[Koha-patches] [PATCH] Analytical records - support for holds from the OPAC

savitra.sirohi at osslabs.biz savitra.sirohi at osslabs.biz
Fri Nov 5 14:26:43 CET 2010


From: Amit Gupta <amit.gupta at osslabs.biz>

Signed-off-by: Amit Gupta <amit.gupta at osslabs.biz>
---
 .../opac-tmpl/prog/en/modules/opac-reserve.tmpl    |   10 ++++++++++
 opac/opac-reserve.pl                               |   19 ++++++++++++++++++-
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
index 812c91b..59c9a2f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
@@ -457,6 +457,9 @@
                               <th>Vol Info</th>
                             <!-- /TMPL_IF -->
                             <th>Information</th>
+		            <!-- TMPL_IF NAME="hostitemsflag" -->
+			      <th>Host Record</th>
+			    <!-- /TMPL_IF -->
                           </tr>
 
                           <!-- TMPL_LOOP name="itemLoop" -->
@@ -499,15 +502,22 @@
                                   <span class="notforloan">Not for loan (<!-- TMPL_VAR NAME="notforloanvalue" -->)</span>
                                 <!-- /TMPL_IF -->
                                 <!-- TMPL_IF NAME="reservedate"-->
+				<!-- TMPL_IF NAME="already_reserved"-->
+				  <span class="waiting">You have already requested this item. </span>
+				<!-- TMPL_ELSE -->
                                   <span class="waiting"><!-- TMPL_IF NAME="waitingdate" -->Waiting<!-- TMPL_ELSE -->On hold<!-- /TMPL_IF --> for patron
                                     <!-- TMPL_IF NAME="waitingdate" -->at<!-- TMPL_ELSE -->expected at<!-- /TMPL_IF --> <!-- TMPL_VAR NAME="ExpectedAtLibrary" -->
                                     since
                                     <!-- TMPL_IF NAME="waitingdate" --><!-- TMPL_VAR NAME="waitingdate" --><!-- TMPL_ELSE --><!-- TMPL_IF name="reservedate" --><!-- TMPL_VAR NAME="reservedate" --><!-- /TMPL_IF --><!-- /TMPL_IF -->.
                                   </span>
+				<!-- /TMPL_IF -->
                                 <!-- TMPL_ELSE -->
                                   <span class="notonhold">Not on hold</span>
                                 <!-- /TMPL_IF -->&nbsp;
                               </td>
+                <!-- TMPL_IF NAME="hostitemsflag" -->
+                      <td><!-- TMPL_IF NAME="hostbiblionumber" --><a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="hostbiblionumber" -->" >Host Record</a><!-- /TMPL_IF --></td>
+                <!-- /TMPL_IF -->
                             </tr>
                           <!-- /TMPL_LOOP -->
                         </table>
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index bcd47a7..01cd576 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -195,6 +195,12 @@ if ( $query->param('place_reserve') ) {
             $branch = $borr->{'branchcode'};
         }
 
+	#item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber
+	my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum);
+	if ($hostbiblioNum ne $biblioNum) {
+		$biblioNum = $hostbiblioNum;
+	}
+
         my $biblioData = $biblioDataHash{$biblioNum};
         my $found;
 
@@ -390,6 +396,11 @@ foreach my $biblioNum (@biblionumbers) {
         my ($reservedate,$reservedfor,$expectedAt) = GetReservesFromItemnumber($itemNum);
         my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
 
+	# the item could be reserved for this borrower vi a host record, flag this
+	if ($reservedfor eq $borrowernumber){
+		$itemLoopIter->{already_reserved} = 1;
+	}
+
         if ( defined $reservedate ) {
             $itemLoopIter->{backgroundcolor} = 'reserved';
             $itemLoopIter->{reservedate}     = format_date($reservedate);
@@ -431,6 +442,12 @@ foreach my $biblioNum (@biblionumbers) {
             $itemLoopIter->{nocancel} = 1;
         }
 
+	# if the items belongs to a host record, show link to host record
+	if ($itemInfo->{biblionumber} ne $biblioNum){
+		$biblioLoopIter{hostitemsflag} = 1;
+		$itemLoopIter->{hostbiblionumber} = $itemInfo->{biblionumber};
+	}
+
         # If there is no loan, return and transfer, we show a checkbox.
         $itemLoopIter->{notforloan} = $itemLoopIter->{notforloan} || 0;
 
@@ -444,7 +461,7 @@ foreach my $biblioNum (@biblionumbers) {
             $policy_holdallowed = 0;
         }
 
-        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum)) {
+        if (IsAvailableForItemLevelRequest($itemNum) and $policy_holdallowed and CanItemBeReserved($borrowernumber,$itemNum) and ($itemLoopIter->{already_reserved} ne 1)) {
             $itemLoopIter->{available} = 1;
             $numCopiesAvailable++;
         }
-- 
1.5.4.5



More information about the Koha-patches mailing list