Bugzilla – Attachment 143961 Details for
Bug 21699
Allow circulation messages to be editable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21699: Allow circulation messages to be editable
Bug-21699-Allow-circulation-messages-to-be-editabl.patch (text/plain), 11.87 KB, created by
Kyle M Hall
on 2022-11-16 17:03:55 UTC
(
hide
)
Description:
Bug 21699: Allow circulation messages to be editable
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2022-11-16 17:03:55 UTC
Size:
11.87 KB
patch
obsolete
>From 5ef018fa3c0063f7b5c83ad273e06024c13b2c8d Mon Sep 17 00:00:00 2001 >From: Kyle Hall <kyle@bywatersolutions.com> >Date: Tue, 8 Nov 2022 15:10:07 -0500 >Subject: [PATCH] Bug 21699: Allow circulation messages to be editable > >During a Webinar discussion regarding the new placement of the circulation messages appearing in the Patron Detail page. It was commented by a librarian that it would be nice to have the circulation messages editable. At times libraries need to keep a specific message on a patrons account with the details such as what branch it was written from and the staff member that wrote it, but it would be nice to be able to edit this message. > >Test Plan: >1) Apply this patch >2) Restart all the things! >3) Browser to a patron record >4) Create a new patron message >5) Note the patron message now has an "edit" button >6) Edit the existing message using the edit button and form >7) Check the action logs for that message, note there is a modification > logged to that message if BorrowersLog is enabled >--- > Koha/Patron/Message.pm | 9 +++- > circ/add_message.pl | 23 +++++---- > .../prog/en/includes/patron_messages.inc | 47 ++++++++++++++++++- > .../admin/preferences/circulation.pref | 2 +- > .../prog/en/modules/tools/viewlog.tt | 3 +- > 5 files changed, 70 insertions(+), 14 deletions(-) > >diff --git a/Koha/Patron/Message.pm b/Koha/Patron/Message.pm >index fa4473d220..ccba93a0d6 100644 >--- a/Koha/Patron/Message.pm >+++ b/Koha/Patron/Message.pm >@@ -53,8 +53,13 @@ sub store { > $self->manager_id( $userenv ? $userenv->{number} : undef ); > } > >- C4::Log::logaction( "MEMBERS", "ADDCIRCMESSAGE", $self->borrowernumber, $self->message ) >- if C4::Context->preference("BorrowersLog"); >+ if ( C4::Context->preference("BorrowersLog") ) { >+ if ( $self->in_storage ) { >+ C4::Log::logaction( "MEMBERS", "MODCIRCMESSAGE", $self->borrowernumber, $self->message ) >+ } else { >+ C4::Log::logaction( "MEMBERS", "ADDCIRCMESSAGE", $self->borrowernumber, $self->message ) >+ } >+ } > > return $self->SUPER::store($self); > } >diff --git a/circ/add_message.pl b/circ/add_message.pl >index ee90af3522..37fb2d14bc 100755 >--- a/circ/add_message.pl >+++ b/circ/add_message.pl >@@ -35,20 +35,27 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+my $message_id = $input->param('message_id'); > my $borrowernumber = $input->param('borrowernumber'); > my $branchcode = $input->param('branchcode'); > my $message_type = $input->param('message_type'); > my $borrower_message = $input->param('borrower_message'); > my $batch = $input->param('batch'); > >-Koha::Patron::Message->new( >- { >- borrowernumber => $borrowernumber, >- branchcode => $branchcode, >- message_type => $message_type, >- message => $borrower_message, >- } >-)->store; >+if ($message_id) { >+ my $message = Koha::Patron::Messages->find($message_id); >+ $message->update( { message => $borrower_message } ) if $message; >+} >+else { >+ Koha::Patron::Message->new( >+ { >+ borrowernumber => $borrowernumber, >+ branchcode => $branchcode, >+ message_type => $message_type, >+ message => $borrower_message, >+ } >+ )->store; >+} > > my $url = $input->referer; > if ( $url ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >index db9c3430fc..27f945c8d4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc >@@ -311,9 +311,11 @@ > </span> > [% IF patron_message.branchcode == Branches.GetLoggedInBranchcode OR Koha.Preference('AllowAllMessageDeletion') %] > [% IF moremember %] >- <a class="btn btn-link delete_message" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&borrowernumber=[% patron_message.borrowernumber | html %]&from=moremember"><i class="fa fa-trash"></i> Delete</a> >+ <a id="#edit_message_form_[% patron_message.message_id | html %]" class="btn btn-link edit_message" href="#edit_message_form_[% patron_message.message_id | uri %]" data-target="#edit_message_form_[% patron_message.message_id | html %]" data-toggle="modal" class="btn btn-default"><i class="fa fa-edit"></i> Edit</a> >+ <a class="btn btn-link delete_message" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&borrowernumber=[% patron_message.borrowernumber | html %]&from=moremember"><i class="fa fa-trash"></i> Delete</a> > [% ELSE %] >- <a class="btn btn-link delete_message" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&borrowernumber=[% patron_message.borrowernumber | html %]"><i class="fa fa-trash"></i> Delete</a> >+ <a id="#edit_message_form_[% patron_message.message_id | html %]" class="btn btn-link edit_message" href="#edit_message_form_[% patron_message.message_id | uri %]" data-target="#edit_message_form_[% patron_message.message_id | html %]" data-toggle="modal" class="btn btn-default"><i class="fa fa-edit"></i> Edit</a> >+ <a class="btn btn-link delete_message" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&borrowernumber=[% patron_message.borrowernumber | html %]"><i class="fa fa-trash"></i> Delete</a> > [% END %] > [% END %] > </li> >@@ -321,4 +323,45 @@ > </ul> > <a id="addnewmessageLabel" href="#add_message_form" class="btn btn-link" data-toggle="modal"><i class="fa fa-plus"></i> Add a new message</a> > </div> <!-- /#messages --> >+ >+ [% FOREACH pm IN patron_messages %] >+ <div id="edit_message_form_[% pm.message_id | html %]" class="modal" tabindex="-1" role="dialog" aria-labelledby="#edit_message_form_[% patron_message.message_id | html %]" aria-hidden="true"> >+ <div class="modal-dialog"> >+ <div class="modal-content"> >+ <form method="post" action="/cgi-bin/koha/circ/add_message.pl" id="message_form" name="message_f"> >+ <input type="hidden" name="message_id" value="[% pm.message_id | html %]"/> >+ <div class="modal-header"> >+ <h3>Edit message</h3> >+ </div> >+ <div class="modal-body"> >+ <div class="form-group"> >+ <label for="message_type">Message is for:</label> >+ <select name="message_type" id="message_type" disabled> >+ [% IF pm.message_type == "L" %] >+ <option value="L" selected="selected">Staff - Internal note</option> >+ [% ELSE %] >+ <option value="L">Staff - Internal note</option> >+ [% END %] >+ >+ [% IF pm.message_type == "B" %] >+ <option value="B" selected="selected">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option> >+ [% ELSE %] >+ <option value="B">OPAC - [% patron.firstname | html %] [% patron.surname | html %]</option> >+ [% END %] >+ </select> >+ </div> >+ <div class="form-group"> >+ <textarea rows="3" class="modal-textarea" name="borrower_message" id="borrower_message" >[% pm.message | html %]</textarea> >+ </div> >+ </div> >+ <div class="modal-footer"> >+ <button class="btn btn-default approve" type="submit"><i class="fa fa-check"></i> Save</button> >+ <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> Cancel</button> >+ </div> >+ </form> >+ </div> >+ </div> >+ </div> >+ [% END %] >+ > [% END # /IF patron_messages %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index e025fc6e9d..307e96e330 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -79,7 +79,7 @@ Circulation: > choices: > 1: Allow > 0: "Don't allow" >- - staff to delete messages added from other libraries. >+ - staff to edit and delete messages added from other libraries. > - > - Show the > - pref: numReturnedItemsToShow >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >index 9bf9f915e1..b672b6c308 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt >@@ -119,6 +119,7 @@ > [% CASE 'RENEWAL' %]<span>Renew</span> > [% CASE 'CHANGE PASS' %]<span>Change password</span> > [% CASE 'ADDCIRCMESSAGE' %]<span>Add circulation message</span> >+[% CASE 'MODCIRCMESSAGE' %]<span>Modify circulation message</span> > [% CASE 'DELCIRCMESSAGE' %]<span>Delete circulation message</span> > [% CASE 'STATUS_CHANGE' %]<span>Change ILL request status</span> > [% CASE 'PATRON_NOTICE' %]<span>ILL notice sent to patron</span> >@@ -243,7 +244,7 @@ > <label for="actionALL" class="viewlog"><input type="checkbox" id="actionALL" name="actions" value=""> All</label> > [% END %] > >- [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'FILL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'Run' 'End' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' 'ADD_BASKET' 'MODIFY_BASKET' 'MODIFY_BASKET_HEADER' 'MODIFY_BASKET_USERS' 'CLOSE_BASKET' 'APPROVE_BASKET' 'REOPEN_BASKET' 'CANCEL_ORDER' 'CREATE_ORDER' 'MODIFY_ORDER' 'CREATE_INVOICE_ADJUSTMENT' 'UPDATE_INVOICE_ADJUSTMENT' 'DELETE_INVOICE_ADJUSTMENT' 'RECEIVE_ORDER' 'MODIFY_BUDGET' 'MODIFY_FUND' 'CREATE_FUND' 'DELETE_FUND' 'OVERDUE' 'EXPIRE' ] %] >+ [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'FILL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'MODCIRCMESSAGE' 'DELCIRCMESSAGE' 'STATUS_CHANGE' 'PATRON_NOTICE' 'CHANGE PASS' 'Run' 'End' 'EDIT_MAPPINGS' 'RESET_MAPPINGS' 'ADD_BASKET' 'MODIFY_BASKET' 'MODIFY_BASKET_HEADER' 'MODIFY_BASKET_USERS' 'CLOSE_BASKET' 'APPROVE_BASKET' 'REOPEN_BASKET' 'CANCEL_ORDER' 'CREATE_ORDER' 'MODIFY_ORDER' 'CREATE_INVOICE_ADJUSTMENT' 'UPDATE_INVOICE_ADJUSTMENT' 'DELETE_INVOICE_ADJUSTMENT' 'RECEIVE_ORDER' 'MODIFY_BUDGET' 'MODIFY_FUND' 'CREATE_FUND' 'DELETE_FUND' 'OVERDUE' 'EXPIRE' ] %] > [% IF actions.grep(actx).size %] > <label for="action[% actx| replace('\s+', '_') | html %]" class="viewlog"><input type="checkbox" id="action[% actx | replace('\s+', '_') | html %]" name="actions" value="[% actx | html %]" checked="checked"> [% PROCESS translate_log_action action=actx %]</label> > [% ELSE %] >-- >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 21699
:
143959
|
143960
|
143961
|
143962
|
146316
|
149644