Bug 22679: Delete related CirculationRules when Removing IssuingRule
[koha-equinox.git] / admin / smart-rules.pl
index d248f4a..927533d 100755 (executable)
@@ -82,8 +82,12 @@ if ($op eq 'delete') {
     my $categorycode = $input->param('categorycode');
     $debug and warn "deleting $1 $2 $branch";
 
-    my $sth_Idelete = $dbh->prepare("delete from issuingrules where branchcode=? and categorycode=? and itemtype=?");
-    $sth_Idelete->execute($branch, $categorycode, $itemtype);
+    Koha::IssuingRules->find({
+        branchcode   => $branch,
+        categorycode => $categorycode,
+        itemtype     => $itemtype
+    })->delete;
+
 }
 elsif ($op eq 'delete-branch-cat') {
     my $categorycode  = $input->param('categorycode');