[Koha-patches] [PATCH] Bug #2754 Show hold request priority in OPAC

Galen Charlton galen.charlton at liblime.com
Fri Dec 5 14:43:54 CET 2008


From: Allen Reinmeyer <allen.reinmeyer at liblime.com>

Code changes to display the priority level on holds in OPAC. Turned on/off based on System Preference.  Database changes to systempreferences for both English and French

Signed-off-by: Galen Charlton <galen.charlton at liblime.com>
---
 admin/systempreferences.pl                         |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql     |    2 +-
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |    6 ++++++
 koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl |    6 ++++++
 opac/opac-user.pl                                  |    5 +++++
 6 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index ef53715..f95aea5 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -267,6 +267,7 @@ my %tabsysprefs;
     $tabsysprefs{OPACViewOthersSuggestions}="OPAC";
     $tabsysprefs{URLLinkText}="OPAC";
     $tabsysprefs{OPACShelfBrowser}="OPAC";
+    $tabsysprefs{OPACDisplayRequestPriority}="OPAC";
 
 # OPAC
     $tabsysprefs{SearchMyLibraryFirst}="OPAC";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 1f13910..3f54c67 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -211,4 +211,4 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 -- FIXME: add FrameworksLoaded, noOPACUserLogin, ReadingHistory ?
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Sets which SMS::Send driver is used to send SMS messages.','free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', 'if ON, allows renewal limits to be overridden on the circulation screen',NULL,'YesNo');
-
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OPACDisplayRequestPriority','0','','Show patrons the priority level on holds in the OPAC','YesNo');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 9f51c4c..5124a33 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -211,4 +211,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES('OpacSuppression', '0', '', 'Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('SMSSendDriver','','','Détermine le pilote utilisé par SMS::Send pour envoyer des SMS.','free');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowRenewalLimitOverride', '0', "S'il est activé, autorise le dépassement des limites du renouvellement sur la page de circulation",NULL,'YesNo');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('OPACDisplayRequestPriority','0','','Afficher l\'ordre des réservation pour les adhérents à l\'opac','YesNo');
 
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 03e13c3..9cb957a 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2040,6 +2040,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.004';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACDisplayRequestPriority','0','Show patrons the priority level on holds in the OPAC','','YesNo')");
+    print "Upgrade to $DBversion done (added OPACDisplayRequestPriority system preference)\n";
+    SetVersion ($DBversion);
+}
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
index 8a0da8a..6a754fd 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
@@ -303,6 +303,9 @@ $.tablesorter.addParser({
                 <th>Title</th>
                 <th>Placed On</th>
                 <th>Pick Up Location</th>
+				<!-- TMPL_IF NAME="showpriority" -->
+				<th>Priority</th>
+				<!-- /TMPL_IF -->
                 <th>Status</th>
 		<th>Modify</th>
             </tr></thead>
@@ -326,6 +329,9 @@ $.tablesorter.addParser({
                 </td>
                 <td><!-- TMPL_VAR NAME="reservedate" --></td>
                 <td><!-- TMPL_VAR NAME="branch" --></td>
+				<!-- TMPL_IF NAME="showpriority" -->
+				<td><!-- TMPL_VAR NAME="priority" --> </td>
+				<!-- /TMPL_IF -->
                 <td>
                     <!-- TMPL_IF NAME="wait" -->
                         <!-- TMPL_IF NAME="atdestination" -->
diff --git a/opac/opac-user.pl b/opac/opac-user.pl
index 71b19b9..dd69072 100755
--- a/opac/opac-user.pl
+++ b/opac/opac-user.pl
@@ -52,6 +52,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
     }
 );
 
+my $OPACDisplayRequestPriority = (C4::Context->preference("OPACDisplayRequestPriority")) ? 1 : 0;
 my $patronupdate = $query->param('patronupdate');
 
 # get borrower information ....
@@ -195,6 +196,9 @@ foreach my $res (@reserves) {
     $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'};
     my $biblioData = GetBiblioData($res->{'biblionumber'});
     $res->{'reserves_title'} = $biblioData->{'title'};
+	if ($OPACDisplayRequestPriority) {
+		$res->{'priority'} = '' if $res->{'priority'} eq '0';
+	}
 }
 
 # use Data::Dumper;
@@ -202,6 +206,7 @@ foreach my $res (@reserves) {
 
 $template->param( RESERVES       => \@reserves );
 $template->param( reserves_count => $#reserves+1 );
+$template->param( showpriority=>1 ) if $OPACDisplayRequestPriority;
 
 my @waiting;
 my $wcount = 0;
-- 
1.5.5.GIT




More information about the Koha-patches mailing list