[% 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 %]
--- /dev/null
+[% 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' %]
<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 %]"/>
--- /dev/null
+#!/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;
}
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');
}
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
$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),
);
$hashlists{ lc($field) . "_loop" } = \@codes_list;
}
$template->param(%hashlists);
+
$template->param(
+ %hashlists,
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+ borrowernumber => $input->param('borrowernumber'),
SuggestionStatuses => GetAuthorisedValues('SUGGEST_STATUS'),
);
output_html_with_http_headers $input, $cookie, $template->output;