[Koha-patches] [PATCH] CalendarEditOnlyLoggedInBranch System Preference

Kyle M Hall kyle.m.hall at gmail.com
Thu Apr 1 15:01:35 CEST 2010


Allows editing of the calendar only for the branch the user is logged in as.
This is equivilent to turning on IndependentBranches,
but only affects editing the calendar.
---
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 tools/holidays.pl                                  |    2 +-
 4 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 29e904c..17bb2cc 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -286,3 +286,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'PrintNoticesMaxLines', '0', '', 'If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.', 'Integer' );
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI','0','Enables ILS-DI services at OPAC.','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI:Authorized_IPs','','.','Restricts usage of ILS-DI to some IPs','Free');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'CalendarEditOnlyLoggedInBranch', '0', '', 'Allows editing of the calendar only for the branch the user is logged in as. This is equivilet to turning on IndependentBranches, but only affects editing the calendar.', '');
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 e3ce7f3..f85ca56 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
@@ -288,3 +288,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('soundon','0','Activer les événements sonores de circulation pendant le prêt et le retour dans l''intranet. N''est pas encore supporté par tous les navigateurs web.','','YesNo');
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'PrintNoticesMaxLines', '0', '', 'If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.', 'Integer' );
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI','0','Active les services ILS-DI à l''OPAC.','','YesNo');
+INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'CalendarEditOnlyLoggedInBranch', '0', '', 'Allows editing of the calendar only for the branch the user is logged in as. This is equivilet to turning on IndependentBranches, but only affects editing the calendar.', '');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index e21b37c..042766b 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3548,6 +3548,13 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.01.00.128";
+if (C4::Context->preference("KohaPlusVersion") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ( 'CalendarEditOnlyLoggedInBranch', '0', '', 'Allows editing of the calendar only for the branch the user is logged in as. This is equivilet to turning on IndependentBranches, but only affects editing the calendar.', '')");
+    print "Upgrade to $DBversion done ( Added CalendarEditOnlyLoggedInBranch system preference )\n";
+    SetVersion($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/tools/holidays.pl b/tools/holidays.pl
index a6afcaa..8716c1d 100755
--- a/tools/holidays.pl
+++ b/tools/holidays.pl
@@ -57,7 +57,7 @@ $keydate =~ s/-/\//g;
 
 my $branch= $input->param('branch') || C4::Context->userenv->{'branch'};
 # Set all the branches.
-my $onlymine=(C4::Context->preference('IndependantBranches') &&
+my $onlymine=( ( C4::Context->preference('IndependantBranches') || C4::Context->preference('CalendarEditOnlyLoggedInBranch') ) &&
               C4::Context->userenv &&
               C4::Context->userenv->{flags} % 2 !=1  &&
               C4::Context->userenv->{branch}?1:0);
-- 
1.5.6.5




More information about the Koha-patches mailing list