|
Lines 42-47
Koha::Checkout - Koha Checkout object class
Link Here
|
| 42 |
|
42 |
|
| 43 |
=cut |
43 |
=cut |
| 44 |
|
44 |
|
|
|
45 |
=head3 store |
| 46 |
|
| 47 |
$item->store; |
| 48 |
|
| 49 |
$params can take an optional 'skip_record_index' parameter. |
| 50 |
If set, the reindexation process will not happen (index_records not called) |
| 51 |
|
| 52 |
NOTE: This is a temporary fix to answer a performance issue when lot of checkout |
| 53 |
dates change which would result in lots of items onloan dates changing. |
| 54 |
The correct way to fix this is to make the ES reindexation process async. |
| 55 |
You should not turn it on if you do not understand what it is doing exactly. |
| 56 |
|
| 57 |
=cut |
| 58 |
|
| 59 |
sub store { |
| 60 |
my $self = shift; |
| 61 |
my $params = @_ ? shift : {}; |
| 62 |
|
| 63 |
# Update |
| 64 |
if ( $self->in_storage ) { |
| 65 |
my %updated_columns = $self->_result->get_dirty_columns; |
| 66 |
return $self->SUPER::store unless %updated_columns; |
| 67 |
|
| 68 |
# If checkout due_date was updated, trigger the item onloan date change |
| 69 |
if ( exists $updated_columns{date_due} ) { |
| 70 |
$self->item->onloan( $updated_columns{date_due} ) |
| 71 |
->store( { skip_record_index => $params->{skip_record_index} } ); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
return $self->SUPER::store; |
| 76 |
} |
| 77 |
|
| 45 |
=head3 is_overdue |
78 |
=head3 is_overdue |
| 46 |
|
79 |
|
| 47 |
my $is_overdue = $checkout->is_overdue( [ $reference_dt ] ); |
80 |
my $is_overdue = $checkout->is_overdue( [ $reference_dt ] ); |
| 48 |
- |
|
|