Bug 24157: (follow-up) Conditionally show controls to reopen and close invoice
authorOwen Leonard <oleonard@myacpl.org>
Fri, 6 Mar 2020 19:13:35 +0000 (19:13 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 30 Jul 2020 15:30:23 +0000 (17:30 +0200)
This follow-up makes minor changes to the template so that the checkbox
for reopening or closing an invoice are not displayed when the user
doens't have the correct permissions.

To test, apply the patch and try the process of viewing or editing an
invoice as a user with these various permissions:

 - edit_invoices ON
 - edit_invoices OFF
 - reopen_closed_invoices ON
 - reopen_closed_invoices OFF

Signed-off-by: Alex Arnaud <alex.arnaud@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt

index f710d38..c6f9fe2 100644 (file)
             <li><span class="label">Status:</span>
                 Closed on [% invoiceclosedate | $KohaDates %]</li>
 
-            <li>
-                <label for="reopen">Reopen: </label>
                 [% IF CAN_user_acquisition_reopen_closed_invoices AND NOT readonly %]
-                    <input type="checkbox" name="reopen" id="reopen" />
-                [% ELSE %]
-                    <input type="checkbox" name="reopen" id="reopen" readonly="disabled" />
+                    <li>
+                        <label for="reopen">Reopen: </label>
+                        <input type="checkbox" name="reopen" id="reopen" />
+                    </li>
                 [% END %]
-            </li>
             [% ELSE %]
-            <li><span class="label">Status:</span>
-                Open</li>
-
-                <li><label for="close">Close: </label> <input type="checkbox" name="close" id="close" />
+                <li>
+                    <span class="label">Status:</span>
+                    Open
+                </li>
+                [% UNLESS ( readonly ) %]
+                    <li>
+                        <label for="close">Close: </label>
+                        <input type="checkbox" name="close" id="close" />
                     </li>
+                [% END %]
             [% END %]
             </ol>
         [% UNLESS readonly %]