Revision 6ef4190e
Von Moritz Bunkus vor mehr als 8 Jahren hinzugefügt
SL/Controller/CustomerVendor.pm | ||
---|---|---|
198 | 198 |
|
199 | 199 |
$self->{shipto}->trans_id($self->{cv}->id); |
200 | 200 |
if( $self->{shipto}->shiptoname ne '' ) { |
201 |
$self->{shipto}->save(); |
|
201 |
$self->{shipto}->save(cascade => 1);
|
|
202 | 202 |
} |
203 | 203 |
|
204 | 204 |
my $snumbers = $self->is_vendor() ? 'vendornumber_'. $self->{cv}->vendornumber : 'customernumber_'. $self->{cv}->customernumber; |
... | ... | |
529 | 529 |
sub action_ajaj_get_shipto { |
530 | 530 |
my ($self) = @_; |
531 | 531 |
|
532 |
my $data = { |
|
532 |
my $data = {}; |
|
533 |
$data->{shipto} = { |
|
533 | 534 |
map( |
534 | 535 |
{ |
535 | 536 |
my $name = 'shipto'. $_; |
... | ... | |
539 | 540 |
) |
540 | 541 |
}; |
541 | 542 |
|
543 |
$data->{shipto_cvars} = $self->_prepare_cvar_configs_for_ajaj($self->{shipto}->cvars_by_config); |
|
544 |
|
|
542 | 545 |
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 }); |
543 | 546 |
} |
544 | 547 |
|
... | ... | |
755 | 758 |
|
756 | 759 |
$self->_copy_form_to_cvars(target => $self->{cv}, source => $::form->{cv_cvars}); |
757 | 760 |
$self->_copy_form_to_cvars(target => $self->{contact}, source => $::form->{contact_cvars}); |
761 |
$self->_copy_form_to_cvars(target => $self->{shipto}, source => $::form->{shipto_cvars}); |
|
758 | 762 |
} |
759 | 763 |
|
760 | 764 |
sub _load_customer_vendor { |
SL/DB/Shipto.pm | ||
---|---|---|
4 | 4 |
|
5 | 5 |
use SL::DB::MetaSetup::Shipto; |
6 | 6 |
use SL::DB::Manager::Shipto; |
7 |
use SL::DB::Helper::CustomVariables ( |
|
8 |
module => 'ShipTo', |
|
9 |
cvars_alias => 1, |
|
10 |
); |
|
7 | 11 |
|
8 | 12 |
our @SHIPTO_VARIABLES = qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptogln shiptocontact |
9 | 13 |
shiptophone shiptofax shiptoemail shiptodepartment_1 shiptodepartment_2); |
js/kivi.CustomerVendor.js | ||
---|---|---|
2 | 2 |
|
3 | 3 |
this.selectShipto = function(params) { |
4 | 4 |
var shiptoId = $('#shipto_shipto_id').val(); |
5 |
var url = 'controller.pl?action=CustomerVendor/ajaj_get_shipto&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&shipto_id='+ shiptoId; |
|
5 | 6 |
|
6 |
if( shiptoId ) { |
|
7 |
var url = 'controller.pl?action=CustomerVendor/ajaj_get_shipto&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&shipto_id='+ shiptoId; |
|
7 |
$.getJSON(url, function(data) { |
|
8 |
var shipto = data.shipto; |
|
9 |
for(var key in shipto) |
|
10 |
$('#shipto_'+ key).val(shipto[key]) |
|
8 | 11 |
|
9 |
$.getJSON(url, function(data) { |
|
10 |
for(var key in data) |
|
11 |
$('#shipto_'+ key).val(data[key]); |
|
12 |
kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.shipto_cvars, 'shipto_cvars_'); |
|
12 | 13 |
|
14 |
if ( shiptoId ) |
|
13 | 15 |
$('#action_delete_shipto').show(); |
16 |
else |
|
17 |
$('#action_delete_shipto').hide(); |
|
14 | 18 |
|
15 |
if( params.onFormSet ) |
|
16 |
params.onFormSet(); |
|
17 |
}); |
|
18 |
} |
|
19 |
else { |
|
20 |
$('#shipto :input').not(':button, :submit, :reset, :hidden').val(''); |
|
21 |
|
|
22 |
$('#action_delete_shipto').hide(); |
|
23 |
|
|
24 |
if( params.onFormSet ) |
|
19 |
if ( params.onFormSet ) |
|
25 | 20 |
params.onFormSet(); |
26 |
} |
|
21 |
});
|
|
27 | 22 |
}; |
28 | 23 |
|
29 | 24 |
this.selectDelivery = function(fromDate, toDate) { |
... | ... | |
41 | 36 |
} |
42 | 37 |
}; |
43 | 38 |
|
44 |
this.setCustomVariablesFromAJAJ = function(cvars) { |
|
39 |
this.setCustomVariablesFromAJAJ = function(cvars, prefix) {
|
|
45 | 40 |
for (var key in cvars) { |
46 | 41 |
var cvar = cvars[key]; |
47 |
var $ctrl = $('#contact_cvars_'+ key);
|
|
42 |
var $ctrl = $('#' + prefix + key);
|
|
48 | 43 |
|
49 | 44 |
if (cvar.type == 'bool') |
50 | 45 |
$ctrl.prop('checked', cvar.value == 1 ? 'checked' : ''); |
... | ... | |
70 | 65 |
for(var key in contact) |
71 | 66 |
$('#contact_'+ key).val(contact[key]) |
72 | 67 |
|
73 |
kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars); |
|
68 |
kivi.CustomerVendor.setCustomVariablesFromAJAJ(data.contact_cvars, 'contact_cvars_');
|
|
74 | 69 |
|
75 | 70 |
if ( contactId ) |
76 | 71 |
$('#action_delete_contact').show(); |
templates/webpages/customer_vendor/tabs/shipto.html | ||
---|---|---|
111 | 111 |
[% L.input_tag('shipto.shiptoemail', SELF.shipto.shiptoemail, size = 45) %] |
112 | 112 |
</td> |
113 | 113 |
</tr> |
114 |
|
|
115 |
[% shipto_cvars = SELF.shipto.cvars_by_config %] |
|
116 |
|
|
117 |
[% IF ( shipto_cvars.size ) %] |
|
118 |
<tr> |
|
119 |
<td colspan="2"> |
|
120 |
<hr> |
|
121 |
</td> |
|
122 |
</tr> |
|
123 |
|
|
124 |
[% FOREACH var = shipto_cvars %] |
|
125 |
<tr> |
|
126 |
<th align="right" valign="top" nowrap>[% var.config.description | html %]</th> |
|
127 |
|
|
128 |
<td valign="top"> |
|
129 |
[% INCLUDE 'common/render_cvar_input.html' |
|
130 |
cvar_name_prefix = 'shipto_cvars.' |
|
131 |
%] |
|
132 |
</td> |
|
133 |
</tr> |
|
134 |
[% END %] |
|
135 |
[% END %] |
|
114 | 136 |
</table> |
115 | 137 |
|
116 | 138 |
[% L.button_tag('submitInputButton(this);', LxERP.t8('Delete Shipto'), name = 'action_delete_shipto', class = 'submit') %] |
Auch abrufbar als: Unified diff
CVars: Lieferadressen-CVars in Stammdaten bearbeiten