X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fir.pl;h=75b44c1e411d8be8d62d5c04aa35dd3b1874d207;hb=232ccb5f2622a7ecc4cfa40031aba17d7717957a;hp=caa8a0e6d511c2dbd70931afccb2d7adbbb583b9;hpb=195883fdfd3b10f329036767f027baa6e7c402b9;p=kivitendo-erp.git diff --git a/bin/mozilla/ir.pl b/bin/mozilla/ir.pl index caa8a0e6d..75b44c1e4 100644 --- a/bin/mozilla/ir.pl +++ b/bin/mozilla/ir.pl @@ -43,7 +43,7 @@ require "$form->{path}/arap.pl"; sub add { $lxdebug->enter_sub(); -print STDERR "ir.pl-add\n"; + $form->{title} = $locale->text('Add Vendor Invoice'); &invoice_links; @@ -67,7 +67,7 @@ sub edit { sub invoice_links { $lxdebug->enter_sub(); -print STDERR "ir.pl-invoice_links\n"; + # create links $form->{webdav} = $webdav; @@ -76,16 +76,40 @@ print STDERR "ir.pl-invoice_links\n"; $form->create_links("AP", \%myconfig, "vendor"); + #quote all_vendor Bug 133 + foreach $ref (@{ $form->{all_vendor} }) { + $ref->{name} = $form->quote($ref->{name}); + } + if ($form->{all_vendor}) { unless ($form->{vendor_id}) { $form->{vendor_id} = $form->{all_vendor}->[0]->{id}; } } + if ($form->{payment_id}) { + $payment_id = $form->{payment_id}; + } + if ($form->{language_id}) { + $language_id = $form->{language_id}; + } + if ($form->{taxzone_id}) { + $taxzone_id = $form->{taxzone_id}; + } $cp_id = $form->{cp_id}; IR->get_vendor(\%myconfig, \%$form); IR->retrieve_invoice(\%myconfig, \%$form); $form->{cp_id} = $cp_id; + + if ($payment_id) { + $form->{payment_id} = $payment_id; + } + if ($language_id) { + $form->{language_id} = $language_id; + } + if ($taxzone_id) { + $form->{taxzone_id} = $taxzone_id; + } # currencies @curr = split /:/, $form->{currencies}; @@ -160,7 +184,7 @@ print STDERR "ir.pl-invoice_links\n"; sub prepare_invoice { $lxdebug->enter_sub(); -print STDERR "ir.pl-prepare_invoice\n"; + if ($form->{id}) { map { $form->{$_} =~ s/\"/"/g } qw(invnumber ordnumber quonumber); @@ -176,8 +200,12 @@ print STDERR "ir.pl-prepare_invoice\n"; $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces); + + (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/); + $dec_qty = length $dec_qty; + $form->{"qty_$i"} = - $form->format_amount(\%myconfig, ($form->{"qty_$i"} * -1)); + $form->format_amount(\%myconfig, ($form->{"qty_$i"} * -1), $dec_qty); $form->{rowcount} = $i; } @@ -188,7 +216,7 @@ print STDERR "ir.pl-prepare_invoice\n"; sub form_header { $lxdebug->enter_sub(); -print STDERR "ir.pl-form_header\n"; + # set option selected foreach $item (qw(AP vendor currency department contact)) { $form->{"select$item"} =~ s/ selected//; @@ -196,6 +224,9 @@ print STDERR "ir.pl-form_header\n"; s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } + #quote selectvendor Bug 133 + $form->{"selectvendor"} = $form->quote($form->{"selectvendor"}); + $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); @@ -223,15 +254,13 @@ print STDERR "ir.pl-form_header\n"; if ($form->{forex}) { $exchangerate .= qq| | - . $locale->text('Exchangerate') - . qq| + . $locale->text('Exchangerate') . qq| $form->{exchangerate}{exchangerate}> |; } else { $exchangerate .= qq| | - . $locale->text('Exchangerate') - . qq| + . $locale->text('Exchangerate') . qq| {exchangerate}> |; } @@ -240,6 +269,40 @@ print STDERR "ir.pl-form_header\n"; {forex}> |; + + if (@{ $form->{TAXZONE} }) { + $form->{selecttaxzone} = ""; + foreach $item (@{ $form->{TAXZONE} }) { + if ($item->{id} == $form->{taxzone_id}) { + $form->{selecttaxzone} .= + ""; + } else { + $form->{selecttaxzone} .= + ""; + } + + } + } else { + $form->{selecttaxzone} =~ s/ selected//g; + if ($form->{taxzone_id} ne "") { + $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/; + } + } + if ($form->{rowcount} >1) { + $form->{selecttaxzone} =~ /