|
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 |
- |
|
|