<?php require_once "include.php"; if (!xml2php("employees")) { $smarty->assign('error_msg', "Error in language file"); } if (isset($VAR['submit'])) { /* check if we have an ID */ if (!isset($VAR['employee_id'])) { force_page('core', 'error&error_msg=No Employee ID'); } /* if we are changing password update */ if ($VAR['password'] != '' || $VAR['login_id'] != '') { $update = "SET EMPLOYEE_PASSWD \t\t=" . $db->qstr(md5($VAR['password'])) . ",\n\t\t\t\t\t\t\tEMPLOYEE_EMAIL\t\t\t=" . $db->qstr($VAR['email']) . ", \n\t\t\t\t\t\t\tEMPLOYEE_FIRST_NAME\t\t=" . $db->qstr($VAR['firstName']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_LAST_NAME\t\t=" . $db->qstr($VAR['lastName']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_DISPLAY_NAME =" . $db->qstr($VAR['displayName']) . ",\n EMPLOYEE_LOGIN ="******",\n\t\t\t\t\t\t\tEMPLOYEE_SSN\t\t\t\t=" . $db->qstr($VAR['']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_ADDRESS\t\t=" . $db->qstr($VAR['address']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_CITY\t\t\t=" . $db->qstr($VAR['city']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_STATE\t\t\t=" . $db->qstr($VAR['state']) . ", \n\t\t\t\t\t\t\tEMPLOYEE_ZIP \t\t\t=" . $db->qstr($VAR['zip']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_TYPE\t\t\t=" . $db->qstr($VAR['type']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_BASED\t\t\t=" . $db->qstr($VAR['based']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_WORK_PHONE\t=" . $db->qstr($VAR['workPhone']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_HOME_PHONE \t=" . $db->qstr($VAR['homePhone']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_MOBILE_PHONE\t=" . $db->qstr($VAR['mobilePhone']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_STATUS\t\t\t=" . $db->qstr($VAR['active']); } else { $update = "\t\tSET\n\t\t\t\t\t\t\tEMPLOYEE_EMAIL\t\t\t=" . $db->qstr($VAR['email']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_FIRST_NAME\t\t=" . $db->qstr($VAR['firstName']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_LAST_NAME\t\t=" . $db->qstr($VAR['lastName']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_DISPLAY_NAME =" . $db->qstr($VAR['displayName']) . ", \n\t\t\t\t\t\t\tEMPLOYEE_SSN\t\t\t\t=" . $db->qstr($VAR['']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_ADDRESS\t\t=" . $db->qstr($VAR['address']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_CITY\t\t\t=" . $db->qstr($VAR['city']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_STATE\t\t\t=" . $db->qstr($VAR['state']) . ", \n\t\t\t\t\t\t\tEMPLOYEE_ZIP \t\t\t=" . $db->qstr($VAR['zip']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_TYPE\t\t\t=" . $db->qstr($VAR['type']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_BASED\t\t\t=" . $db->qstr($VAR['based']) . ",\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tEMPLOYEE_WORK_PHONE\t=" . $db->qstr($VAR['workPhone']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_HOME_PHONE \t=" . $db->qstr($VAR['homePhone']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_MOBILE_PHONE\t=" . $db->qstr($VAR['mobilePhone']) . ",\n\t\t\t\t\t\t\tEMPLOYEE_STATUS\t\t\t=" . $db->qstr($VAR['active']); } $q = "UPDATE " . PRFX . "TABLE_EMPLOYEE " . $update . "\n\t\t\tWHERE EMPLOYEE_ID= " . $db->qstr($VAR['employee_id']); if (!($rs = $db->execute($q))) { force_page('core', 'error&error_msg=Error updateing Employee Information'); } force_page('employees', 'employee_details&employee_id=' . $VAR['employee_id'] . '&page_title=Employees'); } else { $smarty->assign('employee_type', employee_type($db)); $smarty->assign('employee_details', display_employee_info($db, $VAR['employee_id'])); $smarty->display('employees' . SEP . 'edit.tpl'); }
<?php require_once "include.php"; if (!xml2php("employees")) { $smarty->assign('error_msg', "Error in language file"); } // Get the customers id from the url $employee_id = $VAR['employee_id']; // assign the arrays $smarty->assign('open_work_orders', display_open_workorders($db, $employee_id)); $smarty->assign('employee_details', display_employee_info($db, $employee_id)); $smarty->display('employees' . SEP . 'employee_details.tpl');