From 08df38dfcaad6fef28988003da9212ef47f75c84 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 22 Feb 2007 15:33:02 +0000 Subject: [PATCH] =?utf8?q?M=C3=B6glichkeit=20zum=20L=C3=B6schen=20von=20ge?= =?utf8?q?speicherten=20Entw=C3=BCrfen=20eingebaut.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Drafts.pm | 11 ++++---- bin/mozilla/drafts.pl | 29 ++++++++++++++++++++++ locale/de/all | 1 + locale/de/ap | 5 ++++ locale/de/ar | 5 ++++ locale/de/drafts | 5 ++++ locale/de/ir | 5 ++++ locale/de/is | 5 ++++ templates/webpages/drafts/load_de.html | 7 ++++-- templates/webpages/drafts/load_master.html | 7 ++++-- 10 files changed, 71 insertions(+), 9 deletions(-) diff --git a/SL/Drafts.pm b/SL/Drafts.pm index 63da852e7..698b217f5 100644 --- a/SL/Drafts.pm +++ b/SL/Drafts.pm @@ -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(); diff --git a/bin/mozilla/drafts.pl b/bin/mozilla/drafts.pl index df0eb6bcb..c10d91afe 100644 --- a/bin/mozilla/drafts.pl +++ b/bin/mozilla/drafts.pl @@ -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; diff --git a/locale/de/all b/locale/de/all index 9b9b63e83..5c5c5b7d4 100644 --- a/locale/de/all +++ b/locale/de/all @@ -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', diff --git a/locale/de/ap b/locale/de/ap index 9fe0d4c30..25da8e7fd 100644 --- a/locale/de/ap +++ b/locale/de/ap @@ -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', diff --git a/locale/de/ar b/locale/de/ar index ef7d19b65..d6669da9c 100644 --- a/locale/de/ar +++ b/locale/de/ar @@ -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', diff --git a/locale/de/drafts b/locale/de/drafts index 13272f41c..ff6ed6afd 100644 --- a/locale/de/drafts +++ b/locale/de/drafts @@ -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ählen', 'Select a project' => 'Projekt auswählen', 'Select an employee' => 'Angestellten auswä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', }; diff --git a/locale/de/ir b/locale/de/ir index 2e5ec9a0d..02181d1c6 100644 --- a/locale/de/ir +++ b/locale/de/ir @@ -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', diff --git a/locale/de/is b/locale/de/is index 079dbef05..29f52b386 100644 --- a/locale/de/is +++ b/locale/de/is @@ -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', diff --git a/templates/webpages/drafts/load_de.html b/templates/webpages/drafts/load_de.html index a5b4979f9..95eb33f7c 100644 --- a/templates/webpages/drafts/load_de.html +++ b/templates/webpages/drafts/load_de.html @@ -24,6 +24,7 @@ + @@ -31,6 +32,7 @@ + @@ -42,8 +44,9 @@
  Datum Beschreibung Bearbeiter
- - + + +
diff --git a/templates/webpages/drafts/load_master.html b/templates/webpages/drafts/load_master.html index f12c3f24f..6f42c6d0a 100644 --- a/templates/webpages/drafts/load_master.html +++ b/templates/webpages/drafts/load_master.html @@ -24,6 +24,7 @@ + @@ -31,6 +32,7 @@ + @@ -42,8 +44,9 @@
  Date Description Employee
- - + + +
-- 2.20.1