#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use JSON qw(to_json);
use C4::Auth qw(check_cookie_auth);
-use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
use C4::Charset;
-use C4::Circulation qw(GetTransfers);
use C4::Context;
-use Koha::DateUtils;
+use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Holds;
use Koha::ItemTypes;
use Koha::Libraries;
-my $input = new CGI;
+my $input = CGI->new;
-my ( $auth_status, $sessionID ) =
+my ( $auth_status ) =
check_cookie_auth( $input->cookie('CGISESSID'),
{ circulate => 'circulate_remaining_permissions' } );
}
);
-my $borrower;
my @holds;
while ( my $h = $holds_rs->next() ) {
my $item = $h->item();
+ my $item_group = $h->item_group();
my $biblionumber = $h->biblio()->biblionumber();
+ my $desk_id = $h->desk_id;
+ my $desk_name = '';
+ if ($desk_id) {
+ $desk_name = $h->desk()->desk_name();
+ }
+
my $itemtype_limit;
if ( $h->itemtype ) {
my $itemtype = Koha::ItemTypes->find( $h->itemtype );
for my $library ( @$libraries ) {
$library->{selected} = 1 if $library->{branchcode} eq $h->branchcode();
}
+
+ my $biblio = $h->biblio();
+ my @subtitles = split(/ \| /, $biblio->subtitle() // '');
my $hold = {
DT_RowId => $h->reserve_id(),
biblionumber => $biblionumber,
- title => $h->biblio()->title(),
- author => $h->biblio()->author(),
+ title => $biblio->title(),
+ subtitle => \@subtitles,
+ medium => $biblio->medium() // '',
+ part_number => $biblio->part_number() // '',
+ part_name => $biblio->part_name() // '',
+ author => $biblio->author(),
reserve_id => $h->reserve_id(),
branchcode => $h->branch()->branchname(),
branches => $libraries,
+ desk_name => $desk_name,
reservedate => $h->reservedate(),
expirationdate => $h->expirationdate(),
suspend => $h->suspend(),
waiting_here => $h->branch()->branchcode() eq $branch,
priority => $h->priority(),
itemtype_limit => $itemtype_limit,
- subtitle => GetRecordValue(
- 'subtitle',
- GetMarcBiblio({ biblionumber => $biblionumber }),
- GetFrameworkCode($biblionumber)
- ),
reservedate_formatted => $h->reservedate() ? output_pref(
{ dt => dt_from_string( $h->reservedate() ), dateonly => 1 }
)
$hold->{itemnumber} = $item->itemnumber();
$hold->{barcode} = $item->barcode();
$hold->{itemtype} = $item->effective_itemtype();
+ $hold->{itemtype_description} = $item->itemtype->description;
+ $hold->{enumchron} = $item->enumchron();
$hold->{itemcallnumber} = $item->itemcallnumber() || q{};
- my ( $transferred_when, $transferred_from, $transferred_to ) =
- GetTransfers( $item->itemnumber() );
- if ($transferred_when) {
+ my $transfer = $item->get_transfer;
+ if ( $transfer && $transfer->in_transit ) {
$hold->{color} = 'transferred';
$hold->{transferred} = 1;
- $hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
- $hold->{from_branch} = Koha::Libraries->find($transferred_from)->branchname;
+ $hold->{date_sent} = output_pref({ dt => dt_from_string($transfer->datesent) });
+ $hold->{from_branch} = Koha::Libraries->find($transfer->frombranch)->branchname;
}
elsif ( $item->holding_branch() && $item->holding_branch()->branchcode() ne
$h->branch()->branchcode() )
}
}
+ if ($item_group) {
+ $hold->{item_group_id} = $item_group->id;
+ $hold->{item_group_description} = $item_group->description;
+ }
+
push( @holds, $hold );
}