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

(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-topissues.tmpl (-9 / +13 lines)
Lines 45-52 function Dopop(link) { Link Here
45
        at 
45
        at 
46
        <!-- TMPL_VAR name="branch" -->
46
        <!-- TMPL_VAR name="branch" -->
47
        <!-- /TMPL_IF -->
47
        <!-- /TMPL_IF -->
48
        <!-- TMPL_IF name="timeLimit" -->
48
        <!-- TMPL_IF name="timeLimitFinite" -->
49
        in the past <!-- TMPL_VAR name="timeLimit" --> months
49
        in the past <!-- TMPL_VAR name="timeLimitFinite" --> months
50
        <!-- TMPL_ELSE --> of all time<!-- /TMPL_IF -->
50
        <!-- TMPL_ELSE --> of all time<!-- /TMPL_IF -->
51
    </caption>
51
    </caption>
52
            <thead><tr>
52
            <thead><tr>
Lines 90-98 function Dopop(link) { Link Here
90
                <select name="branch" id="branch">
90
                <select name="branch" id="branch">
91
                <option value="">All branches</option>
91
                <option value="">All branches</option>
92
                <!-- TMPL_LOOP name="branchloop" -->
92
                <!-- TMPL_LOOP name="branchloop" -->
93
                    <!-- TMPL_IF EXPR="branch eq branchname" --><option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="value" -->"><!-- /TMPL_IF -->
93
                    <!-- TMPL_IF name="selected" -->
94
                        <!-- TMPL_VAR name="branchname" -->
94
                        <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="branchname" --></option>
95
                    </option>
95
                    <!-- TMPL_ELSE -->
96
                        <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="branchname" --></option>
97
                    <!-- /TMPL_IF -->
96
                <!-- /TMPL_LOOP -->
98
                <!-- /TMPL_LOOP -->
97
                </select>
99
                </select>
98
            </li>
100
            </li>
Lines 100-108 function Dopop(link) { Link Here
100
                    <select name="itemtype" id="itemtype">
102
                    <select name="itemtype" id="itemtype">
101
                        <option value="">All item types</option>
103
                        <option value="">All item types</option>
102
                       <!-- TMPL_LOOP name="itemtypeloop" -->
104
                       <!-- TMPL_LOOP name="itemtypeloop" -->
103
                            <!-- TMPL_IF EXPR="itemtype eq description" --><option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="value" -->"><!-- /TMPL_IF -->
105
                           <!-- TMPL_IF name="selected" -->
104
                                <!-- TMPL_VAR name="description" -->
106
                               <option value="<!-- TMPL_VAR name="value" -->" selected="selected"><!-- TMPL_VAR name="description" --></option>
105
                            </option>
107
                           <!-- TMPL_ELSE -->
108
                               <option value="<!-- TMPL_VAR name="value" -->"><!-- TMPL_VAR name="description" --></option>
109
                           <!-- /TMPL_IF -->
106
                        <!-- /TMPL_LOOP -->
110
                        <!-- /TMPL_LOOP -->
107
                    </select></li>
111
                    </select></li>
108
			<li>
112
			<li>
Lines 129-132 function Dopop(link) { Link Here
129
</div></div>
133
</div></div>
130
<!-- /TMPL_IF -->
134
<!-- /TMPL_IF -->
131
</div>
135
</div>
132
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
136
<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
(-)a/opac/opac-topissues.pl (-9 / +13 lines)
Lines 19-24 Link Here
19
# Suite 330, Boston, MA  02111-1307 USA
19
# Suite 330, Boston, MA  02111-1307 USA
20
20
21
use strict;
21
use strict;
22
use warnings;
23
22
use CGI;
24
use CGI;
23
use C4::Auth;
25
use C4::Auth;
24
use C4::Context;
26
use C4::Context;
Lines 52-65 my ($template, $borrowernumber, $cookie) Link Here
52
my $dbh = C4::Context->dbh;
54
my $dbh = C4::Context->dbh;
53
# Displaying results
55
# Displaying results
54
my $limit = $input->param('limit') || 10;
56
my $limit = $input->param('limit') || 10;
55
my $branch = $input->param('branch');
57
my $branch = $input->param('branch') || '';
56
my $itemtype = $input->param('itemtype');
58
my $itemtype = $input->param('itemtype') || '';
57
my $timeLimit = $input->param('timeLimit') || 3;
59
my $timeLimit = $input->param('timeLimit') || 3;
58
my $whereclause;
60
my $whereclause = '';
59
$whereclause .= 'items.homebranch='.$dbh->quote($branch)." AND " if ($branch);
61
$whereclause .= 'items.homebranch='.$dbh->quote($branch)." AND " if ($branch);
60
$whereclause .= 'biblioitems.itemtype='.$dbh->quote($itemtype)." AND " if $itemtype;
62
$whereclause .= 'biblioitems.itemtype='.$dbh->quote($itemtype)." AND " if $itemtype;
61
$whereclause .= ' TO_DAYS(NOW()) - TO_DAYS(biblio.datecreated) <= '.($timeLimit*30).' AND ' if $timeLimit < 999;
63
$whereclause .= ' TO_DAYS(NOW()) - TO_DAYS(biblio.datecreated) <= '.($timeLimit*30).' AND ' if $timeLimit < 999;
62
$whereclause =~ s/ AND $//;
64
$whereclause =~ s/ AND $// if $whereclause;
63
$whereclause = " WHERE ".$whereclause if $whereclause;
65
$whereclause = " WHERE ".$whereclause if $whereclause;
64
66
65
my $query = "SELECT datecreated, biblio.biblionumber, title, 
67
my $query = "SELECT datecreated, biblio.biblionumber, title, 
Lines 84-95 while (my $line= $sth->fetchrow_hashref) { Link Here
84
    push @results, $line;
86
    push @results, $line;
85
}
87
}
86
88
87
if($timeLimit eq 999){ $timeLimit = 0 };
89
my $timeLimitFinite = $timeLimit;
90
if($timeLimit eq 999){ $timeLimitFinite = 0 };
88
91
89
$template->param(do_it => 1,
92
$template->param(do_it => 1,
90
                limit => $limit,
93
                limit => $limit,
91
                branch => $branches->{$branch}->{branchname},
94
                branch => $branches->{$branch}->{branchname} || 'all locations',
92
                itemtype => $itemtypes->{$itemtype}->{description},
95
                itemtype => $itemtypes->{$itemtype}->{description} || 'item types',
93
                timeLimit => $timeLimit,
96
                timeLimit => $timeLimit,
94
                results_loop => \@results,
97
                results_loop => \@results,
95
                );
98
                );
Lines 100-108 $template->param( branchloop => GetBranchesLoop(C4::Context->userenv->{'branch'} Link Here
100
$itemtypes = GetItemTypes;
103
$itemtypes = GetItemTypes;
101
my @itemtypeloop;
104
my @itemtypeloop;
102
foreach my $thisitemtype (sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'}} keys %$itemtypes) {
105
foreach my $thisitemtype (sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'}} keys %$itemtypes) {
106
        my $selected = 1 if $thisitemtype eq $itemtype;
103
        my %row =(value => $thisitemtype,
107
        my %row =(value => $thisitemtype,
104
                    description => $itemtypes->{$thisitemtype}->{'description'},
108
                    description => $itemtypes->{$thisitemtype}->{'description'},
105
                        );
109
                    selected => $selected,
110
                 );
106
        push @itemtypeloop, \%row;
111
        push @itemtypeloop, \%row;
107
}
112
}
108
113
109
- 

Return to bug 2505