summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-06 20:08:57 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-06 20:08:57 +0000
commit54f827658f696a0cf3209b19d432a624f1f6b02b (patch)
tree3ef916dd96794f938509674af74e1fa89b711a6c /scripts
parentf09e568a681b8fb0b9755b1c3e452ee8801766ac (diff)
Adding customization hooks to scripts/* files
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1954 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Reconciliation.pl1
-rw-r--r--scripts/admin.pl5
-rw-r--r--scripts/customer.pl1
-rw-r--r--scripts/employee.pl1
-rw-r--r--scripts/login.pl1
-rw-r--r--scripts/menu.pl1
-rw-r--r--scripts/payment.pl23
-rw-r--r--scripts/vendor.pl1
-rw-r--r--scripts/vouchers.pl30
9 files changed, 53 insertions, 11 deletions
diff --git a/scripts/Reconciliation.pl b/scripts/Reconciliation.pl
index 8826f037..d648ae35 100644
--- a/scripts/Reconciliation.pl
+++ b/scripts/Reconciliation.pl
@@ -239,6 +239,7 @@ sub corrections {
);
}
+eval { do "scripts/custom/Reconciliation.pl"};
1;
=pod
diff --git a/scripts/admin.pl b/scripts/admin.pl
index 2b8ca816..49274abf 100644
--- a/scripts/admin.pl
+++ b/scripts/admin.pl
@@ -164,4 +164,7 @@ sub __default {
format=>'HTML', path=>'UI');
$template->render($user);
}
-1; \ No newline at end of file
+
+eval { do "scripts/custom/admin.pl"};
+
+1;
diff --git a/scripts/customer.pl b/scripts/customer.pl
index ab9a6919..1834da7a 100644
--- a/scripts/customer.pl
+++ b/scripts/customer.pl
@@ -210,4 +210,5 @@ sub save_notes {
_render_main_screen($customer);
}
+eval { do "scripts/custom/customer.pl"};
1;
diff --git a/scripts/employee.pl b/scripts/employee.pl
index b265dba5..5de34870 100644
--- a/scripts/employee.pl
+++ b/scripts/employee.pl
@@ -210,4 +210,5 @@ sub save_notes {
_render_main_screen($employee);
}
+eval { do "scripts/custom/employee.pl"};
1;
diff --git a/scripts/login.pl b/scripts/login.pl
index f74a6164..02a188cf 100644
--- a/scripts/login.pl
+++ b/scripts/login.pl
@@ -108,4 +108,5 @@ sub continue {
}
}
+eval { do "scripts/custom/login.pl"};
1;
diff --git a/scripts/menu.pl b/scripts/menu.pl
index f873398f..01343318 100644
--- a/scripts/menu.pl
+++ b/scripts/menu.pl
@@ -175,4 +175,5 @@ files.
=cut
+eval { do "scripts/custom/menu.pl"};
1;
diff --git a/scripts/payment.pl b/scripts/payment.pl
index 551ebf90..f11a06c7 100644
--- a/scripts/payment.pl
+++ b/scripts/payment.pl
@@ -82,15 +82,33 @@ sub payments {
$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 @@ my $template = LedgerSMB::Template->new(
eval {$template->render($select) };
if ($@) { $request->error("$@"); }
}
-
+
+eval { do "scripts/custom/payment.pl"};
1;
diff --git a/scripts/vendor.pl b/scripts/vendor.pl
index 6fa2cf77..01653916 100644
--- a/scripts/vendor.pl
+++ b/scripts/vendor.pl
@@ -210,5 +210,6 @@ sub save_notes {
$vendor->get();
_render_main_screen($vendor );
}
+eval { do "scripts/custom/vendor.pl"};
1;
diff --git a/scripts/vouchers.pl b/scripts/vouchers.pl
index c779e887..f8474556 100644
--- a/scripts/vouchers.pl
+++ b/scripts/vouchers.pl
@@ -33,25 +33,26 @@ sub create_vouchers {
# 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 @@ sub create_vouchers {
$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; }
- $script =~ s|.*/||;
+ my $script = $vouchers_dispatch->{$request->{batch_type}}{script};
$form->{script} = $script;
- $vouchers_dispatch->{$request->{batch_type}}{function}();
+ $form->{script} =~ s|.*/||;
+ if ($script =~ /^bin/){
+
+ { 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 approve_batch {
sub delete_batch {
}
+eval { do "scripts/custom/Voucher.pl"};
1;