|
Lines 412-418
sub TooMany {
Link Here
|
| 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 = q| |
| 415 |
SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts |
415 |
SELECT COUNT(*) AS total, COALESCE(SUM(CASE WHEN checkout_type = 'ONSITE' 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 509-515
sub TooMany {
Link Here
|
| 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 = q| |
| 512 |
SELECT COUNT(*) AS total, COALESCE(SUM(onsite_checkout), 0) AS onsite_checkouts |
512 |
SELECT COUNT(*) AS total, COALESCE(SUM(CASE WHEN checkout_type = 'ONSITE' 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 ( defined $issue->checkout_type && $issue->checkout_type eq 'ONSITE' |
| 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 defined $issue->checkout_type |
|
|
906 |
and $issue->checkout_type eq 'ONSITE' |
| 906 |
and $issue->borrowernumber == $patron->borrowernumber ? 1 : 0 ); |
907 |
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, } ); |
908 |
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 |
909 |
# 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'), |
1420 |
issuedate => $issuedate->strftime('%Y-%m-%d %H:%M:%S'), |
| 1420 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
1421 |
date_due => $datedue->strftime('%Y-%m-%d %H:%M:%S'), |
| 1421 |
branchcode => C4::Context->userenv->{'branch'}, |
1422 |
branchcode => C4::Context->userenv->{'branch'}, |
| 1422 |
onsite_checkout => $onsite_checkout, |
1423 |
checkout_type => $onsite_checkout ? 'ONSITE' : undef, |
| 1423 |
auto_renew => $auto_renew ? 1 : 0, |
1424 |
auto_renew => $auto_renew ? 1 : 0, |
| 1424 |
}; |
1425 |
}; |
| 1425 |
|
1426 |
|
|
Lines 2713-2719
sub CanBookBeRenewed {
Link Here
|
| 2713 |
|
2714 |
|
| 2714 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
2715 |
my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); |
| 2715 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
2716 |
my $issue = $item->checkout or return ( 0, 'no_checkout' ); |
| 2716 |
return ( 0, 'onsite_checkout' ) if $issue->onsite_checkout; |
2717 |
return ( 0, 'onsite_checkout' ) if defined $issue->checkout_type && $issue->checkout_type eq 'ONSITE'; |
| 2717 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
2718 |
return ( 0, 'item_denied_renewal') if _item_denied_renewal({ item => $item }); |
| 2718 |
|
2719 |
|
| 2719 |
my $patron = $issue->patron or return; |
2720 |
my $patron = $issue->patron or return; |
|
Lines 4119-4125
sub GetPendingOnSiteCheckouts {
Link Here
|
| 4119 |
LEFT JOIN issues ON items.itemnumber = issues.itemnumber |
4120 |
LEFT JOIN issues ON items.itemnumber = issues.itemnumber |
| 4120 |
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber |
4121 |
LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber |
| 4121 |
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber |
4122 |
LEFT JOIN borrowers ON issues.borrowernumber = borrowers.borrowernumber |
| 4122 |
WHERE issues.onsite_checkout = 1 |
4123 |
WHERE issues.checkout_type = 'ONSITE' |
| 4123 |
|, { Slice => {} } ); |
4124 |
|, { Slice => {} } ); |
| 4124 |
} |
4125 |
} |
| 4125 |
|
4126 |
|