Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision fdbb6888

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID fdbb6888ea00ca5f6450015ea70bb3d5f89edfc9
  • Vorgänger dc48be1c
  • Nachfolger 4a6d8036

Lieferschein: Kunden-/Lieferantenpicker nutzen

Unterschiede anzeigen:

bin/mozilla/do.pl
172 172
  my $form     = $main::form;
173 173
  my %myconfig = %main::myconfig;
174 174

  
175
  # get customer/vendor
176
  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
177

  
178 175
  # retrieve order/quotation
179 176
  my $editing = $form->{id};
180 177

  
......
197 194
  $form->restore_vars(qw(taxincluded)) if $form->{id};
198 195
  $form->restore_vars(qw(salesman_id)) if $editing;
199 196

  
200
  if ($form->{"all_$form->{vc}"}) {
201
    unless ($form->{"$form->{vc}_id"}) {
202
      $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
203
    }
204
  }
205

  
206
  ($form->{ $form->{vc} })  = split /--/, $form->{ $form->{vc} };
207
  $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
208

  
209
  $form->{employee} = "$form->{employee}--$form->{employee_id}";
210

  
211 197
  $main::lxdebug->leave_sub();
212 198
}
213 199

  
......
259 245
  my $form     = $main::form;
260 246
  my %myconfig = %main::myconfig;
261 247

  
248
  my $class       = "SL::DB::" . ($form->{vc} eq 'customer' ? 'Customer' : 'Vendor');
249
  $form->{VC_OBJ} = $class->load_cached($form->{ $form->{vc} . '_id' });
250

  
262 251
  $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
263 252
  $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
264 253

  
265 254
  my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
266
  $form->get_lists($vc              => "ALL_VC",
267
                   "price_factors"  => "ALL_PRICE_FACTORS",
255
  $form->get_lists("price_factors"  => "ALL_PRICE_FACTORS",
268 256
                   "business_types" => "ALL_BUSINESS_TYPES",
269 257
    );
270 258
  $form->{ALL_DEPARTMENTS} = SL::DB::Manager::Department->get_all;
......
302 290
    ]
303 291
  ]);
304 292

  
305
  map { $_->{value} = "$_->{name}--$_->{id}"        } @{ $form->{ALL_VC} };
306

  
307
  $form->{SHOW_VC_DROP_DOWN} =  $myconfig{vclimit} > scalar @{ $form->{ALL_VC} };
308

  
309
  $form->{oldvcname}         =  $form->{"old$form->{vc}"};
310
  $form->{oldvcname}         =~ s/--.*//;
311

  
312 293
  my $dispatch_to_popup = '';
313 294
  if ($form->{resubmit} && ($form->{format} eq "html")) {
314 295
    $dispatch_to_popup  = "window.open('about:blank','Beleg'); document.do.target = 'Beleg';";
......
320 301
  $::request->{layout}->add_javascripts_inline("\$(function(){$dispatch_to_popup});");
321 302

  
322 303

  
323
  my $follow_up_vc                =  $form->{ $form->{vc} eq 'customer' ? 'customer' : 'vendor' };
324
  $follow_up_vc                   =~ s/--\d*\s*$//;
325

  
326
  $form->{follow_up_trans_info} = $form->{donumber} .'('. $follow_up_vc .')';
304
  $form->{follow_up_trans_info} = $form->{donumber} .'('. $form->{VC_OBJ}->name .')';
327 305

  
328 306
  $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part));
329 307

  
......
383 361
  my $payment_id;
384 362
  $payment_id = $form->{payment_id} if $form->{payment_id};
385 363

  
386
  check_name($form->{vc});
364
  my $vc = $form->{vc};
365
  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
366
    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
367

  
368
    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
369
    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
370
  }
371

  
387 372
  $form->{discount} =  $form->{"$form->{vc}_discount"} if defined $form->{"$form->{vc}_discount"};
388 373
  # Problem: Wenn man ohne Erneuern einen Kunden/Lieferanten
389 374
  # wechselt, wird der entsprechende Kunden/ Lieferantenrabatt
......
725 710
  $form->{donumber} =~ s/\s*$//g;
726 711

  
727 712
  my $msg = ucfirst $form->{vc};
728
  $form->isblank($form->{vc}, $locale->text($msg . " missing!"));
713
  $form->isblank($form->{vc} . "_id", $locale->text($msg . " missing!"));
729 714

  
730 715
  # $locale->text('Customer missing!');
731 716
  # $locale->text('Vendor missing!');
......
734 719
  validate_items();
735 720

  
736 721
  # if the name changed get new values
737
  if (check_name($form->{vc})) {
722
  my $vc = $form->{vc};
723
  if (($form->{"previous_${vc}_id"} || $form->{"${vc}_id"}) != $form->{"${vc}_id"}) {
724
    $::form->{salesman_id} = SL::DB::Manager::Employee->current->id if exists $::form->{salesman_id};
725

  
726
    IS->get_customer(\%myconfig, $form) if $vc eq 'customer';
727
    IR->get_vendor(\%myconfig, $form)   if $vc eq 'vendor';
728

  
738 729
    update();
739 730
    $::dispatcher->end_request;
740 731
  }
templates/webpages/do/form_header.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3 3
[%- USE LxERP %]
4
[%- USE L %]
4
[%- USE L %][%- USE P -%]
5 5
<h1>[% title %]</h1>
6 6

  
7 7
 <script type="text/javascript" src="js/show_form_details.js"></script>
8 8
 <script type="text/javascript" src="js/show_history.js"></script>
9 9
 <script type="text/javascript" src="js/show_vc_details.js"></script>
10
 <script type="text/javascript" src="js/common.js"></script>
11 10
 <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
12
 <script type="text/javascript" src="js/vendor_selection.js"></script>
13 11
 <script type="text/javascript" src="js/calculate_qty.js"></script>
14 12
 <script type="text/javascript" src="js/stock_in_out.js"></script>
15 13
 <script type="text/javascript" src="js/follow_up.js"></script>
......
22 20
 </style>
23 21

  
24 22
 [%- IF vc == 'customer' %]
25
 [%- SET vc = 'customer' %]
26
 [%- SET the_vc_id = customer_id %]
27
 [%- SET the_vc = customer %]
28
 [%- SET the_oldvc = oldcustomer %]
29 23
 [%- SET is_customer = '1' %]
30 24
 [%- ELSE %]
31 25
 [%- SET vc = 'vendor' %]
32
 [%- SET the_vc_id = vendor_id %]
33
 [%- SET the_vc = vendor %]
34
 [%- SET the_oldvc = oldvendor %]
35 26
 [%- SET is_customer = '0' %]
36 27
 [%- END %]
28
 [%- SET vc_id = vc _ "_id" %]
37 29
 [%- IF delivered %]
38 30
 [%- SET DISABLED = ' disabled' %]
39 31
 [%- END %]
......
120 112
     <td>
121 113
      <table width="100%">
122 114
       <tr>
123
        <input type="hidden" name="[% vc %]_id" value="[% HTML.escape(the_vc_id) %]">
124
        <input type="hidden" name="old[% vc %]" value="[% HTML.escape(the_oldvc) %]">
125
        <input type="hidden" name="tradediscount" value="[% HTML.escape(tradediscount) %]">
126 115
        <th align="right">[% IF is_customer %][% 'Customer' | $T8 %][% ELSE %][% 'Vendor' | $T8 %][% END %]</th>
127 116
        <td>
128
         [%- UNLESS !delivered && SHOW_VC_DROP_DOWN %]
129
         <input type="text" value="[% HTML.escape(oldvcname) %]" name="[% HTML.escape(vc) %]"[% RO %]>
130
         [%- ELSE %]
131
         <select name="[% vc %]" class="fixed_width" onchange="document.do.update_button.click();"[% RO %]>
132
          [%- FOREACH row = ALL_VC %]
133
          <option value="[% HTML.escape(row.value) %]" [% IF the_oldvc == row.value %] selected[% END %]>[% HTML.escape(row.name) %]</option>
134
          [%- END %]
135
         </select>
136
         <input type="hidden" name="select[% vc %]" value="1">
137
         [%- END %]
138
         <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('[% vc %]')">
117
         [% IF RO %]
118
          [% P.hidden_tag(vc_id, $vc_id) %]
119
          [% HTML.escape(VC_OBJ.name) %]
120
         [% ELSE %]
121
          [% P.customer_vendor_picker(vc_id, $vc_id, type=vc, class="fixed_width") %]
122
         [% END %]
123
         [% P.hidden_tag("previous_" _ vc_id, $vc_id) %]
124
         [% P.button_tag("show_vc_details('" _ HTML.escape(vc) _ "')", LxERP.t8("Details (one letter abbreviation)")) %]
139 125
        </td>
140 126

  
141 127
        [%- IF ALL_CONTACTS.size %]

Auch abrufbar als: Unified diff