=head2 CanBookBeIssued
- ( $issuingimpossible, $needsconfirmation, [ $alerts ] ) = CanBookBeIssued( $borrower,
+ ( $issuingimpossible, $needsconfirmation, [ $alerts ] ) = CanBookBeIssued( $patron,
$barcode, $duedate, $inprocess, $ignore_reserves, $params );
Check if a book can be issued.
=over 4
-=item C<$borrower> hash with borrower informations (from Koha::Patron->unblessed)
+=item C<$patron> is a Koha::Patron
=item C<$barcode> is the bar code of the book being issued.
=cut
sub CanBookBeIssued {
- my ( $borrower, $barcode, $duedate, $inprocess, $ignore_reserves, $params ) = @_;
+ my ( $patron, $barcode, $duedate, $inprocess, $ignore_reserves, $params ) = @_;
my %needsconfirmation; # filled with problems that needs confirmations
my %issuingimpossible; # filled with problems that causes the issue to be IMPOSSIBLE
my %alerts; # filled with messages that shouldn't stop issuing, but the librarian should be aware of.
my $biblioitem = GetBiblioItemData($item->{biblioitemnumber});
$item->{'itemtype'}=$item->{'itype'};
my $dbh = C4::Context->dbh;
+ my $patron_unblessed = $patron->unblessed;
# MANDATORY CHECKS - unless item exists, nothing else matters
unless ( $item->{barcode} ) {
unless ( $duedate ) {
my $issuedate = $now->clone();
- my $branch = _GetCircControlBranch($item,$borrower);
+ my $branch = _GetCircControlBranch($item, $patron_unblessed);
my $itype = ( C4::Context->preference('item-level_itypes') ) ? $item->{'itype'} : $biblioitem->{'itemtype'};
- $duedate = CalcDateDue( $issuedate, $itype, $branch, $borrower );
+ $duedate = CalcDateDue( $issuedate, $itype, $branch, $patron_unblessed );
# Offline circ calls AddIssue directly, doesn't run through here
# So issuingimpossible should be ok.
#
# BORROWER STATUS
#
- my $patron = Koha::Patrons->find( $borrower->{borrowernumber} );
if ( $patron->category->category_type eq 'X' && ( $item->{barcode} )) {
# stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1 .
&UpdateStats({
type => 'localuse',
itemnumber => $item->{'itemnumber'},
itemtype => $item->{'itype'},
- borrowernumber => $borrower->{'borrowernumber'},
+ borrowernumber => $patron->borrowernumber,
ccode => $item->{'ccode'}}
);
ModDateLastSeen( $item->{'itemnumber'} );
return( { STATS => 1 }, {});
}
- my $flags = C4::Members::patronflags( $borrower );
+ my $flags = C4::Members::patronflags( $patron_unblessed );
if ( ref $flags ) {
if ( $flags->{GNA} ) {
$issuingimpossible{GNA} = 1;
$issuingimpossible{DEBARRED} = 1;
}
}
- if ( !defined $borrower->{dateexpiry} || $borrower->{'dateexpiry'} eq '0000-00-00') {
+ if ( !defined $patron->dateexpiry || $patron->dateexpiry eq '0000-00-00') {
$issuingimpossible{EXPIRED} = 1;
} else {
- my $expiry_dt = dt_from_string( $borrower->{dateexpiry}, 'sql', 'floating' );
+ my $expiry_dt = dt_from_string( $patron->dateexpiry, 'sql', 'floating' );
$expiry_dt->truncate( to => 'day');
my $today = $now->clone()->truncate(to => 'day');
$today->set_time_zone( 'floating' );
# DEBTS
my ($balance, $non_issue_charges, $other_charges) =
- C4::Members::GetMemberAccountBalance( $borrower->{'borrowernumber'} );
+ C4::Members::GetMemberAccountBalance( $patron->borrowernumber );
my $amountlimit = C4::Context->preference("noissuescharge");
my $allowfineoverride = C4::Context->preference("AllowFineOverride");
my $no_issues_charge_guarantees = C4::Context->preference("NoIssuesChargeGuarantees");
$no_issues_charge_guarantees = undef unless looks_like_number( $no_issues_charge_guarantees );
if ( defined $no_issues_charge_guarantees ) {
- my $p = Koha::Patrons->find( $borrower->{borrowernumber} );
- my @guarantees = $p->guarantees();
+ my @guarantees = $patron->guarantees();
my $guarantees_non_issues_charges;
foreach my $g ( @guarantees ) {
my ( $b, $n, $o ) = C4::Members::GetMemberAccountBalance( $g->id );
$alerts{OTHER_CHARGES} = sprintf( "%.2f", $other_charges );
}
- $patron = Koha::Patrons->find( $borrower->{borrowernumber} );
+ $patron = Koha::Patrons->find( $patron->borrowernumber ); # FIXME Refetch just in case, to avoid regressions. But must not be needed
if ( my $debarred_date = $patron->is_debarred ) {
# patron has accrued fine days or has a restriction. $count is a date
if ($debarred_date eq '9999-12-31') {
#
# CHECK IF BOOK ALREADY ISSUED TO THIS BORROWER
#
- if ( $issue && $issue->borrowernumber eq $borrower->{'borrowernumber'} ){
+ if ( $issue && $issue->borrowernumber eq $patron->borrowernumber ){
# Already issued to current borrower.
# If it is an on-site checkout if it can be switched to a normal checkout
$messages{ONSITE_CHECKOUT_WILL_BE_SWITCHED} = 1;
} else {
my ($CanBookBeRenewed,$renewerror) = CanBookBeRenewed(
- $borrower->{'borrowernumber'},
+ $patron->borrowernumber,
$item->{'itemnumber'},
);
if ( $CanBookBeRenewed == 0 ) { # no more renewals allowed
C4::Context->preference('SwitchOnSiteCheckouts')
and $issue
and $issue->onsite_checkout
- and $issue->borrowernumber == $borrower->{'borrowernumber'} ? 1 : 0 );
- my $toomany = TooMany( $borrower, $item->{biblionumber}, $item, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } );
+ and $issue->borrowernumber == $patron->borrowernumber ? 1 : 0 );
+ my $toomany = TooMany( $patron_unblessed, $item->{biblionumber}, $item, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } );
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book
if ( $toomany && not exists $needsconfirmation{RENEW_ISSUE} ) {
if ( $toomany->{max_allowed} == 0 ) {
#
# CHECKPREVCHECKOUT: CHECK IF ITEM HAS EVER BEEN LENT TO PATRON
#
- $patron = Koha::Patrons->find($borrower->{borrowernumber});
+ $patron = Koha::Patrons->find( $patron->borrowernumber ); # FIXME Refetch just in case, to avoid regressions. But must not be needed
my $wants_check = $patron->wants_check_for_previous_checkout;
$needsconfirmation{PREVISSUE} = 1
if ($wants_check and $patron->do_check_for_previous_checkout($item));
$issuingimpossible{ITEMNOTSAMEBRANCH} = 1;
$issuingimpossible{'itemhomebranch'} = $item->{C4::Context->preference("HomeOrHoldingBranch")};
}
- $needsconfirmation{BORRNOTSAMEBRANCH} = $borrower->{'branchcode'}
- if ( $borrower->{'branchcode'} ne $userenv->{branch} );
+ $needsconfirmation{BORRNOTSAMEBRANCH} = $patron->branchcode
+ if ( $patron->branchcode ne $userenv->{branch} );
}
}
#
my $rentalConfirmation = C4::Context->preference("RentalFeesCheckoutConfirmation");
if ( $rentalConfirmation ){
- my ($rentalCharge) = GetIssuingCharges( $item->{'itemnumber'}, $borrower->{'borrowernumber'} );
+ my ($rentalCharge) = GetIssuingCharges( $item->{'itemnumber'}, $patron->borrowernumber );
if ( $rentalCharge > 0 ){
$needsconfirmation{RENTALCHARGE} = $rentalCharge;
}
my ( $restype, $res ) = C4::Reserves::CheckReserves( $item->{'itemnumber'} );
if ($restype) {
my $resbor = $res->{'borrowernumber'};
- if ( $resbor ne $borrower->{'borrowernumber'} ) {
+ if ( $resbor ne $patron->borrowernumber ) {
my $patron = Koha::Patrons->find( $resbor );
if ( $restype eq "Waiting" )
{
## CHECK AGE RESTRICTION
my $agerestriction = $biblioitem->{'agerestriction'};
- my ($restriction_age, $daysToAgeRestriction) = GetAgeRestriction( $agerestriction, $borrower );
+ my ($restriction_age, $daysToAgeRestriction) = GetAgeRestriction( $agerestriction, $patron->unblessed );
if ( $daysToAgeRestriction && $daysToAgeRestriction > 0 ) {
if ( C4::Context->preference('AgeRestrictionOverride') ) {
$needsconfirmation{AGE_RESTRICTION} = "$agerestriction";
## check for high holds decreasing loan period
if ( C4::Context->preference('decreaseLoanHighHolds') ) {
- my $check = checkHighHolds( $item, $borrower );
+ my $check = checkHighHolds( $item, $patron_unblessed );
if ( $check->{exceeded} ) {
if ($override_high_holds) {
require C4::Serials;
my $is_a_subscription = C4::Serials::CountSubscriptionFromBiblionumber($biblionumber);
unless ($is_a_subscription) {
+ # FIXME Should be $patron->checkouts($args);
my $checkouts = Koha::Checkouts->search(
{
- borrowernumber => $borrower->{borrowernumber},
+ borrowernumber => $patron->borrowernumber,
biblionumber => $biblionumber,
},
{
my $barcode = $item->{'barcode'} || '';
$barcode = barcodedecode($barcode) if ( $barcode && C4::Context->preference('itemBarcodeInputFilter') );
if ($barcode) {
- my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $borrower, $barcode );
+ my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $barcode );
# TODO push @availablefor, 'loan';
}
my $template_params = { barcode => $barcode };
# always check for blockers on issuing
my ( $error, $question, $alerts, $messages ) = CanBookBeIssued(
- $patron->unblessed,
+ $patron,
$barcode, $datedue,
$inprocess,
undef,
($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw);
}
-my $borrower;
+my ( $borrower, $patron );
if ( $patronid ) {
- $borrower = Koha::Patrons->find( { cardnumber => $patronid } );
- $borrower = $borrower->unblessed if $borrower;
+ $patron = Koha::Patrons->find( { cardnumber => $patronid } );
+ $borrower = $patron->unblessed if $patron;
}
my $currencySymbol = "";
elsif ( $op eq "returnbook" && $allowselfcheckreturns ) {
my ($doreturn) = AddReturn( $barcode, $branch );
}
-elsif ( $borrower and $op eq "checkout" ) {
+elsif ( $patron and $op eq "checkout" ) {
my $impossible = {};
my $needconfirm = {};
( $impossible, $needconfirm ) = CanBookBeIssued(
- $borrower,
+ $patron,
$barcode,
undef,
0,
my $homebranch = $builder->build( { source => 'Branch' } );
my $holdingbranch = $builder->build( { source => 'Branch' } );
my $otherbranch = $builder->build( { source => 'Branch' } );
- my $patron_1 = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
- my $patron_2 = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
+ my $patron_1 = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
+ my $patron_2 = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
my $biblioitem = $builder->build( { source => 'Biblioitem' } );
my $item = $builder->build(
set_userenv($holdingbranch);
- my $issue = AddIssue( $patron_1, $item->{barcode} );
+ my $issue = AddIssue( $patron_1->unblessed, $item->{barcode} );
is( ref($issue), 'Koha::Schema::Result::Issue' ); # FIXME Should be Koha::Checkout
my ( $error, $question, $alerts );
plan tests => 8;
my $library = $builder->build( { source => 'Branch' } );
- my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
+ my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
my $biblioitem_1 = $builder->build( { source => 'Biblioitem' } );
my $item_1 = $builder->build(
# Patron cannot issue item_1, they have overdues
my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
- my $issue = AddIssue( $patron, $item_1->{barcode}, $yesterday ); # Add an overdue
+ my $issue = AddIssue( $patron->unblessed, $item_1->{barcode}, $yesterday ); # Add an overdue
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'confirmation' );
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} );
# Patron cannot issue item_1, they are debarred
my $tomorrow = DateTime->today( time_zone => C4::Context->tz() )->add( days => 1 );
- Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber}, expiration => $tomorrow } );
+ Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->borrowernumber, expiration => $tomorrow } );
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} );
is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . str($error, $question, $alerts) );
is( $error->{USERBLOCKEDWITHENDDATE}, output_pref( { dt => $tomorrow, dateformat => 'sql', dateonly => 1 } ), 'USERBLOCKEDWITHENDDATE should be tomorrow' );
- Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber} } );
+ Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->borrowernumber } );
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} );
is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . str($error, $question, $alerts) );
is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31', 'USERBLOCKEDNOENDDATE should be 9999-12-31 for unlimited debarments' );
}
);
- my ( $error, $question, $alerts ) = CanBookBeIssued( $patron->unblessed, $item_1->{barcode} );
+ my ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_1->{barcode} );
is( $error->{STATS}, 1, '"Error" flag "STATS" must be set if CanBookBeIssued is called with a statistic patron (category_type=X)' );
# TODO There are other tests to provide here
plan tests => 5;
my $library = $builder->build( { source => 'Branch' } );
- my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
+ my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
my $biblioitem = $builder->build( { source => 'Biblioitem' } );
my $biblionumber = $biblioitem->{biblionumber};
);
my ( $error, $question, $alerts );
- my $issue = AddIssue( $patron, $item_1->{barcode}, dt_from_string->add( days => 1 ) );
+ my $issue = AddIssue( $patron->unblessed, $item_1->{barcode}, dt_from_string->add( days => 1 ) );
t::lib::Mocks::mock_preference('AllowMultipleIssuesOnABiblio', 0);
( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} );
my $five_days_go = output_pref({ dt => dt_from_string->add( days => 5 ), dateonly => 1});
my $ten_days_go = output_pref({ dt => dt_from_string->add( days => 10), dateonly => 1 });
my $library = $builder->build( { source => 'Branch' } );
- my $patron = $builder->build( { source => 'Borrower', value => { categorycode => $patron_category->{categorycode} } } );
+ my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } );
my $biblioitem = $builder->build( { source => 'Biblioitem' } );
my $item = $builder->build(
}
);
- my $issue = AddIssue( $patron, $item->{barcode}, $five_days_go ); # date due was 10d ago
+ my $issue = AddIssue( $patron->unblessed, $item->{barcode}, $five_days_go ); # date due was 10d ago
my $actualissue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } );
is( output_pref({ str => $actualissue->date_due, dateonly => 1}), $five_days_go, "First issue works");
my ($issuingimpossible, $needsconfirmation) = CanBookBeIssued($patron,$item->{barcode},$ten_days_go, undef, undef, undef);
}
);
-my $patron_category = $builder->build({ source => 'Category', value => { category_type => 'P', enrolmentfee => 0 } });
-my $patron = $builder->build(
+my $patron_category = $builder->build({ source => 'Category', value => { categorycode => 'NOT_X', category_type => 'P', enrolmentfee => 0 } });
+my $patron = $builder->build_object(
{
- source => 'Borrower',
+ class => 'Koha::Patrons',
value => {
patron_category => $patron_category->{categorycode},
}
{
source => 'Borrower',
value => {
- guarantorid => $patron->{borrowernumber},
+ guarantorid => $patron->borrowernumber,
patron_category => $patron_category->{categorycode},
}
}
source => 'Branch',
});
-my $patron_category = $builder->build({ source => 'Category', value => { category_type => 'P', enrolmentfee => 0 } });
-my $patron = $builder->build({
- source => 'Borrower',
+my $patron_category = $builder->build({ source => 'Category', value => { categorycode => 'NOT_X', category_type => 'P', enrolmentfee => 0 } });
+my $patron = $builder->build_object({
+ class => 'Koha::Patrons',
value => {
branchcode => $branch->{branchcode},
debarred => undef,
categorycode => $patron_category->{categorycode},
},
});
+my $patron_unblessed = $patron->unblessed;
my $biblio = $builder->build({
source => 'Biblio',
});
C4::Context->_new_userenv ('DUMMY_SESSION_ID');
-C4::Context->set_userenv($patron->{borrowernumber}, $patron->{userid}, 'usercnum', 'First name', 'Surname', $branch->{branchcode}, 'My Library', 0);
+C4::Context->set_userenv($patron->borrowernumber, $patron->userid, 'usercnum', 'First name', 'Surname', $branch->{branchcode}, 'My Library', 0);
t::lib::Mocks::mock_preference('AllowTooManyOverride', 0);
# Add onsite checkout
-C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
+C4::Circulation::AddIssue( $patron_unblessed, $item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
my ( $impossible, $messages );
t::lib::Mocks::mock_preference('SwitchOnSiteCheckouts', 0);
( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} );
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'If SwitchOnSiteCheckouts, switch the on-site checkout' );
is( exists $impossible->{TOO_MANY}, '', 'If SwitchOnSiteCheckouts, switch the on-site checkout' );
-C4::Circulation::AddIssue( $patron, $item->{barcode}, undef, undef, undef, undef, { switch_onsite_checkout => 1 } );
+C4::Circulation::AddIssue( $patron_unblessed, $item->{barcode}, undef, undef, undef, undef, { switch_onsite_checkout => 1 } );
my $issue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } );
is( $issue->onsite_checkout, 0, 'The issue should have been switched to a regular checkout' );
my $five_days_after = dt_from_string->add( days => 5 )->set( hour => 23, minute => 59, second => 0 );
},
});
-C4::Circulation::AddIssue( $patron, $another_item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
+C4::Circulation::AddIssue( $patron_unblessed, $another_item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } );
( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} );
is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'Specific case 1 - Switch is allowed' );
is( exists $impossible->{TOO_MANY}, '', 'Specific case 1 - Switch is allowed' );
sub can_book_be_issued {
my $item = $builder->build( { source => 'Item' } );
- my $patron = $builder->build(
- { source => 'Borrower',
+ my $patron = $builder->build_object(
+ { class => 'Koha::Patrons',
value => {
dateexpiry => '9999-12-31',
categorycode => $patron_category->{categorycode},
}
}
);
- $patron->{flags} = C4::Members::patronflags( $patron );
my $duration = gettimeofday();
my ( $issuingimpossible, $needsconfirmation ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} );
$duration = gettimeofday() - $duration;
is( not( exists $issuingimpossible->{EXPIRED} ), 1, 'The patron should not be considered as expired if dateexpiry is 9999-*' );
$item = $builder->build( { source => 'Item' } );
- $patron = $builder->build(
- { source => 'Borrower',
+ $patron = $builder->build_object(
+ { class => 'Koha::Patrons',
value => {
dateexpiry => '0000-00-00',
categorycode => $patron_category->{categorycode},
}
}
);
- $patron->{flags} = C4::Members::patronflags( $patron );
( $issuingimpossible, $needsconfirmation ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} );
is( $issuingimpossible->{EXPIRED}, 1, 'The patron should be considered as expired if dateexpiry is 0000-00-00' );
my $tomorrow = dt_from_string->add_duration( DateTime::Duration->new( days => 1 ) );
$item = $builder->build( { source => 'Item' } );
- $patron = $builder->build(
- { source => 'Borrower',
+ $patron = $builder->build_object(
+ { class => 'Koha::Patrons',
value => {
dateexpiry => output_pref( { dt => $tomorrow, dateonly => 1, dateformat => 'sql' } ),
categorycode => $patron_category->{categorycode},
},
}
);
- $patron->{flags} = C4::Members::patronflags( $patron );
( $issuingimpossible, $needsconfirmation ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} );
is( not( exists $issuingimpossible->{EXPIRED} ), 1, 'The patron should not be considered as expired if dateexpiry is tomorrow' );
use C4::Circulation;
use Koha::Database;
-use Koha::Patron;
+use Koha::Patrons;
use Koha::Biblio;
use Koha::Item;
use Koha::Holds;
t::lib::Mocks::mock_preference('CircControl', 'PatronLibrary');
-my ( $un, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode );
+my $patron_object = Koha::Patrons->find( $patron_hr->{borrowernumber} );
+my ( undef, $needsconfirmation ) = CanBookBeIssued( $patron_object, $item->barcode );
ok( $needsconfirmation->{HIGHHOLDS}, "High holds checkout needs confirmation" );
-( undef, $needsconfirmation ) = CanBookBeIssued( $patron_hr, $item->barcode, undef, undef, undef, { override_high_holds => 1 } );
+( undef, $needsconfirmation ) = CanBookBeIssued( $patron_object, $item->barcode, undef, undef, undef, { override_high_holds => 1 } );
ok( !$needsconfirmation->{HIGHHOLDS}, "High holds checkout does not need confirmation" );
$schema->storage->txn_rollback();
# Our Patron
my $CBBI_patron = $builder->build({source => 'Borrower'});
-$patron = Koha::Patrons->find( $CBBI_patron->{borrowernumber} )->unblessed;
+$patron = Koha::Patrons->find( $CBBI_patron->{borrowernumber} );
# Our Items
my $new_item = $builder->build({
source => 'Item',
});
# Second is Checked Out
BAIL_OUT("CanBookBeIssued Issue failed")
- unless AddIssue($patron, $prev_item->{barcode});
+ unless AddIssue($patron->unblessed, $prev_item->{barcode});
# Mappings
my $CBBI_mappings = [
sub try_issue {
my ($cardnumber, $item ) = @_;
my $issuedate = '2011-05-16';
- my $borrower = Koha::Patrons->find( { cardnumber => $cardnumber } )->unblessed;
- my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $borrower, $item );
- my $issue = AddIssue($borrower, $item, undef, 0, $issuedate);
+ my $patron = Koha::Patrons->find( { cardnumber => $cardnumber } );
+ my ($issuingimpossible,$needsconfirmation) = CanBookBeIssued( $patron, $item );
+ my $issue = AddIssue($patron->unblessed, $item, undef, 0, $issuedate);
return dt_from_string( $issue->due_date() );
}