Bug 18925: Move maxissueqty and maxonsiteissueqty to circulation_rules
[koha.git] / t / db_dependent / Circulation.t
index a8758f1..eafc2d8 100755 (executable)
@@ -41,6 +41,7 @@ use Koha::IssuingRules;
 use Koha::Items;
 use Koha::Checkouts;
 use Koha::Patrons;
+use Koha::CirculationRules;
 use Koha::Subscriptions;
 use Koha::Account::Lines;
 use Koha::Account::Offsets;
@@ -189,14 +190,15 @@ is(
 
 # Set a simple circ policy
 $dbh->do('DELETE FROM issuingrules');
+Koha::CirculationRules->search()->delete();
 $dbh->do(
     q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed,
-                                maxissueqty, issuelength, lengthunit,
+                                issuelength, lengthunit,
                                 renewalsallowed, renewalperiod,
                                 norenewalbefore, auto_renew,
                                 fine, chargeperiod)
       VALUES (?, ?, ?, ?,
-              ?, ?, ?,
+              ?, ?,
               ?, ?,
               ?, ?,
               ?, ?
@@ -204,7 +206,7 @@ $dbh->do(
     },
     {},
     '*', '*', '*', 25,
-    20, 14, 'days',
+    14, 'days',
     1, 7,
     undef, 0,
     .10, 1
@@ -1008,18 +1010,29 @@ my ( $reused_itemnumber_1, $reused_itemnumber_2 );
     $dbh->do('DELETE FROM issues');
     $dbh->do('DELETE FROM items');
     $dbh->do('DELETE FROM issuingrules');
+    Koha::CirculationRules->search()->delete();
     $dbh->do(
         q{
-        INSERT INTO issuingrules ( categorycode, branchcode, itemtype, reservesallowed, maxissueqty, issuelength, lengthunit, renewalsallowed, renewalperiod,
-                    norenewalbefore, auto_renew, fine, chargeperiod ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
+        INSERT INTO issuingrules ( categorycode, branchcode, itemtype, reservesallowed, issuelength, lengthunit, renewalsallowed, renewalperiod,
+                    norenewalbefore, auto_renew, fine, chargeperiod ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
         },
         {},
         '*', '*', '*', 25,
-        20,  14,  'days',
+        14,  'days',
         1,   7,
         undef,  0,
         .10, 1
     );
+    Koha::CirculationRules->set_rules(
+        {
+            categorycode => '*',
+            itemtype     => '*',
+            branchcode   => '*',
+            rules        => {
+                maxissueqty => 20
+            }
+        }
+    );
     my $biblio = $builder->build_sample_biblio();
 
     my $item_1 = $builder->build_sample_item(
@@ -1605,7 +1618,6 @@ subtest 'AddReturn + CumulativeRestrictionPeriods' => sub {
             categorycode => '*',
             itemtype     => '*',
             branchcode   => '*',
-            maxissueqty  => 99,
             issuelength  => 1,
             firstremind  => 1,        # 1 day of grace
             finedays     => 2,        # 2 days of fine per day of overdue