174 |
174 |
IS->get_customer(\%myconfig, \%$form);
|
175 |
175 |
|
176 |
176 |
$form->{$_} = $saved{$_} for keys %saved;
|
177 |
|
$form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
|
178 |
177 |
$form->{rowcount} = 1;
|
179 |
178 |
$form->{AR_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AR} ? $form->{acc_trans}->{AR}->[0]->{chart_id} : $form->{AR_links}->{AR}->[0]->{chart_id};
|
180 |
179 |
|
181 |
180 |
# currencies
|
182 |
181 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
|
183 |
182 |
|
184 |
|
# customers
|
185 |
|
if (@{ $form->{all_customer} || [] }) {
|
186 |
|
$form->{customer} = "$form->{customer}--$form->{customer_id}";
|
187 |
|
map { $form->{selectcustomer} .= "<option>$_->{name}--$_->{id}\n" }
|
188 |
|
(@{ $form->{all_customer} });
|
189 |
|
}
|
190 |
|
|
191 |
183 |
$form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
|
192 |
184 |
|
193 |
185 |
# build the popup menus
|
... | ... | |
215 |
207 |
$form->{invoice_obj} = _retrieve_invoice_object();
|
216 |
208 |
|
217 |
209 |
my ($title, $readonly, $exchangerate, $rows);
|
218 |
|
my ($notes, $customer, $amount, $project);
|
|
210 |
my ($notes, $amount, $project);
|
219 |
211 |
|
220 |
|
$form->{initial_focus} = !($form->{amount_1} * 1) ? 'customer' : 'row_' . $form->{rowcount};
|
|
212 |
$form->{initial_focus} = !($form->{amount_1} * 1) ? 'customer_id' : 'row_' . $form->{rowcount};
|
221 |
213 |
|
222 |
214 |
$title = $form->{title};
|
223 |
215 |
# $locale->text('Add Accounts Receivables Transaction')
|
... | ... | |
231 |
223 |
: ($::instance_conf->get_ar_changeable == 1);
|
232 |
224 |
$readonly = ($form->{radier}) ? "" : $readonly;
|
233 |
225 |
|
234 |
|
# set option selected
|
235 |
|
foreach my $item (qw(customer)) {
|
236 |
|
$form->{"select$item"} =~ s/ selected//;
|
237 |
|
$form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
|
238 |
|
}
|
239 |
|
|
240 |
226 |
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy');
|
241 |
227 |
$form->{exchangerate} = $form->{forex} if $form->{forex};
|
242 |
228 |
|
... | ... | |
274 |
260 |
}
|
275 |
261 |
}
|
276 |
262 |
|
277 |
|
my $follow_up_vc = $form->{customer};
|
278 |
|
$follow_up_vc =~ s/--.*?//;
|
|
263 |
my $follow_up_vc = $form->{customer_id} ? SL::DB::Customer->load_cached($form->{customer_id})->name : '';
|
279 |
264 |
my $follow_up_trans_info = "$form->{invnumber} ($follow_up_vc)";
|
280 |
265 |
|
281 |
|
$::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
|
|
266 |
$::request->layout->add_javascripts("autocomplete_chart.js", "autocomplete_customer.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
|
282 |
267 |
|
283 |
268 |
my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
|
284 |
269 |
my $first_taxchart;
|
... | ... | |
506 |
491 |
|
507 |
492 |
$form->{invdate} = $form->{transdate};
|
508 |
493 |
|
509 |
|
&check_name("customer");
|
|
494 |
if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
|
|
495 |
IS->get_customer(\%myconfig, $form);
|
|
496 |
}
|
510 |
497 |
|
511 |
498 |
$form->{invtotal} =
|
512 |
499 |
($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
|
... | ... | |
618 |
605 |
# check if there is an invoice number, invoice and due date
|
619 |
606 |
$form->isblank("transdate", $locale->text('Invoice Date missing!'));
|
620 |
607 |
$form->isblank("duedate", $locale->text('Due Date missing!'));
|
621 |
|
$form->isblank("customer", $locale->text('Customer missing!'));
|
|
608 |
$form->isblank("customer_id", $locale->text('Customer missing!'));
|
622 |
609 |
|
623 |
610 |
if ($myconfig{mandatory_departments} && !$form->{department_id}) {
|
624 |
611 |
$form->{saved_message} = $::locale->text('You have to specify a department.');
|
... | ... | |
664 |
651 |
}
|
665 |
652 |
|
666 |
653 |
# if oldcustomer ne customer redo form
|
667 |
|
my ($customer) = split /--/, $form->{customer};
|
668 |
|
if ($form->{oldcustomer} ne "$customer--$form->{customer_id}") {
|
|
654 |
if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
|
669 |
655 |
update();
|
670 |
656 |
$::dispatcher->end_request;
|
671 |
657 |
}
|
Debitorenbuchungen: Kundenauswahl über Picker