From 416256cf11637721dd0e8aad5e85d8955aab0788 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@biblibre.com>
Date: Thu, 30 Aug 2012 15:06:58 +0200
Subject: [PATCH] Bug 7992: Followup: Rename the plugin stocknumberam123 with
 stocknumberAV

---
 .../value_builder/{stocknumberam123.pl => stocknumberAV.pl}    |    6 +++---
 installer/data/mysql/updatedatabase.pl                         |    8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
 rename cataloguing/value_builder/{stocknumberam123.pl => stocknumberAV.pl} (95%)

diff --git a/cataloguing/value_builder/stocknumberam123.pl b/cataloguing/value_builder/stocknumberAV.pl
similarity index 95%
rename from cataloguing/value_builder/stocknumberam123.pl
rename to cataloguing/value_builder/stocknumberAV.pl
index f2de8c1..0578d44 100755
--- a/cataloguing/value_builder/stocknumberam123.pl
+++ b/cataloguing/value_builder/stocknumberAV.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# Copyright 2010 BibLibre SARL
+# Copyright 2012 BibLibre SARL
 #
 # This file is part of Koha.
 #
@@ -24,7 +24,7 @@ use C4::Context;
 
 =head1 DESCRIPTION
 
-This plugin is specific to AM123 but could be used as a base for similar operations.
+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.
@@ -57,7 +57,7 @@ sub plugin_javascript {
                     url: '/cgi-bin/koha/cataloguing/plugin_launcher.pl',
                     type: 'POST',
                     data: {
-                        'plugin_name': 'stocknumberam123.pl',
+                        'plugin_name': 'stocknumberAV.pl',
                         'code'    : code.value,
                     },
                     success: function(data){
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index e58c4c9..ceee34e 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -5657,6 +5657,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+
+$DBversion = "3.09.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("UPDATE marc_subfield_structure SET value_builder='stocknumberAV.pl' WHERE value_builder='stocknumberam123.pl'");
+    print "Upgrade to $DBversion done (Bug 7992 - Rename the value_builder plugin stocknumberam123.pl with stocknumberAV.pl.)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)
-- 
1.7.10.4