From d3b2c85df8b4282535cc05028b9a47c119bc1455 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Tue, 20 May 2014 13:49:57 +0200 Subject: [PATCH] Bug 7162; Factorize code for order cancellation (QA fixes) * Remove tab characters in acqui/addorder.pl * Remove FIXME in acqui/cancelorder.pl * Fix typos: "canceled" -> "cancelled", "occured" -> "occurred" * Replace "Click here" link by "OK" * Add a column to aqorders to store cancellation reason instead of having it in aqorders.notes, to avoid having untranslatable strings in database Signed-off-by: Paola Rossi Signed-off-by: Tomas Cohen Arazi --- C4/Acquisition.pm | 9 ++------- acqui/cancelorder.pl | 5 ----- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 10 ++++++++++ .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 4 ++++ .../intranet-tmpl/prog/en/modules/acqui/cancelorder.tt | 10 +++++----- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 80dd500911..f9e8c4966a 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1794,19 +1794,14 @@ sub DelOrder { SET datecancellationprinted=now(), orderstatus='cancelled' "; if($reason) { - $query .= " - , notes = IF(notes IS NULL, - CONCAT('Cancellation reason: ', ?), - CONCAT(notes, ' - Cancellation reason: ', ?) - ) - "; + $query .= ", cancellationreason = ? "; } $query .= " WHERE biblionumber=? AND ordernumber=? "; my $sth = $dbh->prepare($query); if($reason) { - $sth->execute($reason, $reason, $bibnum, $ordernumber); + $sth->execute($reason, $bibnum, $ordernumber); } else { $sth->execute( $bibnum, $ordernumber ); } diff --git a/acqui/cancelorder.pl b/acqui/cancelorder.pl index 0c2489394d..c45b8da4d6 100755 --- a/acqui/cancelorder.pl +++ b/acqui/cancelorder.pl @@ -33,11 +33,6 @@ use Modern::Perl; use CGI; use C4::Auth; use C4::Output; -# FIXME: C4::Search is needed by C4::Items::GetAnalyticsCount, which is called -# by C4::Acquisition::DelOrder. But C4::Search is not imported by C4::Items. -# Once this problem is resolved, the following line can be removed. -# See Bug 7847. -use C4::Search; use C4::Acquisition; my $input = new CGI; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index cbd1c61889..b135e21d8c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3026,6 +3026,7 @@ CREATE TABLE `aqorders` ( -- information related to the basket line items `unitprice` decimal(28,6) default NULL, -- the actual cost entered when receiving this line item `quantityreceived` smallint(6) NOT NULL default 0, -- the quantity that have been received so far `datecancellationprinted` date default NULL, -- the date the line item was deleted + `cancellationreason` text default NULL, -- reason of cancellation `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 diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 99de0b6326..8705c069bd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8942,6 +8942,16 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(" + ALTER TABLE aqorders + ADD COLUMN cancellationreason TEXT DEFAULT NULL AFTER datecancellationprinted + "); + print "Upgrade to $DBversion done (Bug 7162: Add aqorders.cancellationreason)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 ac58f1942d..056a92a081 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -595,6 +595,10 @@ [% IF ( order.publishercode ) %], [% order.publishercode %][% END %] [% IF ( order.publicationyear ) %], [% order.publicationyear %][% END %] [% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %] + [% IF ( order.cancellationreason ) %] +
+ Cancellation reason: [% order.cancellationreason %] + [% END %]

[% IF order.transferred_to %] [% basket = order.transferred_to.basket %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt index 4ac1f82063..8df5f2c183 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt @@ -41,18 +41,18 @@ [% ELSE %] [% IF ( success_cancelorder ) %]
- The order has been successfully canceled + The order has been successfully cancelled [% ELSE %]
- An error has occured. + An error has occurred. [% IF ( error_delitem ) %] -

The order has been canceled, although one or more items could not have been deleted.

+

The order has been cancelled, although one or more items could not have been deleted.

[% END %] [% IF ( error_delbiblio ) %] -

The order has been canceled, although the record has not been deleted.

+

The order has been cancelled, although the record has not been deleted.

[% END %] [% END %] -

Click here to return to previous page

+

OK

[% END %] -- 2.39.5