Lines 131-136
sub store {
Link Here
|
131 |
$self->cn_sort($cn_sort); |
131 |
$self->cn_sort($cn_sort); |
132 |
} |
132 |
} |
133 |
|
133 |
|
|
|
134 |
if( $self->itemlost ) { |
135 |
$self->_add_statistic('item_lost'); # should be quite rare when adding item |
136 |
} |
137 |
|
134 |
} else { # ModItem |
138 |
} else { # ModItem |
135 |
|
139 |
|
136 |
$action = 'modify'; |
140 |
$action = 'modify'; |
Lines 186-200
sub store {
Link Here
|
186 |
$self->permanent_location( $self->location ); |
190 |
$self->permanent_location( $self->location ); |
187 |
} |
191 |
} |
188 |
|
192 |
|
189 |
# If item was lost and has now been found, |
193 |
if( exists $updated_columns{itemlost} && !$updated_columns{itemlost} && $pre_mod_item->itemlost ) { # item found again |
190 |
# reverse any list item charges if necessary. |
194 |
$self->_set_found_trigger($pre_mod_item); # reverse any list item charges if necessary |
191 |
if ( exists $updated_columns{itemlost} |
195 |
$self->_add_statistic('item_found'); |
192 |
and $updated_columns{itemlost} <= 0 |
196 |
} elsif( exists $updated_columns{itemlost} && $updated_columns{itemlost} && !$pre_mod_item->itemlost ) { # item lost |
193 |
and $pre_mod_item->itemlost > 0 ) |
197 |
$self->_add_statistic('item_lost'); |
194 |
{ |
|
|
195 |
$self->_set_found_trigger($pre_mod_item); |
196 |
} |
198 |
} |
197 |
|
|
|
198 |
} |
199 |
} |
199 |
|
200 |
|
200 |
my $result = $self->SUPER::store; |
201 |
my $result = $self->SUPER::store; |
Lines 217-222
sub store {
Link Here
|
217 |
return $result; |
218 |
return $result; |
218 |
} |
219 |
} |
219 |
|
220 |
|
|
|
221 |
sub _add_statistic { |
222 |
my ( $self, $type ) = @_; |
223 |
C4::Stats::UpdateStats({ |
224 |
type => $type, |
225 |
branch => C4::Context->userenv ? C4::Context->userenv->{branch} : undef, |
226 |
borrowernumber => undef, |
227 |
categorycode => undef, |
228 |
itemnumber => $self->itemnumber, |
229 |
ccode => $self->ccode, |
230 |
itemtype => $self->effective_itemtype, |
231 |
location => $self->location, |
232 |
}); |
233 |
} |
234 |
|
220 |
=head3 delete |
235 |
=head3 delete |
221 |
|
236 |
|
222 |
=cut |
237 |
=cut |
223 |
- |
|
|