X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=6b94e2c9a9e37cef3012d6d917072c88594a61f2;hb=a25ac4907df1aca0db5fd0017b96e5d0bc5eadf1;hp=501d885ddbee6ba04c3c2b64a4a699308739d28c;hpb=e4cc127ad5e8b572a747de9be85ebccd4a73a953;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 501d885dd..6b94e2c9a 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -69,8 +69,6 @@ sub add { } &invoice_links; &prepare_invoice; - $form->{format} = "pdf"; - &display_form; $lxdebug->leave_sub(); @@ -138,6 +136,7 @@ sub invoice_links { $cp_id = $form->{cp_id}; IS->get_customer(\%myconfig, \%$form); + #quote all_customer Bug 133 foreach $ref (@{ $form->{all_customer} }) { $ref->{name} = $form->quote($ref->{name}); @@ -170,7 +169,7 @@ sub invoice_links { $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}"; - if ($form->{all_customer}) { + if (@{ $form->{all_customer} }) { $form->{customer} = "$form->{customer}--$form->{customer_id}"; map { $form->{selectcustomer} .= "|; foreach $item (@{ $form->{payment_terms} }) { if ($form->{payment_id} eq $item->{id}) { @@ -319,16 +322,22 @@ sub form_header { } } + my $set_duedate_url = + "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=set_duedate"; + + my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url ); + push(@ { $form->{AJAX} }, $pjx); if (@{ $form->{TAXZONE} }) { $form->{selecttaxzone} = ""; foreach $item (@{ $form->{TAXZONE} }) { if ($item->{id} == $form->{taxzone_id}) { $form->{selecttaxzone} .= - ""; + ""; } else { $form->{selecttaxzone} .= - ""; + ""; } } @@ -338,11 +347,6 @@ sub form_header { $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/; } } - if ($form->{rowcount} >0) { - $form->{selecttaxzone} =~ /"; foreach $item (@{ $form->{SHIPTO} }) { - if ($item->{id} == $form->{shipto_id}) { + if ($item->{shipto_id} == $form->{shipto_id}) { $form->{selectshipto} .= - ""; + ""; } else { $form->{selectshipto} .= - ""; + ""; } } } else { + $form->{selectshipto} = $form->unquote($form->{selectshipto}); $form->{selectshipto} =~ s/ selected//g; if ($form->{shipto_id} ne "") { $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/; @@ -373,8 +378,9 @@ sub form_header { $shipto = qq| | . $locale->text('Shipping Address') . qq| - - |; + |; + $form->{selectshipto} = $form->quote($form->{selectshipto}); + $shipto .= qq| |; @@ -576,6 +582,8 @@ sub form_header { $onload = qq|alert('$credittext')|; } + $form->{"javascript"} .= qq||; + $form->header; print qq| @@ -659,7 +667,7 @@ sub form_header { $dunning | . $locale->text('Record in') . qq| - + $taxzone @@ -906,7 +914,7 @@ sub form_footer { $notes $intnotes - $payment @@ -997,6 +1005,8 @@ if ($form->{type} eq "credit_note") { "; + my @triggers = (); + $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); for $i (1 .. $form->{paidaccounts}) { @@ -1009,8 +1019,10 @@ if ($form->{type} eq "credit_note") { # format amounts $totalpaid += $form->{"paid_$i"}; - $form->{"paid_$i"} = - $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); + if ($form->{"paid_$i"}) { + $form->{"paid_$i"} = + $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); + } $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); @@ -1035,7 +1047,8 @@ if ($form->{type} eq "credit_note") { $column_data{"AR_paid_$i"} = qq||; $column_data{"datepaid_$i"} = - qq|{"datepaid_$i"}>|; + qq|{"datepaid_$i"}> + |; $column_data{"source_$i"} = qq||; $column_data{"memo_$i"} = @@ -1044,6 +1057,7 @@ if ($form->{type} eq "credit_note") { map { print qq|$column_data{"${_}_$i"}\n| } @column_index; print " \n"; + push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } print qq| @@ -1074,7 +1088,7 @@ if ($form->{type} eq "credit_note") { if ($form->{id}) { print qq| - @@ -1086,6 +1100,9 @@ if ($form->{type} eq "credit_note") { . $locale->text('Storno') . qq|">| unless ($form->{storno}); print qq| +|; + print qq| |; if ($form->{id} && !($form->{type} eq "credit_note")) { print qq| @@ -1093,6 +1110,12 @@ if ($form->{type} eq "credit_note") { . $locale->text('Credit Note') . qq|"> |; } + if ($form->{radier}) { + print qq| + +|; + } if ($invdate > $closedto) { @@ -1104,7 +1127,7 @@ if ($form->{type} eq "credit_note") { } else { if ($invdate > $closedto) { - print qq|text('Update') . qq|"> @@ -1119,12 +1142,8 @@ if ($form->{type} eq "credit_note") { } } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| + print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) . + qq| {rowcount}> @@ -1197,8 +1216,6 @@ sub update { } else { - $form->{"selected_unit_$i"} = $form->{"unit_$i"}; - IS->retrieve_item(\%myconfig, \%$form); $rows = scalar @{ $form->{item_list} }; @@ -1216,7 +1233,7 @@ sub update { } else { - $sellprice = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}); + $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit); @@ -1333,6 +1350,7 @@ sub post_payment { ($form->{AR}) = split /--/, $form->{AR}; ($form->{AR_paid}) = split /--/, $form->{AR_paid}; + relink_accounts(); $form->redirect($locale->text(' Payment posted!')) if (IS->post_payment(\%myconfig, \%$form)); $form->error($locale->text('Cannot post payment!')); @@ -1399,6 +1417,7 @@ sub post { $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber"); } } + relink_accounts(); if ($print_post) { if (!(IS->post_invoice(\%myconfig, \%$form))) { $form->error($locale->text('Cannot post invoice!')); @@ -1426,6 +1445,18 @@ sub print_and_post { } +sub use_as_template { + $lxdebug->enter_sub(); + + map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); + $form->{paidaccounts} = 1; + $form->{rowcount}--; + $form->{invdate} = $form->current_date(\%myconfig); + &display_form; + + $lxdebug->leave_sub(); +} + sub storno { $lxdebug->enter_sub(); @@ -1437,7 +1468,6 @@ sub storno { $form->{storno} = 1; $form->{id} = ""; $form->{invnumber} = "Storno zu " . $form->{invnumber}; - $form->{rowcount}--; &post(); $lxdebug->leave_sub();