Testanwendung der CGI::Ajax Modifikation:
authorSven Schöling <s.schoeling@linet-services.de>
Thu, 14 Feb 2008 16:44:16 +0000 (16:44 +0000)
committerSven Schöling <s.schoeling@linet-services.de>
Thu, 14 Feb 2008 16:44:16 +0000 (16:44 +0000)
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
bin/mozilla/ct.pl
locale/de/all
locale/de/ct
locale/de/ic
templates/webpages/ct/form_header_de.html
templates/webpages/ct/form_header_master.html

index f386f6f..d22017d 100644 (file)
--- 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;
 
index 6968de1..8223a6e 100644 (file)
@@ -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();
 
 }
index 4c618b2..418df68 100644 (file)
@@ -438,6 +438,7 @@ aktualisieren wollen?',
   'Delete'                      => 'Löschen',
   'Delete Account'              => 'Konto löschen',
   'Delete Dataset'              => 'Datenbank löschen',
+  'Delete Shipto'               => 'Lieferadresse l&ouml;schen',
   'Delete delivery order'       => 'Lieferschein l&ouml;schen',
   'Delete drafts'               => 'Entwürfe löschen',
   'Delete group'                => 'Gruppe l&ouml;schen',
index b5a332d..e7bacf8 100644 (file)
@@ -235,6 +235,7 @@ $self->{subs} = {
   'erfassen'                    => 'add',
   'weiter'                      => 'continue',
   'löschen'                     => 'delete',
+  'lieferadresse_l&ouml;schen'  => 'delete_shipto',
   'neue_ware'                   => 'new_part',
   'speichern'                   => 'save',
   'speichern_und_debitorenbuchung_erfassen' => 'save_and_ar_transaction',
index 6d73272..d3f9522 100644 (file)
@@ -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',
index d622913..7ba5558 100644 (file)
              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',
      </tr>
     </table>
 
+    <input type="submit" id="delete_shipto" name="delete_shipto" value="Lieferadresse l&ouml;schen" disabled>
     <br style="clear: left" />
    </div>
 
        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); }
   </script>
index fdb122b..b79d19a 100644 (file)
              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',
      </tr>
     </table>
 
+    <input type="submit" id="delete_shipto" name="delete_shipto" value="<translate>Delete Shipto</translate>" disabled>
     <br style="clear: left" />
    </div>
 
        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); }
   </script>