Bugzilla – Attachment 154545 Details for
Bug 25816
Add OPAC messages in SIP display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25816: Add opac messages in SIP display.
Bug-25816-Add-opac-messages-in-SIP-display.patch (text/plain), 3.44 KB, created by
Matthias Meusburger
on 2023-08-17 11:34:51 UTC
(
hide
)
Description:
Bug 25816: Add opac messages in SIP display.
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2023-08-17 11:34:51 UTC
Size:
3.44 KB
patch
obsolete
>From 9a3686fd9af5eac1584725b943321514e5a1b94f Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Wed, 11 Sep 2019 11:39:31 +0200 >Subject: [PATCH] Bug 25816: Add opac messages in SIP display. > >Test plan: > > - Add one or more opac messages to a patron > (patron detail -> add message -> Add a message for: OPAC) > > - Check that the messages will be displayed, with correctly formatted dates. > >You can use src/C4/SIP/interactive_patron_dump.pl for easier testing. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/SIP/ILS/Patron.pm | 17 +++++++++++++++++ > t/db_dependent/SIP/Patron.t | 29 ++++++++++++++++++++++++++++- > 2 files changed, 45 insertions(+), 1 deletion(-) > >diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm >index 4b3e76f1a8..7e7746b576 100644 >--- a/C4/SIP/ILS/Patron.pm >+++ b/C4/SIP/ILS/Patron.pm >@@ -28,6 +28,8 @@ use Koha::Libraries; > use Koha::Patrons; > use Koha::Checkouts; > use Koha::TemplateUtils qw( process_tt ); >+use Koha::Patron::Messages; >+use Koha::DateUtils qw(dt_from_string output_pref); > > our $kp; # koha patron > >@@ -164,6 +166,21 @@ sub new { > } > } > } >+ my $patron_messages = Koha::Patron::Messages->search( >+ { >+ borrowernumber => $kp->{borrowernumber}, >+ message_type => 'B', >+ } >+ ); >+ my @messages_array; >+ while ( my $message = $patron_messages->next ) { >+ my $messagedt = dt_from_string( $message->message_date, 'iso' ); >+ my $formatted_date = output_pref({ dt => $messagedt, dateonly => 1}); >+ push @messages_array, $formatted_date . ": " . $message->message; >+ } >+ if (@messages_array) { >+ $ilspatron{screen_msg} .= ". Messages for you: " . join(' / ', @messages_array); >+ } > > # FIXME: populate fine_items recall_items > $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber}); >diff --git a/t/db_dependent/SIP/Patron.t b/t/db_dependent/SIP/Patron.t >index d7e86eb444..56cafc0fe0 100755 >--- a/t/db_dependent/SIP/Patron.t >+++ b/t/db_dependent/SIP/Patron.t >@@ -4,7 +4,7 @@ > # This needs to be extended! Your help is appreciated.. > > use Modern::Perl; >-use Test::More tests => 10; >+use Test::More tests => 11; > > use t::lib::Mocks; > use t::lib::TestBuilder; >@@ -405,3 +405,30 @@ subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest "Patron messages tests" => sub { >+ plan tests => 1; >+ $schema->storage->txn_begin; >+ my $today = output_pref({ dt => dt_from_string(), dateonly => 1}); >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $library = $builder->build_object ({ class => 'Koha::Libraries' }); >+ my $new_message_1 = Koha::Patron::Message->new( >+ { borrowernumber => $patron->id, >+ branchcode => $library->branchcode, >+ message_type => 'B', >+ message => 'my message 1', >+ })->store; >+ >+ my $new_message_2 = Koha::Patron::Message->new( >+ { borrowernumber => $patron->id, >+ branchcode => $library->branchcode, >+ message_type => 'B', >+ message => 'my message 2', >+ })->store; >+ >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); >+ like( $sip_patron->screen_msg, qr/Messages for you: $today: my message 1 \/ $today: my message 2/,"Screen message includes patron messages"); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
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 25816
:
106060
|
139688
|
154545
|
155592
|
155596