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 147-154 Link Here
147
                                [% IF ( CAN_user_suggestions_suggestions_manage && pendingsuggestions ) %]
148
                                [% IF ( CAN_user_suggestions_suggestions_manage && pendingsuggestions ) %]
148
                                <div class="pending-info" id="suggestions_pending">
149
                                <div class="pending-info" id="suggestions_pending">
149
150
150
                                    <a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Suggestions pending approval</a>:
151
                                    Suggestions pending approval:
151
                                    <span class="pending-number-link">[% pendingsuggestions | html %]</span>
152
                                    <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=[% Branches.GetLoggedInBranchcode | url %]#ASKED">
153
                                    <span id="pendingsuggestions" class="pending-number-link">[% LoginBranchname | html %]: [% pendingsuggestions | html %]</span>
154
                                    </a>
155
                                    [% IF (all_pendingsuggestions > 0) %]
156
                                        /
157
                                        <a href="/cgi-bin/koha/suggestion/suggestion.pl?branchcode=__ANY__#ASKED">
158
                                            <span id="all_pendingsuggestions" class="pending-number-link">All libraries: [% all_pendingsuggestions | html %]</span>
159
                                        </a>
160
                                    [% END %]
152
                                </div>
161
                                </div>
153
                                [% END %]
162
                                [% END %]
154
163
(-)a/mainpage.pl (-4 / +18 lines)
Lines 25-37 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;
32
use Koha::Reviews;
31
use Koha::Reviews;
33
use Koha::ArticleRequests;
32
use Koha::ArticleRequests;
34
use Koha::ProblemReports;
33
use Koha::ProblemReports;
34
use Koha::Suggestions;
35
35
36
my $query = new CGI;
36
my $query = new CGI;
37
37
Lines 66-72 my $branch = Link Here
66
66
67
my $pendingcomments    = Koha::Reviews->search_limited({ approved => 0 })->count;
67
my $pendingcomments    = Koha::Reviews->search_limited({ approved => 0 })->count;
68
my $pendingtags        = get_count_by_tag_status(0);
68
my $pendingtags        = get_count_by_tag_status(0);
69
my $pendingsuggestions = CountSuggestion("ASKED");
69
70
# Get current branch count and total viewable count, if they don't match then pass
71
# both to template
72
73
if( C4::Context->only_my_library ){
74
    my $local_pendingsuggestions_count = Koha::Suggestions->search({ status => "ASKED", branchcode => C4::Context->userenv()->{'branch'} })->count();
75
    $template->param( pendingsuggestions => $local_pendingsuggestions_count );
76
} else {
77
    my $pendingsuggestions = Koha::Suggestions->search({ status => "ASKED" });
78
    my $local_pendingsuggestions_count = $pendingsuggestions->search({ 'me.branchcode' => C4::Context->userenv()->{'branch'} })->count();
79
    my $pendingsuggestions_count = $pendingsuggestions->count();
80
    $template->param(
81
        all_pendingsuggestions => $pendingsuggestions_count != $local_pendingsuggestions_count ? $pendingsuggestions_count : 0,
82
        pendingsuggestions => $local_pendingsuggestions_count
83
    );
84
}
85
70
my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count( $branch );
86
my $pending_borrower_modifications = Koha::Patron::Modifications->pending_count( $branch );
71
my $pending_discharge_requests = Koha::Patron::Discharge::count({ pending => 1 });
87
my $pending_discharge_requests = Koha::Patron::Discharge::count({ pending => 1 });
72
my $pending_article_requests = Koha::ArticleRequests->search_limited(
88
my $pending_article_requests = Koha::ArticleRequests->search_limited(
Lines 80-86 my $pending_problem_reports = Koha::ProblemReports->search({ status => 'New' }); Link Here
80
$template->param(
96
$template->param(
81
    pendingcomments                => $pendingcomments,
97
    pendingcomments                => $pendingcomments,
82
    pendingtags                    => $pendingtags,
98
    pendingtags                    => $pendingtags,
83
    pendingsuggestions             => $pendingsuggestions,
84
    pending_borrower_modifications => $pending_borrower_modifications,
99
    pending_borrower_modifications => $pending_borrower_modifications,
85
    pending_discharge_requests     => $pending_discharge_requests,
100
    pending_discharge_requests     => $pending_discharge_requests,
86
    pending_article_requests       => $pending_article_requests,
101
    pending_article_requests       => $pending_article_requests,
87
- 

Return to bug 25033