/
var
/
www
/
html
/
sugardemo
/
modules
/
Employees
/
Upload File
HOME
<?php /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/Resources/Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ /********************************************************************************* * Description: Contains a variety of utility functions used to display UI * components such as form headers and footers. Intended to be modified on a per * theme basis. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ /** * Create javascript to validate the data entered into a record. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. */ function get_validate_record_js() { global $mod_strings; global $app_strings; $lbl_last_name = $mod_strings['LBL_LIST_LAST_NAME']; $lbl_employee_name = $mod_strings['LBL_LIST_EMPLOYEE_NAME']; $err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS']; $err_invalid_email_address = $app_strings['ERR_INVALID_EMAIL_ADDRESS']; $err_self_reporting = $app_strings['ERR_SELF_REPORTING']; $sqs_no_match = $app_strings['ERR_SQS_NO_MATCH'] . ' : ' . $mod_strings['LBL_LIST_REPORTS_TO_NAME']; $the_script = <<<EOQ <script type="text/javascript" language="Javascript"> function verify_data(form) { var isError = false; var errorMessage = ""; if (trim(form.last_name.value) == "") { isError = true; errorMessage += "\\n$lbl_last_name"; } if (isError == true) { alert("$err_missing_required_fields" + errorMessage); return false; } if (trim(form.email1.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(form.email1.value)) { alert('"' + form.email1.value + '" $err_invalid_email_address'); return false; } if (trim(form.email2.value) != "" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(form.email2.value)) { alert('"' + form.email2.value + '" $err_invalid_email_address'); return false; } if ((trim(form.reports_to_name.value) == "" && trim(form.reports_to_id.value) != "") || (trim(form.reports_to_name.value) != "" && trim(form.reports_to_id.value) == "")) { alert('$sqs_no_match'); return false; } if (document.EditView.return_id.value != '' && document.EditView.return_id.value == form.reports_to_id.value) { alert('$err_self_reporting'); return false; } return true; } </script> EOQ; return $the_script; } function get_chooser_js() { $the_script = <<<EOQ <script type="text/javascript" language="Javascript"> <!-- to hide script contents from old browsers function set_chooser() { var display_tabs_def = ''; for(i=0; i < object_refs['display_tabs'].options.length ;i++) { display_tabs_def += "display_tabs[]="+object_refs['display_tabs'].options[i].value+"&"; } document.EditView.display_tabs_def.value = display_tabs_def; } // end hiding contents from old browsers --> </script> EOQ; return $the_script; }