|
Lines 27-33
use Encode;
Link Here
|
| 27 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
27 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
| 28 |
use C4::Context; |
28 |
use C4::Context; |
| 29 |
use C4::Stats qw( UpdateStats ); |
29 |
use C4::Stats qw( UpdateStats ); |
| 30 |
use C4::Reserves qw( CheckReserves CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest ); |
30 |
use C4::Reserves qw( CheckReserves ReservesOnSamePeriod CanItemBeReserved MoveReserve ModReserve ModReserveMinusPriority RevertWaitingStatus IsItemOnHoldAndFound IsAvailableForItemLevelRequest ); |
| 31 |
use C4::Biblio qw( UpdateTotalIssues ); |
31 |
use C4::Biblio qw( UpdateTotalIssues ); |
| 32 |
use C4::Items qw( ModItemTransfer ModDateLastSeen CartToShelf ); |
32 |
use C4::Items qw( ModItemTransfer ModDateLastSeen CartToShelf ); |
| 33 |
use C4::Accounts; |
33 |
use C4::Accounts; |
|
Lines 1111-1119
sub CanBookBeIssued {
Link Here
|
| 1111 |
$needsconfirmation{'ressurname'} = $patron->surname; |
1111 |
$needsconfirmation{'ressurname'} = $patron->surname; |
| 1112 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1112 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
| 1113 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1113 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
| 1114 |
$needsconfirmation{'resbranchcode'} = $res->{branchcode}; |
1114 |
$needsconfirmation{'resbranchcode'} = $res->branchcode; |
| 1115 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
1115 |
$needsconfirmation{'reswaitingdate'} = $res->{'waitingdate'}; |
| 1116 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1116 |
$needsconfirmation{'reserve_id'} = $res->{'reserve_id'}; |
| 1117 |
} |
1117 |
} |
| 1118 |
elsif ( $restype eq "Reserved" ) { |
1118 |
elsif ( $restype eq "Reserved" ) { |
| 1119 |
# The item is on reserve for someone else. |
1119 |
# The item is on reserve for someone else. |
|
Lines 1123-1130
sub CanBookBeIssued {
Link Here
|
| 1123 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1123 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
| 1124 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1124 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
| 1125 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
1125 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
| 1126 |
$needsconfirmation{'resreservedate'} = $res->{reservedate}; |
1126 |
$needsconfirmation{'resreservedate'} = $res->{'reservedate'}; |
| 1127 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1127 |
$needsconfirmation{'reserve_id'} = $res->{'reserve_id'}; |
| 1128 |
} |
1128 |
} |
| 1129 |
elsif ( $restype eq "Transferred" ) { |
1129 |
elsif ( $restype eq "Transferred" ) { |
| 1130 |
# The item is determined hold being transferred for someone else. |
1130 |
# The item is determined hold being transferred for someone else. |
|
Lines 1134-1141
sub CanBookBeIssued {
Link Here
|
| 1134 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1134 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
| 1135 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1135 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
| 1136 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
1136 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
| 1137 |
$needsconfirmation{'resreservedate'} = $res->{reservedate}; |
1137 |
$needsconfirmation{'resreservedate'} = $res->{'reservedate'}; |
| 1138 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1138 |
$needsconfirmation{'reserve_id'} = $res->{'reserve_id'}; |
| 1139 |
} |
1139 |
} |
| 1140 |
elsif ( $restype eq "Processing" ) { |
1140 |
elsif ( $restype eq "Processing" ) { |
| 1141 |
# The item is determined hold being processed for someone else. |
1141 |
# The item is determined hold being processed for someone else. |
|
Lines 1145-1152
sub CanBookBeIssued {
Link Here
|
| 1145 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
1145 |
$needsconfirmation{'rescardnumber'} = $patron->cardnumber; |
| 1146 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
1146 |
$needsconfirmation{'resborrowernumber'} = $patron->borrowernumber; |
| 1147 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
1147 |
$needsconfirmation{'resbranchcode'} = $patron->branchcode; |
| 1148 |
$needsconfirmation{'resreservedate'} = $res->{reservedate}; |
1148 |
$needsconfirmation{'resreservedate'} = $res->{'reservedate'}; |
| 1149 |
$needsconfirmation{'reserve_id'} = $res->{reserve_id}; |
1149 |
$needsconfirmation{'reserve_id'} = $res->{'reserve_id'}; |
| 1150 |
} |
1150 |
} |
| 1151 |
} |
1151 |
} |
| 1152 |
} |
1152 |
} |
|
Lines 1158-1172
sub CanBookBeIssued {
Link Here
|
| 1158 |
if ($reserves_on_same_period) { |
1158 |
if ($reserves_on_same_period) { |
| 1159 |
my $reserve = $reserves_on_same_period->[0]; |
1159 |
my $reserve = $reserves_on_same_period->[0]; |
| 1160 |
if ($reserve->{borrowernumber} ne $patron->borrowernumber) { |
1160 |
if ($reserve->{borrowernumber} ne $patron->borrowernumber) { |
| 1161 |
my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); |
1161 |
my $patron = Koha::Patrons->find( $reserve->borrowernumber ); |
| 1162 |
$needsconfirmation{RESERVED} = 1; |
1162 |
$needsconfirmation{RESERVED} = 1; |
| 1163 |
$needsconfirmation{resfirstname} = $patron->firstname; |
1163 |
$needsconfirmation{resfirstname} = $patron->firstname; |
| 1164 |
$needsconfirmation{ressurname} = $patron->surname; |
1164 |
$needsconfirmation{ressurname} = $patron->surname; |
| 1165 |
$needsconfirmation{rescardnumber} = $patron->cardnumber; |
1165 |
$needsconfirmation{rescardnumber} = $patron->cardnumber; |
| 1166 |
$needsconfirmation{resborrowernumber} = $patron->borrowernumber; |
1166 |
$needsconfirmation{resborrowernumber} = $patron->borrowernumber; |
| 1167 |
$needsconfirmation{resbranchcode} = $patron->branchcode; |
1167 |
$needsconfirmation{resbranchcode} = $patron->branchcode; |
| 1168 |
$needsconfirmation{resreservedate} = $reserve->{reservedate}; |
1168 |
$needsconfirmation{resreservedate} = $reserve->{'reservedate'}; |
| 1169 |
$needsconfirmation{reserve_id} = $reserve->{reserve_id}; |
1169 |
$needsconfirmation{reserve_id} = $reserve->{'reserve_id'}; |
| 1170 |
} |
1170 |
} |
| 1171 |
} |
1171 |
} |
| 1172 |
} |
1172 |
} |
|
Lines 2775-2781
sub CanBookBeRenewed {
Link Here
|
| 2775 |
} elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($issue->is_overdue and $overduesblockrenewing eq 'blockitem') ) { |
2775 |
} elsif ( ($hasoverdues and $overduesblockrenewing eq 'block') || ($issue->is_overdue and $overduesblockrenewing eq 'blockitem') ) { |
| 2776 |
return ( 0, 'overdue'); |
2776 |
return ( 0, 'overdue'); |
| 2777 |
} |
2777 |
} |
| 2778 |
|
|
|
| 2779 |
$auto_renew = _CanBookBeAutoRenewed({ |
2778 |
$auto_renew = _CanBookBeAutoRenewed({ |
| 2780 |
patron => $patron, |
2779 |
patron => $patron, |
| 2781 |
item => $item, |
2780 |
item => $item, |
|
Lines 2850-2855
sub CanBookBeRenewed {
Link Here
|
| 2850 |
} |
2849 |
} |
| 2851 |
|
2850 |
|
| 2852 |
if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) { |
2851 |
if ( C4::Context->preference("PreventCheckoutOnSameReservePeriod") ) { |
|
|
2852 |
warn $date_due; |
| 2853 |
warn "Inside"; |
| 2853 |
unless ($date_due) { |
2854 |
unless ($date_due) { |
| 2854 |
my $itemtype = $item->effective_itemtype; |
2855 |
my $itemtype = $item->effective_itemtype; |
| 2855 |
my $patron_unblessed = $patron->unblessed; |
2856 |
my $patron_unblessed = $patron->unblessed; |
|
Lines 2867-2882
sub CanBookBeRenewed {
Link Here
|
| 2867 |
} |
2868 |
} |
| 2868 |
} |
2869 |
} |
| 2869 |
|
2870 |
|
| 2870 |
if( $cron ) { #The cron wants to return 'too_soon' over 'on_reserve' |
2871 |
return ( 0, $auto_renew ) if ($auto_renew =~ 'too_soon') && $cron;#$auto_renew ne "no" && $auto_renew ne "ok" and $cron; |
| 2871 |
return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; |
2872 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
| 2872 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
2873 |
return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; |
| 2873 |
} else { # For other purposes we want 'on_reserve' before 'too_soon' |
|
|
| 2874 |
return ( 0, "on_reserve" ) if $resfound; # '' when no hold was found |
| 2875 |
return ( 0, $auto_renew ) if $auto_renew =~ 'too_soon';#$auto_renew ne "no" && $auto_renew ne "ok"; |
| 2876 |
} |
| 2877 |
|
2874 |
|
| 2878 |
if ( GetSoonestRenewDate($borrowernumber, $itemnumber) > dt_from_string() ){ |
2875 |
if ( GetSoonestRenewDate($borrowernumber, $itemnumber) > dt_from_string() ){ |
| 2879 |
return (0, "too_soon") unless $override_limit; |
2876 |
return (0, "too_soon") unless $override_limit; |
| 2880 |
} |
2877 |
} |
| 2881 |
|
2878 |
|
| 2882 |
return ( 0, "auto_renew" ) if $auto_renew eq "ok" && !$override_limit; # 0 if auto-renewal should not succeed |
2879 |
return ( 0, "auto_renew" ) if $auto_renew eq "ok" && !$override_limit; # 0 if auto-renewal should not succeed |