From 886b53e1654c3a7b454afb43190b5130df291a7f Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 11 Aug 2020 19:33:41 +0000 Subject: [PATCH] Bug 26194: Add link to cash register management from message about missing registers 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 https://bugs.koha-community.org/show_bug.cgi?id=26149 --- .../prog/en/modules/members/paycollect.tt | 21 +++++++++++++------ .../intranet-tmpl/prog/en/modules/pos/pay.tt | 14 ++++++++++--- .../prog/en/modules/pos/register.tt | 14 ++++++++++--- .../prog/en/modules/pos/registers.tt | 15 +++++++++---- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index 7eee67249b..f1daae3fa2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -7,6 +7,19 @@ [% PROCESS 'payments.inc' %] [% PROCESS 'accounts.inc' %] [% INCLUDE 'doc-head-open.inc' %] +[% BLOCK cash_register_required %] +
+

+ You must have at least one cash register associated with the library before you can record payments. +

+ [% IF ( CAN_user_parameters_manage_cash_registers ) %] +
+ + +
+ [% END %] +
+[% END %] Koha › Patrons › [% 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"> @@ -215,9 +226,7 @@ </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 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index 021e4ea611..1d1c4886e9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -20,9 +20,17 @@ <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') %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt index 2d96682a2f..c566c57b83 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -23,9 +23,17 @@ <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 ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt index 026dd1c9fa..4e373fc104 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt @@ -20,10 +20,17 @@ <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> -- 2.20.1