From 278adf955b37b522d01c4014b831ee7f36d2f77f Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 9 Nov 2009 09:56:10 +0100 Subject: [PATCH] Editing copynumber to stocknumber Updating updatedatabase.pl Updating value_builder --- cataloguing/value_builder/stocknumber.pl | 2 +- installer/data/mysql/updatedatabase.pl | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cataloguing/value_builder/stocknumber.pl b/cataloguing/value_builder/stocknumber.pl index a289cd3f06..19e1d7b1e6 100755 --- a/cataloguing/value_builder/stocknumber.pl +++ b/cataloguing/value_builder/stocknumber.pl @@ -50,7 +50,7 @@ sub plugin_javascript { my $branchcode = C4::Context->userenv->{'branch'}; - $query = "SELECT MAX(CAST(SUBSTRING_INDEX(copynumber,'_',-1) AS SIGNED)) FROM items WHERE homebranch = ?"; + $query = "SELECT MAX(CAST(SUBSTRING_INDEX(stocknumber,'_',-1) AS SIGNED)) FROM items WHERE homebranch = ?"; my $sth=$dbh->prepare($query); $sth->execute($branchcode); while (my ($count)= $sth->fetchrow_array) { diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 42631b844a..6b13379d68 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3176,8 +3176,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { INSERT IGNORE INTO marc_subfield_structure (frameworkcode,tagfield, tagsubfield, tab, repeatable, mandatory,kohafield) SELECT DISTINCT (frameworkcode),995,"j",10,0,0,"items.stocknumber" from biblio_framework ; }); - } - + #Previously, copynumber was used as stocknumber + $dbh->do(qq{ + UPDATE items set stocknumber=copynumber; + }); + $dbh->do(qq{ + UPDATE items set copynumber=NULL; + }); + } print "Upgrade to $DBversion done (stocknumber field added)\n"; SetVersion ($DBversion); } -- 2.39.5