SetVersion($DBversion);
}
+$DBversion = "3.19.00.XXX";
+if(CheckVersion($DBversion)) {
+ $dbh->do(q{
+ INSERT INTO authorised_values (category, authorised_value, lib) VALUES
+ ('ORDER_CANCELLATION_REASON', 0, 'No reason'),
+ ('ORDER_CANCELLATION_REASON', 1, 'Sold out'),
+ ('ORDER_CANCELLATION_REASON', 2, 'Restocking')
+ });
+
+ my $already_existing_reasons = $dbh->selectcol_arrayref(q{
+ SELECT DISTINCT( cancellationreason )
+ FROM aqorders;
+ }, { Slice => {} });
+
+ my $update_orders_sth = $dbh->prepare(q{
+ UPDATE aqorders
+ SET cancellationreason = ?
+ WHERE cancellationreason = ?
+ });
+
+ my $insert_av_sth = $dbh->prepare(q{
+ INSERT INTO authorised_values (category, authorised_value, lib) VALUES
+ ('ORDER_CANCELLATION_REASON', ?, ?)
+ });
+ my $i = 3;
+ for my $reason ( @$already_existing_reasons ) {
+ next unless $reason;
+ $insert_av_sth->execute( $i, $reason );
+ $update_orders_sth->execute( $i, $reason );
+ $i++;
+ }
+ print "Upgrade to $DBversion done (Bug 13380: Add the ORDER_CANCELLATION_REASON authorised value)\n";
+ SetVersion($DBversion);
+}
+
=head1 FUNCTIONS
=head2 TableExists($table)
[% USE KohaDates %]
[% USE Price %]
+[% USE AuthorisedValues %]
+
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions › [% UNLESS ( basketno ) %]New [% END %][% IF ( delete_confirm ) %]Delete [% END %]Basket [% basketname|html %] ([% basketno %]) for [% name|html %]</title>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
[% IF ( books_loo.editionstatement ) %], [% books_loo.editionstatement %][% END %]
[% IF ( order.cancellationreason ) %]
<br />
- Cancellation reason: [% order.cancellationreason %]
+ Cancellation reason: [% AuthorisedValues.GetByCode( 'ORDER_CANCELLATION_REASON', order.cancellationreason ) %]
[% END %]
</p>
[% IF order.transferred_to %]