function createHolidayPolicy($company_id, $type)
 {
     $hpf = new HolidayPolicyFactory();
     $hpf->setCompany($company_id);
     switch ($type) {
         case 10:
             $hpf->setName('Default');
             $hpf->setType(10);
             $hpf->setDefaultScheduleStatus(10);
             $hpf->setMinimumEmployedDays(0);
             $hpf->setMinimumWorkedPeriodDays(0);
             $hpf->setMinimumWorkedDays(0);
             $hpf->setAverageTimeDays(10);
             $hpf->setAverageTimeWorkedDays(TRUE);
             $hpf->setIncludeOverTime(TRUE);
             $hpf->setIncludePaidAbsenceTime(TRUE);
             $hpf->setForceOverTimePolicy(TRUE);
             $hpf->setMinimumTime(0);
             $hpf->setMaximumTime(0);
             $hpf->setAbsencePolicyID($this->absence_policy_id);
             //$hpf->setRoundIntervalPolicyID( $data['round_interval_policy_id'] );
             break;
     }
     if ($hpf->isValid()) {
         $insert_id = $hpf->Save();
         Debug::Text('Holiday Policy ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Holiday Policy!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
$hpf = new HolidayPolicyFactory();
$action = Misc::findSubmitButton();
$action = strtolower($action);
switch ($action) {
    case 'submit':
        //Debug::setVerbosity(11);
        Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
        $hpf->StartTransaction();
        $hpf->setId($data['id']);
        $hpf->setCompany($current_company->getId());
        $hpf->setName($data['name']);
        $hpf->setType($data['type_id']);
        $hpf->setDefaultScheduleStatus($data['default_schedule_status_id']);
        $hpf->setMinimumEmployedDays($data['minimum_employed_days']);
        $hpf->setMinimumWorkedPeriodDays($data['minimum_worked_period_days']);
        $hpf->setMinimumWorkedDays($data['minimum_worked_days']);
        $hpf->setWorkedScheduledDays($data['worked_scheduled_days']);
        $hpf->setMinimumWorkedAfterPeriodDays($data['minimum_worked_after_period_days']);
        $hpf->setMinimumWorkedAfterDays($data['minimum_worked_after_days']);
        $hpf->setWorkedAfterScheduledDays($data['worked_after_scheduled_days']);
        $hpf->setAverageTimeDays($data['average_time_days']);
        //$hpf->setIncludeOverTime( $data['include_over_time'] );
        if (isset($data['average_time_worked_days'])) {
            $hpf->setAverageTimeWorkedDays(TRUE);
        } else {
            $hpf->setAverageTimeWorkedDays(FALSE);
        }
        if (isset($data['include_over_time'])) {
            $hpf->setIncludeOverTime(TRUE);
        } else {
            $hpf->setIncludeOverTime(FALSE);