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

(-)a/recalls/recalls_to_pull.pl (-15 / +9 lines)
Lines 18-23 Link Here
18
18
19
use Modern::Perl;
19
use Modern::Perl;
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use List::MoreUtils qw( uniq );
22
21
use C4::Auth qw( get_template_and_user );
23
use C4::Auth qw( get_template_and_user );
22
use C4::Output qw( output_html_with_http_headers );
24
use C4::Output qw( output_html_with_http_headers );
23
use Koha::BiblioFrameworks;
25
use Koha::BiblioFrameworks;
Lines 60-66 if ( $op eq 'list' ) { Link Here
60
            my $biblio = Koha::Biblios->find($recall->biblio_id);
62
            my $biblio = Koha::Biblios->find($recall->biblio_id);
61
            my @this_bib_recalls = Koha::Recalls->search({ biblio_id => $recall->biblio_id, status => [ 'requested','overdue','in_transit' ] }, { order_by => { -asc => 'created_date' } })->as_list;
63
            my @this_bib_recalls = Koha::Recalls->search({ biblio_id => $recall->biblio_id, status => [ 'requested','overdue','in_transit' ] }, { order_by => { -asc => 'created_date' } })->as_list;
62
            my $recalls_count = scalar @this_bib_recalls;
64
            my $recalls_count = scalar @this_bib_recalls;
63
            my @unique_patrons = do { my %seen; grep { !$seen{$_->patron_id}++ } @this_bib_recalls };
65
            my @unique_patrons = uniq @this_bib_recalls ;
64
            my $patrons_count = scalar @unique_patrons;
66
            my $patrons_count = scalar @unique_patrons;
65
            my $first_recall = $this_bib_recalls[0];
67
            my $first_recall = $this_bib_recalls[0];
66
68
Lines 90-102 if ( $op eq 'list' ) { Link Here
90
            # don't push data if there are no items available for this recall
92
            # don't push data if there are no items available for this recall
91
93
92
                # get unique values
94
                # get unique values
93
                my @unique_callnumbers = do { my %seen; grep { !$seen{$_}++ } @callnumbers };
94
                my @unique_copynumbers = do { my %seen; grep { !$seen{$_}++ } @copynumbers };
95
                my @unique_enumchrons = do { my %seen; grep { !$seen{$_}++ } @enumchrons };
96
                my @unique_itemtypes = do { my %seen; grep { !$seen{$_}++ } @itemtypes };
97
                my @unique_locations = do { my %seen; grep { !$seen{$_}++ } @locations };
98
                my @unique_libraries = do { my %seen; grep { !$seen{$_}++ } @libraries };
99
100
                push( @pull_list, {
95
                push( @pull_list, {
101
                    biblio => $recall->biblio,
96
                    biblio => $recall->biblio,
102
                    items_count => $items_count,
97
                    items_count => $items_count,
Lines 104-115 if ( $op eq 'list' ) { Link Here
104
                    patrons_count => $patrons_count,
99
                    patrons_count => $patrons_count,
105
                    pull_count => $items_count <= $recalls_count ? $items_count : $recalls_count,
100
                    pull_count => $items_count <= $recalls_count ? $items_count : $recalls_count,
106
                    first_recall => $first_recall,
101
                    first_recall => $first_recall,
107
                    callnumbers => \@unique_callnumbers,
102
                    callnumbers   => [ uniq @callnumbers ],
108
                    copynumbers => \@unique_copynumbers,
103
                      copynumbers => [ uniq @copynumbers ],
109
                    enumchrons => \@unique_enumchrons,
104
                      enumchrons  => [ uniq @enumchrons ],
110
                    itemtypes => \@unique_itemtypes,
105
                      itemtypes   => [ uniq @itemtypes ],
111
                    locations => \@unique_locations,
106
                      locations   => [ uniq @locations ],
112
                    libraries => \@unique_libraries,
107
                      libraries   => [ uniq @libraries ],
113
                });
108
                });
114
            }
109
            }
115
        }
110
        }
116
- 

Return to bug 30877