Bugzilla – Attachment 35696 Details for
Bug 13380
Auto fill order cancellation reasons from authorised values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13380: Fill order cancellation reasons from AV
PASSED-QA-Bug-13380-Fill-order-cancellation-reason.patch (text/plain), 4.75 KB, created by
Kyle M Hall (khall)
on 2015-02-06 12:56:25 UTC
(
hide
)
Description:
[PASSED QA] Bug 13380: Fill order cancellation reasons from AV
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-02-06 12:56:25 UTC
Size:
4.75 KB
patch
obsolete
>From 77128832e295df2ea463fd489451bcd0af37e0d4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 3 Dec 2014 13:07:16 +0100 >Subject: [PATCH] [PASSED QA] Bug 13380: Fill order cancellation reasons from AV > >Since bug 7162, it's possible to give a cancellation reason on deleting >an order. >This would be better to fill an authorised values category with the >different possible values. >Like that we will avoid to have duplicate or similar reasons. > >Also, it will be easier to filter or create reports. > >Test plan: >0/ Don't apply the patch >1/ Cancel some orders and give a cancelletion reason >2/ Apply the patch and execute the updatedb entry >3/ Cancel an order and verify the you have a list with the reason you >previously filled + 3 new ones ('No reason', 'Sold out' and >'Restocking'); >4/ Choose one and verify the value is correctly displayed on the basket >page >5/ You can also try to add other values from the admin module. > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/updatedatabase.pl | 35 ++++++++++++++++++++ > .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 3 +- > .../prog/en/modules/acqui/cancelorder.tt | 2 +- > 3 files changed, 38 insertions(+), 2 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 7e00df3..77bbd2f 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9732,6 +9732,41 @@ if ( CheckVersion($DBversion) ) { > 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 XXXXX - Add the ORDER_CANCELLATION_REASON authorised value)\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 9cc23bd..3d21bbf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt >@@ -1,4 +1,5 @@ > [% USE KohaDates %] >+[% 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" /> >@@ -597,7 +598,7 @@ > [% 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 %] >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 3064a08..5c07c67 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt >@@ -25,7 +25,7 @@ > [% END %] > </p> > <p> >- <textarea name="reason" placeholder="Reason of cancellation"></textarea> >+ [% PROCESS 'av-build-dropbox.inc' name="reason", category="ORDER_CANCELLATION_REASON" default="0" %] > </p> > <input type="hidden" name="action" value="confirmcancel" /> > <input type="hidden" value="[% ordernumber %]" name="ordernumber" /> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13380
:
34090
|
34091
|
34140
|
34746
|
34747
|
35695
|
35696
|
35767
|
35768
|
35773
|
37144
|
37163
|
37179
|
37363