/** * Muestra todos los datos de un registro sobre el DIV identificado por "formDiv". * * @param $id (int) Identificador del registro a ser mostrado. * @return $html (string) Devuelve una cadena de caracteres que contiene una tabla con los datos * a extraidos de la base de datos para ser mostrados */ function showCustomerRecord($id, $type = "customer") { global $locate; $customer =& astercrm::getCustomerByID($id, $type); $contactList =& astercrm::getContactListByID($customer['id']); $html = ' <table border="0" width="100%"> <tr> <td nowrap align="left" width="160">' . $locate->Translate("customer_name") . ' [<a href=? onclick="xajax_showNote(\'' . $customer['id'] . '\',\'customer\');return false;">' . $locate->Translate("note") . '</a>]</td> <td align="left">' . $customer['customer'] . ' [<a href=? onclick="xajax_edit(\'' . $customer['id'] . '\',\'customer\');return false;">' . $locate->Translate("edit") . '</a>] [<a href=? onclick=" if (xajax.$(\'hidCustomerBankDetails\').value == \'OFF\'){ showObj(\'trCustomerBankDetails\'); xajax.$(\'hidCustomerBankDetails\').value = \'ON\'; }else{ hideObj(\'trCustomerBankDetails\'); xajax.$(\'hidCustomerBankDetails\').value = \'OFF\'; } return false;">' . $locate->Translate("bank") . '</a>]<input type="hidden" value="OFF" name="hidCustomerBankDetails" id="hidCustomerBankDetails"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("city") . '/' . $locate->Translate("state") . '[' . $locate->Translate("zipcode") . ']' . '</td> <td align="left">' . $customer['city'] . '/' . $customer['state'] . '[' . $customer['zipcode'] . ']' . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("address") . '</td> <td align="left">' . $customer['address'] . '</td> </tr> <!--**********************--> <tr> <td nowrap align="left">' . $locate->Translate("mobile") . '</td> <td align="left"><a href=? onclick="xajax_dial(\'' . $customer['mobile'] . '\');return false;">' . $customer['mobile'] . '</a></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("fax") . '</td> <td align="left"><a href=? onclick="xajax_dial(\'' . $customer['fax'] . '\');return false;">' . $customer['fax'] . '</a></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("email") . '</td> <td align="left">' . $customer['email'] . '</td> </tr> <!--**********************--> <tr> <td nowrap align="left">' . $locate->Translate("website") . '</td> <td align="left"><a href="' . $customer['website'] . '" target="_blank">' . $customer['website'] . '</a></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("customer_contact") . '</td> <td align="left">' . $customer['contact'] . ' (' . $locate->Translate($customer['contactgender']) . ')</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("customer_phone") . '</td> <td align="left"><a href=? onclick="xajax_dial(\'' . $customer['phone'] . '\');return false;">' . $customer['phone'] . '</a></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("category") . '</td> <td align="left">' . $customer['category'] . '</td> </tr> <tr id="trCustomerBankDetails" name="trCustomerBankDetails" style="display:none"> <td nowrap align="left">' . $locate->Translate("bank_name") . '</td> <td align="left">' . $customer['bankname'] . '</td> </tr> <tr id="trCustomerBankDetails" name="trCustomerBankDetails" style="display:none"> <td nowrap align="left">' . $locate->Translate("bank_zip") . '</td> <td align="left">' . $customer['bankzip'] . '</td> </tr> <tr id="trCustomerBankDetails" name="trCustomerBankDetails" style="display:none"> <td nowrap align="left">' . $locate->Translate("bank_account_name") . '</td> <td align="left">' . $customer['bankaccountname'] . '</td> </tr> <tr id="trCustomerBankDetails" name="trCustomerBankDetails" style="display:none"> <td nowrap align="left">' . $locate->Translate("bank_account") . '</td> <td align="left">' . $customer['bankaccount'] . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("create_time") . '</td> <td align="left">' . $customer['cretime'] . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("create_by") . '</td> <td align="left">' . $customer['creby'] . '</td> </tr> <tr> <td colspan=2> <table width="100%"> <tr> <td> <a href=? onclick="if (xajax.$(\'allContact\').value==\'off\'){xajax.$(\'contactList\').style.display=\'block\';xajax.$(\'allContact\').value=\'on\'}else{xajax.$(\'contactList\').style.display=\'none\';xajax.$(\'allContact\').value=\'off\'} return false;">' . $locate->Translate("display_all") . '</a> </td> <td> <a href="?" onclick="xajax_noteAdd(\'' . $customer['id'] . '\',0);return false;">' . $locate->Translate("add_note") . '</a> </td> <td> <a href="?" onclick="xajax_surveyAdd(\'' . $customer['id'] . '\',0);return false;">' . $locate->Translate("add_survey") . '</a> </td> <input type="hidden" id="allContact" name="allContact" value="off"> </tr> </table> </td> </tr> </table> <table border="0" width="100%" id="contactList" name="contactList" style="display:none"> '; while ($contactList->fetchInto($row)) { $html .= '<tr>'; for ($i = 1; $i < 5; $i++) { $html .= ' <td align="left" width="20%"> <a href=? onclick="xajax_showContact(\'' . $row['id'] . '\');return false;">' . $row['contact'] . '</a> </td> '; if (!$contactList->fetchInto($row)) { $html .= '<td> </td>'; } } $html .= '</tr>'; } $html .= ' </table>'; return $html; }
function formDiallistAdd($userexten, $customerid) { global $locate; // echo $userexten.$customerid;exit; if ($_SESSION['curuser']['usertype'] == 'admin') { $res = Customer::getGroups(); $groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">'; while ($row = $res->fetchRow()) { $groupoptions .= '<option value="' . $row['groupid'] . '"'; $groupoptions .= '>' . $row['groupname'] . '</option>'; } $groupoptions .= '</select>'; $assignoptions = '<input type="text" id="assign" name="assign" size="35"">'; } elseif ($_SESSION['curuser']['usertype'] == 'groupadmin') { $groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">'; $res = Customer::getRecordsByField('groupid', $_SESSION['curuser']['groupid'], 'astercrm_account'); $assignoptions .= '<select name="assign" id="assign">'; $assignoptions .= '<option value="">' . $locate->Translate("none") . '</option>'; while ($row = $res->fetchRow()) { $assignoptions .= '<option value="' . $row['extension'] . '"'; $assignoptions .= '>' . $row['extension'] . '</option>'; } $assignoptions .= '</select>'; } else { $groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">'; $assignoptions = '<input type="text" id="assign" name="assign" size="35" value="' . $_SESSION['curuser']['extension'] . '" disabled><input type="hidden" id="assign" name="assign" value="' . $_SESSION['curuser']['extension'] . '">'; } $customernamehtml = ''; if ($userexten != '' && $customerid > 0) { $res_customer = astercrm::getRecordById($customerid, 'customer'); $res_contact = astercrm::getContactListByID($customerid); $numberblank = '<select name="dialnumber" id="dialnumber">'; if ($res_customer['phone'] != '') { $numberblank .= '<option value="' . $res_customer['phone'] . '">' . $res_customer['phone'] . '</option>'; } if ($res_customer['mobile'] != '') { $numberblank .= '<option value="' . $res_customer['mobile'] . '">' . $res_customer['mobile'] . '</option>'; } while ($res_contact->fetchInto($row)) { if ($row['phone'] != '') { $numberblank .= '<option value="' . $row['phone'] . '">' . $row['phone'] . '</option>'; } if ($row['phone1'] != '') { $numberblank .= '<option value="' . $row['phone1'] . '">' . $row['phone1'] . '</option>'; } if ($row['phone2'] != '') { $numberblank .= '<option value="' . $row['phone2'] . '">' . $row['phone2'] . '</option>'; } if ($row['mobile'] != '') { $numberblank .= '<option value="' . $row['mobile'] . '">' . $row['mobile'] . '</option>'; } } $numberblank .= '</select>'; $saveHtml = ' <tr> <td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="xajax_saveDiallist(xajax.getFormValues(\'formaddDiallist\'),\'' . $userexten . '\',\'' . $customerid . '\');return false;"></td> </tr> <table> </form> '; } else { $numberblank = '<input name="dialnumber" id="dialnumber">'; $customernamehtml = '<tr> <td nowrap align="left">' . $locate->Translate("Customer Name") . '</td> <td align="left"><input name="customername" id="customername"></td> </tr>'; $saveHtml = ' <tr> <td nowrap colspan=2 align=right><input type="button" id="btnAddDiallist" name="btnAddDiallist" value="' . $locate->Translate("continue") . '" onclick="saveDiallistMain(xajax.getFormValues(\'formaddDiallist\'));return false;"></td> </tr> <table> </form> '; } $html = ' <!-- No edit the next line --> <form method="post" name="formaddDiallist" id="formaddDiallist"> <table border="1" width="100%" class="adminlist">' . $customernamehtml . ' <tr> <td nowrap align="left">' . $locate->Translate("Dialnumber") . '*</td> <td align="left">' . $numberblank . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Assign To") . '</td> <td align="left"> ' . $assignoptions . ' </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Call Order") . '</td> <td align="left"> <input type="text" id="callOrder" name="callOrder" size="20" value="1"> </td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Dialtime") . '</td> <td align="left"> <input type="text" id="dialtime" name="dialtime" size="20" value="' . date("Y-m-d H:i", time()) . '"> <INPUT onclick="displayCalendar(document.getElementById(\'dialtime\'),\'yyyy-mm-dd hh:ii\',this,true)" type="button" value="Cal"> </td> </tr>'; $html .= ' <tr> <td align="left" width="25%">' . $locate->Translate("Group Name") . '</td> <td>' . $groupoptions . '</td> </tr>'; $html .= ' <tr> <td align="left" width="25%">' . $locate->Translate("Campaign Name") . '</td> <td><SELECT id="campaignid" name="campaignid"></SELECT></td> </tr>'; $html .= ' <tr> <td align="left" width="25%">' . $locate->Translate("Memo") . '</td> <td><textarea id="memo" name="memo" cols="50" rows="8"></textarea></td> </tr>'; $html .= $saveHtml; return $html; }