Bug 6857: display a charge warning alert for reserves
authorRobin Sheat <robin@catalyst.net.nz>
Thu, 8 Sep 2011 06:29:24 +0000 (18:29 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Sun, 11 Sep 2011 09:35:52 +0000 (21:35 +1200)
If a user is placing a reserve on the OPAC, this'll let them know that
it's going to cost them.

Author: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Members.pm
koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt
opac/opac-reserve.pl

index dcc168b..8d4a6c5 100644 (file)
@@ -2,6 +2,7 @@ package C4::Members;
 
 # Copyright 2000-2003 Katipo Communications
 # Copyright 2010 BibLibre
+# Parts Copyright 2010 Catalyst IT
 #
 # This file is part of Koha.
 #
@@ -352,11 +353,11 @@ sub GetMemberDetails {
     my $query;
     my $sth;
     if ($borrowernumber) {
-        $sth = $dbh->prepare("select borrowers.*,category_type,categories.description from borrowers left join categories on borrowers.categorycode=categories.categorycode where  borrowernumber=?");
+        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE  borrowernumber=?");
         $sth->execute($borrowernumber);
     }
     elsif ($cardnumber) {
-        $sth = $dbh->prepare("select borrowers.*,category_type,categories.description from borrowers left join categories on borrowers.categorycode=categories.categorycode where cardnumber=?");
+        $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?");
         $sth->execute($cardnumber);
     }
     else {
@@ -386,6 +387,7 @@ sub GetMemberDetails {
     $sth->execute( $borrower->{'categorycode'} );
     my $enrolment = $sth->fetchrow;
     $borrower->{'enrolmentperiod'} = $enrolment;
+    
     return ($borrower);    #, $flags, $accessflagshash);
 }
 
index 4d81a17..12c5190 100644 (file)
                         [% USER_INF.firstname %] [% USER_INF.surname %] ([% USER_INF.cardnumber %])
                       [% END %]
                     </h3>[% END %]
+             [% IF (RESERVE_CHARGE) %]
+             <div class="dialog alert">
+               There is a charge of [% RESERVE_CHARGE %] for placing this reserve
+             </div>
+             [% END %]
 
             <form action="/cgi-bin/koha/opac-reserve.pl" method="post">
             <input type="hidden" name="place_reserve" value="1"/>
index a92a976..ab02afe 100755 (executable)
@@ -54,6 +54,10 @@ sub get_out ($$$) {
 # get borrower information ....
 my ( $borr ) = GetMemberDetails( $borrowernumber );
 
+# Pass through any reserve charge
+if ($borr->{reservefee} > 0){
+    $template->param( RESERVE_CHARGE => sprintf("%.2f",$borr->{reservefee}));
+}
 # get branches and itemtypes
 my $branches = GetBranches();
 my $itemTypes = GetItemTypes();