Lines 72-84
my $item = $builder->build(
Link Here
|
72 |
AddIssue( $patron, $item->{barcode} ); |
72 |
AddIssue( $patron, $item->{barcode} ); |
73 |
|
73 |
|
74 |
is( |
74 |
is( |
75 |
ItemSafeToDelete($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
75 |
ItemSafeToDelete( $biblio->{biblionumber}, $item->{itemnumber} ), |
76 |
'book_on_loan', |
76 |
'book_on_loan', |
77 |
'ItemSafeToDelete reports item on loan', |
77 |
'ItemSafeToDelete reports item on loan', |
78 |
); |
78 |
); |
79 |
|
79 |
|
80 |
is( |
80 |
is( |
81 |
DelItemCheck($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
81 |
DelItemCheck( $biblio->{biblionumber}, $item->{itemnumber} ), |
82 |
'book_on_loan', |
82 |
'book_on_loan', |
83 |
'item that is on loan cannot be deleted', |
83 |
'item that is on loan cannot be deleted', |
84 |
); |
84 |
); |
Lines 92-104
t::lib::Mocks::mock_preference('IndependentBranches', 1);
Link Here
|
92 |
ModItem( { homebranch => $branch2->{branchcode}, holdingbranch => $branch2->{branchcode} }, $biblio->{biblionumber}, $item->{itemnumber} ); |
92 |
ModItem( { homebranch => $branch2->{branchcode}, holdingbranch => $branch2->{branchcode} }, $biblio->{biblionumber}, $item->{itemnumber} ); |
93 |
|
93 |
|
94 |
is( |
94 |
is( |
95 |
ItemSafeToDelete($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
95 |
ItemSafeToDelete( $biblio->{biblionumber}, $item->{itemnumber} ), |
96 |
'not_same_branch', |
96 |
'not_same_branch', |
97 |
'ItemSafeToDelete reports IndependentBranches restriction', |
97 |
'ItemSafeToDelete reports IndependentBranches restriction', |
98 |
); |
98 |
); |
99 |
|
99 |
|
100 |
is( |
100 |
is( |
101 |
DelItemCheck($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
101 |
DelItemCheck( $biblio->{biblionumber}, $item->{itemnumber} ), |
102 |
'not_same_branch', |
102 |
'not_same_branch', |
103 |
'IndependentBranches prevents deletion at another branch', |
103 |
'IndependentBranches prevents deletion at another branch', |
104 |
); |
104 |
); |
Lines 113-125
ModItem( { homebranch => $branch->{branchcode}, holdingbranch => $branch->{branc
Link Here
|
113 |
$module->mock( GetAnalyticsCount => sub { return 1 } ); |
113 |
$module->mock( GetAnalyticsCount => sub { return 1 } ); |
114 |
|
114 |
|
115 |
is( |
115 |
is( |
116 |
ItemSafeToDelete($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
116 |
ItemSafeToDelete( $biblio->{biblionumber}, $item->{itemnumber} ), |
117 |
'linked_analytics', |
117 |
'linked_analytics', |
118 |
'ItemSafeToDelete reports linked analytics', |
118 |
'ItemSafeToDelete reports linked analytics', |
119 |
); |
119 |
); |
120 |
|
120 |
|
121 |
is( |
121 |
is( |
122 |
DelItemCheck($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
122 |
DelItemCheck( $biblio->{biblionumber}, $item->{itemnumber} ), |
123 |
'linked_analytics', |
123 |
'linked_analytics', |
124 |
'Linked analytics prevents deletion of item', |
124 |
'Linked analytics prevents deletion of item', |
125 |
); |
125 |
); |
Lines 127-143
ModItem( { homebranch => $branch->{branchcode}, holdingbranch => $branch->{branc
Link Here
|
127 |
} |
127 |
} |
128 |
|
128 |
|
129 |
is( |
129 |
is( |
130 |
ItemSafeToDelete($dbh, $biblio->{biblionumber}, $item->{itemnumber} ), |
130 |
ItemSafeToDelete( $biblio->{biblionumber}, $item->{itemnumber} ), |
131 |
1, |
131 |
1, |
132 |
'ItemSafeToDelete shows item safe to delete' |
132 |
'ItemSafeToDelete shows item safe to delete' |
133 |
); |
133 |
); |
134 |
|
134 |
|
135 |
DelItemCheck( $dbh, $biblio->{biblionumber}, $item->{itemnumber} ); |
135 |
DelItemCheck( $biblio->{biblionumber}, $item->{itemnumber} ); |
136 |
|
136 |
|
137 |
my $test_item = GetItem( $item->{itemnumber} ); |
137 |
my $test_item = GetItem( $item->{itemnumber} ); |
138 |
|
138 |
|
139 |
is( $test_item->{itemnumber}, undef, |
139 |
is( $test_item->{itemnumber}, undef, |
140 |
"DelItemCheck should delete item if 'do_not_commit' not set" |
140 |
"DelItemCheck should delete item if ItemSafeToDelete returns true" |
141 |
); |
141 |
); |
142 |
|
142 |
|
143 |
# End of testing |
143 |
# End of testing |