underscoring the important
[freeside.git] / FS / FS / cust_credit.pm
index cbdc71d..938686f 100644 (file)
@@ -262,11 +262,14 @@ methods.
 sub check {
   my $self = shift;
 
+  $self->otaker(getotaker) unless ($self->otaker);
+
   my $error =
     $self->ut_numbern('crednum')
     || $self->ut_number('custnum')
     || $self->ut_numbern('_date')
     || $self->ut_money('amount')
+    || $self->ut_alpha('otaker')
     || $self->ut_textn('reason')
     || $self->ut_foreign_key('reasonnum', 'reason', 'reasonnum')
     || $self->ut_enum('closed', [ '', 'Y' ])
@@ -280,8 +283,6 @@ sub check {
 
   $self->_date(time) unless $self->_date;
 
-  $self->otaker(getotaker) unless ($self->otaker);
-
   $self->SUPER::check;
 }
 
@@ -419,9 +420,9 @@ sub _upgrade_data {  # class method
 
     warn "$me Checking for unmigrated reasons\n" if $DEBUG;
 
-    my @cust_credits = qsearch({ 'table' => $class->table,
-                                 'hashref' => {},
-                                 'extrasql' => 'WHERE reason IS NOT NULL',
+    my @cust_credits = qsearch({ 'table'     => $class->table,
+                                 'hashref'   => {},
+                                 'extra_sql' => 'WHERE reason IS NOT NULL',
                               });
 
     if (scalar(grep { $_->getfield('reason') =~ /\S/ } @cust_credits)) {
@@ -480,8 +481,7 @@ sub _upgrade_data {  # class method
           die "$class had error inserting FS::reason_type into database: $error\n"
             if $error;
         }
-                                            # or clause for 1.7.x
-        $conf->set($_, $reason_type->typenum) or die "failed setting config";
+        $conf->set($_, $reason_type->typenum);
       }
     }