@@ -, +, @@
arbitrary SIP2 fields
Make a least one repeatable.
are at least two instances of the repeatable code
patron_status_request messages for the patron
corrosponding fields!
---
C4/SIP/ILS/Patron.pm | 31 +++++++++++++++++++++++++++++++
C4/SIP/Sip/MsgType.pm | 6 ++++++
etc/SIPconfig.xml | 1 +
3 files changed, 38 insertions(+)
--- a/C4/SIP/ILS/Patron.pm
+++ a/C4/SIP/ILS/Patron.pm
@@ -15,6 +15,8 @@ use Carp;
use Sys::Syslog qw(syslog);
use Data::Dumper;
+use C4::SIP::Sip qw(add_field);
+
use C4::Debug;
use C4::Context;
use C4::Koha;
@@ -447,6 +449,35 @@ sub _get_outstanding_holds {
return \@hold_array;
}
+sub build_patron_attributes_string {
+ my ( $self, $server ) = @_;
+
+ my $string = q{};
+
+ if ( $server->{account}->{patron_attribute} ) {
+ my @attributes_to_send =
+ ref $server->{account}->{patron_attribute} eq "ARRAY"
+ ? @{ $server->{account}->{patron_attribute} }
+ : $server->{account}->{patron_attribute};
+
+ foreach my $a ( @attributes_to_send ) {
+ my @attributes = Koha::Patron::Attributes->search(
+ {
+ borrowernumber => $self->{borrowernumber},
+ code => $a->{code}
+ }
+ );
+
+ foreach my $attribute ( @attributes ) {
+ my $value = $attribute->attribute();
+ $string .= add_field( $a->{field}, $value );
+ }
+ }
+ }
+
+ return $string;
+}
+
1;
__END__
--- a/C4/SIP/Sip/MsgType.pm
+++ a/C4/SIP/Sip/MsgType.pm
@@ -19,6 +19,8 @@ use Data::Dumper;
use CGI qw ( -utf8 );
use C4::Auth qw(&check_api_auth);
+use Koha::Patron::Attributes;
+
use UNIVERSAL::can;
use vars qw(@ISA @EXPORT_OK);
@@ -443,6 +445,8 @@ sub build_patron_status {
if ( $server->{account}->{send_patron_home_library_in_af} );
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line );
+ $resp .= $patron->build_patron_attributes_string( $server );
+
} else {
# Invalid patron (cardnumber)
# Report that the user has no privs.
@@ -1006,6 +1010,8 @@ sub handle_patron_info {
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server);
}
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line );
+
+ $resp .= $patron->build_patron_attributes_string( $server );
} else {
# Invalid patron ID:
--- a/etc/SIPconfig.xml
+++ a/etc/SIPconfig.xml
@@ -54,6 +54,7 @@
av_field_template="[% accountline.description %] [% accountline.amountoutstanding | format('%.2f') %]" >
+
--