From: Sven Schöling Date: Thu, 21 Feb 2008 15:20:12 +0000 (+0000) Subject: order_links auf aktuelle code richtlinien gebracht, und einige konstruktionen behutsa... X-Git-Tag: release-2.6.0beta1~219 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=648b2e7ea886ac021cb1f98bed9955e71f09cf29;p=kivitendo-erp.git order_links auf aktuelle code richtlinien gebracht, und einige konstruktionen behutsam vereinfacht. --- diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index acfa4c2d7..95376da61 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -197,100 +197,55 @@ sub order_links { OE->retrieve(\%myconfig, \%$form); - $payment_id = $form->{payment_id} if $form->{payment_id}; - $language_id = $form->{language_id} if $form->{language_id}; - $taxzone_id = $form->{taxzone_id} if $form->{taxzone_id}; - $salesman_id = $form->{salesman_id} if $editing; - # 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) - if ( $form->{rowcount} - && $form->{type} eq 'sales_order' - && defined $form->{customer} - && $form->{customer} eq '') { - - # $main::lxdebug->message(0, "Detected Edit order with concurrent customers"); - $form->error( - $locale->text( - 'Collective Orders only work for orders from one customer!') - ); + if ( $form->{rowcount} && $form->{type} eq 'sales_order' + && defined $form->{customer} && $form->{customer} eq '') { + $form->error($locale->text('Collective Orders only work for orders from one customer!')); } - $taxincluded = $form->{taxincluded}; - $form->{shipto} = 1 if $form->{id}; + $form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"}; - if ($form->{"all_$form->{vc}"}) { - unless ($form->{"$form->{vc}_id"}) { - $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id}; - } - } - - $cp_id = $form->{cp_id}; - $intnotes = $form->{intnotes}; + $payment_id = $form->{payment_id} if $form->{payment_id}; + $language_id = $form->{language_id} if $form->{language_id}; + $taxzone_id = $form->{taxzone_id} if $form->{taxzone_id}; + $salesman_id = $form->{salesman_id} if $editing; + $taxincluded = $form->{taxincluded}; + $cp_id = $form->{cp_id}; + $intnotes = $form->{intnotes}; + $form->{shipto} = 1 if $form->{id}; # get customer / vendor - if ($form->{type} =~ /(purchase_order|request_quotation)/) { - 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_(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 if $intnotes; + IR->get_vendor(\%myconfig, \%$form) if $form->{type} =~ /(purchase_order|request_quotation)/; + IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/; + + $form->{cp_id} = $cp_id; + $form->{payment_id} = $payment_id if $payment_id; + $form->{language_id} = $language_id if $language_id; + $form->{taxzone_id} = $taxzone_id if $taxzone_id; + $form->{intnotes} = $intnotes if $intnotes; + $form->{taxincluded} = $taxincluded if $form->{id}; + $form->{salesman_id} = $salesman_id if $editing; + $form->{forex} = $form->{exchangerate}; + $form->{employee} = "$form->{employee}--$form->{employee_id}"; + + # build vendor/customer drop down ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} }; $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; - # build the popup menus if (@{ $form->{"all_$form->{vc}"} }) { - $form->{ $form->{vc} } = - qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; - map { $form->{"select$form->{vc}"} .= -"\n" } - (@{ $form->{"all_$form->{vc}"} }); + map { $_->{name} = $form->quote($_->{name}) } @{ $form->{"all_$form->{vc}"} }; + $form->{ $form->{vc} } = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|; + $form->{"select$form->{vc}"} = join "\n", map "", @{ $form->{"all_$form->{vc}"} }; } - $form->{taxincluded} = $taxincluded if ($form->{id}); - # departments if (@{ $form->{all_departments} }) { - $form->{selectdepartment} = "\n" - } @{ $form->{all_departments} }; + $form->{selectdepartment} = join "\n", "", @{ $form->{all_departments} }; } - $form->{employee} = "$form->{employee}--$form->{employee_id}"; - - # forex - $form->{forex} = $form->{exchangerate}; - - $form->{salesman_id} = $salesman_id if ($editing); - $lxdebug->leave_sub(); }