Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
# Add constraint for manager_id
unless( foreign_key_exists( 'accountlines', 'accountlines_ibfk_borrowers_2' ) ) {
- $dbh->do("ALTER TABLE accountlines CHANGE COLUMN manager_id manager_id INT(11) NULL DEFAULT NULL;");
- $dbh->do("UPDATE accountlines a LEFT JOIN borrowers b ON ( a.manager_id = b.borrowernumber) SET a.manager_id = NULL WHERE b.borrowernumber IS NULL;
+ $dbh->do("ALTER TABLE accountlines CHANGE COLUMN manager_id manager_id INT(11) NULL DEFAULT NULL");
+ $dbh->do("UPDATE accountlines a LEFT JOIN borrowers b ON ( a.manager_id = b.borrowernumber) SET a.manager_id = NULL WHERE b.borrowernumber IS NULL");
$dbh->do("ALTER TABLE accountlines ADD CONSTRAINT `accountlines_ibfk_borrowers_2` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE");
}
my $item = $builder->build_object({ class => 'Koha::Items' });
my $issue = $builder->build_object(
{
- class => 'Koha::Checkout',
+ class => 'Koha::Checkouts',
value => { itemnumber => $item->itemnumber }
}
);
amount => 10,
})->store;
+ $issue->delete;
$item->delete;
$line = $line->get_from_storage;
is( $line->itemnumber, undef, "The account line should not be deleted when the related item is delete");