|
Lines 659-697
sub IsMemberBlocked {
Link Here
|
| 659 |
my $borrowernumber = shift; |
659 |
my $borrowernumber = shift; |
| 660 |
my $dbh = C4::Context->dbh; |
660 |
my $dbh = C4::Context->dbh; |
| 661 |
|
661 |
|
| 662 |
# does patron have current fine days? |
662 |
my $blockeddate = CheckBorrowerDebarred($borrowernumber); |
| 663 |
my $strsth=qq{ |
|
|
| 664 |
SELECT |
| 665 |
ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due) ) AS blockingdate, |
| 666 |
DATEDIFF(ADDDATE(returndate, finedays * DATEDIFF(returndate,date_due)),NOW()) AS blockedcount |
| 667 |
FROM old_issues |
| 668 |
}; |
| 669 |
if(C4::Context->preference("item-level_itypes")){ |
| 670 |
$strsth.= |
| 671 |
qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber) |
| 672 |
LEFT JOIN issuingrules ON (issuingrules.itemtype=items.itype)} |
| 673 |
}else{ |
| 674 |
$strsth .= |
| 675 |
qq{ LEFT JOIN items ON (items.itemnumber=old_issues.itemnumber) |
| 676 |
LEFT JOIN biblioitems ON (biblioitems.biblioitemnumber=items.biblioitemnumber) |
| 677 |
LEFT JOIN issuingrules ON (issuingrules.itemtype=biblioitems.itemtype) }; |
| 678 |
} |
| 679 |
$strsth.= |
| 680 |
qq{ WHERE finedays IS NOT NULL |
| 681 |
AND date_due < returndate |
| 682 |
AND borrowernumber = ? |
| 683 |
ORDER BY blockingdate DESC, blockedcount DESC |
| 684 |
LIMIT 1}; |
| 685 |
my $sth=$dbh->prepare($strsth); |
| 686 |
$sth->execute($borrowernumber); |
| 687 |
my $row = $sth->fetchrow_hashref; |
| 688 |
my $blockeddate = $row->{'blockeddate'}; |
| 689 |
my $blockedcount = $row->{'blockedcount'}; |
| 690 |
|
663 |
|
| 691 |
return (1, $blockedcount) if $blockedcount > 0; |
664 |
return ( 1, $blockeddate ) if $blockeddate; |
| 692 |
|
665 |
|
| 693 |
# if he have late issues |
666 |
# if he have late issues |
| 694 |
$sth = $dbh->prepare( |
667 |
my $sth = $dbh->prepare( |
| 695 |
"SELECT COUNT(*) as latedocs |
668 |
"SELECT COUNT(*) as latedocs |
| 696 |
FROM issues |
669 |
FROM issues |
| 697 |
WHERE borrowernumber = ? |
670 |
WHERE borrowernumber = ? |
|
Lines 700-708
sub IsMemberBlocked {
Link Here
|
| 700 |
$sth->execute($borrowernumber); |
673 |
$sth->execute($borrowernumber); |
| 701 |
my $latedocs = $sth->fetchrow_hashref->{'latedocs'}; |
674 |
my $latedocs = $sth->fetchrow_hashref->{'latedocs'}; |
| 702 |
|
675 |
|
| 703 |
return (-1, $latedocs) if $latedocs > 0; |
676 |
return ( -1, $latedocs ) if $latedocs > 0; |
| 704 |
|
677 |
|
| 705 |
return (0, 0); |
678 |
return ( 0, 0 ); |
| 706 |
} |
679 |
} |
| 707 |
|
680 |
|
| 708 |
=head2 GetMemberIssuesAndFines |
681 |
=head2 GetMemberIssuesAndFines |
| 709 |
- |
|
|