From efa3525c8df4650ae057a8d8e61e6200b0c461f0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Nov 2019 19:05:05 +0100 Subject: [PATCH] Bug 23590: Add ability to edit the manager of a suggestion MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Prior to this patch there was an hidden behavior that set the manager to the logged in user when a suggestion was edited. This patch proposes to let the librarian pick another manager. Other small adjustements will be added to polish this new behavior: * Create 2 new DB columns: suggestions.lastmodificationby and suggestion.lastmodificationdate * Choose a manager when editing a suggestion * Batch modify suggestions and set a manager for them * Let notify the new manager using the TO_PROCESS letter * Display the manageddate, lastmodificationby and lastmodificationdate info where appropriate This first patch adds a new "Select manager" link when editing a suggestion. Test plan for the whole patchset: 0/ a. Execute the update DB entry, generate the new DBIC file and restart all b. Create at least 2 patrons with the suggestions_manage permission 1/ Submit a new suggestion (OPAC or staff, not important) 2/ Accept it 3/ Edit it => "Last modification by" is empty => You see that you are the manager of this suggestion 4/ Click "Select manager" and search for a new manager => The patron search will only display patrons with the suggestions_manage permission 5/ Save 6/ Edit again => The manager is set to you, but there is a note saying that previously it was the patron you picked => The "Last modification by" is set to you 7/ Click "Keep existing manager" => The manager is now set to the previous manager 8/ Select another manager (which has a valid email address defined) 9/ Click the "notify" checkbox 10/ Save 11/ Confirm that a TO_PROCESS notice has been generated into the message_queue table 12/ Create at least one other suggestion 13/ List the suggestions => There is a 4th action column to assign a manager to several suggestions in one go. 14/ Use this new button and confirm that it works as expected 15/ Go to your purchase suggestion list (OPAC and staff) => You see the "managed date" displayed in a new column Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Séverine QUEUNE Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- .../prog/en/modules/suggestion/suggestion.tt | 68 +++++++++++++++++-- suggestion/suggestion.pl | 3 +- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 66e6d940c7..09bc0534bc 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -371,18 +371,36 @@ [% IF ( suggestedby_borrowernumber ) %][% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %]) [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %] - - - [% INCLUDE 'date-format.inc' %] - [% IF ( managedby_borrowernumber ) %][% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %]) [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])[% END %] - [% INCLUDE 'date-format.inc' %] [% IF ( acceptedby_borrowernumber ) %][% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %]) [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])[% END %] - + + +
  • + + [% INCLUDE 'date-format.inc' %] +
  • +
  • + +
    + + You + + [% IF managedby_borrowernumber && logged_in_user.borrowernumber != managedby_borrowernumber %] + | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %]) + [% END %] +
    + Select manager + [% IF managedby_borrowernumber && logged_in_user.borrowernumber != managedby_borrowernumber %] + Keep existing manager + [% END %] + +
    +
  • +
    Acquisition information
    1. @@ -962,6 +980,27 @@ [% END %] [% IF ( op_save ) %] [% END %] diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 365e1d1c75..723ccecaad 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -154,7 +154,7 @@ if ( $op =~ /save/i ) { $suggestion_only->{ lc( $suggestion_only->{"STATUS"}) . "by" } = C4::Context->userenv->{number}; } $suggestion_only->{manageddate} = dt_from_string; - $suggestion_only->{"managedby"} = C4::Context->userenv->{number}; + $suggestion_only->{"managedby"} ||= C4::Context->userenv->{number}; } my $otherreason = $input->param('other_reason'); @@ -334,6 +334,7 @@ foreach my $element ( qw(managedby suggestedby acceptedby) ) { my $patron = Koha::Patrons->find( $$suggestion_ref{$element} ); my $category = $patron->category; $template->param( + $element."_patron"=> $patron, $element."_borrowernumber"=>$patron->borrowernumber, $element."_firstname"=>$patron->firstname, $element."_surname"=>$patron->surname, -- 2.39.5