View | Details | Raw Unified | Return to bug 25033
Collapse All | Expand All

(-)a/acqui/acqui-home.pl (-3 / +15 lines)
Lines 35-43 use C4::Acquisition; Link Here
35
use C4::Budgets;
35
use C4::Budgets;
36
use C4::Members;
36
use C4::Members;
37
use C4::Debug;
37
use C4::Debug;
38
use C4::Suggestions;
39
use Koha::Acquisition::Currencies;
38
use Koha::Acquisition::Currencies;
40
use Koha::Patrons;
39
use Koha::Patrons;
40
use Koha::Suggestions;
41
41
42
my $query = CGI->new;
42
my $query = CGI->new;
43
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
43
my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user(
Lines 51-57 my ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( Link Here
51
);
51
);
52
52
53
my $status           = $query->param('status') || "ASKED";
53
my $status           = $query->param('status') || "ASKED";
54
my $suggestions_count       = CountSuggestion($status);
54
# Get current branch count and total viewable count, if they don't match then pass
55
# both to template
56
if( C4::Context->only_my_library ){
57
    my $local_pendingsuggestions_count = Koha::Suggestions->search({ status => "ASKED", branchcode => C4::Context->userenv()->{'branch'} })->count();
58
    $template->param( suggestions_count => $local_pendingsuggestions_count );
59
} else {
60
    my $pendingsuggestions = Koha::Suggestions->search({ status => "ASKED" });
61
    my $local_pendingsuggestions_count = $pendingsuggestions->search({ 'me.branchcode' => C4::Context->userenv()->{'branch'} })->count();
62
    my $pendingsuggestions_count = $pendingsuggestions->count();
63
    $template->param(
64
        all_pendingsuggestions => $pendingsuggestions_count != $local_pendingsuggestions_count ? $pendingsuggestions_count : 0,
65
        suggestions_count => $local_pendingsuggestions_count
66
    );
67
}
55
68
56
my $budget_arr = GetBudgetHierarchy;
69
my $budget_arr = GetBudgetHierarchy;
57
70
Lines 114-120 $template->param( Link Here
114
    totspent_active     => $totspent_active,
127
    totspent_active     => $totspent_active,
115
    totordered_active   => $totordered_active,
128
    totordered_active   => $totordered_active,
116
    totavail_active     => $totavail_active,
129
    totavail_active     => $totavail_active,
117
    suggestions_count   => $suggestions_count,
118
);
130
);
119
131
120
my $cur = Koha::Acquisition::Currencies->get_active;
132
my $cur = Koha::Acquisition::Currencies->get_active;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt (-1 / +12 lines)
Lines 54-60 Link Here
54
    <div id="acqui_acqui_home_suggestions">
54
    <div id="acqui_acqui_home_suggestions">
55
        <fieldset>
55
        <fieldset>
56
        <legend>Pending suggestions</legend>
56
        <legend>Pending suggestions</legend>
57
            <p>[% suggestions_count | html %] suggestions waiting. <a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Manage suggestions</a>.</p>
57
        <p>
58
            Manage suggestions:
59
            <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=[% Branches.GetLoggedInBranchcode | url %]#ASKED">
60
                <span id="pendingsuggestions" class="pending-number-link">[% LoginBranchname | html %]: [% suggestions_count | html %]</span>
61
            </a>
62
            [% IF (all_pendingsuggestions > 0) %]
63
                /
64
                <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=__ANY__#ASKED">
65
                    <span id="all_pendingsuggestions" class="pending-number-link">All libraries: [% all_pendingsuggestions | html %]</span>
66
                </a>
67
            [% END %]
68
        </p>
58
        </fieldset>
69
        </fieldset>
59
    </div>
70
    </div>
60
</div>
71
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt (-2 / +11 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE Branches %]
4
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% INCLUDE 'doc-head-open.inc' %]
6
<title>Koha staff client</title>
7
<title>Koha staff client</title>
Lines 155-162 Link Here
155
                                [% IF ( CAN_user_suggestions_suggestions_manage && pendingsuggestions ) %]
156
                                [% IF ( CAN_user_suggestions_suggestions_manage && pendingsuggestions ) %]
156
                                <div class="pending-info" id="suggestions_pending">
157
                                <div class="pending-info" id="suggestions_pending">
157
158
158
                                    <a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Suggestions pending approval</a>:
159
                                    Suggestions pending approval:
159
                                    <span class="pending-number-link">[% pendingsuggestions | html %]</span>
160
                                    <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=[% Branches.GetLoggedInBranchcode | url %]#ASKED">
161
                                    <span id="pendingsuggestions" class="pending-number-link">[% LoginBranchname | html %]: [% pendingsuggestions | html %]</span>
162
                                    </a>
163
                                    [% IF (all_pendingsuggestions > 0) %]
164
                                        /
165
                                        <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=__ANY__#ASKED">
166
                                            <span id="all_pendingsuggestions" class="pending-number-link">All libraries: [% all_pendingsuggestions | html %]</span>
167
                                        </a>
168
                                    [% END %]
160
                                </div>
169
                                </div>
161
                                [% END %]
170
                                [% END %]
162
171
(-)a/mainpage.pl (-4 / +18 lines)
Lines 25-31 use C4::Output; Link Here
25
use C4::Auth;
25
use C4::Auth;
26
use C4::Koha;
26
use C4::Koha;
27
use C4::NewsChannels; # GetNewsToDisplay
27
use C4::NewsChannels; # GetNewsToDisplay
28
use C4::Suggestions qw/CountSuggestion/;
29
use C4::Tags qw/get_count_by_tag_status/;
28
use C4::Tags qw/get_count_by_tag_status/;
30
use Koha::Patron::Modifications;
29
use Koha::Patron::Modifications;
31
use Koha::Patron::Discharge;
30
use Koha::Patron::Discharge;
Lines 33-38 use Koha::Reviews; Link Here
33
use Koha::ArticleRequests;
32
use Koha::ArticleRequests;
34
use Koha::ProblemReports;
33
use Koha::ProblemReports;
35
use Koha::Quotes;
34
use Koha::Quotes;
35
use Koha::Suggestions;
36
36
37
my $query = new CGI;
37
my $query = new CGI;
38
38
Lines 68-74 my $branch = Link Here
68
68
69
my $pendingcomments    = Koha::Reviews->search_limited({ approved => 0 })->count;
69
my $pendingcomments    = Koha::Reviews->search_limited({ approved => 0 })->count;
70
my $pendingtags        = get_count_by_tag_status(0);
70
my $pendingtags        = get_count_by_tag_status(0);
71
my $pendingsuggestions = CountSuggestion("ASKED");
71
72
# Get current branch count and total viewable count, if they don't match then pass
73
# both to template
74
75
if( C4::Context->only_my_library ){
76
    my $local_pendingsuggestions_count = Koha::Suggestions->search({ status => "ASKED", branchcode => C4::Context->userenv()->{'branch'} })->count();
77
    $template->param( pendingsuggestions => $local_pendingsuggestions_count );
78
} else {
79
    my $pendingsuggestions = Koha::Suggestions->search({ status => "ASKED" });
80
    my $local_pendingsuggestions_count = $pendingsuggestions->search({ 'me.branchcode' => C4::Context->userenv()->{'branch'} })->count();
81
    my $pendingsuggestions_count = $pendingsuggestions->count();
82
    $template->param(
83
        all_pendingsuggestions => $pendingsuggestions_count != $local_pendingsuggestions_count ? $pendingsuggestions_count : 0,
84
        pendingsuggestions => $local_pendingsuggestions_count
85
    );
86
}
87
72
my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count( $branch );
88
my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count( $branch );
73
my $pending_discharge_requests = Koha::Patron::Discharge::count({ pending => 1 });
89
my $pending_discharge_requests = Koha::Patron::Discharge::count({ pending => 1 });
74
my $pending_article_requests = Koha::ArticleRequests->search_limited(
90
my $pending_article_requests = Koha::ArticleRequests->search_limited(
Lines 82-88 my $pending_problem_reports = Koha::ProblemReports->search({ status => 'New' }); Link Here
82
$template->param(
98
$template->param(
83
    pendingcomments                => $pendingcomments,
99
    pendingcomments                => $pendingcomments,
84
    pendingtags                    => $pendingtags,
100
    pendingtags                    => $pendingtags,
85
    pendingsuggestions             => $pendingsuggestions,
86
    pending_borrower_modifications => $pending_borrower_modifications,
101
    pending_borrower_modifications => $pending_borrower_modifications,
87
    pending_discharge_requests     => $pending_discharge_requests,
102
    pending_discharge_requests     => $pending_discharge_requests,
88
    pending_article_requests       => $pending_article_requests,
103
    pending_article_requests       => $pending_article_requests,
89
- 

Return to bug 25033