From c2240f520b92404215be3912bc35bc53a6279fd8 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 --- C4/Acquisition.pm | 9 ++------- acqui/cancelorder.pl | 5 ----- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 11 +++++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt | 10 +++++----- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 80dd500..f9e8c49 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 0c24893..c45b8da 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 cbd1c61..b135e21 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 5064c40..09d9eb9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8891,6 +8891,17 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "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 ac58f19..056a92a 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 4ac1f82..8df5f2c 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 %] -- 1.9.1