$main::lxdebug->leave_sub();
}
+sub _shipto_label {
+ my $s = shift(@_);
+ join('; ', grep { $_ } map { $s->{"shipto$_"} } qw(name department_1 street city)) || ' '
+}
+
sub form_header {
$main::lxdebug->enter_sub();
$form->{is_admin} = $myconfig{role} eq 'admin';
$form->{is_customer} = $form->{db} eq 'customer';
$form->{salesman_label} = sub { $_[0]->{name} ne "" ? $_[0]->{name} : $_[0]->{login} };
- $form->{shipto_label} = sub { my $s = shift(@_); join('; ', grep { $_ } map { $s->{"shipto$_"} } qw(name department_1 street city)) || ' ' };
+ $form->{shipto_label} = \&_shipto_label;
$form->{contacts_label} = sub { join ", ", grep { $_ } $_[0]->{cp_name}, $_[0]->{cp_givenname} };
$form->{taxzone_id} = 0 if !$form->{id};
$form->{jsscript} = 1;
$form->{fokus} = "ct.greeting";
- $form->{AJAX} = [ new CGI::Ajax( map {; "get_$_" => "$form->{script}?action=get_$_" } qw(shipto contact delivery) ) ];
+ $form->{AJAX} = [ new CGI::Ajax( map {; "get_$_" => "$form->{script}?action=get_$_" } qw(contact delivery) ) ];
+ $form->{SHIPTO_ALL} = [ +{ shipto_id => '0', shiptoname => $::locale->text('All') }, @{ $form->{SHIPTO} } ];
- unshift @{ $form->{SHIPTO} }, +{ shipto_id => '0', shiptoname => '' }, +{ shipto_id => '0', shiptoname => 'Alle' };
unshift @{ $form->{CONTACTS} }, +{ cp_id => '0', cp_name => $locale->text('New contact') };
$form->{title} = $form->{title_save}
$main::auth->assert('customer_vendor_edit');
- my $form = $main::form;
- my %myconfig = %main::myconfig;
+ CT->populate_drop_down_boxes(\%::myconfig, $::form);
+ CT->get_shipto(\%::myconfig, $::form) if $::form->{shipto_id};
- CT->get_shipto(\%myconfig, \%$form);
- 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)));
- $main::lxdebug->leave_sub();
+ $::form->{shipto_label} = \&_shipto_label;
+ print $::form->ajax_response_header(), $::form->parse_html_template('ct/_shipto');
+
+ $main::lxdebug->leave_sub();
}
sub get_delivery {
--- /dev/null
+[% USE L %][% USE HTML %][% USE T8 %][% USE LxERP %]
+ <table width="100%" id="shipto_table">
+ <tr>
+ <th align="right">[% 'Shipping Address' | $T8 %]</th>
+ <td>
+ [%- INCLUDE generic/multibox.html
+ name = 'shipto_id',
+ id = 'shipto_id',
+ DATA = SHIPTO,
+ onChange = "\$('#shipto_table').load('ct.pl?action=get_shipto&id=' + \$('#cvid').attr('value') + '&db=' + \$('#db').attr('value') + '&shipto_id=' + this.value)",
+ id_key = 'shipto_id',
+ label_sub = 'shipto_label',
+ label_key = 'shipto_label',
+ show_empty = 1,
+ -%]
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Company Name' | $T8 %]</th>
+ <td><input id="shiptoname" name="shiptoname" size="35" maxlength="75" value="[% HTML.escape(shiptoname) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Abteilung' | $T8 %]</th>
+ <td>
+ <input id="shiptodepartment_1" name="shiptodepartment_1" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_1) %]">
+ <input id="shiptodepartment_2" name="shiptodepartment_2" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_2) %]">
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Street' | $T8 %]</th>
+ <td><input id="shiptostreet" name="shiptostreet" size="35" maxlength="75" value="[% HTML.escape(shiptostreet) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
+ <td>
+ <input id="shiptozipcode" name="shiptozipcode" size="5" maxlength="75" value="[% HTML.escape(shiptozipcode) %]">
+ <input id="shiptocity" name="shiptocity" size="30" maxlength="75" value="[% HTML.escape(shiptocity) %]">
+ </td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Country' | $T8 %]</th>
+ <td><input id="shiptocountry" name="shiptocountry" size="35" maxlength="75" value="[% HTML.escape(shiptocountry) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Contact' | $T8 %]</th>
+ <td><input id="shiptocontact" name="shiptocontact" size="30" maxlength="75" value="[% HTML.escape(shiptocontact) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Phone' | $T8 %]</th>
+ <td><input id="shiptophone" name="shiptophone" size="30" maxlength="30" value="[% HTML.escape(shiptophone) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'Fax' | $T8 %]</th>
+ <td><input id="shiptofax" name="shiptofax" size="30" maxlength="30" value="[% HTML.escape(shiptofax) %]"></td>
+ </tr>
+
+ <tr>
+ <th align="right" nowrap>[% 'E-mail' | $T8 %]</th>
+ <td><input id="shiptoemail" name="shiptoemail" size="45" value="[% HTML.escape(shiptoemail) %]"></td>
+ </tr>
+ </table>
</div>
<div id="shipto" class="tabcontent">
-
- <table width="100%">
- <tr>
- <th align="right">[% 'Shipping Address' | $T8 %]</th>
- <td>
- [%- INCLUDE generic/multibox.html
- name = 'shipto_id',
- id = 'shipto_id',
- DATA = SHIPTO,
- 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])",
- id_key = 'shipto_id',
- label_sub = 'shipto_label',
- label_key = 'shipto_label',
- -%]
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Company Name' | $T8 %]</th>
- <td><input id="shiptoname" name="shiptoname" size="35" maxlength="75" value="[% HTML.escape(shiptoname) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Abteilung' | $T8 %]</th>
- <td>
- <input id="shiptodepartment_1" name="shiptodepartment_1" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_1) %]">
- <input id="shiptodepartment_2" name="shiptodepartment_2" size="16" maxlength="75" value="[% HTML.escape(shiptodepartment_2) %]">
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Street' | $T8 %]</th>
- <td><input id="shiptostreet" name="shiptostreet" size="35" maxlength="75" value="[% HTML.escape(shiptostreet) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th>
- <td>
- <input id="shiptozipcode" name="shiptozipcode" size="5" maxlength="75" value="[% HTML.escape(shiptozipcode) %]">
- <input id="shiptocity" name="shiptocity" size="30" maxlength="75" value="[% HTML.escape(shiptocity) %]">
- </td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Country' | $T8 %]</th>
- <td><input id="shiptocountry" name="shiptocountry" size="35" maxlength="75" value="[% HTML.escape(shiptocountry) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Contact' | $T8 %]</th>
- <td><input id="shiptocontact" name="shiptocontact" size="30" maxlength="75" value="[% HTML.escape(shiptocontact) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Phone' | $T8 %]</th>
- <td><input id="shiptophone" name="shiptophone" size="30" maxlength="30" value="[% HTML.escape(shiptophone) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'Fax' | $T8 %]</th>
- <td><input id="shiptofax" name="shiptofax" size="30" maxlength="30" value="[% HTML.escape(shiptofax) %]"></td>
- </tr>
-
- <tr>
- <th align="right" nowrap>[% 'E-mail' | $T8 %]</th>
- <td><input id="shiptoemail" name="shiptoemail" size="45" value="[% HTML.escape(shiptoemail) %]"></td>
- </tr>
-
- <tr>
- <td> </td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- </table>
+ [% INCLUDE 'ct/_shipto.html' %]
<input type="submit" id="delete_shipto" name="action" value="[% 'Delete Shipto' | $T8 %]" disabled>
<br style="clear: left" />
[%- INCLUDE generic/multibox.html
name = 'delivery_id',
id = 'delivery_id',
- DATA = SHIPTO,
+ DATA = SHIPTO_ALL,
onChange = "get_delivery(['shipto_id__' + this.value, 'from__' + from.value, 'to__' + to.value, 'id__' + cvid.value, 'db__' + db.value], ['delivery'])",
id_key = 'shipto_id',
label_sub = 'shipto_label',
+ show_empty = 1,
-%]
</td>
</tr>