die $error if $error;
}
}
+
+ # migrate use_disposition_taqua and use_disposition to disposition_in
+ @part_pkg_option = qsearch('part_pkg_option',
+ { 'optionname' => { op => 'LIKE',
+ value => 'use_disposition%',
+ },
+ 'optionvalue' => 1,
+ });
+ my %newopts = map { $_->pkgpart => $_ }
+ qsearch('part_pkg_option', { 'optionname' => 'disposition_in', } );
+ foreach my $old_opt (@part_pkg_option) {
+ my $pkgpart = $old_opt->pkgpart;
+ my $newval = $old_opt->optionname eq 'use_disposition_taqua' ? '100'
+ : 'ANSWERED';
+ my $error = $old_opt->delete;
+ die $error if $error;
+
+ if ( exists($newopts{$pkgpart}) ) {
+ my $opt = $newopts{$pkgpart};
+ $opt->optionvalue($opt->optionvalue.",$newval");
+ $error = $opt->replace;
+ die $error if $error;
+ } else {
+ my $new_opt = new FS::part_pkg_option {
+ 'pkgpart' => $pkgpart,
+ 'optionname' => 'disposition_in',
+ 'optionvalue' => $newval,
+ };
+ $error = $new_opt->insert;
+ die $error if $error;
+ $newopts{$pkgpart} = $new_opt;
+ }
+ }
+
}
=item curuser_pkgs_sql
'type' => 'checkbox',
},
- 'use_disposition' => { 'name' => 'Do not charge for CDRs where the disposition flag is not set to "ANSWERED".',
- 'type' => 'checkbox',
- },
-
- 'use_disposition_taqua' => { 'name' => 'Do not charge for CDRs where the disposition is not set to "100" (Taqua).',
- 'type' => 'checkbox',
- },
-
'use_carrierid' => { 'name' => 'Do not charge for CDRs where the Carrier ID is not set to: ',
},
'ignore_disposition' => { 'name' => 'Do not charge for CDRs where the Disposition is set to any of these (comma-separated) values: ',
},
+
+ 'disposition_in' => { 'name' => 'Do not charge for CDRs where the Disposition is not set to any of these (comma-separated) values: ',
+ },
'skip_dst_prefix' => { 'name' => 'Do not charge for CDRs where the destination number starts with any of these values: ',
},
disable_src
domestic_prefix international_prefix
disable_tollfree
- use_amaflags use_disposition
- use_disposition_taqua use_carrierid
+ use_amaflags
+ use_carrierid
use_cdrtypenum ignore_cdrtypenum
- ignore_disposition
+ ignore_disposition disposition_in
skip_dcontext skip_dst_prefix
skip_dstchannel_prefix skip_src_length_more
noskip_src_length_accountcode_tollfree
my @opt = qw(
use_amaflags
- use_disposition
- use_disposition_taqua
use_carrierid
use_cdrtypenum
ignore_cdrtypenum
+ disposition_in
ignore_disposition
skip_dst_prefix
skip_dcontext
return 'amaflags != 2'
if $opt{'use_amaflags'} && $cdr->amaflags != 2;
- return 'disposition != ANSWERED'
- if $opt{'use_disposition'} && $cdr->disposition ne 'ANSWERED';
-
- return "disposition != 100"
- if $opt{'use_disposition_taqua'} && $cdr->disposition != 100;
+ return "disposition NOT IN ( $opt{'disposition_in'} )"
+ if $opt{'disposition_in'} =~ /\S/
+ && !grep { $cdr->disposition eq $_ } split(/\s*,\s*/, $opt{'disposition_in'});
return "disposition IN ( $opt{'ignore_disposition'} )"
if $opt{'ignore_disposition'} =~ /\S/
'type' => 'checkbox',
},
- 'use_disposition' => { 'name' => 'Do not charge for CDRs where the disposition flag is not set to "ANSWERED".',
- 'type' => 'checkbox',
- },
-
- 'use_disposition_taqua' => { 'name' => 'Do not charge for CDRs where the disposition is not set to "100" (Taqua).',
- 'type' => 'checkbox',
- },
-
'use_carrierid' => { 'name' => 'Do not charge for CDRs where the Carrier ID is not set to: ',
},
'ignore_disposition' => { 'name' => 'Do not charge for CDRs where the Disposition is set to any of these (comma-separated) values: ',
},
+
+ 'disposition_in' => { 'name' => 'Do not charge for CDRs where the Disposition is not set to any of these (comma-separated) values: ',
+ },
'skip_dcontext' => { 'name' => 'Do not charge for CDRs where the dcontext is set to any of these (comma-separated) values:',
},
min_charge min_included sec_granularity
default_prefix
disable_tollfree
- use_amaflags use_disposition
- use_disposition_taqua use_carrierid
+ use_amaflags
+ use_carrierid
use_cdrtypenum ignore_cdrtypenum
- ignore_disposition
+ ignore_disposition disposition_in
skip_dcontext skip_dstchannel_prefix
skip_dst_length_less skip_lastapp
use_duration
my @opt = qw(
use_amaflags
- use_disposition
- use_disposition_taqua
use_carrierid
use_cdrtypenum
ignore_cdrtypenum
+ disposition_in
ignore_disposition
skip_dcontext
skip_dstchannel_prefix
return 'amaflags != 2'
if $opt{'use_amaflags'} && $cdr->amaflags != 2;
- return 'disposition != ANSWERED'
- if $opt{'use_disposition'} && $cdr->disposition ne 'ANSWERED';
-
- return "disposition != 100"
- if $opt{'use_disposition_taqua'} && $cdr->disposition != 100;
+ return "disposition NOT IN ( $opt{'disposition_in'} )"
+ if $opt{'disposition_in'} =~ /\S/
+ && !grep { $cdr->disposition eq $_ } split(/\s*,\s*/, $opt{'disposition_in'});
return "disposition IN ( $opt{'ignore_disposition'} )"
if $opt{'ignore_disposition'} =~ /\S/