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"}) {
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
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} }) {
$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 = "";
$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) : ();
]
]);
$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}" };
# 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},
'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};
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} . '%';
}
[% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES), default=taxzone_id, title_key='description', style='width: 250px') %]
</td>
</tr>
-[%- IF ALL_DEPARTMENTS %]
+[%- IF ALL_DEPARTMENTS.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
<td colspan="3">
- [% 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') %]
</td>
</tr>
[%- END %]
[%- IF ALL_DEPARTMENTS.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
- <td colspan="3">
- [%- 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,
- -%]
- </td>
+ <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, style="width: 250px") %]</td>
</tr>
[%- END %]
<tr>