| | 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 | /* |
|---|