@@ -, +, @@ --- admin/smart-rules.pl | 10 +++++++++- installer/data/mysql/sysprefs.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 15 +++++++++++++++ .../prog/en/modules/admin/preferences/admin.pref | 14 ++++++++++++++ tools/letter.pl | 13 +++++++------ 5 files changed, 47 insertions(+), 7 deletions(-) --- a/admin/smart-rules.pl +++ a/admin/smart-rules.pl @@ -43,8 +43,16 @@ my ($template, $loggedinuser, $cookie) }); my $type=$input->param('type'); -my $branch = $input->param('branch') || GetBranchesCount() == 1 ? undef : C4::Branch::mybranch(); + +my $branch; +if ( C4::Context->preference('DefaultToLoggedInLibraryCircRules') ) { + $branch = $input->param('branch') || GetBranchesCount() == 1 ? undef : C4::Branch::mybranch(); +} +else { + $branch = $input->param('branch') || ( C4::Branch::onlymine() ? ( C4::Branch::mybranch() || '*' ) : '*' ); +} $branch = '*' if $branch eq 'NO_LIBRARY_SET'; + my $op = $input->param('op') || q{}; if ($op eq 'delete') { --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -102,6 +102,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DefaultLongOverdueLostValue', NULL, NULL, "Set the LOST value of an item to n when the item has been overdue for more than defaultlongoverduedays days.", 'integer'), ('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), ('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'), ('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'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -9669,6 +9669,21 @@ 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 ( + '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' + ) + }); + + print "Upgrade to $DBversion done (Bug 13379 - Modify authorised_values.category to varchar(32))\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref @@ -50,6 +50,20 @@ Administration: yes: Allow no: "Don't allow" - staff and patrons to create and view saved lists of books. + - + - When editing circulation rules show the + - pref: DefaultToLoggedInLibraryCircRules + choices: + yes: "logged in library's" + no: "all libraries" + - rules by default. + - + - When editing notices and slips show the + - pref: DefaultToLoggedInLibraryNoticesSlips + choices: + yes: "logged in library's" + no: "all libraries" + - notices and slips by default. Login options: - - Automatically log out users after --- a/tools/letter.pl +++ a/tools/letter.pl @@ -78,13 +78,14 @@ my $module = $input->param('module'); my $content = $input->param('content'); my $op = $input->param('op') || ''; -# Default to logged in branch for notice list only +# Default to logged in branch for notice list only, if DefaultToLoggedInLibraryNoticesSlips is enabled our $branchcode = - $input->param('branchcode') eq '*' ? undef - : $input->param('branchcode') ? $input->param('branchcode') - : $op ? $input->param('branchcode') - : GetBranchesCount() == 1 ? undef - : C4::Branch::mybranch(); + !C4::Context->preference('DefaultToLoggedInLibraryNoticesSlips') ? $input->param('branchcode') + : $input->param('branchcode') eq '*' ? undef + : $input->param('branchcode') ? $input->param('branchcode') + : $op ? $input->param('branchcode') + : GetBranchesCount() == 1 ? undef + : C4::Branch::mybranch(); my $dbh = C4::Context->dbh; --