Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Sun Aug 18, 2019 9:01 pm
Auto Dialer Software


All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Sort Rates by First Letter of Destination
PostPosted: Wed Feb 07, 2007 1:57 am 
Offline

Joined: Thu Aug 10, 2006 10:47 pm
Posts: 145
Location: LA,CA,USA
Hello All!

WARNING: Only Tested on Asterisk2Billing V1.2.3 (BrainCoral)

As per request this thread should...hopefully show you how to add Rate Letter Sorting to your Call Rates.....as i have done here: http://forum.a2billing.net/viewtopic.php?t=1700

Keep in mind this fix is NOT for the faint of heart, as this is a fairly intensive addon.....but well worth it in my opinion....

PP_menu.php

Change Line 117
Code:
href="A2B_entity_ratecard.php?form_action=list"


TO

Code:
href="A2B_entity_ratecard.php?form_action=list&ratesort=A"


A2B_entity_ratecard.php

Below ( Line 8 )
Code:
if (! has_rights (ACX_ACCESS)){
      Header ("HTTP/1.0 401 Unauthorized");
      Header ("Location: PP_error.php?c=accessdenied");
      die();
}


ADD

Code:
$ratesort = $_GET['ratesort'];
if (strlen($ratesort)==0) $ratesort='A';


FINAL
Code:
if (! has_rights (ACX_ACCESS)){
      Header ("HTTP/1.0 401 Unauthorized");
      Header ("Location: PP_error.php?c=accessdenied");
      die();
}

$ratesort = $_GET['ratesort'];
if (strlen($ratesort)==0) $ratesort='A';


Below ( Line 19 )
Code:
$HD_Form -> setDBHandler (DbConnect());
$HD_Form -> init();


ADD
Code:
$HD_Form -> FG_TABLE_CLAUSE .= " AND SUBSTRING(cc_ratecard.destination,1,1)='".strtolower($ratesort)."'"; // sort by first letter


FINAL
Code:
$HD_Form -> setDBHandler (DbConnect());
$HD_Form -> init();
$HD_Form -> FG_TABLE_CLAUSE .= " AND SUBSTRING(cc_ratecard.destination,1,1)='".strtolower($ratesort)."'"; // sort by first letter


Below ( Line 52 )
Code:
// #### TOP SECTION PAGE
$HD_Form -> create_toppage ($form_action);


ADD
Code:
?>
    <table width="75%" border=0 cellspacing=1 cellpadding=3 bgcolor="#000033" align="center">
        <tr>
       <td bgcolor="#000033" width="100%" valign="top" align="center" class="bb2">

              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=A">A</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=B">B</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=C">C</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=D">D</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=E">E</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=F">F</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=G">G</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=H">H</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=I">I</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=J">J</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=K">K</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=L">L</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=M">M</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=N">N</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=O">O</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=P">P</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=Q">Q</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=R">R</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=S">S</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=T">T</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=U">U</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=V">V</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=W">W</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=X">X</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=Y">Y</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=Z">Z</a>         

       </td>
        </tr>
    </table>
<?php


FINAL
Code:
// #### TOP SECTION PAGE
$HD_Form -> create_toppage ($form_action);
?>
    <table width="75%" border=0 cellspacing=1 cellpadding=3 bgcolor="#000033" align="center">
        <tr>
       <td bgcolor="#000033" width="100%" valign="top" align="center" class="bb2">

              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=A">A</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=B">B</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=C">C</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=D">D</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=E">E</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=F">F</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=G">G</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=H">H</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=I">I</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=J">J</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=K">K</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=L">L</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=M">M</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=N">N</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=O">O</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=P">P</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=Q">Q</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=R">R</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=S">S</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=T">T</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=U">U</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=V">V</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=W">W</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=X">X</a>         
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=Y">Y</a>
              <a href="A2B_entity_ratecard.php?form_action=list&ratesort=Z">Z</a>         

       </td>
        </tr>
    </table>
<?php   
// #### CREATE FORM OR LIST


../lib/Form/Class.FormHandler.inc.php

function create_form
Below ( Line 1954 )
Code:
         if (isset($_POST['stitle']))  $stitle = $_POST['stitle'];
         else $stitle = $_GET['stitle'];


ADD
Code:
         if (isset($_POST['ratesort'])) $ratesort = $_POST['ratesort'];
         else $ratesort = $_GET['ratesort'];


FINAL
Code:
         if (isset($_POST['stitle']))  $stitle = $_POST['stitle'];
         else $stitle = $_GET['stitle'];
         
         if (isset($_POST['ratesort'])) $ratesort = $_POST['ratesort'];
         else $ratesort = $_GET['ratesort'];


Below ( Line 1964 )
Code:
         $atmenu = $_GET['atmenu'];


ADD

Code:
         $ratesort = $_GET['ratesort'];


FINAL
Code:
         $atmenu = $_GET['atmenu'];
         $ratesort = $_GET['ratesort'];


../lib/Form/Class.ViewHandler.inc.php

Below ( Line 94 )
Code:
$stitle = $_GET['stitle'];


ADD

Code:
$ratesort = $_GET['ratesort'];


FINAL
Code:
   $stitle = $_GET['stitle'];
   $ratesort = $_GET['ratesort'];


Change ( Line 455 )

FROM
Code:
$c_url = $_SERVER['PHP_SELF'].'?stitle='.$stitle.'&atmenu='.$atmenu.'&current_page=%s'."&filterprefix=".$_GET['filterprefix']."&order=".$_GET['order']."&sens=".$_GET['sens']."&mydisplaylimit=".$_GET['mydisplaylimit'].$this-> CV_FOLLOWPARAMETERS;


TO
Code:
$c_url = $_SERVER['PHP_SELF'].'?stitle='.$stitle.'&atmenu='.$atmenu.'&current_page=%s'."&filterprefix=".$_GET['filterprefix']."&order=".$_GET['order']."&sens=".$_GET['sens']."&mydisplaylimit=".$_GET['mydisplaylimit']."&ratesort=".$ratesort.$this-> CV_FOLLOWPARAMETERS;


PHEW...did you make it this far? If so congrats....check out your new toy....post problems, suggestions, or anything else here.....have fun everyone! :P


Last edited by crshman on Sun Feb 11, 2007 9:56 am, edited 3 times in total.

Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 07, 2007 2:09 am 
Offline

Joined: Fri Apr 28, 2006 5:11 am
Posts: 426
Excellent! :up:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 15, 2007 8:03 pm 
Offline

Joined: Mon May 29, 2006 7:07 pm
Posts: 287
Location: Denver
Beautifull :P


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 16, 2007 9:46 am 
Offline

Joined: Fri Dec 22, 2006 2:43 pm
Posts: 76
Location: London, UK
Great work crshman.

Thanks very much.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 25, 2007 6:27 am 
Offline
Moderator
User avatar

Joined: Tue Jun 06, 2006 12:14 pm
Posts: 685
Location: florida
Hey - who here did the site callwithus.com ??

Nice Job, Is that Letter rating this hack that crshman did, or something else?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 2:55 pm 
Offline

Joined: Fri Oct 27, 2006 6:17 pm
Posts: 161
great hack, is working, but if you select any number (50 or 100) from select list then back to A again, is the same if you select ALL from the select list.
cheers.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 4:49 am 
Offline

Joined: Sat Apr 29, 2006 2:17 pm
Posts: 48
this is not working for me :(

Parse error: parse error, unexpected T_VARIABLE in /var/www/html/a2customer/lib/Form/Class.ViewHandler.inc.php on line 95

any idea?

Added after 21 minutes:

nevermind, I had another patch that was causing this error


Top
 Profile  
 
 Post subject: Error: THERE IS NO RATECARD CREATED!
PostPosted: Sun May 20, 2007 6:17 am 
Offline

Joined: Sun May 20, 2007 5:29 am
Posts: 1
:) :) Hello All :) :)

I have followed the instructions completely, and all looks fine, however, I get no rates displayed. :?

THERE IS NO RATECARD CREATED! is the message I get at the bottom of the screen, and even after selecting the ratecard from the dropdown and clicking SEARCH I get the same message. Clicking on ANY of the letters returns the same error message. :(

I have 1 ratecard setup correctly. :wall:

Prior to adding this code, I had applied the other patch found on this site, about not displaying the rates, and it fixed the problem. Now the new code has returned it to the original problem. :lamo:

Thanks in advance for any input you guys can offer. :beer:

Have a great day!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 
Predictive Dialer


All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group