This patch removes the trailing .pl from the introduced svc scripts.
Also removes a leftover (wrong license text)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
exempt_fine: $("#exemptfine").is(':checked')
};
- $.post( "/cgi-bin/koha/svc/checkin.pl", params, function( data ) {
+ $.post( "/cgi-bin/koha/svc/checkin", params, function( data ) {
id = "#checkin_" + data.itemnumber;
content = "";
date_due: $("#newduedate").val()
};
- $.post( "/cgi-bin/koha/svc/renew.pl", params, function( data ) {
+ $.post( "/cgi-bin/koha/svc/renew", params, function( data ) {
var id = "#renew_" + data.itemnumber;
var content = "";
"bPaginate": false,
"bProcessing": true,
"bServerSide": false,
- "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl',
+ "sAjaxSource": '/cgi-bin/koha/svc/checkouts',
"fnServerData": function ( sSource, aoData, fnCallback ) {
aoData.push( { "name": "borrowernumber", "value": borrowernumber } );
"bPaginate": false,
"bProcessing": true,
"bServerSide": false,
- "sAjaxSource": '/cgi-bin/koha/svc/checkouts.pl',
+ "sAjaxSource": '/cgi-bin/koha/svc/checkouts',
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.each(relatives_borrowernumbers, function( index, value ) {
aoData.push( { "name": "borrowernumber", "value": value } );
--- /dev/null
+#!/usr/bin/perl
+
+# Copyright 2014 ByWater Solutions
+#
+# 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 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.
+
+use Modern::Perl;
+
+use CGI;
+use JSON qw(to_json);
+
+use C4::Circulation;
+use C4::Items qw(GetBarcodeFromItemnumber);
+use C4::Context;
+use C4::Auth qw(check_cookie_auth);
+
+my $input = new CGI;
+
+my ( $auth_status, $sessionID ) =
+ check_cookie_auth( $input->cookie('CGISESSID'),
+ { circulate => 'circulate_remaining_permissions' } );
+
+if ( $auth_status ne "ok" ) {
+ exit 0;
+}
+
+binmode STDOUT, ":encoding(UTF-8)";
+print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
+
+my $itemnumber = $input->param('itemnumber');
+my $borrowernumber = $input->param('borrowernumber');
+my $override_limit = $input->param('override_limit');
+my $exempt_fine = $input->param('exempt_fine');
+my $branchcode = $input->param('branchcode')
+ || C4::Context->userenv->{'branch'};
+
+my $barcode = GetBarcodeFromItemnumber($itemnumber);
+
+my $data;
+$data->{itemnumber} = $itemnumber;
+$data->{borrowernumber} = $borrowernumber;
+$data->{branchcode} = $branchcode;
+
+if ( C4::Context->preference("InProcessingToShelvingCart") ) {
+ my $item = GetItem($itemnumber);
+ if ( $item->{'location'} eq 'PROC' ) {
+ $item->{'location'} = 'CART';
+ ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
+ }
+}
+
+if ( C4::Context->preference("ReturnToShelvingCart") ) {
+ my $item = GetItem($itemnumber);
+ $item->{'location'} = 'CART';
+ ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
+}
+
+( $data->{returned} ) = AddReturn( $barcode, $branchcode, $exempt_fine );
+
+print to_json($data);
+++ /dev/null
-#!/usr/bin/perl
-
-# Copyright 2014 ByWater Solutions
-#
-# 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 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.
-
-use Modern::Perl;
-
-use CGI;
-use JSON qw(to_json);
-
-use C4::Circulation;
-use C4::Items qw(GetBarcodeFromItemnumber);
-use C4::Context;
-use C4::Auth qw(check_cookie_auth);
-
-my $input = new CGI;
-
-my ( $auth_status, $sessionID ) =
- check_cookie_auth( $input->cookie('CGISESSID'),
- { circulate => 'circulate_remaining_permissions' } );
-
-if ( $auth_status ne "ok" ) {
- exit 0;
-}
-
-binmode STDOUT, ":encoding(UTF-8)";
-print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
-
-my $itemnumber = $input->param('itemnumber');
-my $borrowernumber = $input->param('borrowernumber');
-my $override_limit = $input->param('override_limit');
-my $exempt_fine = $input->param('exempt_fine');
-my $branchcode = $input->param('branchcode')
- || C4::Context->userenv->{'branch'};
-
-my $barcode = GetBarcodeFromItemnumber($itemnumber);
-
-my $data;
-$data->{itemnumber} = $itemnumber;
-$data->{borrowernumber} = $borrowernumber;
-$data->{branchcode} = $branchcode;
-
-if ( C4::Context->preference("InProcessingToShelvingCart") ) {
- my $item = GetItem($itemnumber);
- if ( $item->{'location'} eq 'PROC' ) {
- $item->{'location'} = 'CART';
- ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
- }
-}
-
-if ( C4::Context->preference("ReturnToShelvingCart") ) {
- my $item = GetItem($itemnumber);
- $item->{'location'} = 'CART';
- ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
-}
-
-( $data->{returned} ) = AddReturn( $barcode, $branchcode, $exempt_fine );
-
-print to_json($data);
--- /dev/null
+#!/usr/bin/perl
+
+# Copyright 2014 ByWater Solutions
+#
+# 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 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.
+
+use strict;
+use warnings;
+
+use CGI;
+use JSON qw(to_json);
+
+use C4::Auth qw(check_cookie_auth);
+use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
+use C4::Circulation
+ qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate);
+use C4::Context;
+
+use Koha::DateUtils;
+
+my $input = new CGI;
+
+my ( $auth_status, $sessionID ) =
+ check_cookie_auth( $input->cookie('CGISESSID'),
+ { circulate => 'circulate_remaining_permissions' } );
+
+if ( $auth_status ne "ok" ) {
+ exit 0;
+}
+
+my @sort_columns = qw/date_due title itype issuedate branchcode itemcallnumber/;
+
+my @borrowernumber = $input->param('borrowernumber');
+my $offset = $input->param('iDisplayStart');
+my $results_per_page = $input->param('iDisplayLength') || -1;
+my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ]
+ || 'issuedate';
+my $sorting_direction = $input->param('sSortDir_0') eq 'asc' ? 'asc' : 'desc';
+
+$results_per_page = undef if ( $results_per_page == -1 );
+
+binmode STDOUT, ":encoding(UTF-8)";
+print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
+
+my @parameters;
+my $sql = '
+ SELECT
+ issuedate,
+ date_due,
+
+ biblionumber,
+ biblio.title,
+ author,
+
+ itemnumber,
+ barcode,
+ itemnotes,
+ itemcallnumber,
+ replacementprice,
+
+ issues.branchcode,
+ branchname,
+
+ itype,
+ itemtype,
+
+ borrowernumber,
+ surname,
+ firstname,
+ cardnumber,
+
+ DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today
+ FROM issues
+ LEFT JOIN items USING ( itemnumber )
+ LEFT JOIN biblio USING ( biblionumber )
+ LEFT JOIN biblioitems USING ( biblionumber )
+ LEFT JOIN borrowers USING ( borrowernumber )
+ LEFT JOIN branches ON ( issues.branchcode = branches.branchcode )
+ WHERE borrowernumber
+';
+
+if ( @borrowernumber == 1 ) {
+ $sql .= '= ?';
+}
+else {
+ $sql .= ' IN (' . join( ',', ('?') x @borrowernumber ) . ') ';
+}
+push( @parameters, @borrowernumber );
+
+$sql .= " ORDER BY $sorting_column $sorting_direction ";
+
+my $dbh = C4::Context->dbh();
+my $sth = $dbh->prepare($sql);
+$sth->execute(@parameters);
+
+my $item_level_itypes = C4::Context->preference('item-level_itypes');
+
+my @checkouts_today;
+my @checkouts_previous;
+while ( my $c = $sth->fetchrow_hashref() ) {
+ my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} );
+
+ my ( $can_renew, $can_renew_error ) =
+ CanBookBeRenewed( $c->{borrowernumber}, $c->{itemnumber} );
+ my $can_renew_date =
+ $can_renew_error eq 'too_soon'
+ ? output_pref(
+ {
+ dt => GetSoonestRenewDate( $c->{borrowernumber}, $c->{itemnumber} ),
+ as_due_date => 1
+ }
+ )
+ : undef;
+
+ my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
+ GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
+
+ my $checkout = {
+ DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber},
+ title => $c->{title},
+ author => $c->{author},
+ barcode => $c->{barcode},
+ itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype},
+ itemnotes => $c->{itemnotes},
+ branchcode => $c->{branchcode},
+ branchname => $c->{branchname},
+ itemcallnumber => $c->{itemcallnumber} || q{},
+ charge => $charge,
+ price => $c->{replacementprice} || q{},
+ can_renew => $can_renew,
+ can_renew_error => $can_renew_error,
+ can_renew_date => $can_renew_date,
+ itemnumber => $c->{itemnumber},
+ borrowernumber => $c->{borrowernumber},
+ biblionumber => $c->{biblionumber},
+ issuedate => $c->{issuedate},
+ date_due => $c->{date_due},
+ renewals_count => $renewals_count,
+ renewals_allowed => $renewals_allowed,
+ renewals_remaining => $renewals_remaining,
+ issuedate_formatted => output_pref(
+ {
+ dt => dt_from_string( $c->{issuedate} ),
+ as_due_date => 1
+ }
+ ),
+ date_due_formatted => output_pref(
+ {
+ dt => dt_from_string( $c->{date_due} ),
+ as_due_date => 1
+ }
+ ),
+ subtitle => GetRecordValue(
+ 'subtitle',
+ GetMarcBiblio( $c->{biblionumber} ),
+ GetFrameworkCode( $c->{biblionumber} )
+ ),
+ borrower => {
+ surname => $c->{surname},
+ firstname => $c->{firstname},
+ cardnumber => $c->{cardnumber},
+ },
+ issued_today => !$c->{not_issued_today},
+ };
+
+ if ( $c->{not_issued_today} ) {
+ push( @checkouts_previous, $checkout );
+ }
+ else {
+ push( @checkouts_today, $checkout );
+ }
+}
+
+@checkouts_today = reverse(@checkouts_today)
+ if ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' );
+@checkouts_previous = reverse(@checkouts_previous)
+ if ( C4::Context->preference('previousIssuesDefaultSortOrder') eq 'desc' );
+
+my @checkouts = ( @checkouts_today, @checkouts_previous );
+
+my $data;
+$data->{'iTotalRecords'} = scalar @checkouts;
+$data->{'iTotalDisplayRecords'} = scalar @checkouts;
+$data->{'sEcho'} = $input->param('sEcho') || undef;
+$data->{'aaData'} = \@checkouts;
+
+print to_json($data);
+++ /dev/null
-#!/usr/bin/perl
-
-# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
-
-# Copyright 2014 ByWater Solutions
-#
-# 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 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.
-
-use strict;
-use warnings;
-
-use CGI;
-use JSON qw(to_json);
-
-use C4::Auth qw(check_cookie_auth);
-use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
-use C4::Circulation
- qw(GetIssuingCharges CanBookBeRenewed GetRenewCount GetSoonestRenewDate);
-use C4::Context;
-
-use Koha::DateUtils;
-
-my $input = new CGI;
-
-my ( $auth_status, $sessionID ) =
- check_cookie_auth( $input->cookie('CGISESSID'),
- { circulate => 'circulate_remaining_permissions' } );
-
-if ( $auth_status ne "ok" ) {
- exit 0;
-}
-
-my @sort_columns = qw/date_due title itype issuedate branchcode itemcallnumber/;
-
-my @borrowernumber = $input->param('borrowernumber');
-my $offset = $input->param('iDisplayStart');
-my $results_per_page = $input->param('iDisplayLength') || -1;
-my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ]
- || 'issuedate';
-my $sorting_direction = $input->param('sSortDir_0') eq 'asc' ? 'asc' : 'desc';
-
-$results_per_page = undef if ( $results_per_page == -1 );
-
-binmode STDOUT, ":encoding(UTF-8)";
-print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
-
-my @parameters;
-my $sql = '
- SELECT
- issuedate,
- date_due,
-
- biblionumber,
- biblio.title,
- author,
-
- itemnumber,
- barcode,
- itemnotes,
- itemcallnumber,
- replacementprice,
-
- issues.branchcode,
- branchname,
-
- itype,
- itemtype,
-
- borrowernumber,
- surname,
- firstname,
- cardnumber,
-
- DATEDIFF( issuedate, CURRENT_DATE() ) AS not_issued_today
- FROM issues
- LEFT JOIN items USING ( itemnumber )
- LEFT JOIN biblio USING ( biblionumber )
- LEFT JOIN biblioitems USING ( biblionumber )
- LEFT JOIN borrowers USING ( borrowernumber )
- LEFT JOIN branches ON ( issues.branchcode = branches.branchcode )
- WHERE borrowernumber
-';
-
-if ( @borrowernumber == 1 ) {
- $sql .= '= ?';
-}
-else {
- $sql .= ' IN (' . join( ',', ('?') x @borrowernumber ) . ') ';
-}
-push( @parameters, @borrowernumber );
-
-$sql .= " ORDER BY $sorting_column $sorting_direction ";
-
-my $dbh = C4::Context->dbh();
-my $sth = $dbh->prepare($sql);
-$sth->execute(@parameters);
-
-my $item_level_itypes = C4::Context->preference('item-level_itypes');
-
-my @checkouts_today;
-my @checkouts_previous;
-while ( my $c = $sth->fetchrow_hashref() ) {
- my ($charge) = GetIssuingCharges( $c->{itemnumber}, $c->{borrowernumber} );
-
- my ( $can_renew, $can_renew_error ) =
- CanBookBeRenewed( $c->{borrowernumber}, $c->{itemnumber} );
- my $can_renew_date =
- $can_renew_error eq 'too_soon'
- ? output_pref(
- {
- dt => GetSoonestRenewDate( $c->{borrowernumber}, $c->{itemnumber} ),
- as_due_date => 1
- }
- )
- : undef;
-
- my ( $renewals_count, $renewals_allowed, $renewals_remaining ) =
- GetRenewCount( $c->{borrowernumber}, $c->{itemnumber} );
-
- my $checkout = {
- DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber},
- title => $c->{title},
- author => $c->{author},
- barcode => $c->{barcode},
- itemtype => $item_level_itypes ? $c->{itype} : $c->{itemtype},
- itemnotes => $c->{itemnotes},
- branchcode => $c->{branchcode},
- branchname => $c->{branchname},
- itemcallnumber => $c->{itemcallnumber} || q{},
- charge => $charge,
- price => $c->{replacementprice} || q{},
- can_renew => $can_renew,
- can_renew_error => $can_renew_error,
- can_renew_date => $can_renew_date,
- itemnumber => $c->{itemnumber},
- borrowernumber => $c->{borrowernumber},
- biblionumber => $c->{biblionumber},
- issuedate => $c->{issuedate},
- date_due => $c->{date_due},
- renewals_count => $renewals_count,
- renewals_allowed => $renewals_allowed,
- renewals_remaining => $renewals_remaining,
- issuedate_formatted => output_pref(
- {
- dt => dt_from_string( $c->{issuedate} ),
- as_due_date => 1
- }
- ),
- date_due_formatted => output_pref(
- {
- dt => dt_from_string( $c->{date_due} ),
- as_due_date => 1
- }
- ),
- subtitle => GetRecordValue(
- 'subtitle',
- GetMarcBiblio( $c->{biblionumber} ),
- GetFrameworkCode( $c->{biblionumber} )
- ),
- borrower => {
- surname => $c->{surname},
- firstname => $c->{firstname},
- cardnumber => $c->{cardnumber},
- },
- issued_today => !$c->{not_issued_today},
- };
-
- if ( $c->{not_issued_today} ) {
- push( @checkouts_previous, $checkout );
- }
- else {
- push( @checkouts_today, $checkout );
- }
-}
-
-@checkouts_today = reverse(@checkouts_today)
- if ( C4::Context->preference('todaysIssuesDefaultSortOrder') eq 'desc' );
-@checkouts_previous = reverse(@checkouts_previous)
- if ( C4::Context->preference('previousIssuesDefaultSortOrder') eq 'desc' );
-
-my @checkouts = ( @checkouts_today, @checkouts_previous );
-
-my $data;
-$data->{'iTotalRecords'} = scalar @checkouts;
-$data->{'iTotalDisplayRecords'} = scalar @checkouts;
-$data->{'sEcho'} = $input->param('sEcho') || undef;
-$data->{'aaData'} = \@checkouts;
-
-print to_json($data);
--- /dev/null
+#!/usr/bin/perl
+
+# Copyright 2014 ByWater Solutions
+#
+# 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 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.
+
+use Modern::Perl;
+
+use CGI;
+use JSON qw(to_json);
+
+use C4::Auth qw(check_cookie_auth);
+use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
+use C4::Branch qw(GetBranchName);
+use C4::Charset;
+use C4::Circulation qw(GetTransfers);
+use C4::Context;
+
+use Koha::Database;
+use Koha::DateUtils;
+
+my $input = new CGI;
+
+my ( $auth_status, $sessionID ) =
+ check_cookie_auth( $input->cookie('CGISESSID'),
+ { circulate => 'circulate_remaining_permissions' } );
+
+if ( $auth_status ne "ok" ) {
+ exit 0;
+}
+
+my $branch = C4::Context->userenv->{'branch'};
+
+my $schema = Koha::Database->new()->schema();
+
+my @sort_columns =
+ qw/reservedate title itemcallnumber barcode expirationdate priority/;
+
+my $borrowernumber = $input->param('borrowernumber');
+my $offset = $input->param('iDisplayStart');
+my $results_per_page = $input->param('iDisplayLength');
+my $sorting_direction = $input->param('sSortDir_0') || 'desc';
+my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ]
+ || 'reservedate';
+
+binmode STDOUT, ":encoding(UTF-8)";
+print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
+
+my $holds_rs = $schema->resultset('Reserve')->search(
+ { borrowernumber => $borrowernumber },
+ {
+ prefetch => { 'item' => 'biblio' },
+ order_by => { "-$sorting_direction" => $sorting_column }
+ }
+);
+
+my $borrower;
+my @holds;
+while ( my $h = $holds_rs->next() ) {
+ my $item = $h->item();
+
+ my $biblionumber = $h->biblio()->biblionumber();
+
+ my $hold = {
+ DT_RowId => $h->reserve_id(),
+ biblionumber => $biblionumber,
+ title => $h->biblio()->title(),
+ author => $h->biblio()->author(),
+ reserve_id => $h->reserve_id(),
+ reservedate => $h->reservedate(),
+ expirationdate => $h->expirationdate(),
+ suspend => $h->suspend(),
+ suspend_until => $h->suspend_until(),
+ found => $h->found(),
+ waiting => $h->found() eq 'W',
+ waiting_at => $h->branchcode()->branchname(),
+ waiting_here => $h->branchcode()->branchcode() eq $branch,
+ priority => $h->priority(),
+ subtitle => GetRecordValue(
+ 'subtitle', GetMarcBiblio($biblionumber),
+ GetFrameworkCode($biblionumber)
+ ),
+ reservedate_formatted => $h->reservedate() ? output_pref(
+ { dt => dt_from_string( $h->reservedate() ), dateonly => 1 }
+ )
+ : q{},
+ suspend_until_formatted => $h->suspend_until() ? output_pref(
+ { dt => dt_from_string( $h->suspend_until() ), dateonly => 1 }
+ )
+ : q{},
+ expirationdate_formatted => $h->expirationdate() ? output_pref(
+ { dt => dt_from_string( $h->expirationdate() ), dateonly => 1 }
+ )
+ : q{},
+ };
+
+ $hold->{transfered} = 0;
+ $hold->{not_transfered} = 0;
+
+ if ($item) {
+ $hold->{itemnumber} = $item->itemnumber();
+ $hold->{barcode} = $item->barcode();
+ $hold->{itemtype} = $item->effective_itemtype();
+ $hold->{itemcallnumber} = $item->itemcallnumber() || q{};
+
+ my ( $transferred_when, $transferred_from, $transferred_to ) =
+ GetTransfers( $item->itemnumber() );
+ if ($transferred_when) {
+ $hold->{color} = 'transferred';
+ $hold->{transferred} = 1;
+ $hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
+ $hold->{from_branch} = GetBranchName($transferred_from);
+ }
+ elsif ( $item->holdingbranch()->branchcode() ne
+ $h->branchcode()->branchcode() )
+ {
+ $hold->{not_transferred} = 1;
+ $hold->{not_transferred_by} = $h->branchcode()->branchname();
+ }
+ }
+
+ push( @holds, $hold );
+}
+
+my $data;
+$data->{'iTotalRecords'} = scalar @holds;
+$data->{'iTotalDisplayRecords'} = scalar @holds;
+$data->{'sEcho'} = $input->param('sEcho') || undef;
+$data->{'aaData'} = \@holds;
+
+print to_json($data);
+++ /dev/null
-#!/usr/bin/perl
-
-# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
-
-# Copyright 2014 ByWater Solutions
-#
-# 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 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.
-
-use Modern::Perl;
-
-use CGI;
-use JSON qw(to_json);
-
-use C4::Auth qw(check_cookie_auth);
-use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
-use C4::Branch qw(GetBranchName);
-use C4::Charset;
-use C4::Circulation qw(GetTransfers);
-use C4::Context;
-
-use Koha::Database;
-use Koha::DateUtils;
-
-my $input = new CGI;
-
-my ( $auth_status, $sessionID ) =
- check_cookie_auth( $input->cookie('CGISESSID'),
- { circulate => 'circulate_remaining_permissions' } );
-
-if ( $auth_status ne "ok" ) {
- exit 0;
-}
-
-my $branch = C4::Context->userenv->{'branch'};
-
-my $schema = Koha::Database->new()->schema();
-
-my @sort_columns =
- qw/reservedate title itemcallnumber barcode expirationdate priority/;
-
-my $borrowernumber = $input->param('borrowernumber');
-my $offset = $input->param('iDisplayStart');
-my $results_per_page = $input->param('iDisplayLength');
-my $sorting_direction = $input->param('sSortDir_0') || 'desc';
-my $sorting_column = $sort_columns[ $input->param('iSortCol_0') ]
- || 'reservedate';
-
-binmode STDOUT, ":encoding(UTF-8)";
-print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
-
-my $holds_rs = $schema->resultset('Reserve')->search(
- { borrowernumber => $borrowernumber },
- {
- prefetch => { 'item' => 'biblio' },
- order_by => { "-$sorting_direction" => $sorting_column }
- }
-);
-
-my $borrower;
-my @holds;
-while ( my $h = $holds_rs->next() ) {
- my $item = $h->item();
-
- my $biblionumber = $h->biblio()->biblionumber();
-
- my $hold = {
- DT_RowId => $h->reserve_id(),
- biblionumber => $biblionumber,
- title => $h->biblio()->title(),
- author => $h->biblio()->author(),
- reserve_id => $h->reserve_id(),
- reservedate => $h->reservedate(),
- expirationdate => $h->expirationdate(),
- suspend => $h->suspend(),
- suspend_until => $h->suspend_until(),
- found => $h->found(),
- waiting => $h->found() eq 'W',
- waiting_at => $h->branchcode()->branchname(),
- waiting_here => $h->branchcode()->branchcode() eq $branch,
- priority => $h->priority(),
- subtitle => GetRecordValue(
- 'subtitle', GetMarcBiblio($biblionumber),
- GetFrameworkCode($biblionumber)
- ),
- reservedate_formatted => $h->reservedate() ? output_pref(
- { dt => dt_from_string( $h->reservedate() ), dateonly => 1 }
- )
- : q{},
- suspend_until_formatted => $h->suspend_until() ? output_pref(
- { dt => dt_from_string( $h->suspend_until() ), dateonly => 1 }
- )
- : q{},
- expirationdate_formatted => $h->expirationdate() ? output_pref(
- { dt => dt_from_string( $h->expirationdate() ), dateonly => 1 }
- )
- : q{},
- };
-
- $hold->{transfered} = 0;
- $hold->{not_transfered} = 0;
-
- if ($item) {
- $hold->{itemnumber} = $item->itemnumber();
- $hold->{barcode} = $item->barcode();
- $hold->{itemtype} = $item->effective_itemtype();
- $hold->{itemcallnumber} = $item->itemcallnumber() || q{};
-
- my ( $transferred_when, $transferred_from, $transferred_to ) =
- GetTransfers( $item->itemnumber() );
- if ($transferred_when) {
- $hold->{color} = 'transferred';
- $hold->{transferred} = 1;
- $hold->{date_sent} = output_pref( dt_from_string($transferred_when) );
- $hold->{from_branch} = GetBranchName($transferred_from);
- }
- elsif ( $item->holdingbranch()->branchcode() ne
- $h->branchcode()->branchcode() )
- {
- $hold->{not_transferred} = 1;
- $hold->{not_transferred_by} = $h->branchcode()->branchname();
- }
- }
-
- push( @holds, $hold );
-}
-
-my $data;
-$data->{'iTotalRecords'} = scalar @holds;
-$data->{'iTotalDisplayRecords'} = scalar @holds;
-$data->{'sEcho'} = $input->param('sEcho') || undef;
-$data->{'aaData'} = \@holds;
-
-print to_json($data);
--- /dev/null
+#!/usr/bin/perl
+
+# Copyright 2014 ByWater Solutions
+#
+# 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 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.
+
+use Modern::Perl;
+
+use CGI;
+use JSON qw(to_json);
+
+use C4::Circulation;
+use C4::Context;
+use C4::Auth qw(check_cookie_auth);
+
+use Koha::DateUtils qw(output_pref dt_from_string);
+
+my $input = new CGI;
+
+my ( $auth_status, $sessionID ) =
+ check_cookie_auth( $input->cookie('CGISESSID'),
+ { circulate => 'circulate_remaining_permissions' } );
+
+if ( $auth_status ne "ok" ) {
+ exit 0;
+}
+
+binmode STDOUT, ":encoding(UTF-8)";
+print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
+
+my $itemnumber = $input->param('itemnumber');
+my $borrowernumber = $input->param('borrowernumber');
+my $override_limit = $input->param('override_limit');
+my $branchcode = $input->param('branchcode')
+ || C4::Context->userenv->{'branch'};
+my $date_due;
+if ( $input->param('date_due') ) {
+ $date_due = dt_from_string( $input->param('date_due') );
+ $date_due->set_hour(23);
+ $date_due->set_minute(59);
+}
+
+my $data;
+$data->{itemnumber} = $itemnumber;
+$data->{borrowernumber} = $borrowernumber;
+$data->{branchcode} = $branchcode;
+
+( $data->{renew_okay}, $data->{error} ) =
+ CanBookBeRenewed( $borrowernumber, $itemnumber, $override_limit );
+
+if ( $data->{renew_okay} ) {
+ $date_due = AddRenewal( $borrowernumber, $itemnumber, $branchcode, $date_due );
+ $data->{date_due} = output_pref( { dt => $date_due, as_due_date => 1 } );
+}
+
+print to_json($data);
+++ /dev/null
-#!/usr/bin/perl
-
-# Copyright 2014 ByWater Solutions
-#
-# 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 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.
-
-use Modern::Perl;
-
-use CGI;
-use JSON qw(to_json);
-
-use C4::Circulation;
-use C4::Context;
-use C4::Auth qw(check_cookie_auth);
-
-use Koha::DateUtils qw(output_pref dt_from_string);
-
-my $input = new CGI;
-
-my ( $auth_status, $sessionID ) =
- check_cookie_auth( $input->cookie('CGISESSID'),
- { circulate => 'circulate_remaining_permissions' } );
-
-if ( $auth_status ne "ok" ) {
- exit 0;
-}
-
-binmode STDOUT, ":encoding(UTF-8)";
-print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
-
-my $itemnumber = $input->param('itemnumber');
-my $borrowernumber = $input->param('borrowernumber');
-my $override_limit = $input->param('override_limit');
-my $branchcode = $input->param('branchcode')
- || C4::Context->userenv->{'branch'};
-my $date_due;
-if ( $input->param('date_due') ) {
- $date_due = dt_from_string( $input->param('date_due') );
- $date_due->set_hour(23);
- $date_due->set_minute(59);
-}
-
-my $data;
-$data->{itemnumber} = $itemnumber;
-$data->{borrowernumber} = $borrowernumber;
-$data->{branchcode} = $branchcode;
-
-( $data->{renew_okay}, $data->{error} ) =
- CanBookBeRenewed( $borrowernumber, $itemnumber, $override_limit );
-
-if ( $data->{renew_okay} ) {
- $date_due = AddRenewal( $borrowernumber, $itemnumber, $branchcode, $date_due );
- $data->{date_due} = output_pref( { dt => $date_due, as_due_date => 1 } );
-}
-
-print to_json($data);