Bug 5786 - Move AllowOnShelfHolds and OPACItemHolds system prefs to the Circulation...
[koha.git] / t / db_dependent / Circulation_Issuingrule.t
index a9f9fb5..b1d9d72 100644 (file)
@@ -116,6 +116,8 @@ my $sampleissuingrule1 = {
     finedays           => 0,
     lengthunit         => 'Null',
     renewalperiod      => 5,
+    norenewalbefore    => 6,
+    auto_renew         => 0,
     issuelength        => 5,
     chargeperiod       => 0,
     rentaldiscount     => '2.000000',
@@ -128,7 +130,10 @@ my $sampleissuingrule1 = {
     renewalsallowed    => 0,
     firstremind        => 0,
     itemtype           => 'BOOK',
-    categorycode       => $samplecat->{categorycode}
+    categorycode       => $samplecat->{categorycode},
+    maxsuspensiondays  => 0,
+    onshelfholds       => 0,
+    opacitemholds      => 'N',
 };
 my $sampleissuingrule2 = {
     branchcode         => $samplebranch2->{branchcode},
@@ -137,6 +142,8 @@ my $sampleissuingrule2 = {
     maxissueqty        => 2,
     renewalsallowed    => 'Null',
     renewalperiod      => 2,
+    norenewalbefore    => 7,
+    auto_renew         => 0,
     reservesallowed    => 'Null',
     issuelength        => 2,
     lengthunit         => 'Null',
@@ -151,7 +158,10 @@ my $sampleissuingrule2 = {
     accountsent        => 'Null',
     reservecharge      => 'Null',
     chargename         => 'Null',
-    restrictedtype     => 'Null'
+    restrictedtype     => 'Null',
+    maxsuspensiondays  => 0,
+    onshelfholds       => 1,
+    opacitemholds      => 'Y',
 };
 my $sampleissuingrule3 = {
     branchcode         => $samplebranch1->{branchcode},
@@ -160,6 +170,8 @@ my $sampleissuingrule3 = {
     maxissueqty        => 3,
     renewalsallowed    => 'Null',
     renewalperiod      => 3,
+    norenewalbefore    => 8,
+    auto_renew         => 0,
     reservesallowed    => 'Null',
     issuelength        => 3,
     lengthunit         => 'Null',
@@ -174,7 +186,10 @@ my $sampleissuingrule3 = {
     accountsent        => 'Null',
     reservecharge      => 'Null',
     chargename         => 'Null',
-    restrictedtype     => 'Null'
+    restrictedtype     => 'Null',
+    maxsuspensiondays  => 0,
+    onshelfholds       => 1,
+    opacitemholds      => 'F',
 };
 $query = 'INSERT INTO issuingrules (
                 branchcode,
@@ -183,6 +198,8 @@ $query = 'INSERT INTO issuingrules (
                 maxissueqty,
                 renewalsallowed,
                 renewalperiod,
+                norenewalbefore,
+                auto_renew,
                 reservesallowed,
                 issuelength,
                 lengthunit,
@@ -197,8 +214,9 @@ $query = 'INSERT INTO issuingrules (
                 accountsent,
                 reservecharge,
                 chargename,
-                restrictedtype
-                ) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
+                restrictedtype,
+                maxsuspensiondays
+                ) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
 my $sth = $dbh->prepare($query);
 $sth->execute(
     $sampleissuingrule1->{branchcode},
@@ -207,6 +225,8 @@ $sth->execute(
     $sampleissuingrule1->{maxissueqty},
     $sampleissuingrule1->{renewalsallowed},
     $sampleissuingrule1->{renewalperiod},
+    $sampleissuingrule1->{norenewalbefore},
+    $sampleissuingrule1->{auto_renew},
     $sampleissuingrule1->{reservesallowed},
     $sampleissuingrule1->{issuelength},
     $sampleissuingrule1->{lengthunit},
@@ -221,7 +241,8 @@ $sth->execute(
     $sampleissuingrule1->{accountsent},
     $sampleissuingrule1->{reservecharge},
     $sampleissuingrule1->{chargename},
-    $sampleissuingrule1->{restrictedtype}
+    $sampleissuingrule1->{restrictedtype},
+    $sampleissuingrule1->{maxsuspensiondays},
 );
 $sth->execute(
     $sampleissuingrule2->{branchcode},
@@ -230,6 +251,8 @@ $sth->execute(
     $sampleissuingrule2->{maxissueqty},
     $sampleissuingrule2->{renewalsallowed},
     $sampleissuingrule2->{renewalperiod},
+    $sampleissuingrule2->{norenewalbefore},
+    $sampleissuingrule2->{auto_renew},
     $sampleissuingrule2->{reservesallowed},
     $sampleissuingrule2->{issuelength},
     $sampleissuingrule2->{lengthunit},
@@ -244,7 +267,8 @@ $sth->execute(
     $sampleissuingrule2->{accountsent},
     $sampleissuingrule2->{reservecharge},
     $sampleissuingrule2->{chargename},
-    $sampleissuingrule2->{restrictedtype}
+    $sampleissuingrule2->{restrictedtype},
+    $sampleissuingrule2->{maxsuspensiondays},
 );
 $sth->execute(
     $sampleissuingrule3->{branchcode},
@@ -253,6 +277,8 @@ $sth->execute(
     $sampleissuingrule3->{maxissueqty},
     $sampleissuingrule3->{renewalsallowed},
     $sampleissuingrule3->{renewalperiod},
+    $sampleissuingrule3->{norenewalbefore},
+    $sampleissuingrule3->{auto_renew},
     $sampleissuingrule3->{reservesallowed},
     $sampleissuingrule3->{issuelength},
     $sampleissuingrule3->{lengthunit},
@@ -267,7 +293,8 @@ $sth->execute(
     $sampleissuingrule3->{accountsent},
     $sampleissuingrule3->{reservecharge},
     $sampleissuingrule3->{chargename},
-    $sampleissuingrule3->{restrictedtype}
+    $sampleissuingrule3->{restrictedtype},
+    $sampleissuingrule3->{maxsuspensiondays},
 );
 
 is_deeply(
@@ -279,15 +306,6 @@ is_deeply(
     "GetIssuingCharge returns issuingrule1's informations"
 );
 
-#FIX ME: Currently, GetIssuingRule without parameters returns an issuingrule with branchcode -> *,categorycode -> *, itemtype -> *
-#is_deeply ( GetIssuingRule(),{$sampleissuingrule1,$sampleissuingrule2,$sampleissuingrule3},"Without parameters, GetIssuingRule returns all the issuingrule");
-
-#FIX ME: Currently, GetIssuingRule with only one parameter returns an issuingrule with branchcode -> *,categorycode -> *, itemtype -> *
-#is_deeply(GetIssuingRule($samplecat->{categorycode}),{$sampleissuingrule1,$sampleissuingrule2,$sampleissuingrule3},"GetIssuingRule with a categorycode returns all the issuingrules of this category");
-
-#FIX ME: Currently, GetIssuingRule with only two parameters returns an issuingrule with branchcode -> *,categorycode -> *, itemtype -> *
-#is_deeply(GetIssuingRule($samplecat->{categorycode},'BOOK'),{$sampleissuingrule1,$sampleissuingrule2},"GetIssuingRule with a categorycode and'Book' returns all the issuingrules of this category and the itemtype = book");
-
 #Test GetLoanLength
 is_deeply(
     C4::Circulation::GetLoanLength(
@@ -346,12 +364,5 @@ is_deeply(
     "GetHardDueDate returns the duedate and the duedatecompare"
 );
 
-#FIXME: Currently, with wrong parameters GetHardDueDate returns '' because GetIssuingrule returns wrong value
-#@hardduedate = C4::Circulation::GetHardDueDate(-1,-1,-1);
-#is_deeply(\@hardduedate,[undef,undef],"GetHardDueDate with wrong parameters returns undef");
-#FIXME: Currently, without parameter GetHardDueDate returns '' because GetIssuingrule returns wrong value
-#@hardduedate = C4::Circulation::GetHardDueDate();
-#is_deeply(\@hardduedate,[undef,undef],"GetHardDueDate without parameter returns undef");
-
 #End transaction
 $dbh->rollback;