$error[$num_errors++] = "The day must be informed correctly"; } if (User_Validate_Simple_Field($_POST['year'], 2) <= 0 && is_int($_POST['year'])) { $error[$num_errors++] = "The year must be informed correctly"; } else { $max_day = date('t', mktime(0, 0, 0, $_POST['month'], 1, $_POST['year'])); if ($_POST['day'] > $max_day) { $error[$num_errors++] = "Invalid day"; } } $check = Check_Appointment_Overlap($account_id, $_POST['day'], $_POST['month'], $_POST['year'], $_POST['beg_time'], $_POST['end_time'], '', $bd); if ($check) { $error[$num_errors++] = "There is another appointment within this time span"; } if ($ins_at_master) { $check = Check_Appointment_Overlap($owner, $_POST['day'], $_POST['month'], $_POST['year'], $_POST['beg_time'], $_POST['end_time'], '', $bd); if ($check) { $error[$num_errors++] = "There is another appointment on the owner's schedule within this time span"; } } if (empty($error)) { $day_w = date('w', mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year'])); $check = $check = Check_Weekly_Appointment_Overlap($account_id, $day_w, $_POST['beg_time'], $_POST['end_time'], '', $bd); if ($ins_at_master) { $check1 = Check_Weekly_Appointment_Overlap($owner, $day_w, $_POST['beg_time'], $_POST['end_time'], '', $bd); } if (!$check1 && !$check) { Insert_Appointment($account_id, $_POST['description'], $_POST['type'], $_POST['year'] . "-" . $_POST['month'] . "-" . $_POST['day'], $_POST['beg_time'], $_POST['end_time'], $_POST['url'], $owner, 0, 0, 1, $bd); $alert[$num_alerts++] = "Appointment Inserted Successfully"; if ($ins_at_master) { Insert_Appointment($owner, $_POST['description'], $_POST['type'], $_POST['year'] . "-" . $_POST['month'] . "-" . $_POST['day'], $_POST['beg_time'], $_POST['end_time'], $_POST['url'], $owner, 0, 0, 1, $bd);
function Group_Check_Appointment_Overlap($group_id, $day, $month, $year, $beg_time, $end_time, $bd) { $members = List_Members($group_id, 0, $bd); $overlap = 0; for ($j = 0; $j < count($members) && !$overlap; $j++) { $current = Check_Appointment_Overlap($members[$j][0], $day, $month, $year, $beg_time, $end_time, '', $bd); if ($current == 0) { $overlap = 0; } else { $overlap = 1; } } return $overlap; }
include "sch_auth.php"; exit; } else { if ($conf == 'yes') { $apps = array(); $overlap_apps = Check_Weekly_Appointment_Overlap($account_id, $app[0][15], $app[0][7], $app[0][9], '', $bd); echo $app[0][15]; if ($overlap_apps) { for ($i = 0; $i < $bd->NumberOfRows($overlap_apps); $i++) { $cur_app = $bd->FetchResult($overlap_apps, $i, 'app_id'); $res_app = List_Weekly_Appointments($account_id, '', '', 1, '', '', '', '', $cur_app, '', $cfg['time'], $array_type, $array_color, $array_image, $cfg['days'], $bd); $apps = array_merge($apps, $res_app); } } if ($perio == 'common') { $overlap_apps = Check_Appointment_Overlap($account_id, $app[0][4], $app[0][5], $app[0][6], $app[0][7], $app[0][9], '', $bd); if ($overlap_apps) { for ($i = 0; $i < $bd->NumberOfRows($overlap_apps); $i++) { $cur_app = $bd->FetchResult($overlap_apps, $i, 'app_id'); $res_app = List_Appointments($account_id, '', '', 1, '', '', '', '', $cur_app, '', $cfg['time'], $array_type, $array_color, $array_image, $cfg['days'], $bd); $apps = array_merge($apps, $res_app); } } } if (count($apps) == 0) { $update = "UPDATE appointments SET authorized = 1 WHERE\n\t\t\t\t\tapp_id = " . $app[0][0]; $bd->Query($update); $alert[$num_alerts++] = "Appointment authorized successfully."; include "sch_auth.php"; exit; }