Lines 411-418
sub TooMany {
Link Here
|
411 |
# rule |
411 |
# rule |
412 |
if (defined($maxissueqty_rule) and $maxissueqty_rule->rule_value ne '') { |
412 |
if (defined($maxissueqty_rule) and $maxissueqty_rule->rule_value ne '') { |
413 |
my @bind_params; |
413 |
my @bind_params; |
414 |
my $count_query = q| |
414 |
my $count_query = qq| |
415 |
SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts |
415 |
SELECT COUNT(*) AS total, COALESCE(SUM(CASE WHEN checkout_type = '$Koha::Checkouts::type->{onsite_checkout}' THEN 1 ELSE 0 END), 0) AS onsite_checkouts |
416 |
FROM issues |
416 |
FROM issues |
417 |
JOIN items USING (itemnumber) |
417 |
JOIN items USING (itemnumber) |
418 |
|; |
418 |
|; |
Lines 508-515
sub TooMany {
Link Here
|
508 |
my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower); |
508 |
my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower); |
509 |
if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') { |
509 |
if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') { |
510 |
my @bind_params = (); |
510 |
my @bind_params = (); |
511 |
my $branch_count_query = q| |
511 |
my $branch_count_query = qq| |
512 |
SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts |
512 |
SELECT COUNT(*) AS total, COALESCE(SUM(CASE WHEN checkout_type = '$Koha::Checkouts::type->{onsite_checkout}' THEN 1 ELSE 0 END), 0) AS onsite_checkouts |
513 |
FROM issues |
513 |
FROM issues |
514 |
JOIN items USING (itemnumber) |
514 |
JOIN items USING (itemnumber) |
515 |
WHERE borrowernumber = ? |
515 |
WHERE borrowernumber = ? |
Lines 852-858
sub CanBookBeIssued {
Link Here
|
852 |
# If it is an on-site checkout if it can be switched to a normal checkout |
852 |
# If it is an on-site checkout if it can be switched to a normal checkout |
853 |
# or ask whether the loan should be renewed |
853 |
# or ask whether the loan should be renewed |
854 |
|
854 |
|
855 |
if ( $issue->onsite_checkout |
855 |
if ( $issue->is_onsite_checkout |
856 |
and C4::Context->preference('SwitchOnSiteCheckouts') ) { |
856 |
and C4::Context->preference('SwitchOnSiteCheckouts') ) { |
857 |
$messages{ONSITE_CHECKOUT_WILL_BE_SWITCHED} = 1; |
857 |
$messages{ONSITE_CHECKOUT_WILL_BE_SWITCHED} = 1; |
858 |
} else { |
858 |
} else { |
Lines 902-908
sub CanBookBeIssued {
Link Here
|
902 |
my $switch_onsite_checkout = ( |
902 |
my $switch_onsite_checkout = ( |
903 |
C4::Context->preference('SwitchOnSiteCheckouts') |
903 |
C4::Context->preference('SwitchOnSiteCheckouts') |
904 |
and $issue |
904 |
and $issue |
905 |
and $issue->onsite_checkout |
905 |
and $issue->is_onsite_checkout |
906 |
and $issue->borrowernumber == $patron->borrowernumber ? 1 : 0 ); |
906 |
and $issue->borrowernumber == $patron->borrowernumber ? 1 : 0 ); |
907 |
my $toomany = TooMany( $patron_unblessed, $item_object, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } ); |
907 |
my $toomany = TooMany( $patron_unblessed, $item_object, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } ); |
908 |
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book |
908 |
# if TooMany max_allowed returns 0 the user doesn't have permission to check out this book |
Lines 1421-1427
sub AddIssue {
Link Here
|
1421 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
1421 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
1422 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1422 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1423 |
branchcode => C4::Context->userenv->{'branch'}, |
1423 |
branchcode => C4::Context->userenv->{'branch'}, |
1424 |
onsite_checkout => $onsite_checkout, |
1424 |
checkout_type => $onsite_checkout ? |
|
|
1425 |
$Koha::Checkouts::type->{onsite_checkout} |
1426 |
: $Koha::Checkouts::type->{checkout}, |
1425 |
auto_renew => $auto_renew ? 1 : 0, |
1427 |
auto_renew => $auto_renew ? 1 : 0, |
1426 |
}; |
1428 |
}; |
1427 |
|
1429 |
|
Lines 2724-2730
sub CanBookBeRenewed {
Link Here
|
2724 |
|
2726 |
|
2725 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2727 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2726 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2728 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2727 |
return ( 0, 'onsite_checkout' ) if $issue->onsite_checkout; |
2729 |
return ( 0, 'onsite_checkout' ) if $issue->is_onsite_checkout; |
2728 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
2730 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
2729 |
|
2731 |
|
2730 |
my $patron = $issue->patron or return; |
2732 |
my $patron = $issue->patron or return; |
Lines 4109-4115
sub GetAgeRestriction {
Link Here
|
4109 |
|
4111 |
|
4110 |
sub GetPendingOnSiteCheckouts { |
4112 |
sub GetPendingOnSiteCheckouts { |
4111 |
my $dbh = C4::Context->dbh; |
4113 |
my $dbh = C4::Context->dbh; |
4112 |
return $dbh->selectall_arrayref(q| |
4114 |
return $dbh->selectall_arrayref(qq| |
4113 |
SELECT |
4115 |
SELECT |
4114 |
items.barcode, |
4116 |
items.barcode, |
4115 |
items.biblionumber, |
4117 |
items.biblionumber, |
Lines 4130-4136
sub GetPendingOnSiteCheckouts {
Link Here
|
4130 |
LEFT JOIN issues ON items.itemnumber = issues.itemnumber |
4132 |
LEFT JOIN issues ON items.itemnumber = issues.itemnumber |
4131 |
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber |
4133 |
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber |
4132 |
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber |
4134 |
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber |
4133 |
WHERE issues.onsite_checkout = 1 |
4135 |
WHERE issues.checkout_type = '$Koha::Checkouts::type->{onsite_checkout}' |
4134 |
|, { Slice => {} } ); |
4136 |
|, { Slice => {} } ); |
4135 |
} |
4137 |
} |
4136 |
|
4138 |
|