From 19f2e37468e91d07f0edf2843d013f561b079106 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Fri, 11 Jan 2019 09:25:00 +0000 Subject: [PATCH] Bug 22098: Update stocknumberAV cataloguing plugin to use objects This patch: - changes SQL to Koha::AuthorisedValues - remove type param from script tag - fixes the plugin description 0) Do not apply the patch 1) Set the plugin 1.1) Update a biblio framework and link plugin stocknumberAV.pl to some item subfield 1.2) Add authorised values category called "INVENTORY" 1.3) Add some authorised values: authorised value is prefix and description is a current stock/inventory number 2) Add an item and try to use this plugin to ensure you set it correctly 2.1) Use a defined prefix to see if the number is correct 2.2) Ensure the number is correctly incremented in authorised values 2.3) Use not defined prefix to see the error message 2.4) Insert a not prefix string (eg number) to see it is not changed 3) Apply the patch 4) Repeat 2) and see it is working the same 5) Look into patch and confirm the description does make sense and is rigth according to what you see in UI 6) Sign off :D Signed-off-by: Fridolin Somers Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- cataloguing/value_builder/stocknumberAV.pl | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/cataloguing/value_builder/stocknumberAV.pl b/cataloguing/value_builder/stocknumberAV.pl index ac9d41f537..395623eea6 100755 --- a/cataloguing/value_builder/stocknumberAV.pl +++ b/cataloguing/value_builder/stocknumberAV.pl @@ -23,18 +23,18 @@ use Modern::Perl; use CGI qw ( -utf8 ); use C4::Auth; -use C4::Context; use C4::Output; +use Koha::AuthorisedValues; =head1 DESCRIPTION This plugin is based on authorised values INVENTORY. It is used for stocknumber computation. -If the user send an empty string, we return a simple incremented stocknumber. +If no prefix is submitted, or prefix does not contain only nubers, it returns the inserted code (= keep a field unchanged) If a prefix is submited, we look for the highest stocknumber with this prefix, and return it incremented. In this case, a stocknumber has this form : "PREFIX 0009678570". - - PREFIX is an upercase word + - PREFIX contains of letters - a space separator - 10 digits, with leading 0s if needed @@ -43,7 +43,7 @@ In this case, a stocknumber has this form : "PREFIX 0009678570". my $builder = sub { my ( $params ) = @_; my $res = qq{ -