Move block() from the ILS into the ILS::Patron. Create the
authordjfiander <djfiander>
Sat, 15 Apr 2006 00:44:15 +0000 (00:44 +0000)
committerdjfiander <djfiander>
Sat, 15 Apr 2006 00:44:15 +0000 (00:44 +0000)
opposite enable() method to support the Patron Enable message

ILS/Patron.pm

index 979f654..4fa5f13 100644 (file)
@@ -95,6 +95,12 @@ sub home_phone {
     return $self->{home_phone};
 }
 
+sub language {
+    my $self = shift;
+
+    return $self->{language} || '000'; # Unspecified
+}
+
 sub charge_ok {
     my $self = shift;
 
@@ -350,6 +356,35 @@ sub fee_items_count {
 
     return scalar @{$self->{fee_items}};
 }
+
+sub block {
+    my ($self, $card_retained, $blocked_card_msg) = @_;
+
+    foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok') {
+       $self->{$field} = 'N';
+    }
+
+    $self->{screen_msg} = $blocked_card_msg || "Card Blocked.  Please contact library staff";
+
+    return $self;
+}
+
+sub enable {
+    my $self = shift;
+
+    foreach my $field ('charge_ok', 'renew_ok', 'recall_ok', 'hold_ok') {
+       $self->{$field} = 'Y';
+    }
+
+    syslog("DEBUG", "Patron(%s)->enable: charge: %s, renew:%s, recall:%s",
+          $self->{id}, $self->{charge_ok}, $self->{renew_ok},
+          $self->{recall_ok});
+
+    $self->{screen_msg} = "All privileges restored.";
+
+    return $self;
+}
+
 #
 # Messages
 #