Bugzilla – Attachment 153654 Details for
Bug 33608
Allow to get statistics about found/recovered books
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33608: Add UpdateStats to item->store
Bug-33608-Add-UpdateStats-to-item-store.patch (text/plain), 2.38 KB, created by
Martin Renvoize (ashimema)
on 2023-07-19 14:11:07 UTC
(
hide
)
Description:
Bug 33608: Add UpdateStats to item->store
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-07-19 14:11:07 UTC
Size:
2.38 KB
patch
obsolete
>From 7e5d3bf71c5ca14e3a9ea8ca2869f4629fb9db9b Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 8 May 2023 07:52:04 +0000 >Subject: [PATCH] Bug 33608: Add UpdateStats to item->store > >Test plan: >Run t/db_dependent/Koha/Item.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Item.pm | 31 +++++++++++++++++++++++-------- > 1 file changed, 23 insertions(+), 8 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 17791f2994..97763b6b0d 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -130,6 +130,10 @@ sub store { > $self->cn_sort($cn_sort); > } > >+ if( $self->itemlost ) { >+ $self->_add_statistic('item_lost'); # should be quite rare when adding item >+ } >+ > } else { # ModItem > > $action = 'modify'; >@@ -185,15 +189,12 @@ sub store { > $self->permanent_location( $self->location ); > } > >- # If item was lost and has now been found, >- # reverse any list item charges if necessary. >- if ( exists $updated_columns{itemlost} >- and $updated_columns{itemlost} <= 0 >- and $pre_mod_item->itemlost > 0 ) >- { >- $self->_set_found_trigger($pre_mod_item); >+ if( exists $updated_columns{itemlost} && !$updated_columns{itemlost} && $pre_mod_item->itemlost ) { # item found again >+ $self->_set_found_trigger($pre_mod_item); # reverse any list item charges if necessary >+ $self->_add_statistic('item_found'); >+ } elsif( exists $updated_columns{itemlost} && $updated_columns{itemlost} && !$pre_mod_item->itemlost ) { # item lost >+ $self->_add_statistic('item_lost'); > } >- > } > > my $result = $self->SUPER::store; >@@ -216,6 +217,20 @@ sub store { > return $result; > } > >+sub _add_statistic { >+ my ( $self, $type ) = @_; >+ C4::Stats::UpdateStats({ >+ type => $type, >+ branch => C4::Context->userenv ? C4::Context->userenv->{branch} : undef, >+ borrowernumber => undef, >+ categorycode => undef, >+ itemnumber => $self->itemnumber, >+ ccode => $self->ccode, >+ itemtype => $self->effective_itemtype, >+ location => $self->location, >+ }); >+} >+ > =head3 delete > > =cut >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33608
:
150840
|
150841
|
150842
|
150843
|
150844
|
150845
|
150846
|
151051
|
151052
|
151053
|
151054
|
151055
|
151056
|
151057
|
151913
|
151915
|
151916
|
151917
|
151918
|
151919
|
151920
|
151921
|
151922
|
153653
|
153654
|
153655
|
153656
|
153657
|
153658
|
153659
|
153660
|
153661
|
153698
|
153699
|
153700
|
153701
|
153702
|
153703
|
153704
|
153705
|
153706
|
153707
|
153708
|
153709
|
153710
|
153711
|
153712
|
153713
|
153765
|
157440
|
157441
|
157442
|
157443
|
157444
|
157445
|
157446
|
157447
|
157448
|
157449