Lines 38-44
subtest 'buildKohaItemsNamespace status tests' => sub {
Link Here
|
38 |
my $item = $builder->build_sample_item({}); |
38 |
my $item = $builder->build_sample_item({}); |
39 |
|
39 |
|
40 |
my $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
40 |
my $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
41 |
like($xml,qr/<status>available<\/status>/,"Item is available when no other status applied"); |
41 |
like($xml,qr{<status>available</status>},"Item is available when no other status applied"); |
42 |
|
42 |
|
43 |
# notforloan |
43 |
# notforloan |
44 |
{ |
44 |
{ |
Lines 48-86
subtest 'buildKohaItemsNamespace status tests' => sub {
Link Here
|
48 |
Koha::ItemTypes->find($item->itype)->notforloan(0)->store; |
48 |
Koha::ItemTypes->find($item->itype)->notforloan(0)->store; |
49 |
Koha::ItemTypes->find($item->biblioitem->itemtype)->notforloan(1)->store; |
49 |
Koha::ItemTypes->find($item->biblioitem->itemtype)->notforloan(1)->store; |
50 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
50 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
51 |
like($xml,qr/<status>reference<\/status>/,"reference if positive itype notforloan value"); |
51 |
like($xml,qr{<status>reference</status>},"reference if positive itype notforloan value"); |
52 |
|
52 |
|
53 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
53 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
54 |
Koha::ItemTypes->find($item->itype)->notforloan(1)->store; |
54 |
Koha::ItemTypes->find($item->itype)->notforloan(1)->store; |
55 |
Koha::ItemTypes->find($item->biblioitem->itemtype)->notforloan(0)->store; |
55 |
Koha::ItemTypes->find($item->biblioitem->itemtype)->notforloan(0)->store; |
56 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
56 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
57 |
like($xml,qr/<status>reference<\/status>/,"reference if positive itemtype notforloan value"); |
57 |
like($xml,qr{<status>reference</status>},"reference if positive itemtype notforloan value"); |
58 |
Koha::ItemTypes->find($item->itype)->notforloan(0)->store; |
58 |
Koha::ItemTypes->find($item->itype)->notforloan(0)->store; |
59 |
|
59 |
|
60 |
$item->notforloan(-1)->store; |
60 |
$item->notforloan(-1)->store; |
61 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
61 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
62 |
like($xml,qr/<status>On order<\/status>/,"On order if negative notforloan value"); |
62 |
like($xml,qr{<status>On order</status>},"On order if negative notforloan value"); |
63 |
|
63 |
|
64 |
$item->notforloan(1)->store; |
64 |
$item->notforloan(1)->store; |
65 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
65 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
66 |
like($xml,qr/<status>reference<\/status>/,"reference if positive notforloan value"); |
66 |
like($xml,qr{<status>reference</status>},"reference if positive notforloan value"); |
67 |
} |
67 |
} |
68 |
|
68 |
|
69 |
$item->onloan('2001-01-01')->store; |
69 |
$item->onloan('2001-01-01')->store; |
70 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
70 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
71 |
like($xml,qr/<status>Checked out<\/status>/,"Checked out status takes precedence over Not for loan"); |
71 |
like($xml,qr{<status>Checked out</status>},"Checked out status takes precedence over Not for loan"); |
72 |
|
72 |
|
73 |
$item->withdrawn(1)->store; |
73 |
$item->withdrawn(1)->store; |
74 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
74 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
75 |
like($xml,qr/<status>Withdrawn<\/status>/,"Withdrawn status takes precedence over Checked out"); |
75 |
like($xml,qr{<status>Withdrawn</status>},"Withdrawn status takes precedence over Checked out"); |
76 |
|
76 |
|
77 |
$item->itemlost(1)->store; |
77 |
$item->itemlost(1)->store; |
78 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
78 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
79 |
like($xml,qr/<status>Lost<\/status>/,"Lost status takes precedence over Withdrawn"); |
79 |
like($xml,qr{<status>Lost</status>},"Lost status takes precedence over Withdrawn"); |
80 |
|
80 |
|
81 |
$item->damaged(1)->store; |
81 |
$item->damaged(1)->store; |
82 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
82 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
83 |
like($xml,qr/<status>Damaged<\/status>/,"Damaged status takes precedence over Lost"); |
83 |
like($xml,qr{<status>Damaged</status>},"Damaged status takes precedence over Lost"); |
84 |
|
84 |
|
85 |
$builder->build({ source => "Branchtransfer", value => { |
85 |
$builder->build({ source => "Branchtransfer", value => { |
86 |
itemnumber => $item->itemnumber, |
86 |
itemnumber => $item->itemnumber, |
Lines 88-94
subtest 'buildKohaItemsNamespace status tests' => sub {
Link Here
|
88 |
} |
88 |
} |
89 |
}); |
89 |
}); |
90 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
90 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
91 |
like($xml,qr/<status>In transit<\/status>/,"In-transit status takes precedence over Damaged"); |
91 |
like($xml,qr{<status>In transit</status>},"In-transit status takes precedence over Damaged"); |
92 |
|
92 |
|
93 |
my $hold = $builder->build_object({ class => 'Koha::Holds', value => { |
93 |
my $hold = $builder->build_object({ class => 'Koha::Holds', value => { |
94 |
biblionumber => $item->biblionumber, |
94 |
biblionumber => $item->biblionumber, |
Lines 98-111
subtest 'buildKohaItemsNamespace status tests' => sub {
Link Here
|
98 |
} |
98 |
} |
99 |
}); |
99 |
}); |
100 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
100 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
101 |
like($xml,qr/<status>Waiting<\/status>/,"Waiting status takes precedence over In transit"); |
101 |
like($xml,qr{<status>Waiting</status>},"Waiting status takes precedence over In transit"); |
102 |
|
102 |
|
103 |
$builder->build({ source => "TmpHoldsqueue", value => { |
103 |
$builder->build({ source => "TmpHoldsqueue", value => { |
104 |
itemnumber => $item->itemnumber |
104 |
itemnumber => $item->itemnumber |
105 |
} |
105 |
} |
106 |
}); |
106 |
}); |
107 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
107 |
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]); |
108 |
like($xml,qr/<status>Pending hold<\/status>/,"Pending status takes precedence over all"); |
108 |
like($xml,qr{<status>Pending hold</status>},"Pending status takes precedence over all"); |
109 |
|
109 |
|
110 |
|
110 |
|
111 |
}; |
111 |
}; |
112 |
- |
|
|