Lines 7-14
use Modern::Perl;
Link Here
|
7 |
use POSIX qw(strftime); |
7 |
use POSIX qw(strftime); |
8 |
|
8 |
|
9 |
use C4::Bookseller qw( GetBookSellerFromId ); |
9 |
use C4::Bookseller qw( GetBookSellerFromId ); |
|
|
10 |
use C4::Items qw (AddItem GetItem); |
11 |
use C4::Branch qw (ModBranch); |
10 |
|
12 |
|
11 |
use Test::More tests => 62; |
13 |
use Test::More tests => 67; |
12 |
|
14 |
|
13 |
BEGIN { |
15 |
BEGIN { |
14 |
use_ok('C4::Acquisition'); |
16 |
use_ok('C4::Acquisition'); |
Lines 223-226
is($order3->{'quantityreceived'}, 2, 'Order not split up');
Link Here
|
223 |
is($order3->{'quantity'}, 2, '2 items on order'); |
225 |
is($order3->{'quantity'}, 2, '2 items on order'); |
224 |
is($order3->{'budget_id'}, $budgetid2, 'Budget has changed'); |
226 |
is($order3->{'budget_id'}, $budgetid2, 'Budget has changed'); |
225 |
|
227 |
|
|
|
228 |
# |
229 |
# test DelOrder |
230 |
# use: |
231 |
# &DelOrder($ordernumber); |
232 |
|
233 |
# create 3 items on the same record and link 2 of them to the order |
234 |
|
235 |
# Add a branch |
236 |
my $b1 = { |
237 |
add => 1, |
238 |
branchcode => 'BRA', |
239 |
branchname => 'BranchA', |
240 |
branchaddress1 => 'adr1A', |
241 |
branchaddress2 => 'adr2A', |
242 |
branchaddress3 => 'adr3A', |
243 |
branchzip => 'zipA', |
244 |
branchcity => 'cityA', |
245 |
branchstate => 'stateA', |
246 |
branchcountry => 'countryA', |
247 |
branchphone => 'phoneA', |
248 |
branchfax => 'faxA', |
249 |
branchemail => 'emailA', |
250 |
branchurl => 'urlA', |
251 |
branchip => 'ipA', |
252 |
branchprinter => undef, |
253 |
branchnotes => 'noteA', |
254 |
opac_info => 'opacA' |
255 |
}; |
256 |
ModBranch($b1); |
257 |
|
258 |
my ($item_bibnum1, $item_bibitemnum1, $itemnumber1) = AddItem({ homebranch => 'BRA', holdingbranch => 'BRA' } , $biblionumber2); |
259 |
my ($item_bibnum2, $item_bibitemnum2, $itemnumber2) = AddItem({ homebranch => 'BRA', holdingbranch => 'BRA' } , $biblionumber2); |
260 |
my ($item_bibnum3, $item_bibitemnum3, $itemnumber3) = AddItem({ homebranch => 'BRA', holdingbranch => 'BRA' } , $biblionumber2); |
261 |
NewOrderItem ($itemnumber1, $ordernumber3); |
262 |
NewOrderItem ($itemnumber2, $ordernumber3); |
263 |
|
264 |
# If no ordernumber is passed, the function returns undef and does not try to update database |
265 |
my $return_DelOrder = DelOrder (); |
266 |
is($return_DelOrder , undef, 'DelOrder returns undef with no param'); |
267 |
# Cancel the order with the given order, by filling the datecancellationprinted and orderstatus fields. |
268 |
DelOrder ($ordernumber3); |
269 |
$order3 = GetOrder( $ordernumber3 ); |
270 |
ok(($order3->{'orderstatus'} eq 'cancelled')&& (defined $order3->{'datecancellationprinted'}),'DelOrders update orderstatus and fill datecancellationprinted fields'); |
271 |
|
272 |
# All the items linked with that order are deleted. |
273 |
is(scalar GetItemnumbersFromOrder($ordernumber3), 0, 'DelOrders delete items linked with cancelled order in aqorders_items table'); |
274 |
ok(!defined GetItem($itemnumber1) && !defined GetItem($itemnumber2), "DelOrder deletes items linked with order in items table"); |
275 |
|
276 |
# Other items (created manually) are not deleted. |
277 |
is(GetItem($itemnumber3)->{biblionumber},$biblionumber2, "DelOrder does not delete item created manually"); |
278 |
|
226 |
$dbh->rollback; |
279 |
$dbh->rollback; |
227 |
- |
|
|