From 83e913f8c26a815019ffde21524cc7f126357d57 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 Signed-off-by: Kyle M Hall --- 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 253b08a10c..5a41942050 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{}; my $language = C4::Languages::getlanguage(); -- 2.39.5