X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=f4b32c0351746d9c775b2d570444cd3bda347e47;hb=024df846ffcf9d315f068a50f3fac8a992791902;hp=6f12c94d37e156c9bc660ea2b8d0abfabc4d39ec;hpb=f9f5330a26eb3f447677ab2524c823cb9f96723b;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 6f12c94d3..f4b32c035 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -30,7 +30,6 @@ # Order entry module # Quotation module #====================================================================== -use Data::Dumper; use SL::OE; use SL::IR; @@ -95,6 +94,13 @@ sub edit { } } + if ($form->{print_and_save}) { + $form->{action} = "print"; + $form->{resubmit} = 1; + $language_id = $form->{language_id}; + $printer_id = $form->{printer_id}; + } + if ($form->{type} eq 'purchase_order') { $form->{title} = $locale->text('Edit Purchase Order'); $form->{heading} = $locale->text('Purchase Order'); @@ -118,6 +124,10 @@ sub edit { &order_links; &prepare_order; + if ($form->{print_and_save}) { + $form->{language_id} = $language_id; + $form->{printer_id} = $printer_id; + } &display_form; $lxdebug->leave_sub(); @@ -132,12 +142,22 @@ sub order_links { # retrieve order/quotation $form->{webdav} = $webdav; - # set jscalendar $form->{jscalendar} = $jscalendar; OE->retrieve(\%myconfig, \%$form); + 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}; + } + + # if multiple rowcounts (== collective order) then check if the # there were more than one customer (in that case OE::retrieve removes # the content from the field) @@ -168,24 +188,20 @@ sub order_links { # get customer / vendor if ($form->{type} =~ /(purchase_order|request_quotation|receive_order)/) { IR->get_vendor(\%myconfig, \%$form); - - #quote all_vendor Bug 133 - foreach $ref (@{ $form->{all_vendor} }) { - $ref->{name} = $form->quote($ref->{name}); - } - } if ($form->{type} =~ /(sales|ship)_(order|quotation)/) { IS->get_customer(\%myconfig, \%$form); - - #quote all_vendor Bug 133 - foreach $ref (@{ $form->{all_customer} }) { - $ref->{name} = $form->quote($ref->{name}); - } - } $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; + } $form->{intnotes} = $intnotes; ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} }; $form->{"old$form->{vc}"} = @@ -239,11 +255,11 @@ sub prepare_order { $lxdebug->enter_sub(); $form->{format} = "pdf"; $form->{media} = "screen"; - $form->{formname} = $form->{type}; + $form->{formname} = $form->{type} unless $form->{formname}; map { $form->{$_} =~ s/\"/"/g } qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact); - + my $i = 0; foreach $ref (@{ $form->{form_details} }) { $form->{rowcount} = ++$i; @@ -291,6 +307,14 @@ sub form_header { $form->{jsscript} = $form->{jscalendar}; $jsscript = ""; + $payment = qq||; + foreach $item (@{ $form->{payment_terms} }) { + if ($form->{payment_id} eq $item->{id}) { + $payment .= qq||; + } else { + $payment .= qq||; + } + } if ($form->{jsscript}) { # with JavaScript Calendar @@ -337,32 +361,69 @@ sub form_header { } # set option selected - foreach $item ($form->{vc}, currency, department, employee, contact) { + foreach $item ($form->{vc}, currency, department, employee) { $form->{"select$item"} =~ s/ selected//; $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; } - #quote select[customer|vendor] Bug 133 - $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"}); - #build contacts if ($form->{all_contacts}) { - $form->{selectcontact} = ""; + $form->{selectcontact} = ""; foreach $item (@{ $form->{all_contacts} }) { + my $department = ($item->{cp_abteilung}) ? "--$item->{cp_abteilung}" : ""; if ($form->{cp_id} == $item->{cp_id}) { $form->{selectcontact} .= - ""; } else { - $form->{selectcontact} .= ""; } } + } else { + $form->{selectcontact} =~ s/ selected//g; + if ($form->{cp_id} ne "") { + $form->{selectcontact} =~ s/value=$form->{cp_id}/value=$form->{cp_id} selected/; + } } + + if (@{ $form->{SHIPTO} }) { + $form->{selectshipto} = ""; + foreach $item (@{ $form->{SHIPTO} }) { + if ($item->{id} == $form->{shipto_id}) { + $form->{selectshipto} .= + ""; + } else { + $form->{selectshipto} .= + ""; + } + + } + } else { + $form->{selectshipto} =~ s/ selected//g; + if ($form->{shipto_id} ne "") { + $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/; + } + } + + $shipto = qq| + | . $locale->text('Shipping Address') . qq| + + |; + + + + $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate}); + if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) { + $creditwarning = 1; + } else { + $creditwarning = 0; + } + $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); $form->{creditremaining} = @@ -370,7 +431,7 @@ sub form_header { $contact = ($form->{selectcontact}) - ? qq|\n| + ? qq|\n| : qq||; $exchangerate = qq| @@ -417,6 +478,58 @@ sub form_header { |; } + if ($form->{max_dunning_level}) { + $dunning = qq| + + + + + + + + + +
| . $locale->text('Max. Dunning Level') . qq|:$form->{max_dunning_level}| . $locale->text('Dunning Amount') . qq|:| + . $form->format_amount(\%myconfig, $form->{dunning_amount},2) + . qq|
+ + +|; + } + + 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} >0) { + $form->{selecttaxzone} =~ /