From 22b488cc1ad36f1da7695b27cf77e1da2bae6c58 Mon Sep 17 00:00:00 2001 From: Srdjan Date: Mon, 26 Mar 2012 14:44:21 +1300 Subject: [PATCH] bug7398: OPACShowHoldsCount syspref Show holds count on OPAC detail if OPACShowHoldsCount is yes Take in account OPACShowHoldsCount syspref on opac-reserves.pl --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++ .../prog/en/modules/admin/preferences/opac.pref | 6 ++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 9 ++++ .../opac-tmpl/prog/en/modules/opac-reserve.tt | 46 ++++++++--------- opac/opac-detail.pl | 10 ++++ opac/opac-reserve.pl | 51 ++++++++++---------- 7 files changed, 80 insertions(+), 50 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 3e850b3..47abbce 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -355,3 +355,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowPublicListCreation',1,'If set, allows opac users to create public lists',NULL,'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAllowSharingPrivateLists',0,'If set, allows opac users to share private lists with other patrons',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowHoldsCount',0,'Show the total number of holds in the OPAC details',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8259bf2..4a1ce74 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5036,6 +5036,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.07.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OPACShowHoldsCount',0,'Show the total number of holds in the OPAC details',NULL,'YesNo')"); + print "Upgrade to $DBversion done (Added system preference OPACShowHoldsCount)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index ae6b620..7af079d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -343,6 +343,12 @@ OPAC: no: "Don't allow" - patrons to place holds on specific items in the OPAC. If this is disabled, users can only put a hold on the next available item. - + - pref: OPACShowHoldsCount + choices: + yes: Show + no: "Don't show" + - the total number of holds on the details page + - - pref: OpacRenewalAllowed choices: yes: Allow diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 5c5b885..854929e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -599,6 +599,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () { Status [% IF ( itemdata_itemnotes ) %]Notes[% END %] Date Due + [% IF holds_count.defined %] + Holds + [% END %] [% FOREACH ITEM_RESULT IN ITEM_RESULTS %] [% IF ( item_level_itypes ) %][% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %][% ITEM_RESULT.description %][% END %][% END %] [% ITEM_RESULT.description %][% END %] @@ -623,10 +626,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] [% ITEM_RESULT.datedue %] + [% IF holds_count.defined %] + [% ITEM_RESULT.holds_count %] + [% END %] [% END %] [% END %] + [% IF holds_count.defined %] +
Holds: [% holds_count %]
+ [% END %] [% ELSE %] [% IF ( ALTERNATEHOLDINGS ) %] [% FOREACH ALTERNATEHOLDING IN ALTERNATEHOLDINGS %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index 7597a4a..0373ff3 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -242,7 +242,7 @@ [% UNLESS ( item_level_itypes ) %] Item Type [% END %] - [% IF ( showpriority ) %] + [% IF ( showholds ) %] Priority [% END %] [% IF ( reserve_in_future ) %] @@ -297,19 +297,21 @@ [% END %] - [% IF ( bibitemloo.holdable ) %][% UNLESS ( item_level_itypes ) %] - - [% IF ( bibitemloo.imageurl ) %][% END %] - [% bibitemloo.description %] - - [% END %][% END %] [% IF ( bibitemloo.holdable ) %] - [% IF ( showpriority ) %] - - [% bibitemloo.rank %] out of [% bibitemloo.reservecount %] - [% END %][% END %] - [% IF ( reserve_in_future ) %] - [% IF ( bibitemloo.holdable ) %] + + [% UNLESS ( item_level_itypes ) %] + + [% IF ( bibitemloo.imageurl ) %][% END %] + [% bibitemloo.description %] + + [% END %] + [% IF showholds %] + + [% IF ( showpriority ) %] [% bibitemloo.rank %] out of [% END %][% bibitemloo.reservecount %] + + [% END %] + [% IF ( reserve_in_future ) %] +

Clear Date

- [% END %] - - [% END %] - [% IF ( bibitemloo.holdable ) %] + + [% END %] + Show Calendar

Clear Date

- [% END %] - - [% IF ( bibitemloo.holdable ) %] - - [% IF ( OPACItemHolds ) %] - - + + [% IF ( OPACItemHolds ) %] + +