예제 #1
0
 function createRecurringSchedule($company_id, $template_id, $start_date, $end_date, $user_ids)
 {
     $rscf = new RecurringScheduleControlFactory();
     $rscf->setCompany($company_id);
     $rscf->setRecurringScheduleTemplateControl($template_id);
     $rscf->setStartWeek(1);
     $rscf->setStartDate($start_date);
     $rscf->setEndDate($end_date);
     $rscf->setAutoFill(FALSE);
     if ($rscf->isValid()) {
         $rscf->Save(FALSE);
         if (isset($user_ids)) {
             $rscf->setUser($user_ids);
         }
         if ($rscf->isValid()) {
             $rscf->Save();
             Debug::Text('Saving Recurring Schedule...', __FILE__, __LINE__, __METHOD__, 10);
             return TRUE;
         }
     }
     return FALSE;
 }
        $permission_children_ids = array();
    }
    if ($permission->Check('recurring_schedule', 'view_own')) {
        $permission_children_ids[] = $current_user->getId();
    }
    $filter_data['permission_children_ids'] = $permission_children_ids;
}
$rscf = new RecurringScheduleControlFactory();
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'submit':
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $rscf->setId($data['id']);
        $rscf->setCompany($current_company->getId());
        $rscf->setRecurringScheduleTemplateControl($data['template_id']);
        $rscf->setStartWeek($data['start_week']);
        $rscf->setStartDate($data['start_date']);
        $rscf->setEndDate($data['end_date']);
        if (isset($data['auto_fill'])) {
            $rscf->setAutoFill(TRUE);
        } else {
            $rscf->setAutoFill(FALSE);
        }
        if ($rscf->isValid()) {
            $rscf->Save(FALSE);
            if (isset($data['user_ids'])) {
                $rscf->setUser($data['user_ids']);
            }
            if ($rscf->isValid()) {
                $rscf->Save();