Bug 22996: Add new preference BarcodeSeparators
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 28 May 2019 14:47:35 +0000 (14:47 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 10 Sep 2019 08:34:23 +0000 (09:34 +0100)
The pref value is used within a regex character class like [pref].
This means that we should precede hyphen with a backslash; the pipe char
or dot does not need escaping.

Test plan:
Run new install or upgrade.
Check pref value.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

installer/data/mysql/atomicupdate/bug_22996.perl [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref

diff --git a/installer/data/mysql/atomicupdate/bug_22996.perl b/installer/data/mysql/atomicupdate/bug_22996.perl
new file mode 100644 (file)
index 0000000..c90d71b
--- /dev/null
@@ -0,0 +1,6 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do( q/INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES (?, ?, ?, ?, ?)/, undef, 'BarcodeSeparators','\s\r\n','','Splitting characters for barcodes','Free' );
+    SetVersion( $DBversion );
+    print "Upgrade to $DBversion done (Bug 22996 - Add pref BarcodeSeparators)\n";
+}
index f61c042..807bef0 100644 (file)
@@ -85,6 +85,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('BakerTaylorEnabled','0','','Enable or disable all Baker & Taylor features.','YesNo'),
 ('BakerTaylorPassword','','','Baker & Taylor Password for Content Cafe (external content)','Free'),
 ('BakerTaylorUsername','','','Baker & Taylor Username for Content Cafe (external content)','Free'),
+('BarcodeSeparators','\\s\\r\\n','','Splitting characters for barcodes','Free'),
 ('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
 ('BatchCheckouts','0','','Enable or disable batch checkouts','YesNo'),
 ('BatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch','Free'),
index 52dfd85..1d4f296 100644 (file)
@@ -1,4 +1,10 @@
 Tools:
+    Barcodes:
+        -
+            - Split barcodes on the following separator chars
+            - pref: BarcodeSeparators
+              default: '\s\r\n'
+            - "in batch item modification and inventory.<br/>Note: Type \\r for carriage return, \\n for newline and \\s for whitespace. Possible candidates to include also are pipe char |, hyphen (precede with backslash), comma, semicolon, dot, etc."
     Batch item:
         -
             - Process up to