Bug 25695: merge of similar code blocks after circulation_rules update
authorSlava Shishkin <slavashishkin@gmail.com>
Thu, 18 Jun 2020 09:11:29 +0000 (12:11 +0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 9 Jul 2020 09:50:42 +0000 (11:50 +0200)
In onboarding.pl we have second block with adding just one more
rule parameter (maxissueqty) which can be merged to first one
after all parameters now stored in circulation_rules table.

Also this eliminates the need of adding forgotten "warn $@" after
the second eval block.

Mentored-by: Andrew Nugged <nugged@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

installer/onboarding.pl

index 5d10d23..7a76342 100755 (executable)
@@ -272,7 +272,7 @@ if ( $step == 5 ) {
                 hardduedatecompare               => -1,
                 holds_per_day                    => $holds_per_day,
                 holds_per_record                 => $holds_per_record,
-                maxissueqty                      => "",
+                maxissueqty                      => $maxissueqty,
                 maxonsiteissueqty                => "",
                 maxsuspensiondays                => "",
                 no_auto_renewal_after            => "",
@@ -294,26 +294,7 @@ if ( $step == 5 ) {
             warn $@;
             push @messages, { code => 'error_on_insert_circ_rule' };
         } else {
-
-            eval {
-                Koha::CirculationRules->set_rules(
-                    {
-                        categorycode => $categorycode,
-                        itemtype     => $itemtype,
-                        branchcode   => $branchcode,
-                        rules        => {
-                            maxissueqty => $maxissueqty,
-                        }
-                    }
-                );
-            };
-
-            unless ($@) {
-                push @messages, { code => 'success_on_insert_circ_rule' };
-            }
-            else {
-                push @messages, { code => 'error_on_insert_circ_rule' };
-            }
+            push @messages, { code => 'success_on_insert_circ_rule' };
         }
     }