From 63e3eb4174586b89b392e4966f380256ab226810 Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Wed, 13 Dec 2017 15:14:58 +1300 Subject: [PATCH] Bug 19801 - Display messages on user details page as well as on Check Out page To test: Look up a borrower, add a message (internal or opac) Click the Details tab for that borrower Messages should be displayed above the user information [is this the right place? it could go below] adding messages on this page should make them immediately available deleting messages on this page should delete them immediately and bring you back to the detail page. Basically, make sure messages work from both the Check out and detail pages and that there are no typos. Messages should work the same as they always have from the Check Out page. sponsored-by: Catalyst IT Signed-off-by: Simon Pouchol Signed-off-by: Marjorie Vila Signed-off-by: Alex Arnaud --- circ/del_message.pl | 9 +++++-- .../prog/en/modules/members/moremember.tt | 28 ++++++++++++++++++++-- members/moremember.pl | 14 +++++++++++ 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/circ/del_message.pl b/circ/del_message.pl index ccce661..8dfa3d4 100755 --- a/circ/del_message.pl +++ b/circ/del_message.pl @@ -43,5 +43,10 @@ my $message_id = $input->param('message_id'); my $message = Koha::Patron::Messages->find($message_id); $message->delete if $message; -print $input->redirect( - "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); +if ( $input->param('from') eq "moremember" ) { + print $input->redirect( + "/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); +} else { + print $input->redirect( + "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 180d941..a0fe938 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -41,6 +41,7 @@ var relatives_borrowernumbers = new Array(); [% END %] var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); +var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) %] @@ -190,6 +191,31 @@ function validate1(date) { [% END %] +
+

Messages:

+
    + [% FOREACH patron_message IN patron_messages %] +
  • + [% IF(patron_message.message_type == "L") %] + + [% ELSE %] + + [% END %] + [% patron_message.message_date | $KohaDates %] + [% Branches.GetName( patron_message.branchcode ) %] + [% IF patron_message.manager_id %] + ( [% patron_message.get_column('manager_firstname') %] [% patron_message.get_column('manager_surname') %] ) + [% END %] + "[% patron_message.message | html %]" + + [% IF patron_message.branchcode == branchcode OR Koha.Preference('AllowAllMessageDeletion') %] + Delete + [% END %] +
  • + [% END %] +
+ Add a new message +
[% IF ( flagged ) %]
@@ -217,7 +243,6 @@ function validate1(date) {
[% END %] -

[% UNLESS ( I ) %] [% title | html %] [% firstname | html %] [% END %] [% surname | html %] ([% cardnumber | html %])

@@ -500,7 +525,6 @@ function validate1(date) {
-
  • [% issuecount %] Checkout(s)
  • diff --git a/members/moremember.pl b/members/moremember.pl index faae4d7..1bf4d22 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -54,6 +54,7 @@ use Koha::AuthorisedValues; use Koha::CsvProfiles; use Koha::Patron::Debarments qw(GetDebarments); use Koha::Patron::Images; +use Koha::Patron::Messages; use Module::Load; if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) { load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber ); @@ -331,6 +332,18 @@ if ( C4::Context->preference("ExportCircHistory") ) { $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]); } +my $patron_messages = Koha::Patron::Messages->search( + { + 'me.borrowernumber' => $borrowernumber, + }, + { + join => 'manager', + '+select' => ['manager.surname', 'manager.firstname' ], + '+as' => ['manager_surname', 'manager_firstname'], + } +); + + # Display the language description instead of the code # Note that this is certainly wrong my ( $subtag, $region ) = split '-', $patron->lang; @@ -359,6 +372,7 @@ $template->param( PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20, relatives_issues_count => $relatives_issues_count, relatives_borrowernumbers => \@relatives, + patron_messages => $patron_messages, ); output_html_with_http_headers $input, $cookie, $template->output; -- 2.7.4