add disable ability to conditions & disable cust_bill_has_service, so the condition...
authorivan <ivan>
Fri, 5 Oct 2007 00:39:58 +0000 (00:39 +0000)
committerivan <ivan>
Fri, 5 Oct 2007 00:39:58 +0000 (00:39 +0000)
FS/FS/part_event/Condition.pm
FS/FS/part_event/Condition/cust_bill_has_service.pm
FS/FS/part_event_condition.pm

index 0b9d579..3c0904c 100644 (file)
@@ -152,6 +152,17 @@ sub condition_sql {
   'true';
 }
 
+=item disabled
+
+Condition classes may optionally define a disabled method.  Returning a true
+value disbles the condition entirely.
+
+=cut
+
+sub disabled {
+  0;
+}
+
 =item implicit_flag
 
 This is used internally by the I<once> and I<balance> conditions.  You probably
index c28047c..ff02035 100644 (file)
@@ -16,6 +16,9 @@ sub eventtable_hashref {
     };
 }
 
+# could not find component for path '/elements/tr-select-part_svc.html'
+sub disabled { 1; }
+
 sub option_fields {
   (
     'has_service' => { 'label'      => 'Has service',
index 200d4fc..d13e849 100644 (file)
@@ -191,6 +191,10 @@ foreach my $INC ( @INC ) {
       #warn "error using $fullmod (skipping): $@\n" if $@;
       #next;
     }
+    if ( $fullmod->disabled ) {
+      warn "$fullmod is disabled; skipping\n";
+      next;
+    }
     #my $full_condition_sql = $fullmod. '::condition_sql';
     my $condition_sql_coderef = sub { $fullmod->condition_sql(@_) };
     my $order_sql_coderef = $fullmod->can('order_sql')