Bug 17600: Standardize our EXPORT_OK
[srvgit] / Koha / CirculationRules.pm
index 5b63998..d1c5648 100644 (file)
@@ -18,7 +18,7 @@ package Koha::CirculationRules;
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use Carp qw(croak);
+use Carp qw( croak );
 
 use Koha::Exceptions;
 use Koha::CirculationRule;
@@ -46,7 +46,7 @@ Any attempt to set a rule with a nonsensical scope (for instance, setting the C<
 =cut
 
 our $RULE_KINDS = {
-    refund => {
+    lostreturn => {
         scope => [ 'branchcode' ],
     },
 
@@ -151,6 +151,9 @@ our $RULE_KINDS = {
     renewalsallowed => {
         scope => [ 'branchcode', 'categorycode', 'itemtype' ],
     },
+    unseen_renewals_allowed => {
+        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+    },
     rentaldiscount => {
         scope => [ 'branchcode', 'categorycode', 'itemtype' ],
     },
@@ -163,6 +166,9 @@ our $RULE_KINDS = {
     note => { # This is not really a rule. Maybe we will want to separate this later.
         scope => [ 'branchcode', 'categorycode', 'itemtype' ],
     },
+    decreaseloanholds => {
+        scope => [ 'branchcode', 'categorycode', 'itemtype' ],
+    },
     # Not included (deprecated?):
     #   * accountsent
     #   * reservecharge
@@ -282,7 +288,7 @@ sub set_rule {
     my $rule_name    = $params->{rule_name};
     my $rule_value   = $params->{rule_value};
     my $can_be_blank = defined $kind_info->{can_be_blank} ? $kind_info->{can_be_blank} : 1;
-    $rule_value = undef if $rule_value eq "" && !$can_be_blank;
+    $rule_value = undef if defined $rule_value && $rule_value eq "" && !$can_be_blank;
 
     for my $v ( $branchcode, $categorycode, $itemtype ) {
         $v = undef if $v and $v eq '*';
@@ -433,7 +439,21 @@ sub get_onshelfholds_policy {
 
 =head3 get_lostreturn_policy
 
-  my $refund = Koha::CirculationRules->get_lostreturn_policy( { return_branch => $return_branch, item => $item } );
+  my $lostrefund_policy = Koha::CirculationRules->get_lostreturn_policy( { return_branch => $return_branch, item => $item } );
+
+Return values are:
+
+=over 2
+
+=item '0' - Do not refund
+
+=item 'refund' - Refund the lost item charge
+
+=item 'restore' - Refund the lost item charge and restore the original overdue fine
+
+=item 'charge' - Refund the lost item charge and charge a new overdue fine
+
+=back
 
 =cut
 
@@ -454,11 +474,11 @@ sub get_lostreturn_policy {
     my $rule = Koha::CirculationRules->get_effective_rule(
         {
             branchcode => $branch,
-            rule_name  => 'refund',
+            rule_name  => 'lostreturn',
         }
     );
 
-    return $rule ? $rule->rule_value : 1;
+    return $rule ? $rule->rule_value : 'refund';
 }
 
 =head3 article_requestable_rules