Bug 13215: Fix notice deletion
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 21 Nov 2014 09:28:02 +0000 (10:28 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 27 Nov 2014 14:42:21 +0000 (11:42 -0300)
This patch could have only been
-        name => $values[0]->{name},
+        name => $letter->{name},

Other changes are just indentation and variable names (send an hashref
$letter to the template and use the Branches TT plugin to display the
branch name)

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt
tools/letter.pl

index 7c68f22..cfda11c 100644 (file)
@@ -1,4 +1,5 @@
 [% USE Koha %]
+[% USE Branches %]
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; Notices[% IF ( add_form or copy_form ) %][% IF ( modify ) %] &rsaquo; Modify notice[% ELSE %] &rsaquo; Add notice[% END %][% END %][% IF ( add_validate or copy_validate) %] &rsaquo; Notice added[% END %][% IF ( delete_confirm ) %] &rsaquo; Confirm deletion[% END %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
@@ -424,40 +425,40 @@ $(document).ready(function() {
        <input type="submit" value="OK" />
        </form>
 [% END %]
-       
-[% IF ( delete_confirm ) %]
-    <div class="dialog alert"><h3>Delete notice?</h3>
-       <table>
-        <thead>
-               <tr>
-                       <th>Library</th>
-                       <th>Module</th>
-                       <th>Code</th>
-                       <th>Name</th>
-               </tr>
-        </thead>
-               <tr>
-                       <td>[% branchname %]</td>
-                       <td>[% module %]</td>
-            <td>[% code %]</td>
-                       <td>[% name %]</td>
-               </tr>
-       </table>
-               <form action="[% action %]" method="post">
-               <input type="hidden" name="op" value="delete_confirmed">
-               <input type="hidden" name="branchcode" value="[% branchcode %]" />
-               <input type="hidden" name="code" value="[% code %]" />
-               <input type="hidden" name="module" value="[% module %]" />
-                <input type="submit" value="Yes, delete" class="approve" />
-                               </form>
 
-                               <form action="[% action %]" method="get">
-                    <input type="submit" value="No, do not delete" class="deny" />
-                               </form>
-               </div>
+[% IF ( delete_confirm ) %]
+    <div class="dialog alert">
+        <h3>Delete notice?</h3>
+        <table>
+            <thead>
+            <tr>
+                <th>Library</th>
+                <th>Module</th>
+                <th>Code</th>
+                <th>Name</th>
+            </tr>
+            </thead>
+            <tr>
+                <td>[% Branches.GetName( letter.branchcode ) %]</td>
+                <td>[% letter.module %]</td>
+                <td>[% letter.code %]</td>
+                <td>[% letter.name %]</td>
+            </tr>
+        </table>
+            <form action="[% action %]" method="post">
+            <input type="hidden" name="op" value="delete_confirmed">
+            <input type="hidden" name="branchcode" value="[% letter.branchcode %]" />
+            <input type="hidden" name="code" value="[% letter.code %]" />
+            <input type="hidden" name="module" value="[% letter.module %]" />
+            <input type="submit" value="Yes, delete" class="approve" />
+        </form>
 
+        <form action="[% action %]" method="get">
+            <input type="submit" value="No, do not delete" class="deny" />
+        </form>
+    </div>
 [% END %]
-       
+
 [% IF ( delete_confirmed ) %]
        Data deleted
        <form action="[% action %]" method="post">
index 66d78be..4fcd8a8 100755 (executable)
@@ -289,11 +289,7 @@ sub delete_confirm {
     my $letter = C4::Letters::getletter($module, $code, $branchcode);
     my @values = values %$letter;
     $template->param(
-        branchcode => $branchcode,
-        branchname => GetBranchName($branchcode),
-        code => $code,
-        module => $module,
-        name => $values[0]->{name},
+        letter => $letter,
     );
     return;
 }