From bb74dcef1ff3d6eb73bdde38eb11320590b2c011 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 20 Nov 2007 07:36:30 +0000 Subject: Customer screen now renders reasonably well. TODO: Needs a lot of CSS work to beautify. Also CSS/Javascript could be used to create a tabbed interface for this screen. Also, a lot of issues with stored procedures have been fixed. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1880 4979c152-3d1c-0410-bac9-87ea11338e46 --- scripts/customer.pl | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/customer.pl b/scripts/customer.pl index 76fa8a56..988538a8 100644 --- a/scripts/customer.pl +++ b/scripts/customer.pl @@ -72,6 +72,9 @@ sub add { my ($request) = @_; my $customer = LedgerSMB::DBObject::Customer->new(base => $request, copy => 'all'); $customer->set(entity_class=>2); + + $customer->get_metadata(); + my $template = LedgerSMB::Template->new( user => $user, template => 'customer', @@ -79,7 +82,7 @@ sub add { locale => $request->{_locale}, format => 'HTML'); $request->{script} = 'Customer/customer'; - $template->render($request); + $template->render($customer); } =pod @@ -145,26 +148,16 @@ customer as needed, and will generate a new Company ID for the customer if neede sub save { my ($request) = @_; - - if ($request->type() == 'POST') { - - my $customer = LedgerSMB::DBObject::Customer->get(base=>$request, copy=>'all'); - - unless ($customer) { - - $customer = LedgerSMB::DBObject::Customer->new(base=>$reqest, copy=>'all'); - } - - my $result = $customer->save(); - my $template = LedgerSMB::Template->new( user => $user, - template => 'Customer/customer', language => $user->{language}, + my $customer = LedgerSMB::DBObject::Customer->new({base => $request}); + + my $result = $customer->save(); + + my $template = LedgerSMB::Template->new( user => $request->{_user}, + template => 'customer', locale => $request->{_locale}, + path => 'UI/Customer', format => 'HTML'); - $template->render($result); - } - else { - - } + $template->render($customer); } 1; -- cgit v1.2.3