App-LedgerSMB-Admin

 view release on metacpan or  search on metacpan

bin/lsmb_createdb  view on Meta::CPAN

The following options are supported:

   --help                   Print this message and exit
   --host hostname          Database Host
   --path /example/path     Path to LedgerSMB installation (required)
   --chart us/chart/General Chart of Accounts path (relative to sql)
   --gifi  ca/gifi/General  Path to GIFI
   --port 5432              Database Port
   --dbname database        Create db with the following name (required)
   --username postgres      Database Superuser to Log In As
   --prompt-password        Prompt for Password (can use PGPASSWORD instead)
|;

my ($all, $help, $host, $port, $path, $dbname, $username, $promptpasswd,
  $chart, $gifi);

GetOptions('all'               => \$all,
           'help'              => \$help,
           'chart=s'           => \$chart,
           'gifi=s'            => \$gifi,
           'host=s'            => \$host,
           'port=s'            => \$port,
           'username=s'        => \$username, 
           'prompt-password'   => \$promptpasswd,
           'path=s'            => \$path,
           'dbname=s'          => \$dbname
);

if ($help or !$dbname){
   print $helpmsg;
   exit 0;
}

my $passwd;

bin/lsmb_createdb  view on Meta::CPAN

App::LedgerSMB::Admin->add_paths($major => $path);
close LSMB;


## set up db connection

my $db = App::LedgerSMB::Admin::Database->new(
   host     => $host,
   port     => $port,
   username => $username,
   password => $password,
   dbname   => $dbname,
);

## do the actual work

$db->create;
$db->load($major);
$chart =~ s/\.sql$// if $chart;
$gifi =~ s/\.sql$// if $gifi ;
$db->run_file("$path/sql/$chart.sql") if $chart;

bin/lsmb_reload  view on Meta::CPAN


   --all                    Reload All Databases
   --help                   Print this message and exit
   --host hostname          Database Host
   --path13 /example/path   Path to LedgerSMB 1.3 installation
   --path14 /example/path2  Path to LedgerSMB 1.4 installation
   --path15 /example/path2  Path to LedgerSMB 1.5 installation
   --port 5432              Database Port
   --dbname database        Reload the specified db, overridden by --all
   --username postgres      Database Superuser to Log In As
   --prompt-password        Prompt for Password (can use PGPASSWORD instead)
|;

my ($all, $help, $host, $port, $path13, $path14, $dbname, 
    $username, $promptpasswd);

GetOptions('all'               => \$all,
           'help'              => \$help,
           'host=s'            => \$host,
           'port=s'            => \$port,
           'username=s'        => \$username, 
           'prompt-password'   => \$promptpasswd,
           'path13=s'          => \$path13,
           'path14=s'          => \$path14,
           'path15=s'          => \$path15,
           'dbname=s'          => \$dbname
);

if ($help){
   print $helpmsg;
   exit 0;
}

bin/lsmb_reload  view on Meta::CPAN

   $lsmbversion->{1.5} = $1;
   warn $lsmbversion->{1.5};
   close LSMB;
}
## set up db connection

my $db = App::LedgerSMB::Admin::Database->new(
   host     => $host,
   port     => $port,
   username => $username,
   password => $password,
   dbname   => $dbname,
);

## do the actual work

if ($all){
  for my $dbhame ($db->list_dbs){
     my $working_db = $db->new($db->export, dbname => $dbname);
     do_reload($working_db) if eval { $working_db->major_version };
  }

lib/App/LedgerSMB/Admin.pm  view on Meta::CPAN

The following options are supported:

   --all                    Reload All Databases
   --help                   Print this message and exit
   --host hostname          Database Host
   --path13 /example/path   Path to LedgerSMB 1.3 installation
   --path14 /example/path2  Path to LedgerSMB 1.4 installation
   --port 5432              Database Poart
   --dbname database        Reload the specified db, overridden by --all
   --username postgres      Database Superuser to Log In As
   --prompt-password        Prompt for Password (can use PGPASSWORD instead)


=head2 lsmb_createdb

Due to improper errors, this currently does not work properly with LedgerSMB
1.3.  It is expected that it will following the LedgerSMB 1.3.45 release
(forthcoming).

The lsmb_reload application provides a command line tool for upgrading or
rebuilding stored procedures and permissions of a LedgerSMB 1.3 or 1.4 database.

   --help                   Print this message and exit
   --host hostname          Database Host
   --path /example/path     Path to LedgerSMB installation (required)
   --chart us/chart/General Chart of Accounts path (relative to sql)
   --gifi  ca/gifi/General  Path to GIFI
   --port 5432              Database Poart
   --dbname database        Create db with the following name (required)
   --username postgres      Database Superuser to Log In As
   --prompt-password        Prompt for Password (can use PGPASSWORD instead)

=head1 Bundled Libraries

=head2 App::LedgerSMB::Admin

Provides base version tracking and management routines

=head2 App::LedgerSMB::Admin::Database

Routines to reload, create, update, backup, and restore databases

lib/App/LedgerSMB/Admin/Database.pm  view on Meta::CPAN

Upgrading to 1.4 from 1.3, after updating 1.3 instance to latest:

  use App::LedgerSMB::Admin;
  use App::LedgerSMB::Admin::Database;
  App::LedgerSMB::Admin->add_paths(
     '1.3' => '/usr/local/ledgersmb_1.3',
     '1.4' => '/usr/local/ledgersmb_1.4',
  ); # setting the version paths
  my $db = App::LedgerSMB::Admin::Database->new(
     username  => 'postgres',
     password  => 'secretpassword',
     host      => 'localhost',
     port      => '5432',
     dbname    => 'mycompany',
  );
  if ($db->major_version eq '1.3') {
      $db->reload;
      $db->upgrade_to('1.4');
  }

=head1 VERSION

lib/App/LedgerSMB/Admin/Database.pm  view on Meta::CPAN

=cut

our $VERSION=0.04;

=head1 PROPERTIES INHERITED FROM PGObject::Util::DBAdmin

Please see the docs for PGObject::Util::DBAdmin.

=head2 username 

=head2 password

=head2 host

=head2 port

=head2 dbname

=head1 ADDITIONAL PROPERTIES

=head2 version

lib/App/LedgerSMB/Admin/Database/Setting.pm  view on Meta::CPAN

    my ($self) = @_;
    return $self->database->connect;
}

sub _get_prefix { 'setting_' };

=head1 SYNOPSIS

 my $db = App::LedgerSMB::Admin::Database->new(
      username => 'postgres',
      password => 'secret',
      host     => 'localhost',
      port     => '5432',
 );
 my $setting = App::LedgerSMB::Admin::Database::Setting->new(
     database    => $db,
     setting_key => 'separate_duties');
 my $sep_duties = $setting->value;

=head1 PROPERTIES

lib/App/LedgerSMB/Admin/User.pm  view on Meta::CPAN

    first_name  => 'Chris',
    last_name   => 'Travers',
    is_employee => 0,
    is_person   => 1,
    username    => 'chris',
    temp_pass   => 'foobarbaz',
    country_id  => '232',
    database    => App::LedgerSMB::Admin::Database->new(
                       dbname => 'lsmb13',
                     username => 'postgres',
                     password => 'secret',
                         host => 'localhost',
                         port => '5432',
                   ),
 );
 $user->assign_roles($user->list_roles);
 $user->save;

=head1 PROPERTIES

=head2 database

lib/App/LedgerSMB/Admin/User.pm  view on Meta::CPAN

                   unless eval { $_[0]->isa('App::LedgerSMB::Admin::Database')};
                },
);

=head2 username

=cut

has username => (is => 'ro');

=head2 password

=cut

has password => (is => 'ro');

=head2 first_name

=cut

has first_name => (is => 'ro');

=head2 last_name

=cut

lib/App/LedgerSMB/Admin/User.pm  view on Meta::CPAN

=head2 get

=cut

dbmethod get => (funcname => 'get_user');

=head2 reset_passwd

=cut

dbmethod reset_password => (funcname => 'save_user');

=head1 LICENSE AND COPYRIGHT

Copyright 2014 Chris Travers.

This program is distributed under the (Revised) BSD License:
L<http://www.opensource.org/licenses/BSD-3-Clause>

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions



( run in 0.305 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )