diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 64ef4f6817..391926b06c 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -191,6 +191,26 @@ sub AUTOLOAD { } } +sub name { + my ( $self, $template ) = @_; + + if ($template) { + require Template; + require Koha::Patrons; + + my $tt = Template->new(); + + my $patron = Koha::Patrons->find( $self->{borrowernumber} ); + + my $output; + $tt->process( \$template, { patron => $patron }, \$output ); + return $output; + } + else { + return $self->{name}; + } +} + sub check_password { my ( $self, $pwd ) = @_; diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index f3815cf92b..dded51e22c 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -420,7 +420,7 @@ sub build_patron_status { $resp .= patron_status_string($patron); $resp .= $lang . timestamp(); - $resp .= add_field( FID_PERSONAL_NAME, $patron->name ); + $resp .= add_field( FID_PERSONAL_NAME, $patron->name( $server->{account}->{ae_field_template} ) ); # while the patron ID we got from the SC is valid, let's # use the one returned from the ILS, just in case... @@ -948,7 +948,7 @@ sub handle_patron_info { # while the patron ID we got from the SC is valid, let's # use the one returned from the ILS, just in case... $resp .= add_field( FID_PATRON_ID, $patron->id ); - $resp .= add_field( FID_PERSONAL_NAME, $patron->name ); + $resp .= add_field( FID_PERSONAL_NAME, $patron->name( $server->{account}->{ae_field_template} ) ); # TODO: add code for the fields # hold items limit @@ -1246,7 +1246,7 @@ sub handle_patron_enable { $resp .= $patron->language . timestamp(); $resp .= add_field( FID_PATRON_ID, $patron->id ); - $resp .= add_field( FID_PERSONAL_NAME, $patron->name ); + $resp .= add_field( FID_PERSONAL_NAME, $patron->name( $server->{account}->{ae_field_template} ) ); if ( defined($patron_pwd) ) { $resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $patron->check_password($patron_pwd) ) ); } diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index 80f667e30f..f51f0938b5 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -51,6 +51,7 @@