break; } // Do the checks if ($administration_employee_role->id != 0) { // Existing employee_role /********************************************/ /*** First do the start date check series ***/ /********************************************/ if ($_POST['employees_roles_start_date'] != $administration_employee_role->start_date) { // Start date has changed if ($_POST['employees_roles_start_date'] < $administration_employee_role->start_date) { // Start date before original start date if ($_POST['question_t1'] == 'ASKED') { // Change tariffs_start_date OK or not (doesn't matter in this stage) } else { if (tep_not_null($administration_employee_role->has_tariffs(null, 'tariffs_start_date', '=', tep_strftime(DATE_FORMAT_DATABASE, $administration_employee_role->start_date)))) { $_POST['question_t1'] = 'ASK'; break; } } } else { // Start date after original start date // Check tariffs if (tep_not_null($administration_employee_role->has_tariffs(null, 'tariffs_end_date', '<', tep_strftime(DATE_FORMAT_DATABASE, $_POST['employees_roles_start_date'])))) { $_POST['action'] = 'enter_data'; $error_level = 8; // Tariff end date before new start date break; } else { if (tep_not_null($administration_employee_role->has_tariffs(null, 'tariffs_start_date', '<', tep_strftime(DATE_FORMAT_DATABASE, $_POST['employees_roles_start_date']), 'AND', 'tariffs_end_date', '>=', tep_strftime(DATE_FORMAT_DATABASE, $_POST['employees_roles_start_date'])))) { $_POST['question_t1_answer'] = true;
public function has_tariffs($parents_id, $column_name1, $comparison1, $value1, $delimiter = '', $column_name2 = '', $comparison2 = '', $value2 = '') { $database = $_SESSION['database']; $roles_listing = ''; if (tep_not_null($parents_id)) { $roles_query = $database->query("select roles_id from " . TABLE_ROLES . " where projects_id in (" . $parents_id . ")"); while ($roles_result = $database->fetch_array($roles_query)) { if (tep_not_null($roles_listing)) { $roles_listing .= ','; } $roles_listing .= '' . $roles_result['roles_id']; } } $employee_role = new employee_role(); return $employee_role->has_tariffs($roles_listing, $column_name1, $comparison1, $value1, $delimiter, $column_name2, $comparison2, $value2); }