Bug 27946: Add UI handling of AR fees
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 17 Dec 2021 13:32:04 +0000 (10:32 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 28 Jan 2022 21:09:07 +0000 (11:09 -1000)
This patch:
- Adds a notice about the fee to be charged to the patron (staff and
  OPAC)
- Adds the right UI description for ARTICLE_REQUEST_FEE debit types in
  the UI.

To test:
1. Have some article request fee rules
2. Play with placing an article request in OPAC and staff
=> SUCCESS: You see a message about the fee
=> SUCCESS: The fees are correctly applied to the patron
3. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
circ/request-article.pl
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
koha-tmpl/intranet-tmpl/prog/en/modules/circ/request-article.tt
koha-tmpl/opac-tmpl/bootstrap/en/includes/accounts.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-request-article.tt
opac/opac-request-article.pl

index dbe91dd..6a6e63c 100755 (executable)
@@ -129,10 +129,14 @@ if ( !$patron && $patron_cardnumber ) {
     }
 }
 
-if( $patron && !$patron->can_request_article) {
+if ( $patron && !$patron->can_request_article ) {
     $patron = undef;
+    $template->param( error_message => 'article_request_limit_reached' );
+}
+
+if ( $patron ) {
     $template->param(
-        error_message => 'article_request_limit_reached'
+        article_request_fee => $patron->article_request_fee
     );
 }
 
index e571957..8fcb01e 100644 (file)
@@ -13,6 +13,7 @@
     [%- SWITCH debit_type.code -%]
         [%- CASE 'ACCOUNT'          -%]Account creation fee
         [%- CASE 'ACCOUNT_RENEW'    -%]Account renewal fee
+        [%- CASE 'ARTICLE_REQUEST'  -%]Article scan request fee
         [%- CASE 'LOST'             -%]Lost item
         [%- CASE 'MANUAL'           -%]Manual fee
         [%- CASE 'NEW_CARD'         -%]New card
index 56536b9..618a3c6 100644 (file)
@@ -5,6 +5,7 @@
 [% USE Branches %]
 [% USE ItemTypes %]
 [% USE AuthorisedValues %]
+[% USE Price %]
 [% SET footerjs = 1 %]
 [% SET article_requests_view = 1 %]
 [% SET biblionumber = biblio.biblionumber %]
                         </form>
                     [% ELSE %]
                         [% IF biblio.can_article_request( patron ) %]
-
+                            [% IF article_request_fee > 0 %]
+                                <div class="dialog alert">
+                                    Patron will be charged with <strong>[% article_request_fee | $Price %]</strong> for every request
+                                </div>
+                            [% END %]
                             <form id="place-article-request" method="post" action="/cgi-bin/koha/circ/request-article.pl">
                                 <input type="hidden" name="action" value="create" />
                                 <input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
index ca749fb..7bda0e8 100644 (file)
@@ -13,6 +13,7 @@
     [%- SWITCH debit_type_code -%]
         [%- CASE 'ACCOUNT'          -%]Account creation fee
         [%- CASE 'ACCOUNT_RENEW'    -%]Account renewal fee
+        [%- CASE 'ARTICLE_REQUEST'  -%]Article scan request fee
         [%- CASE 'LOST'             -%]Lost item
         [%- CASE 'MANUAL'           -%]Manual fee
         [%- CASE 'NEW_CARD'         -%]New card
index 613f0fa..505336d 100644 (file)
@@ -2,6 +2,7 @@
 [% USE Branches %]
 [% USE ItemTypes %]
 [% USE AdditionalContents %]
+[% USE Price %]
 [% USE raw %]
 [% INCLUDE 'doc-head-open.inc' %]
 
                         [% IF article_request_type == 'item_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsItemOnly') %]   [% END %]
 
 
+                    [% IF article_request_fee > 0 %]
+                        <div class="alert alert-warning">
+                            You will be charged with <strong>[% article_request_fee | $Price %]</strong> for every request
+                        </div>
+                    [% END %]
+
                         <form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
                             <legend class="sr-only">Place article request</legend>
                             <input type="hidden" name="action" value="create" />
index 1ef7184..dcf9f21 100755 (executable)
@@ -128,6 +128,9 @@ if(!$patron->can_request_article) {
     );
 }
 
+$template->param( article_request_fee => $patron->article_request_fee )
+  if $action ne 'create';
+
 $template->param(
     biblio => $biblio,
     patron => $patron,