From 6c5c1c36fa682244c355f6c06808ec715f0a2baa Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 26 Apr 2007 20:28:38 +0000 Subject: Merging bugfixes from current branches/1.2 git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1105 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/aa.pl | 12 ++++-- bin/admin.pl | 124 ++++++--------------------------------------------------- bin/am.pl | 8 ++-- bin/arapprn.pl | 6 +-- bin/cp.pl | 34 ++++++++++------ bin/ic.pl | 4 +- bin/io.pl | 15 +++---- bin/ir.pl | 23 +++++++---- bin/is.pl | 20 ++++++---- bin/jc.pl | 17 +------- bin/login.pl | 6 --- bin/oe.pl | 9 +++-- bin/pos.pl | 15 +++---- 13 files changed, 98 insertions(+), 195 deletions(-) (limited to 'bin') diff --git a/bin/aa.pl b/bin/aa.pl index 08a766f2..f4e6c1b1 100644 --- a/bin/aa.pl +++ b/bin/aa.pl @@ -117,6 +117,14 @@ sub display_form { } sub create_links { + if ( $form->{script} eq 'ap.pl' ) { + $form->{ARAP} = 'AP'; + $form->{vc} = 'vendor'; + } + elsif ( $form->{script} eq 'ar.pl' ) { + $form->{ARAP} = 'AR'; + $form->{vc} = 'customer'; + } $form->create_links( $form->{ARAP}, \%myconfig, $form->{vc} ); @@ -1481,13 +1489,12 @@ qq| | } sub transactions { - if ( $form->{ $form->{vc} } ) { $form->{ $form->{vc} } = $form->unescape( $form->{ $form->{vc} } ); ( $form->{ $form->{vc} }, $form->{"$form->{vc}_id"} ) = split( /--/, $form->{ $form->{vc} } ); } - + my @column_index; AA->transactions( \%myconfig, \%$form ); $href = "$form->{script}?action=transactions"; @@ -1640,7 +1647,6 @@ sub transactions { $href .= "&l_$item=Y"; } } - if ( !$form->{summary} ) { foreach $item (qw(source debit credit accno description projectnumber)) { diff --git a/bin/admin.pl b/bin/admin.pl index 2754dac4..187235b3 100644 --- a/bin/admin.pl +++ b/bin/admin.pl @@ -155,7 +155,7 @@ sub login { } sub logout { - + $form->{login} = 'admin'; $form->{callback} = "admin.pl?action=adminlogin"; Session::session_destroy($form); $form->redirect( $locale->text('You are logged out') ); @@ -224,11 +224,13 @@ sub list_users { my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH}; my $fetchMembers = $dbh->selectall_arrayref( -"SELECT uc.name, uc.company, uc.templates, uc.dbuser, uc.dbdriver, uc.dbname, uc.dbhost, u.username - FROM users as u, users_conf as uc - WHERE u.id = uc.id - AND u.id > 1 - ORDER BY u.username;", { Slice => {} } + "SELECT uc.name, uc.company, uc.templates, + uc.dbuser, uc.dbdriver, uc.dbname, + uc.dbhost, u.username + FROM users as u, users_conf as uc + WHERE u.id = uc.id + AND u.id > 1 + ORDER BY u.username;", { Slice => {} } ); my @memberArray = (); @@ -327,7 +329,6 @@ sub list_users { . qq| $dbdrivers - $nologin

- - - - |; -} - sub unlock_system { # This needs to be done with a db tool diff --git a/bin/am.pl b/bin/am.pl index 1764384d..1eaec1f0 100644 --- a/bin/am.pl +++ b/bin/am.pl @@ -1527,7 +1527,7 @@ sub save_language { foreach $file (@templates) { if ( -f "$myconfig{templates}/$file" ) { - open( TEMP, '<', "$myconfig{templates}/$file" ) + open( TEMP, '<,', "$myconfig{templates}/$file" ) or $form->error("$myconfig{templates}/$file : $!"); open( NEW, '>', "$myconfig{templates}/$form->{code}/$file" ) @@ -2291,9 +2291,9 @@ sub config {
{script}> - + - + @@ -2337,7 +2337,7 @@ sub config {
$form->{title}
- + diff --git a/bin/arapprn.pl b/bin/arapprn.pl index ceae64be..223518d0 100644 --- a/bin/arapprn.pl +++ b/bin/arapprn.pl @@ -256,9 +256,8 @@ sub print_check { %queued = split / /, $form->{queued}; - $form->{OUT} = "| ${LedgerSMB::Sysconfig::printer}{$form->{media}}"; + $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} }; $form->{printmode} = '|-'; - if ( $form->{printed} !~ /$form->{formname}/ ) { $form->{printed} .= " $form->{formname}"; @@ -381,7 +380,6 @@ sub print_transaction { $form->parse_amount( \%myconfig, $form->{"amount_$i"} ); } - foreach $accno ( split / /, $form->{taxaccounts} ) { if ( $form->{"tax_$accno"} ) { $form->format_string("${accno}_description"); @@ -530,7 +528,7 @@ sub print_transaction { } if ( $form->{media} !~ /(queue|screen)/ ) { - $form->{OUT} = "${LedgerSMB::Sysconfig::printer}{$form->{media}}"; + $form->{OUT} = ${LedgerSMB::Sysconfig::printer}{ $form->{media} }; $form->{printmode} = '|-'; if ( $form->{printed} !~ /$form->{formname}/ ) { diff --git a/bin/cp.pl b/bin/cp.pl index c643b7d8..6a9fc309 100644 --- a/bin/cp.pl +++ b/bin/cp.pl @@ -45,9 +45,6 @@ # #====================================================================== -use Error qw(:try); - -use LedgerSMB::Template; use LedgerSMB::CP; use LedgerSMB::OP; use LedgerSMB::IS; @@ -59,6 +56,12 @@ require "bin/arap.pl"; # end of main +# This may need to get more sophisticated in the future +# Anyway, it provides one point of control for date handling. +sub default_date { + $form->{date} ||= 'current_date'; +} + sub payment { if ( $form->{type} eq 'receipt' ) { @@ -420,12 +423,13 @@ sub invoices_due { $totalamount += $form->{"amount_$i"}; $totaldue += $form->{"due_$i"}; - if ( $form->{"paid_$i"} !~ /NaN/ ) { - $totalpaid += $form->{"paid_$i"}; + if ( $form->{"paid_$i"} =~ /NaN/ ) { + $form->{"paid_$i"} = ''; } else { - $form->{"paid_$i"} = ''; + $totalpaid += $form->{"paid_$i"}; } + for (qw(amount due paid)) { $form->{"${_}_$i"} = $form->format_amount( \%myconfig, $form->{"${_}_$i"}, 2 ); @@ -441,6 +445,9 @@ sub invoices_due { $column_data{due} = qq|{"due_$i"}>|; + if ( $form->{"paid_$i"} =~ /NaN/ ) { + $form->{"paid_$i"} = ''; + } $column_data{paid} = qq||; @@ -1147,10 +1154,7 @@ sub list_invoices { $totalamount += $form->{"amount_$i"}; $totaldue += $form->{"due_$i"}; - if ( $form->{"paid_$i"} =~ /NaN/ ) { - $form->{"paid_$i"} = ''; - } - else { + if ( $form->{"paid_$i"} !~ /NaN/ ) { $totalpaid += $form->{"paid_$i"}; } @@ -1170,6 +1174,10 @@ sub list_invoices { $column_data{due} = qq|{"due_$i"}>|; + if ( $form->{"paid_$i"} =~ /NaN/ ) { + $form->{"paid_$i"} = ''; + } + $column_data{paid} = qq||; @@ -1307,7 +1315,10 @@ sub payment_footer { } -sub post { &{"post_$form->{payment}"} } +sub post { + &default_date; + &{"post_$form->{payment}"}; +} sub post_payments { @@ -1533,7 +1544,6 @@ sub check_form { $form->error( $locale->text('Cannot post payment for a closed period!') ) if ( $datepaid <= $closedto ); - # this is just to format the year $form->{datepaid} = $locale->date( \%myconfig, $form->{datepaid} ); $amount = $form->parse_amount( \%myconfig, $form->{amount} ); diff --git a/bin/ic.pl b/bin/ic.pl index 50de73fd..5ca97516 100644 --- a/bin/ic.pl +++ b/bin/ic.pl @@ -3642,8 +3642,8 @@ sub save { $form->{"${_}_base"} += $amount; } if ( !$form->{taxincluded} ) { - my @taxlist = - Tax::init_taxes( $form, $form->{"taxaccounts_$i"} ); + my @taxlist = Tax::init_taxes( $form, $form->{"taxaccounts_$i"}, + $form->{taxaccounts} ); $amount += Tax::calculate_taxes( \@taxlist, $form, $amount, 0 ); } diff --git a/bin/io.pl b/bin/io.pl index 48c2caa0..4c41462d 100644 --- a/bin/io.pl +++ b/bin/io.pl @@ -576,7 +576,7 @@ sub item_selected { $form->{"${_}_$i"} = $form->{"new_${_}_$j"}; } $form->{"sellprice_$i"} = $form->{"new_sellprice_$j"} - unless $form->{"sellprice_$i"}; + if not $form->{"sellprice_$i"}; $form->{"partsgroup_$i"} = qq|$form->{"new_partsgroup_$j"}--$form->{"new_partsgroup_id_$j"}|; @@ -622,8 +622,8 @@ sub item_selected { $form->{"${_}_base"} += $amount; } if ( !$form->{taxincluded} ) { - my @taxlist = - Tax::init_taxes( $form, $form->{"taxaccounts_$i"} ); + my @taxlist = Tax::init_taxes( $form, $form->{"taxaccounts_$i"}, + $form->{taxaccounts} ); $amount += Tax::calculate_taxes( \@taxlist, $form, $amount, 0 ); } @@ -696,7 +696,7 @@ sub new_item { } $i = $form->{rowcount}; - for (qw(partnumber description sellprice unit)) { + for (qw(partnumber description)) { $form->{"${_}_$i"} = $form->quote( $form->{"${_}_$i"} ); } @@ -1366,8 +1366,8 @@ sub print_options { {grouppartsgroup}> | . $locale->text('Group') . qq| - +
| . $locale->text('Password') . qq|
| . $locale->text('Confirm') . qq|$form->{"due_$i"} {"paid_$i"}>$form->{"due_$i"} {"paid_$i"}>
| . $locale->text('Sort by') . qq| -> @@ -1404,7 +1404,6 @@ sub print { sub print_form { my ($old_form) = @_; - $inv = "inv"; $due = "due"; @@ -1569,7 +1568,6 @@ sub print_form { else { IS->invoice_details( \%myconfig, \%$form ); } - if ( exists $form->{longformat} ) { $form->{"${due}date"} = $duedate; for ( "${inv}date", "${due}date", "shippingdate", "transdate" ) { @@ -1640,9 +1638,8 @@ sub print_form { $form->{pre} = "\n
" if $form->{format} eq 'txt';
 
     if ( $form->{media} !~ /(screen|queue|email)/ ) {
-        $form->{OUT}       = "${LedgerSMB::SysConfig::printer}{$form->{media}}";
+        $form->{OUT}       = ${LedgerSMB::Sysconfig::printer}{ $form->{media} };
         $form->{printmode} = '|-';
-
         $form->{OUT} =~ s/<%(fax)%>/<%$form->{vc}$1%>/;
         $form->{OUT} =~ s/<%(.*?)%>/$form->{$1}/g;
 
diff --git a/bin/ir.pl b/bin/ir.pl
index 87866777..50c7c51f 100644
--- a/bin/ir.pl
+++ b/bin/ir.pl
@@ -484,12 +484,13 @@ qq|