X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=34870fea269936ec068bcee6bf99c08aad9f4df0;hb=15f549fdb43fba2d99817c659533dfa02638bf27;hp=7aa3f2eb28a1da3334ba1ffb9aa6fe15bd872072;hpb=972f67f3fe4d62126a9a5958918175b5f0b08ee6;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 7aa3f2eb2..34870fea2 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -44,26 +44,59 @@ require "$form->{path}/arap.pl"; # end of main -sub add { +# For locales.pl: +# $locale->text('Edit the purchase_order'); +# $locale->text('Edit the sales_order'); +# $locale->text('Edit the request_quotation'); +# $locale->text('Edit the sales_quotation'); + +# $locale->text('Workflow purchase_order'); +# $locale->text('Workflow sales_order'); +# $locale->text('Workflow request_quotation'); +# $locale->text('Workflow sales_quotation'); + +sub set_headings { $lxdebug->enter_sub(); + my ($action) = @_; + if ($form->{type} eq 'purchase_order') { - $form->{title} = $locale->text('Add Purchase Order'); - $form->{vc} = 'vendor'; + $form->{title} = $action eq "edit" ? + $locale->text('Edit Purchase Order') : + $locale->text('Add Purchase Order'); + $form->{heading} = $locale->text('Purchase Order'); + $form->{vc} = 'vendor'; } if ($form->{type} eq 'sales_order') { - $form->{title} = $locale->text('Add Sales Order'); - $form->{vc} = 'customer'; + $form->{title} = $action eq "edit" ? + $locale->text('Edit Sales Order') : + $locale->text('Add Sales Order'); + $form->{heading} = $locale->text('Sales Order'); + $form->{vc} = 'customer'; } if ($form->{type} eq 'request_quotation') { - $form->{title} = $locale->text('Add Request for Quotation'); - $form->{vc} = 'vendor'; + $form->{title} = $action eq "edit" ? + $locale->text('Edit Request for Quotation') : + $locale->text('Add Request for Quotation'); + $form->{heading} = $locale->text('Request for Quotation'); + $form->{vc} = 'vendor'; } if ($form->{type} eq 'sales_quotation') { - $form->{title} = $locale->text('Add Quotation'); - $form->{vc} = 'customer'; + $form->{title} = $action eq "edit" ? + $locale->text('Edit Quotation') : + $locale->text('Add Quotation'); + $form->{heading} = $locale->text('Quotation'); + $form->{vc} = 'customer'; } + $lxdebug->leave_sub(); +} + +sub add { + $lxdebug->enter_sub(); + + set_headings("add"); + $form->{callback} = "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&path=$form->{path}&password=$form->{password}" unless $form->{callback}; @@ -77,6 +110,13 @@ sub add { sub edit { $lxdebug->enter_sub(); + # show history button + $form->{javascript} = qq||; + #/show hhistory button + + $form->{simple_save} = 0; + + set_headings("edit"); # editing without stuff to edit? try adding it first if ($form->{rowcount}) { @@ -95,29 +135,21 @@ sub edit { } } - if ($form->{type} eq 'purchase_order') { - $form->{title} = $locale->text('Edit Purchase Order'); - $form->{heading} = $locale->text('Purchase Order'); - $form->{vc} = 'vendor'; - } - if ($form->{type} eq 'sales_order') { - $form->{title} = $locale->text('Edit Sales Order'); - $form->{heading} = $locale->text('Sales Order'); - $form->{vc} = 'customer'; - } - if ($form->{type} eq 'request_quotation') { - $form->{title} = $locale->text('Edit Request for Quotation'); - $form->{heading} = $locale->text('Request for Quotation'); - $form->{vc} = 'vendor'; - } - if ($form->{type} eq 'sales_quotation') { - $form->{title} = $locale->text('Edit Quotation'); - $form->{heading} = $locale->text('Quotation'); - $form->{vc} = 'customer'; + if ($form->{print_and_save}) { + $form->{action} = "print"; + $form->{resubmit} = 1; + $language_id = $form->{language_id}; + $printer_id = $form->{printer_id}; } + set_headings("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 +164,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) @@ -166,7 +208,7 @@ sub order_links { $intnotes = $form->{intnotes}; # get customer / vendor - if ($form->{type} =~ /(purchase_order|request_quotation|receive_order)/) { + if ($form->{type} =~ /(purchase_order|request_quotation)/) { IR->get_vendor(\%myconfig, \%$form); #quote all_vendor Bug 133 @@ -175,7 +217,7 @@ sub order_links { } } - if ($form->{type} =~ /(sales|ship)_(order|quotation)/) { + if ($form->{type} =~ /sales_(order|quotation)/) { IS->get_customer(\%myconfig, \%$form); #quote all_vendor Bug 133 @@ -185,7 +227,15 @@ sub order_links { } $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}"} = @@ -200,7 +250,7 @@ sub order_links { } # currencies - @curr = split /:/, $form->{currencies}; + @curr = split(/:/, $form->{currencies}); chomp $curr[0]; $form->{defaultcurrency} = $curr[0]; $form->{currency} = $form->{defaultcurrency} unless $form->{currency}; @@ -237,13 +287,9 @@ sub order_links { sub prepare_order { $lxdebug->enter_sub(); - $form->{format} = "pdf"; - $form->{media} = "screen"; - $form->{formname} = $form->{type}; - - map { $form->{$_} =~ s/\"/"/g } - qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact); + $form->{formname} = $form->{type} unless $form->{formname}; + my $i = 0; foreach $ref (@{ $form->{form_details} }) { $form->{rowcount} = ++$i; @@ -284,13 +330,26 @@ sub prepare_order { sub form_header { $lxdebug->enter_sub(); - $checkedopen = ($form->{closed}) ? "" : "checked"; - $checkedclosed = ($form->{closed}) ? "checked" : ""; + my $checkedclosed = $form->{"closed"} ? "checked" : ""; + my $checkeddelivered = $form->{"delivered"} ? "checked" : ""; + + map { $form->{$_} =~ s/\"/"/g } + qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname + shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact + shiptophone shiptofax shiptodepartment_1 shiptodepartment_2); # use JavaScript Calendar or not $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 @@ -323,21 +382,26 @@ sub form_header { $openclosed = qq| - - - - - -
| - . $locale->text('Open') . qq| | - . $locale->text('Closed') . qq|
- + + +|; + + if (($form->{"type"} eq "sales_order") || + ($form->{"type"} eq "purchase_order")) { + $openclosed .= qq| + + +|; + } + + $openclosed .= qq| + |; } # 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}/; @@ -346,33 +410,66 @@ sub form_header { #quote select[customer|vendor] Bug 133 $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"}); - #build contacts - if ($form->{all_contacts}) { - - $form->{selectcontact} = ""; - foreach $item (@{ $form->{all_contacts} }) { - if ($form->{cp_id} == $item->{cp_id}) { - $form->{selectcontact} .= - ""; + } 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>/; + } + } + + $taxzone = qq| + + | . $locale->text('Steuersatz') . qq| + + + |; + + if ($form->{type} !~ /_quotation$/) { $ordnumber = qq| @@ -456,10 +594,11 @@ sub form_header { $form->{creditlimit} | . $locale->text('Remaining') . qq| - $form->{creditremaining} + $form->{creditremaining} + $shipto |; } else { @@ -485,7 +624,6 @@ sub form_header { |; - $terms = ""; } $ordnumber .= qq| @@ -498,7 +636,10 @@ sub form_header { $button2 |; - + $creditremaining = qq| + + $shipto + |; } $vc = @@ -542,20 +683,41 @@ sub form_header { |; } + if ($form->{resubmit} && ($form->{format} eq "html")) { + $onload = + qq|window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()|; + } elsif ($form->{resubmit}) { + $onload = qq|document.oe.submit()|; + } else { + $onload = "fokus()"; + } + + $credittext = $locale->text('Credit Limit exceeded!!!'); + if ($creditwarning) { + $onload = qq|alert('$credittext')|; + } + + $form->{"javascript"} .= qq||; $form->header; print qq| - + -
{script}> +{script}> + + + + {id}> +{action}> {type}> {formname}> {media}> {format}> +{proforma}> @@ -595,6 +757,8 @@ sub form_header { $creditremaining $business + $dunning + $taxzone $department | . $locale->text('Currency') . qq| @@ -610,15 +774,38 @@ sub form_header { | . $locale->text('Ship via') . qq| - - + |; +# +# +# +# +# +# +# +# +# +# +# +#
+# +# +#
+# +# +#
+# +# +print qq| $openclosed $employee $ordnumber - $terms + + + +
| . $locale->text('Project Number') . qq|$globalprojectnumber
@@ -638,6 +825,8 @@ $jsscript + + @@ -773,6 +962,9 @@ sub form_footer { $notes $intnotes + | . $locale->text('Payment Terms') . qq| + @@ -839,8 +1031,8 @@ sub form_footer { -Bearbeiten des $form->{heading}
-{type}") . qq|
+ @@ -850,16 +1042,24 @@ Bearbeiten des $form->{heading}
. $locale->text('E-mail') . qq|"> + |; - if ($form->{id}) { + if (($form->{id})) { print qq| -
Workflow $form->{heading}
+ + +
| . $locale->text("Workflow $form->{type}") . qq|
|; - if ($form->{type} =~ /sales_quotation$/) { + if (($form->{type} =~ /sales_quotation$/)) { print qq| |; @@ -869,10 +1069,12 @@ Bearbeiten des $form->{heading}
|; } + if (1) { print qq| |; +} if ($form->{type} =~ /sales_order$/) { print qq| @@ -889,7 +1091,7 @@ Bearbeiten des $form->{heading}
+ . $locale->text('Request for Quotation') . qq|"> |; } else { @@ -899,7 +1101,7 @@ Bearbeiten des $form->{heading}
. $locale->text('Order') . qq|"> |; } - } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount}) { + } elsif ($form->{type} =~ /sales_order$/ && $form->{rowcount} && !$form->{proforma}) { print qq|
Workflow $form->{heading}
{path}/menu.pl"; - &menubar; - } - print qq| {rowcount}> @@ -935,13 +1132,14 @@ Bearbeiten des $form->{heading}
sub update { $lxdebug->enter_sub(); + set_headings($form->{"id"} ? "edit" : "add"); + map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(exchangerate creditlimit creditremaining); + $form->{update} = 1; &check_name($form->{vc}); - &check_project; - $buysell = 'buy'; $buysell = 'sell' if ($form->{vc} eq 'vendor'); $form->{exchangerate} = $exchangerate @@ -964,7 +1162,7 @@ sub update { $form->{creditremaining} += ($form->{oldinvtotal} - $form->{oldtotalpaid}); &check_form; - } else { + } else { if ( $form->{type} eq 'purchase_order' || $form->{type} eq 'request_quotation') { @@ -990,11 +1188,16 @@ sub update { } else { $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); - + if ($form->{"not_discountable_$i"}) { + $form->{"discount_$i"} = 0; + } map { $form->{item_list}[$i]{$_} =~ s/\"/"/g } qw(partnumber description unit); map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] }; + if ($form->{"part_payment_id_$i"} ne "") { + $form->{payment_id} = $form->{"part_payment_id_$i"}; + } $s = ($sellprice) ? $sellprice : $form->{"sellprice_$i"}; @@ -1050,7 +1253,7 @@ sub update { $form->{rowcount}--; $form->{"discount_$i"} = ""; &display_form; - } else { + } else { $form->{"id_$i"} = 0; $form->{"unit_$i"} = $locale->text('ea'); @@ -1074,6 +1277,7 @@ sub search { $ordnumber = 'ordnumber'; $employee = $locale->text('Employee'); } + if ($form->{type} eq 'request_quotation') { $form->{title} = $locale->text('Request for Quotations'); $form->{vc} = 'vendor'; @@ -1081,13 +1285,7 @@ sub search { $ordnumber = 'quonumber'; $employee = $locale->text('Employee'); } - if ($form->{type} eq 'receive_order') { - $form->{title} = $locale->text('Receive Merchandise'); - $form->{vc} = 'vendor'; - $ordlabel = $locale->text('Order Number'); - $ordnumber = 'ordnumber'; - $employee = $locale->text('Employee'); - } + if ($form->{type} eq 'sales_order') { $form->{title} = $locale->text('Sales Orders'); $form->{vc} = 'customer'; @@ -1095,14 +1293,6 @@ sub search { $ordnumber = 'ordnumber'; $employee = $locale->text('Salesperson'); } - if ($form->{type} eq 'ship_order') { - $form->{title} = $locale->text('Ship Merchandise'); - $form->{vc} = 'customer'; - $ordlabel = $locale->text('Order Number'); - $ordnumber = 'ordnumber'; - $employee = $locale->text('Salesperson'); - - } if ($form->{type} eq 'sales_quotation') { $form->{title} = $locale->text('Quotations'); @@ -1112,30 +1302,6 @@ sub search { $employee = $locale->text('Employee'); } - if ($form->{type} =~ /(ship|receive)_order/) { - OE->get_warehouses(\%myconfig, \%$form); - - # warehouse - if (@{ $form->{all_warehouses} }) { - $form->{selectwarehouse} = "