Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ca0df4c4

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID ca0df4c46aea2660839d4f77bfda8ea3e826a61d
  • Vorgänger 51502881
  • Nachfolger 4800abb9

Debitorenbuchungen: Kundenauswahl über Picker

Unterschiede anzeigen:

bin/mozilla/ar.pl
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
  }
templates/webpages/ar/form_header.html
42 42
              <tr>
43 43
                <th align="right" nowrap>[% 'Customer' | $T8 %]</th>
44 44
                <td colspan=3>
45
[%- IF selectcustomer %]
46
    <select id='customer' name="customer" onchange="document.getElementById('update_button').click();"[% IF initial_focus == 'customer'%] class="initial_focus"[% END %]>[% selectcustomer %]</select>
47
[%- ELSE %]
48
    <input id='customer' name=customer value="[% customer | html %]" size=35[% IF initial_focus == 'customer'%] class="initial_focus"[% END %]>
49
[%- END %]
50
                <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('customer')"></td>
51
                [% L.hidden_tag('selectcustomer', selectcustomer) %]
52
                [% L.hidden_tag('oldcustomer', oldcustomer) %]
53
                [% L.hidden_tag('customer_id', customer_id) %]
54
                [% L.hidden_tag('terms', terms) %]
45
                 [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 300px", class=(initial_focus == 'customer_id' ? "initial_focus" : "")) %]
46
                 [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
47
                 [% L.hidden_tag("previous_customer_id", customer_id) %]
48
                 [% L.hidden_tag('terms', terms) %]
49
               </td>
55 50
              </tr>
56 51
[%- IF max_dunning_level || invoice_obj.dunning_config_id  %]
57 52
              <tr>

Auch abrufbar als: Unified diff