From e4249bbd4b3593325532d5ae1fa819d0b22e58fd Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Wed, 12 Jun 2013 14:15:12 +0200 Subject: [PATCH] Bug 10449 - Suggestions pending approval should count only suggestions of current branch In intranet main page and acquisition home page, a text can display the number of suggestions pending for approval. When clicking on this like, the suggestions management page is displayed. In this page, by default, only the suggestions of current branch are visible. This patch modifies "Suggestions pending approval" count so that when clicking on link, you see the same count in "Pending" tab. Test plan : - Create pending suggestions in several branches - Connect with user in koha-conf.xml to have no selected branch (you see NO LIBRARY SET) - On main page, look at "Suggestions pending approval" - Click on this link - In suggestions management page, click on "Go" near "Status" => You see the same count in "Pending" tab - Come back to main page - Select a branch (with pending suggestions) - On main page, look at "Suggestions pending approval" - Click on this link => You see the same count in "Pending" tab --- C4/Suggestions.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index bf7878b..3c31867 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -364,7 +364,7 @@ sub GetSuggestionByStatus { &CountSuggestion($status) -Count the number of aqorders with the status given on input argument. +Count the number of aqorders of current branch and with the status given on input argument. the arg status can be : =over 2 @@ -408,8 +408,13 @@ sub CountSuggestion { FROM suggestions WHERE STATUS=? }; + my @params = ($status); + unless ($userenv->{branch} eq 'NO_LIBRARY_SET') { + $query .= q{ AND branchcode=? }; + push @params, $userenv->{branch}; + } $sth = $dbh->prepare($query); - $sth->execute($status); + $sth->execute(@params); } my ($result) = $sth->fetchrow; return $result; -- 1.7.10.4