Bug 30928: Add interface to statistics

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lucas Gass 2023-04-28 14:30:41 +00:00 committed by Tomas Cohen Arazi
parent ce8911a955
commit 60c4611955
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
4 changed files with 13 additions and 4 deletions

View file

@ -825,6 +825,7 @@ sub CanBookBeIssued {
ccode => $item_object->ccode, ccode => $item_object->ccode,
categorycode => $patron->categorycode, categorycode => $patron->categorycode,
location => $item_object->location, location => $item_object->location,
interface => C4::Context->interface,
} }
); );
ModDateLastSeen( $item_object->itemnumber ); # FIXME Move to Koha::Item ModDateLastSeen( $item_object->itemnumber ); # FIXME Move to Koha::Item
@ -1773,7 +1774,8 @@ sub AddIssue {
location => $item_object->location, location => $item_object->location,
borrowernumber => $borrower->{'borrowernumber'}, borrowernumber => $borrower->{'borrowernumber'},
ccode => $item_object->ccode, ccode => $item_object->ccode,
categorycode => $borrower->{'categorycode'} categorycode => $borrower->{'categorycode'},
interface => C4::Context->interface,
} }
); );
@ -2407,6 +2409,7 @@ sub AddReturn {
borrowernumber => $borrowernumber, borrowernumber => $borrowernumber,
ccode => $item->ccode, ccode => $item->ccode,
categorycode => $categorycode, categorycode => $categorycode,
interface => C4::Context->interface,
}); });
# Send a check-in slip. # NOTE: borrower may be undef. Do not try to send messages then. # Send a check-in slip. # NOTE: borrower may be undef. Do not try to send messages then.
@ -3265,6 +3268,7 @@ sub AddRenewal {
borrowernumber => $borrowernumber, borrowernumber => $borrowernumber,
ccode => $item_object->ccode, ccode => $item_object->ccode,
categorycode => $patron->categorycode, categorycode => $patron->categorycode,
interface => C4::Context->interface,
} }
); );

View file

@ -65,7 +65,8 @@ C<$params> is an hashref whose expected keys are:
other : sipmode other : sipmode
itemtype : the type of the item itemtype : the type of the item
ccode : the collection code of the item ccode : the collection code of the item
categorycode : the categorycode of the patron categorycode : the categorycode of the patron
interface : the context this action was taken in
type key is mandatory. type key is mandatory.
For types used in C4::Circulation (renew,issue,localuse,return), the following other keys are mandatory: For types used in C4::Circulation (renew,issue,localuse,return), the following other keys are mandatory:
@ -83,7 +84,7 @@ sub UpdateStats {
# make some controls # make some controls
return () if ! defined $params; return () if ! defined $params;
# change these arrays if new types of transaction or new parameters are allowed # change these arrays if new types of transaction or new parameters are allowed
my @allowed_keys = qw (type branch amount other itemnumber itemtype borrowernumber ccode location categorycode); my @allowed_keys = qw (type branch amount other itemnumber itemtype borrowernumber ccode location categorycode interface);
my @allowed_circulation_types = qw (renew issue localuse return onsite_checkout recall); my @allowed_circulation_types = qw (renew issue localuse return onsite_checkout recall);
my @allowed_accounts_types = qw (writeoff payment); my @allowed_accounts_types = qw (writeoff payment);
my @circulation_mandatory_keys = qw (type branch borrowernumber itemnumber ccode itemtype); my @circulation_mandatory_keys = qw (type branch borrowernumber itemnumber ccode itemtype);
@ -125,6 +126,7 @@ sub UpdateStats {
my $location = exists $params->{location} ? $params->{location} : undef; my $location = exists $params->{location} ? $params->{location} : undef;
my $ccode = exists $params->{ccode} ? $params->{ccode} : ''; my $ccode = exists $params->{ccode} ? $params->{ccode} : '';
my $categorycode = exists $params->{categorycode} ? $params->{categorycode} : undef; my $categorycode = exists $params->{categorycode} ? $params->{categorycode} : undef;
my $interface = exists $params->{interface} ? $params->{interface} : undef;
my $dtf = Koha::Database->new->schema->storage->datetime_parser; my $dtf = Koha::Database->new->schema->storage->datetime_parser;
my $statistic = Koha::Statistic->new( my $statistic = Koha::Statistic->new(
@ -140,6 +142,7 @@ sub UpdateStats {
borrowernumber => $borrowernumber, borrowernumber => $borrowernumber,
ccode => $ccode, ccode => $ccode,
categorycode => $categorycode, categorycode => $categorycode,
interface => $interface,
} }
)->store; )->store;

View file

@ -256,6 +256,7 @@ sub add_credit {
type => lc($credit_type), type => lc($credit_type),
amount => $amount, amount => $amount,
borrowernumber => $self->{patron_id}, borrowernumber => $self->{patron_id},
interface => $interface,
} }
) if grep { $credit_type eq $_ } ( 'PAYMENT', 'WRITEOFF' ); ) if grep { $credit_type eq $_ } ( 'PAYMENT', 'WRITEOFF' );

View file

@ -173,7 +173,8 @@ sub add_recall {
borrowernumber => $recall->patron_id, borrowernumber => $recall->patron_id,
itemtype => $item->effective_itemtype, itemtype => $item->effective_itemtype,
ccode => $item->ccode, ccode => $item->ccode,
categorycode => $checkout->patron->categorycode categorycode => $checkout->patron->categorycode,
interface => $interface,
} }
); );