}
}
- # update department
- ($null, $form->{department_id}) = split(/--/, $form->{department});
-
# amount for AR account
$form->{receivables} = $form->round_amount($form->{amount}, 2) * -1;
push(@values, $business_id);
}
if ($form->{department_id}) {
- my $department_id = $form->{department_id};
$where .= " AND a.department_id = ?";
- push(@values, $department_id);
- }
- if ($form->{department}) {
- my $department = like($form->{department});
- $where .= " AND d.description ILIKE ?";
- push(@values, $department);
+ push(@values, $form->{department_id});
}
foreach my $column (qw(invnumber ordnumber cusordnumber notes transaction_description)) {
if ($form->{$column}) {
(@{ $form->{all_customer} });
}
- # departments
- if (@{ $form->{all_departments} || [] }) {
- $form->{selectdepartment} = "<option>\n";
- $form->{department} = "$form->{department}--$form->{department_id}";
-
- map {
- $form->{selectdepartment} .=
- "<option>$_->{description}--$_->{id}\n"
- } (@{ $form->{all_departments} || [] });
- }
+ $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
$form->{employee} = "$form->{employee}--$form->{employee_id}";
$form->{invoice_obj} = _retrieve_invoice_object();
my ($title, $readonly, $exchangerate, $rows);
- my ($notes, $department, $customer, $employee, $amount, $project);
+ my ($notes, $customer, $employee, $amount, $project);
my ($ARselected);
$readonly = ($form->{radier}) ? "" : $readonly;
# set option selected
- foreach my $item (qw(customer currency department employee)) {
+ foreach my $item (qw(customer currency employee)) {
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
}
"taxcharts" => { "key" => "ALL_TAXCHARTS",
"module" => "AR" },);
+ $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+
$_->{link_split} = { map { $_ => 1 } split/:/, $_->{link} } for @{ $form->{ALL_CHARTS} };
my %project_labels = map { $_->{id} => $_->{projectnumber} } @{ $form->{"ALL_PROJECTS"} };
$form->isblank("duedate", $locale->text('Due Date missing!'));
$form->isblank("customer", $locale->text('Customer missing!'));
- if ($myconfig{mandatory_departments} && !$form->{department}) {
+ if ($myconfig{mandatory_departments} && !$form->{department_id}) {
$form->{saved_message} = $::locale->text('You have to specify a department.');
update();
exit;
# Auch in Rechnungsübersicht nach Kundentyp filtern - jan
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
"customers" => "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_BUSINESS_TYPES} = scalar @{ $form->{ALL_BUSINESS_TYPES} } > 0;
$form->{CT_CUSTOM_VARIABLES} = CVar->get_configs('module' => 'CT');
push @options, $locale->text('Contact Person') . " : $form->{cp_name}";
}
- # $form->{department} seems to never be filled, and showing the department_id
- # at the top of the report doesn't make much sense.
- # So determine the department name from the id whenever we have a filter for
- # department
- if ($form->{department}) {
- my ($department) = split /--/, $form->{department};
- push @options, $locale->text('Department') . " : $department";
- }
if ($form->{department_id}) {
- # push @options, $locale->text('Department Id') . " : $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;
- }
+ my $department = SL::DB::Manager::Department->find_by( id => $form->{department_id} );
+ push @options, $locale->text('Department') . " : " . $department->description;
}
if ($form->{invnumber}) {
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}";
<td>[%- IF forex %][% L.hidden_tag('exchangerate', LxERP.format_amount(exchangerate, 5)) %][% LxERP.format_amount(exchangerate, 5) %][%- ELSE %][% L.input_tag('exchangerate', LxERP.format_amount(exchangerate, 5), size=10) %][%- END %]</td>
[% END %]
</tr>
- [% department_html %]
- [%- IF selectdepartment %]
- <tr>
- <th align="right" nowrap>[% 'Department' | $T8 %]</th>
- <td colspan=3><select name=department>[% selectdepartment %]</select>
- <input type=hidden name=selectdepartment value="[% selectdepartment | html %]">
- </td>
- </tr>
- [%- END %]
+ [% IF ALL_DEPARTMENTS %]
+ <tr>
+ <th align="right" nowrap>[% 'Department' | $T8 %]</th>
+ <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1) %]</td>
+ </tr>
+ [% END %]
<tr>
<td align=right>[% L.checkbox_tag('taxincluded', checked=taxincluded) %]</td>
<th align="left" nowrap><label for="taxincluded">[% 'Tax Included' | $T8 %]</label></th>