$form->{defaultcurrency} = $form->get_default_currency($myconfig);
$form->{taxincluded} = 0 unless $form->{taxincluded};
- ($null, $form->{department_id}) = split(/--/, $form->{department});
-
if ($form->{currency} eq $form->{defaultcurrency}) {
$form->{exchangerate} = 1;
} else {
$where .= " AND (cp.cp_name ILIKE ? OR cp.cp_givenname ILIKE ?)";
push(@values, (like($form->{"cp_name"}))x2);
}
- if ($form->{department}) {
- # ähnlich wie commit 0bbfb33b6aa8e38bb6c81d1684ab7d08e5b5c5af abteilung
- # wird so nicht mehr als zeichenkette zusammengebaut
- # hätte zu ee9f9f9aa4c3b9d5d20ab10a45c12bcaa6aa78d0 auffallen können ;-) jan
- #my ($null, $department_id) = split /--/, $form->{department};
+ if ($form->{department_id}) {
$where .= " AND a.department_id = ?";
- push(@values, $form->{department});
+ push(@values, $form->{department_id});
}
if ($form->{invnumber}) {
$where .= " AND a.invnumber ILIKE ?";
$form->{initial_transdate} = $form->{transdate};
create_links(dont_save => 1);
$form->{transdate} = $form->{initial_transdate};
+
&display_form;
$main::lxdebug->leave_sub();
(@{ $form->{all_vendor} });
}
- # departments
- if (@{ $form->{all_departments} || [] }) {
- $form->{department} = "$form->{department}--$form->{department_id}";
- $form->{selectdepartment} = "<option>\n" . join('', map { my $quoted = H("$_->{description}--$_->{id}"); "<option value=\"${quoted}\">${quoted}\n"} @{ $form->{all_departments} || [] });
- }
+ $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
$form->{employee} = "$form->{employee}--$form->{employee_id}";
# type=submit $locale->text('Edit Accounts Payables Transaction')
# set option selected
- foreach my $item (qw(vendor currency department)) {
+ foreach my $item (qw(vendor currency)) {
my $to_replace = H($form->{$item});
$form->{"select$item"} =~ s/ selected//;
$form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/;
@{ $form->{ALL_CHARTS} }
);
+ $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
+
my %project_labels = ();
foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
$project_labels{$item->{id}} = $item->{projectnumber};
$form->isblank("vendor", $locale->text('Vendor missing!'));
$form->isblank("invnumber", $locale->text('Invoice Number 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;
$form->{title} = $locale->text('AP Transactions');
$form->get_lists("projects" => { "key" => "ALL_PROJECTS", "all" => 1 },
- "departments" => "ALL_DEPARTMENTS",
"vendors" => "ALL_VC");
+ $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
# constants and subs for template
$form->{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
vendornumber country ustid taxzone payment_terms charts direct_debit);
my @hidden_variables = map { "l_${_}" } @columns;
- push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes project_id transdatefrom transdateto department
+ push @hidden_variables, "l_subtotal", qw(open closed vendor invnumber ordnumber transaction_description notes project_id transdatefrom transdateto
parts_partnumber parts_description);
my $href = build_std_url('action=ap_transactions', grep { $form->{$_} } @hidden_variables);
my @options;
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') . " : " . (split /--/, $form->{department})[0] if ($form->{department});
+ push @options, $locale->text('Department') . " : $form->{department}" if ($form->{department});
push @options, $locale->text('Invoice Number') . " : $form->{invnumber}" if ($form->{invnumber});
push @options, $locale->text('Order Number') . " : $form->{ordnumber}" if ($form->{ordnumber});
push @options, $locale->text('Notes') . " : $form->{notes}" if ($form->{notes});
<form method="post" action="[% script | html %]">
<input type="hidden" name="selectvendor" value="[% selectvendor | html %]">
-<input type="hidden" name="selectdepartment" value="[% selectdepartment | html %]">
<input type="hidden" name="selectcurrency" value="[% selectcurrency | html %]">
<input type="hidden" name="oldvendor" value="[% oldvendor | html %]">
</tr>
- [% IF ( selectdepartment ) %]
+ [% IF ALL_DEPARTMENTS %]
<tr>
<th align="right" nowrap>[% 'Department' | $T8 %]</th>
- <td colspan="3">
- <select name="department">[% selectdepartment %]</select>
- </td>
+ <td colspan=3>[% L.select_tag('department_id', ALL_DEPARTMENTS, default = department_id, title_key = 'description', with_empty = 1) %]</td>
</tr>
[% END %]