From 245b032241e70470b1d392b5fe055a2dfd6333c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 14 Feb 2008 16:44:16 +0000 Subject: [PATCH] Testanwendung der CGI::Ajax Modifikation: Lieferadressen haben jetzt einen (noch nutzlosen) Loeschenbutton, der ausgeblendet wird, wenn die Lieferadressen nicht 'echt' sind, oder wenn sie bereits vorhanen sind. --- SL/CT.pm | 7 +++++++ bin/mozilla/ct.pl | 2 +- locale/de/all | 1 + locale/de/ct | 1 + locale/de/ic | 2 -- templates/webpages/ct/form_header_de.html | 5 ++++- templates/webpages/ct/form_header_master.html | 5 ++++- 7 files changed, 18 insertions(+), 5 deletions(-) diff --git a/SL/CT.pm b/SL/CT.pm index f386f6fe5..d22017d4f 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -845,6 +845,13 @@ sub get_shipto { map { $form->{$_} = $ref->{$_} } keys %$ref; + $query = qq|SELECT COUNT(shipto_id) AS used FROM ( + SELECT shipto_id FROM oe UNION + SELECT shipto_id FROM ar UNION + SELECT shipto_id FROM delivery_orders + ) AS stid WHERE shipto_id = ? OR ? = 0|; + ($form->{shiptoused}) = selectfirst_array_query($form, $dbh, $query, ($form->{shipto_id})x2); + $sth->finish; $dbh->disconnect; diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 6968de187..8223a6ef7 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -577,7 +577,7 @@ sub get_shipto { CT->get_shipto(\%myconfig, \%$form); print $cgi->header(), join '__pjx__', map $form->{"shipto$_"}, - qw(name department_1 department_2 street zipcode city country contact phone fax email); + qw(name department_1 department_2 street zipcode city country contact phone fax email used); $lxdebug->leave_sub(); } diff --git a/locale/de/all b/locale/de/all index 4c618b2fc..418df68b4 100644 --- a/locale/de/all +++ b/locale/de/all @@ -438,6 +438,7 @@ aktualisieren wollen?', 'Delete' => 'Löschen', 'Delete Account' => 'Konto löschen', 'Delete Dataset' => 'Datenbank löschen', + 'Delete Shipto' => 'Lieferadresse löschen', 'Delete delivery order' => 'Lieferschein löschen', 'Delete drafts' => 'Entwürfe löschen', 'Delete group' => 'Gruppe löschen', diff --git a/locale/de/ct b/locale/de/ct index b5a332d8a..e7bacf872 100644 --- a/locale/de/ct +++ b/locale/de/ct @@ -235,6 +235,7 @@ $self->{subs} = { 'erfassen' => 'add', 'weiter' => 'continue', 'löschen' => 'delete', + 'lieferadresse_löschen' => 'delete_shipto', 'neue_ware' => 'new_part', 'speichern' => 'save', 'speichern_und_debitorenbuchung_erfassen' => 'save_and_ar_transaction', diff --git a/locale/de/ic b/locale/de/ic index 6d73272b3..d3f9522a7 100644 --- a/locale/de/ic +++ b/locale/de/ic @@ -201,8 +201,6 @@ $self->{texts} = { 'Pick List' => 'Sammelliste', 'Please enter values' => 'Bitte Werte eingeben', 'Postscript' => 'Postscript', - 'Preis' => 'Preis', - 'Preisklasse' => 'Preisgruppe', 'Price' => 'Preis', 'Price Factor' => 'Preisfaktor', 'Pricegroup' => 'Preisgruppe', diff --git a/templates/webpages/ct/form_header_de.html b/templates/webpages/ct/form_header_de.html index d622913c4..7ba555827 100644 --- a/templates/webpages/ct/form_header_de.html +++ b/templates/webpages/ct/form_header_de.html @@ -235,7 +235,7 @@ 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'])", + onChange = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto])", id_key = 'shipto_id', label_sub = 'shipto_label', label_key = 'shipto_label', @@ -302,6 +302,7 @@ +
@@ -593,4 +594,6 @@ Calendar.setup({ inputField : "toB", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger_to" }); Calendar.setup({ inputField : "FU_date", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BR", button : "FU_date_trigger" }); //--> + + function enable_delete_shipto(used){ var s=document.getElementById('delete_shipto'); if (s) s.disabled = (used > 0 ? true : false); } diff --git a/templates/webpages/ct/form_header_master.html b/templates/webpages/ct/form_header_master.html index fdb122bbf..b79d19a64 100644 --- a/templates/webpages/ct/form_header_master.html +++ b/templates/webpages/ct/form_header_master.html @@ -235,7 +235,7 @@ 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'])", + onChange = "get_shipto(['shipto_id__' + this.value], ['shiptoname','shiptodepartment_1', 'shiptodepartment_2','shiptostreet','shiptozipcode','shiptocity','shiptocountry','shiptocontact','shiptophone','shiptofax','shiptoemail',enable_delete_shipto])", id_key = 'shipto_id', label_sub = 'shipto_label', label_key = 'shipto_label', @@ -302,6 +302,7 @@ +
@@ -593,4 +594,6 @@ Calendar.setup({ inputField : "toB", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BL", button : "trigger_to" }); Calendar.setup({ inputField : "FU_date", ifFormat :"[% myconfig_jsc_dateformat %]", align : "BR", button : "FU_date_trigger" }); //--> + + function enable_delete_shipto(used){ var s=document.getElementById('delete_shipto'); if (s) s.disabled = (used > 0 ? true : false); } -- 2.20.1