X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=d6783443f2fd7b13bb300851d1022b040db393a8;hb=62f99e30c191d86af9249b6ec61f410dbe46466d;hp=f4b32c0351746d9c775b2d570444cd3bda347e47;hpb=54e4131e091831e00a861fe2c4f53e344b87ddca;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index f4b32c035..d6783443f 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -30,6 +30,7 @@ # Order entry module # Quotation module #====================================================================== +use Data::Dumper; use SL::OE; use SL::IR; @@ -43,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 +111,10 @@ sub add { sub edit { $lxdebug->enter_sub(); + $form->{simple_save} = 0; + + set_headings("edit"); + # editing without stuff to edit? try adding it first if ($form->{rowcount}) { map { $id++ if $form->{"id_$_"} } (1 .. $form->{rowcount}); @@ -101,26 +139,7 @@ sub edit { $printer_id = $form->{printer_id}; } - 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'; - } + set_headings("edit"); &order_links; &prepare_order; @@ -188,9 +207,21 @@ 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) { @@ -216,7 +247,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}; @@ -253,12 +284,9 @@ sub order_links { sub prepare_order { $lxdebug->enter_sub(); - $form->{format} = "pdf"; $form->{media} = "screen"; $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; @@ -303,6 +331,11 @@ sub form_header { $checkedopen = ($form->{closed}) ? "" : "checked"; $checkedclosed = ($form->{closed}) ? "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 = ""; @@ -367,6 +400,9 @@ sub form_header { 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}) { @@ -391,12 +427,12 @@ sub form_header { if (@{ $form->{SHIPTO} }) { $form->{selectshipto} = ""; foreach $item (@{ $form->{SHIPTO} }) { - if ($item->{id} == $form->{shipto_id}) { + if ($item->{shipto_id} == $form->{shipto_id}) { $form->{selectshipto} .= - ""; + ""; } else { $form->{selectshipto} .= - ""; + ""; } } @@ -502,26 +538,21 @@ sub form_header { 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/; + $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}>/value=$form->{taxzone_id} selected>/; } } - if ($form->{rowcount} >0) { - $form->{selecttaxzone} =~ /