3 # A Class for hiding the ILS's concept of the patron from the OpenSIP
7 package OpenILS::SIP::Patron;
13 use Sys::Syslog qw(syslog);
15 use Digest::MD5 qw(md5_hex);
18 use OpenILS::Application::AppUtils;
19 use OpenILS::Application::Actor;
20 use OpenSRF::Utils qw/:datetime/;
21 use DateTime::Format::ISO8601;
22 my $U = 'OpenILS::Application::AppUtils';
24 our (@ISA, @EXPORT_OK);
28 @EXPORT_OK = qw(invalid_patron);
35 my $patron_id = shift;
38 if ($key ne 'usr' and $key ne 'barcode') {
39 syslog("LOG_ERROR", "Patron (card) lookup requested by illegeal key '$key'");
43 unless(defined $patron_id) {
44 syslog("LOG_WARNING", "No patron ID provided to ILS::Patron->new");
48 my $type = ref($class) || $class;
49 my $self = bless({}, $type);
51 syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s => %s): searching...", $key, $patron_id);
53 my $e = OpenILS::SIP->editor();
54 # Pass the authtoken, if any, to the editor so that we can use it
55 # to fake a context org_unit for the csp.ignore_proximity in
56 # flesh_user_penalties, below.
57 unless ($e->authtoken()) {
58 $e->authtoken($args{authtoken}) if ($args{authtoken});
78 # in some cases, we don't need all of this data. Only fetch the user + barcode
79 $usr_flesh = {flesh => 1, flesh_fields => {au => ['card']}} if $args{slim_user};
82 if($key eq 'barcode') { # retrieve user by barcode
84 $$usr_flesh{flesh} += 1;
85 $$usr_flesh{flesh_fields}{ac} = ['usr'];
87 my $card = $e->search_actor_card([{barcode => $patron_id}, $usr_flesh])->[0];
89 if(!$card or !$U->is_true($card->active)) {
90 syslog("LOG_WARNING", "No such patron barcode: $patron_id");
97 $user = $e->retrieve_actor_user([$patron_id, $usr_flesh]);
100 if(!$user or $U->is_true($user->deleted)) {
101 syslog("LOG_WARNING", "OILS: Unable to find patron %s => %s", $key, $patron_id);
105 if(!$U->is_true($user->active)) {
106 syslog("LOG_WARNING", "OILS: Patron is inactive %s => %s", $key, $patron_id);
110 # now grab the user's penalties
112 $self->flesh_user_penalties($user, $e) unless $args{slim_user};
114 $self->{authtoken} = $args{authtoken} if $args{authtoken};
115 $self->{editor} = $e;
116 $self->{user} = $user;
117 $self->{id} = ($key eq 'barcode') ? $patron_id : $user->card->barcode; # The barcode IS the ID to SIP.
118 # We give back the passed barcode if the key was indeed a barcode, just to be safe. Otherwise pull it from the card.
120 syslog("LOG_DEBUG", "OILS: new OpenILS Patron(%s => %s): found patron : barred=%s, card:active=%s",
121 $key, $patron_id, $user->barred, $user->card->active );
123 $U->log_user_activity($user->id, $self->get_act_who, 'verify');
130 my $config = OpenILS::SIP->config();
131 my $login = OpenILS::SIP->login_account();
133 my $act_who = $config->{implementation_config}->{default_activity_who};
134 my $force_who = $config->{implementation_config}->{force_activity_who};
136 # 1. future: test sip extension for caller-provided ewho and !$force_who
138 # 2. See if the login is tagged with an ewho
139 return $login->{activity_who} if $login->{activity_who};
141 # 3. if all else fails, see if there is an institution-wide ewho
142 return $config->{activity_who} if $config->{activity_who};
147 # grab patron penalties. Only grab non-archived penalties that are for fines,
148 # excessive overdues, or otherwise block circluation activity
149 sub flesh_user_penalties {
150 my ($self, $user, $e) = @_;
152 # Use the ws_ou or home_ou of the authsession user, if any, as a
153 # context org_unit for the penalties and the csp.ignore_proximity.
155 if ($e->authtoken()) {
156 my $auth_usr = $e->checkauth();
158 $here = $auth_usr->ws_ou() || $auth_usr->home_ou();
162 # Get the "raw" list of user's penalties and flesh the
163 # standing_penalty field, so we can filter them based on
164 # csp.ignore_proximity.
166 $e->search_actor_user_standing_penalty([
171 # ignore "archived" penalties
172 {stop_date => undef},
173 {stop_date => {'>' => 'now'}}
181 transform => 'actor.org_unit_ancestors',
187 # Use "here" or user's home_ou.
188 where => {id => ($here) ? $here : $user->home_ou},
193 # in addition to fines and excessive overdue penalties,
194 # we only care about penalties that result in blocks
195 standing_penalty => {
197 select => {csp => ['id']},
201 {id => [1,2]}, # fines / overdues
202 {block_list => {'!=' => undef}}
210 flesh_fields => {ausp => ['standing_penalty']}
213 # We filter the raw penalties that apply into this array.
214 my $applied_penalties = [];
215 if (ref($raw_penalties) eq 'ARRAY' && @$raw_penalties) {
216 my $here_prox = ($here) ? $U->get_org_unit_proximity($e, $here, $user->home_ou())
218 # Filter out those that do not apply and deflesh the standing_penalty.
219 $applied_penalties = [map
220 { $_->standing_penalty($_->standing_penalty->id()) }
222 !defined($_->standing_penalty->ignore_proximity())
223 || ((defined($here_prox))
224 ? $_->standing_penalty->ignore_proximity() < $here_prox
225 : $_->standing_penalty->ignore_proximity() <
226 $U->get_org_unit_proximity($e, $_->org_unit(), $user->home_ou()))
229 $user->standing_penalties($applied_penalties);
239 return format_name($self->{user});
244 return OpenILS::SIP::clean_text(
246 ($u->first_given_name || ''),
247 ($u->second_given_name || ''),
248 ($u->family_name || '')));
253 my $lib = OpenILS::SIP::shortname_from_id($self->{user}->home_ou);
254 syslog('LOG_DEBUG', "OILS: Patron->home_library() = $lib");
260 return "" unless $addr;
261 my $return = OpenILS::SIP::clean_text(
262 join( ' ', map {$_ || ''} (
273 $return =~ s/\s+/ /sg; # Compress any run of of whitespace to one space
279 return $self->{user}->id;
284 my $u = $self->{user};
285 my $str = __addr_string($u->billing_address || $u->mailing_address);
286 syslog('LOG_DEBUG', "OILS: Patron address: $str");
292 return OpenILS::SIP::clean_text($self->{user}->email);
297 return $self->{user}->day_phone;
302 my $dob = OpenILS::SIP->format_date($self->{user}->dob, 'dob');
303 syslog('LOG_DEBUG', "OILS: Patron DOB = $dob");
309 my $expire = OpenILS::SIP->format_date($self->{user}->expire_date);
310 syslog('LOG_DEBUG', "OILS: Patron Expire = $expire");
317 my $use_code = OpenILS::SIP->get_option_value('patron_type_uses_code') || '';
319 # should we use the no_i18n version of patron profile name (as a 'code')?
320 return $self->{editor}->retrieve_permission_grp_tree(
321 [$self->{user}->profile->id, {no_i18n => 1}])->name
322 if $use_code =~ /true/io;
324 return OpenILS::SIP::clean_text($self->{user}->profile->name);
329 return '000'; # Unspecified
332 # How much more detail do we need to check here?
333 # sec: adding logic to return false if user is barred, has a circulation block
337 my $u = $self->{user};
339 # compute expiration date for borrowing privileges
340 my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date));
342 # determine whether patron should be allowed to circulate materials:
343 # not barred, doesn't owe too much wrt fines/fees, privileges haven't
345 my $circ_is_blocked =
346 (($u->barred eq 't') or
347 ($u->standing_penalties and @{$u->standing_penalties}) or
348 (CORE::time > $expire->epoch));
351 !$circ_is_blocked and
352 $u->active eq 't' and
353 $u->card->active eq 't';
358 # How much more detail do we need to check here?
361 return $self->charge_ok;
366 return $self->charge_ok if
367 OpenILS::SIP->get_option_value('patron_calculate_recal_ok');
373 return $self->charge_ok;
376 # return true if the card provided is marked as lost
379 return $self->{user}->card->active eq 'f';
382 sub recall_overdue { # not implemented
388 my ($self, $pwd) = @_;
389 syslog('LOG_DEBUG', 'OILS: Patron->check_password()');
390 return 0 unless (defined $pwd and $self->{user});
391 return $U->verify_migrated_user_password(
392 $self->{editor},$self->{user}->id, $pwd);
395 sub currency { # not really implemented
397 syslog('LOG_DEBUG', 'OILS: Patron->currency()');
403 syslog('LOG_DEBUG', 'OILS: Patron->fee_amount()');
404 my $user_id = $self->{user}->id;
406 my $e = $self->{editor};
408 my $summary = $e->retrieve_money_open_user_summary($user_id);
409 $e->rollback; # xact_rollback + disconnect
411 my $total = ($summary) ? $summary->balance_owed : 0;
412 syslog('LOG_INFO', "User ".$self->{id} .":$user_id has a fee amount of \$$total");
418 my $u = $self->{user};
420 return 'barred' if $u->barred eq 't';
424 return $b if $u->active eq 'f';
425 return $b if $u->card->active eq 'f';
427 # if we have any penalties at this point, they are blocking penalties
428 return $b if $u->standing_penalties and @{$u->standing_penalties};
430 # has the patron account expired?
431 my $expire = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($u->expire_date));
432 return $b if CORE::time > $expire->epoch;
437 sub print_line { # not implemented
442 sub too_many_charged { # not implemented
447 sub too_many_overdue {
449 return scalar( # PATRON_EXCEEDS_OVERDUE_COUNT
450 grep { $_->standing_penalty == 2 } @{$self->{user}->standing_penalties}
454 # not completely sure what this means
455 sub too_many_renewal {
460 # not relevant, handled by fines/fees
461 sub too_many_claim_return {
466 # not relevant, handled by fines/fees
472 sub excessive_fines {
474 return scalar( # PATRON_EXCEEDS_FINES
475 grep { $_->standing_penalty == 1 } @{$self->{user}->standing_penalties}
479 # Until someone suggests otherwise, fees and fines are the same
483 return $self->excessive_fines;
486 # not relevant, handled by fines/fees
487 sub too_many_billed {
495 # List of outstanding holds placed
498 my ($self, $start, $end, $ids_only) = @_;
499 syslog('LOG_DEBUG', 'OILS: Patron->hold_items()');
502 # all of my open holds
503 my $holds = $self->{editor}->search_action_hold_request({
504 usr => $self->{user}->id,
505 fulfillment_time => undef,
509 return $holds if $ids_only;
510 return $self->__format_holds($holds, $start, $end);
514 my ($self, $start, $end, $ids_only) = @_;
515 syslog('LOG_DEBUG', 'OILS: Patron->unavail_holds()');
517 my $holds = $self->{editor}->search_action_hold_request({
518 usr => $self->{user}->id,
519 fulfillment_time => undef,
520 cancel_time => undef,
522 {current_shelf_lib => undef},
523 {current_shelf_lib => {'!=' => {'+ahr' => 'pickup_lib'}}}
527 return $holds if $ids_only;
528 return $self->__format_holds($holds, $start, $end);
534 my ($self, $holds, $start, $end) = @_;
536 return [] unless @$holds;
538 my $return_datatype =
539 OpenILS::SIP->get_option_value('msg64_hold_datatype') || '';
543 for my $hold (@$holds) {
545 if ($return_datatype eq 'barcode') {
547 if (my $copy = $self->find_copy_for_hold($hold)) {
548 push(@response, $copy->barcode);
551 syslog('LOG_WARNING',
552 'OILS: No representative copy found for hold ' . $hold->id);
557 OpenILS::SIP::clean_text($self->__hold_to_title($hold)));
561 return (defined $start and defined $end) ?
562 [ @response[($start-1)..($end-1)] ] :
566 # Finds a representative copy for the given hold.
567 # If no copy exists at all, undef is returned.
568 # The only limit placed on what constitutes a
569 # "representative" copy is that it cannot be deleted.
570 # Otherwise, any copy that allows us to find the hold
571 # later is good enough.
572 sub find_copy_for_hold {
573 my ($self, $hold) = @_;
574 my $e = $self->{editor};
576 return $e->retrieve_asset_copy($hold->current_copy)
577 if $hold->current_copy;
579 return $e->retrieve_asset_copy($hold->target)
580 if $hold->hold_type =~ /C|R|F/;
582 return $e->search_asset_copy([
583 {call_number => $hold->target, deleted => 'f'},
584 {limit => 1}])->[0] if $hold->hold_type eq 'V';
586 my $bre_ids = [$hold->target];
588 if ($hold->hold_type eq 'M') {
589 # find all of the bibs that link to the target metarecord
590 my $maps = $e->search_metabib_metarecord_source_map(
591 {metarecord => $hold->target});
592 $bre_ids = [map {$_->record} @$maps];
595 my $vol_ids = $e->search_asset_call_number(
596 {record => $bre_ids, deleted => 'f'},
600 return $e->search_asset_copy([
601 {call_number => $vol_ids, deleted => 'f'},
606 # Given a "representative" copy, finds a matching hold
607 sub find_hold_from_copy {
608 my ($self, $barcode) = @_;
609 my $e = $self->{editor};
612 my $copy = $e->search_asset_copy([
613 {barcode => $barcode, deleted => 'f'},
614 {flesh => 1, flesh_fields => {acp => ['call_number']}}
617 return undef unless $copy;
619 my $run_hold_query = sub {
621 return $e->search_action_hold_request([
622 { usr => $self->{user}->id,
623 cancel_time => undef,
624 fulfillment_time => undef,
628 order_by => {ahr => 'request_time DESC'}
633 # first see if there is a match on current_copy
634 return $hold if $hold =
635 $run_hold_query->(current_copy => $copy->id);
637 # next, assume bib-level holds are the most common
638 return $hold if $hold = $run_hold_query->(
639 target => $copy->call_number->record, hold_type => 'T');
641 # next try metarecord holds
642 my $map = $e->search_metabib_metarecord_source_map(
643 {source => $copy->call_number->record})->[0];
645 return $hold if $hold = $run_hold_query->(
646 target => $map->metarecord, hold_type => 'M');
649 return $hold if $hold = $run_hold_query->(
650 target => $copy->call_number->id, hold_type => 'V');
653 return $run_hold_query->(
654 target => $copy->id, hold_type => ['C', 'F', 'R']);
657 sub __hold_to_title {
660 my $e = $self->{editor};
662 my( $id, $mods, $title, $volume, $copy );
664 return __copy_to_title($e,
665 $e->retrieve_asset_copy($hold->target))
666 if $hold->hold_type eq 'C' or $hold->hold_type eq 'F' or $hold->hold_type eq 'R';
668 return __volume_to_title($e,
669 $e->retrieve_asset_call_number($hold->target))
670 if $hold->hold_type eq 'V';
672 return __record_to_title(
673 $e, $hold->target) if $hold->hold_type eq 'T';
675 return __metarecord_to_title(
676 $e, $hold->target) if $hold->hold_type eq 'M';
679 sub __copy_to_title {
680 my( $e, $copy ) = @_;
681 #syslog('LOG_DEBUG', "OILS: copy_to_title(%s)", $copy->id);
682 return $copy->dummy_title if $copy->call_number == -1;
684 my $vol = (ref $copy->call_number) ?
686 $e->retrieve_asset_call_number($copy->call_number);
688 return __volume_to_title($e, $vol);
692 sub __volume_to_title {
693 my( $e, $volume ) = @_;
694 #syslog('LOG_DEBUG', "OILS: volume_to_title(%s)", $volume->id);
695 return __record_to_title($e, $volume->record);
699 sub __record_to_title {
700 my( $e, $title_id ) = @_;
701 #syslog('LOG_DEBUG', "OILS: record_to_title($title_id)");
702 my $mods = $U->simplereq(
704 'open-ils.search.biblio.record.mods_slim.retrieve', $title_id );
705 return ($mods) ? $mods->title : "";
708 sub __metarecord_to_title {
709 my( $e, $m_id ) = @_;
710 #syslog('LOG_DEBUG', "OILS: metarecord_to_title($m_id)");
711 my $mods = $U->simplereq(
713 'open-ils.search.biblio.metarecord.mods_slim.retrieve', $m_id);
714 return ($U->event_code($mods)) ? "<unknown>" : $mods->title;
719 # remove the hold on item item_id from my hold queue.
720 # return true if I was holding the item, false otherwise.
723 my ($self, $item_id) = @_;
727 sub __patron_items_info {
729 return if $self->{item_info};
731 OpenILS::Application::Actor::_checked_out(
732 0, $self->{editor}, $self->{user}->id);;
738 my ($self, $start, $end, $ids_only) = @_;
740 $self->__patron_items_info();
741 my @overdues = @{$self->{item_info}->{overdue}};
742 #$overdues[$_] = __circ_to_title($self->{editor}, $overdues[$_]) for @overdues;
744 return \@overdues if $ids_only;
747 syslog('LOG_DEBUG', "OILS: overdue_items() fleshing circs @overdues");
749 my $return_datatype = OpenILS::SIP->get_option_value('msg64_summary_datatype') || '';
751 for my $circid (@overdues) {
753 if($return_datatype eq 'barcode') {
754 push( @o, __circ_to_barcode($self->{editor}, $circid));
756 push( @o, OpenILS::SIP::clean_text(__circ_to_title($self->{editor}, $circid)));
761 return (defined $start and defined $end) ?
762 [ @overdues[($start-1)..($end-1)] ] : \@overdues;
765 sub __circ_to_barcode {
768 $circ = $e->retrieve_action_circulation($circ);
769 my $copy = $e->retrieve_asset_copy($circ->target_copy);
770 return $copy->barcode;
773 sub __circ_to_title {
774 my( $e, $circ ) = @_;
776 $circ = $e->retrieve_action_circulation($circ);
777 return __copy_to_title( $e,
778 $e->retrieve_asset_copy($circ->target_copy) );
782 my ($self, $start, $end, $ids_only) = shift;
783 return $self->charged_items_impl($start, $end, undef, $ids_only);
786 # implementation method
787 # force_bc -- return barcode data regardless of msg64_summary_datatype;
788 # this is used by the renew-all code
789 sub charged_items_impl {
790 my ($self, $start, $end, $force_bc, $ids_only) = shift;
792 $self->__patron_items_info();
795 @{$self->{item_info}->{out}},
796 @{$self->{item_info}->{overdue}}
799 #$charges[$_] = __circ_to_title($self->{editor}, $charges[$_]) for @charges;
801 return \@charges if $ids_only;
804 syslog('LOG_DEBUG', "OILS: charged_items() fleshing circs @charges");
806 my $return_datatype = OpenILS::SIP->get_option_value('msg64_summary_datatype') || '';
808 for my $circid (@charges) {
810 if($return_datatype eq 'barcode' or $force_bc) {
811 push( @c, __circ_to_barcode($self->{editor}, $circid));
813 push( @c, OpenILS::SIP::clean_text(__circ_to_title($self->{editor}, $circid)));
819 return (defined $start and defined $end) ?
820 [ @charges[($start-1)..($end-1)] ] :
825 my ($self, $start, $end, $ids_only) = @_;
828 my $xacts = $U->simplereq('open-ils.actor', 'open-ils.actor.user.transactions.history.have_balance', $self->{authtoken}, $self->{user}->id);
829 foreach my $xact (@{$xacts}) {
834 my $line = $xact->balance_owed . " " . $xact->last_billing_type . " ";
835 if ($xact->xact_type eq 'circulation') {
836 my $mods = $U->simplereq('open-ils.circ', 'open-ils.circ.circ_transaction.find_title', $self->{authtoken}, $xact->id);
837 $line .= $mods->title . ' / ' . $mods->author;
839 $line .= $xact->last_billing_note;
841 push @fines, OpenILS::SIP::clean_text($line);
844 my $log_status = $@ ? 'ERROR: ' . $@ : 'OK';
845 syslog('LOG_DEBUG', 'OILS: Patron->fine_items() ' . $log_status);
846 return (defined $start and defined $end) ?
847 [ @fines[($start-1)..($end-1)] ] : \@fines;
850 # not currently supported
852 my ($self, $start, $end, $ids_only) = @_;
857 my ($self, $card_retained, $blocked_card_msg) = @_;
858 $blocked_card_msg ||= '';
860 my $e = $self->{editor};
861 my $u = $self->{user};
863 syslog('LOG_INFO', "OILS: Blocking user %s", $u->card->barcode );
865 return $self if $u->card->active eq 'f';
867 $e->xact_begin; # connect and start a new transaction
869 $u->card->active('f');
870 if( ! $e->update_actor_card($u->card) ) {
871 syslog('LOG_ERR', "OILS: Block card update failed: %s", $e->event->{textcode});
872 $e->rollback; # rollback + disconnect
876 # retrieve the un-fleshed user object for update
877 $u = $e->retrieve_actor_user($u->id);
878 my $note = OpenILS::SIP::clean_text($u->alert_message) || "";
879 $note = "<sip> CARD BLOCKED BY SELF-CHECK MACHINE. $blocked_card_msg</sip>\n$note"; # XXX Config option
880 $note =~ s/\s*$//; # kill trailng whitespace
881 $u->alert_message($note);
883 if( ! $e->update_actor_user($u) ) {
884 syslog('LOG_ERR', "OILS: Block: patron alert update failed: %s", $e->event->{textcode});
885 $e->rollback; # rollback + disconnect
890 $self->{user}->alert_message( $note );
892 $e->commit; # commits and disconnects
896 # Testing purposes only
898 my ($self, $card_retained) = @_;
899 $self->{screen_msg} = "All privileges restored.";
901 # Un-mark card as inactive, grep out the patron alert
902 my $e = $self->{editor};
903 my $u = $self->{user};
905 syslog('LOG_INFO', "OILS: Unblocking user %s", $u->card->barcode );
907 return $self if $u->card->active eq 't';
909 $e->xact_begin; # connect and start a new transaction
911 $u->card->active('t');
912 if( ! $e->update_actor_card($u->card) ) {
913 syslog('LOG_ERR', "OILS: Unblock card update failed: %s", $e->event->{textcode});
914 $e->rollback; # rollback + disconnect
918 # retrieve the un-fleshed user object for update
919 $u = $e->retrieve_actor_user($u->id);
920 my $note = OpenILS::SIP::clean_text($u->alert_message) || "";
921 $note =~ s#<sip>.*</sip>##;
922 $note =~ s/^\s*//; # kill leading whitespace
923 $note =~ s/\s*$//; # kill trailng whitespace
924 $u->alert_message($note);
926 if( ! $e->update_actor_user($u) ) {
927 syslog('LOG_ERR', "OILS: Unblock: patron alert update failed: %s", $e->event->{textcode});
928 $e->rollback; # rollback + disconnect
933 $self->{user}->alert_message( $note );
935 $e->commit; # commits and disconnects
944 return "Please contact library staff";
948 return "Please contact library staff";
951 sub inet_privileges {
953 my $e = OpenILS::SIP->editor();
954 $INET_PRIVS = $e->retrieve_all_config_net_access_level() unless $INET_PRIVS;
955 my ($level) = grep { $_->id eq $self->{user}->net_access_level } @$INET_PRIVS;
956 my $name = OpenILS::SIP::clean_text($level->name);
957 syslog('LOG_DEBUG', "OILS: Patron inet_privs = $name");
963 my $extra_fields = {};
964 my $u = $self->{user};
965 foreach my $stat_cat_entry (@{$u->stat_cat_entries}) {
966 my $stat_cat = $stat_cat_entry->stat_cat;
967 next unless ($stat_cat->sip_field);
968 my $value = $stat_cat_entry->stat_cat_entry;
969 if(defined $stat_cat->sip_format && length($stat_cat->sip_format) > 0) { # Has a format string?
970 if($stat_cat->sip_format =~ /^\|(.*)\|$/) { # Regex match?
971 if($value =~ /($1)/) { # If we have a match
972 if(defined $2) { # Check to see if they embedded a capture group
973 $value = $2; # If so, use it
975 else { # No embedded capture group?
976 $value = $1; # Use our outer one
980 $value = ''; # Empty string. Will be checked for below.
983 else { # Not a regex match - Try sprintf match (looking for a %s, if any)
984 $value = sprintf($stat_cat->sip_format, $value);
987 next unless length($value) > 0; # No value = no export
988 $value =~ s/\|//g; # Remove all lingering pipe chars for sane output purposes
989 $extra_fields->{ $stat_cat->sip_field } = [] unless (defined $extra_fields->{$stat_cat->sip_field});
990 push(@{$extra_fields->{ $stat_cat->sip_field}}, $value);
992 return $extra_fields;