From 36074fba651560bef11423f2d1817ffc83c0045c Mon Sep 17 00:00:00 2001 From: Mathieu Saby Date: Mon, 17 Feb 2014 01:11:42 +0100 Subject: [PATCH] Bug 9416: add new order vendor note field MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently, there is a single note field in each order. It would be useful to have 2 notes fields: - one for the staff (ex: "catalog this book as soon as possible") - one for the vendor (ex: "urgent", "only the 2d volume"...), which could later be printed in basketgroup pdf for example 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 Changes in database structure: - new column aqorders.order_vendornote - column aqorders.notes renamed aqorders.order_internalnote To test : [1] 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) [2] Check the changes made on one page (eg detail of the order) are saved and visible on an other page (eg receipt page) Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Testing notes on last patch. Signed-off-by: Galen Charlton --- C4/Acquisition.pm | 6 +++--- acqui/modordernotes.pl | 17 ++++++++++++----- acqui/orderreceive.pl | 3 ++- installer/data/mysql/kohastructure.sql | 3 ++- installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/acqui/addorderiso2709.tt | 4 ++-- .../prog/en/modules/acqui/basket.tt | 13 +++++++++---- .../prog/en/modules/acqui/modordernotes.tt | 9 +++++---- .../prog/en/modules/acqui/neworderempty.tt | 8 ++++++-- .../prog/en/modules/acqui/orderreceive.tt | 6 ++++-- .../prog/en/modules/acqui/parcel.tt | 13 +++++++++---- 11 files changed, 61 insertions(+), 28 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 2b17eab6bd..9000fb2cc8 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -310,7 +310,7 @@ sub GetBasketAsCSV { publicationyear => $bd->{'publicationyear'}, publishercode => $bd->{'publishercode'}, collectiontitle => $bd->{'collectiontitle'}, - notes => $order->{'notes'}, + notes => $order->{'order_internalnote'}, quantity => $order->{'quantity'}, rrp => $order->{'rrp'}, deliveryplace => C4::Branch::GetBranchName( $basket->{'deliveryplace'} ), @@ -381,7 +381,7 @@ sub GetBasketGroupAsCSV { rrp => $order->{rrp}, discount => $bookseller->{discount}, ecost => $order->{ecost}, - notes => $order->{notes}, + notes => $order->{order_internalnote}, entrydate => $order->{entrydate}, booksellername => $bookseller->{name}, bookselleraddress => $bookseller->{address1}, @@ -1234,7 +1234,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", "order_vendornote", "order_internalnote", "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 ffdc9f6c74..74ccd186b7 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->{'order_internalnote'} = $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->{'order_internalnote'}); + } } 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 2a21c14554..50920e0c27 100755 --- a/acqui/orderreceive.pl +++ b/acqui/orderreceive.pl @@ -222,7 +222,8 @@ $template->param( invoice => $invoice->{invoicenumber}, datereceived => $datereceived->output(), datereceived_iso => $datereceived->output('iso'), - notes => $order->{notes}, + order_internalnote => $order->{order_internalnote}, + order_vendornote => $order->{order_vendornote}, suggestionid => $suggestion->{suggestionid}, surnamesuggestedby => $suggestion->{surnamesuggestedby}, firstnamesuggestedby => $suggestion->{firstnamesuggestedby}, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 57cc3b8a87..ea4f944961 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2979,7 +2979,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 + `order_internalnote` 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 d2db8d110e..263d4d9c15 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8136,6 +8136,13 @@ if ( CheckVersion($DBversion) ) { print "Upgrade to $DBversion done (Bug 9448 - Add separate permission for writing off fees)\n"; SetVersion ($DBversion); } +$DBversion = "3.15.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("ALTER TABLE aqorders CHANGE notes order_internalnote MEDIUMTEXT;"); + $dbh->do("ALTER TABLE aqorders ADD COLUMN order_vendornote MEDIUMTEXT AFTER order_internalnote;"); + print "Upgrade to $DBversion done (Bug 9416 - In each order, add a new note made for the vendor)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS 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 44d2bb8c93..ccc8bf0041 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tt @@ -231,8 +231,8 @@ [% 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 cd3117613c..37ac2d2545 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -491,10 +491,15 @@ (suggestion #[% books_loo.suggestionid %]) [% END %]

    - [% IF ( books_loo.notes ) %] -

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

    + [% IF ( books_loo.order_internalnote ) %] +

    Internal note: [% books_loo.order_internalnote|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 %] @@ -598,7 +603,7 @@ [% ELSE %] Deleted bibliographic record, can't find title
    [% END %] - [% IF ( order.notes ) %] [% order.notes %][% END %] + [% IF ( order.order_internalnote ) %] [% order.order_internalnote %][% END %] [% IF ( order.isbn ) %] - [% order.isbn %][% END %] [% IF ( order.issn ) %] - [% order.issn %][% END %] [% IF ( order.publishercode ) %], [% order.publishercode %][% END %] 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 6fc4867760..ee60b0e268 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 4ce63a0907..ab30ff2d90 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt @@ -536,8 +536,12 @@ $(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 3f5dc42d5c..6d2b3fa345 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -328,8 +328,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 b537148d62..11bc92029c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt @@ -268,17 +268,22 @@ [% 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 %] (suggestion #[% loop_order.suggestionid %]) [% END %]
    - [% IF ( loop_order.notes ) %] -

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

    + [% IF ( loop_order.order_internalnote ) %] + f

    Internal note: [% loop_order.order_internalnote|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 -- 2.39.5