Browse Source

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>
21.11/bug30761
Joonas Kylmälä 1 year ago
committed by Jonathan Druart
parent
commit
9ead068920
  1. 2
      circ/checkout-notes.pl
  2. 2
      circ/renew.pl
  3. 2
      misc/cronjobs/automatic_renewals.pl
  4. 4
      tools/batch_extend_due_dates.pl

2
circ/checkout-notes.pl

@ -56,7 +56,7 @@ if ( $action eq 'seen' ) {
}
}
my $notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'borrower', { item => 'biblionumber' } ] });
my $notes = Koha::Checkouts->search({ 'me.note' => { '!=', undef } }, { prefetch => [ 'patron', { item => 'biblionumber' } ] });
$template->param(
selected_count => scalar(@issue_ids),
action => $action,

2
circ/renew.pl

@ -63,7 +63,7 @@ if ($barcode) {
if ($issue) {
$borrower = $issue->borrower();
$borrower = $issue->patron();
if ( ( $borrower->debarred() || q{} ) lt dt_from_string()->ymd() ) {
my $can_renew;

2
misc/cronjobs/automatic_renewals.pl

@ -132,7 +132,7 @@ $verbose = 1 unless $verbose or $confirm;
print "Test run only\n" unless $confirm;
print "getting auto renewals\n" if $verbose;
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'borrower.autorenew_checkouts' => 1 },{ join => 'borrower'});
my $auto_renews = Koha::Checkouts->search({ auto_renew => 1, 'patron.autorenew_checkouts' => 1 },{ join => 'patron'});
print "found " . $auto_renews->count . " auto renewals\n" if $verbose;
my $renew_digest = {};

4
tools/batch_extend_due_dates.pl

@ -59,7 +59,7 @@ elsif ( $op eq 'list' ) {
my $dtf = Koha::Database->new->schema->storage->datetime_parser;
my $search_params;
if (@categorycodes) {
$search_params->{'borrower.categorycode'} = { -in => \@categorycodes };
$search_params->{'patron.categorycode'} = { -in => \@categorycodes };
}
if (@branchcodes) {
$search_params->{'me.branchcode'} = { -in => \@branchcodes };
@ -98,7 +98,7 @@ elsif ( $op eq 'list' ) {
my $checkouts = Koha::Checkouts->search(
$search_params,
{
join => [ 'item', 'borrower' ]
join => [ 'item', 'patron' ]
}
);

Loading…
Cancel
Save