Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b1d38913

Von Moritz Bunkus vor mehr als 13 Jahren hinzugefügt

  • ID b1d38913571c810a6e09fa2f756e8dd17b35a25a
  • Vorgänger 5aaa3c62
  • Nachfolger a65c8e99

Lieferadressentab mit jQuery & AJAX neu laden lassen, nicht via CGI::AJAX

Unterschiede anzeigen:

bin/mozilla/ct.pl
293 293
  $main::lxdebug->leave_sub();
294 294
}
295 295

  
296
sub _shipto_label {
297
  my $s = shift(@_);
298
  join('; ', grep { $_ } map { $s->{"shipto$_"} } qw(name department_1 street city)) || ' '
299
}
300

  
296 301
sub form_header {
297 302
  $main::lxdebug->enter_sub();
298 303

  
......
313 318
  $form->{is_admin}       = $myconfig{role} eq 'admin';
314 319
  $form->{is_customer}    = $form->{db}     eq 'customer';
315 320
  $form->{salesman_label} = sub { $_[0]->{name} ne "" ? $_[0]->{name} : $_[0]->{login} };
316
  $form->{shipto_label}   = sub { my $s = shift(@_); join('; ', grep { $_ } map { $s->{"shipto$_"} } qw(name department_1 street city)) || ' ' };
321
  $form->{shipto_label}   = \&_shipto_label;
317 322
  $form->{contacts_label} = sub { join ", ", grep { $_ } $_[0]->{cp_name}, $_[0]->{cp_givenname} };
318 323
  $form->{taxzone_id}     = 0                                                               if !$form->{id};
319 324
  $form->{jsscript}       = 1;
320 325
  $form->{fokus}          = "ct.greeting";
321
  $form->{AJAX}           = [ new CGI::Ajax( map {; "get_$_" => "$form->{script}?action=get_$_" } qw(shipto contact delivery) ) ];
326
  $form->{AJAX}           = [ new CGI::Ajax( map {; "get_$_" => "$form->{script}?action=get_$_" } qw(contact delivery) ) ];
327
  $form->{SHIPTO_ALL}     = [ +{ shipto_id => '0', shiptoname => $::locale->text('All') }, @{ $form->{SHIPTO} } ];
322 328

  
323
  unshift @{ $form->{SHIPTO} },   +{ shipto_id => '0', shiptoname => '' }, +{ shipto_id => '0', shiptoname => 'Alle' };
324 329
  unshift @{ $form->{CONTACTS} }, +{ cp_id     => '0', cp_name => $locale->text('New contact') };
325 330

  
326 331
  $form->{title} = $form->{title_save}
......
661 666

  
662 667
  $main::auth->assert('customer_vendor_edit');
663 668

  
664
  my $form     = $main::form;
665
  my %myconfig = %main::myconfig;
669
  CT->populate_drop_down_boxes(\%::myconfig, $::form);
670
  CT->get_shipto(\%::myconfig, $::form) if $::form->{shipto_id};
666 671

  
667
  CT->get_shipto(\%myconfig, \%$form);
668
  print $form->ajax_response_header(), join('__pjx__', map($form->{"shipto$_"}, qw(name department_1 department_2 street zipcode city country contact phone fax email used)));
669
  $main::lxdebug->leave_sub();
672
  $::form->{shipto_label} = \&_shipto_label;
670 673

  
674
  print $::form->ajax_response_header(), $::form->parse_html_template('ct/_shipto');
675

  
676
  $main::lxdebug->leave_sub();
671 677
}
672 678

  
673 679
sub get_delivery {
templates/webpages/ct/_shipto.html
1
[% USE L %][% USE HTML %][% USE T8 %][% USE LxERP %]
2
    <table width="100%" id="shipto_table">
3
     <tr>
4
      <th align="right">[% 'Shipping Address' | $T8 %]</th>
5
      <td>
6
       [%- INCLUDE generic/multibox.html
7
             name       = 'shipto_id',
8
             id         = 'shipto_id',
9
             DATA       = SHIPTO,
10
             onChange   = "\$('#shipto_table').load('ct.pl?action=get_shipto&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)",
11
             id_key     = 'shipto_id',
12
             label_sub  = 'shipto_label',
13
             label_key  = 'shipto_label',
14
             show_empty = 1,
15
       -%]
16
      </td>
17
     </tr>
18

  
19
     <tr>
20
      <th align="right" nowrap>[% 'Company Name' | $T8 %]</th>
21
      <td><input id="shiptoname" name="shiptoname" size="35" maxlength="75" value="[% HTML.escape(shiptoname) %]"></td>
22
     </tr>
23

  
24
     <tr>
25
      <th align="right" nowrap>[% 'Abteilung' | $T8 %]</th>
26
      <td>
27
       <input id="shiptodepartment_1" name="shiptodepartment_1" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_1) %]">
28
       <input id="shiptodepartment_2" name="shiptodepartment_2" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_2) %]">
29
      </td>
30
     </tr>
31

  
32
     <tr>
33
      <th align="right" nowrap>[% 'Street' | $T8 %]</th>
34
      <td><input id="shiptostreet" name="shiptostreet" size="35" maxlength="75" value="[% HTML.escape(shiptostreet) %]"></td>
35
     </tr>
36

  
37
     <tr>
38
      <th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
39
      <td>
40
       <input id="shiptozipcode" name="shiptozipcode" size="5" maxlength="75" value="[% HTML.escape(shiptozipcode) %]">
41
       <input id="shiptocity" name="shiptocity" size="30" maxlength="75" value="[% HTML.escape(shiptocity) %]">
42
      </td>
43
     </tr>
44

  
45
     <tr>
46
      <th align="right" nowrap>[% 'Country' | $T8 %]</th>
47
      <td><input id="shiptocountry" name="shiptocountry" size="35" maxlength="75" value="[% HTML.escape(shiptocountry) %]"></td>
48
     </tr>
49

  
50
     <tr>
51
      <th align="right" nowrap>[% 'Contact' | $T8 %]</th>
52
      <td><input id="shiptocontact" name="shiptocontact" size="30" maxlength="75" value="[% HTML.escape(shiptocontact) %]"></td>
53
     </tr>
54

  
55
     <tr>
56
      <th align="right" nowrap>[% 'Phone' | $T8 %]</th>
57
      <td><input id="shiptophone" name="shiptophone" size="30" maxlength="30" value="[% HTML.escape(shiptophone) %]"></td>
58
     </tr>
59

  
60
     <tr>
61
      <th align="right" nowrap>[% 'Fax' | $T8 %]</th>
62
      <td><input id="shiptofax" name="shiptofax" size="30" maxlength="30" value="[% HTML.escape(shiptofax) %]"></td>
63
     </tr>
64

  
65
     <tr>
66
      <th align="right" nowrap>[% 'E-mail' | $T8 %]</th>
67
      <td><input id="shiptoemail" name="shiptoemail" size="45" value="[% HTML.escape(shiptoemail) %]"></td>
68
     </tr>
69
    </table>
templates/webpages/ct/form_header.html
300 300
   </div>
301 301

  
302 302
   <div id="shipto" class="tabcontent">
303

  
304
    <table width="100%">
305
     <tr>
306
      <th align="right">[% 'Shipping Address' | $T8 %]</th>
307
      <td>
308
       [%- INCLUDE generic/multibox.html
309
             name       = 'shipto_id',
310
             id         = 'shipto_id',
311
             DATA       = SHIPTO,
312
             onChange   = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto,set_gender])",
313
             id_key     = 'shipto_id',
314
             label_sub  = 'shipto_label',
315
             label_key  = 'shipto_label',
316
       -%]
317
      </td>
318
     </tr>
319

  
320
     <tr>
321
      <th align="right" nowrap>[% 'Company Name' | $T8 %]</th>
322
      <td><input id="shiptoname" name="shiptoname" size="35" maxlength="75" value="[% HTML.escape(shiptoname) %]"></td>
323
     </tr>
324

  
325
     <tr>
326
      <th align="right" nowrap>[% 'Abteilung' | $T8 %]</th>
327
      <td>
328
       <input id="shiptodepartment_1" name="shiptodepartment_1" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_1) %]">
329
       <input id="shiptodepartment_2" name="shiptodepartment_2" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_2) %]">
330
      </td>
331
     </tr>
332

  
333
     <tr>
334
      <th align="right" nowrap>[% 'Street' | $T8 %]</th>
335
      <td><input id="shiptostreet" name="shiptostreet" size="35" maxlength="75" value="[% HTML.escape(shiptostreet) %]"></td>
336
     </tr>
337

  
338
     <tr>
339
      <th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
340
      <td>
341
       <input id="shiptozipcode" name="shiptozipcode" size="5" maxlength="75" value="[% HTML.escape(shiptozipcode) %]">
342
       <input id="shiptocity" name="shiptocity" size="30" maxlength="75" value="[% HTML.escape(shiptocity) %]">
343
      </td>
344
     </tr>
345

  
346
     <tr>
347
      <th align="right" nowrap>[% 'Country' | $T8 %]</th>
348
      <td><input id="shiptocountry" name="shiptocountry" size="35" maxlength="75" value="[% HTML.escape(shiptocountry) %]"></td>
349
     </tr>
350

  
351
     <tr>
352
      <th align="right" nowrap>[% 'Contact' | $T8 %]</th>
353
      <td><input id="shiptocontact" name="shiptocontact" size="30" maxlength="75" value="[% HTML.escape(shiptocontact) %]"></td>
354
     </tr>
355

  
356
     <tr>
357
      <th align="right" nowrap>[% 'Phone' | $T8 %]</th>
358
      <td><input id="shiptophone" name="shiptophone" size="30" maxlength="30" value="[% HTML.escape(shiptophone) %]"></td>
359
     </tr>
360

  
361
     <tr>
362
      <th align="right" nowrap>[% 'Fax' | $T8 %]</th>
363
      <td><input id="shiptofax" name="shiptofax" size="30" maxlength="30" value="[% HTML.escape(shiptofax) %]"></td>
364
     </tr>
365

  
366
     <tr>
367
      <th align="right" nowrap>[% 'E-mail' | $T8 %]</th>
368
      <td><input id="shiptoemail" name="shiptoemail" size="45" value="[% HTML.escape(shiptoemail) %]"></td>
369
     </tr>
370

  
371
     <tr>
372
      <td>&nbsp;</td>
373
     </tr>
374
     <tr>
375
      <td>&nbsp;</td>
376
     </tr>
377
    </table>
303
    [% INCLUDE 'ct/_shipto.html' %]
378 304

  
379 305
    <input type="submit" id="delete_shipto" name="action" value="[% 'Delete Shipto' | $T8 %]" disabled>
380 306
    <br style="clear: left" />
......
530 456
       [%- INCLUDE generic/multibox.html
531 457
             name       = 'delivery_id',
532 458
             id         = 'delivery_id',
533
             DATA       = SHIPTO,
459
             DATA       = SHIPTO_ALL,
534 460
             onChange   = "get_delivery(['shipto_id__' + this.value, 'from__' + from.value, 'to__' + to.value, 'id__' + cvid.value, 'db__' + db.value], ['delivery'])",
535 461
             id_key     = 'shipto_id',
536 462
             label_sub  = 'shipto_label',
463
             show_empty = 1,
537 464
       -%]
538 465
      </td>
539 466
     </tr>

Auch abrufbar als: Unified diff