From 7349e2c4d087cee96f677dc05e316885386428a7 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Oct 2007 00:39:58 +0000 Subject: [PATCH] add disable ability to conditions & disable cust_bill_has_service, so the condition edit page renders again --- FS/FS/part_event/Condition.pm | 11 +++++++++++ FS/FS/part_event/Condition/cust_bill_has_service.pm | 3 +++ FS/FS/part_event_condition.pm | 4 ++++ 3 files changed, 18 insertions(+) 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') -- 2.11.0