import torrus 1.0.9
[freeside.git] / FS / FS / part_event / Condition / once.pm
index adab243..d004814 100644 (file)
@@ -7,7 +7,7 @@ use FS::cust_event;
 
 use base qw( FS::part_event::Condition );
 
-sub description { "Don't run this event again after it has completed sucessfully"; }
+sub description { "Don't run this event again after it has completed successfully"; }
 
 sub implicit_flag { 10; }
 
@@ -20,19 +20,18 @@ sub condition {
 
   my $obj_pkey = $object->primary_key;
   my $tablenum = $object->$obj_pkey();
-  
   my @existing = qsearch( {
-    'table'    => 'cust_event',
-    'hashref'  => {
-                    'eventpart' => $self->eventpart,
-                    'tablenum'  => $tablenum,
-                    #'status'    => { op=>'NOT IN', value=>"('failed','new')" },
-                    'status'    => { op=>'!=', value=>'failed' },
-                  },
-    'addl_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/
-                      ? " AND eventnum != $1 "
-                      : ''
-                  ),
+    'table'     => 'cust_event',
+    'hashref'   => {
+                     'eventpart' => $self->eventpart,
+                     'tablenum'  => $tablenum,
+                     'status'    => { op=>'!=', value=>'failed' },
+                   },
+    'extra_sql' => ( $opt{'cust_event'}->eventnum =~ /^(\d+)$/
+                       ? " AND eventnum != $1 "
+                       : ''
+                   ),
   } );
 
   ! scalar(@existing);