} if (isset($week_row['end_time']) and $week_row['end_time'] != '') { $week_rows[$week_row_id]['end_time'] = TTDate::strtotime($week_row['end_time']); } } } $rstcf = new RecurringScheduleTemplateControlFactory(); $rstf = new RecurringScheduleTemplateFactory(); $action = Misc::findSubmitButton(); $action = strtolower($action); switch ($action) { case 'submit': Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10); //Debug::setVerbosity(11); $redirect = 0; $rstcf->StartTransaction(); $rstcf->setId($data['id']); $rstcf->setCompany($current_company->getId()); $rstcf->setName($data['name']); $rstcf->setDescription($data['description']); if ($rstcf->isValid()) { $rstc_id = $rstcf->Save(); Debug::Text('aRecurring Schedule Template Control ID: ' . $rstc_id, __FILE__, __LINE__, __METHOD__, 10); if ($rstc_id === TRUE) { $rstc_id = $data['id']; } Debug::Text('bRecurring Schedule Template Control ID: ' . $rstc_id, __FILE__, __LINE__, __METHOD__, 10); //Save each weeks data. if (count($week_rows) > 0) { foreach ($week_rows as $week_row_id => $week_row) { Debug::Text('Row ID: ' . $week_row_id . ' Week: ' . $week_row['week'], __FILE__, __LINE__, __METHOD__, 10);