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