There is no item in the catalog with the given barcode. The value is C<$barcode>.
-=item C<IsPermanent>
-
-The item's home branch is permanent. This doesn't prevent the item from being transferred, though. The value is the code of the item's home branch.
-
=item C<DestinationEqualsHolding>
The item is already at the branch to which it is being transferred. The transfer is nonetheless considered to have failed. The value should be ignored.
}
}
- # if is permanent...
- # FIXME Is this still used by someone?
- # See other FIXME in AddReturn
- my $library = Koha::Libraries->find($hbr);
- if ( $library and $library->get_categories->search({'me.categorycode' => 'PE'})->count ) {
- $messages->{'IsPermanent'} = $hbr;
- $dotransfer = 0;
- }
-
# can't transfer book if is already there....
if ( $fbr eq $tbr ) {
$messages->{'DestinationEqualsHolding'} = 1;
$issuingimpossible{DEBARRED} = 1;
}
}
- if ( !defined $patron->dateexpiry || $patron->dateexpiry eq '0000-00-00') {
+
+ if ( $patron->is_expired ) {
$issuingimpossible{EXPIRED} = 1;
- } else {
- 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' );
- if ( DateTime->compare($today, $expiry_dt) == 1 ) {
- $issuingimpossible{EXPIRED} = 1;
- }
}
#
#
# DEBTS
- my ($balance, $non_issue_charges, $other_charges) =
- C4::Members::GetMemberAccountBalance( $patron->borrowernumber );
+ my $account = $patron->account;
+ my $balance = $account->balance;
+ my $non_issues_charges = $account->non_issues_charges;
+ my $other_charges = $balance - $non_issues_charges;
my $amountlimit = C4::Context->preference("noissuescharge");
my $allowfineoverride = C4::Context->preference("AllowFineOverride");
my @guarantees = $patron->guarantees();
my $guarantees_non_issues_charges;
foreach my $g ( @guarantees ) {
- my ( $b, $n, $o ) = C4::Members::GetMemberAccountBalance( $g->id );
- $guarantees_non_issues_charges += $n;
+ $guarantees_non_issues_charges += $g->account->non_issues_charges;
}
if ( $guarantees_non_issues_charges > $no_issues_charge_guarantees && !$inprocess && !$allowfineoverride) {
}
if ( C4::Context->preference("IssuingInProcess") ) {
- if ( $non_issue_charges > $amountlimit && !$inprocess && !$allowfineoverride) {
- $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_charges );
- } elsif ( $non_issue_charges > $amountlimit && !$inprocess && $allowfineoverride) {
- $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
- } elsif ( $allfinesneedoverride && $non_issue_charges > 0 && $non_issue_charges <= $amountlimit && !$inprocess ) {
- $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
+ if ( $non_issues_charges > $amountlimit && !$inprocess && !$allowfineoverride) {
+ $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issues_charges );
+ } elsif ( $non_issues_charges > $amountlimit && !$inprocess && $allowfineoverride) {
+ $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
+ } elsif ( $allfinesneedoverride && $non_issues_charges > 0 && $non_issues_charges <= $amountlimit && !$inprocess ) {
+ $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
}
}
else {
- if ( $non_issue_charges > $amountlimit && $allowfineoverride ) {
- $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
- } elsif ( $non_issue_charges > $amountlimit && !$allowfineoverride) {
- $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_charges );
- } elsif ( $non_issue_charges > 0 && $allfinesneedoverride ) {
- $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
+ if ( $non_issues_charges > $amountlimit && $allowfineoverride ) {
+ $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
+ } elsif ( $non_issues_charges > $amountlimit && !$allowfineoverride) {
+ $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issues_charges );
+ } elsif ( $non_issues_charges > 0 && $allfinesneedoverride ) {
+ $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issues_charges );
}
}
The book is not currently on loan. The value is C<$barcode>.
-=item C<IsPermanent>
-
-The book's home branch is a permanent collection. If you have borrowed
-this book, you are not allowed to return it. The value is the code for
-the book's home branch.
-
=item C<withdrawn>
This book has been withdrawn/cancelled. The value should be ignored.
}
}
-
- # check if the book is in a permanent collection....
- # FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality.
- if ( $returnbranch ) {
- my $library = Koha::Libraries->find($returnbranch);
- if ( $library and $library->get_categories->search({'me.categorycode' => 'PE'})->count ) {
- $messages->{'IsPermanent'} = $returnbranch;
- }
- }
-
# check if the return is allowed at this branch
my ($returnallowed, $message) = CanBookBeReturned($item, $branch);
unless ($returnallowed){
my $dbh = C4::Context->dbh;
my $statement = <<END_SQL;
-SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due, branches.branchemail
-FROM issues
-LEFT JOIN items USING (itemnumber)
-LEFT OUTER JOIN branches USING (branchcode)
-WHERE returndate is NULL
-HAVING days_until_due >= 0 AND days_until_due <= ?
+SELECT *
+FROM (
+ SELECT issues.*, items.itype as itemtype, items.homebranch, TO_DAYS( date_due )-TO_DAYS( NOW() ) as days_until_due, branches.branchemail
+ FROM issues
+ LEFT JOIN items USING (itemnumber)
+ LEFT OUTER JOIN branches USING (branchcode)
+ WHERE returndate is NULL
+) tmp
+WHERE days_until_due >= 0 AND days_until_due <= ?
END_SQL
my @bind_parameters = ( $params->{'days_in_advance'} );
if ( C4::Context->preference('OPACFineNoRenewalsBlockAutoRenew') ) {
my $fine_no_renewals = C4::Context->preference("OPACFineNoRenewals");
- my ( $amountoutstanding ) = C4::Members::GetMemberAccountRecords($patron->borrowernumber);
+ my $amountoutstanding = $patron->account->balance;
if ( $amountoutstanding and $amountoutstanding > $fine_no_renewals ) {
return ( 0, "auto_too_much_oweing" );
}
my $dbh = C4::Context->dbh;
my $query = q{
+ SELECT * FROM (
SELECT b.biblionumber, b.title, b.author, bi.itemtype, bi.publishercode,
bi.place, bi.publicationyear, b.copyrightdate, bi.pages, bi.size,
i.ccode, SUM(i.issues) AS count
}
$query .= q{
- GROUP BY b.biblionumber
- HAVING count > 0
+ GROUP BY b.biblionumber, b.title, b.author, bi.itemtype, bi.publishercode,
+ bi.place, bi.publicationyear, b.copyrightdate, bi.pages, bi.size,
+ i.ccode
ORDER BY count DESC
};
+ $query .= q{ ) xxx WHERE count > 0 };
$count = int($count);
if ($count > 0) {
$query .= "LIMIT $count";