Revision ce73964f
Von Moritz Bunkus vor etwa 3 Jahren hinzugefügt
SL/Controller/CustomerVendor.pm | ||
---|---|---|
61 | 61 |
'delete', |
62 | 62 |
'delete_contact', |
63 | 63 |
'delete_shipto', |
64 |
'delete_additional_billing_address', |
|
64 | 65 |
] |
65 | 66 |
); |
66 | 67 |
|
... | ... | |
71 | 72 |
'show', |
72 | 73 |
'update', |
73 | 74 |
'ajaj_get_shipto', |
75 |
'ajaj_get_additional_billing_address', |
|
74 | 76 |
'ajaj_get_contact', |
75 | 77 |
'ajax_list_prices', |
76 | 78 |
] |
... | ... | |
88 | 90 |
|
89 | 91 |
__PACKAGE__->run_before('normalize_name'); |
90 | 92 |
|
93 |
my @ADDITIONAL_BILLING_ADDRESS_COLUMNS = qw(name department_1 department_2 contact street zipcode city country gln email phone fax default_address); |
|
91 | 94 |
|
92 | 95 |
sub action_add { |
93 | 96 |
my ($self) = @_; |
... | ... | |
280 | 283 |
$self->{shipto}->save(cascade => 1); |
281 | 284 |
} |
282 | 285 |
|
286 |
if ($self->is_customer && any { $self->{additional_billing_address}->$_ ne '' } @ADDITIONAL_BILLING_ADDRESS_COLUMNS) { |
|
287 |
$self->{additional_billing_address}->customer_id($self->{cv}->id); |
|
288 |
$self->{additional_billing_address}->save(cascade => 1); |
|
289 |
|
|
290 |
# Make sure only one address per customer has "default address" set. |
|
291 |
if ($self->{additional_billing_address}->default_address) { |
|
292 |
SL::DB::Manager::AdditionalBillingAddress->update_all( |
|
293 |
set => { default_address => 0, }, |
|
294 |
where => [ |
|
295 |
customer_id => $self->{cv}->id, |
|
296 |
'!id' => $self->{additional_billing_address}->id, |
|
297 |
]); |
|
298 |
} |
|
299 |
} |
|
300 |
|
|
283 | 301 |
my $snumbers = $self->is_vendor() ? 'vendornumber_'. $self->{cv}->vendornumber : 'customernumber_'. $self->{cv}->customernumber; |
284 | 302 |
SL::DB::History->new( |
285 | 303 |
trans_id => $self->{cv}->id, |
... | ... | |
325 | 343 |
push(@redirect_params, shipto_id => $self->{shipto}->shipto_id); |
326 | 344 |
} |
327 | 345 |
|
346 |
if ( $self->is_customer && $self->{additional_billing_address}->id ) { |
|
347 |
push(@redirect_params, additional_billing_address_id => $self->{additional_billing_address}->id); |
|
348 |
} |
|
349 |
|
|
328 | 350 |
$self->redirect_to(@redirect_params); |
329 | 351 |
} |
330 | 352 |
|
... | ... | |
512 | 534 |
$self->action_edit(); |
513 | 535 |
} |
514 | 536 |
|
537 |
sub action_delete_additional_billing_address { |
|
538 |
my ($self) = @_; |
|
539 |
|
|
540 |
my $db = $self->{additional_billing_address}->db; |
|
541 |
|
|
542 |
if ( !$self->{additional_billing_address}->id ) { |
|
543 |
SL::Helper::Flash::flash('error', $::locale->text('No address selected to delete')); |
|
544 |
} else { |
|
545 |
$db->with_transaction(sub { |
|
546 |
if ( $self->{additional_billing_address}->used ) { |
|
547 |
$self->{additional_billing_address}->detach; |
|
548 |
$self->{additional_billing_address}->save(cascade => 1); |
|
549 |
SL::Helper::Flash::flash('info', $::locale->text('Address is in use and was flagged invalid.')); |
|
550 |
} else { |
|
551 |
$self->{additional_billing_address}->delete(cascade => 1); |
|
552 |
SL::Helper::Flash::flash('info', $::locale->text('Address deleted.')); |
|
553 |
} |
|
554 |
|
|
555 |
1; |
|
556 |
}) || die($db->error); |
|
557 |
|
|
558 |
$self->{additional_billing_address} = SL::DB::AdditionalBillingAddress->new; |
|
559 |
} |
|
560 |
|
|
561 |
$self->action_edit; |
|
562 |
} |
|
515 | 563 |
|
516 | 564 |
sub action_search { |
517 | 565 |
my ($self) = @_; |
... | ... | |
637 | 685 |
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 }); |
638 | 686 |
} |
639 | 687 |
|
688 |
sub action_ajaj_get_additional_billing_address { |
|
689 |
my ($self) = @_; |
|
690 |
|
|
691 |
my $data = { |
|
692 |
additional_billing_address => { |
|
693 |
map { ($_ => $self->{additional_billing_address}->$_) } ('id', @ADDITIONAL_BILLING_ADDRESS_COLUMNS) |
|
694 |
}, |
|
695 |
}; |
|
696 |
|
|
697 |
$self->render(\SL::JSON::to_json($data), { type => 'json', process => 0 }); |
|
698 |
} |
|
699 |
|
|
640 | 700 |
sub action_ajaj_get_contact { |
641 | 701 |
my ($self) = @_; |
642 | 702 |
|
... | ... | |
899 | 959 |
$self->{shipto}->assign_attributes(%{$::form->{shipto}}); |
900 | 960 |
$self->{shipto}->module('CT'); |
901 | 961 |
|
962 |
if ($self->is_customer) { |
|
963 |
if ( $::form->{additional_billing_address}->{id} ) { |
|
964 |
$self->{additional_billing_address} = SL::DB::AdditionalBillingAddress->new(id => $::form->{additional_billing_address}->{id})->load; |
|
965 |
} else { |
|
966 |
$self->{additional_billing_address} = SL::DB::AdditionalBillingAddress->new; |
|
967 |
} |
|
968 |
$self->{additional_billing_address}->assign_attributes(%{ $::form->{additional_billing_address} }); |
|
969 |
} |
|
970 |
|
|
902 | 971 |
if ( $::form->{contact}->{cp_id} ) { |
903 | 972 |
$self->{contact} = SL::DB::Contact->new(cp_id => $::form->{contact}->{cp_id})->load(); |
904 | 973 |
} else { |
... | ... | |
940 | 1009 |
$self->{shipto} = SL::DB::Shipto->new(); |
941 | 1010 |
} |
942 | 1011 |
|
1012 |
if ($self->is_customer) { |
|
1013 |
if ( $::form->{additional_billing_address_id} ) { |
|
1014 |
$self->{additional_billing_address} = SL::DB::AdditionalBillingAddress->new(id => $::form->{additional_billing_address_id})->load; |
|
1015 |
die($::locale->text('Error')) if $self->{additional_billing_address}->customer_id != $self->{cv}->id; |
|
1016 |
|
|
1017 |
} else { |
|
1018 |
$self->{additional_billing_address} = SL::DB::AdditionalBillingAddress->new; |
|
1019 |
} |
|
1020 |
} |
|
1021 |
|
|
943 | 1022 |
if ( $::form->{contact_id} ) { |
944 | 1023 |
$self->{contact} = SL::DB::Contact->new(cp_id => $::form->{contact_id})->load(); |
945 | 1024 |
|
... | ... | |
988 | 1067 |
$self->{note_followup} = SL::DB::FollowUp->new(); |
989 | 1068 |
|
990 | 1069 |
$self->{shipto} = SL::DB::Shipto->new(); |
1070 |
$self->{additional_billing_address} = SL::DB::AdditionalBillingAddress->new if $self->is_customer; |
|
991 | 1071 |
|
992 | 1072 |
$self->{contact} = $self->_new_contact_object; |
993 | 1073 |
} |
... | ... | |
1064 | 1144 |
$self->{shiptos} = $self->{cv}->shipto; |
1065 | 1145 |
$self->{shiptos} ||= []; |
1066 | 1146 |
|
1147 |
if ($self->is_customer) { |
|
1148 |
$self->{additional_billing_addresses} = $self->{cv}->additional_billing_addresses; |
|
1149 |
$self->{additional_billing_addresses} ||= []; |
|
1150 |
} |
|
1151 |
|
|
1067 | 1152 |
$self->{notes} = SL::DB::Manager::Note->get_all( |
1068 | 1153 |
query => [ |
1069 | 1154 |
trans_id => $self->{cv}->id, |
... | ... | |
1311 | 1396 |
my ($self) = @_; |
1312 | 1397 |
|
1313 | 1398 |
my $class = 'SL::DB::' . ($self->is_vendor ? 'Vendor' : 'Customer'); |
1314 |
return $class->new(
|
|
1399 |
my $object = $class->new(
|
|
1315 | 1400 |
contacts => [], |
1316 | 1401 |
shipto => [], |
1317 | 1402 |
custom_variables => [], |
1318 | 1403 |
); |
1404 |
|
|
1405 |
$object->additional_billing_addresses([]) if $self->is_customer; |
|
1406 |
|
|
1407 |
return $object; |
|
1319 | 1408 |
} |
1320 | 1409 |
|
1321 | 1410 |
sub _new_contact_object { |
js/kivi.CustomerVendor.js | ||
---|---|---|
21 | 21 |
}); |
22 | 22 |
}; |
23 | 23 |
|
24 |
this.selectAdditionalBillingAddress = function(params) { |
|
25 |
var additionalBillingAddressId = $('#additional_billing_address_id').val(); |
|
26 |
var url = 'controller.pl?action=CustomerVendor/ajaj_get_additional_billing_address&id='+ $('#cv_id').val() +'&db='+ $('#db').val() +'&additional_billing_address_id='+ additionalBillingAddressId; |
|
27 |
|
|
28 |
$.getJSON(url, function(data) { |
|
29 |
var additional_billing_address = data.additional_billing_address; |
|
30 |
for (var key in additional_billing_address) |
|
31 |
$('#additional_billing_address_'+ key).val(additional_billing_address[key]) |
|
32 |
|
|
33 |
if ( additionalBillingAddressId ) |
|
34 |
$('#action_delete_additional_billing_address').show(); |
|
35 |
else |
|
36 |
$('#action_delete_additional_billing_address').hide(); |
|
37 |
|
|
38 |
if ( params.onFormSet ) |
|
39 |
params.onFormSet(); |
|
40 |
}); |
|
41 |
}; |
|
42 |
|
|
24 | 43 |
this.selectDelivery = function(fromDate, toDate) { |
25 | 44 |
var deliveryId = $('#delivery_id').val(); |
26 | 45 |
|
... | ... | |
449 | 468 |
$(elt).data('customer_vendor_picker', new kivi.CustomerVendor.Picker($(elt))); |
450 | 469 |
}); |
451 | 470 |
|
452 |
$('#cv_phone,#shipto_shiptophone,#contact_cp_phone1,#contact_cp_phone2,#contact_cp_mobile1,#contact_cp_mobile2').each(function(idx, elt) { |
|
471 |
$('#cv_phone,#shipto_shiptophone,#additional_billing_address_phone,#contact_cp_phone1,#contact_cp_phone2,#contact_cp_mobile1,#contact_cp_mobile2').each(function(idx, elt) {
|
|
453 | 472 |
kivi.CustomerVendor.init_dial_action($(elt)); |
454 | 473 |
}); |
455 | 474 |
} |
locale/de/all | ||
---|---|---|
254 | 254 |
'Added sections and function blocks: #1' => 'Hinzugefügte Abschnitte und Funktionsblöcke: #1', |
255 | 255 |
'Added text blocks: #1' => 'Hinzugefügte Textblöcke: #1', |
256 | 256 |
'Addition' => 'Zusatz', |
257 |
'Additional Billing Addresses' => 'Zusätzliche Rechnungsadressen', |
|
257 | 258 |
'Additional articles' => 'Zusätzliche Artikel', |
258 | 259 |
'Additional articles actions' => 'Aktionen zu zusätzlichen Artikeln', |
259 | 260 |
'Additionally the invoice is marked for direct debit and would have been checked automatically had the bank information been entered.' => 'Weiterhin ist die Rechnung für Lastschrifteinzug vorgesehen und wäre standardmäßig ausgewählt, wenn die Bankinformationen eingetragen wären.', |
260 | 261 |
'Additionally the invoice is not marked for direct debit and would have been checked automatically had the bank information been entered.' => 'Weiterhin ist die Rechnung nicht für Lastschrifteinzug vorgesehen und wäre standardmäßig ausgewählt, wenn die Bankinformationen eingetragen wären.', |
261 | 262 |
'Address' => 'Adresse', |
263 |
'Address deleted.' => 'Adresse gelöscht', |
|
264 |
'Address is in use and was flagged invalid.' => 'Adresse wurde benutzt und wird nur als ungültig markiert', |
|
262 | 265 |
'Administration' => 'Administration', |
263 | 266 |
'Administration area' => 'Administration', |
264 | 267 |
'Advance turnover tax return' => 'Umsatzsteuervoranmeldung', |
... | ... | |
978 | 981 |
'Decrease' => 'Verringern', |
979 | 982 |
'Default (no language selected)' => 'Standard (keine Sprache ausgewählt)', |
980 | 983 |
'Default Accounts' => 'Standardkonten', |
984 |
'Default Billing Address' => 'Standard-Rechnungsadresse', |
|
981 | 985 |
'Default Bin' => 'Standard-Lagerplatz', |
982 | 986 |
'Default Bin with ignoring onhand' => 'Standard-Lagerplatz für Auslagern ohne Prüfung auf Bestand', |
983 | 987 |
'Default Client (unconfigured)' => 'Standardmandant (unkonfiguriert)', |
... | ... | |
1015 | 1019 |
'Delete Documents' => 'Dokumente löschen', |
1016 | 1020 |
'Delete Images' => 'Bilder löschen', |
1017 | 1021 |
'Delete Shipto' => 'Lieferadresse löschen', |
1022 |
'Delete address' => 'Adresse löschen', |
|
1018 | 1023 |
'Delete all' => 'Alle Löschen', |
1019 | 1024 |
'Delete for Customers' => 'Bei Kunden löschen', |
1020 | 1025 |
'Delete links' => 'Verknüpfungen löschen', |
... | ... | |
2110 | 2115 |
'New Password' => 'Neues Passwort', |
2111 | 2116 |
'New Purchase Price Rule' => 'Neue Einkaufspreisregel', |
2112 | 2117 |
'New Sales Price Rule' => 'Neue Verkaufspreisregel', |
2118 |
'New address' => 'Neue Adresse', |
|
2113 | 2119 |
'New client #1: The database configuration fields "host", "port", "name" and "user" must not be empty.' => 'Neuer Mandant #1: Die Datenbankkonfigurationsfelder "Host", "Port" und "Name" dürfen nicht leer sein.', |
2114 | 2120 |
'New client #1: The name must be unique and not empty.' => 'Neuer Mandant #1: Der Name darf nicht leer und muss eindeutig sein.', |
2115 | 2121 |
'New contact' => 'Neue Ansprechperson', |
... | ... | |
2140 | 2146 |
'No VAT Info for this Factur-X/ZUGFeRD invoice, please ask your vendor to add this for his Factur-X/ZUGFeRD data.' => 'Konnte keine UST-ID für diese Factur-X-/ZUGFeRD-Rechnungen finden, bitte fragen Sie bei Ihren Lieferanten nach, ob dieses Feld im Factur-X-/ZUGFeRD-Datensatz gesetzt wird.', |
2141 | 2147 |
'No Vendor was found matching the search parameters.' => 'Zu dem Suchbegriff wurde kein Händler gefunden', |
2142 | 2148 |
'No action defined.' => 'Keine Aktion definiert.', |
2149 |
'No address selected to delete' => 'Keine Adresse zum Löschen ausgewählt', |
|
2143 | 2150 |
'No article has been selected yet.' => 'Es wurde noch kein Artikel ausgewählt.', |
2144 | 2151 |
'No articles have been added yet.' => 'Es wurden noch keine Artikel hinzugefügt.', |
2145 | 2152 |
'No assembly has been selected yet.' => 'Es wurde noch kein Erzeugnis ausgewahlt.', |
templates/webpages/customer_vendor/form.html | ||
---|---|---|
20 | 20 |
<div class="tabwidget" id="customer_vendor_tabs"> |
21 | 21 |
<ul> |
22 | 22 |
<li><a href="#billing">[% 'Billing Address' | $T8 %]</a></li> |
23 |
<li><a href="#additional_billing_addresses">[% 'Additional Billing Addresses' | $T8 %]</a></li> |
|
23 | 24 |
<li><a href="#bank">[% 'Bank account' | $T8 %]</a></li> |
24 | 25 |
<li><a href="#shipto">[% 'Shipping Address' | $T8 %]</a></li> |
25 | 26 |
<li><a href="#contacts">[% 'Contacts' | $T8 %]</a></li> |
... | ... | |
61 | 62 |
</ul> |
62 | 63 |
|
63 | 64 |
[% PROCESS "customer_vendor/tabs/billing.html" %] |
65 |
[% PROCESS "customer_vendor/tabs/additional_billing_addresses.html" %] |
|
64 | 66 |
[% PROCESS "customer_vendor/tabs/bank.html" %] |
65 | 67 |
[% PROCESS "customer_vendor/tabs/shipto.html" %] |
66 | 68 |
[% PROCESS "customer_vendor/tabs/contacts.html" %] |
templates/webpages/customer_vendor/tabs/additional_billing_addresses.html | ||
---|---|---|
1 |
[%- USE T8 %] |
|
2 |
[%- USE LxERP %] |
|
3 |
[%- USE L %] |
|
4 |
|
|
5 |
<div id="additional_billing_addresses"> |
|
6 |
<table id="additional_billing_address_table"> |
|
7 |
<tr> |
|
8 |
<th align="right">[% 'Billing Address' | $T8 %]</th> |
|
9 |
|
|
10 |
<td> |
|
11 |
[% L.select_tag( |
|
12 |
'additional_billing_address.id', |
|
13 |
SELF.additional_billing_addresses, |
|
14 |
default = SELF.additional_billing_address.id, |
|
15 |
value_key = 'id', |
|
16 |
title_key = 'displayable_id', |
|
17 |
with_empty = 1, |
|
18 |
empty_title = LxERP.t8('New address'), |
|
19 |
onchange = "kivi.CustomerVendor.selectAdditionalBillingAddress({onFormSet: function(){ additionalBillingAddressMapWidget.testInputs(); kivi.reinit_widgets(); }});", |
|
20 |
) |
|
21 |
%] |
|
22 |
</td> |
|
23 |
</tr> |
|
24 |
|
|
25 |
<tr> |
|
26 |
<th align="right" nowrap>[% 'Default Billing Address' | $T8 %]</th> |
|
27 |
<td>[% L.yes_no_tag('additional_billing_address.default_address', SELF.additional_billing_address.default_address) %]</td> |
|
28 |
</tr> |
|
29 |
|
|
30 |
<tr> |
|
31 |
<th align="right" nowrap>[% 'Name' | $T8 %]</th> |
|
32 |
|
|
33 |
<td> |
|
34 |
[% L.input_tag('additional_billing_address.name', SELF.additional_billing_address.name, size = 35) %] |
|
35 |
</td> |
|
36 |
</tr> |
|
37 |
|
|
38 |
<tr> |
|
39 |
<th align="right" nowrap>[% 'Department' | $T8 %]</th> |
|
40 |
|
|
41 |
<td> |
|
42 |
[% L.input_tag('additional_billing_address.department_1', SELF.additional_billing_address.department_1, size = 16) %] |
|
43 |
[% L.input_tag('additional_billing_address.department_2', SELF.additional_billing_address.department_2, size = 16) %] |
|
44 |
</td> |
|
45 |
</tr> |
|
46 |
|
|
47 |
<tr> |
|
48 |
<th align="right" nowrap>[% 'Street' | $T8 %]</th> |
|
49 |
|
|
50 |
<td> |
|
51 |
[% L.input_tag('additional_billing_address.street', SELF.additional_billing_address.street, size = 35) %] |
|
52 |
|
|
53 |
<span id="additional_billing_address_map"></span> |
|
54 |
<script type="text/javascript"> |
|
55 |
additionalBillingAddressMapWidget = new kivi.CustomerVendor.MapWidget('additional_billing_address_'); |
|
56 |
$(function() { |
|
57 |
additionalBillingAddressMapWidget.render($('#additional_billing_address_map')); |
|
58 |
}); |
|
59 |
</script> |
|
60 |
</td> |
|
61 |
</tr> |
|
62 |
|
|
63 |
<tr> |
|
64 |
<th align="right" nowrap>[% 'Zipcode' | $T8 %]/[% 'City' | $T8 %]</th> |
|
65 |
|
|
66 |
<td> |
|
67 |
[% L.input_tag('additional_billing_address.zipcode', SELF.additional_billing_address.zipcode, size = 5) %] |
|
68 |
[% L.input_tag('additional_billing_address.city', SELF.additional_billing_address.city, size = 30) %] |
|
69 |
</td> |
|
70 |
</tr> |
|
71 |
|
|
72 |
<tr> |
|
73 |
<th align="right" nowrap>[% 'Country' | $T8 %]</th> |
|
74 |
|
|
75 |
<td> |
|
76 |
[% L.input_tag('additional_billing_address.country', SELF.additional_billing_address.country, size = 35) %] |
|
77 |
</td> |
|
78 |
</tr> |
|
79 |
|
|
80 |
<tr> |
|
81 |
<th align="right" nowrap>[% 'GLN' | $T8 %]</th> |
|
82 |
|
|
83 |
<td> |
|
84 |
[% L.input_tag('additional_billing_address.gln', SELF.additional_billing_address.gln, size = 30) %] |
|
85 |
</td> |
|
86 |
</tr> |
|
87 |
|
|
88 |
<tr> |
|
89 |
<th align="right" nowrap>[% 'Contact' | $T8 %]</th> |
|
90 |
|
|
91 |
<td> |
|
92 |
[% L.input_tag('additional_billing_address.contact', SELF.additional_billing_address.contact, size = 30) %] |
|
93 |
</td> |
|
94 |
</tr> |
|
95 |
|
|
96 |
<tr> |
|
97 |
<th align="right" nowrap>[% 'Phone' | $T8 %]</th> |
|
98 |
|
|
99 |
<td> |
|
100 |
[% L.input_tag('additional_billing_address.phone', SELF.additional_billing_address.phone, size = 30) %] |
|
101 |
</td> |
|
102 |
</tr> |
|
103 |
|
|
104 |
<tr> |
|
105 |
<th align="right" nowrap>[% 'Fax' | $T8 %]</th> |
|
106 |
|
|
107 |
<td> |
|
108 |
[% L.input_tag('additional_billing_address.fax', SELF.additional_billing_address.fax, size = 30) %] |
|
109 |
</td> |
|
110 |
</tr> |
|
111 |
|
|
112 |
<tr> |
|
113 |
<th align="right" nowrap>[% 'E-mail' | $T8 %]</th> |
|
114 |
|
|
115 |
<td> |
|
116 |
[% L.input_tag('additional_billing_address.email', SELF.additional_billing_address.email, size = 45) %] |
|
117 |
</td> |
|
118 |
</tr> |
|
119 |
</table> |
|
120 |
|
|
121 |
[% L.button_tag('submitInputButton("delete_additional_billing_address");', LxERP.t8('Delete address'), class = 'submit') %] |
|
122 |
[% IF ( !SELF.additional_billing_address.id ) %] |
|
123 |
<script type="text/javascript"> |
|
124 |
$('#action_delete_additional_billing_address').hide(); |
|
125 |
</script> |
|
126 |
[% END %] |
|
127 |
</div> |
templates/webpages/customer_vendor/tabs/shipto.html | ||
---|---|---|
3 | 3 |
[%- USE L %] |
4 | 4 |
|
5 | 5 |
<div id="shipto"> |
6 |
<table width="100%" id="shipto_table">
|
|
6 |
<table id="shipto_table"> |
|
7 | 7 |
<tr> |
8 | 8 |
<th align="right">[% 'Shipping Address' | $T8 %]</th> |
9 | 9 |
|
Auch abrufbar als: Unified diff
Zusätzliche Rechnungsadressen: in Kundenstammdaten bearbeiten