From dd2ee66b1d04c3644c48c32b33673463af223077 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Fri, 23 Dec 2016 09:44:10 +0100 Subject: [PATCH] =?utf8?q?Auftr=C3=A4ge=20-=20Abteilung=20per=20ALL=5FDEPA?= =?utf8?q?RTMENTS=20und=20L.select=5Ftag?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/OE.pm | 19 ++++--------------- bin/mozilla/oe.pl | 20 ++++++++------------ templates/webpages/oe/form_header.html | 4 ++-- templates/webpages/oe/search.html | 13 +------------ 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/SL/OE.pm b/SL/OE.pm index 3e3ed3f56..f8b1b00e5 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -138,11 +138,9 @@ sub transactions { qq|WHERE (o.quotation = ?) |; push(@values, $quotation); - my ($null, $split_department_id) = split /--/, $form->{department}; - my $department_id = $form->{department_id} || $split_department_id; - if ($department_id) { + if ($form->{department_id}) { $query .= qq| AND o.department_id = ?|; - push(@values, $department_id); + push(@values, $form->{department_id}); } if ($form->{"project_id"}) { @@ -722,8 +720,6 @@ SQL my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't'; - ($null, $form->{department_id}) = split(/--/, $form->{department}) if $form->{department}; - # save OE record $query = qq|UPDATE oe SET @@ -1282,8 +1278,8 @@ sub order_details { push(@project_ids, $form->{"globalproject_id"}) if ($form->{"globalproject_id"}); - $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS', - 'departments' => 'ALL_DEPARTMENTS'); + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); + $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all; my %price_factors; foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) { @@ -1292,13 +1288,6 @@ sub order_details { $pfac->{formatted_factor} = $form->format_amount($myconfig, $pfac->{factor}); } - # lookup department - foreach my $dept (@{ $form->{ALL_DEPARTMENTS} }) { - next unless $dept->{id} eq $form->{department_id}; - $form->{department} = $dept->{description}; - last; - } - # sort items by partsgroup for $i (1 .. $form->{rowcount}) { $partsgroup = ""; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 47d6f8f09..83cf28fe1 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -354,11 +354,12 @@ sub form_header { $form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"), "payments" => "ALL_PAYMENTS", "currencies" => "ALL_CURRENCIES", - "departments" => "ALL_DEPARTMENTS", $vc => { key => "ALL_" . uc($vc), limit => $myconfig{vclimit} + 1 }, "price_factors" => "ALL_PRICE_FACTORS"); + $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all; + # Projects my @old_project_ids = uniq grep { $_ } map { $_ * 1 } ($form->{"globalproject_id"}, map { $form->{"project_id_$_"} } 1..$form->{"rowcount"}); my @old_ids_cond = @old_project_ids ? (id => \@old_project_ids) : (); @@ -396,7 +397,6 @@ sub form_header { ] ]); $TMPL_VAR{sales_employee_labels} = sub { $_[0]->{name} || $_[0]->{login} }; - $TMPL_VAR{department_labels} = sub { "$_[0]->{description}--$_[0]->{id}" }; # vendor/customer $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" }; @@ -775,11 +775,11 @@ sub search { # setup vendor / customer data $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP"); $form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 }, - "departments" => "ALL_DEPARTMENTS", "$form->{vc}s" => "ALL_VC", "taxzones" => "ALL_TAXZONES", "business_types" => "ALL_BUSINESS_TYPES",); $form->{ALL_EMPLOYEES} = SL::DB::Manager::Employee->get_all_sorted(query => [ deleted => 0 ]); + $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all; $form->{CT_CUSTOM_VARIABLES} = CVar->get_configs('module' => 'CT'); ($form->{CT_CUSTOM_VARIABLES_FILTER_CODE}, @@ -980,19 +980,11 @@ sub orders { 'data' => $form->{OE}); my @options; - my ($department) = split m/--/, $form->{department}; push @options, $locale->text('Customer') . " : $form->{customer}" if $form->{customer}; push @options, $locale->text('Vendor') . " : $form->{vendor}" if $form->{vendor}; push @options, $locale->text('Contact Person') . " : $form->{cp_name}" if $form->{cp_name}; - push @options, $locale->text('Department') . " : $department" if $form->{department}; - if ($form->{department_id}) { - unless ($form->{department}) { - require SL::DB::Department; - my $department = SL::DB::Manager::Department->find_by(id => $::form->{department_id}); - push @options, $locale->text('Department') . " : " . $department->description if $department; - } - } + push @options, $locale->text('Department') . " : $form->{department}" if $form->{department}; push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if $form->{ordnumber}; push @options, $locale->text('Customer Order Number') . " : $form->{cusordnumber}" if $form->{cusordnumber}; push @options, $locale->text('Notes') . " : $form->{notes}" if $form->{notes}; @@ -1031,6 +1023,10 @@ sub orders { push @options, $locale->text('Steuersatz') . " : " . SL::DB::TaxZone->new(id => $form->{taxzone_id})->load->description; } + if ($form->{department_id}) { + push @options, $locale->text('Department') . " : " . SL::DB::Department->new(id => $form->{department_id})->load->description; + } + if (($form->{order_probability_value} || '') ne '') { push @options, $::locale->text('Order probability') . ' ' . ($form->{order_probability_op} eq 'le' ? '<=' : '>=') . ' ' . $form->{order_probability_value} . '%'; } diff --git a/templates/webpages/oe/form_header.html b/templates/webpages/oe/form_header.html index 70e702e63..497be459f 100644 --- a/templates/webpages/oe/form_header.html +++ b/templates/webpages/oe/form_header.html @@ -112,11 +112,11 @@ [% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES), default=taxzone_id, title_key='description', style='width: 250px') %] -[%- IF ALL_DEPARTMENTS %] +[%- IF ALL_DEPARTMENTS.size %] [% 'Department' | $T8 %] - [% L.select_tag('department_id', ALL_DEPARTMENTS, default=department_id, title_sub=\department_labels, with_empty=1, style='width:250px') %] + [% L.select_tag('department_id', ALL_DEPARTMENTS, default=department_id, title_key = 'description', with_empty=1, style='width:250px') %] [%- END %] diff --git a/templates/webpages/oe/search.html b/templates/webpages/oe/search.html index b7161ee8d..1b9d615f6 100644 --- a/templates/webpages/oe/search.html +++ b/templates/webpages/oe/search.html @@ -39,18 +39,7 @@ [%- IF ALL_DEPARTMENTS.size %] [% 'Department' | $T8 %] - - [%- INCLUDE 'generic/multibox.html' - name = 'department_id', - style = 'width: 250px', - DATA = ALL_DEPARTMENTS, - id_key = 'id', - label_key = 'description', - limit = MYCONFIG.vclimit, - show_empty = 1, - allow_textbox = 1, - -%] - + [% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style="width: 250px") %] [%- END %] -- 2.20.1