From fe3cfabeeb408ca1ae1da894e8bee22c4d34bf15 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Mon, 1 Jul 2013 13:43:08 +0000 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 --- 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 ++++ .../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 bb570bd..56c023b 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -1770,19 +1770,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 136104f..6268024 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2994,6 +2994,7 @@ 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 + cancellationreason text default NULL, -- reason of cancellation `notes` mediumtext, -- notes related to this order line `supplierreference` mediumtext, -- not used? always NULL `purchaseordernumber` mediumtext, -- not used? always NULL diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 80ab210..d9517af 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7912,6 +7912,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 c316ac8..c6ce919 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -571,6 +571,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.7.10.4