Ejemplo n.º 1
0
    /**
     *  Imprime la forma para agregar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param ninguno
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma para insertar 
     *							un nuevo registro.
     */
    function formAdd()
    {
        global $locate, $config;
        $pin = astercrm::generateUniquePin(intval($config['system']['pin_len']));
        $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("Pin") . '*</td>
					<td align="left"><input type="text" id="pin" name="pin" size="25" maxlength="30" value="' . $pin . '" readonly><input type="hidden" id="pin" name="pin" value="' . $pin . '"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("First name") . '</td>
					<td align="left"><input type="text" id="first_name" name="first_name" size="25" maxlength="50"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Last name") . '</td>
					<td align="left"><input type="text" id="last_name" name="last_name" size="25" maxlength="50"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Discount") . '</td>
					<td align="left"><input type="radio" id="discount_type" name="discount_type" value="0" onclick="selectDiscountType(this.value);" checked>' . $locate->Translate("Dynamic") . '<input type="radio" id="discount_type" name="discount_type" value="1" onclick="selectDiscountType(this.value);">' . $locate->Translate("Static") . '&nbsp;<input type="text" id="discount" name="discount" size="15" maxlength="10" disabled></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_save(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
			</form>
			*' . $locate->Translate("obligatory_fields") . '
			';
        return $html;
    }
Ejemplo n.º 2
0
    /**
     *  Imprime la forma para agregar un nuevo registro sobre el DIV identificado por "formDiv".
     *
     *	@param ninguno
     *	@return $html	(string) Devuelve una cadena de caracteres que contiene la forma para insertar 
     *							un nuevo registro.
     */
    function formAdd()
    {
        global $locate, $config;
        /*
        if ($_SESSION['curuser']['usertype'] == 'reseller'){
        	$group = astercrm::getAll('accountgroup','resellerid',$_SESSION['curuser']['resellerid']);
        }elseif($_SESSION['curuser']['usertype'] == 'admin'){
        	$group = astercrm::getAll('accountgroup');
        }
        
        while	($group->fetchInto($row)){
        	$groupoptions .= "<OPTION value='".$row['id']."'>".$row['groupname']."</OPTION>";
        }
        */
        $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']);
                }
                $reselleroptions .= "<OPTION value='" . $row['id'] . "'>" . $row['resellername'] . "</OPTION>";
            }
            $reselleroptions .= '</select>';
        } 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;
                }
            }
        }
        $group = astercrm::getAll('accountgroup', 'resellerid', $_SESSION['curuser']['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']);
                }
                $groupoptions .= "<OPTION value='" . $row['id'] . "'>" . $row['groupname'] . "</OPTION>";
            }
            $groupoptions .= '</select>';
        } else {
            while ($group->fetchInto($row)) {
                if ($row['id'] == $_SESSION['curuser']['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;
                }
            }
        }
        $statusoptions = '
							<option value="1">' . $locate->Translate("Avaiable") . '</option>
							<option value="-1">' . $locate->Translate("Lock") . '</option>
						';
        $pin = astercrm::generateUniquePin(intval($config['system']['pin_len']));
        $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']);
        }
        $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="text" id="clid" name="clid" size="25" maxlength="30" onblur="document.getElementById(\'accountcode\').value = this.value;"></td>
				</tr>';
        if ($billingfield == 'callerid') {
            $html .= '
				<tr>
					<td nowrap align="left">' . $locate->Translate("Accountcode") . '</td>
					<td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="40"></td>
				</tr>';
        } else {
            $html .= '
				<tr style="display:none;">
					<td nowrap align="left">' . $locate->Translate("Accountcode") . '</td>
					<td align="left"><input type="text" id="accountcode" name="accountcode" size="25" maxlength="40"></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="' . $pin . '" readonly><input type="hidden" id="pin" name="pin" value="' . $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"></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"></td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Limit Type") . '</td>
					<td align="left">
					<select id="limittype" name="limittype">
						<option value="" selected>' . $locate->Translate("No limit") . '</option>
						<option value="prepaid">' . $locate->Translate("Prepaid") . '</option>
						<option value="postpaid">' . $locate->Translate("Postpaid") . '</option>
					</select>
					</td>
				</tr>';
        }
        $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">' . $statusoptions . '</select>
					</td>
				</tr>
				<tr>
					<td nowrap align="left">' . $locate->Translate("Is Show") . '</td>
					<td align="left">
						<select id="isshow" name="isshow"><option value="yes">' . $locate->Translate("yes") . '</option><option value="no">' . $locate->Translate("no") . '</option></select>
					</td>
				</tr>
				<tr>
					<td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_save(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("continue") . '</button></td>
				</tr>

			 </table>
			';
        $html .= '
			</form>
			*' . $locate->Translate("obligatory_fields") . '
			';
        return $html;
    }