[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1954] trunk/scripts



Revision: 1954
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1954&view=rev
Author:   einhverfr
Date:     2007-12-06 12:08:57 -0800 (Thu, 06 Dec 2007)

Log Message:
-----------
Adding customization hooks to scripts/* files

Modified Paths:
--------------
    trunk/scripts/Reconciliation.pl
    trunk/scripts/admin.pl
    trunk/scripts/customer.pl
    trunk/scripts/employee.pl
    trunk/scripts/login.pl
    trunk/scripts/menu.pl
    trunk/scripts/payment.pl
    trunk/scripts/vendor.pl
    trunk/scripts/vouchers.pl

Added Paths:
-----------
    trunk/scripts/custom/

Modified: trunk/scripts/Reconciliation.pl
===================================================================
--- trunk/scripts/Reconciliation.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/Reconciliation.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -239,6 +239,7 @@
     );
 }
 
+eval { do "scripts/custom/Reconciliation.pl"};
 1;
 
 =pod

Modified: trunk/scripts/admin.pl
===================================================================
--- trunk/scripts/admin.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/admin.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -164,4 +164,7 @@
             format=>'HTML', path=>'UI');
     $template->render($user);
 }
-1;
\ No newline at end of file
+
+eval { do "scripts/custom/admin.pl"};
+
+1;

Modified: trunk/scripts/customer.pl
===================================================================
--- trunk/scripts/customer.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/customer.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -210,4 +210,5 @@
     _render_main_screen($customer);
 }
     
+eval { do "scripts/custom/customer.pl"};
 1;

Modified: trunk/scripts/employee.pl
===================================================================
--- trunk/scripts/employee.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/employee.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -210,4 +210,5 @@
     _render_main_screen($employee);
 }
     
+eval { do "scripts/custom/employee.pl"};
 1;

Modified: trunk/scripts/login.pl
===================================================================
--- trunk/scripts/login.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/login.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -108,4 +108,5 @@
     }
 }
     
+eval { do "scripts/custom/login.pl"};
 1;

Modified: trunk/scripts/menu.pl
===================================================================
--- trunk/scripts/menu.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/menu.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -175,4 +175,5 @@
 
 =cut
 
+eval { do "scripts/custom/menu.pl"};
 1;

Modified: trunk/scripts/payment.pl
===================================================================
--- trunk/scripts/payment.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/payment.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -82,15 +82,33 @@
     $template->render($payment);
 }
 
+sub post_payments_bulk {
+    my ($request) = @_;
+    my $payment =  LedgerSMB::DBObject::Payment->new({'base' => $request});
+    $payment->post_bulk();
+    my $template = LedgerSMB::Template->new(
+        user     => $request->{_user},
+        locale   => $request->{_locale},
+        path     => 'UI/payments',
+        template => 'payments_filter',
+        format   => 'HTML', 
+    );
+    $template->render($payment);
+}
+
 sub display_payments {
     my ($request) = @_;
     my $payment =  LedgerSMB::DBObject::Payment->new({'base' => $request});
     $payment->get_payment_detail_data();
+	$payment->debug({file => '/tmp/delme'});
+    for (@{$payment->{contact_invoices}}){
+        $_->{total_due} = $payment->format_amount(amount =>  $_->{total_due});
+    }
     my $template = LedgerSMB::Template->new(
         user     => $request->{_user},
         locale   => $request->{_locale},
         path     => 'UI/payments',
-        template => 'payments_filter',
+        template => 'payments_detail',
         format   => 'HTML', 
     );
     $template->render($payment);
@@ -405,5 +423,6 @@
 eval {$template->render($select) };
 if ($@) { $request->error("$@");  }
 }
- 
+
+eval { do "scripts/custom/payment.pl"};
 1;

Modified: trunk/scripts/vendor.pl
===================================================================
--- trunk/scripts/vendor.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/vendor.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -210,5 +210,6 @@
     $vendor->get();
     _render_main_screen($vendor );
 }
+eval { do "scripts/custom/vendor.pl"};
     
 1;

Modified: trunk/scripts/vouchers.pl
===================================================================
--- trunk/scripts/vouchers.pl	2007-12-06 18:49:23 UTC (rev 1953)
+++ trunk/scripts/vouchers.pl	2007-12-06 20:08:57 UTC (rev 1954)
@@ -33,25 +33,26 @@
     #  This is because these scripts import all functions into the *current*
     #  namespace.  People using fastcgi and modperl should *not* cache this 
     #  module at the moment. -- CT
-    my ($request) = shift @_;
+    #  Also-- request is in 'our' scope here due to the redirect logic.
+    our ($request) = shift @_;
     use LedgerSMB::Form;
 
     my $batch = LedgerSMB::Batch->new({base => $request});
     $batch->{batch_class} = $request->{batch_type};
     $batch->create;
 
-    my $vouchers_dispatch = 
+    our $vouchers_dispatch = 
     {
         payable    => {script => 'bin/ap.pl', function => sub {add()}},
         receivable => {script => 'bin/ar.pl', function => sub {add()}},
         gl         => {script => 'bin/gl.pl', function => sub {add()}},
-        receipts   => {script => 'scripts/payments.pl', 
+        receipt   => {script => 'scripts/payment.pl', 
 	             function => sub {
 				my ($request) = @_;
 				$request->{account_class} = 2;
 				LedgerSMB::Scripts::payment::payments($request);
 				}},
-        payments   => {script => 'scripts/payments.pl', 
+        payment   => {script => 'scripts/payment.pl', 
 	             function => sub {
 				my ($request) = @_;
 				$request->{account_class} = 1;
@@ -73,13 +74,25 @@
     $form->{approved} = 0;
     $form->{transdate} = $request->{batch_date};
 
+    $request->{batch_id} = $batch->{id};
+    $request->{approved} = 0;
+    $request->{transdate} = $request->{batch_date};
 
+
     my $script = $vouchers_dispatch->{$request->{batch_type}}{script};
-    { no strict; no warnings 'redefine'; do $script; }
+    $form->{script} = $script;
+    $form->{script} =~ s|.*/||;
+    if ($script =~ /^bin/){
 
-    $script =~ s|.*/||;
-    $form->{script} = $script;
-    $vouchers_dispatch->{$request->{batch_type}}{function}();
+        { no strict; no warnings 'redefine'; do $script; }
+
+    } elsif ($script =~ /scripts/) {
+
+         { do $script } 
+
+    }
+
+    $vouchers_dispatch->{$request->{batch_type}}{function}($request);
 }
 
 sub get_batch {
@@ -97,4 +110,5 @@
 sub delete_batch {
 }
 
+eval { do "scripts/custom/Voucher.pl"};
 1;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.