Bug 7166: Adds edit order notes when the basket is closed
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 19 Mar 2012 14:50:01 +0000 (15:50 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 20 Mar 2012 15:45:37 +0000 (16:45 +0100)
 When you are on parcel.pl or basket.pl you can now add or edit a note
 for each order.

 To test:
 Create orders with and without note.
 Edit/Add the note on basket.pl page

 Close the basket.
 Check you can add/edit the order note on parcel.pl page

+ From Owen:
Correcting markup issues with modordernotes.pl:

- Adding "rows" and "cols" attributes to <textarea> (required)
- Converting cancel button to link to stay consistent with
  other pages
- Changing page layout to fixed & centered (not sidebar needed)
- Expanding information in breadcrumbs to match information
  on basket.pl

Changing markup around note add and edit links: Moving output
of order note to the end of the table cell, putting it in its
own paragraph, and adding a "Note:" label

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
C4/Acquisition.pm
acqui/modordernotes.pl [new file with mode: 0755]
acqui/neworderempty.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt

index 0a96a02..15a68ea 100644 (file)
@@ -714,8 +714,9 @@ sub GetPendingOrders {
     my $dbh = C4::Context->dbh;
     my $strsth = "
         SELECT    ".($grouped?"count(*),":"")."aqbasket.basketno,
-                    surname,firstname,aqorders.*,biblio.*,biblioitems.isbn,
-                    aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname
+                    surname,firstname,biblio.*,biblioitems.isbn,
+                    aqbasket.closedate, aqbasket.creationdate, aqbasket.basketname,
+                    aqorders.*
         FROM      aqorders
         LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno
         LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber
diff --git a/acqui/modordernotes.pl b/acqui/modordernotes.pl
new file mode 100755 (executable)
index 0000000..ffdc9f6
--- /dev/null
@@ -0,0 +1,82 @@
+#!/usr/bin/perl
+
+# Copyright 2011 BibLibre SARL
+# 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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+=head1 NAME
+
+modordernotes.pl
+
+=head1 DESCRIPTION
+
+Modify just notes when basket is closed.
+
+=cut
+
+use Modern::Perl;
+
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Acquisition;
+use C4::Bookseller qw( GetBookSellerFromId);
+
+my $input = new CGI;
+my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
+    template_name   => 'acqui/modordernotes.tmpl',
+    query           => $input,
+    type            => 'intranet',
+    authnotrequired => 0,
+    flagsrequired   => { 'acquisition' => '*' },
+    debug           => 1,
+} );
+
+my $op = $input->param('op');
+my $ordernumber = $input->param('ordernumber');
+my $referrer = $input->param('referrer') || $input->referer();
+
+my $order = GetOrder($ordernumber);
+my $basket = GetBasket($order->{basketno});
+my ($bookseller) = GetBookSellerFromId($basket->{booksellerid});
+
+
+if($op and $op eq 'save') {
+    my $ordernotes = $input->param('ordernotes');
+    $order->{'notes'} = $ordernotes;
+    ModOrder($order);
+    print $input->redirect($referrer);
+    exit;
+} else {
+    $template->param(
+        ordernotes => $order->{'notes'},
+    );
+}
+
+if($op) {
+    $template->param($op => 1);
+}
+
+$template->param(
+    basketname           => $basket->{'basketname'},
+    basketno             => $order->{basketno},
+    booksellerid         => $bookseller->{'id'},
+    booksellername       => $bookseller->{'name'},
+    ordernumber => $ordernumber,
+    referrer => $referrer,
+);
+
+
+output_html_with_http_headers $input, $cookie, $template->output;
index 7fee382..1e33a1a 100755 (executable)
@@ -123,6 +123,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
 );
 
 my $marcflavour = C4::Context->preference('marcflavour');
+
+if(!$basketno) {
+    my $order = GetOrder($ordernumber);
+    $basketno = $order->{'basketno'};
+}
+
 my $basket = GetBasket($basketno);
 my $contract = &GetContract($basket->{contractnumber});
 
index 88578b2..bad45e0 100644 (file)
                         <td>
                             <p>[% IF ( books_loo.order_received ) %] (rcvd)[% END %]
                                 <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% books_loo.biblionumber %]">[% books_loo.title |html %]</a> by [% books_loo.author %]
-                                    [% IF ( books_loo.notes ) %] [% books_loo.notes %][% END %]
-                                    [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %]
-                                    [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %]
-                                    [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %]
-                                    [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear %][% END %]
-                                    [% IF ( books_loo.suggestionid ) %]
-                                        <br/>
-                                        Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
-                                        (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&op=show">suggestion #[% books_loo.suggestionid %]</a>)
-                                    [% END %]
-                                    [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
+                                <br />
+                                [% IF ( books_loo.isbn ) %] - [% books_loo.isbn %][% END %]
+                                [% IF ( books_loo.issn ) %] - [% books_loo.issn %][% END %]
+                                [% IF ( books_loo.publishercode ) %], [% books_loo.publishercode %][% END %]
+                                [% IF ( books_loo.publicationyear ) %], [% books_loo.publicationyear %][% END %]
+                                [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
+                                [% IF ( books_loo.suggestionid ) %]
+                                    <br/>
+                                    Suggested by: [% books_loo.surnamesuggestedby %][% IF ( books_loo.firstnamesuggestedby ) %], [% books_loo.firstnamesuggestedby %] [% END %]
+                                    (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% books_loo.suggestionid %]&op=show">suggestion #[% books_loo.suggestionid %]</a>)
+                                [% END %]
+                                [% IF ( books_loo.notes ) %]
+                                    <p class="ordernote"><strong>Note: </strong>[% books_loo.notes|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]">Change note</a>]</p>
+                                [% ELSE %]
+                                    [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% books_loo.ordernumber %]">Add note</a>]
+                                [% END %]
                             </p>
-                            </td>
+                        </td>
                         <td class="number">[% books_loo.rrp %]</td>
                         <td class="number">[% books_loo.ecost %]</td>
                         <td class="number">[% books_loo.quantity %]</td>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt
new file mode 100644 (file)
index 0000000..0961f4a
--- /dev/null
@@ -0,0 +1,31 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Koha &rsaquo; Acquisition &rsaquo; Change order notes</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+
+<body>
+[% INCLUDE 'header.inc' %]
+
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisition</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% booksellername|html %]</a> &rsaquo; <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketname|html %] ([% basketno %])</a> &rsaquo; Change order notes</div>
+
+<div id="doc" class="yui-t7">
+
+<div id="bd">
+  <div id="yui-main">
+      <h1>Change order notes (order no. [% ordernumber %])</h1>
+      <form action="/cgi-bin/koha/acqui/modordernotes.pl" method="post">
+        <fieldset class="brief">
+          <label for="ordernotes">Notes:</label>
+          <textarea id="ordernotes" name="ordernotes" rows="3" cols="30">[% ordernotes %]</textarea>
+        </fieldset>
+        <input type="hidden" name="referrer" value="[% referrer %]" />
+        <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
+        <input type="hidden" name="op" value="save" />
+        <fieldset class="action">
+          <input type="submit" value="Save" />
+          <a class="cancel" href="[% referrer %]">Cancel</a>
+        </fieldset>
+      </form>
+  </div>
+</div>
+[% INCLUDE 'intranet-bottom.inc' %]
index e6464f2..26a53bb 100644 (file)
@@ -170,9 +170,9 @@ $(document).ready(function()
 
 [% IF ( basketno ) %]
     <div id="acqui_basket_summary"  class="yui-g">
-       <fieldset class="rows">
+    <fieldset class="rows">
         <legend>Basket details</legend>
-               <ol>
+        <ol>
         [% IF ( basketnote ) %]<li><span class="label">Internal note:</span> [% basketnote %]</li>[% END %]
         [% IF ( basketbooksellernote ) %]<li><span class="label">Vendor note:</span> [% basketbooksellernote %]</li>[% END %]
         [% IF ( basketcontractno ) %]
@@ -198,12 +198,12 @@ $(document).ready(function()
                 <input type="hidden" value="mod_basket" name="op" />
                 <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
             </li>
-               <fieldset class="action"><input type="submit" value="Change basketgroup" /></fieldset>
-        </form>
+            <fieldset class="action"><input type="submit" value="Change basketgroup" /></fieldset>
         [% END %]
+        </form>
         [% END %]
-                       </ol>
-</fieldset>
+        </ol>
+    </fieldset>
     </div>
 [% END %]
 
index 786c5be..02e1769 100644 (file)
                     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 %]&amp;op=show">suggestion #[% loop_order.suggestionid %]</a>)
                 [% END %]
+                <br />
+                [% IF ( loop_order.notes ) %]
+                    <p class="ordernote"><strong>Note: </strong>[% loop_order.notes|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Fbooksellerid=[% loop_order.booksellerid %]&amp;datereceived=[% loop_order.invoicedatereceived %]&amp;invoice=[% loop_order.invoice %]">Change note</a>]</p>
+                [% ELSE %]
+                    [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Fbooksellerid=[% loop_order.booksellerid %]&amp;datereceived=[% loop_order.invoicedatereceived %]&amp;invoice=[% loop_order.invoice %]">Add note</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&amp;id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
                 <td>[% loop_order.quantity %]</td>