[PATCH] Add T-prefix removal to itemBarcodeInputFilter

Michael Hafen mdhafen at tech.washk12.org
Fri Aug 22 07:28:19 NZST 2008


This adds an option to itemBarcodeInputFilter, trim-Tprefix, that removes whitespace and 'T' from the beginning of the barcode.
---
 C4/Circulation.pm                              |    2 ++
 installer/data/mysql/en/mandatory/sysprefs.sql |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
 mode change 100644 => 100755 installer/data/mysql/en/mandatory/sysprefs.sql

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 4dcf179..c3b3c8c 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -144,6 +144,8 @@ sub barcodedecode {
     $filter or return $barcode;     # ensure filter is defined, else return untouched barcode
 	if ($filter eq 'whitespace') {
 		$barcode =~ s/\s//g;
+	} elsif ($filter eq 'trim-Tprefix') {
+		$barcode =~ s/^[tT\s]*//;
 	} elsif ($filter eq 'cuecat') {
 		chomp($barcode);
 	    my @fields = split( /\./, $barcode );
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
old mode 100644
new mode 100755
index c79a727..5ab9693
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -143,7 +143,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('libraryAddress','','The address to use for printing receipts, overdues, etc. if different than physical address',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('finesMode','test','Choose the fines mode, \'off\', \'test\' (emails admin report) or \'production\' (accrue overdue fines).  Requires accruefines cronjob.','off|test|production','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('globalDueDate','','If set, allows a global static due date for all checkouts','10','free');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','whitespace|T-prefix|cuecat','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('itemBarcodeInputFilter','','If set, allows specification of a item barcode input filter','none|whitespace|trim-Tprefix|T-prefix|cuecat','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('singleBranchMode',0,'Operate in Single-branch mode, hide branch selection in the OPAC',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('URLLinkText','','Text to display as the link anchor in the OPAC',NULL,'free');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACSubscriptionDisplay','economical','Specify how to display subscription information in the OPAC','economical|off|full','Choice');
-- 
1.5.6.3


--=-P89dudLfLyVLWlVnlYS5--



More information about the Koha mailing list