From d9d79fbd3752b3e2d09569dc3b15049142779653 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 21 Apr 2015 11:03:27 -0400 Subject: [PATCH] Bug 11625 - Implement DefaultToLoggedInLibraryCircRules This patch set makes the default circ rules and notices/slips to edit the logged in branch, if one is set. Test Plan: 1) Apply this patch 2) Log into staff side, and set your library 3) Browse to Administration/Circulation and fines rules 4) Note the rule set selected is for your library 5) Select "All libraries" 6) Note the rule set selected is for "All libraries" 7) Browse to Toos/Notices & slips 8) Note the notice set selected is for your library 9) Select "All libraries" 10) Not the rule set selected is for "All libraries" 11) Click "New Notice" 12) Note the Library field is set to "All libraries" Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Passes QA script and tests. --- admin/smart-rules.pl | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 9ef6ef6..0851014 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -44,7 +44,16 @@ my ($template, $loggedinuser, $cookie) }); my $type=$input->param('type'); -my $branch = $input->param('branch') || ( C4::Branch::onlymine() ? ( 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') { -- 1.7.2.5