From: ivan Date: Fri, 5 Oct 2007 00:39:58 +0000 (+0000) Subject: add disable ability to conditions & disable cust_bill_has_service, so the condition... X-Git-Tag: TRIXBOX_2_6~293 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=7349e2c4d087cee96f677dc05e316885386428a7 add disable ability to conditions & disable cust_bill_has_service, so the condition edit page renders again --- diff --git a/FS/FS/part_event/Condition.pm b/FS/FS/part_event/Condition.pm index 0b9d57912..3c0904c6c 100644 --- a/FS/FS/part_event/Condition.pm +++ b/FS/FS/part_event/Condition.pm @@ -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 and I conditions. You probably diff --git a/FS/FS/part_event/Condition/cust_bill_has_service.pm b/FS/FS/part_event/Condition/cust_bill_has_service.pm index c28047cdd..ff02035d3 100644 --- a/FS/FS/part_event/Condition/cust_bill_has_service.pm +++ b/FS/FS/part_event/Condition/cust_bill_has_service.pm @@ -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', diff --git a/FS/FS/part_event_condition.pm b/FS/FS/part_event_condition.pm index 200d4fcd6..d13e84927 100644 --- a/FS/FS/part_event_condition.pm +++ b/FS/FS/part_event_condition.pm @@ -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')