Ticket #248: Class.RateEngine.php.patch

File Class.RateEngine.php.patch, 1.8 kB (added by kovzol, 5 months ago)

patch for Class.RateEngine?.php (AGI script)

  • Class.RateEngine.php

    old new  
    212212                 
    213213                 
    214214                //1) REMOVE THOSE THAT HAVE A SMALLER DIALPREFIX 
     215                //   ...BUT BEING CAREFUL: THIS SHOULD BE DONE FOR EACH TARIFFPLAN, NOT GLOBALLY! 
     216                //   (Modified by Zoltan Kovacs, 2008-07-30, kovzol@ephone.hu.) 
     217                $QUERY2="select id from cc_tariffplan"; 
     218                $A2B->instance_table = new Table(); 
     219                $result2 = $A2B->instance_table -> SQLExec ($A2B -> DBHandle, $QUERY2); 
     220                // $result2 contains all existing tariffplans 
     221                for ($i2=0; $i2<count($result2);$i2++){ 
     222                    for ($i3=0; $i3<count($result);$i3++) { 
     223                        $this_tariffplan=$result2[$i2][0]; 
     224                        // we deal only with same the tariffplans 
     225                        if ($result[$i3][3]==$this_tariffplan){ 
     226                            $max_len_prefix = strlen($result[$i3][7]); 
     227                            for ($i=1;$i<count($result);$i++){ 
     228                            // we set the 'toremove' flag to true if this rate should be 
     229                            // removed due to its length is not maximal within the 
     230                            // currently checked tariffplan 
     231                            if (strlen($result[$i][7]) < $max_len_prefix && $result[$i][3]==$this_tariffplan) 
     232                                $result[$i]['toremove']=true; 
     233                            } // for 
     234                        } // if 
     235                    } // for $i3 
     236                } // for $i2 
     237                $i5=0; 
     238                // cleaning up the array and copying the result to $result3 
     239                for ($i4=0; $i4<count($result);$i4++) 
     240                    if ($result[$i4]['toremove']!=true){ 
     241                    $result3[$i5]=$result[$i4]; 
     242                    $i5++; 
     243                    }  
     244                // copying $result3 back to $result 
     245                $result=$result3; 
     246 
     247 
     248                 
     249                /* 
    215250                $max_len_prefix = strlen($result[0][7]); 
    216251                for ($i=1;$i<count($result);$i++){ 
    217252                        if ( strlen($result[$i][7]) < $max_len_prefix) break; 
    218253                }        
    219254                $result = array_slice ($result, 0, $i); 
    220                  
     255                */ 
    221256                 
    222257                //2) TAKE THE VALUE OF LCTYPE  
    223258                //LCR : According to the buyer price    -0      buyrate [col 6] 


Google