[Koha-patches] [PATCH] Bug 3539, Adding a systempreference to hide borrowers name on the catalogue detail page, and holds page

Chris Cormack chrisc at catalyst.net.nz
Wed Aug 19 10:21:13 CEST 2009


Squashed commit of the following:

commit e9dd6e1dee03fe3503f7995b57510f9edfe6b333
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Wed Aug 19 08:14:53 2009 +0000

    Version number

commit df3ee5473e79b760a91c62b96d7ce19229e0fd27
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Wed Aug 19 08:08:11 2009 +0000

    French systempref

commit c4b036e4e43947d7d1fb9f2e18e460788cb4e1ec
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Wed Aug 19 00:25:33 2009 +0000

    Code to update the database, and updating the sysprefs.sql

commit f74b942c24d5e9c33a4ec0e5ac706a0e347eb1a7
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Tue Aug 18 02:07:22 2009 +0000

    Now hides the name on the detail screen too

commit 53c80dbef88e360a4bbb78ecff3a6ca6ec401398
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Tue Aug 18 01:35:19 2009 +0000

    Allowing the librarians to choose to hide the borrowers name on holds
---
 admin/systempreferences.pl                         |    2 ++
 catalogue/detail.pl                                |    7 ++++++-
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |    6 ++++++
 .../prog/en/modules/catalogue/detail.tmpl          |   16 ++++++++++++++--
 .../prog/en/modules/reserve/request.tmpl           |    8 +++++++-
 kohaversion.pl                                     |    2 +-
 reserve/request.pl                                 |    7 +++++--
 9 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index bb73d42..419fa06 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -201,6 +201,8 @@ $tabsysprefs{AutoEmailOpacUser}            = "Patrons";
 $tabsysprefs{AutoEmailPrimaryAddress}      = "Patrons";
 $tabsysprefs{EnhancedMessagingPreferences} = "Patrons";
 $tabsysprefs{'SMSSendDriver'}              = 'Patrons';
+$tabsysprefs{HidePatronName}               = "Patrons";
+
 
 # I18N/L10N
 $tabsysprefs{dateformat}    = "I18N/L10N";
diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index a24031e..9c9ebe9 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -155,6 +155,10 @@ foreach my $item (@items) {
     # checking for holds
     my ($reservedate,$reservedfor,$expectedAt) = GetReservesFromItemnumber($item->{itemnumber});
     my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
+    
+    if (C4::Context->preference('HidePatronName')){
+	$item->{'hidepatronname'} = 1;
+    }
 
     if ( defined $reservedate ) {
         $item->{backgroundcolor} = 'reserved';
@@ -162,7 +166,8 @@ foreach my $item (@items) {
         $item->{ReservedForBorrowernumber}     = $reservedfor;
         $item->{ReservedForSurname}     = $ItemBorrowerReserveInfo->{'surname'};
         $item->{ReservedForFirstname}   = $ItemBorrowerReserveInfo->{'firstname'};
-        $item->{ExpectedAtLibrary}     = $branches->{$expectedAt}{branchname};
+        $item->{ExpectedAtLibrary}      = $branches->{$expectedAt}{branchname};
+	$item->{cardnumber}             = $ItemBorrowerReserveInfo->{'cardnumber'};
     }
 
 	# Check the transit status
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 1921948..2e394d4 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -250,3 +250,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('F
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','See:  http://aws.amazon.com.  Note that this is required after 2009/08/15 in order to retrieve any enhanced content other than book covers from Amazon.','','free');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patrons cardnumbers will be shown instead of their name on the holds and catalogue screens', 'YesNo');
\ No newline at end of file
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 d08415f..ab98724 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
@@ -252,3 +252,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('F
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','Voir:  http://aws.amazon.com. Notez que cela est nécessaire après le 15 Aout 2009 pour pouvoir utiliser les webservices Amazon autre que les couvertures de livre.','','free');
+INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'Active l'affichage du numéro des adhérents à la place de leur nom dans les pages de réservation et du catalogue.', 'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index f81acaa..e8632b3 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2503,6 +2503,12 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     print "Upgrade to $DBversion done (added AWSPrivateKey syspref - note that if you use enhanced content from Amazon, this should be set right away.)";
 }
 
+$DBversion = '3.01.00.045';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('HidePatronName', '0', '', 'If this is switched on, patrons cardnumbers will be shown instead of their name on the holds and catalogue screens', 'YesNo')");
+    SetVersion ($DBversion);
+    print "Upgrade to $DBversion done (added a preference to hide the patrons name in the staff catalog)";
+}
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
index 4bacb77..e330f7f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
@@ -200,7 +200,13 @@ function verify_images() {
                 <!-- TMPL_IF name="datedue" -->
 						<span class="datedue">Checked out
                     <!-- TMPL_UNLESS  NAME="NOTSAMEBRANCH" -->
-                          to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->"><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></a>
+                          to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->">
+			  <!-- TMPL_IF NAME='hidepatronname' -->
+			      <!-- TMPL_VAR NAME="cardnumber" -->
+			  <!-- TMPL_ELSE -->
+			      <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" -->
+			  <!-- /TMPL_IF -->
+			  </a>
                     <!-- /TMPL_UNLESS -->
 						: due <!-- TMPL_VAR NAME="datedue" -->
 						</span>
@@ -252,7 +258,13 @@ function verify_images() {
                     <!-- TMPL_ELSE -->
                         On hold
                     <!-- /TMPL_IF -->
-                    <!-- TMPL_IF NAME="canreservefromotherbranches" -->for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="ReservedForBorrowernumber" -->"><!-- TMPL_VAR NAME="ReservedForFirstname" --> <!-- TMPL_VAR NAME="ReservedForSurname" --></a><!-- /TMPL_IF -->
+                    <!-- TMPL_IF NAME="canreservefromotherbranches" -->for <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="ReservedForBorrowernumber" -->">
+		        <!-- TMPL_IF NAME="hidepatronname" -->
+		            <!-- TMPL_VAR NAME="cardnumber" -->
+		        <!-- TMPL_ELSE -->
+		            <!-- TMPL_VAR NAME="ReservedForFirstname" --> <!-- TMPL_VAR NAME="ReservedForSurname" -->
+			<!-- /TMPL_IF -->
+		    </a><!-- /TMPL_IF -->
                     <!-- TMPL_IF NAME="waitingdate" -->
                         at<!-- TMPL_ELSE -->expected at
                     <!-- /TMPL_IF -->   <!-- TMPL_VAR NAME="ExpectedAtLibrary" -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
index 29187b9..094a4f4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tmpl
@@ -552,7 +552,13 @@ function checkMultiHold() {
           </select>
         </td>
         <td>
-          <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->" ><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --></a>
+          <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->" >
+	  <!-- TMPL_IF NAME="hidename" -->
+	      <!-- TMPL_VAR NAME="cardnumber" -->
+	  <!-- TMPL_ELSE -->
+	      <!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" -->
+	  <!-- /TMPL_IF -->
+	  </a>
         </td>
         <td><!-- TMPL_VAR NAME="notes" --></td>
         <td><!-- TMPL_VAR NAME="date" --></td>
diff --git a/kohaversion.pl b/kohaversion.pl
index c9bdbb1..41c2a33 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.041';
+    our $VERSION = '3.01.00.045';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
diff --git a/reserve/request.pl b/reserve/request.pl
index 08ddd61..2a744e3 100755
--- a/reserve/request.pl
+++ b/reserve/request.pl
@@ -478,13 +478,16 @@ foreach my $biblionumber (@biblionumbers) {
         
         #     get borrowers reserve info
         my $reserveborrowerinfo = GetMemberDetails( $res->{'borrowernumber'}, 0);
-        
+        if (C4::Context->preference('HidePatronName')){
+	    $reserve{'hidename'} = 1;
+	    $reserve{'cardnumber'} = $reserveborrowerinfo->{'cardnumber'};
+	}
         $reserve{'date'}           = format_date( $res->{'reservedate'} );
         $reserve{'borrowernumber'} = $res->{'borrowernumber'};
         $reserve{'biblionumber'}   = $res->{'biblionumber'};
         $reserve{'borrowernumber'} = $res->{'borrowernumber'};
         $reserve{'firstname'}      = $reserveborrowerinfo->{'firstname'};
-        $reserve{'surname'}        = $reserveborrowerinfo->{'surname'};
+        $reserve{'surname'}        = $reserveborrowerinfo->{'surname'};	    
         $reserve{'notes'}          = $res->{'reservenotes'};
         $reserve{'wait'}           =
           ( ( defined $res->{'found'} and $res->{'found'} eq 'W' ) or ( $res->{'priority'} eq '0' ) );
-- 
1.5.6.5




More information about the Koha-patches mailing list