[Koha-patches] [PATCH] Bug 3173 Place Hold link visible in OPAC even if syspref turned off

Jane Wagner jwagner at ptfs.com
Wed Apr 29 21:30:54 CEST 2009


If the syspref RequestOnOpac is turned off, the link to place a hold does not
show in the detail page.  However, the link is still present in the results
list as well as in the basket and in lists.  Modified scripts and templates
to check for the syspref and to obey it.
---
 .../opac-tmpl/prog/en/modules/opac-basket.tmpl     |    5 +++--
 .../opac-tmpl/prog/en/modules/opac-opensearch.tmpl |    5 ++++-
 .../opac-tmpl/prog/en/modules/opac-results.tmpl    |    3 ++-
 .../opac-tmpl/prog/en/modules/opac-shelves.tmpl    |    5 ++++-
 opac/opac-basket.pl                                |    7 +++++--
 opac/opac-search.pl                                |    6 +++++-
 opac/opac-shelves.pl                               |    6 ++++++
 7 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl
index a102457..5897f86 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-basket.tmpl
@@ -76,9 +76,10 @@ function tagAdded() {
 		);
 	        return false;
 	    });
+	<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
         $(".holdsep").text("| ");
         $(".hold").text("Place Hold");
-  
+	<!-- /TMPL_IF -->
         <!-- TMPL_IF NAME="TagsEnabled" -->
         <!-- TMPL_IF NAME="TagsInputOnList" -->
           $(".tagsep").text("| ");
@@ -350,4 +351,4 @@ function tagAdded() {
 </div>
 </div>
 </body>
-</html>
\ No newline at end of file
+</html>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl
index beeb750..28e07f7 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-opensearch.tmpl
@@ -44,7 +44,10 @@
                         <!-- TMPL_IF name="pages" -->. <!-- TMPL_VAR name="pages"  ESCAPE="html" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="notes" -->, <!-- TMPL_VAR name="notes"  ESCAPE="html" --><!-- /TMPL_IF -->
                         <!-- TMPL_IF name="size" --> <!-- TMPL_VAR name="size"  ESCAPE="html" -->. <!-- /TMPL_IF -->
-                        <!-- TMPL_IF name="isbn" --> <!-- TMPL_VAR name="isbn"  ESCAPE="html" --><!-- /TMPL_IF --> </p><p><a href="<!-- TMPL_VAR NAME="OPACBaseURL" -->/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold on <i><!-- TMPL_VAR NAME="title_nospan" --></i></a></p>
+                        <!-- TMPL_IF name="isbn" --> <!-- TMPL_VAR name="isbn"  ESCAPE="html" --><!-- /TMPL_IF --> </p><p>
+			<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
+			<a href="<!-- TMPL_VAR NAME="OPACBaseURL" -->/cgi-bin/koha/opac-reserve.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Place Hold on <i><!-- TMPL_VAR NAME="title_nospan" --></i></a></p>
+			<!-- /TMPL_IF -->
 						]]></description>
        <guid><!-- TMPL_VAR NAME="OPACBaseURL" -->/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" --></guid>
      </item>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
index 60c7858..e7e4ec1 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tmpl
@@ -279,9 +279,10 @@ $(document).ready(function(){
             <!-- TMPL_IF EXPR="opacbookbag || virtualshelves" -->
     	    	<span class="addto"></span>
             <!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
 		    <span id="placehold"><!-- input class="submit" type="submit" value="Place Hold"/ --></span>
             <div id="holdDetails"></div>
-
+            <!-- /TMPL_IF -->
 			<!-- TMPL_IF NAME="TagsEnabled" -->
             <!-- TMPL_IF NAME="TagsInputOnList" -->
                 <span id="tagsel_span"></span>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
index 18ebcf2..f27e1a8 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tmpl
@@ -96,8 +96,9 @@ $(function() {
 });
 
 $(document).ready(function(){
+    <!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
     $(".hold").html("Place Hold");
-
+    <!-- /TMPL_IF -->
     <!-- TMPL_IF NAME="TagsEnabled" -->
     $("#tagsel_tag").text("Tag");
     $("#tagsel_button").click(function(){
@@ -177,7 +178,9 @@ $(document).ready(function(){
                          <input type="submit" class="deleteshelf" value="Delete List" onclick="return confirmDelete(_('Are you sure you want to remove this List?'));"/>
                       </form>
                       <a href="#" class="send tag_hides" onclick="open(CGIBIN+'opac-sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a>
+		<!-- TMPL_IF NAME="opacuserlogin" --><!-- TMPL_IF NAME="RequestOnOpac" -->
                       <a href="#" class="hold tag_hides" onclick="holdSelections();return false;"></a>
+		<!-- /TMPL_IF -->
                     <!-- /div -->
                     <a id="tagsel_tag" href="#" onclick="tagSelected(); return false;"></a>                 
                     <span id="tagsel_form" style="display:none">
diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl
index 154d8af..29ec6a9 100755
--- a/opac/opac-basket.pl
+++ b/opac/opac-basket.pl
@@ -54,8 +54,11 @@ if (C4::Context->preference('TagsEnabled')) {
 		C4::Context->preference($_) and $template->param($_ => 1);
 	}
 }
-
-
+# adding the $RequestOnOpac param
+my $RequestOnOpac;
+if (C4::Context->preference("RequestOnOpac")) {
+        $RequestOnOpac = 1;
+}
 foreach my $biblionumber ( @bibs ) {
     $template->param( biblionumber => $biblionumber );
 
diff --git a/opac/opac-search.pl b/opac/opac-search.pl
index a20041e..18fcd05 100755
--- a/opac/opac-search.pl
+++ b/opac/opac-search.pl
@@ -58,7 +58,11 @@ else {
     authnotrequired => 1,
     }
 );
-
+# adding the $RequestOnOpac param
+my $RequestOnOpac;
+if (C4::Context->preference("RequestOnOpac")) {
+        $RequestOnOpac = 1;
+}
 if ($cgi->param("format") && $cgi->param("format") eq 'rss2') {
 	$template->param("rss2" => 1);
 }
diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl
index dbd598c..dc72da9 100755
--- a/opac/opac-shelves.pl
+++ b/opac/opac-shelves.pl
@@ -31,6 +31,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
         type            => "opac",
         authnotrequired => 1,
     });
+# adding the $RequestOnOpac param
+my $RequestOnOpac;
+if (C4::Context->preference("RequestOnOpac")) {
+        $RequestOnOpac = 1;
+}
 $template->param(listsview => 1);
 # if $loggedinuser is not defined, set it to -1, which should
 # not correspond to any real borrowernumber.  
@@ -38,3 +43,4 @@ $template->param(listsview => 1);
 #        routines in C4::VirtualShelves and C4::VirtualShelves::page
 #        to deal with lists accessed during an anonymous OPAC session
 shelfpage('opac', $query, $template, (defined($loggedinuser) ? $loggedinuser : -1), $cookie);
+
-- 
1.5.6.5




More information about the Koha-patches mailing list