Bugzilla – Attachment 100223 Details for
Bug 24819
Add ability for librarians to choose a patron when entering a purchase suggestion
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24819: Allow the librarian to choose a patron when entering a purchase suggestion
Bug-24819-Allow-the-librarian-to-choose-a-patron-w.patch (text/plain), 10.62 KB, created by
Matthias Meusburger
on 2020-03-06 09:20:59 UTC
(
hide
)
Description:
Bug 24819: Allow the librarian to choose a patron when entering a purchase suggestion
Filename:
MIME Type:
Creator:
Matthias Meusburger
Created:
2020-03-06 09:20:59 UTC
Size:
10.62 KB
patch
obsolete
>From 58da46abeeb0f667c078b319794f2c82cc9a1628 Mon Sep 17 00:00:00 2001 >From: Matthias Meusburger <matthias.meusburger@biblibre.com> >Date: Thu, 5 Mar 2020 16:41:25 +0100 >Subject: [PATCH] Bug 24819: Allow the librarian to choose a patron when > entering a purchase suggestion > >Sometimes librarians are creating purchase suggestions that came from patrons >which didn't use the opac (but sent an email, or told the librarian verbally...) > >This patch allows the librarian to change the creator of the purchase suggestion >when entering it. > >This way, the patron will be able to receive notifications during the purchase >suggestion workflow. > >Test plan: > > - Apply the patch > > - Check that you can change the default creator of the purchase suggestion when > creating a new suggestion by clicking on 'Set to patron' > (Home > Acquisitions > Suggestions management > New purchase suggestion) > > - Check that you can also change the creator of the purchase suggestion when > editing an existing suggestion >--- > .../prog/en/modules/suggestion/suggestion.tt | 9 ++-- > .../modules/suggestion/tables/suggestion_search.tt | 36 ++++++++++++++ > koha-tmpl/intranet-tmpl/prog/js/suggestions.js | 17 +++++++ > suggestion/suggestion_search.pl | 57 ++++++++++++++++++++++ > 4 files changed, 116 insertions(+), 3 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/tables/suggestion_search.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/suggestions.js > create mode 100755 suggestion/suggestion_search.pl > >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 66e6d94..3e3a806 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -363,23 +363,26 @@ > </li> > [% END %] > <li><table> >- <thead><tr><th> </th><th>Date</th><th>By</th></tr></thead> >+ <thead><tr><th> </th><th>Date</th><th>By</th><th>Action</th></tr></thead> > <tbody> > <tr> > <th><label for="suggesteddate">[% tp('purchase suggestion created by', 'Created by:') | html %]</label> </th> > <td><input type="text" id="suggesteddate" name="suggesteddate" class="datepicker" size="10" maxlength="10" value="[% suggesteddate | $KohaDates %]"/>[% INCLUDE 'date-format.inc' %]</td> >- <td><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %] >+ <td id="tdsuggestedby"><input type="hidden" id="suggestedby" name="suggestedby" value="[% suggestedby | html %]"/>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber | uri %]">[% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %] > </td> >+ <td><a href="#" id="suggestion_search" class="btn btn-default">Set to patron</a></td> > </tr> > <tr> > <th><label for="managedon">Managed by:</label> </th> > <td><input type="text" id="managedon" name="manageddate" class="datepicker" size="10" maxlength="10" value="[% manageddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td> > <td><input type="hidden" id="managedby" name="managedby" value="[% managedby | html %]"/>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber | uri %]">[% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %])[% END %]</td> >+ <td></td> > </tr> > <tr> > <th><label for="accepteddate">Accepted on:</label> </th> > <td><input type="text" id="accepteddate" name="accepteddate" class="datepicker" size="10" maxlength="10" value="[% accepteddate | $KohaDates %]" />[% INCLUDE 'date-format.inc' %]</td> > <td><input type="hidden" id="acceptedby" name="acceptedby" value="[% acceptedby | html %]"/>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber | uri %]">[% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %])</a> [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])[% END %]</td> >+ <td></td> > </tr> > </tbody> > </table></li></ol> >@@ -990,6 +993,6 @@ > [% END %] > [% Asset.js("js/acq.js") | $raw %] > [% Asset.js("js/acquisitions-menu.js") | $raw %] >+ [% Asset.js("js/suggestions.js") | $raw %] > [% END %] >- > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/tables/suggestion_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/tables/suggestion_search.tt >new file mode 100644 >index 0000000..a82f0e8 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/tables/suggestion_search.tt >@@ -0,0 +1,36 @@ >+[% USE raw %] >+[% USE To %] >+[% USE Branches %] >+[% USE KohaDates %] >+{ >+ "sEcho": [% sEcho | html %], >+ "iTotalRecords": [% iTotalRecords | html %], >+ "iTotalDisplayRecords": [% iTotalDisplayRecords | html %], >+ "aaData": [ >+ [% FOREACH data IN aaData %] >+ { >+ "dt_cardnumber": >+ "[% data.cardnumber | html %]", >+ "dt_name": >+ "[% INCLUDE 'patron-title.inc' borrowernumber = data.borrowernumber category_type = data.category_type firstname = data.firstname surname = data.surname othernames = data.othernames cardnumber = data.cardnumber invert_name = 1%]", >+ "dt_dateofbirth": >+ "[% data.dateofbirth | $KohaDates %]", >+ "dt_address": >+ "[% INCLUDE escape_address data=data %]", >+ "dt_action": >+ "<a href=\"#\" class=\"btn btn-default btn-xs select_user\" data-borrowernumber=\"[% data.borrowernumber | html %]\">Select</a><input type=\"hidden\" id=\"borrower_data[% data.borrowernumber | html %]\" name=\"borrower_data[% data.borrowernumber | html %]\" value=\"[% To.json(data) | html %]\" />" >+ }[% UNLESS loop.last %],[% END %] >+ [% END %] >+ ] >+} >+[% BLOCK escape_address %] >+[%~ SET address = data.streetnumber _ ' ' %] >+[%~ IF data.address %][% SET address = address _ data.address _ ' ' %][% END %] >+[%~ IF data.address2 %][% SET address = address _ data.address2 _ ' ' %][% END %] >+[%~ IF data.city %][% SET address = address _ data.city _ ' ' %][% END %] >+[%~ IF data.state %][% SET address = address _ data.state _ ' ' %][% END %] >+[%~ IF data.zipcode %][% SET address = address _ data.zipcode _ ' ' %][% END %] >+[%~ IF data.country %][% SET address = address _ data.country _ ' ' %][% END %] >+[%~ SET address = address _ Branches.GetName( data.branchcode ) %] >+[%~ To.json( address ) | $raw ~%] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/suggestions.js b/koha-tmpl/intranet-tmpl/prog/js/suggestions.js >new file mode 100644 >index 0000000..613e967 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/suggestions.js >@@ -0,0 +1,17 @@ >+function select_user(borrowernumber, borrower) { >+ var suggested = '<input type="hidden" id="suggestedby" name="suggestedby" value="' + borrowernumber + '" />'; >+ suggested += '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=' + borrowernumber + '">'; >+ suggested += borrower.surname + ', ' + borrower.firstname + ' (' + borrower.cardnumber + ')'; >+ suggested += '</a> '; >+ suggested += borrower.branchname + ' (' + borrower.category_description + ')'; >+ $("#tdsuggestedby").html(suggested); >+ return 0; >+} >+ >+$(document).ready(function(){ >+ $('body').on('click', '#suggestion_search', function(e) { >+ e.preventDefault(); >+ var newin = window.open('suggestion_search.pl','popup','width=600,height=400,resizable=no,toolbar=false,scrollbars=yes,top'); >+ }); >+ >+}); >diff --git a/suggestion/suggestion_search.pl b/suggestion/suggestion_search.pl >new file mode 100755 >index 0000000..24e33b7 >--- /dev/null >+++ b/suggestion/suggestion_search.pl >@@ -0,0 +1,57 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright 2020 BibLibre >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+use C4::Auth; >+use C4::Output; >+use C4::Members; >+ >+use Koha::Patron::Categories; >+ >+my $input = new CGI; >+ >+my $dbh = C4::Context->dbh; >+ >+my ( $template, $loggedinuser, $cookie, $staff_flags ) = get_template_and_user( >+ { template_name => "common/patron_search.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { suggestions => 'suggestions_manage' }, >+ } >+); >+ >+my $q = $input->param('q') || ''; >+my $op = $input->param('op') || ''; >+ >+my $referer = $input->referer(); >+ >+my $patron_categories = Koha::Patron::Categories->search_limited; >+$template->param( >+ view => ( $input->request_method() eq "GET" ) ? "show_form" : "show_results", >+ columns => ['cardnumber', 'name', 'dateofbirth', 'address', 'action' ], >+ json_template => 'suggestion/tables/suggestion_search.tt', >+ selection_type => 'select', >+ alphabet => ( C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ), >+ categories => $patron_categories, >+ aaSorting => 1, >+); >+output_html_with_http_headers( $input, $cookie, $template->output ); >-- >2.7.4
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 24819
:
100223
|
100281
|
101583
|
101716
|
101788
|
101789
|
103197
|
103198
|
103199