From 28ecc1dd708735987840df9c72ee6c8e105d20ed Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 22 Jan 2015 09:06:31 -0500 Subject: [PATCH] Bug 11747 [QA Followup 2] - Use system preference to control behavior --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 11 +++++++++++ .../prog/en/modules/admin/preferences/admin.pref | 7 +++++++ tools/overduerules.pl | 9 +++++---- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 642de6b..f45b4e6 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -104,6 +104,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'), ('DefaultToLoggedInLibraryCircRules', '0', NULL , 'If enabled, circ rules editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), ('DefaultToLoggedInLibraryNoticesSlips', '0', NULL , 'If enabled,slips and notices editor will default to the logged in library''s rules, rather than the ''all libraries'' rules.', 'YesNo'), +('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo'), ('delimiter',';',';|tabulation|,|/|\\|#||','Define the default separator character for exporting reports','Choice'), ('Display856uAsImage','OFF','OFF|Details|Results|Both','Display the URI in the 856u field as an image, the corresponding Staff Client XSLT option must be on','Choice'), ('DisplayClearScreenButton','0','','If set to ON, a clear screen button will appear on the circulation page.','YesNo'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 62d7de3..4064ba7 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9684,6 +9684,17 @@ if(CheckVersion($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.19.00.XXX"; +if(CheckVersion($DBversion)) { + $dbh->do(q{ + INSERT INTO systempreferences ( variable, value, options, explanation, type ) + VALUES ('DefaultToLoggedInLibraryOverdueTriggers', '0', NULL , 'If enabled, overdue status triggers editor will default to the logged in library''s rules, rather than the ''default'' rules.', 'YesNo') + }); + + print "Upgrade to $DBversion done (Bug 13379 - Modify authorised_values.category to varchar(32))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref index dbf89ec..01786a9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -64,6 +64,13 @@ Administration: yes: "logged in library's" no: "all libraries" - notices and slips by default. + - + - When editing overdue notice/status triggers show the + - pref: DefaultToLoggedInLibraryOverdueTriggers + choices: + yes: "logged in library's" + no: "default" + - triggers by default. Login options: - - Automatically log out users after diff --git a/tools/overduerules.pl b/tools/overduerules.pl index 66c6801..098d711 100755 --- a/tools/overduerules.pl +++ b/tools/overduerules.pl @@ -61,7 +61,7 @@ sub blank_row { my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "tools/overduerules.tmpl", + template_name => "tools/overduerules.tt", query => $input, type => "intranet", authnotrequired => 0, @@ -73,9 +73,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $type = $input->param('type'); my $branch = - defined( $input->param('branch') ) ? $input->param('branch') - : GetBranchesCount() == 1 ? undef - : C4::Branch::mybranch(); + !C4::Context->preference('DefaultToLoggedInLibraryOverdueTriggers') ? $input->param('branch') + : defined( $input->param('branch') ) ? $input->param('branch') + : GetBranchesCount() == 1 ? undef + : C4::Branch::mybranch(); $branch = q{} if $branch eq 'NO_LIBRARY_SET'; $branch ||= q{}; -- 1.7.2.5