[Koha-patches] [PATCH] Adds a new SystemPreference : RenewSerialAddsSuggestion

Henri-Damien LAURENT henridamien at koha-fr.org
Wed May 7 11:04:15 CEST 2008


This system preference, if Set, will create a new acquisition suggestion on Subscription Renew.
This is only to prevent the default behaviour generating many useless suggestions.
Nonetheless, some libraries could require this thing.
---
 C4/Serials.pm                                      |   19 ++++++++++---------
 admin/systempreferences.pl                         |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |   12 ++++++++----
 kohaversion.pl                                     |    2 +-
 6 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/C4/Serials.pm b/C4/Serials.pm
index 78d7e43..242d067 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -1428,15 +1428,16 @@ sub ReNewSubscription {
      my $sth = $dbh->prepare($query);
      $sth->execute( $subscription->{biblionumber} );
      my $biblio = $sth->fetchrow_hashref;
-     NewSuggestion(
-         $user,             $subscription->{bibliotitle},
-         $biblio->{author}, $biblio->{publishercode},
-         $biblio->{note},   '',
-         '',                '',
-         '',                '',
-         $subscription->{biblionumber}
-     );
-
+     if (C4::Context->preference("RenewSerialAddsSuggestion")){
+        NewSuggestion(
+            $user,             $subscription->{bibliotitle},
+            $biblio->{author}, $biblio->{publishercode},
+            $biblio->{note},   '',
+            '',                '',
+            '',                '',
+            $subscription->{biblionumber}
+        );
+    }
     # renew subscription
     $query = qq|
         UPDATE subscription
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index decbd77..3822d13 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -116,6 +116,7 @@ my %tabsysprefs;
     $tabsysprefs{ReceiveBackIssues}="Cataloguing";
     $tabsysprefs{DefaultClassificationSource}="Cataloguing";
     $tabsysprefs{RoutingSerials}="Cataloguing";
+    $tabsysprefs{RenewSerialAddsSuggestion}="Cataloguing";
     $tabsysprefs{'item-level_itypes'}="Cataloguing";
 
 # Circulation
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 64c7582..0724749 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -183,3 +183,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GranularPermissions','0','Use detailed staff user permissions',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion',0,'If ON, adds a new suggestion at serial subscription renewal',NULL,'YesNo');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index bf5eb5b..7591064 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -185,3 +185,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACItemHolds','1','Si activé, les adhérents peuvent placer des réservations sur un exemplaire spécifique. Sinon, il ne peuvent que réserver le prochain disponible.','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('GranularPermissions','0','Use detailed staff user permissions',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable, value,options,type, explanation) VALUES ('AddPatronLists','categorycode','categorycode|category_type','Choice','Slectionner categorycode ou category_type permet d\'afficher la liste des catégories ou des types de catégories à l\'ajout d\'un lecteur');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion',0,'Si activé, génère une suggestion d\'achat à chaque Renouvellement d\'abonnement',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index d080d49..9a615db 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -1479,16 +1479,20 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 }
 
 $DBversion = "3.00.00.079";
-if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    my ($print_error) = $dbh->{PrintError};
-    $dbh->{PrintError} = 0;
-    
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {   
     $dbh->do("INSERT INTO `systempreferences` (variable, value,options,type, explanation)VALUES
 	    ('AddPatronLists','categorycode','categorycode|category_type','Choice','Allow user to choose what list to pick up from when adding patrons')");
 	print "Upgrade to $DBversion done (add browser table if not already present)\n";
 	SetVersion ($DBversion);
 }
 
+    $DBversion = "3.00.00.080";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RenewSerialAddsSuggestion','0','if ON, adds a new suggestion at serial subscription renewal',NULL,'YesNo');");
+  print "Upgrade to $DBversion done (add browser table if not already present)\n";
+  SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/kohaversion.pl b/kohaversion.pl
index ccff567..2d83d26 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = "3.00.00.079";
+    our $VERSION = "3.00.00.080";
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.5.4.3




More information about the Koha-patches mailing list