From 83dc62da796c90bbd6ad561988de9b216c0900b2 Mon Sep 17 00:00:00 2001 From: Mathieu Saby Date: Fri, 20 Sep 2013 14:28:51 +0200 Subject: [PATCH] Bug 9416: Add a new note for vendor in each order Content-Type: text/plain; charset="utf-8" This patch adds a new note made for vendor in each order. The existing note is renamed "internal note". The behavior of the 2 notes are the same An other patch will display this vendor note in pdf printed basketgroups. To test : Make a complete acquisiton process (creating the order > looking at the basket > looking the order > receiving) and try to use the 2 notes (internal note / vendor note) check the changes made on one page (eg detail of the order) are well saved and visible on an other page (eg receipt page) Note : display of existing acq note is broken on receipt page. It must be fixed in an other bug --- C4/Acquisition.pm | 2 +- acqui/modordernotes.pl | 17 ++++++++++++----- acqui/orderreceive.pl | 4 ++-- installer/data/mysql/kohastructure.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/acqui/addorderiso2709.tt | 2 +- .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 9 +++++++-- .../prog/en/modules/acqui/modordernotes.tt | 9 +++++---- .../prog/en/modules/acqui/neworderempty.tt | 6 +++++- .../prog/en/modules/acqui/orderreceive.tt | 6 ++++-- .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 11 ++++++++--- 11 files changed, 54 insertions(+), 22 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index ed9c215..d2a0db0 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1113,7 +1113,7 @@ Else, the upcoming July 1st is used. =item defaults entrydate to Now -The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "rrp", "ecost", "gstrate", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "budget_id". +The following keys are used: "biblionumber", "title", "basketno", "quantity", "notes", "orderstaffnote", "rrp", "ecost", "gstrate", "unitprice", "subscription", "sort1", "sort2", "booksellerinvoicenumber", "listprice", "budgetdate", "purchaseordernumber", "branchcode", "booksellerinvoicenumber", "budget_id". =back diff --git a/acqui/modordernotes.pl b/acqui/modordernotes.pl index ffdc9f6..fc5a05f 100755 --- a/acqui/modordernotes.pl +++ b/acqui/modordernotes.pl @@ -47,7 +47,7 @@ my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { my $op = $input->param('op'); my $ordernumber = $input->param('ordernumber'); my $referrer = $input->param('referrer') || $input->referer(); - +my $type = $input->param('type'); my $order = GetOrder($ordernumber); my $basket = GetBasket($order->{basketno}); my ($bookseller) = GetBookSellerFromId($basket->{booksellerid}); @@ -55,14 +55,20 @@ my ($bookseller) = GetBookSellerFromId($basket->{booksellerid}); if($op and $op eq 'save') { my $ordernotes = $input->param('ordernotes'); - $order->{'notes'} = $ordernotes; + if ($type eq "vendor") { + $order->{'order_vendornote'} = $ordernotes; + } else { + $order->{'notes'} = $ordernotes; + } ModOrder($order); print $input->redirect($referrer); exit; } else { - $template->param( - ordernotes => $order->{'notes'}, - ); + if ($type eq "vendor") { + $template->param(ordernotes => $order->{'order_vendornote'}); + } else { + $template->param(ordernotes => $order->{'notes'}); + } } if($op) { @@ -76,6 +82,7 @@ $template->param( booksellername => $bookseller->{'name'}, ordernumber => $ordernumber, referrer => $referrer, + type => $type, ); diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl index 8fc760b..4ecea2b 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -220,12 +220,12 @@ $template->param( invoice => $invoice->{invoicenumber}, datereceived => $datereceived->output(), datereceived_iso => $datereceived->output('iso'), - notes => $order->{notes}, + order_internalnote => $order->{notes}, + order_vendornote => $order->{order_vendornote}, suggestionid => $suggestion->{suggestionid}, surnamesuggestedby => $suggestion->{surnamesuggestedby}, firstnamesuggestedby => $suggestion->{firstnamesuggestedby}, ); - # regardless of the content of $unitprice e.g 0 or '' or any string will return in these cases 0.00 # and the 'IF' in the .tt will show 0.00 and not 'ecost' (see BZ 7129) # So if $unitprice == 0 we don't create unitprice diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index fdab879..9781f97 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2912,7 +2912,8 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items `quantityreceived` smallint(6) NOT NULL default 0, -- the quantity that have been received so far `cancelledby` varchar(10) default NULL, -- not used? always NULL `datecancellationprinted` date default NULL, -- the date the line item was deleted - `notes` mediumtext, -- notes related to this order line + `notes` mediumtext, -- notes related to this order line, made for staff + `order_vendornote` mediumtext, -- notes related to this order line, made for vendor `supplierreference` mediumtext, -- not used? always NULL `purchaseordernumber` mediumtext, -- not used? always NULL `basketno` int(11) default NULL, -- links this order line to a specific basket (aqbasket.basketno) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index da78e68..d6bbcf3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7130,6 +7130,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("ALTER TABLE aqorders ADD COLUMN order_vendornote MEDIUMTEXT AFTER notes;"); + print "Upgrade to $DBversion done (Bug 9416 - We should have 2 kinds of notes for each order line\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt index 62f1519..3ced8c1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -197,7 +197,7 @@ [% END %]
  • - +
  • The 2 following fields are available for your own usage. They can be useful for statistical purposes
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 67e299d..98235ea 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -350,9 +350,14 @@ [% END %]

    [% IF ( books_loo.notes ) %] -

    Note: [% books_loo.notes|html %] [Change note]

    +

    Internal note: [% books_loo.notes|html %] [Change internal note]

    [% ELSE %] -

    [Add note]

    + [Add internal note] + [% END %] + [% IF ( books_loo.order_vendornote ) %] +

    Vendor note: [% books_loo.order_vendornote|html %] [Change vendor note]

    + [% ELSE %] + [Add vendor note] [% END %] [% IF (books_loo.transferred_from) %] [% basket = books_loo.transferred_from.basket %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt index 6fc4867..c3d2129 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/modordernotes.tt @@ -1,26 +1,27 @@ [% INCLUDE 'doc-head-open.inc' %] -Koha › Acquisition › Change order notes +Koha › Acquisition › Change order [% IF (type == "vendor") %]vendor[% ELSE %]internal[% END %] note [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'header.inc' %] - +
    -

    Change order notes (order no. [% ordernumber %])

    +

    Change order [% IF (type == "vendor") %]vendor[% ELSE %]internal[% END %] note (order no. [% ordernumber %])

    - +
    +
    Cancel 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 c261530..df39d31 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -535,9 +535,13 @@ $(document).ready(function() [% END %]
  • - +
  • +
  • + + +
  • The 2 following fields are available for your own usage. They can be useful for statistical purposes
    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 67999e4..bc3a504 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -315,8 +315,10 @@ [% ELSE %] - [% END %]
  • - + [% END %] +
  • +
  • + 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 174a6bf..a183490 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -202,7 +202,7 @@ [% loop_order.title |html %] [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %] [% IF ( loop_order.isbn ) %] – [% loop_order.isbn %][% END %] - [% IF ( loop_order.publishercode ) %]
    Publisher :[% loop_order.publishercode %][% END %] + [% IF ( loop_order.publishercode ) %]
    Publisher:[% loop_order.publishercode %][% END %] [% IF ( loop_order.suggestionid ) %]
    Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %] @@ -210,10 +210,15 @@ [% END %]
    [% IF ( loop_order.notes ) %] -

    Note: [% loop_order.notes|html %] [Change note]

    +

    Internal note: [% loop_order.notes|html %] [Change internal note]

    [% ELSE %] - [Add note] + [Add internal note] [% END %] + [% IF ( loop_order.order_vendornote ) %] +

    Vendor note: [% loop_order.order_vendornote|html %] [Change vendor note]

    + [% ELSE %] + [Add vendor note] + [% END %] MARC | Card [% loop_order.quantity %] -- 1.7.9.5