Brieffunktion: Löschen von Entwürfen gefixt
authorMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 20 Apr 2016 12:09:09 +0000 (14:09 +0200)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Wed, 20 Apr 2016 12:09:09 +0000 (14:09 +0200)
SL/Controller/Letter.pm
templates/webpages/letter/load_drafts.html

index e9fe6cf..bdef557 100644 (file)
@@ -308,7 +308,10 @@ sub action_skip_draft {
 
 sub action_delete_drafts {
   my ($self) = @_;
-  delete_letter_drafts();
+
+  my @ids = @{ $::form->{ids} || [] };
+  SL::DB::Manager::LetterDraft->delete_all(where => [ id => \@ids ]) if @ids;
+
   $self->action_add(skip_drafts => 1);
 }
 
index 33cc946..f2455ec 100644 (file)
@@ -1,5 +1,5 @@
 [%- USE T8 %]
-[%- USE HTML %]
+[%- USE HTML %][%- USE L -%]
 <h1>[% 'Load letter draft' | $T8 %]</h1>
 
  <form method="post" name="Form" action="controller.pl">
@@ -19,7 +19,7 @@
 
       [% FOREACH row = LETTER_DRAFTS %]
        <tr class="listrow[% loop.count % 2 %]">
-        <td><input type="checkbox" name="checked_[% row.id %]" value="1"></td>
+        <td>[% L.checkbox_tag("ids[+]", value=row.id) %]</td>
         <td>[% row.date.to_kivitendo | html %]</td>
         <td><a href="[% SELF.url_for(action='edit', 'draft.id'=row.id) %]">[% row.subject | html %]</a></td>
         <td>[% row.customer.displayable_name | html %]</td>
@@ -32,7 +32,7 @@
     <td>
      <input type="hidden" name="action" value="Letter/dispatch">
      <input type="submit" class="submit" name="action_skip_draft" value="[% 'Skip' | $T8 %]">
-     <input type="submit" class="submit" name="action_delete_draft" value="[% 'Delete drafts' | $T8 %]">
+     <input type="submit" class="submit" name="action_delete_drafts" value="[% 'Delete drafts' | $T8 %]">
    </td>
    </tr>
   </table>