Bug 26194: Add link to cash register management from message about missing registers
authorOwen Leonard <oleonard@myacpl.org>
Tue, 11 Aug 2020 19:33:41 +0000 (19:33 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 18 Aug 2020 13:45:49 +0000 (15:45 +0200)
In places where the interface warns the user about missing cash
registers we should provide users with permission a direct link to the
cash register management page.

To test, apply the patch and enable the UseCashRegisters and
EnablePointOfSale preferences.

If necessary, go to Administration -> Cash registers and remove any cash
registers for your library.

 - Log in to the staff interface as a user with "manage_cash_registers"
   permission.
 - Locate a patron who has outstanding fines.
 - Under Accounting -> Make a payment, click the "Pay" button next to a
   fine.
 - The page should show the message about missing cash registers with a
   button which take you directly to the "Add new cash register" form.
 - Perform the same check by selecting the checkbox next to a fine and
   clicking the "Pay amount" button and the "Pay selected" button.
 - Test the message shown at:
   - Tools -> Cashup registers.
   - Point of sale -> Register details
   - Point of sale -> Library details
 - Perform the same tests when logged in as a user without permission to
   manage cash registers. The messages shown in the previous steps
   should omit the button linking to cash register management.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

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

koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt
koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt
koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt

index 7eee672..f1daae3 100644 (file)
@@ -7,6 +7,19 @@
 [% PROCESS 'payments.inc' %]
 [% PROCESS 'accounts.inc' %]
 [% INCLUDE 'doc-head-open.inc' %]
+[% BLOCK cash_register_required %]
+    <div id="error_message" class="dialog message">
+        <p>
+            You must have at least one cash register associated with the library before you can record payments.
+        </p>
+        [% IF ( CAN_user_parameters_manage_cash_registers ) %]
+            <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
+                <input type="hidden" name="op" value="add_form" />
+                <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
+            </form>
+        [% END %]
+    </div>
+[% END %]
 <title>Koha &rsaquo; Patrons &rsaquo;
     [% IF type == 'WRITEOFF' %]
         Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
@@ -74,9 +87,7 @@
 
 [% IF ( pay_individual ) %]
     [% IF ( error_registers ) %]
-    <div id="error_message" class="dialog alert">
-        You must have at least one cash register associated with this branch before you can record payments.
-    </div>
+        [% PROCESS 'cash_register_required' %]
     [% ELSE %]
 
     <ul class="nav nav-pills">
     </form>
 [% ELSE %]
     [% IF ( error_registers && type != 'writeoff' ) %]
-    <div id="error_message" class="dialog alert">
-        You must have at least one cash register associated with this branch before you can record payments.
-    </div>
+        [% PROCESS 'cash_register_required' %]
     [% ELSE %]
 
     [% IF selected_accts %]
index 19da1e1..43b8d32 100644 (file)
         <div class="col-sm-10 col-sm-push-2">
 
         [% IF ( error_registers ) %]
-        <div id="error_message" class="dialog alert">
-            You must have at least one cash register associated with this branch before you can record payments.
-        </div>
+            <div id="error_message" class="dialog message">
+                <p>
+                    You must have at least one cash register associated with the library before you can record payments.
+                </p>
+                [% IF ( CAN_user_parameters_manage_cash_registers ) %]
+                    <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
+                        <input type="hidden" name="op" value="add_form" />
+                        <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
+                    </form>
+                [% END %]
+            </div>
         [% ELSE %]
 
         [% IF payment_id && !Koha.Preference('FinePaymentAutoPopup') %]
index 2d96682..c566c57 100644 (file)
         <div class="col-sm-10 col-sm-push-2">
 
             [% IF ( error_registers ) %]
-            <div id="error_message" class="dialog alert">
-                You must have at least one cash register associated with this library before you can record payments.
-            </div>
+                <div id="error_message" class="dialog message">
+                    <p>
+                        You must have at least one cash register associated with the library before you can record payments.
+                    </p>
+                    [% IF ( CAN_user_parameters_manage_cash_registers ) %]
+                        <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
+                            <input type="hidden" name="op" value="add_form" />
+                            <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
+                        </form>
+                    [% END %]
+                </div>
             [% ELSE %]
 
             [% IF ( CAN_user_cash_management_cashup ) %]
index 026dd1c..4e373fc 100644 (file)
             <div class="col-sm-10 col-sm-push-2">
                 <main>
                     [% IF ( error_registers ) %]
-                    <div id="error_message" class="dialog alert">
-                        You must have at least one cash register associated with this library before you
-                        can record payments.
-                    </div>
+                        <div id="error_message" class="dialog message">
+                            <p>
+                                You must have at least one cash register associated with the library before you can record payments.
+                            </p>
+                            [% IF ( CAN_user_parameters_manage_cash_registers ) %]
+                                <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
+                                    <input type="hidden" name="op" value="add_form" />
+                                    <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
+                                </form>
+                            [% END %]
+                        </div>
                     [% ELSE %]
                     <div id="toolbar" class="btn-toolbar">
                         <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>