From 4ccd994d3041b17fafdde453e60c410ccd8f67f5 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. Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart --- admin/smart-rules.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index bedaef3..332c94b 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') { -- 2.1.0