X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fir.pl;h=466d44bd5d2a6bec30bfa96329c74f4af38c11c5;hb=a1e47d425a58b8342992daab4907591506949f07;hp=11cab57b2275075da8aec4e10d807abb0b0f1925;hpb=1f2c95729c5b2752ecc33eb5d5ddb4b395fe51be;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index 11cab57b2..466d44bd5 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -112,7 +112,7 @@ sub invoice_links { } # currencies - @curr = split /:/, $form->{currencies}; + @curr = split(/:/, $form->{currencies}); chomp $curr[0]; $form->{defaultcurrency} = $curr[0]; @@ -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}; @@ -224,6 +225,9 @@ sub form_header { s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } + $form->{radier} = + ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0; + #quote selectvendor Bug 133 $form->{"selectvendor"} = $form->quote($form->{"selectvendor"}); @@ -275,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}) . ""; } } @@ -288,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| @@ -354,6 +354,8 @@ sub form_header { qq|{duedate}>|; } + $form->{"javascript"} .= qq||; + $form->header; print qq| @@ -669,6 +671,7 @@ sub form_footer { |; + my @triggers = (); $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); for $i (1 .. $form->{paidaccounts}) { @@ -681,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"}); @@ -706,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"} = @@ -717,6 +723,7 @@ sub form_footer { print qq| |; + push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } print qq| @@ -743,22 +750,28 @@ sub form_footer { print qq| | unless ($form->{storno}); + if ($form->{radier}) { + print qq| + +|; + } + print qq| +|; - } else { - if ($invdate > $closedto) { - 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}> @@ -823,8 +836,6 @@ sub update { } else { - $form->{"selected_unit_$i"} = $form->{"unit_$i"}; - IR->retrieve_item(\%myconfig, \%$form); my $rows = scalar @{ $form->{item_list} }; @@ -910,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}) { @@ -993,11 +1015,8 @@ 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') . " $form->{invnumber} " . $locale->text('posted!'))