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

(-)a/C4/HoldsQueue.pm (-23 / +39 lines)
Lines 135-169 sub GetHoldsQueueItems { Link Here
135
    my ($branchlimit) = @_;
135
    my ($branchlimit) = @_;
136
    my $dbh   = C4::Context->dbh;
136
    my $dbh   = C4::Context->dbh;
137
137
138
    my @bind_params = ();
138
    my $search_params;
139
    my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location,
140
                         items.enumchron, items.cn_sort, biblioitems.publishercode,
141
                         biblio.copyrightdate, biblio.subtitle, biblio.medium,
142
                         biblio.part_number, biblio.part_name,
143
                         biblioitems.publicationyear, biblioitems.pages, biblioitems.size,
144
                         biblioitems.isbn, biblioitems.editionstatement, items.copynumber
145
                  FROM tmp_holdsqueue
146
                       JOIN biblio      USING (biblionumber)
147
                  LEFT JOIN biblioitems USING (biblionumber)
148
                  LEFT JOIN items       USING (  itemnumber)
149
                /;
150
    if ($branchlimit) {
139
    if ($branchlimit) {
151
        $query .=" WHERE tmp_holdsqueue.holdingbranch = ?";
140
        $search_params->{'me.holdingbranch'} = $branchlimit;
152
        push @bind_params, $branchlimit;
153
    }
141
    }
154
    $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate";
142
155
    my $sth = $dbh->prepare($query);
143
    my $schema = Koha::Database->new->schema;
156
    $sth->execute(@bind_params);
144
    my $queue_rs = $schema->resultset('TmpHoldsqueue')->search(
145
        $search_params,
146
        {
147
            join => [ qw{ biblio biblioitem borrower item } ],
148
            order_by => [ qw{ ccode location cn_sort author title pickbranch reservedate } ]
149
        }
150
    );
151
157
    my $items = [];
152
    my $items = [];
158
    while ( my $row = $sth->fetchrow_hashref ){
153
    while ( my $r = $queue_rs->next ) {
159
        # return the bib-level or item-level itype per syspref
154
        my $result = { $r->get_columns };
160
        if (!C4::Context->preference('item-level_itypes')) {
155
        $result->{author}           = $r->biblio->author;
161
            $row->{itype} = $row->{itemtype};
156
        $result->{copyrightdate}    = $r->biblio->copyrightdate;
157
        $result->{medium}           = $r->biblio->medium;
158
        $result->{part_name}        = $r->biblio->part_name;
159
        $result->{part_number}      = $r->biblio->part_number;
160
        $result->{subittle}         = $r->biblio->subtitle;
161
        $result->{editionstatement} = $r->biblioitem->editionstatement;
162
        $result->{isbn}             = $r->biblioitem->isbn;
163
        $result->{pages}            = $r->biblioitem->pages;
164
        $result->{publicationyear}  = $r->biblioitem->publicationyear;
165
        $result->{publishercode}    = $r->biblioitem->publishercode;
166
        $result->{size}             = $r->biblioitem->size;
167
        $result->{ccode}            = $r->item->ccode;
168
        $result->{cn_sort}          = $r->item->cn_sort;
169
        $result->{copynumber}       = $r->item->copynumber;
170
        $result->{enumchron}        = $r->item->enumchron;
171
        $result->{itype}            = $r->item->itype;
172
        $result->{location}         = $r->item->location;
173
174
        if ( !C4::Context->preference('item-level_itypes') ) {
175
            $result->{itype} = $result->{itemtype};
162
        }
176
        }
163
        delete $row->{itemtype};
164
177
165
        push @$items, $row;
178
        $result->{patron} = Koha::Patron->_new_from_dbic( $r->borrower );
179
180
        push( @$items, $result );
166
    }
181
    }
182
167
    return $items;
183
    return $items;
168
}
184
}
169
185
(-)a/Koha/Schema/Result/TmpHoldsqueue.pm (-1 / +49 lines)
Lines 167-172 __PACKAGE__->belongs_to( Link Here
167
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-14 18:14:09
167
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-05-14 18:14:09
168
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tzgAgf+OVO+IncaTr7SZuQ
168
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tzgAgf+OVO+IncaTr7SZuQ
169
169
170
__PACKAGE__->belongs_to(
171
  "biblio",
172
  "Koha::Schema::Result::Biblio",
173
  { biblionumber => "biblionumber" },
174
  {
175
    is_deferrable => 1,
176
    join_type     => "LEFT",
177
    on_delete     => "CASCADE",
178
    on_update     => "CASCADE",
179
  },
180
);
181
182
__PACKAGE__->belongs_to(
183
  "biblioitem",
184
  "Koha::Schema::Result::Biblioitem",
185
  { biblionumber => "biblionumber" },
186
  {
187
    is_deferrable => 1,
188
    join_type     => "LEFT",
189
    on_delete     => "CASCADE",
190
    on_update     => "CASCADE",
191
  },
192
);
193
194
__PACKAGE__->belongs_to(
195
  "borrower",
196
  "Koha::Schema::Result::Borrower",
197
  { borrowernumber => "borrowernumber" },
198
  {
199
    is_deferrable => 1,
200
    join_type     => "LEFT",
201
    on_delete     => "CASCADE",
202
    on_update     => "CASCADE",
203
  },
204
);
205
206
__PACKAGE__->belongs_to(
207
  "item",
208
  "Koha::Schema::Result::Item",
209
  { itemnumber => "itemnumber" },
210
  {
211
    is_deferrable => 1,
212
    join_type     => "LEFT",
213
    on_delete     => "CASCADE",
214
    on_update     => "CASCADE",
215
  },
216
);
217
218
170
219
171
# You can replace this text with custom content, and it will be preserved on regeneration
172
1;
220
1;
(-)a/circ/view_holdsqueue.pl (-4 lines)
Lines 51-59 my $itemtypeslimit = $params->{'itemtypeslimit'}; Link Here
51
if ( $run_report ) {
51
if ( $run_report ) {
52
    # XXX GetHoldsQueueItems() does not support $itemtypeslimit!
52
    # XXX GetHoldsQueueItems() does not support $itemtypeslimit!
53
    my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit);
53
    my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit);
54
    for my $item ( @$items ) {
55
        $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} );
56
    }
57
    $template->param(
54
    $template->param(
58
        branchlimit     => $branchlimit,
55
        branchlimit     => $branchlimit,
59
        total      => scalar @$items,
56
        total      => scalar @$items,
60
- 

Return to bug 28966