Bug 11529: Remove duplicate column name from select query
[koha-ffzg.git] / Koha / IssuingRule.pm
index 4b3d012..cb9ac70 100644 (file)
@@ -31,12 +31,38 @@ Koha::Hold - Koha Hold object class
 
 =cut
 
+=head3 delete
+
+=cut
+
+sub delete {
+    my ($self) = @_;
+
+    my $branchcode = $self->branchcode eq '*' ? undef : $self->branchcode;
+    my $categorycode = $self->categorycode eq '*' ? undef : $self->categorycode;
+    my $itemtype = $self->itemtype eq '*' ? undef : $self->itemtype;
+
+    Koha::CirculationRules->search({
+        branchcode   => $branchcode,
+        itemtype     => $itemtype,
+        categorycode => $categorycode,
+        rule_name => [qw(
+            maxissueqty
+            maxonsiteissueqty
+            max_holds
+        )],
+    })->delete;
+
+    $self->SUPER::delete;
+
+}
+
 =head3 type
 
 =cut
 
-sub type {
+sub _type {
     return 'Issuingrule';
 }
 
-1;
\ No newline at end of file
+1;