From 2ca6d76e6feaf6f7508566fddfdb8636a5fa5f80 Mon Sep 17 00:00:00 2001 From: Jonathan Druart <jonathan.druart@biblibre.com> Date: Wed, 22 Feb 2012 15:30:38 +0100 Subject: [PATCH 1/1] Bug 7577: Adds a display page for suggestions --- .../prog/en/modules/acqui/neworderempty.tt | 2 +- .../prog/en/modules/acqui/orderreceive.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 4 +- .../prog/en/modules/suggestion/suggestion.tt | 141 ++++++++++++++++++-- suggestion/suggestion.pl | 17 ++- 5 files changed, 148 insertions(+), 18 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt index a27d151..e6464f2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -326,7 +326,7 @@ $(document).ready(function() <ol> <li> <span class="label">Suggested by: </span> - [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]">suggestion #[% suggestionid %]</a>) + [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]&op=show">suggestion #[% suggestionid %]</a>) </li> </ol> </fieldset> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index e238278..3eb3e23 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -42,7 +42,7 @@ <ol> <li> <span class="label">Suggested by: </span> - [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]">suggestion #[% suggestionid %]</a>) + [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]&op=show">suggestion #[% suggestionid %]</a>) </li> </ol> </fieldset> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt index afc9b65..786c5be 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -244,7 +244,7 @@ [% IF ( loop_order.suggestionid ) %] <br/> Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %] - (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]">suggestion #[% loop_order.suggestionid %]</a>) + (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&op=show">suggestion #[% loop_order.suggestionid %]</a>) [% END %] </td> <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> @@ -369,7 +369,7 @@ [% IF ( loop_receive.suggestionid ) %] <br/> Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %] - (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]">suggestion #[% loop_receive.suggestionid %]</a>) + (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&op=show">suggestion #[% loop_receive.suggestionid %]</a>) [% END %] </td> <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> 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 47ee96a..1f72e4f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -1,5 +1,19 @@ -[% INCLUDE 'doc-head-open.inc' %]<title>Koha › Acquisitions › -[% IF ( op_save ) %][% IF ( suttesionid ) %]Edit purchase suggestion #[% suggestionid %][% ELSE %]Enter a new purchase suggestion[% END %][% ELSE %]Suggestions Management[% END %]</title> +[% INCLUDE 'doc-head-open.inc' %] +<title>Koha › Acquisitions › + [% IF ( op_save ) %] + [% IF ( suggestionid) %] + [% IF ( op == 'show' ) %] + Show purchase suggestion #[% suggestionid %] + [% ELSE %] + Edit purchase suggestion #[% suggestionid %] + [% END %] + [% ELSE %] + Enter a new purchase suggestion + [% END %] + [% ELSE %] + Suggestions Management + [% END %] +</title> [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] [% IF ( op_else ) %] <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> @@ -91,7 +105,114 @@ $(document).ready(function() { calcNewsuggTotal(); }); <body> [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] -<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › [% IF ( op_save ) %] <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> › [% IF ( suggestionid ) %]Suggestion edit #[% suggestionid %][% ELSE %]New purchase suggestion[% END %][% ELSE %]Suggestions Management[% END %] </div> +<div id="breadcrumbs"> + <a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › + [% IF ( op_save ) %] + <a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a> › + [% IF ( op == 'show' ) %] + Show suggestion #[% suggestionid %] + [% ELSE %] + Suggestion edit #[% suggestionid %] + [% END %] + [% ELSE %] + Suggestions Management + [% END %] +</div> + +[% IF ( op == 'show' ) %] +<div id="doc" class="yui-t7"> <!-- <div id="doc3" class="yui-t2"> --> +<div id="bd"> + <div id="yui-main"> + <div class="yui-b"> + + <fieldset class="rows"> + <legend>Bibliographic information</legend> + <ol> + <li><label for="title">Title:</label>[% title |html %]</li> + <li><label for="author">Author:</label>[% author %]</li> + <li><label for="copyrightdate">Copyright date:</label>[% copyrightdate %]</li> + <li><label for="isbn">ISBN or ISSN or other standard number:</label>[% isbn %]</li> + <li><label for="publishercode">Publisher:</label>[% publishercode %]</li> + <li><label for="place">Publication Place:</label>[% place %]</li> + <li><label for="collectiontitle">Collection Title:</label>[% collectiontitle %]</li> + <li><label for="itemtype">Document Type:</label> + [% FOREACH itemtypeloo IN itemtypeloop %] + [% IF ( itemtypeloo.selected ) %][% itemtypeloo.description %][% END %] + [% END %] + </li> + [% IF ( patron_reason_loop ) %] + <li><label for="patronreason">Reason for suggestion: </label> + [% FOREACH patron_reason_loo IN patron_reason_loop %] + [% IF ( patron_reason_loo.selected ) %][% patron_reason_loo.lib %][% END %] + [% END %] + </li> + [% END %] + <li><label for="note">Notes:</label>[% note %]</li> + </ol> + </fieldset> + <fieldset class="rows"> <legend>Suggestion management</legend> + <ol> + <li> + <label for="status">Status:</label> + [% IF ( STATUS == 'ASKED' ) %]Pending + [% ELSIF ( STATUS == 'ACCEPTED' ) %]Accepted + [% ELSIF ( STATUS == 'CHECKED' ) %]Checked + [% ELSIF ( STATUS == 'REJECTED' ) %]Rejected + [% ELSE %]No Status + [% END %] + </li> + <li> + <table> + <thead><tr><th> </th><th>Date</th><th>By</th></tr></thead> + <tbody> + <tr> + <th><label for="suggesteddate">Suggestion creation</label> </th> + <td>[% suggesteddate %]</td> + <td>[% IF ( suggestedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% suggestedby_borrowernumber %]">[% suggestedby_surname %], [% suggestedby_firstname %]</a> [% suggestedby_branchcode %] ([% suggestedby_description %])[% END %] + </td> + </tr> + <tr> + <th><label for="managedon">Suggestion management</label> </th> + <td>[% manageddate %]</td> + <td>[% IF ( managedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% managedby_borrowernumber %]">[% managedby_surname %], [% managedby_firstname %]</a> [% managedby_branchcode %] ([% managedby_description %])[% END %]</td> + </tr> + <tr> + <th><label for="accepteddate">Suggestion Accepted</label> </th> + <td>[% accepteddate %]</td> + <td>[% IF ( acceptedby_borrowernumber ) %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% acceptedby_borrowernumber %]">[% acceptedby_surname %], [% acceptedby_firstname %]</a> [% acceptedby_branchcode %] ([% acceptedby_description %])[% END %]</td> + </tr> + </tbody> + </table></li></ol> + </fieldset> + <fieldset class="rows"> <legend>Acquisition information</legend> + <ol> + <li> + <label for="branchcode">Library:</label> [% branchname %] + </li> + <li> + <label for="budget">Budget:</label> [% budgetname %] + </li> + <li> + <label for="quantity">Copies:</label>[% quantity %] + </li> + <li> + <label for="currency">Currency:</label>[% currency %] + </li> + <li> + <label for="price">Price:</label>[% price %] + </li> + <li> + <label for="total">Total</label>[% total %] + </li> + </ol> + </fieldset> + + <a class="cancel" href="suggestion.pl"><<Back to the list</a> + + </div> + </div> +</div> +[% END %] [% IF ( op_save ) %]<div id="doc" class="yui-t7">[% ELSE %]<div id="doc3" class="yui-t2">[% END %] <div id="bd"> @@ -189,7 +310,7 @@ $(document).ready(function() { calcNewsuggTotal(); }); <input type="text" readonly="readonly" id="total" name="total" size="10" value="[% total %]"/> </li></ol> </fieldset><input type="hidden" id="returnsuggested" name="returnsuggested" value="[% IF ( returnsuggestedby ) %][% returnsuggestedby %][% ELSE %]noone[% END %]"/> - <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl?suggestionid=[% suggestionid %][% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %] + <fieldset class="action"><input type="hidden" name="op" value="[% op %]" />[% IF ( suggestionid ) %]<input type="submit" value="Save" /> <a class="cancel" href="[% IF ( returnsuggestedby ) %]/cgi-bin/koha/members/moremember.pl?borrowernumber=[% returnsuggestedby %]#suggestions[% ELSE %]suggestion.pl?suggestionid=[% suggestionid %]&op=show[% END %]">Cancel</a>[% ELSE %]<input type="submit" value="Submit Your Suggestion" /> <a class="cancel" href="suggestion.pl">Cancel</a>[% END %] </fieldset> </form> [% END %] @@ -245,9 +366,9 @@ $(document).ready(function() { calcNewsuggTotal(); }); <input type="checkbox" name="edit_field" value="[% suggestions_loo.suggestionid %]" /> </td> <td> - <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&op=edit" title="suggestion" > - [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %] - </a> + <a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&op=show" title="suggestion" > + [% suggestions_loo.title |html %][% IF ( suggestions_loo.author ) %], by [% suggestions_loo.author %][% END %]</a> + [<a href="suggestion.pl?suggestionid=[% suggestions_loo.suggestionid %]&op=edit" title="suggestion" >edit</a>] <br /> [% IF ( suggestions_loo.copyrightdate ) %]© [% suggestions_loo.copyrightdate %] [% END %] [% IF ( suggestions_loo.volumedesc ) %]; Volume:<i>[% suggestions_loo.volumedesc %]</i> [% END %] @@ -314,7 +435,7 @@ $(document).ready(function() { calcNewsuggTotal(); }); </div> </div> - [% UNLESS ( op_save ) %] <div class="yui-b"> + [% UNLESS ( op_save ) %] [% UNLESS ( op == 'show' ) %]<div class="yui-b"> <form name="suggestionfilter" action="suggestion.pl" method="get"> <fieldset class="brief"><ol style="display:block;"><li><label for="displayby">Organize by: </label> <select name="displayby" id="displayby" style="width:auto;"> @@ -458,7 +579,9 @@ $(document).ready(function() { calcNewsuggTotal(); }); </fieldset> </div> </form> - </div>[% END %] + </div> + [% END %] + [% END %] </div> [% INCLUDE 'intranet-bottom.inc' %] diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 272ca6f..64f00d4 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -34,13 +34,13 @@ use C4::Debug; sub Init{ my $suggestion= shift @_; - foreach my $date qw(suggesteddate manageddate){ + foreach my $date ( qw(suggesteddate manageddate) ){ $suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")? $suggestion->{$date}=C4::Dates->today: format_date($suggestion->{$date}) ); } - foreach my $date qw(rejecteddate accepteddate){ + foreach my $date ( qw(rejecteddate accepteddate) ){ $suggestion->{$date}=(($suggestion->{$date} eq "0000-00-00" ||$suggestion->{$date} eq "")? "": format_date($suggestion->{$date}) @@ -173,6 +173,13 @@ elsif ($op eq "change" ) { } $op = 'else'; } +elsif ( $op eq 'show' ) { + $suggestion_ref=&GetSuggestion($$suggestion_ref{'suggestionid'}); + $$suggestion_ref{branchname} = GetBranchName $$suggestion_ref{branchcode}; + my $budget = GetBudget $$suggestion_ref{budgetid}; + $$suggestion_ref{budgetname} = $$budget{budget_name}; + Init($suggestion_ref); +} if ($op=~/else/) { $op='else'; @@ -193,7 +200,7 @@ if ($op=~/else/) { my $budget = GetBudget($suggestion->{budgetid}); $suggestion->{budget_name}=$budget->{budget_name} if $budget; } - foreach my $date qw(suggesteddate manageddate accepteddate){ + foreach my $date ( qw(suggesteddate manageddate accepteddate) ){ if ($suggestion->{$date} ne "0000-00-00" && $suggestion->{$date} ne "" ){ $suggestion->{$date}=format_date($suggestion->{$date}) ; } else { @@ -219,7 +226,7 @@ if ($op=~/else/) { ); } -foreach my $element qw(managedby suggestedby acceptedby) { +foreach my $element ( qw(managedby suggestedby acceptedby) ) { # $debug || warn $$suggestion_ref{$element}; if ($$suggestion_ref{$element}){ my $member=GetMember(borrowernumber=>$$suggestion_ref{$element}); @@ -333,7 +340,7 @@ $template->param( ); my %hashlists; -foreach my $field qw(managedby acceptedby suggestedby budgetid) { +foreach my $field ( qw(managedby acceptedby suggestedby budgetid) ) { my $values_list; $values_list=GetDistinctValues("suggestions.".$field) ; my @codes_list = map{ -- 1.7.7.3