@@ -, +, @@ patrons --- .../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 | 14 ++- 5 files changed, 178 insertions(+), 3 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt create mode 100755 members/purchase-suggestions.pl --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -83,6 +83,7 @@ [% IF EnableBorrowerFiles %] [% IF ( borrower_files ) %]
  • [% ELSE %]
  • [% END %]Files
  • [% END %] + [% IF ( suggestions ) %]
  • [% ELSE %]
  • [% END %]Purchase suggestions
  • [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/purchase-suggestions.tt @@ -0,0 +1,107 @@ +[% INCLUDE 'doc-head-open.inc' %] +Koha › Patrons › +[% IF ( unknowuser ) %] + Patron does not exist +[% ELSE %] + Purchase suggestions for [% INCLUDE 'patron-title.inc' %] +[% END %] + + +[% INCLUDE 'doc-head-close.inc' %] + +[% INCLUDE 'datatables-strings.inc' %] + +[% INCLUDE 'calendar.inc' %] + + + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'patron-search.inc' %] + + + +
    + +
    +
    +
    +
    +

    Purchase suggestions

    + + + + + + + + + + + + + + + [% FOREACH s IN suggestions %] + + + + + + [% END %] + +
    SummaryNoteManaged byStatus
    +

    [% s.title |html %]

    +

    + [% 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 %] +

    +
    [% s.note %] + + [% IF ( s.surnamemanagedby ) %] + [% s.surnamemanagedby %] + [% IF ( s.firstnamemanagedby ) %],[% END %] + [% s.firstnamemanagedby %] + [% ELSE %] +   + [% END %] + + [% 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 %] +
    +
    +
    +
    +
    +[% INCLUDE 'circ-menu.inc' %] +
    +
    +[% INCLUDE 'intranet-bottom.inc' %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -296,6 +296,7 @@ h4.local_collapse a { font-size : 80%; text-decoration: none; } fieldset.brief o
    [% IF ( op_save ) %]
    + [% IF ( suggestionid ) %]

    Edit purchase suggestion #[% suggestionid %]

    --- a/members/purchase-suggestions.pl +++ a/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; --- a/suggestion/suggestion.pl +++ a/suggestion/suggestion.pl @@ -77,6 +77,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'); @@ -132,6 +133,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 @@ -362,10 +368,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), ); @@ -386,7 +390,11 @@ foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { $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; --