Koha/circ/checkout-notes.pl
Joonas Kylmälä 9ead068920 Bug 29380: Correct table name in joins to prevent errors
The commit "Bug 29290: Rename relationships borrower =>
patron" (d46492ac23) renamed the relation for the borrowers table from
'borrower' to 'patron' but the joins were not updated accordingly so a
few scripts got broken.

To test:
 1) Notice that
    $ perl misc/cronjobs/automatic_renewals.pl -c -s -v
    returns 255 error code on exit
 2) Apply patch
 3) Notice the automatic_renewals.pl works now and exit code is 0
 4) Make sure /cgi-bin/koha/tools/batch_extend_due_dates.pl works.
 5) Try to grep for 'borrower' in Koha source code and see if there
    are any other join done using the Koha::Checkout or
    Koha::Old::Checkout objects.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 29380: (follow-up) Fix renewal feature in staff interface

The commit "Bug 29290: Rename relationships borrower =>
patron" (d46492ac23) renamed the relation for the borrowers table from
'borrower' to 'patron' but the usage in the renew.pl script was not
updated.

To test:
 1) Try to renew a book in intranet through the renewal tab
 2) Notice it gives error
 3) Apply patch
 4) Notice the error is now gone

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-11-03 15:40:52 +01:00

66 lines
2 KiB
Perl
Executable file

#!/usr/bin/perl
# Copyright 2016 Aleisha Amohia <aleisha@catalyst.net.nz>
#
# 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, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Context;
use C4::Output qw( output_html_with_http_headers );
use C4::Auth qw( get_template_and_user );
use Koha::Checkouts;
my $query = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "circ/checkout-notes.tt",
query => $query,
type => "intranet",
flagsrequired => { circulate => "manage_checkout_notes" },
}
);
my $action;
foreach (qw( seen notseen )) {
$action = $_ if ( $query->param("mark_selected-$_") );
}
$action ||= 'none';
my @issue_ids = $query->multi_param('issue_ids');
if ( $action eq 'seen' ) {
foreach my $issue_id ( @issue_ids ) {
my $issue = Koha::Checkouts->find($issue_id);
$issue->set({ noteseen => 1 })->store;
}
} elsif ( $action eq 'notseen' ) {
foreach my $issue_id ( @issue_ids ) {
my $issue = Koha::Checkouts->find($issue_id);
$issue->set({ noteseen => 0 })->store;
}
}
my $notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'patron', { item => 'biblionumber' } ] });
$template->param(
selected_count => scalar(@issue_ids),
action => $action,
notes => $notes,
);
output_html_with_http_headers $query, $cookie, $template->output;