my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
$form->get_lists($vc => "ALL_VC",
"price_factors" => "ALL_PRICE_FACTORS",
- "departments" => "ALL_DEPARTMENTS",
"business_types" => "ALL_BUSINESS_TYPES",
);
+ $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"});
]
]);
- map { $_->{value} = "$_->{description}--$_->{id}" } @{ $form->{ALL_DEPARTMENTS} };
map { $_->{value} = "$_->{name}--$_->{id}" } @{ $form->{ALL_VC} };
$form->{SHOW_VC_DROP_DOWN} = $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
$form->get_lists("projects" => { "key" => "ALL_PROJECTS",
"all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
"$form->{vc}s" => "ALL_VC",
"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->{SHOW_VC_DROP_DOWN} = $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
$form->{title} = $locale->text('Delivery Orders');
my $locale = $main::locale;
my $cgi = $::request->{cgi};
- $form->{department_id} = (split /--/, $form->{department})[-1];
($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} });
report_generator_set_default_sort('transdate', 1);
if ($form->{cp_name}) {
push @options, $locale->text('Contact Person') . " : $form->{cp_name}";
}
- if ($form->{department}) {
- my ($department) = split /--/, $form->{department};
- push @options, $locale->text('Department') . " : $department";
+ if ($form->{department_id}) {
+ push @options, $locale->text('Department') . " : " . SL::DB::Department->new(id => $form->{department_id})->load->description;
}
if ($form->{donumber}) {
push @options, $locale->text('Delivery Order Number') . " : $form->{donumber}";
[%- IF ALL_DEPARTMENTS.size %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
- <td colspan="3">
- <select name="department" class="fixed_width">
- <option></option>
- [%- FOREACH row = ALL_DEPARTMENTS %]
- <option[% IF department == row.id %] selected[% END %]>[% HTML.escape(row.description) %]--[% HTML.escape(row.id) %]</option>
- [%- END %]
- </select>
- </td>
+ <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1, class="fixed_width") %]</td>
</tr>
[%- END %]