X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=58a1f2c7e63e982d257964fe3ab4c495da373e4a;hb=a88b876c3d2941bdcd9429e887efcab2968c9285;hp=3bfcbf6205f9593ef5e171fbca634102b975387a;hpb=2e6f965bbc04d506fed5ac2dfac32c1542b09cb6;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 3bfcbf620..58a1f2c7e 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -189,6 +189,7 @@ sub prepare_invoice { map { $form->{$_} =~ s/\"/"/g } qw(invnumber ordnumber quonumber); + my $i = 0; foreach $ref (@{ $form->{invoice_details} }) { $i++; map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref}; @@ -278,10 +279,11 @@ sub form_header { foreach $item (@{ $form->{TAXZONE} }) { if ($item->{id} == $form->{taxzone_id}) { $form->{selecttaxzone} .= - "{id} selected>$item->{description}"; + "{id} selected>" . H($item->{description}) . + ""; } else { $form->{selecttaxzone} .= - "{id}>$item->{description}"; + "{id}>" . H($item->{description}) . ""; } } @@ -291,11 +293,6 @@ sub form_header { $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/; } } - if ($form->{rowcount} >1) { - $form->{selecttaxzone} =~ /.*?<\/option>/; - $form->{selecttaxzone} = $&; - } - $taxzone = qq| @@ -357,6 +354,8 @@ sub form_header { qq|{duedate}>|; } + $form->{"javascript"} .= qq||; + $form->header; print qq| @@ -672,6 +671,7 @@ sub form_footer { |; + my @triggers = (); $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); for $i (1 .. $form->{paidaccounts}) { @@ -684,8 +684,10 @@ sub form_footer { s/option>\Q$form->{"AP_paid_$i"}\E/option selected>$form->{"AP_paid_$i"}/; # format amounts - $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"}); @@ -709,7 +711,8 @@ sub form_footer { $column_data{"AP_paid_$i"} = qq|$form->{"selectAP_paid_$i"}|; $column_data{"datepaid_$i"} = - qq|{"datepaid_$i"}>|; + qq|{"datepaid_$i"}> + |; $column_data{"source_$i"} = qq|{"source_$i"}>|; $column_data{"memo_$i"} = @@ -720,6 +723,7 @@ sub form_footer { print qq| |; + push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } print qq| @@ -752,21 +756,22 @@ sub form_footer { . $locale->text('Delete') . qq|"> |; } - } else { - if ($invdate > $closedto) { - print qq| - |; - } + print qq| +|; + } - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; + print qq||; + + if (!$form->{id} && ($invdate > $closedto)) { + print qq| |; } - print qq| + print $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) . + qq| {rowcount}> @@ -916,13 +921,24 @@ sub storno { $form->{storno} = 1; $form->{id} = ""; $form->{invnumber} = "Storno zu " . $form->{invnumber}; - $form->{rowcount}--; &post(); $lxdebug->leave_sub(); } +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 post_payment { $lxdebug->enter_sub(); for $i (1 .. $form->{paidaccounts}) { @@ -999,10 +1015,6 @@ sub post { $form->{id} = 0 if $form->{postasnew}; - # get new invnumber in sequence if no invnumber is given or if posasnew was requested - if (!$form->{invnumber} || $form->{postasnew}) { - $form->{invnumber} = $form->update_defaults(\%myconfig, "invnumber"); - } relink_accounts(); $form->redirect( $locale->text('Invoice')