Bugzilla – Attachment 64922 Details for
Bug 15685
Allow creation of items (AcqCreateItem) to be customizable per-basket
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15685 - QA Followup
Bug-15685---QA-Followup.patch (text/plain), 5.52 KB, created by
Nick Clemens (kidclamp)
on 2017-07-07 14:56:21 UTC
(
hide
)
Description:
Bug 15685 - QA Followup
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-07-07 14:56:21 UTC
Size:
5.52 KB
patch
obsolete
>From b559d21ad19ae0ad9b02e61fdb06ba4dda8d150b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 7 Jul 2017 14:54:11 +0000 >Subject: [PATCH] Bug 15685 - QA Followup > >DB revision fixes >Unit tests >--- > installer/data/mysql/atomicupdate/bug15685.perl | 8 ++++ > .../bug_15685-add_create_items_to_aqbasket.sql | 1 - > installer/data/mysql/kohastructure.sql | 2 +- > t/db_dependent/Koha/Acquisition/Basket.pm | 52 ++++++++++++++++++++++ > 4 files changed, 61 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug15685.perl > delete mode 100644 installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql > create mode 100644 t/db_dependent/Koha/Acquisition/Basket.pm > >diff --git a/installer/data/mysql/atomicupdate/bug15685.perl b/installer/data/mysql/atomicupdate/bug15685.perl >new file mode 100644 >index 0000000..398ad4d >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug15685.perl >@@ -0,0 +1,8 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ $dbh->do( "ALTER TABLE aqbasket ADD COLUMN create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL" ); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 15685 - description)\n"; >+} >diff --git a/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql b/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql >deleted file mode 100644 >index 145e6d4..0000000 >--- a/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql >+++ /dev/null >@@ -1 +0,0 @@ >-ALTER TABLE aqbasket ADD COLUMN create_items ENUM('ordering', 'receiving', 'cataloguing') DEFAULT NULL; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 4ca9b37..e97ffa0 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2987,7 +2987,7 @@ CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions > `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id) > `deliveryplace` varchar(10) default NULL, -- basket delivery place > `billingplace` varchar(10) default NULL, -- basket billing place >- create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL; -- when items should be created for orders in this basket >+ create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL, -- when items should be created for orders in this basket > branch varchar(10) default NULL, -- basket branch > is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing > PRIMARY KEY (`basketno`), >diff --git a/t/db_dependent/Koha/Acquisition/Basket.pm b/t/db_dependent/Koha/Acquisition/Basket.pm >new file mode 100644 >index 0000000..ad1089c >--- /dev/null >+++ b/t/db_dependent/Koha/Acquisition/Basket.pm >@@ -0,0 +1,52 @@ >+#!/usr/bin/perl >+ >+# Copyright 2017 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+use Test::More tests => 8; >+use Koha::Database; >+use t::lib::TestBuilder; >+use t::lib::Mocks; >+use C4::Acquisition; >+ >+use_ok('Koha::Acquisition::Basket'); >+use_ok('Koha::Acquisition::Baskets'); >+ >+my $schema = Koha::Database->schema; >+$schema->storage->txn_begin; >+my $dbh = C4::Context->dbh; >+ >+# Start transaction >+$dbh->{RaiseError} = 1; >+ >+my $builder = t::lib::TestBuilder->new; >+my $basket = $builder->build_object({ class => 'Koha::Acquisition::Baskets', value => { create_items => undef } }); >+my $created_basketno = C4::Acquisition::NewBasket($basket->booksellerid, $basket->authorisedby, $basket->basketname,$basket->note, $basket->booksellernote, $basket->contractnumber, $basket->deliveryplace, $basket->billingplace, $basket->is_standing, $basket->create_items); >+my $created_basket = Koha::Acquisition::Baskets->find({ basketno => $created_basketno }); >+is($created_basket->basketno, $created_basketno, "Basket created by NewBasket matches db basket"); >+is( $basket->create_items, undef, "Create items value can be null"); >+t::lib::Mocks::mock_preference('AcqCreateItem', 'cataloguing'); >+is( $basket->effective_create_items, "cataloguing","We use AcqCreateItem if basket create items is not set"); >+C4::Acquisition::ModBasketHeader($basket->basketno, $basket->basketname, $basket->note, $basket->booksellernote, $basket->contractnumber, $basket->booksellerid, $basket->deliveryplace, $basket->billingplace, $basket->is_standing, "ordering"); >+my $retrieved_basket = Koha::Acquisition::Baskets->find({ basketno => $basket->basketno }); >+$basket->create_items("ordering"); >+is( $retrieved_basket->create_items, "ordering", "Should be able to set with ModBasketHeader"); >+is( $basket->create_items, "ordering", "Should be able to set with object methods"); >+is_deeply($retrieved_basket->unblessed, $basket->unblessed, "Correct basket found and updated"); >+is( $retrieved_basket->effective_create_items, "ordering","We use basket create items if it is set"); >+ >-- >2.1.4
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 15685
:
47783
|
55094
|
55096
|
57390
|
57392
|
57395
|
57424
|
57425
|
57426
|
57427
|
64918
|
64919
|
64920
|
64921
|
64922
|
65119
|
65120
|
65121
|
65122
|
65895
|
65896
|
65897
|
65898
|
65899
|
65900
|
66119
|
66120
|
66121
|
66122
|
66123
|
66124
|
67638
|
67639
|
67640
|
67641
|
67642
|
67643
|
67644
|
67645
|
67646
|
67647
|
67689
|
67690
|
67691
|
67692
|
67693
|
67694
|
67695
|
67696
|
67697
|
67698
|
67884
|
67898
|
67899
|
67900
|
67901
|
67902
|
67903
|
67904
|
67905
|
67906
|
67907
|
67908
|
67909
|
67910
|
67911