Lines 24-29
use C4::Auth;
Link Here
|
24 |
use C4::Output; |
24 |
use C4::Output; |
25 |
|
25 |
|
26 |
use Koha::Patrons; |
26 |
use Koha::Patrons; |
|
|
27 |
use Koha::Holds; |
28 |
use Koha::Old::Holds; |
27 |
|
29 |
|
28 |
my $query = CGI->new; |
30 |
my $query = CGI->new; |
29 |
my @all_holds; |
31 |
my @all_holds; |
Lines 42-51
my ( $template, $patron_id, $cookie ) = get_template_and_user(
Link Here
|
42 |
} |
44 |
} |
43 |
); |
45 |
); |
44 |
|
46 |
|
45 |
my $patron = Koha::Patrons->find( $patron_id ); |
47 |
my $patron = Koha::Patrons->find($patron_id); |
46 |
|
48 |
|
47 |
my $holds = $patron->holds; |
49 |
my $sort = $query->param('sort'); |
48 |
my $old_holds = $patron->old_holds; |
50 |
$sort = 'reservedate' unless $sort; |
|
|
51 |
|
52 |
my $unlimit = $query->param('unlimit'); |
53 |
my $ops = { |
54 |
prefetch => ['biblio', 'item'], |
55 |
order_by => $sort |
56 |
}; |
57 |
|
58 |
$ops->{rows} = 50 unless $unlimit; |
59 |
|
60 |
my $holds = Koha::Holds->search({ |
61 |
borrowernumber => $patron_id |
62 |
}, $ops); |
63 |
|
64 |
my $old_holds = Koha::Old::Holds->search({ |
65 |
borrowernumber => $patron_id |
66 |
}, $ops); |
49 |
|
67 |
|
50 |
while (my $hold = $holds->next) { |
68 |
while (my $hold = $holds->next) { |
51 |
push @all_holds, $hold; |
69 |
push @all_holds, $hold; |
Lines 55-73
while (my $hold = $old_holds->next) {
Link Here
|
55 |
push @all_holds, $hold; |
73 |
push @all_holds, $hold; |
56 |
} |
74 |
} |
57 |
|
75 |
|
58 |
my $sort = $query->param('sort'); |
|
|
59 |
|
60 |
$sort = 'reservedate' unless $sort; |
61 |
|
62 |
if($sort eq 'reservedate') { |
76 |
if($sort eq 'reservedate') { |
63 |
@all_holds = sort {$b->$sort cmp $a->$sort} @all_holds; |
77 |
@all_holds = sort {$b->$sort cmp $a->$sort} @all_holds; |
64 |
} else { |
78 |
} else { |
65 |
my ($obj, $col) = split /\./, $sort; |
79 |
my ($obj, $col) = split /\./, $sort; |
66 |
@all_holds = sort {$a->$obj->$col cmp $b->$obj->$col} @all_holds; |
80 |
@all_holds = sort { ( $a->$obj && $a->$obj->$col || '' ) cmp ( $b->$obj && $b->$obj->$col || '' ) } @all_holds; |
67 |
} |
81 |
} |
68 |
|
82 |
|
69 |
my $unlimit = $query->param('unlimit'); |
|
|
70 |
|
71 |
unless($unlimit) { |
83 |
unless($unlimit) { |
72 |
@all_holds = splice(@all_holds, 0, 50); |
84 |
@all_holds = splice(@all_holds, 0, 50); |
73 |
} |
85 |
} |
74 |
- |
|
|