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 1419-1425
sub AddIssue {
Link Here
|
1419 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
1419 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
1420 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1420 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1421 |
branchcode => C4::Context->userenv->{'branch'}, |
1421 |
branchcode => C4::Context->userenv->{'branch'}, |
1422 |
onsite_checkout => $onsite_checkout, |
1422 |
checkout_type => $onsite_checkout ? |
|
|
1423 |
$Koha::Checkouts::type->{onsite_checkout} |
1424 |
: $Koha::Checkouts::type->{checkout}, |
1423 |
auto_renew => $auto_renew ? 1 : 0, |
1425 |
auto_renew => $auto_renew ? 1 : 0, |
1424 |
}; |
1426 |
}; |
1425 |
|
1427 |
|
Lines 2713-2719
sub CanBookBeRenewed {
Link Here
|
2713 |
|
2715 |
|
2714 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2716 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2715 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2717 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2716 |
return ( 0, 'onsite_checkout' ) if $issue->onsite_checkout; |
2718 |
return ( 0, 'onsite_checkout' ) if $issue->is_onsite_checkout; |
2717 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
2719 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
2718 |
|
2720 |
|
2719 |
my $patron = $issue->patron or return; |
2721 |
my $patron = $issue->patron or return; |
Lines 4098-4104
sub GetAgeRestriction {
Link Here
|
4098 |
|
4100 |
|
4099 |
sub GetPendingOnSiteCheckouts { |
4101 |
sub GetPendingOnSiteCheckouts { |
4100 |
my $dbh = C4::Context->dbh; |
4102 |
my $dbh = C4::Context->dbh; |
4101 |
return $dbh->selectall_arrayref(q| |
4103 |
return $dbh->selectall_arrayref(qq| |
4102 |
SELECT |
4104 |
SELECT |
4103 |
items.barcode, |
4105 |
items.barcode, |
4104 |
items.biblionumber, |
4106 |
items.biblionumber, |
Lines 4119-4125
sub GetPendingOnSiteCheckouts {
Link Here
|
4119 |
LEFT JOIN issues ON items.itemnumber = issues.itemnumber |
4121 |
LEFT JOIN issues ON items.itemnumber = issues.itemnumber |
4120 |
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber |
4122 |
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber |
4121 |
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber |
4123 |
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber |
4122 |
WHERE issues.onsite_checkout = 1 |
4124 |
WHERE issues.checkout_type = '$Koha::Checkouts::type->{onsite_checkout}' |
4123 |
|, { Slice => {} } ); |
4125 |
|, { Slice => {} } ); |
4124 |
} |
4126 |
} |
4125 |
|
4127 |
|