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();
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;
$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;
'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',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Department' => 'Abteilung',
'Description' => 'Beschreibung',
'Draft saved.' => 'Entwurf gespeichert.',
'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',
'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',
'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',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Department' => 'Abteilung',
'Description' => 'Beschreibung',
'Draft saved.' => 'Entwurf gespeichert.',
'September' => 'September',
'Ship via' => 'Transportmittel',
'Shipping Point' => 'Versandort',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
'Storno (one letter abbreviation)' => 'S',
'Subtotal' => 'Zwischensumme',
'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',
'debitorenbuchung' => 'ar_transaction',
'weiter' => 'continue',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'buchen' => 'post',
'zahlung_buchen' => 'post_payment',
'rechnung' => 'sales_invoice',
'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',
'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',
'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',
'set_longdescription' => 'set_longdescription',
'show_history' => 'show_history',
'vendor_selection' => 'vendor_selection',
+ 'entwürfe_löschen' => 'delete_drafts',
'entwurf_speichern' => 'save_draft',
'Überspringen' => 'skip',
};
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
'Description' => 'Beschreibung',
'Ship to' => 'Lieferadresse',
'Shipping Address' => 'Lieferadresse',
'Show details' => 'Details anzeigen',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
'Steuersatz' => 'Steuersatz',
'Storno' => 'Storno',
'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',
'yes' => 'yes',
'weiter' => 'continue',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'buchen' => 'post',
'zahlung_buchen' => 'post_payment',
'entwurf_speichern' => 'save_draft',
'Dec' => 'Dez',
'December' => 'Dezember',
'Delete' => 'Löschen',
+ 'Delete drafts' => 'Entwürfe löschen',
'Delivery Date' => 'Lieferdatum',
'Department' => 'Abteilung',
'Description' => 'Beschreibung',
'Shipping Address' => 'Lieferadresse',
'Shipping Point' => 'Versandort',
'Show details' => 'Details anzeigen',
+ 'Skip' => 'Überspringen',
'Source' => 'Beleg',
'Steuersatz' => 'Steuersatz',
'Storno' => 'Storno',
'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',
'weiter' => 'continue',
'gutschrift' => 'credit_note',
'löschen' => 'delete',
+ 'entwürfe_löschen' => 'delete_drafts',
'email' => 'e_mail',
'auftrag' => 'order',
'buchen' => 'post',
<td>
<table>
<tr>
+ <th class="listheading"> </th>
<th class="listheading">Datum</th>
<th class="listheading">Beschreibung</th>
<th class="listheading">Bearbeiter</th>
<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>
<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>
<td>
<table>
<tr>
+ <th class="listheading"> </th>
<th class="listheading"><translate>Date</translate></th>
<th class="listheading"><translate>Description</translate></th>
<th class="listheading"><translate>Employee</translate></th>
<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>
<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>