Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a99fc9f6

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID a99fc9f6b84fbf0effae46eb41fe056c960a1602
  • Vorgänger 8dcc0849
  • Nachfolger 1c82a10e

Verkaufsrechnungen: Kundenwahl über Picker

Unterschiede anzeigen:

bin/mozilla/is.pl
143 143
  # create links
144 144
  $form->create_links("AR", \%myconfig, "customer");
145 145

  
146
  if ($form->{all_customer}) {
147
    unless ($form->{customer_id}) {
148
      $form->{customer_id} = $form->{all_customer}->[0]->{id};
149
      $form->{salesman_id} = $form->{all_customer}->[0]->{salesman_id};
150
    }
151
  }
152

  
153 146
  my $editing = $form->{id};
154 147

  
155 148
  $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id
......
158 151

  
159 152
  IS->get_customer(\%myconfig, \%$form);
160 153

  
161
  #quote all_customer Bug 133
162
  foreach my $ref (@{ $form->{all_customer} }) {
163
    $ref->{name} = $form->quote($ref->{name});
164
  }
165

  
166 154
  $form->restore_vars(qw(id));
167 155

  
168 156
  IS->retrieve_invoice(\%myconfig, \%$form);
......
171 159
  $form->restore_vars(qw(taxincluded)) if $form->{id};
172 160
  $form->restore_vars(qw(salesman_id)) if $editing;
173 161

  
174

  
175
  # build vendor/customer drop down compatibility... don't ask
176
  if (@{ $form->{"all_customer"} }) {
177
    $form->{"selectcustomer"} = 1;
178
    $form->{customer}         = qq|$form->{customer}--$form->{"customer_id"}|;
179
  }
180

  
181
  $form->{"oldcustomer"}  = $form->{customer};
182

  
183
  if ($form->{"oldcustomer"} !~ m/--\d+$/ && $form->{"customer_id"}) {
184
    $form->{"oldcustomer"} .= qq|--$form->{"customer_id"}|
185
  }
186

  
187

  
188
#  $form->{oldcustomer} = "$form->{customer}--$form->{customer_id}";
189
#  $form->{selectcustomer} = 1;
190

  
191 162
  $form->{employee} = "$form->{employee}--$form->{employee_id}";
192 163

  
193 164
  # forex
......
291 262
  my %TMPL_VAR = ();
292 263
  my @custom_hiddens;
293 264

  
294
  if ($form->{id}) {
295
    require SL::DB::Invoice;
296
    $TMPL_VAR{invoice_obj} = SL::DB::Invoice->new(id => $form->{id})->load;
297
  }
265
  $TMPL_VAR{customer_obj} = SL::DB::Customer->load_cached($form->{customer_id}) if $form->{customer_id};
266
  $TMPL_VAR{invoice_obj}  = SL::DB::Invoice->load_cached($form->{id})           if $form->{id};
267

  
298 268
  $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
299 269
  $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
300 270

  
......
302 272

  
303 273
  $form->get_lists("taxzones"      => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
304 274
                   "currencies"    => "ALL_CURRENCIES",
305
                   "customers"     => "ALL_CUSTOMERS",
306 275
                   "price_factors" => "ALL_PRICE_FACTORS");
307 276

  
308 277
  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
......
342 311
  ]);
343 312
  $TMPL_VAR{department_labels}     = sub { "$_[0]->{description}--$_[0]->{id}" };
344 313

  
345
  # customer
346
  $TMPL_VAR{vc_keys} = sub { "$_[0]->{name}--$_[0]->{id}" };
347
  $TMPL_VAR{vclimit} = $myconfig{vclimit};
348
  $TMPL_VAR{vc_select} = "customer_or_vendor_selection_window('customer', '', 0, 0)";
349
  push @custom_hiddens, "customer_id";
350
  push @custom_hiddens, "oldcustomer";
351
  push @custom_hiddens, "selectcustomer";
352

  
353 314
  # currencies and exchangerate
354 315
  my @values = map { $_       } @{ $form->{ALL_CURRENCIES} };
355 316
  my %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
......
365 326
  $TMPL_VAR{creditwarning} = ($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update};
366 327
  $TMPL_VAR{is_credit_remaining_negativ} = $form->{creditremaining} =~ /-/;
367 328

  
368
  my $follow_up_vc         =  $form->{customer};
369
  $follow_up_vc            =~ s/--\d*\s*$//;
370
  $TMPL_VAR{customer_name} = $follow_up_vc;
371

  
372 329
# set option selected
373 330
  foreach my $item (qw(AR)) {
374 331
    $form->{"select$item"} =~ s/ selected//;
......
448 405
  $form->{taxaccounts_array} = [ split(/ /, $form->{taxaccounts}) ];
449 406

  
450 407
  if( $form->{customer_id} && !$form->{taxincluded_changed_by_user} ) {
451
    my $customer = SL::DB::Customer->new(id => $form->{customer_id})->load();
408
    my $customer = SL::DB::Customer->load_cached($form->{customer_id});
452 409
    $form->{taxincluded} = defined($customer->taxincluded_checked) ? $customer->taxincluded_checked : $myconfig{taxincluded_checked};
453 410
  }
454 411

  
......
561 518
  my $taxincluded         = $form->{taxincluded} ? "checked" : '';
562 519
  $form->{update} = 1;
563 520

  
564
  &check_name("customer");
521
  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
522
    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
523

  
524
    IS->get_customer(\%myconfig, $form);
525
  }
565 526

  
566 527
  $form->{taxincluded} ||= $taxincluded;
567 528

  
......
750 711

  
751 712
  $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
752 713
  $form->isblank("invdate",  $locale->text('Invoice Date missing!'));
753
  $form->isblank("customer", $locale->text('Customer missing!'));
714
  $form->isblank("customer_id", $locale->text('Customer missing!'));
754 715
  $form->error($locale->text('Cannot post invoice for a closed period!'))
755 716
        if ($form->date_closed($form->{"invdate"}, \%myconfig));
756 717

  
......
758 719
  $form->{invnumber} =~ s/\s*$//g;
759 720

  
760 721
  # if oldcustomer ne customer redo form
761
  if (&check_name('customer')) {
722
  if (($form->{previous_customer_id} || $form->{customer_id}) != $form->{customer_id}) {
762 723
    &update;
763 724
    $::dispatcher->end_request;
764 725
  }
templates/webpages/is/form_header.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3 3
[%- USE LxERP %]
4
[%- USE L %]
5
[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_name _ ')' %]
4
[%- USE L %][%- USE P -%]
5
[%- SET follow_up_trans_info = invnumber _ ' (' _ customer_obj.name _ ')' %]
6 6
<script type="text/javascript" src="js/common.js"></script>
7 7
<script type="text/javascript" src="js/delivery_customer_selection.js"></script>
8
<script type="text/javascript" src="js/vendor_selection.js"></script>
9 8
<script type="text/javascript" src="js/calculate_qty.js"></script>
10 9
<script type="text/javascript" src="js/follow_up.js"></script>
11
<script type="text/javascript" src="js/customer_or_vendor_selection.js"></script>
12 10

  
13 11
<form method="post" name="invoice" action="[% script %]">
14 12

  
......
52 50
        <tr>
53 51
          <th align="right">[% 'Customer' | $T8 %]</th>
54 52
          <td>
55
            [%- INCLUDE 'generic/multibox.html'
56
                 id            = 'customer',
57
                 name          = 'customer',
58
                 style         = 'width: 250px',
59
                 class         = 'initial_focus',
60
                 DATA          = ALL_CUSTOMERS,
61
                 id_sub        = 'vc_keys',
62
                 label_key     = 'name',
63
                 select        = vc_select,
64
                 limit         = vclimit,
65
                 allow_textbox = 1,
66
                 onChange      = "document.getElementById('update_button').click();" -%]
67
            <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% HTML.escape(vc) %]')">
53
           [% P.customer_vendor_picker("customer_id", customer_id, type="customer", style="width: 250px", class="initial_focus") %]
54
           [% L.button_tag("show_vc_details('customer')", LxERP.t8('Details (one letter abbreviation)')) %]
55
           [% L.hidden_tag("previous_customer_id", customer_id) %]
68 56
          <input type="hidden" name="customer_pricegroup_id" value="[% HTML.escape(customer_pricegroup_id) %]">
69
          <input type="hidden" name="customer_id" value="[% HTML.escape(customer_id) %]">
70
          <input type="hidden" name="oldcustomer" value="[% HTML.escape(oldcustomer) %]">
71
          <input type="hidden" name="selectcustomer" value="[% HTML.escape(selectcustomer) %]">
72 57
          </td>
73 58
        </tr>
74 59
[%- IF ALL_CONTACTS.size %]

Auch abrufbar als: Unified diff