Example #1
0
 public function payment($module = '')
 {
     global $payment, $language, $PHP_SELF;
     $instance_sub_table = new Table("cc_payment_methods", "payment_filename");
     $DBHandle = DbConnect();
     $return = null;
     $return = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
     $this->modules = array();
     if (is_array($return)) {
         foreach ($return as $value) {
             array_push($this->modules, $value["payment_filename"]);
         }
     }
     $include_modules = array();
     if (!empty($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
         $this->selected_module = $module;
         $include_modules[] = array('class' => $module, 'file' => $module . '.php');
     } else {
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             $include_modules[] = array('class' => $class, 'file' => $value);
         }
     }
     for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
         include dirname(__FILE__) . '/../methods/' . $include_modules[$i]['file'];
         $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
     }
     if (!is_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
         $this->form_action_url = $GLOBALS[$module]->form_action_url;
     }
     $actived_module = $this->selection();
     $payment = $actived_module[0]['id'];
 }
Example #2
0
 public function currencies()
 {
     $this->currencies = array();
     $currenciesTable = new Table("cc_currencies", " * ");
     $DBHandle = DBConnect();
     $return = $currenciesTable->Get_list($DBHandle, "", 0);
     $this->currencies = array();
     foreach ($return as $value) {
         $this->currencies[$value['currency']] = array('currency' => $value['currency'], 'name' => $value['name'], 'value' => $value['value'], 'decimal_point' => $value['decimal_point'], 'basecurrency' => $value['basecurrency'], 'decimal_places' => 2);
     }
 }
function gen_all_agents($dbh, $do_sip, $do_iax, &$err_msg)
{
    global $FG_DEBUG;
    global $A2B;
    $ita = new Table('cc_agent', 'id, login,name');
    if ($FG_DEBUG > 1) {
        $ita->debug_st = 1;
    }
    $list_agent = $ita->Get_list($dbh, 'active = true', null, null, null, null);
    if (!is_array($list_agent) || count($list_agent) == 0) {
        $err_msg .= str_params(_("<p style='color: red'>No active agents found!<br>%1</p>"), array($dbh->ErrorMsg()), 1);
        return false;
    }
    // These are put by default on a non-existing directory!
    // This is intentional, since those files contain SIP/IAX passwords.
    // they shouldn't be carelessly left in a world-readable dir.
    if (isset($A2B->config['webui']['buddy_sip_agent'])) {
        $buddy_sip = $A2B->config['webui']['buddy_sip_agent'];
    } else {
        $buddy_sip = "/tmp/a2billing/additional_sip.%1.conf";
    }
    if (isset($A2B->config['webui']['buddy_iax_agent'])) {
        $buddy_iax = $A2B->config['webui']['buddy_iax_agent'];
    } else {
        $buddy_iax = "/tmp/a2billing/additional_iax.%1.conf";
    }
    $succ = 0;
    foreach ($list_agent as $ag) {
        $hdr_lines = "; Configuration for " . $ag[2] . "\n";
        if ($do_sip) {
            $fname = str_params($buddy_sip, $ag);
            $qclause = str_dbparams($dbh, "name IN (SELECT callerid FROM cc_booth WHERE agentid = %1)", array($ag[0]));
            if (gen_userdata($dbh, $fname, 'cc_sip_buddies', $qclause, $err_msg, $hdr_lines)) {
                $succ++;
            }
        }
        if ($do_iax) {
            $fname = str_params($buddy_iax, $ag);
            $qclause = str_dbparams($dbh, "name IN (SELECT callerid FROM cc_booth WHERE agentid = %1)", array($ag[0]));
            if (gen_userdata($dbh, $fname, 'cc_iax_buddies', $qclause, $err_msg, $hdr_lines)) {
                $succ++;
            }
        }
    }
    $co = 0;
    if ($do_sip) {
        $co += count($list_agent);
    }
    if ($do_iax) {
        $co += count($list_agent);
    }
    $err_msg .= str_params(_("<p style='color: blue'>Agent config files: %#1 of %#2 files created.</p>"), array($succ, $co), 1);
    return true;
}
Example #4
0
 function init(&$DBHandle)
 {
     global $list_booths;
     global $txt_fill;
     global $txt_empty;
     global $txt_change;
     $itb = new Table("cc_booth", "id, name, agentid");
     //$itb->debug_st=1;
     $FG_TABLE_CLAUSE = 'def_card_id IS NOT NULL';
     //"agentid = ". $DBHandle->Quote($_SESSION["agent_id"]) ." AND cur_card_id IS NULL";
     // A booth without default card couldn't ever become active!
     $ltb = $itb->Get_list($DBHandle, $FG_TABLE_CLAUSE);
     $list_booths = $ltb;
     $txt_fill = _("Fill!");
     $txt_empty = _("Empty!");
 }
Example #5
0
 function payment($module = '')
 {
     global $payment, $language, $PHP_SELF;
     $instance_sub_table = new Table("cc_payment_methods", "payment_filename");
     $QUERY = " active = 't'";
     $DBHandle = DbConnect();
     $return = null;
     $return = $instance_sub_table->Get_list($DBHandle, $QUERY, 0);
     $this->modules = array();
     if (is_array($return)) {
         foreach ($return as $value) {
             array_push($this->modules, $value["payment_filename"]);
         }
     }
     //if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
     //$this->modules = explode(';', MODULE_PAYMENT_INSTALLED);
     $include_modules = array();
     if (!is_null($module) && in_array($module . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
         $this->selected_module = $module;
         $include_modules[] = array('class' => $module, 'file' => $module . '.php');
     } else {
         reset($this->modules);
         while (list(, $value) = each($this->modules)) {
             $class = substr($value, 0, strrpos($value, '.'));
             $include_modules[] = array('class' => $class, 'file' => $value);
         }
     }
     for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
         include dirname(__FILE__) . '/../methods/' . $include_modules[$i]['file'];
         $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
     }
     // if there is only one payment method, select it as default because in
     // checkout_confirmation.php the $payment variable is being assigned the
     // $_POST['payment'] value which will be empty (no radio button selection possible)
     if (count($this->modules) == 1 && (!isset($GLOBALS[$payment]) || isset($GLOBALS[$payment]) && !is_object($GLOBALS[$payment]))) {
         $payment = $include_modules[0]['class'];
     }
     if (!is_null($module) && in_array($module, $this->modules) && isset($GLOBALS[$module]->form_action_url)) {
         $this->form_action_url = $GLOBALS[$module]->form_action_url;
     }
     //}
 }
    }
    if (DB_TYPE != 'postgres') {
        $run_restore = $run_gzip . MYSQL . " -u " . USER . " -p" . PASS;
    } else {
        $env_var = "PGPASSWORD='******'";
        putenv($env_var);
        $run_restore = $run_gzip . PSQL . " -d " . DBNAME . " -U " . USER . " -h " . HOST;
    }
    if ($FG_DEBUG == 1) {
        echo $run_restore . "<br>";
    }
    exec($run_restore);
}
if ($form_action == "download") {
    $instance_table_backup = new Table($HD_Form->FG_TABLE_NAME, $HD_Form->FG_QUERY_EDITION);
    $list = $instance_table_backup->Get_list($HD_Form->DBHandle, $HD_Form->FG_EDITION_CLAUSE, null, null, null, null, 1, 0);
    $path = $list[0][1];
    $filename = basename($path);
    $len = filesize($path);
    header("content-type: application/stream");
    header("content-length: " . $len);
    header("content-disposition: attachment; filename=" . $filename);
    $fp = fopen($path, "r");
    fpassthru($fp);
    exit;
}
if ($form_action == "upload") {
    $uploaddir = BACKUP_PATH . '/';
    $uploadfile = $uploaddir . basename($_FILES['databasebackup']['name']);
    if (move_uploaded_file($_FILES['databasebackup']['tmp_name'], $uploadfile)) {
        $instance_table_backup = new Table($HD_Form->FG_TABLE_NAME, 'id, name, path, creationdate');
             } else {
                 $next_limite_pay_date = date("{$day_startdate}-m-Y", $next_bill_date);
             }
             $next_bill_date = date("Y-m-d", strtotime("{$next_limite_pay_date} - {$billdaybefor_anniversary} day"));
         }
         break;
     default:
         continue;
         break;
 }
 switch ($action) {
     case "bill":
         //select card
         $table_card = new Table('cc_card', '*');
         $card_clause = "id = " . $subscription['card_id'];
         $result_card = $table_card->Get_list($A2B->DBHandle, $card_clause);
         if (!is_array($result_card)) {
             break;
         } else {
             $card = $result_card[0];
         }
         if ($card['credit'] + $card['typepaid'] * $card['creditlimit'] >= $subscription['fee']) {
             // USER HAVE ENOUGH CREDIT TO PAY FOR THE DID
             $service_array[$service_id]['totalcardperform']++;
             $service_array[$service_id]['totalcredit'] += $subscription['fee'];
             $QUERY = "UPDATE cc_card SET credit=credit-'" . $subscription['fee'] . "' WHERE id=" . $card['id'];
             $result = $instance_table->SQLExec($A2B->DBHandle, $QUERY, 0);
             if ($verbose_level >= 1) {
                 echo "==> UPDATE CARD QUERY: \t{$QUERY}\n";
             }
             $QUERY = "INSERT INTO cc_charge (id_cc_card, amount, chargetype, id_cc_card_subscription, charged_status, description) VALUES ('" . $card['id'] . "', '" . $subscription['fee'] . "', '3','" . $subscription['card_subscription_id'] . "',1, '" . $subscription['product_name'] . "')";
	$list_destination = $instance_table->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, null, "ASC", null, null, null, null);
	$destination = $list_destination[0];

	$instance_table = new Table("cc_tariffplan", "id, tariffname");
	$FG_TABLE_CLAUSE = "";
	$list_tariffname = $instance_table->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "tariffname", "ASC", null, null, null, null);
	$nb_tariffname = count($list_tariffname);

	$instance_table = new Table("cc_trunk", "id_trunk, trunkcode, providerip");
	$FG_TABLE_CLAUSE = "";
	$list_trunk = $instance_table->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "trunkcode", "ASC", null, null, null, null);
	$nb_trunk = count($list_trunk);
	
	$instance_table = new Table("cc_outbound_cid_group", "id, group_name");
	$FG_TABLE_CLAUSE = "";
	$list_cid_group = $instance_table->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "group_name", "ASC", null, null, null, null);
	$nb_cid_group = count($list_cid_group);

?>

<!-- ** ** ** ** ** Part for the Update ** ** ** ** ** -->
<div class="toggle_hide2show">
<center><a href="#" target="_self" class="toggle_menu"><img class="toggle_hide2show" src="<?php echo KICON_PATH; ?>/toggle_hide2show.png" onmouseover="this.style.cursor='hand';" HEIGHT="16"> <font class="fontstyle_002"><?php echo gettext("BATCH ASSIGNED");?> </font></a></center>
	<div class="tohide" style="display:none;">
<center>

<b>&nbsp;<?php echo $HD_Form -> FG_NB_RECORD ?> <?php echo gettext("rates selected!"); ?>&nbsp;<?php echo gettext("Use the options below to batch update the selected rates.");?></b>
	   <table align="center" border="0" width="65%"  cellspacing="1" cellpadding="2">
		<form name="assignForm" action="javascript:;" method="post">
		<INPUT type="hidden" name="batchupdate" value="1">
		<INPUT type="hidden" name="atmenu" value="<?php echo $atmenu?>">
include '../lib/admin.defines.php';
include '../lib/admin.module.access.php';
include '../lib/admin.smarty.php';
if (!has_rights(ACX_BILLING)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
getpost_ifset(array('id'));
if (empty($id)) {
    header("Location: A2B_entity_logrefill.php?atmenu=payment&section=10");
}
$DBHandle = DbConnect();
$remittance_table = new Table('cc_remittance_request', '*');
$remittance_clause = "id = " . $id;
$remittance_result = $remittance_table->Get_list($DBHandle, $remittance_clause, 0);
$remittance = $remittance_result[0];
if (empty($remittance)) {
    header("Location: A2B_entity_remittance_request.php?atmenu=payment&section=10");
}
// #### HEADER SECTION
$smarty->display('main.tpl');
?>
<br/>
<br/>
<br/>
<table style="width : 80%;" class="editform_table1">
   <tr>
           <th colspan="2" background="../Public/templates/default/images/background_cells.gif">
               <?php 
echo gettext("REMITTANCE INFO");
            ?>
 <?php 
            echo $FG_TABLE_EDITION[$i][4];
            ?>
><?php 
            echo stripslashes($list[0][$i]);
            ?>
</textarea> 
                        <?php 
        } elseif (strtoupper($FG_TABLE_EDITION[$i][3]) == strtoupper("SELECT")) {
            if ($FG_DEBUG == 1) {
                echo "<br> TYPE DE SELECT :" . $FG_TABLE_EDITION[$i][7];
            }
            if (strtoupper($FG_TABLE_EDITION[$i][7]) == strtoupper("SQL")) {
                $instance_sub_table = new Table($FG_TABLE_EDITION[$i][8], $FG_TABLE_EDITION[$i][9]);
                $select_list = $instance_sub_table->Get_list($DBHandle, $FG_TABLE_EDITION[$i][10], null, null, null, null, null, null);
                if ($FG_DEBUG >= 2) {
                    echo "<br>";
                    print_r($select_list);
                }
            } elseif (strtoupper($FG_TABLE_EDITION[$i][7]) == strtoupper("LIST")) {
                $select_list = $FG_TABLE_EDITION[$i][11];
                //$select_list_nb = count($select_list);
            }
            ?>
                        <SELECT class="form_enter" disabled name=<?php 
            echo $FG_TABLE_EDITION[$i][1];
            ?>
 class="form_enter">
                          <?php 
            if (count($select_list) > 0) {
Example #11
0
$conf_clause = "key_val = 'fax'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$fax = $result[0][0];
$conf_clause = "key_val = 'email'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$email = $result[0][0];
$conf_clause = "key_val = 'vat'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$vat_invoice = $result[0][0];
$conf_clause = "key_val = 'display_account'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$display_account = $result[0][0];
//country convert
$table_country = new Table('cc_country', 'countryname');
$country_clause = "countrycode = '" . $card['country'] . "'";
$result = $table_country->Get_list($DBHandle, $country_clause, 0);
$card_country = $result[0][0];
//Currencies check
$curr = $card['currency'];
$currencies_list = get_currencies();
if (!isset($currencies_list[strtoupper($curr)][2]) || !is_numeric($currencies_list[strtoupper($curr)][2])) {
    $mycur = 1;
    $display_curr = strtoupper(BASE_CURRENCY);
} else {
    $mycur = $currencies_list[strtoupper($curr)][2];
    $display_curr = strtoupper($curr);
}
function amount_convert($amount)
{
    global $mycur;
    return $amount / $mycur;
	Header ("Location: PP_error.php?c=accessdenied");	   
	die();	   
}

getpost_ifset(array('id'));

if (empty($id)) {
	header("Location: A2B_entity_log_viewer.php?section=16");
}


$DBHandle  = DbConnect();

$log_table = new Table('cc_system_log','*');
$log_clause = "id = ".$id;
$log_result = $log_table -> Get_list($DBHandle, $log_clause, 0);
$log = $log_result[0];

if (empty($log)) {
	header("Location: A2B_entity_log_viewer.php?section=16");
}

// #### HEADER SECTION
$smarty->display('main.tpl');
?>
<br/>
<br/>
<br/>
<table style="width : 80%;" class="editform_table1">
   <tr>
   		<th colspan="2" background="../Public/templates/default/images/background_cells.gif">
Example #13
0
include './lib/customer.module.access.php';
include './lib/Form/Class.FormHandler.inc.php';
include './lib/customer.smarty.php';
getpost_ifset(array('key'));
$HD_Form = new FormHandler("cc_card", "User");
$HD_Form->setDBHandler(DbConnect());
$HD_Form->init();
// HEADER SECTION
$smarty->display('signup_header.tpl');
if (empty($key)) {
    $key = null;
}
$result = null;
$instance_sub_table = new Table('cc_card', "username, lastname, firstname, email, uipass, credit, useralias, loginkey, status, id");
$QUERY = "( loginkey = '" . $key . "' )";
$list = $instance_sub_table->Get_list($HD_Form->DBHandle, $QUERY);
if (isset($key) && $list[0][8] != "1") {
    if ($A2B->config["signup"]['activated']) {
        // Status : 1 - Active
        $QUERY = "UPDATE cc_card SET status = 1 WHERE ( status = 2 OR status = 3 ) AND loginkey = '" . $key . "' ";
    } else {
        // Status : 2 - New
        $QUERY = "UPDATE cc_card SET status = 2 WHERE ( status = 2 OR status = 3 ) AND loginkey = '" . $key . "' ";
    }
    $result = $instance_sub_table->SQLExec($HD_Form->DBHandle, $QUERY, 0);
}
if ($list[0][8] != "1" && isset($result) && $result != null) {
    list($username, $lastname, $firstname, $email, $uipass, $credit, $cardalias, $loginkey, $status, $idcard) = $list[0];
    if ($FG_DEBUG == 1) {
        echo "<br/># {$username}, {$lastname}, {$firstname}, {$email}, {$uipass}, {$credit}, {$cardalias} #<br/>";
    }
Example #14
0
					<?php if(!empty($call['id_ratecard'])){ ?>
					<a href="A2B_entity_def_ratecard.php?form_action=ask-edit&id=<?php echo $call['id_ratecard']?>"> <img src="<?php echo Images_Path."/link.png"?>" border="0" title="<?php echo gettext("Link to the used rate")?>" alt="<?php echo  gettext("Link to the used rate")?>"></a>
					 <?php } ?>
				</td>
				
			</tr>
		<?php 
		$i++;	
		}
}
?>
</table>
<?php
$did_destination_table = new Table('cc_did_destination,cc_did ','*');
$did_destination_clause = " cc_did_destination.id_cc_did = cc_did.id and cc_did_destination.id_cc_card  = ".$id;
$did_destination_result = $did_destination_table -> Get_list($DBHandle, $did_destination_clause, 0);
$did_destination = $did_destination_result[0];
if(sizeof($did_destination_result)>0 && $did_destination_result[0]!=null) {
?>
<table class="toppage_maintable">
	<tr>
		<td height="20" align="center">
			<font class="toppage_maintable_text">
			  <?php echo gettext("DIDs & DID Destination"); ?>		  <br/>
			</font>
		</td>
	</tr>
</table>

<table width="95%"  cellspacing="2" cellpadding="2" border="0">
					<TR bgcolor="<?php 
        echo $FG_TABLE_ALTERNATE_ROW_COLOR[$ligne_number % 2];
        ?>
"  onmouseover="bgColor='#FFDEA6'" onMouseOut="bgColor='<?php 
        echo $FG_TABLE_ALTERNATE_ROW_COLOR[$ligne_number % 2];
        ?>
'"> 
					
				  		<?php 
        for ($i = 0; $i < $FG_NB_TABLE_COL; $i++) {
            //$FG_TABLE_COL[$i][1];
            //$FG_TABLE_COL[]=array ("Name", "name", "20%");
            if ($FG_TABLE_COL[$i][6] == "lie") {
                $instance_sub_table = new Table($FG_TABLE_COL[$i][7], $FG_TABLE_COL[$i][8]);
                $sub_clause = str_replace("%id", $recordset[$i], $FG_TABLE_COL[$i][9]);
                $select_list = $instance_sub_table->Get_list($DBHandle, $sub_clause, null, null, null, null, null, null);
                $field_list_sun = split(',', $FG_TABLE_COL[$i][8]);
                $record_display = $FG_TABLE_COL[$i][10];
                for ($l = 1; $l <= count($field_list_sun); $l++) {
                    $record_display = str_replace("%{$l}", $select_list[0][$l - 1], $record_display);
                }
            } elseif ($FG_TABLE_COL[$i][6] == "list") {
                $select_list = $FG_TABLE_COL[$i][7];
                $record_display = $select_list[$recordset[$i]][0];
            } else {
                $record_display = $recordset[$i];
            }
            if (is_numeric($FG_TABLE_COL[$i][5]) && strlen($record_display) > $FG_TABLE_COL[$i][5]) {
                $record_display = substr($record_display, 0, $FG_TABLE_COL[$i][5] - 3) . "...";
            }
            ?>
Example #16
0
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
$FG_DEBUG = 0;
$DBHandle = DbConnect();
$my_max_file_size = (int) MY_MAX_FILE_SIZE_IMPORT;
// GET CALLPLAN LIST
$instance_table_tariffname = new Table("cc_tariffplan", "id, tariffname");
$FG_TABLE_CLAUSE = "";
$list_tariffname = $instance_table_tariffname->Get_list($DBHandle, $FG_TABLE_CLAUSE, "id", "DESC", null, null, null, null);
$nb_tariffname = count($list_tariffname);
// GET TRUNK LIST
$instance_table_trunk = new Table("cc_trunk", "id_trunk, trunkcode");
$FG_TABLE_CLAUSE = "";
$list_trunk = $instance_table_trunk->Get_list($DBHandle, $FG_TABLE_CLAUSE, "id_trunk", "ASC", null, null, null, null);
$nb_trunk = count($list_trunk);
$smarty->display('main.tpl');
?>

<script language="JavaScript" type="text/javascript">
<!--

function sendtoupload(form){
	if (form.tariffplan.value.length < 1){
		alert ('<?php 
echo addslashes(gettext("Please, you must first select a ratecard !"));
?>
');
		form.tariffplan.focus ();
		return (false);
Example #17
0
                 </td>
            </tr>
</table>
        <?php 
}
?>
<br/>

<?php 
// Load the list of values in the config table ! key=values_notifications
$key = "delay_notifications";
$DBHandle = DbConnect();
$instance_config_table = new Table("cc_config", "id, config_value");
$QUERY = " config_key = '" . $key . "' ";
$return = null;
$return = $instance_config_table->Get_list($DBHandle, $QUERY, 0);
$id_config = $return[0]["id"];
if (!is_null($return) && !empty($return) > 0) {
    ?>
<table align="center"  class="bgcolor_001" border="0" width="65%">
<tr>
    <td>
    <?php 
    $msg = gettext("Currently, the periodicity of notification is ") . $return[0]["config_value"];
    if ($return[0]["config_value"] == 1) {
        $msg .= gettext(" day");
    } else {
        $msg .= gettext(" days");
    }
    $msg .= '.';
    echo $msg;
Example #18
0
function linktonext_2($value){
        $handle = DbConnect();
        $inst_table = new Table("cc_tariffgroup", "id");
        $FG_TABLE_CLAUSE = "tariffgroupname = '$value'";
        $list_group = $inst_table -> Get_list ($handle, $FG_TABLE_CLAUSE, "", "", "", "", "", "", "", 10);
        $id = $list_group[0][0];
    if($id > 0){
        echo "<a href=\"call-pnl-report.php?group_id=$id&report_type=2\">$value</a>";
    }else{
        echo $value;
    }
}
 /**
  * Function to create the search form
  * @public
  */
 function create_search_form()
 {
     Console::logSpeed('Time taken to get to line ' . __LINE__);
     $processed = $this->getProcessed();
     $cur = 0;
     foreach ($this->FG_FILTER_SEARCH_FORM_SELECT as $select) {
         // 	If is a sql_type
         if ($select[1]) {
             $instance_table = new Table($select[1][0], $select[1][1]);
             $list = $instance_table->Get_list($this->DBHandle, $select[1][2], $select[1][3], $select[1][4], null, null, null, null);
             $this->FG_FILTER_SEARCH_FORM_SELECT[$cur][1] = $list;
         } else {
             $this->FG_FILTER_SEARCH_FORM_SELECT[$cur][1] = $select[3];
         }
         $cur++;
     }
     include "Class.SearchHandler.inc.php";
 }
	Header ("Location: PP_error.php?c=accessdenied");	   
	die();	   
}

getpost_ifset(array('id'));

if (empty($id)) {
	header("Location: A2B_entity_payment_agent.php?atmenu=payment&section=10");
}


$DBHandle  = DbConnect();

$payment_table = new Table('cc_logpayment_agent','*');
$payment_clause = "id = ".$id;
$payment_result = $payment_table -> Get_list($DBHandle, $payment_clause, 0);
$payment = $payment_result[0];

if (empty($payment)) {
	header("Location: A2B_entity_payment_agent.php?atmenu=payment&section=10");
}

// #### HEADER SECTION
$smarty->display('main.tpl');
?>
<br/>
<br/>
<br/>
<table style="width : 80%;" class="editform_table1">
   <tr>
   		<th colspan="2" background="../Public/templates/default/images/background_cells.gif">
if (!has_rights(ACX_VOUCHER)) {
    Header("HTTP/1.0 401 Unauthorized");
    Header("Location: PP_error.php?c=accessdenied");
    die;
}
$HD_Form->setDBHandler(DbConnect());
$HD_Form->init();
$currencies_list = get_currencies();
if (strlen($voucher) > 0) {
    if (is_numeric($voucher)) {
        sleep(2);
        $FG_VOUCHER_TABLE = "cc_voucher";
        $FG_VOUCHER_FIELDS = "voucher, credit, activated, tag, currency, expirationdate";
        $instance_sub_table = new Table($FG_VOUCHER_TABLE, $FG_VOUCHER_FIELDS);
        $FG_TABLE_CLAUSE_VOUCHER = "expirationdate >= CURRENT_TIMESTAMP AND activated='t' AND voucher='{$voucher}'";
        $list_voucher = $instance_sub_table->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE_VOUCHER, $order, $sens, null, null, $limite, $current_record);
        if ($list_voucher[0][0] == $voucher) {
            if (!isset($currencies_list[strtoupper($list_voucher[0][4])][2])) {
                $error_msg = '<font face="Arial, Helvetica, sans-serif" size="2" color="red"><b>' . gettext("System Error : the currency table is incomplete!") . '</b></font><br><br>';
            } else {
                $add_credit = $list_voucher[0][1] * $currencies_list[strtoupper($list_voucher[0][4])][2];
                $QUERY = "UPDATE cc_voucher SET activated='f', usedcardnumber='" . $_SESSION["pr_login"] . "', usedate=now() WHERE voucher='" . $voucher . "'";
                $result = $instance_sub_table->SQLExec($HD_Form->DBHandle, $QUERY, 0);
                $QUERY = "UPDATE cc_card SET credit=credit+'" . $add_credit . "' WHERE username='******'";
                $result = $instance_sub_table->SQLExec($HD_Form->DBHandle, $QUERY, 0);
                $error_msg = '<font face="Arial, Helvetica, sans-serif" size="2" color="green"><b>' . gettext("The voucher") . '(' . $voucher . ') ' . gettext("has been used, We added") . ' ' . $add_credit . ' ' . gettext("credit on your account!") . '</b></font><br><br>';
            }
        } else {
            $error_msg = '<font face="Arial, Helvetica, sans-serif" size="2" color="red"><b>' . gettext("This voucher doesn't exist !") . '</b></font><br><br>';
        }
    } else {
Example #22
0
$items = $receipt->loadItems();
//load customer
$DBHandle = DbConnect();
$card_table = new Table('cc_card', '*');
$card_clause = "id = " . $_SESSION["card_id"];
$card_result = $card_table->Get_list($DBHandle, $card_clause, 0);
$card = $card_result[0];
if (empty($card)) {
    echo "Customer doesn't exist or is not correctly defined for this receipt !";
    die;
}
$smarty->display('main.tpl');
//Load receipt conf
$invoice_conf_table = new Table('cc_invoice_conf', 'value');
$conf_clause = "key_val = 'company_name'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$company_name = $result[0][0];
$conf_clause = "key_val = 'address'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$address = $result[0][0];
$conf_clause = "key_val = 'zipcode'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$zipcode = $result[0][0];
$conf_clause = "key_val = 'city'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$city = $result[0][0];
$conf_clause = "key_val = 'country'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
$country = $result[0][0];
$conf_clause = "key_val = 'web'";
$result = $invoice_conf_table->Get_list($DBHandle, $conf_clause, 0);
						$instance_sub_table = new Table($this->FG_TABLE_COL[$i][7], $this->FG_TABLE_COL[$i][8]);
						$sub_clause = str_replace("%id", $list[$ligne_number][$i-$k], $this->FG_TABLE_COL[$i][9]);

						$select_list = $instance_sub_table -> Get_list ($this->DBHandle, $sub_clause, null, null, null, null, null, null, null, 10);
						$field_list_sun = preg_split('/,/', $this->FG_TABLE_COL[$i][8]);
						$record_display = $this->FG_TABLE_COL[$i][10];

						for ($l=1;$l<=count($field_list_sun);$l++){
							$record_display = str_replace("%$l", $select_list[0][$l-1], $record_display);
						}

					} elseif($this->FG_TABLE_COL[$i][6]=="lie_link") {

						$instance_sub_table = new Table($this->FG_TABLE_COL[$i][7], $this->FG_TABLE_COL[$i][8]);
						$sub_clause = str_replace("%id", $list[$ligne_number][$i-$k], $this->FG_TABLE_COL[$i][9]);
						$select_list = $instance_sub_table -> Get_list ($this->DBHandle, $sub_clause, null, null, null, null, null, null, null, 10);
						
						if (is_array($select_list)) {
							$field_list_sun = preg_split('/,/',$this->FG_TABLE_COL[$i][8]);
							$record_display = $this->FG_TABLE_COL[$i][10];
							$link = $this->FG_TABLE_COL[$i][12];
							if (stripos($this->FG_TABLE_COL[$i][12],'form_action')===false) $link .= "?form_action=ask-edit&";
							else $link .= "?";
							$link.= "id=".$select_list[0][1];
							for ($l=1;$l<=count($field_list_sun);$l++){
								$val = str_replace("%$l", $select_list[0][$l-1], $record_display);
								$record_display = "<a href='$link'>$val</a>";
							}
						} else {
							$record_display="";
						}
Example #24
0
}
if (!isset($fromstatsday_sday)) {
    $fromstatsday_sday = date("d");
    $fromstatsmonth_sday = date("Y-m");
}
$hourintervalplus = $hourinterval + 1;
if (isset($fromstatsday_sday) && isset($fromstatsmonth_sday)) {
    $date_clause .= " AND t1.starttime < '{$fromstatsmonth_sday}-{$fromstatsday_sday} " . $hourintervalplus . ":00:00' AND t1.starttime >= '{$fromstatsmonth_sday}-{$fromstatsday_sday} " . $hourinterval . ":00:00' ";
}
//-- $date_clause=" AND calldate < date'$fromstatsmonth_sday-$fromstatsday_sday'+ INTERVAL '1 DAY' AND calldate >= '$fromstatsmonth_sday-$fromstatsday_sday 12:00:00'";
if (strpos($SQLcmd, 'WHERE') > 0) {
    $FG_TABLE_CLAUSE = substr($SQLcmd, 6) . $date_clause;
} elseif (strpos($date_clause, 'AND') > 0) {
    $FG_TABLE_CLAUSE = substr($date_clause, 5);
}
$list_total = $instance_table_graph->Get_list($DBHandle, $FG_TABLE_CLAUSE, 't1.starttime', 'ASC', null, null, null, null);
/**************************************/
$nbcall = count($list_total);
$mycall_min[0] = 0;
$mycall_dur[0] = 0;
/*
    WE WILL BUILD DIFFERENT TABLES,
mycall_min FOR THE STARTDATE (MIN)
mycall_dur FOR THE DURATION OF EACH CALLS (IN SECS)
mycall_minsec_start FOR THE EXACT START OF THE CALL AND END
mycall_minsec_start[i][0] - START DATE (MINSEC)1843		18em Minutes 43 sec
mycall_minsec_start[i][1] - END DATE   (MINSEC)2210		22em Minutes 10 sec
*/
for ($i = 1; $i <= $nbcall; $i++) {
    $mycall_min[$i] = substr($list_total[$i - 1][0], 14, 2);
    $mycall_minsec_start[$i][0] = substr($list_total[$i - 1][0], 14, 2) . substr($list_total[$i - 1][0], 17, 2);
Example #25
0
     if (empty($price) || !is_numeric($price)) {
         $error_msg .= gettext("Amount inserted is invalid, it must be a number. Check the format.");
     }
     if (!empty($error_msg)) {
         break;
     }
     $DBHandle = DbConnect();
     $receipt = new Receipt($id);
     $receipt->insertReceiptItem($description, $price);
     Header("Location: A2B_receipt_edit.php?" . "id=" . $id);
     break;
 case 'edit':
     if (!empty($idc) && is_numeric($idc)) {
         $DBHandle = DbConnect();
         $instance_sub_table = new Table("cc_receipt_item", "*");
         $result = $instance_sub_table->Get_list($DBHandle, "id = {$idc}");
         if (!is_array($result) || sizeof($result) == 0) {
             Header("Location: A2B_receipt_edit.php?" . "id=" . $id);
         } else {
             $description = $result[0]['description'];
             $price = $result[0]['price'];
             $date = $result[0]['date'];
         }
     }
     break;
 case 'delete':
     if (!empty($idc) && is_numeric($idc)) {
         $DBHandle = DbConnect();
         $instance_sub_table = new Table("cc_receipt_item", "*");
         $instance_sub_table->Delete_Selected($DBHandle, "id = {$idc}");
     }
Example #26
0
     }
 }
 if (!USE_REALTIME) {
     $who = Notification::$AGENT;
     $who_id = $_SESSION['agent_id'];
     NotificationsDAO::AddNotification($key, Notification::$HIGH, $who, $who_id);
 }
 $instance_table_friend = new Table('cc_card');
 $instance_table_friend->Update_table($HD_Form->DBHandle, $friend_param_update, "id='{$id_cc_card}'", $func_table = null);
 if ($form_action == "add_sip") {
     $TABLE_BUDDY = 'cc_sip_buddies';
 } else {
     $TABLE_BUDDY = 'cc_iax_buddies';
 }
 $instance_table_friend = new Table($TABLE_BUDDY, '*');
 $list_friend = $instance_table_friend->Get_list($HD_Form->DBHandle, "id_cc_card='{$id_cc_card}'", null, null, null, null);
 if (is_array($list_friend) && count($list_friend) > 0) {
     Header("Location: " . $HD_Form->FG_GO_LINK_AFTER_ACTION);
     exit;
 }
 $form_action = "add";
 $_POST['accountcode'] = $_POST['username'] = $_POST['name'] = $_POST['cardnumber'] = $cardnumber;
 $_POST['allow'] = FRIEND_ALLOW;
 $_POST['context'] = FRIEND_CONTEXT;
 $_POST['nat'] = FRIEND_NAT;
 $_POST['amaflags'] = FRIEND_AMAFLAGS;
 $_POST['regexten'] = $cardnumber;
 $_POST['id_cc_card'] = $id_cc_card;
 $_POST['callerid'] = $useralias;
 $_POST['qualify'] = FRIEND_QUALIFY;
 $_POST['host'] = FRIEND_HOST;
Example #27
0
	die();	   
}

getpost_ifset(array('id','groupID'));

if(!is_numeric($groupID) || ($groupID != 0 && $groupID != 1)) $groupID =0;

if (empty($id)) {
	header("Location: A2B_entity_user.php?atmenu=user&groupID=$groupID&section=3");
}

$DBHandle  = DbConnect();

$admin_table = new Table('cc_ui_authen','*');
$admin_clause = "userid = ".$id;
$admin_result = $admin_table -> Get_list($DBHandle, $admin_clause, 0);
$admin = $admin_result[0];

if (empty($admin)) {
	header("Location: A2B_entity_user.php?atmenu=user&groupID=$groupID&section=3");
}

// #### HEADER SECTION
$smarty->display('main.tpl');
$lg_liste= Constants::getLanguages();
?>
<br/>
<br/>
<br/>
<table style="width : 80%;" class="editform_table1">
   <tr>
// #### HELP SECTION
echo $CC_help_generate_customer;
$instance_table_tariff = new Table("cc_tariffgroup", "id, tariffgroupname");
$FG_TABLE_CLAUSE = "";
$list_tariff = $instance_table_tariff->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "tariffgroupname", "ASC", null, null, null, null);
$nb_tariff = count($list_tariff);
$instance_table_group = new Table("cc_card_group", " id, name ");
$list_group = $instance_table_group->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "name", "ASC", null, null, null, null);
$instance_table_agent = new Table("cc_agent", " id, login ");
$list_agent = $instance_table_agent->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "login", "ASC", null, null, null, null);
$instance_table_seria = new Table("cc_card_seria", " id, name ");
$list_seria = $instance_table_seria->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "name", "ASC", null, null, null, null);
$instance_table_didgroup = new Table("cc_didgroup", " id, didgroupname ");
$list_didgroup = $instance_table_didgroup->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "didgroupname", "ASC", null, null, null, null);
$instance_table_country = new Table("cc_country", " countrycode, countryname ");
$list_country = $instance_table_country->Get_list($HD_Form->DBHandle, $FG_TABLE_CLAUSE, "countryname", "ASC", null, null, null, null);
// FORM FOR THE GENERATION
?>
<div align="center">
<?php 
if (!empty($msg_error) && $nb_error > 0) {
    ?>
    <div class="msg_error" style="width:70%;text-align:left;">
        <?php 
    echo $msg_error;
    ?>
    </div>
<?php 
}
?>
<table align="center"  class="bgcolor_001" border="0" width="65%">
Example #29
0
$DBHandle = DbConnect();
$HD_Form->setDBHandler($DBHandle);
$HD_Form->init();

// #### HEADER SECTION

$static_amount = false;
$amount = 0;
if ($item_type = "invoice" && is_numeric($item_id)) {
	$table_invoice = new Table("cc_invoice", "status,paid_status");
	$clause_invoice = "id = " . $item_id;
	$result = $table_invoice->Get_list($DBHandle, $clause_invoice);
	if (is_array($result) && $result[0]['status'] == 1 && $result[0]['paid_status'] == 0) {
		$table_invoice_item = new Table("cc_invoice_item", "COALESCE(SUM(price*(1+(vat/100))),0)");
		$clause_invoice_item = "id_invoice = " . $item_id;
		$result = $table_invoice_item->Get_list($DBHandle, $clause_invoice_item);
		$amount = $result[0][0];

		$static_amount = true;
	}
}
$smarty->display('main.tpl');
$HD_Form->create_toppage($form_action);

$payment_modules = new payment;
?>
<script language="javascript">
function checkamount()
{
 	if (document.checkout_amount.amount == "")
	{
Example #30
0
<?php

$instance_sub_table = new Table("cc_configuration", "configuration_key as cfgkey, configuration_value as cfgvalue");
$DBHandle = DbConnect();
$configuration_query = $instance_sub_table->Get_list($DBHandle);
foreach ($configuration_query as $configuration) {
    define($configuration['cfgkey'], $configuration['cfgvalue']);
}