Bugzilla – Attachment 52641 Details for
Bug 3669
Create a template for circ/add_message.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 3669: Moving 'Add a new message' into a pop up box and adding to patron toolbar
Bug-3669-Moving-Add-a-new-message-into-a-pop-up-bo.patch (text/plain), 13.71 KB, created by
Jonathan Druart
on 2016-06-21 11:40:16 UTC
(
hide
)
Description:
Bug 3669: Moving 'Add a new message' into a pop up box and adding to patron toolbar
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-06-21 11:40:16 UTC
Size:
13.71 KB
patch
obsolete
>From 9d19fe6c7d68d8ae2d5e6b21b579f10a453c3e35 Mon Sep 17 00:00:00 2001 >From: Aleisha <aleishaamohia@hotmail.com> >Date: Thu, 24 Mar 2016 00:28:42 +0000 >Subject: [PATCH] Bug 3669: Moving 'Add a new message' into a pop up box and > adding to patron toolbar >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch moves all the code into an include which can be accessed from the 'Add a new message' link or the patron toolbar. > >EDIT: Ensuring modal opens on all pages >EDIT2: Once the form has been submitted the page will redirect to where you submitted the form from. >EDIT3: Fixing indentation of member-add-message.inc > Ensuring messages save on every page > Fill branch > Ensure predefined notes appear > Form redirects to where it was submitted from, or just the circulation page. >EDIT4: Removing the new include file and moving it all into the modal in the toolbar >EDIT5: Removing swp file and unnecessary code duplication by utilising plugins >EDIT6: Batch checkout fixes >EDIT7: Ensure you do not get JS error from Comment 24 (Batch checkout syspref must be turned on) > >To test: >1) Go to a patron circ page (circ/circulation.pl?borrowernumber=X) >2) Click 'Add a new message' under Messages >3) Confirm this brings up the modal to add a message. Confirm clicking Save saves your message. If it is an OPAC message (for the user), confirm it shows as expected on the OPAC. >4) Click Cancel. Confirm this closes the modal. >5) Click 'Add message' button in toolbar. Complete steps 3 and 4. >6) Confirm the modal opens from all other pages with the members toolbar. Confirm predefined notes shows. > circ/circulation.pl > members/moremember.pl > members/routing-lists.pl > members/statistics.pl > members/boraccount.pl > members/pay.pl > members/maninvoice.pl > members/mancredit.pl > members/readingrec.pl > members/notices.pl > members/member-flags.pl > members/member-password.pl > members/paycollect.pl > members/files.pl > turn on BatchCheckouts syspref and put in appropriate patron category > circ/circulation.pl?borrowernumber=X&batch=1 >7) Confirm that the page redirects to where you submitted the form from once you have submitted it. >8) Go to Check Out tab and confirm your message saved (or OPAC, wherever you saved it) > >Sponsored-by: Catalyst IT > >Followed test plan, works as expected. (Re-tested for comment #24) >Signed-off-by: Marc Véron <veron@veron.ch> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > circ/add_message.pl | 4 +- > circ/circulation.pl | 5 --- > .../prog/en/includes/members-toolbar.inc | 45 ++++++++++++++++++++++ > .../prog/en/modules/circ/circulation.tt | 39 +------------------ > .../en/modules/circ/circulation_batch_checkouts.tt | 4 +- > .../prog/en/modules/members/moremember.tt | 1 - > .../intranet-tmpl/prog/js/pages/circulation.js | 2 - > members/readingrec.pl | 1 - > members/routing-lists.pl | 1 - > 9 files changed, 50 insertions(+), 52 deletions(-) > >diff --git a/circ/add_message.pl b/circ/add_message.pl >index 317f34b..aee65a1 100755 >--- a/circ/add_message.pl >+++ b/circ/add_message.pl >@@ -51,5 +51,5 @@ Koha::Patron::Message->new( > } > )->store; > >-print $input->redirect( >- "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"); >+my $url = $input->referer() // "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber"; >+print $input->redirect($url); >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 3057370..b4d454d 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -658,15 +658,10 @@ $template->param( > my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber}); > $template->param( picture => 1 ) if $patron_image; > >-# get authorised values with type of BOR_NOTES >- >-my $canned_notes = GetAuthorisedValues("BOR_NOTES"); >- > $template->param( > debt_confirmed => $debt_confirmed, > SpecifyDueDate => $duedatespec_allow, > CircAutocompl => C4::Context->preference("CircAutocompl"), >- canned_bor_notes_loop => $canned_notes, > debarments => GetDebarments({ borrowernumber => $borrowernumber }), > todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ), > modifications => Koha::Patron::Modifications->GetModifications({ borrowernumber => $borrowernumber }), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >index b7e7178..75cb6bc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc >@@ -1,5 +1,7 @@ > [% USE Koha %] > [% USE Borrowers %] >+[% USE Branches %] >+[% USE AuthorisedValues %] > [% SET NorwegianPatronDBEnable = Koha.Preference( 'NorwegianPatronDBEnable' ) %] > <script type="text/javascript"> > //<![CDATA[ >@@ -170,6 +172,8 @@ function searchToHold(){ > <a id="searchtohold" class="btn btn-small" href="#"><i class="fa fa-search"></i> Search to hold</a> > [% END %] > >+ <a id="addnewmessageLabel" href="#add_message_form" data-toggle="modal" class="btn btn-small"><i class="fa fa-comment-o"></i> Add message</a> >+ > <div class="btn-group"> > <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">More <span class="caret"></span></button> > <ul class="dropdown-menu"> >@@ -212,3 +216,44 @@ function searchToHold(){ > </ul> > </div> > </div> >+ >+<!-- Modal --> >+<div id="add_message_form" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="addnewmessageLabel" aria-hidden="true"> >+ <div class="modal-body"> >+ <form method="post" action="/cgi-bin/koha/circ/add_message.pl" id="message_form" name="message_f"> >+ <fieldset id="borrower_messages" class="brief"> >+ <legend>Leave a message</legend> >+ <ol> >+ <li> >+ <label for="message_type">Add a message for:</label> >+ <select name="message_type" id="message_type"> >+ <option value="L">Staff - Internal note</option> >+ <option value="B">OPAC - [% firstname %] [% surname %]</option> >+ </select> >+ </li> >+ [% bor_notes = AuthorisedValues.Get( 'BOR_NOTES' ) %] >+ [% IF bor_notes %] >+ <li> >+ <label for="type">Predefined notes: </label> >+ <select name="type" id="type" onchange="this.form.borrower_message.value=this.options[this.selectedIndex].value;"> >+ <option value="">Select note</option> >+ [% FOREACH bor_note IN bor_notes %] >+ <option value="[% bor_note.lib %]">[% bor_note.lib %]</option> >+ [% END %] >+ </select> >+ </li> >+ [% END %] >+ <li> >+ <textarea rows="3" cols="60" name="borrower_message" id="borrower_message" ></textarea> >+ </li> >+ </ol> >+ <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >+ <input type="hidden" name="branchcode" value="[% LoginBranchcode %]" /> >+ </fieldset> >+ </div> >+ <div class="modal-footer"> >+ <fieldset class="action"> >+ <input type="submit" value="Save" /> </form><a href="#" class="cancel" data-dismiss="modal" aria-hidden="true">Cancel</a> >+ </fieldset> >+ </div> >+</div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index f8666bd..439fec7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -47,7 +47,6 @@ var relatives_borrowernumbers = new Array(); > relatives_borrowernumbers.push("[% b %]"); > [% END %] > >-var MSG_ADD_MESSAGE = _("Add a new message"); > 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."); > >@@ -140,43 +139,6 @@ $(document).ready(function() { > [% END %] > > <!-- INITIAL BLOC : PARAMETERS & BORROWER INFO --> >-<div style="display: none;" id="add_message_form"> >-<form method="post" action="/cgi-bin/koha/circ/add_message.pl" id="message_form" name="message_f"> >-<fieldset id="borrower_messages" class="brief"> >-<legend>Leave a message</legend> >- <ol> >- <li> >- <label for="message_type">Add a message for:</label> >- <select name="message_type" id="message_type"> >- <option value="L">Staff - Internal note</option> >- <option value="B">OPAC - [% firstname %] [% surname %]</option> >- </select> >- </li> >- [% IF ( canned_bor_notes_loop ) %] >- <li> >- <label for="type">Predefined notes: </label> >- <select name="type" id="type" onchange="this.form.borrower_message.value=this.options[this.selectedIndex].value;"> >- <option value="">Select note</option> >- [% FOREACH canned_bor_notes_loo IN canned_bor_notes_loop %] >- <option value="[% canned_bor_notes_loo.lib %]">[% canned_bor_notes_loo.lib %]</option> >- [% END %] >- </select> >- </li> >- [% END %] >- <li> >- <textarea rows="3" cols="60" name="borrower_message" id="borrower_message" ></textarea> >- </li> >- </ol> >- <fieldset class="action"> >- <input type="submit" value="Save" /> <a href="#" class="cancel">Cancel</a> >- </fieldset> >- >- <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >- <input type="hidden" name="branchcode" value="[% branch %]" /> >-</fieldset> >-</form> >-</div> >- > [% IF ( was_renewed ) %]<div class="dialog message">Patron's account has been renewed until [% expiry | $KohaDates %]</div>[% END %] > > [% IF additional_materials %] >@@ -876,6 +838,7 @@ No patron matched <span class="ex">[% message %]</span> > [% END %]</li> > [% END %] > </ul> >+ <a id="addnewmessageLabel" href="#add_message_form" data-toggle="modal">Add a new message</a> > </div> > > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt >index 614fdbb..e36dfc0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt >@@ -79,7 +79,7 @@ $(document).ready(function() { > [% END %] > </div> > [% ELSIF borrower and not checkout_infos %] >- <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/circulation.pl"> >+ <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrowernumber %]&batch=1"> > <fieldset id="circ_circulation_issue"> > <label for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label> > <fieldset class="rows"> >@@ -110,7 +110,7 @@ $(document).ready(function() { > [% ELSIF borrower %] > [% IF confirmation_needed && CAN_user_circulate_force_checkout %] > <h3>Batch checkout confirmation [% IF borrowernumber %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] [% END %]</h3> >- <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off"> >+ <form method="post" action="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% borrowernumber %]" id="mainform" name="mainform" autocomplete="off"> > [% ELSE %] > <h3>Batch checkout information [% IF borrowernumber %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] [% END %]</h3> > [% END %] >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 80a80a9..2213a7c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -42,7 +42,6 @@ var relatives_borrowernumbers = new Array(); > relatives_borrowernumbers.push("[% b %]"); > [% END %] > >-var MSG_ADD_MESSAGE = _("Add a new message"); > var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); > > columns_settings = [% ColumnsSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >index 2d85c81..d1481ee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js >@@ -14,8 +14,6 @@ $(document).ready(function() { > } > }); > >- $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+MSG_ADD_MESSAGE+"</a>"); >- > $("#borrower_messages .cancel").on("click",function(){ > $("#add_message_form").hide(); > $("#addmessage").show(); >diff --git a/members/readingrec.pl b/members/readingrec.pl >index 79351ff..35a1ad4 100755 >--- a/members/readingrec.pl >+++ b/members/readingrec.pl >@@ -119,7 +119,6 @@ if (C4::Context->preference('ExtendedPatronAttributes')) { > ); > } > >- > $template->param(%$data); > > $template->param( >diff --git a/members/routing-lists.pl b/members/routing-lists.pl >index c8377db..8c6d3ac 100755 >--- a/members/routing-lists.pl >+++ b/members/routing-lists.pl >@@ -88,7 +88,6 @@ if ($borrowernumber) { > > ################################################################################## > >- > $template->param(%$borrower); > > $template->param( >-- >2.8.1
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 3669
:
49497
|
49610
|
49714
|
49716
|
49833
|
50044
|
50047
|
50100
|
50976
|
51353
|
51374
|
52277
| 52641 |
52642
|
52796