[Koha-patches] [PATCH] Analytical records: allow only specific copy holds for analytical records plus changes to use new C4 routines
savitra.sirohi at osslabs.biz
savitra.sirohi at osslabs.biz
Wed Nov 24 05:48:08 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 | 47 ++++++++++++++++---
opac/opac-reserve.pl | 28 ++++++------
2 files changed, 53 insertions(+), 22 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 4d06e85..ee99c0d 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tmpl
@@ -99,6 +99,21 @@
$(".copiesrow").hide();
});
+ // When 'hide copies' radion button is clicked
+ $(".hidecopies").click(function() {
+ // Make sure all other specific copy table rows are hidden
+ biblioNum = suffixOf($(this).attr("id"), "_");
+ newCopiesRowId = "#copiesrow_" + biblioNum;
+
+ if (!changeSelection(newCopiesRowId, false)) {
+ return false;
+ }
+
+ // Hide the copies table row
+ $(".copiesrow").hide();
+ });
+
+
// When 'Place Hold' button is clicked
$(".placehold").click(function(){
var biblionumbers = "";
@@ -387,14 +402,26 @@
disabled="disabled"
/>
<!-- TMPL_ELSE -->
- <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
- id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
- class="selectany"
- value="Any"
- checked="checked"
- />
+ <!-- TMPL_IF NAME = "hostitemsflag" -->
+ <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
+ id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
+ class="hidecopies"
+ checked="checked"
+ />
+ <!-- TMPL_ELSE -->
+ <input type="radio" name="reqtype_<!-- TMPL_VAR NAME="biblionumber" -->"
+ id="reqany_<!-- TMPL_VAR NAME="biblionumber" -->"
+ class="selectany"
+ value="Any"
+ checked="checked"
+ />
+ <!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
- <label for="reqany_<!-- TMPL_VAR NAME="biblionumber" -->">Next available copy</label>
+ <!-- TMPL_IF NAME="hostitemsflag" -->
+ <label>Hide copies</label>
+ <!-- TMPL_ELSE -->
+ <label for="reqany_<!-- TMPL_VAR NAME="biblionumber" -->">Next available copy</label>
+ <!-- /TMPL_UNLESS -->
</td>
</tr>
<tr>
@@ -413,7 +440,11 @@
value="Specific"
/>
<!-- /TMPL_UNLESS -->
- <label for="reqspecific_<!-- TMPL_VAR NAME="biblionumber"-->">A specific copy</label>
+ <!-- TMPL_IF NAME="hostitemsflag" -->
+ <label for="reqspecific_<!-- TMPL_VAR NAME="biblionumber"-->">Show Copies</label>
+ <!-- TMPL_ELSE -->
+ <label for="reqspecific_<!-- TMPL_VAR NAME="biblionumber"-->">A specific copy</label>
+ <!-- /TMPL_IF -->
</td>
</tr>
</table>
diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl
index 01cd576..62f4848 100755
--- a/opac/opac-reserve.pl
+++ b/opac/opac-reserve.pl
@@ -117,17 +117,15 @@ foreach my $biblioNumber (@biblionumbers) {
my $marcrecord= GetMarcBiblio($biblioNumber);
-# adding items linked via host biblios
- foreach my $hostfield ( $marcrecord->field('773')) {
- my $hostbiblionumber = $hostfield->subfield("w");
- my $linkeditemnumber = $hostfield->subfield("o");
- my @hostitemInfos = GetItemsInfo($hostbiblionumber);
- foreach my $hostitemInfo (@hostitemInfos){
- if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
- push(@itemInfos, $hostitemInfo);
- }
- }
- }
+ # flag indicating existence of at least one item linked via a host record
+ my $hostitemsflag;
+ # adding items linked via host biblios
+ my @hostitemInfos = GetHostItemsInfo($marcrecord);
+ if (@hostitemInfos){
+ $hostitemsflag =1;
+ push (@itemInfos, at hostitemInfos);
+ }
+
$biblioData->{itemInfos} = \@itemInfos;
@@ -196,9 +194,11 @@ if ( $query->param('place_reserve') ) {
}
#item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber
- my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum);
- if ($hostbiblioNum ne $biblioNum) {
- $biblioNum = $hostbiblioNum;
+ if ($itemNum ne '') {
+ my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum);
+ if ($hostbiblioNum ne $biblioNum) {
+ $biblioNum = $hostbiblioNum;
+ }
}
my $biblioData = $biblioDataHash{$biblioNum};
--
1.5.4.5
More information about the Koha-patches
mailing list