Lines 18-23
package Koha::Recalls;
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
|
|
21 |
use DateTime; |
21 |
|
22 |
|
22 |
use Koha::Database; |
23 |
use Koha::Database; |
23 |
use Koha::Recall; |
24 |
use Koha::Recall; |
Lines 140-155
sub add_recall {
Link Here
|
140 |
branchcode => $branchcode, |
141 |
branchcode => $branchcode, |
141 |
rule_name => 'recall_due_date_interval', |
142 |
rule_name => 'recall_due_date_interval', |
142 |
}); |
143 |
}); |
143 |
my $due_interval = defined $recall_due_date_interval ? $recall_due_date_interval->rule_value : 5; |
144 |
my $due_interval = 5; |
144 |
my $timestamp = dt_from_string( $recall->timestamp ); |
145 |
$due_interval = $recall_due_date_interval->rule_value |
145 |
my $checkout_timestamp = dt_from_string( $checkout->date_due ); |
146 |
if defined $recall_due_date_interval && $recall_due_date_interval->rule_value; |
146 |
my $due_date = $timestamp->set( |
147 |
my $timestamp = dt_from_string( $recall->timestamp ); |
|
|
148 |
my $checkout_due_date = dt_from_string( $checkout->date_due ); |
149 |
my $recall_due_date = $timestamp->set( |
147 |
{ |
150 |
{ |
148 |
hour => $checkout_timestamp->hour, minute => $checkout_timestamp->minute, |
151 |
hour => $checkout_due_date->hour, minute => $checkout_due_date->minute, |
149 |
second => $checkout_timestamp->second |
152 |
second => $checkout_due_date->second |
150 |
} |
153 |
} |
151 |
)->add( days => $due_interval ); |
154 |
)->add( days => $due_interval ); |
152 |
$checkout->update( { date_due => $due_date } ); |
155 |
$checkout->update( { date_due => $recall_due_date } ) |
|
|
156 |
if DateTime->compare( $recall_due_date, $checkout_due_date ) == -1; |
153 |
|
157 |
|
154 |
# get itemnumber of most relevant checkout if a biblio-level recall |
158 |
# get itemnumber of most relevant checkout if a biblio-level recall |
155 |
unless ( $recall->item_level ) { $itemnumber = $checkout->itemnumber; } |
159 |
unless ( $recall->item_level ) { $itemnumber = $checkout->itemnumber; } |
Lines 200-206
sub add_recall {
Link Here
|
200 |
# add action log |
204 |
# add action log |
201 |
C4::Log::logaction( 'RECALLS', 'CREATE', $recall->id, "Recall requested by borrower #" . $recall->patron_id, $interface ) if ( C4::Context->preference('RecallsLog') ); |
205 |
C4::Log::logaction( 'RECALLS', 'CREATE', $recall->id, "Recall requested by borrower #" . $recall->patron_id, $interface ) if ( C4::Context->preference('RecallsLog') ); |
202 |
|
206 |
|
203 |
return ( $recall, $due_interval, $due_date ); |
207 |
return ( $recall, $due_interval, $recall_due_date ); |
204 |
} |
208 |
} |
205 |
|
209 |
|
206 |
# unable to add recall |
210 |
# unable to add recall |
207 |
- |
|
|