-
- if(!defined($weektime)) {
- return qsearchs( 'rate_detail',
- { 'ratenum' => $self->ratenum,
- 'dest_regionnum' => $regionnum,
- 'ratetimenum' => '',
- } );
+
+ my %hash = (
+ 'ratenum' => $self->ratenum,
+ 'dest_regionnum' => $regionnum,
+ );
+
+ # find all rates matching ratenum, regionnum, cdrtypenum
+ my @details = qsearch( 'rate_detail', {
+ %hash,
+ 'cdrtypenum' => $cdrtypenum
+ });
+ # find all rates maching ratenum, regionnum and null cdrtypenum
+ if ( !@details and $cdrtypenum ) {
+ @details = qsearch( 'rate_detail', {
+ %hash,
+ 'cdrtypenum' => ''
+ });