X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Far.pl;h=d218ff6abced12df33ae5033f82973d887b42de8;hb=f5ab83507b71d551147835d84ec8317afd2842e9;hp=eedf53838a0ae046f7dd8e1990df2aec90c983ba;hpb=1a8377aed5882cfd99554e01c01f4835e5222c88;p=kivitendo-erp.git diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index eedf53838..d218ff6ab 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -36,7 +36,7 @@ use SL::IS; use SL::PE; use Data::Dumper; -require "$form->{path}/arap.pl"; +require "bin/mozilla/arap.pl"; require "bin/mozilla/common.pl"; require "bin/mozilla/drafts.pl"; @@ -79,6 +79,7 @@ sub add { # saving the history if(!exists $form->{addition} && ($form->{id} ne "")) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "ADDED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -86,7 +87,7 @@ sub add { $form->{title} = "Add"; $form->{callback} = - "$form->{script}?action=add&path=$form->{path}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=add&login=$form->{login}&password=$form->{password}" unless $form->{callback}; AR->get_transdate(\%myconfig, $form); @@ -102,7 +103,7 @@ sub edit { # show history button $form->{javascript} = qq||; #/show hhistory button - + $form->{javascript} .= qq||; $form->{title} = "Edit"; &create_links; @@ -322,7 +323,7 @@ sub form_header { # show history button js $form->{javascript} .= qq||; #/show history button js - + $form->{javascript} .= qq||; $readonly = ($form->{id}) ? "readonly" : ""; $form->{radier} = @@ -470,18 +471,18 @@ selectcustomer}| $form->{fokus} = "arledger.customer"; # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { # with JavaScript Calendar $button1 = qq| - {transdate}> + text('button') . qq|> |; $button2 = qq| - {duedate}> + text('button') . qq|> |; @@ -494,15 +495,21 @@ selectcustomer}| # without JavaScript Calendar $button1 = - qq|{transdate}>|; + qq||; $button2 = - qq|{duedate}>|; + qq||; } - $form->header; + $form->{javascript} .= + qq|| . + qq||; + $form->header; + $onload = qq|focus()|; + $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| - +
{script}> @@ -527,7 +534,7 @@ selectcustomer}| - + @@ -787,12 +794,12 @@ $jsscript |; $column_data{paid} = - qq||; + qq||; $column_data{AR_paid} = qq||; $column_data{exchangerate} = qq||; $column_data{datepaid} = - qq||; $column_data{source} = qq||; @@ -840,7 +847,6 @@ sub form_footer { -{path}> {login}> {password}> | @@ -896,7 +902,7 @@ sub form_footer { } if ($form->{menubar}) { - require "$form->{path}/menu.pl"; + require "bin/mozilla/menu.pl"; &menubar; } # button for saving history @@ -1013,7 +1019,7 @@ sub update { sub post_payment { $lxdebug->enter_sub(); for $i (1 .. $form->{paidaccounts}) { - if ($form->{"paid_$i"}) { + if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) { $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); $form->isblank("datepaid_$i", $locale->text('Payment date missing!')); @@ -1050,9 +1056,17 @@ sub post { $closedto = $form->datetonum($form->{closedto}, \%myconfig); $transdate = $form->datetonum($form->{transdate}, \%myconfig); + $form->error($locale->text('Cannot post transaction for a closed period!')) if ($transdate <= $closedto); + + my $zero_amount_posting = 1; + for $i (1 .. $form->{rowcount}) { + if ($form->parse_amount(\%myconfig, $form->{"amount_$i"})) { + $zero_amount_posting = 0; + last; + } + } - $form->error($locale->text('Cannot post transaction for a closed period!')) - if ($transdate <= $closedto); + $form->error($locale->text('Zero amount posting!')) if $zero_amount_posting; $form->isblank("exchangerate", $locale->text('Exchangerate missing!')) if ($form->{currency} ne $form->{defaultcurrency}); @@ -1090,6 +1104,7 @@ sub post { if (AR->post_transaction(\%myconfig, \%$form)) { # saving the history if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1108,6 +1123,7 @@ sub post_as_new { $form->{postasnew} = 1; # saving the history if(!exists $form->{addition} && $form->{id} ne "") { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED AS NEW"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1172,6 +1188,7 @@ sub yes { if (AR->delete_transaction(\%myconfig, \%$form, $spool)) { # saving the history if(!exists $form->{addition}) { + $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; $form->save_history($form->dbconnect(\%myconfig)); } @@ -1215,20 +1232,22 @@ sub search { | if $form->{selectdepartment}; $form->{title} = $locale->text('AR Transactions'); - + + $form->{javascript} .= qq||; + # use JavaScript Calendar or not - $form->{jsscript} = $jscalendar; + $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { # with JavaScript Calendar $button1 = qq| - |; $button2 = qq| - |; @@ -1241,9 +1260,9 @@ sub search { # without JavaScript Calendar $button1 = qq| - |; + |; $button2 = qq| - |; + |; } $form->get_lists("projects" => { "key" => "ALL_PROJECTS", @@ -1261,9 +1280,11 @@ sub search { $form->{fokus} = "search.customer"; $form->header; - + $onload = qq|focus()|; + $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; + $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; print qq| - +{script}> @@ -1286,6 +1307,10 @@ sub search { + + + + @@ -1362,6 +1387,8 @@ sub search { + +
| . $locale->text('Customer') . qq|$customer$customer {"paid_$i"}>${selectAR_paid}$exchangerate{"datepaid_$i"}> + qq| + text('button') . qq|> + text('button') . qq|> | . $locale->text('Order Number') . qq|
| . $locale->text('Transaction description') . qq|
| . $locale->text('Notes') . qq| | . $locale->text('Subtotal') . qq| | . $locale->text('Project Number') . qq|| . $locale->text('Transaction description') . qq|
@@ -1376,7 +1403,6 @@ sub search { {nextsub}> -{path}> {login}> {password}> @@ -1405,7 +1431,7 @@ sub ar_transactions { AR->ar_transactions(\%myconfig, \%$form); $callback = - "$form->{script}?action=ar_transactions&path=$form->{path}&login=$form->{login}&password=$form->{password}"; + "$form->{script}?action=ar_transactions&login=$form->{login}&password=$form->{password}"; $href = $callback; if ($form->{customer}) { @@ -1438,6 +1464,12 @@ sub ar_transactions { $option .= "\n
" if $option; $option .= $locale->text('Notes') . " : $form->{notes}"; } + if ($form->{transaction_description}) { + $callback .= "&transaction_description=" . $form->escape($form->{transaction_description}, 1); + $href .= "&transaction_description=" . $form->escape($form->{transaction_description}); + $option .= "\n
" if $option; + $option .= $locale->text('Transaction description') . " : $form->{transaction_description}"; + } if ($form->{transdatefrom}) { $callback .= "&transdatefrom=$form->{transdatefrom}"; @@ -1474,7 +1506,7 @@ sub ar_transactions { @columns = qw(transdate id type invnumber ordnumber name netamount tax amount paid - datepaid due duedate notes employee shippingpoint shipvia + datepaid due duedate transaction_description notes employee shippingpoint shipvia globalprojectnumber); $form->{"l_type"} = "Y"; @@ -1550,6 +1582,8 @@ sub ar_transactions { . ""; $column_header{globalprojectnumber} = qq|| . $locale->text('Project Number') . qq||; + $column_header{transaction_description} = + "" . $locale->text('Transaction description') . ""; $form->{title} = $locale->text('AR Transactions'); @@ -1635,12 +1669,18 @@ sub ar_transactions { $module = ($ar->{invoice}) ? "is.pl" : $form->{script}; $column_data{invnumber} = - "{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}"; + "{id}&login=$form->{login}&password=$form->{password}&callback=$callback>$ar->{invnumber}"; + + my $is_storno = $ar->{storno} && ($ar->{invnumber} =~ /^Storno zu/); + my $has_storno = $ar->{storno} && !$is_storno; + $column_data{type} = "" . - ($ar->{storno} ? $locale->text("Storno (one letter abbreviation)") : - $ar->{amount} < 0 ? - $locale->text("Credit note (one letter abbreviation)") : - $locale->text("Invoice (one letter abbreviation)")) . ""; + ($has_storno ? $locale->text("Invoice with Storno (abbreviation)") : + $is_storno ? $locale->text("Storno (one letter abbreviation)") : + $ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") : + $ar->{invoice} ? $locale->text("Invoice (one letter abbreviation)") : + $locale->text("AR Transaction (abbreviation)")) + . ""; $column_data{ordnumber} = "$ar->{ordnumber} "; $column_data{name} = "$ar->{name}"; $ar->{notes} =~ s/\r\n/
/g; @@ -1650,6 +1690,8 @@ sub ar_transactions { $column_data{employee} = "$ar->{employee} "; $column_data{globalprojectnumber} = "" . H($ar->{globalprojectnumber}) . ""; + $column_data{transaction_description} = + "" . H($ar->{transaction_description}) . ""; $i++; $i %= 2; @@ -1710,7 +1752,6 @@ sub ar_transactions { -{path}> {login}> {password}>