Möglichkeit zum Löschen von gespeicherten Entwürfen eingebaut.
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 22 Feb 2007 15:33:02 +0000 (15:33 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 22 Feb 2007 15:33:02 +0000 (15:33 +0000)
SL/Drafts.pm
bin/mozilla/drafts.pl
locale/de/all
locale/de/ap
locale/de/ar
locale/de/drafts
locale/de/ir
locale/de/is
templates/webpages/drafts/load_de.html
templates/webpages/drafts/load_master.html

index 63da852..698b217 100644 (file)
@@ -108,16 +108,17 @@ sub load {
 sub remove {
   $main::lxdebug->enter_sub();
 
-  my ($self, $myconfig, $form, $draft_id) = @_;
+  my ($self, $myconfig, $form, @draft_ids) = @_;
 
-  return $main::lxdebug->leave_sub() unless ($draft_id);
+  return $main::lxdebug->leave_sub() unless (@draft_ids);
 
-  my ($dbh, $sth, $query, @values);
+  my ($dbh, $sth, $query);
 
   $dbh = $form->dbconnect($myconfig);
 
-  $query = qq|DELETE FROM drafts WHERE id = ?|;
-  do_query($form, $dbh, $query, $draft_id);
+  $query = qq|DELETE FROM drafts WHERE id IN (| .
+    join(", ", map({ "?" } @draft_ids)) . qq|)|;
+  do_query($form, $dbh, $query, @draft_ids);
 
   $dbh->disconnect();
 
index df0eb6b..c10d91a 100644 (file)
@@ -83,6 +83,7 @@ sub dont_load_draft {
   my $draft_nextsub = $form->{draft_nextsub};
   $draft_nextsub = "add" unless ($form->{draft_nextsub});
   restore_form($form->{SAVED_FORM}, 1);
+  delete($form->{SAVED_FORM});
   delete($form->{action});
   $form->{DONT_LOAD_DRAFT} = 1;
 
@@ -107,4 +108,32 @@ sub load_draft {
   $lxdebug->leave_sub();
 }
 
+sub delete_drafts {
+  $lxdebug->enter_sub();
+
+  my @ids;
+  foreach (keys(%{$form})) {
+    push(@ids, $1) if (/^checked_(.*)/ && $form->{$_});
+  }
+  Drafts->remove(\%myconfig, $form, @ids) if (@ids);
+  restore_form($form->{SAVED_FORM}, 1);
+  delete($form->{SAVED_FORM});
+
+  add();
+
+  $lxdebug->leave_sub();
+}
+
+sub draft_action_dispatcher {
+  $lxdebug->enter_sub();
+
+  if ($form->{draft_action} eq $locale->text("Skip")) {
+    dont_load_draft();
+  } elsif ($form->{draft_action} eq $locale->text("Delete drafts")) {
+    delete_drafts();
+  }
+
+  $lxdebug->leave_sub();
+}
+
 1;
index 9b9b63e..5c5c5b7 100644 (file)
@@ -351,6 +351,7 @@ aktualisieren wollen?',
   'Delete'                      => 'Löschen',
   'Delete Account'              => 'Konto löschen',
   'Delete Dataset'              => 'Datenbank löschen',
+  'Delete drafts'               => 'Entwürfe löschen',
   'Delivered'                   => 'Geliefert',
   'Delivery Date'               => 'Lieferdatum',
   'Department'                  => 'Abteilung',
index 9fe0d4c..25da8e7 100644 (file)
@@ -33,6 +33,7 @@ $self->{texts} = {
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
   'Delete'                      => 'Löschen',
+  'Delete drafts'               => 'Entwürfe löschen',
   'Department'                  => 'Abteilung',
   'Description'                 => 'Beschreibung',
   'Draft saved.'                => 'Entwurf gespeichert.',
@@ -113,6 +114,7 @@ $self->{texts} = {
   'Select from one of the projects below' => 'Wählen Sie eines der untenstehenden Projekte',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
+  'Skip'                        => 'Überspringen',
   'Source'                      => 'Beleg',
   'Subtotal'                    => 'Zwischensumme',
   'Tax'                         => 'Steuer',
@@ -162,9 +164,11 @@ $self->{subs} = {
   'continue'                    => 'continue',
   'create_links'                => 'create_links',
   'delete'                      => 'delete',
+  'delete_drafts'               => 'delete_drafts',
   'delivery_customer_selection' => 'delivery_customer_selection',
   'display_form'                => 'display_form',
   'dont_load_draft'             => 'dont_load_draft',
+  'draft_action_dispatcher'     => 'draft_action_dispatcher',
   'edit'                        => 'edit',
   'employee_selection_internal' => 'employee_selection_internal',
   'form_footer'                 => 'form_footer',
@@ -204,6 +208,7 @@ $self->{subs} = {
   'kreditorenbuchung_erfassen'  => 'add_accounts_payables_transaction',
   'weiter'                      => 'continue',
   'löschen'                     => 'delete',
+  'entwürfe_löschen'            => 'delete_drafts',
   'kreditorenbuchung_bearbeiten' => 'edit_accounts_payables_transaction',
   'buchen'                      => 'post',
   'zahlung_buchen'              => 'post_payment',
index ef7d19b..d6669da 100644 (file)
@@ -37,6 +37,7 @@ $self->{texts} = {
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
   'Delete'                      => 'Löschen',
+  'Delete drafts'               => 'Entwürfe löschen',
   'Department'                  => 'Abteilung',
   'Description'                 => 'Beschreibung',
   'Draft saved.'                => 'Entwurf gespeichert.',
@@ -121,6 +122,7 @@ $self->{texts} = {
   'September'                   => 'September',
   'Ship via'                    => 'Transportmittel',
   'Shipping Point'              => 'Versandort',
+  'Skip'                        => 'Überspringen',
   'Source'                      => 'Beleg',
   'Storno (one letter abbreviation)' => 'S',
   'Subtotal'                    => 'Zwischensumme',
@@ -170,10 +172,12 @@ $self->{subs} = {
   'continue'                    => 'continue',
   'create_links'                => 'create_links',
   'delete'                      => 'delete',
+  'delete_drafts'               => 'delete_drafts',
   'delivery_customer_selection' => 'delivery_customer_selection',
   'display'                     => 'display',
   'display_form'                => 'display_form',
   'dont_load_draft'             => 'dont_load_draft',
+  'draft_action_dispatcher'     => 'draft_action_dispatcher',
   'edit'                        => 'edit',
   'employee_selection_internal' => 'employee_selection_internal',
   'form_footer'                 => 'form_footer',
@@ -213,6 +217,7 @@ $self->{subs} = {
   'debitorenbuchung'            => 'ar_transaction',
   'weiter'                      => 'continue',
   'löschen'                     => 'delete',
+  'entwürfe_löschen'            => 'delete_drafts',
   'buchen'                      => 'post',
   'zahlung_buchen'              => 'post_payment',
   'rechnung'                    => 'sales_invoice',
index 13272f4..ff6ed6a 100644 (file)
@@ -4,6 +4,7 @@ $self->{texts} = {
   'Customer Number'             => 'Kundennummer',
   'DELETED'                     => 'Gelöscht',
   'DUNNING STARTED'             => 'DUNNING STARTED',
+  'Delete drafts'               => 'Entwürfe löschen',
   'Draft saved.'                => 'Entwurf gespeichert.',
   'ELSE'                        => 'Zusatz',
   'Enter longdescription'       => 'Langtext eingeben',
@@ -31,6 +32,7 @@ $self->{texts} = {
   'Select a part'               => 'Artikel ausw&auml;hlen',
   'Select a project'            => 'Projekt ausw&auml;hlen',
   'Select an employee'          => 'Angestellten ausw&auml;hlen',
+  'Skip'                        => 'Überspringen',
   'Unit'                        => 'Einheit',
   'Value'                       => 'Wert',
   'Variable'                    => 'Variable',
@@ -52,8 +54,10 @@ $self->{subs} = {
   'Q'                           => 'Q',
   'build_std_url'               => 'build_std_url',
   'calculate_qty'               => 'calculate_qty',
+  'delete_drafts'               => 'delete_drafts',
   'delivery_customer_selection' => 'delivery_customer_selection',
   'dont_load_draft'             => 'dont_load_draft',
+  'draft_action_dispatcher'     => 'draft_action_dispatcher',
   'employee_selection_internal' => 'employee_selection_internal',
   'format_dates'                => 'format_dates',
   'load_draft'                  => 'load_draft',
@@ -72,6 +76,7 @@ $self->{subs} = {
   'set_longdescription'         => 'set_longdescription',
   'show_history'                => 'show_history',
   'vendor_selection'            => 'vendor_selection',
+  'entwürfe_löschen'            => 'delete_drafts',
   'entwurf_speichern'           => 'save_draft',
   'Überspringen'                => 'skip',
 };
index 2e5ec9a..02181d1 100644 (file)
@@ -49,6 +49,7 @@ $self->{texts} = {
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
   'Delete'                      => 'Löschen',
+  'Delete drafts'               => 'Entwürfe löschen',
   'Delivery Date'               => 'Lieferdatum',
   'Department'                  => 'Abteilung',
   'Description'                 => 'Beschreibung',
@@ -183,6 +184,7 @@ $self->{texts} = {
   'Ship to'                     => 'Lieferadresse',
   'Shipping Address'            => 'Lieferadresse',
   'Show details'                => 'Details anzeigen',
+  'Skip'                        => 'Überspringen',
   'Source'                      => 'Beleg',
   'Steuersatz'                  => 'Steuersatz',
   'Storno'                      => 'Storno',
@@ -242,10 +244,12 @@ $self->{subs} = {
   'continue'                    => 'continue',
   'customer_details'            => 'customer_details',
   'delete'                      => 'delete',
+  'delete_drafts'               => 'delete_drafts',
   'delivery_customer_selection' => 'delivery_customer_selection',
   'display_form'                => 'display_form',
   'display_row'                 => 'display_row',
   'dont_load_draft'             => 'dont_load_draft',
+  'draft_action_dispatcher'     => 'draft_action_dispatcher',
   'e_mail'                      => 'e_mail',
   'edit'                        => 'edit',
   'employee_selection_internal' => 'employee_selection_internal',
@@ -304,6 +308,7 @@ $self->{subs} = {
   'yes'                         => 'yes',
   'weiter'                      => 'continue',
   'löschen'                     => 'delete',
+  'entwürfe_löschen'            => 'delete_drafts',
   'buchen'                      => 'post',
   'zahlung_buchen'              => 'post_payment',
   'entwurf_speichern'           => 'save_draft',
index 079dbef..29f52b3 100644 (file)
@@ -60,6 +60,7 @@ $self->{texts} = {
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
   'Delete'                      => 'Löschen',
+  'Delete drafts'               => 'Entwürfe löschen',
   'Delivery Date'               => 'Lieferdatum',
   'Department'                  => 'Abteilung',
   'Description'                 => 'Beschreibung',
@@ -208,6 +209,7 @@ $self->{texts} = {
   'Shipping Address'            => 'Lieferadresse',
   'Shipping Point'              => 'Versandort',
   'Show details'                => 'Details anzeigen',
+  'Skip'                        => 'Überspringen',
   'Source'                      => 'Beleg',
   'Steuersatz'                  => 'Steuersatz',
   'Storno'                      => 'Storno',
@@ -267,10 +269,12 @@ $self->{subs} = {
   'credit_note'                 => 'credit_note',
   'customer_details'            => 'customer_details',
   'delete'                      => 'delete',
+  'delete_drafts'               => 'delete_drafts',
   'delivery_customer_selection' => 'delivery_customer_selection',
   'display_form'                => 'display_form',
   'display_row'                 => 'display_row',
   'dont_load_draft'             => 'dont_load_draft',
+  'draft_action_dispatcher'     => 'draft_action_dispatcher',
   'e_mail'                      => 'e_mail',
   'edit'                        => 'edit',
   'employee_selection_internal' => 'employee_selection_internal',
@@ -332,6 +336,7 @@ $self->{subs} = {
   'weiter'                      => 'continue',
   'gutschrift'                  => 'credit_note',
   'löschen'                     => 'delete',
+  'entwürfe_löschen'            => 'delete_drafts',
   'email'                       => 'e_mail',
   'auftrag'                     => 'order',
   'buchen'                      => 'post',
index a5b4979..95eb33f 100644 (file)
@@ -24,6 +24,7 @@
     <td>
      <table>
       <tr>
+       <th class="listheading">&nbsp;</th>
        <th class="listheading">Datum</th>
        <th class="listheading">Beschreibung</th>
        <th class="listheading">Bearbeiter</th>
@@ -31,6 +32,7 @@
 
       <TMPL_LOOP DRAFTS>
        <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+        <td><input type="checkbox" name="checked_<TMPL_VAR id>" value="1"></td>
         <td><TMPL_VAR itime ESCAPE=HTML></td>
         <td><a href="<TMPL_VAR script ESCAPE=URL>?login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&path=<TMPL_VAR path ESCAPE=URL>&action=load_draft&id=<TMPL_VAR id ESCAPE=URL>"><TMPL_VAR description ESCAPE=HTML></a></td>
         <td><TMPL_VAR employee_name ESCAPE=HTML></td>
@@ -42,8 +44,9 @@
 
    <tr>
     <td>
-     <input type="hidden" name="action" value="dont_load_draft">
-     <input type="submit" class="submit" name="dummy" value="Überspringen">
+     <input type="hidden" name="action" value="draft_action_dispatcher">
+     <input type="submit" class="submit" name="draft_action" value="Überspringen">
+     <input type="submit" class="submit" name="draft_action" value="Entwürfe löschen">
     </td>
    </tr>
   </table>
index f12c3f2..6f42c6d 100644 (file)
@@ -24,6 +24,7 @@
     <td>
      <table>
       <tr>
+       <th class="listheading">&nbsp;</th>
        <th class="listheading"><translate>Date</translate></th>
        <th class="listheading"><translate>Description</translate></th>
        <th class="listheading"><translate>Employee</translate></th>
@@ -31,6 +32,7 @@
 
       <TMPL_LOOP DRAFTS>
        <tr class="listrow<TMPL_IF __odd__>1<TMPL_ELSE>0</TMPL_IF>">
+        <td><input type="checkbox" name="checked_<TMPL_VAR id>" value="1"></td>
         <td><TMPL_VAR itime ESCAPE=HTML></td>
         <td><a href="<TMPL_VAR script ESCAPE=URL>?login=<TMPL_VAR login ESCAPE=URL>&password=<TMPL_VAR password ESCAPE=URL>&path=<TMPL_VAR path ESCAPE=URL>&action=load_draft&id=<TMPL_VAR id ESCAPE=URL>"><TMPL_VAR description ESCAPE=HTML></a></td>
         <td><TMPL_VAR employee_name ESCAPE=HTML></td>
@@ -42,8 +44,9 @@
 
    <tr>
     <td>
-     <input type="hidden" name="action" value="dont_load_draft">
-     <input type="submit" class="submit" name="dummy" value="<translate>Skip</translate>">
+     <input type="hidden" name="action" value="draft_action_dispatcher">
+     <input type="submit" class="submit" name="draft_action" value="<translate>Skip</translate>">
+     <input type="submit" class="submit" name="draft_action" value="<translate>Delete drafts</translate>">
     </td>
    </tr>
   </table>