Bug 19532: (follow-up) Fix calls, tests, syspref settings, checks

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Aleisha Amohia 2021-10-14 16:54:36 +13:00 committed by Fridolin Somers
parent 4d6c7cdb1a
commit a8929cbcdb
14 changed files with 27 additions and 20 deletions

View file

@ -358,7 +358,8 @@ sub buildKohaItemsNamespace {
if ( $recalls->count ) {
# recalls take priority over holds
$status = 'Waiting';
$status = 'other';
$substatus = 'Recall waiting';
}
elsif ( $item->has_pending_hold ) {
$status = 'other';
@ -366,7 +367,7 @@ sub buildKohaItemsNamespace {
}
elsif ( $item->holds->waiting->count ) {
$status = 'other';
$substatus = 'Waiting';
$substatus = 'Hold waiting';
}
elsif ($item->get_transfer) {
$status = 'other';

View file

@ -1171,7 +1171,11 @@ Return all active recalls attached to this biblio, sorted by oldest first
=cut
sub recalls {
my ( $self ) = @_;
my ( $self, $params ) = @_;
if ( $params->{borrowernumber} ) {
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef, borrowernumber => $params->{borrowernumber} }, { order_by => { -asc => 'recalldate' } });
return @recalls_rs;
}
my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } });
return @recalls_rs;
}
@ -1204,7 +1208,9 @@ sub can_be_recalled {
my @itemtypes;
my @itemnumbers;
my @items;
my @all_itemnumbers;
foreach my $item ( @all_items ) {
push( @all_itemnumbers, $item->itemnumber );
if ( $item->can_be_recalled({ patron => $patron }) ) {
push( @itemtypes, $item->effective_itemtype );
push( @itemnumbers, $item->itemnumber );
@ -1251,7 +1257,7 @@ sub can_be_recalled {
return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record );
# check if any of the items under this biblio are already checked out by this borrower
return 0 if ( Koha::Checkouts->search({ itemnumber => [ @itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 );
return 0 if ( Koha::Checkouts->search({ itemnumber => [ @all_itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 );
}
# check item availability

View file

@ -20,7 +20,7 @@ package Koha::Recall;
use Modern::Perl;
use Koha::Database;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
use Koha::Patron;
use Koha::Biblio;
use Koha::Item;

View file

@ -21,7 +21,7 @@ use Modern::Perl;
use Koha::Database;
use Koha::Recall;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
use C4::Stats qw( UpdateStats );

View file

@ -43,7 +43,7 @@
[% UNLESS specific_patron %]
<td class="recall-patron">
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.borrowernumber | uri %]">[% recall.patron.firstname | html %] [% recall.patron.surname | html %] ([% recall.patron.cardnumber | html %])</a>
[% INCLUDE 'patron-title.inc' patron=recall.patron hide_patron_infos_if_needed=1 link_to="circulation_recalls" %]
</td>
[% END %]

View file

@ -1281,6 +1281,6 @@ Circulation:
-
- pref: UseRecalls
choices:
yes: Use
no: "Don't use"
1: Use
0: "Don't use"
- recalls. Make sure you configure <a href="/cgi-bin/koha/admin/smart-rules.pl">circulation and fines rules</a> for recalls once enabled.

View file

@ -111,8 +111,8 @@ Logging:
-
- pref: RecallsLog
choices:
on: Log
off: "Don't log"
1: Log
0: "Don't log"
- any actions on recalls (create, cancel, expire, fulfill).
Debugging:

View file

@ -31,7 +31,7 @@ BEGIN {
# - recalls that have been awaiting pickup for longer than the specified recall_shelf_time circulation rule, or the RecallsMaxPickUpDelay if circ rule is unset
use Koha::Script -cron;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
use Koha::Recalls;
use C4::Log;

View file

@ -46,7 +46,7 @@ if ( C4::Context->preference('UseRecalls') ) {
my $items = Koha::Items->search({ biblionumber => $biblionumber });
# check if already recalled
my $recalled = scalar $biblio->recalls;
my $recalled = scalar $biblio->recalls({ borrowernumber => $borrowernumber });
if ( defined $recalled and $recalled > 0 ) {
my $recalls_per_record = Koha::CirculationRules->get_effective_rule({
categorycode => $patron->categorycode,

View file

@ -22,7 +22,7 @@ use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use Koha::Recalls;
use Koha::BiblioFrameworks;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
use Koha::Patrons;
my $query = CGI->new;

View file

@ -18,8 +18,8 @@
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Output;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::Search;
use Koha::Recalls;
use Koha::Biblios;

View file

@ -21,7 +21,7 @@ use Test::More tests => 27;
use t::lib::TestBuilder;
use t::lib::Mocks;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
BEGIN {
require_ok('Koha::Recall');

View file

@ -21,7 +21,7 @@ use Test::More tests => 19;
use t::lib::TestBuilder;
use t::lib::Mocks;
use Koha::DateUtils;
use Koha::DateUtils qw( dt_from_string );
BEGIN {
require_ok('Koha::Recall');

View file

@ -131,7 +131,7 @@ subtest 'buildKohaItemsNamespace status tests' => sub {
}
});
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
like($xml,qr{<substatus>Waiting</substatus>},"Waiting status takes precedence over In transit (holds)");
like($xml,qr{<substatus>Hold waiting</substatus>},"Waiting status takes precedence over In transit (holds)");
$hold->cancel;
$builder->build({ source => "TmpHoldsqueue", value => {
@ -151,7 +151,7 @@ subtest 'buildKohaItemsNamespace status tests' => sub {
}});
$recall->set_waiting;
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
like($xml,qr{<status>Waiting</status>},"Waiting status takes precedence over In transit (recalls)");
like($xml,qr{<substatus>Recall waiting</substatus>},"Waiting status takes precedence over In transit (recalls)");
};