Bug 10729: Add phrases configuration for ICU
[koha_fer] / C4 / SIP / ILS.pm
index 9e20845..e2089e8 100644 (file)
@@ -32,7 +32,7 @@ my %supports = (
     "login"                 => 1,
     "patron information"    => 1,
     "end patron session"    => 1,
-    "fee paid"              => 0,
+    "fee paid"              => 1,
     "item information"      => 1,
     "item status update"    => 0,
     "patron enable"         => 1,
@@ -181,7 +181,7 @@ sub checkin {
     $circ->item($item = new ILS::Item $item_id);
 
     if ($item) {
-        $circ->do_checkin($current_loc, $return_date);
+        $circ->do_checkin($current_loc);
     } else {
         $circ->alert(1);
         $circ->alert_type(99);
@@ -190,12 +190,16 @@ sub checkin {
        # It's ok to check it in if it exists, and if it was checked out
        $circ->ok($item && $item->{patron});
 
-    if ($circ->ok) {
-               $circ->patron($patron = new ILS::Patron $item->{patron});
-               delete $item->{patron};
-               delete $item->{due_date};
-               $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
-    }
+       if (!defined($item->{patron})) {
+               $circ->screen_msg("Item not checked out");
+       } else {
+               if ($circ->ok) {
+                       $circ->patron($patron = new ILS::Patron $item->{patron});
+                       delete $item->{patron};
+                       delete $item->{due_date};
+                       $patron->{items} = [ grep {$_ ne $item_id} @{$patron->{items}} ];
+               }
+       }
     # END TRANSACTION
 
     return $circ;
@@ -214,14 +218,18 @@ sub pay_fee {
     my ($self, $patron_id, $patron_pwd, $fee_amt, $fee_type,
        $pay_type, $fee_id, $trans_id, $currency) = @_;
     my $trans;
-    my $patron;
 
-#    $trans = new ILS::Transaction::FeePayment;
+    $trans = ILS::Transaction::FeePayment->new();
 
-    $patron = new ILS::Patron $patron_id;
 
     $trans->transaction_id($trans_id);
-    $trans->patron($patron);
+    my $patron;
+    $trans->patron($patron = ILS::Patron->new($patron_id));
+    if (!$patron) {
+        $trans->screen_msg('Invalid patron barcode.');
+        return $trans;
+    }
+    $trans->pay($patron->{borrowernumber},$fee_amt, $pay_type);
     $trans->ok(1);
 
     return $trans;
@@ -246,6 +254,10 @@ sub add_hold {
                return $trans;
        }
 
+    if ( $patron->holds_blocked_by_excessive_fees() ) {
+        $trans->screen_msg("Excessive fees blocking placement of hold.");
+    }
+
    if ($item->fee and $fee_ack ne 'Y') {
                $trans->screen_msg = "Fee required to place hold.";
                return $trans;
@@ -420,17 +432,12 @@ sub renew {
     if (!defined($item)) {
                $trans->screen_msg("Item not checked out to " . $patron->name);     # not checked out to $patron_id
         $trans->ok(0);
-    } elsif (!$item->available($patron_id)) {
-               $trans->screen_msg("Item unavailable due to outstanding holds");
-        $trans->ok(0);
     } else {
-               $trans->renewal_ok(1);
-               $trans->desensitize(0); # It's already checked out
-               $trans->do_renew();
-               syslog("LOG_DEBUG", "done renew (ok:%s): %s renews %s", $trans->renewal_ok, $patron_id, $item_id);
-
-#              $item->{due_date} = $nb_due_date if $no_block eq 'Y';
-#              $item->{sip_item_properties} = $item_props if $item_props;
+        $trans->do_renew();
+        if ($trans->renewal_ok()) {
+            $item->{due_date} = $trans->{due};
+            $trans->desensitize(0);
+        }
     }
 
     return $trans;