[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Seeking help with: ->_create_new_customer_in_lsmb()
- Subject: Seeking help with: ->_create_new_customer_in_lsmb()
- From: Hugh Esco <..hidden..>
- Date: Thu, 29 Jan 2009 12:48:04 -0500
Hello all:
I'm working to integrate an e-commerce site with LedgerSMB.
When the following ->method() is invoked, I see in the error logs:
Can't open config file 'ledgersmb.conf' (no such file or directory) at
/usr/local/ledgersmb/LedgerSMB/Sysconfig.pm line 79
although I very clearly have such a file at /usr/local/ledgersmb.
grep reveals no definition of read_config(), which is the function
throwing this error in code at:
/usr/local/ledgersmb/LedgerSMB/Sysconfig.pm,
reading:
my %config;
read_config( 'ledgersmb.conf' => %config ) or die;
so I added the chdir line below, (as my use lib apparently had not done
the trick) and now see in my logs:
"my" variable $msgid masks earlier declaration in same scope at
/usr/local/ledgersmb/LedgerSMB/Mailer.pm line 59.
"my" variable $query masks earlier declaration in same scope at
/usr/local/ledgersmb/LedgerSMB/User.pm line 869.,
Can't locate object method "new" via package "LedgerSMB::Form" at
/usr/local/share/perl/5.8.8/YMD/WWW/Account.pm line 375.,
although it apprently found that module and that module clearly
has a ->new() method.
If I can work this out, I'd like to distill what I know into
a HOWTO posted at:
http://ledgersmb.frauerpower.com/index.php/Main_Page
perhaps even a CPAN module of glue code until we can fully
expose and document the LSMB API.
Any advice on how to proceed in resolving this issue would
be appreciated.
-- Hugh Esco
And now for my broken, work-in-progress subroutine:
sub _create_new_customer_in_lsmb {
my $self = shift;
my $path_lsmb = $self->{'cfg'}->param("paths.ledger_smb");
print STDERR $path_lsmb,"\n";
chdir "$path_lsmb";
require LedgerSMB::Form;
require LedgerSMB::Session::DB;
$ENV{HTTP_HOST} = $self->{'cfg'}->param("lsmb.http_host");
my $form = LedgerSMB::Form->new();
LedgerSMB::Session::password_check($form,
$self->{'cfg'}->param("lsmb.login"),
$self->{'cfg'}->param("lsmb.password") );
LedgerSMB::Session::DB->session_create( $form );
my $sql = 'SELECT now();';
my $date = $self->{'dbh'}->do($sql);
print STDERR "The \$date is now $date \n";
$form->{'name'} = $self->{'field'}->{'organization'};
$form->{'address1'} = $self->{'field'}->{'addr1'};
$form->{'address2'} = $self->{'field'}->{'addr2'};
$form->{'city'} = $self->{'field'}->{'city'};
$form->{'state'} = $self->{'field'}->{'state'};
$form->{'zip'} = $self->{'field'}->{'zip'};
$form->{'contact'} = $self->{'field'}->{'fname'} . ' ' . $self->{'field'}->{'lname'};
$form->{'phone'} = $self->{'field'}->{'phone'};
$form->{'email'} = $self->{'field'}->{'emails'};
$form->{'startdate'} = $date;
print STDERR Dumper(\$form);
my $myconfig = LedgerSMB::User->fetch_config( $form->{login} );
LedgerSMB::CT->save_customer( $myconfig, $form );
return 1;
}