Bugzilla – Attachment 13999 Details for
Bug 9261
Allow librarians to make purchase suggestions for patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9261 - Allow librarians to make purchase suggestions for patrons
Bug-9261---Allow-librarians-to-make-purchase-sugge.patch (text/plain), 11.43 KB, created by
Kyle M Hall
on 2012-12-11 14:46:51 UTC
(
hide
)
Description:
Bug 9261 - Allow librarians to make purchase suggestions for patrons
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-12-11 14:46:51 UTC
Size:
11.43 KB
patch
obsolete
>From e14cf34fcde8da85adc2547339ee1b218e75bd22 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 11 Dec 2012 09:41:04 -0500 >Subject: [PATCH] Bug 9261 - Allow librarians to make purchase suggestions for patrons > >This patch adds a new tab to the patron side menu for purchase suggestions. >From this new tab, a librarian can view the patron's existing purchase suggestios >and also create new suggestions in the name of that patron. > >Test Plan: >1) Apply patch >2) Ensure the system preference 'suggestions' is enabled >3) View the details for a patron >4) Click the new 'Purchase suggestions' tab >5) Click the 'New purchase suggestion' button >6) Add the new purchase suggestions >7) You should now end up back at the borrowers purchase suggetions >8) Verify the new purchase suggestion was added >--- > .../intranet-tmpl/prog/en/includes/circ-menu.inc | 1 + > .../en/modules/members/purchase-suggestions.tt | 107 ++++++++++++++++++++ > .../prog/en/modules/suggestion/suggestion.tt | 1 + > members/purchase-suggestions.pl | 58 +++++++++++ > suggestion/suggestion.pl | 17 +++- > 5 files changed, 180 insertions(+), 4 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt > create mode 100755 members/purchase-suggestions.pl > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >index f2cd877..19b7fbc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >@@ -83,6 +83,7 @@ > [% IF EnableBorrowerFiles %] > [% IF ( borrower_files ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/files.pl?borrowernumber=[% borrowernumber %]">Files</a></li> > [% END %] >+ [% IF ( suggestions ) %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/purchase-suggestions.pl?borrowernumber=[% borrowernumber %]">Purchase suggestions</a></li> > </ul></div> > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt >new file mode 100644 >index 0000000..225ab1d >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt >@@ -0,0 +1,107 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Patrons › >+[% IF ( unknowuser ) %] >+ Patron does not exist >+[% ELSE %] >+ Purchase suggestions for [% INCLUDE 'patron-title.inc' %] >+[% END %] >+</title> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables-strings.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >+[% INCLUDE 'calendar.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> >+<script type="text/javascript"> >+ $(document).ready(function() { >+ $("#suggestions").dataTable($.extend(true, {}, dataTablesDefaults, { >+ 'bPaginate': false, >+ 'bFilter': false, >+ 'bInfo': false, >+ } )); >+ >+ new YAHOO.widget.Button("newsuggestion"); >+ }); >+</script> >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'patron-search.inc' %] >+ >+<div id="breadcrumbs"> >+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> >+› <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> >+› [% IF ( unknowuser ) %]Patron does not exist[% ELSE %]Purchase suggestions for [% firstname %] [% surname %] ([% cardnumber %])[% END %] >+</div> >+ >+<div id="doc3" class="yui-t1"> >+ >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <div class="yui-g"> >+ <h2>Purchase suggestions</h2> >+ >+ <div id="toolbar"> >+ <ul class="toolbar"> >+ <li><a id="newsuggestion" href="/cgi-bin/koha/suggestion/suggestion.pl?op=add&suggestedby=[% borrowernumber %]&redirect=[% borrowernumber %]">New purchase suggestion</a></li> >+ </ul> >+ </div> >+ >+ <table id="suggestions"> >+ <thead> >+ <tr> >+ <th>Summary</th> >+ <th>Note</th> >+ <th>Managed by</th> >+ <th>Status</th> >+ </tr> >+ </thead> >+ >+ <tbody> >+ [% FOREACH s IN suggestions %] >+ <tr> >+ <td> >+ <p><strong>[% s.title |html %]</strong></p> >+ <p> >+ [% IF ( s.author ) %][% s.author %],[% END %] >+ [% IF ( s.copyrightdate ) %] - [% s.copyrightdate %],[% END %] >+ [% IF ( s.publishercode ) %] - [% s.publishercode %][% END %] >+ [% IF ( s.place ) %]([% s.place %])[% END %] >+ [% IF ( s.collectiontitle ) %] , [% s.collectiontitle %][% END %] >+ [% IF ( s.itemtype ) %] - [% s.itemtype %][% END %] >+ </p> >+ </td> >+ <td>[% s.note %] >+ <td> >+ [% IF ( s.surnamemanagedby ) %] >+ [% s.surnamemanagedby %] >+ [% IF ( s.firstnamemanagedby ) %],[% END %] >+ [% s.firstnamemanagedby %] >+ [% ELSE %] >+ >+ [% END %] >+ </td> >+ <td> >+ [% IF ( s.ASKED ) %]Requested[% END %] >+ [% IF ( s.CHECKED ) %]Checked by the library[% END %] >+ [% IF ( s.ACCEPTED ) %]Accepted by the library[% END %] >+ [% IF ( s.ORDERED ) %]Ordered by the library[% END %] >+ [% IF ( s.REJECTED ) %]Suggestion declined [% END %] >+ [% IF ( s.AVAILABLE ) %]Available in the library[% END %] >+ [% IF ( s.reason ) %]([% s.reason %])[% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </div> >+ </div> >+ </div> >+<div class="yui-b"> >+[% INCLUDE 'circ-menu.inc' %] >+</div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >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 fb73fd1..756e591 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -260,6 +260,7 @@ $(document).ready(function() { calcNewsuggTotal(); }); > <div class="yui-b"> > [% IF ( op_save ) %] > <form id="add_edit" action="suggestion.pl" method="post"> >+ <input type="hidden" name="redirect" id="redirect" value="[% redirect %]" /> > [% IF ( suggestionid ) %] > <h1>Edit purchase suggestion #[% suggestionid %]</h1> > <input type="hidden" name="suggestionid" value="[% suggestionid %]"/> >diff --git a/members/purchase-suggestions.pl b/members/purchase-suggestions.pl >new file mode 100755 >index 0000000..8a55075 >--- /dev/null >+++ b/members/purchase-suggestions.pl >@@ -0,0 +1,58 @@ >+#!/usr/bin/perl >+ >+# Copyright 2012 ByWater Solutions >+# >+# This file is part of Koha. >+# >+# 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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, >+# Suite 330, Boston, MA 02111-1307 USA >+ >+use Modern::Perl; >+ >+use CGI; >+use C4::Auth; >+use C4::Context; >+use C4::Output; >+use C4::Branch; >+use C4::Members; >+use C4::Suggestions; >+ >+my $input = new CGI; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { template_name => "members/purchase-suggestions.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { borrowers => 1 }, >+ debug => 1, >+ } >+); >+ >+my $borrowernumber = $input->param('borrowernumber'); >+ >+# Set informations for the patron >+my $borrower = GetMemberDetails( $borrowernumber, 0 ); >+foreach my $key ( keys %$borrower ) { >+ $template->param( $key => $borrower->{$key} ); >+} >+$template->param( >+ categoryname => $borrower->{'description'}, >+ branchname => GetBranchName( $borrower->{'branchcode'} ), >+); >+ >+my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } ); >+ >+$template->param( suggestions => $suggestions ); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 99f38eb..70b0fd6 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -74,6 +74,7 @@ sub GetCriteriumDesc{ > } > > my $input = CGI->new; >+my $redirect = $input->param('redirect'); > my $suggestedbyme = (defined $input->param('suggestedbyme')? $input->param('suggestedbyme'):1); > my $op = $input->param('op')||'else'; > my @editsuggestions = $input->param('edit_field'); >@@ -130,6 +131,11 @@ if ( $op =~ /save/i ) { > } > map{delete $$suggestion_ref{$_}} keys %$suggestion_ref; > $op = 'else'; >+ >+ if( $redirect ) { >+ print $input->redirect("/cgi-bin/koha/members/purchase-suggestions.pl?borrowernumber=$redirect"); >+ } >+ > } > elsif ($op=~/add/) { > #Adds suggestion >@@ -348,10 +354,8 @@ for ( my $i = 0 ; $i < $count ; $i++ ) { > $line{selected} = 1 if ($line{'currcode'} eq $selected_currency); > push @loop_currency, \%line; > } >- >-$template->param(loop_currency => \@loop_currency); >- > $template->param( >+ loop_currency => \@loop_currency, > price => sprintf("%.2f", $$suggestion_ref{'price'}||0), > total => sprintf("%.2f", $$suggestion_ref{'total'}||0), > ); >@@ -369,5 +373,10 @@ foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { > $hashlists{ lc($field) . "_loop" } = \@codes_list; > } > $template->param(%hashlists); >-$template->param(DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),); >+ >+$template->param( >+ %hashlists, >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >+ borrowernumber => $input->param('borrowernumber'), >+); > output_html_with_http_headers $input, $cookie, $template->output; >-- >1.7.2.5
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 9261
:
13999
|
14612
|
14675
|
14677
|
16602
|
16603
|
20002
|
20003
|
20007
|
20008
|
20806
|
22843
|
22897
|
22898
|
22899
|
22900
|
22901
|
22902
|
22903