Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2dcf4554

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 2dcf4554600db801c495e0d5bb99eadfb36785bd
  • Vorgänger 122f91e7
  • Nachfolger cf9865dc

Kreditorenbuchungen: Kundenauswahl über Picker

Unterschiede anzeigen:

bin/mozilla/ap.pl
176 176
  IR->get_vendor(\%myconfig, \%$form);
177 177

  
178 178
  $form->{$_}        = $saved{$_} for keys %saved;
179
  $form->{oldvendor} = "$form->{vendor}--$form->{vendor_id}";
180 179
  $form->{rowcount}  = 1;
181 180
  $form->{AP_chart_id} = $form->{acc_trans} && $form->{acc_trans}->{AP} ? $form->{acc_trans}->{AP}->[0]->{chart_id} : $form->{AP_links}->{AP}->[0]->{chart_id};
182 181

  
......
186 185
  # currencies
187 186
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
188 187

  
189
  # vendors
190
  if (@{ $form->{all_vendor} || [] }) {
191
    $form->{vendor} = qq|$form->{vendor}--$form->{vendor_id}|;
192
    map { my $quoted = H($_->{name} . "--" . $_->{id}); $form->{selectvendor} .= "<option value=\"${quoted}\">${quoted}\n" }
193
      (@{ $form->{all_vendor} });
194
  }
195

  
196
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
188
  $::form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all_sorted;
197 189

  
198 190
  $form->{employee} = "$form->{employee}--$form->{employee_id}";
199 191

  
......
237 229

  
238 230
  $::form->{invoice_obj} = SL::DB::PurchaseInvoice->new(id => $::form->{id})->load if $::form->{id};
239 231

  
240
  $form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor' : 'row_' . $form->{rowcount};
232
  $form->{initial_focus} = !($form->{amount_1} * 1) ? 'vendor_id' : 'row_' . $form->{rowcount};
241 233

  
242 234
  $form->{title_} = $form->{title};
243 235
  $form->{title} = $form->{title} eq 'Add' ? $locale->text('Add Accounts Payables Transaction') : $locale->text('Edit Accounts Payables Transaction');
......
245 237
  # type=submit $locale->text('Add Accounts Payables Transaction')
246 238
  # type=submit $locale->text('Edit Accounts Payables Transaction')
247 239

  
248
  # set option selected
249
  foreach my $item (qw(vendor)) {
250
    my $to_replace         =  H($form->{$item});
251
    $form->{"select$item"} =~ s/ selected//;
252
    $form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/;
253
  }
254 240
  my $readonly = $form->{id} ? "readonly" : "";
255 241

  
256 242
  $form->{radier} = ($::instance_conf->get_ap_changeable == 2)
......
322 308
    $charts{$item->{accno}} = $item;
323 309
  }
324 310

  
325
  my $follow_up_vc         =  $form->{vendor};
326
  $follow_up_vc            =~ s/--.*?//;
311
  my $follow_up_vc         = $form->{vendor_id} ? SL::DB::Vendor->load_cached($form->{vendor_id})->name : '';
327 312
  my $follow_up_trans_info =  "$form->{invnumber} ($follow_up_vc)";
328 313

  
329
  $::request->layout->add_javascripts("autocomplete_chart.js", "show_vc_details.js", "show_history.js", "follow_up.js", "kivi.Draft.js", "kivi.GL.js");
314
  $::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");
330 315
  my $transdate = $::form->{transdate} ? DateTime->from_kivitendo($::form->{transdate}) : DateTime->today_local;
331 316
  my $first_taxchart;
332 317

  
......
524 509

  
525 510
  $form->{invdate} = $form->{transdate};
526 511

  
527
  my $vendor_changed = &check_name("vendor");
512
  if (($form->{previous_vendor_id} || $form->{vendor_id}) != $form->{vendor_id}) {
513
    IR->get_vendor(\%::myconfig, $form);
514
  }
528 515

  
529 516
  $form->{rowcount} = $count + 1;
530 517

  
......
627 614
  # check if there is a vendor, invoice, due date and invnumber
628 615
  $form->isblank("transdate", $locale->text("Invoice Date missing!"));
629 616
  $form->isblank("duedate",   $locale->text("Due Date missing!"));
630
  $form->isblank("vendor",    $locale->text('Vendor missing!'));
617
  $form->isblank("vendor_id", $locale->text('Vendor missing!'));
631 618
  $form->isblank("invnumber", $locale->text('Invoice Number missing!'));
632 619

  
633 620
  if ($myconfig{mandatory_departments} && !$form->{department_id}) {
......
682 669
  }
683 670

  
684 671
  # if old vendor ne vendor redo form
685
  my ($vendor) = split /--/, $form->{vendor};
686
  if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") {
672
  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
687 673
    &update;
688 674
    $::dispatcher->end_request;
689 675
  }
templates/webpages/ap/form_header.html
5 5

  
6 6
<form method="post" action="[% script | html %]">
7 7

  
8
<input type="hidden" name="selectvendor" value="[% selectvendor | html %]">
9

  
10
<input type="hidden" name="oldvendor" value="[% oldvendor | html %]">
11
<input type="hidden" name="vendor_id" value="[% vendor_id | html %]">
12 8
<input type="hidden" name="terms" value="[% terms | html %]">
13 9

  
14 10
<input type="hidden" name="creditlimit" value="[% creditlimit | html %]">
......
80 76
              <tr>
81 77
                <th align="right" nowrap>[% 'Vendor' | $T8 %]</th>
82 78
                <td colspan="3">
83
                  [% IF ( selectvendor ) %]
84
                    <select name="vendor" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>[% selectvendor %]</select>
85
                  [% ELSE %]
86
                    <input name=vendor value="[% vendor | html %]" size="35"[% IF initial_focus == 'vendor' %] class="initial_focus"[% END %]>
87
                  [% END %]
88
                  <input type="button" value="D" onclick="show_vc_details('vendor')">
79
                 [% P.customer_vendor_picker("vendor_id", vendor_id, type="vendor", style="width: 300px") %]
80
                 [% L.button_tag("show_vc_details('vendor')", LxERP.t8('Details (one letter abbreviation)')) %]
81
                 [% L.hidden_tag("previous_vendor_id", vendor_id) %]
89 82
                </td>
90 83
              </tr>
91 84

  

Auch abrufbar als: Unified diff