/** * Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv". * * @param $id (int) Identificador del registro a ser editado. * @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos * a extraidos de la base de datos para ser editados */ function formEdit($id) { global $locate, $config; $rate =& Customer::getRecordByID($id, 'myrate'); /* $group = astercrm::getAll('accountgroup'); if ($_SESSION['curuser']['usertype'] == 'admin'){ $groupoptions .= '<select id="groupid" name="groupid">'; while ($group->fetchInto($row)){ if ($row['id'] == $rate['groupid']){ $groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>"; }else{ $groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>"; } } $groupoptions .= '</select>'; }else{ while ($group->fetchInto($row)){ if ($row['id'] == $_SESSION['curuser']['groupid']){ $groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">'; break; } } } */ $reselleroptions = ''; $reseller = astercrm::getAll('resellergroup'); if ($_SESSION['curuser']['usertype'] == 'admin') { $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">'; $reselleroptions .= '<option value="0"></option>'; while ($reseller->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } if ($row['id'] == $rate['resellerid']) { $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>"; } else { $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>"; } } $reselleroptions .= '</select>'; } else { while ($reseller->fetchInto($row)) { if ($row['id'] == $rate['resellerid']) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">'; break; } } } $group = astercrm::getAll('accountgroup', 'resellerid', $rate['resellerid']); if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { $groupoptions .= '<select id="groupid" name="groupid">'; $groupoptions .= "<OPTION value='0'></OPTION>"; while ($group->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } if ($row['id'] == $rate['groupid']) { $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>"; } else { $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>"; } } $groupoptions .= '</select>'; } else { while ($group->fetchInto($row)) { if ($row['id'] == $rate['groupid']) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">'; break; } } } $html = ' <!-- No edit the next line --> <form method="post" name="f" id="f"> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">' . $locate->Translate("prefix") . '</td> <td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '" onKeyUp="xajax_showBuyRate(this.value);" onclick="xajax_showBuyRate(this.value);"> <span id="spanShowBuyRate" name="spanShowBuyRate"></span></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("length") . '</td> <td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Destination") . '</td> <td align="left"><input type="text" id="destination" name="destination" size="25" maxlength="30" value="' . $rate['destination'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Connect charge") . '</td> <td align="left"><input type="text" id="connectcharge" name="connectcharge" size="20" maxlength="20" value="' . $rate['connectcharge'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Init block") . '</td> <td align="left"><input type="text" id="initblock" name="initblock" size="25" maxlength="100" value="' . $rate['initblock'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Rate") . '</td> <td align="left"><input type="text" id="rateinitial" name="rateinitial" size="25" maxlength="30" value="' . $rate['rateinitial'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Billing block") . '</td> <td align="left"><input type="text" id="billingblock" name="billingblock" size="25" maxlength="30" value="' . $rate['billingblock'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Reseller") . '</td> <td align="left">' . $reselleroptions . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Group") . '</td> <td align="left"> ' . $groupoptions . ' </td> </tr> <tr> <td colspan="2" align="center"> <button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button> </td> </tr> </table> '; $html .= ' </form> *' . $locate->Translate("obligatory_fields") . ' '; return $html; }
/** * Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv". * * @param $id (int) Identificador del registro a ser editado. * @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos * a extraidos de la base de datos para ser editados */ function formEdit($id) { global $locate, $config; $clid =& Customer::getRecordByID($id, 'clid'); if ($clid['isshow'] == 'yes') { $selecty = "selected"; $selectn = ""; } else { if ($clid['isshow'] == 'no') { $selecty = ""; $selectn = "selected"; } } $reselleroptions = ''; $reseller = astercrm::getAll('resellergroup'); if ($_SESSION['curuser']['usertype'] == 'admin') { $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">'; $reselleroptions .= '<option value="0"></option>'; while ($reseller->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } if ($row['id'] == $clid['resellerid']) { $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>"; } else { $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>"; } } $reselleroptions .= '</select>'; } else { while ($reseller->fetchInto($row)) { if ($row['id'] == $clid['resellerid']) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">'; break; } } } $group = astercrm::getAll('accountgroup', 'resellerid', $clid['resellerid']); if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { $groupoptions .= '<select id="groupid" name="groupid">'; $groupoptions .= "<OPTION value='0'></OPTION>"; while ($group->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } if ($row['id'] == $clid['groupid']) { $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>"; } else { $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>"; } } $groupoptions .= '</select>'; } else { while ($group->fetchInto($row)) { if ($row['id'] == $clid['groupid']) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">'; break; } } } if ($clid['status'] == 1) { $statusoptions = ' <option value="1" selected>' . $locate->Translate("Avaiable") . '</option> <option value="-1">' . $locate->Translate("Lock") . '</option> '; } else { $statusoptions = ' <option value="1">' . $locate->Translate("Avaiable") . '</option> <option value="-1" selected>' . $locate->Translate("Lock") . '</option> '; } $configstatus = common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig); if ($configstatus == -2) { $html = "(fail to read " . $config['system']['astercc_path'] . "/astercc.conf)"; return $html; } else { $billingfield = trim($asterccConfig['system']['billingfield']); } if ($_SESSION['curuser']['usertype'] == 'clid') { $readonly = "readonly"; } $html = ' <!-- No edit the next line --> <form method="post" name="f" id="f"> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">'; if ($billingfield == 'accountcode') { $html .= $locate->Translate("Accountcode"); } else { $html .= $locate->Translate("Caller ID"); } $html .= '*</td> <td align="left"><input type="hidden" id="id" name="id" value="' . $clid['id'] . '"><input type="text" id="clid" name="clid" size="25" maxlength="30" value="' . $clid['clid'] . '" ' . $readonly . ' onblur="document.getElementById(\'accountcode\').value = this.value;"></td> </tr>'; if ($billingfield == 'callerid') { $html .= ' <tr> <td nowrap align="left">' . $locate->Translate("Account Code") . '*</td> <td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="40" value="' . $clid['accountcode'] . '"></td> </tr>'; } else { $html .= ' <tr style="display:none;"> <td nowrap align="left">' . $locate->Translate("Account Code") . '*</td> <td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="40" value="' . $clid['accountcode'] . '" readonly></td> </tr>'; } $html .= '<tr> <td nowrap align="left">' . $locate->Translate("Pin") . '*</td> <td align="left"><input type="text" id="pin" name="pin" size="25" maxlength="30" value="' . $clid['pin'] . '" readonly><input type="hidden" id="pin" name="pin" value="' . $clid['pin'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Display") . '</td> <td align="left"><input type="text" id="display" name="display" size="25" maxlength="20" value="' . $clid['display'] . '" ' . $readonly . '></td> </tr>'; if ($config['system']['setclid'] == 1) { $html .= '<tr> <td nowrap align="left">' . $locate->Translate("Credit Limit") . '*</td> <td align="left"><input type="text" id="creditlimit" name="creditlimit" size="25" maxlength="30" value="' . $clid['creditlimit'] . '" ' . $readonly . '></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Cur Credit") . '</td> <td align="left"> <input type="text" id="curcreditshow" name="curcreditshow" size="25" maxlength="100" value="' . $clid['curcredit'] . '" readonly> <input type="hidden" id="curcredit" name="curcredit" value="' . $clid['curcredit'] . ' "> </td> </tr>'; if ($_SESSION['curuser']['usertype'] != 'clid') { $html .= '<tr> <td nowrap align="left">' . $locate->Translate("Operate") . '</td> <td align="left"> <select id="creditmodtype" name="creditmodtype" onchange="showComment(this)"> <option value="">' . $locate->Translate("No change") . '</option> <option value="add">' . $locate->Translate("Refund") . '</option> <option value="reduce">' . $locate->Translate("Charge") . '</option> </select> <input type="text" id="creditmod" name="creditmod" size="15" maxlength="100" value="" disabled><p>' . $locate->Translate("Comment") . ' : <input type="text" id="comment" name="comment" size="18" maxlength="20" value="" disabled></p> </td> </tr> <tr>'; } $html .= '<td nowrap align="left">' . $locate->Translate("Limit Type") . '</td> <td align="left"> <select id="limittype" name="limittype" ' . $readonly . '>'; if ($clid['limittype'] == "postpaid") { $html .= ' <option value="">' . $locate->Translate("No limit") . '</option> <option value="prepaid">' . $locate->Translate("Prepaid") . '</option> <option value="postpaid" selected>' . $locate->Translate("Postpaid") . '</option>'; } elseif ($clid['limittype'] == "prepaid") { $html .= ' <option value="">' . $locate->Translate("No limit") . '</option> <option value="prepaid" selected>' . $locate->Translate("Prepaid") . '</option> <option value="postpaid">' . $locate->Translate("Postpaid") . '</option>'; } else { $html .= ' <option value="" selected>' . $locate->Translate("No limit") . '</option> <option value="prepaid">' . $locate->Translate("Prepaid") . '</option> <option value="postpaid">' . $locate->Translate("Postpaid") . '</option>'; } } $html .= '<tr> <td nowrap align="left">' . $locate->Translate("Reseller") . '</td> <td align="left">' . $reselleroptions . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Group") . '</td> <td align="left"> ' . $groupoptions . ' </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Status") . '</td> <td align="left"> <select id="status" name="status" ' . $readonly . '>' . $statusoptions . '</select> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Is Show") . '</td> <td align="left"> <select id="isshow" name="isshow" ' . $readonly . '><option value="yes" ' . $selecty . '>' . $locate->Translate("yes") . '</option><option value="no" ' . $selectn . '>' . $locate->Translate("no") . '</option></select> </td> </tr>'; if ($_SESSION['curuser']['usertype'] != 'clid') { $html .= '<tr> <td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td> </tr>'; } $html .= '</table> '; $html .= ' </form> *' . $locate->Translate("Obligatory Fields") . ' '; return $html; }
function setGroup($resellerid) { global $locate, $config; $objResponse = new xajaxResponse(); $res = astercrm::getAll("accountgroup", 'resellerid', $resellerid); //添加option while ($res->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } $objResponse->addScript("addOption('groupid','" . $row['id'] . "','" . $row['groupname'] . "');"); } return $objResponse; }
/** * Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv". * * @param $id (int) Identificador del registro a ser editado. * @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos * a extraidos de la base de datos para ser editados */ function formEdit($id) { global $locate, $config; $account =& Customer::getRecordByID($id, 'account'); /* $group = astercrm::getAll('accountgroup'); if ($_SESSION['curuser']['usertype'] == 'admin'){ $groupoptions .= '<select id="groupid" name="groupid">'; while ($group->fetchInto($row)){ if ($row['id'] == $account['groupid']){ $groupoptions .= "<OPTION value='".$row['id']."' selected>".$row['groupname']."</OPTION>"; }else{ $groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>"; } } if ($account['groupid'] == 0 ){ $groupoptions .= "<OPTION value='0' selected></OPTION>"; }else{ $groupoptions .= "<OPTION value='0'></OPTION>"; } $groupoptions .= '</select>'; }else{ while ($group->fetchInto($row)){ if ($row['id'] == $account['groupid']){ $groupoptions .= $row['groupname'].'<input type="hidden" value="'.$row['id'].'" name="groupid" id="groupid">'; break; } } } */ $fixedValueFlag = false; $groupSelectTrStyle = ''; if ($_SESSION['curuser']['usertype'] == 'reseller' && ($_SESSION['curuser']['userid'] == $account['id'] || $account['usertype'] == 'reseller')) { $fixedValueFlag = true; $groupSelectTrStyle = " style='display:none;' "; } else { if ($_SESSION['curuser']['usertype'] == 'groupadmin' && ($_SESSION['curuser']['userid'] == $account['id'] || $account['usertype'] == 'groupadmin')) { $fixedValueFlag = true; } } if ($fixedValueFlag) { if ($_SESSION['curuser']['usertype'] == 'reseller') { $usertypeoptions = $locate->Translate("Reseller") . '<input type="hidden" value="reseller" name="usertype" id="usertype" />'; } else { $usertypeoptions = $locate->Translate("Group Admin") . '<input type="hidden" value="groupadmin" name="usertype" id="usertype" />'; } } else { $usertypeoptions = '<select id="usertype" name="usertype">'; $usertypeoptions .= '<option value="" '; if ($account['usertype'] == '') { $html .= ' selected '; } $usertypeoptions .= '></option>'; if ($_SESSION['curuser']['usertype'] == 'admin') { $usertypeoptions .= '<option value="admin"'; if ($account['usertype'] == 'admin') { $usertypeoptions .= ' selected '; } $usertypeoptions .= ' >' . $locate->Translate("Admin") . '</option>'; $usertypeoptions .= '<option value="reseller"'; if ($account['usertype'] == 'reseller') { $usertypeoptions .= ' selected '; } $usertypeoptions .= ' >' . $locate->Translate("Reseller") . '</option>'; } if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { $usertypeoptions .= '<option value="groupadmin"'; if ($account['usertype'] == 'groupadmin') { $usertypeoptions .= ' selected '; } $usertypeoptions .= ' >' . $locate->Translate("Group Admin") . '</option>'; } $usertypeoptions .= ' <option value="operator"'; if ($account['usertype'] == 'operator') { $usertypeoptions .= ' selected '; } $usertypeoptions .= '>' . $locate->Translate("Operator") . '</option>'; $usertypeoptions .= '</select>'; } $reselleroptions = ''; $reseller = astercrm::getAll('resellergroup'); if ($_SESSION['curuser']['usertype'] == 'admin') { $reselleroptions .= '<select id="resellerid" name="resellerid" onchange="setGroup();">'; $reselleroptions .= '<option value="0"></option>'; while ($reseller->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } if ($row['id'] == $account['resellerid']) { $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>"; } else { $reselleroptions .= "<OPTION value='" . $row['id'] . "' >" . $row['resellername'] . "</OPTION>"; } } $reselleroptions .= '</select>'; } else { while ($reseller->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } if ($row['id'] == $account['resellerid']) { $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">'; break; } } } $group = astercrm::getAll('accountgroup', 'resellerid', $account['resellerid']); if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') { $groupoptions .= '<select id="groupid" name="groupid">'; $groupoptions .= "<OPTION value='0'></OPTION>"; while ($group->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } if ($row['id'] == $account['groupid']) { $groupoptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['groupname'] . "</OPTION>"; } else { $groupoptions .= "<OPTION value='" . $row['id'] . "' >" . $row['groupname'] . "</OPTION>"; } } $groupoptions .= '</select>'; } else { while ($group->fetchInto($row)) { if ($row['id'] == $account['groupid']) { if ($config['synchronize']['display_synchron_server']) { $row['groupname'] = astercrm::getSynchronDisplay($row['id'], $row['groupname']); } $groupoptions .= $row['groupname'] . '<input type="hidden" value="' . $row['id'] . '" name="groupid" id="groupid">'; break; } } } $html = ' <!-- No edit the next line --> <form method="post" name="f" id="f"> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">' . $locate->Translate("username") . '</td> <td align="left"><input type="hidden" id="id" name="id" value="' . $account['id'] . '"><input type="text" id="username" name="username" size="25" maxlength="30" value="' . $account['username'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("password") . '</td> <td align="left"><input type="text" id="password" name="password" size="25" maxlength="30" value="' . $account['password'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("usertype") . '</td> <td align="left">' . $usertypeoptions . ' </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Reseller") . '</td> <td align="left">' . $reselleroptions . '</td> </tr> <tr ' . $groupSelectTrStyle . '> <td nowrap align="left">' . $locate->Translate("Group") . '</td> <td align="left"> ' . $groupoptions . ' </td> </tr> <tr> <td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td> </tr> </table> '; $html .= ' </form> ' . $locate->Translate("obligatory fields") . ' '; return $html; }
function setClid($groupid) { global $locate, $config; $objResponse = new xajaxResponse(); $res = astercrm::getAll("clid", 'groupid', $groupid); //添加option $objResponse->addScript("addOption('sltBooth','" . "0" . "','" . $locate->Translate("All") . "');"); while ($res->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $clidDisplay = astercrm::getSynchronDisplay($row['id'], $row['clid']); } $objResponse->addScript("addOption('sltBooth','" . $row['clid'] . "','" . $clidDisplay . "');"); } $objResponse->addScript("addOption('sltBooth','-1','" . $locate->Translate("Callback") . "');"); return $objResponse; }
/** * Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv". * * @param $id (int) Identificador del registro a ser editado. * @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos * a extraidos de la base de datos para ser editados */ function formEdit($id) { global $locate, $config; $group =& Customer::getRecordByID($id, 'accountgroup'); $reselleroptions = ''; $reseller = astercrm::getAll('resellergroup'); if ($_SESSION['curuser']['usertype'] == 'admin') { $reselleroptions .= '<select id="resellerid" name="resellerid">'; $reselleroptions .= '<option value="0"></option>'; while ($reseller->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } if ($row['id'] == $group['resellerid']) { $reselleroptions .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>"; } else { $reselleroptions .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>"; } } $reselleroptions .= '</select>'; //the admin has the reset group button $resetBtnStr = '<input type="button" onclick="if(confirm("' . $locate->Translate("Make Sure To Reset The Relate Data By Group") . '?")) xajax_resetGroup("' . $group['id'] . '");return false;" value="' . $locate->Translate("Reset Group") . '">'; } else { while ($reseller->fetchInto($row)) { if ($row['id'] == $_SESSION['curuser']['resellerid']) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } $reselleroptions .= $row['resellername'] . '<input type="hidden" value="' . $row['id'] . '" name="resellerid" id="resellerid">'; break; } } //except the admin,other don't have the reset group button $resetBtnStr = ''; } $html = ' <!-- No edit the next line --> <form method="post" name="f" id="f"> <input type="hidden" id="groupid" name="groupid" value=' . $group['id'] . '> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">' . $locate->Translate("Reseller") . '*</td> <td align="left">' . $reselleroptions . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Group Name") . '*</td> <td align="left"><input type="text" id="groupname" name="groupname" size="25" maxlength="30" value="' . $group['groupname'] . '"> ' . $resetBtnStr . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Title") . '</td> <td align="left"><input type="text" id="grouptitle" name="grouptitle" size="25" maxlength="50" value="' . $group['grouptitle'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Tagline") . '</td> <td align="left"><input type="text" id="grouptagline" name="grouptagline" size="25" maxlength="80" value="' . $group['grouptagline'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Account Code") . '</td> <td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="30" value="' . $group['accountcode'] . '">' . "(" . $locate->Translate("might be useful for callback") . ")" . '</td> </tr> <!--<tr> <td nowrap align="left">' . $locate->Translate("Allow Callback") . '</td> <td align="left"> <select id="allowcallback" name="allowcallback">'; if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['allowcallback'] == 'yes') { if ($group['allowcallback'] == "yes") { $html .= '<option value="yes" selected>' . $locate->Translate("Yes") . '</option>'; $html .= '<option value="no">' . $locate->Translate("No") . '</option>'; } else { $html .= '<option value="yes">' . $locate->Translate("Yes") . '</option>'; $html .= '<option value="no" selected>' . $locate->Translate("No") . '</option>'; } } else { $html .= '<option value="no">' . $locate->Translate("No") . '</option>'; } $html .= ' </select> </td> </tr>--> <tr> <td nowrap align="left">' . $locate->Translate("Credit Limit") . '*</td> <td align="left"><input type="text" id="creditlimit" name="creditlimit" size="25" maxlength="30" value="' . $group['creditlimit'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Cur Credit") . '</td> <td align="left"> <input type="text" id="curcreditshow" name="curcreditshow" size="25" maxlength="100" value="' . $group['curcredit'] . '" readonly> <input type="hidden" id="curcredit" name="curcredit" value="' . $group['curcredit'] . '"> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Operate") . '</td> <td align="left" id="tdOperate"> <select id="creditmodtype" name="creditmodtype" onchange="showComment(this)"> <option value="">' . $locate->Translate("No change") . '</option> <option value="add">' . $locate->Translate("Refund") . '</option> <option value="reduce">' . $locate->Translate("Charge") . '</option> </select> <input type="text" id="creditmod" name="creditmod" size="15" maxlength="100" value="" disabled><p> ' . $locate->Translate("Comment") . ' : <input type="text" id="comment" name="comment" size="18" maxlength="20" value="" disabled></p> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Limit Type") . '</td> <td align="left"> <select id="limittype" name="limittype">'; if ($group['limittype'] == "postpaid") { $html .= ' <option value="">' . $locate->Translate("No limit") . '</option> <option value="prepaid">' . $locate->Translate("Prepaid") . '</option> <option value="postpaid" selected>' . $locate->Translate("Postpaid") . '</option>'; } elseif ($group['limittype'] == "prepaid") { $html .= ' <option value="">' . $locate->Translate("No limit") . '</option> <option value="prepaid" selected>' . $locate->Translate("Prepaid") . '</option> <option value="postpaid">' . $locate->Translate("Postpaid") . '</option>'; } else { $html .= ' <option value="" selected>' . $locate->Translate("No limit") . '</option> <option value="prepaid">' . $locate->Translate("Prepaid") . '</option> <option value="postpaid">' . $locate->Translate("Postpaid") . '</option>'; } $html .= '</select> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Group Billsec Multiple") . '</td> <td align="left"> <input type="text" id="group_multiple" name="group_multiple" size="6" maxlength="6" value="' . $group['group_multiple'] . '"> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Customer Billsec Multiple") . '</td> <td align="left"> <input type="text" id="customer_multiple" name="customer_multiple" size="6" maxlength="6" value="' . $group['customer_multiple'] . '"> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Display Logo") . '</td> <td align="left"><input type="radio" id="grouplogostatus" name="grouplogostatus" value="1" '; if ($group['grouplogostatus'] == 1) { $html .= 'checked'; } $html .= '>enable <input type="radio" id="grouplogostatus" name="grouplogostatus" value="0"'; if ($group['grouplogostatus'] == 0) { $html .= 'checked'; } $html .= '>disable</td> </tr> </table> </form>'; $html .= '<form action="upload.php" method="post" enctype="multipart/form-data" name="formLogoUpload" id="formLogoUpload" target="iframeForUpload"> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">' . $locate->Translate("Upload New Logo") . '</td> <td><input type="file" name="callshopLogo" id="callshopLogo" size="35"/><input type="hidden" id="LogoUploadFlag" name="LogoUploadFlag" value="1"> <input type="hidden" id="group_id" name="group_id" value=' . $group['id'] . '></td> <tr> <tr> <td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f")); document.getElementById("formLogoUpload").submit();return false;\'>' . $locate->Translate("continue") . '</button></td> </tr> </table> </form> '; $html .= ' *' . $locate->Translate("Obligatory Fields") . ' '; return $html; }
function searchRateHtml($table, $type, $object) { global $db, $locate, $config; if ($table == 'resellerrate') { $sql = "SELECT {$table}.*,resellergroup.resellername FROM {$table} LEFT JOIN resellergroup ON resellergroup.id = {$table}.resellerid WHERE 1"; } else { $sql = "SELECT {$table}.*,resellergroup.resellername,accountgroup.groupname FROM {$table} LEFT JOIN resellergroup ON resellergroup.id = {$table}.resellerid LEFT JOIN accountgroup ON accountgroup.id = {$table}.groupid WHERE 1"; } $totalSql = "SELECT count(*) FROM {$table} WHERE 1 "; $insertSql = "INSERT INTO {$table}_history SELECT * FROM {$table} WHERE 1 "; $deleteSql = "DELETE FROM {$table} WHERE 1 "; $tmpSql = ''; if ($type == 'all') { $tmpSql .= " "; } else { if ($type == 'system') { $tmpSql .= " AND {$table}.resellerid = 0 "; } else { if ($type == 'reseller') { $tmpSql .= " AND {$table}.resellerid = '{$object}' "; } else { if ($type == 'group') { if ($object == 'default') { $tmpSql .= " AND {$table}.groupid = 0 "; } else { $tmpSql .= " AND {$table}.groupid = '{$object}' "; } } } } } $insertSql .= $tmpSql; //search total rate by this conditions Customer::events($totalSql . $tmpSql); $totalRes =& $db->query($totalSql . $tmpSql); $totalRes->fetchInto($totalResult, DB_FETCHMODE_ORDERED); $deleteSql = $deleteSql . $tmpSql; //delete sql $sql = $sql . $tmpSql . " limit 20 ; "; //show 20 data on the page Customer::events($sql); $result =& $db->query($sql); // <input type="button" value="'.$locate->Translate("delete").'" onclick="if (confirm(\''.$locate->Translate("Are you sure you want to delete this rate").'?\')) xajax_deleteRate(document.getElementById(\'deleteSql\').value);return false;" /> $dataHtml = '<div>' . $locate->Translate('Rate Amount is') . ' ' . $totalResult[0] . ',' . $locate->Translate('default show 20 data') . '</div> <table border="1" class="adminlist"> <tr> <th width="" class="title">' . $locate->Translate('id') . '</th> <th width="" class="title">' . $locate->Translate('prefix') . '</th> <th width="" class="title">' . $locate->Translate('length') . '</th> <th width="" class="title">' . $locate->Translate('destination') . '</th> <th width="" class="title">' . $locate->Translate('connect_charge') . '</th> <th width="" class="title">' . $locate->Translate('init_block') . '</th> <th width="" class="title">' . $locate->Translate('rate') . '</th> <th width="" class="title">' . $locate->Translate('billing_block') . '</th> <th width="" class="title">' . $locate->Translate('group') . '</th> <th width="" class="title">' . $locate->Translate('reseller') . '</th> <th width="" class="title">' . $locate->Translate('addtime') . '</th> </tr>'; $i = 0; while ($result->fetchInto($row)) { $j = 0; if ($i % 2 == 0) { $j = 1; } if ($config['synchronize']['display_synchron_server']) { $html .= astercrm::getSynchronDisplay($row['id'], $row['id']); } $dataHtml .= '<tr class="row' . $j . '" id="gridRow' . $i . '"> <td style="cursor: pointer;" id="gridRow1Col1">' . $row['id'] . '</td> <td style="cursor: pointer;" id="gridRow1Col2">' . $row['dialprefix'] . '</td> <td style="cursor: pointer;" id="gridRow1Col3">' . $row['numlen'] . '</td> <td style="cursor: pointer;" id="gridRow1Col4">' . $row['destination'] . '</td> <td style="cursor: pointer;" id="gridRow1Col5">' . $row['connectcharge'] . '</td> <td style="cursor: pointer;" id="gridRow1Col6">' . $row['initblock'] . '</td> <td style="cursor: pointer;" id="gridRow1Col7">' . $row['rateinitial'] . '</td> <td style="cursor: pointer;" id="gridRow1Col8">' . $row['billingblock'] . '</td> <td style="cursor: pointer;" id="gridRow1Col9">' . $row['groupname'] . '</td> <td style="cursor: pointer;" id="gridRow1Col10">' . $row['resellername'] . '</td> <td style="cursor: pointer;" id="gridRow1Col11">' . $row['addtime'] . '</td> </tr>'; } $dataHtml .= '</table><input type="hidden" id="deleteSql" value="' . $deleteSql . '" /><input type="hidden" id="historySql" value="' . $insertSql . '" />'; return $dataHtml; }
/** * Imprime la forma para editar un nuevo registro sobre el DIV identificado por "formDiv". * * @param $id (int) Identificador del registro a ser editado. * @return $html (string) Devuelve una cadena de caracteres que contiene la forma con los datos * a extraidos de la base de datos para ser editados */ function formEdit($id) { global $locate, $config; $rate =& Customer::getRecordByID($id, 'resellerrate'); $reseller = astercrm::getAll('resellergroup'); $options .= '<select id="resellerid" name="resellerid">'; $flag = false; while ($reseller->fetchInto($row)) { if ($config['synchronize']['display_synchron_server']) { $row['resellername'] = astercrm::getSynchronDisplay($row['id'], $row['resellername']); } if ($row['id'] == $rate['resellerid']) { $options .= "<OPTION value='" . $row['id'] . "' selected>" . $row['resellername'] . "</OPTION>"; $flag = true; } else { $options .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>"; } } if ($flag == true) { $options .= "<OPTION value='0'>" . $locate->Translate("All") . "</OPTION>"; } else { $options .= "<OPTION value='0' selected>" . $locate->Translate("All") . "</OPTION>"; } $options .= '</select>'; $html = ' <!-- No edit the next line --> <form method="post" name="f" id="f"> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">' . $locate->Translate("Prefix") . '</td> <td align="left"><input type="hidden" id="id" name="id" value="' . $rate['id'] . '"><input type="text" id="dialprefix" name="dialprefix" size="25" maxlength="30" value="' . $rate['dialprefix'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Length") . '</td> <td align="left"><input type="text" id="numlen" name="numlen" size="10" maxlength="10" value="' . $rate['numlen'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Dest") . '</td> <td align="left"><input type="text" id="destination" name="destination" size="25" maxlength="30" value="' . $rate['destination'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Connect Charge") . '</td> <td align="left"><input type="text" id="connectcharge" name="connectcharge" size="20" maxlength="20" value="' . $rate['connectcharge'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Init Block") . '</td> <td align="left"><input type="text" id="initblock" name="initblock" size="25" maxlength="100" value="' . $rate['initblock'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Rate") . '</td> <td align="left"><input type="text" id="rateinitial" name="rateinitial" size="25" maxlength="30" value="' . $rate['rateinitial'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Billing Block") . '</td> <td align="left"><input type="text" id="billingblock" name="billingblock" size="25" maxlength="30" value="' . $rate['billingblock'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Reseller") . '</td> <td align="left"> ' . $options . ' </td> </tr> <tr> <td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_update(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td> </tr> </table> '; $html .= ' </form> *' . $locate->Translate("obligatory_fields") . ' '; return $html; }