예제 #1
0
 //Get earliest pre_mature exception in a NON-closed pay period.
 $elf = new ExceptionListFactory();
 $elf->getByCompanyIDAndTypeAndPayPeriodStatus($c_obj->getId(), 5, array(10, 12, 15, 30), 1, NULL, NULL, array('b.date_stamp' => 'asc'));
 //Limit 1
 if ($elf->getRecordCount() > 0) {
     foreach ($elf as $e_obj) {
         $tmp_start_date = $e_obj->getUserDateObject()->getDateStamp();
         if ($tmp_start_date < $start_date) {
             $start_date = $tmp_start_date;
             Debug::text('  Pre-Mature exceptions occur before start date, reducing to: ' . TTDate::getDate('DATE+TIME', $start_date) . '(' . $e_obj->getId() . ')', __FILE__, __LINE__, __METHOD__, 5);
         }
     }
 }
 unset($elf, $e_obj, $tmp_start_date);
 $udlf = new UserDateListFactory();
 $udlf->getByCompanyIdAndStartDateAndEndDateAndPayPeriodStatus($c_obj->getId(), $start_date, $end_date, array(10, 12, 15, 30));
 Debug::text(' Start Date: ' . TTDate::getDate('DATE+TIME', $start_date) . ' End Date: ' . TTDate::getDate('DATE+TIME', $end_date) . ' User Date Rows: ' . $udlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 5);
 if ($udlf->getRecordCount() > 0) {
     $i = 0;
     foreach ($udlf as $ud_obj) {
         $user_obj_prefs = $ud_obj->getUserObject()->getUserPreferenceObject();
         if (is_object($user_obj_prefs)) {
             $user_obj_prefs->setTimeZonePreferences();
         } else {
             //Use system timezone.
             TTDate::setTimeZone();
         }
         //Recalculate system time, and exceptions for the day.
         //Because if its a Monday, it will also recalculate the rest of the days in the week.
         //Shouldn't be a big deal though.
         //This isn't needed, since we now do it in AddRecurringScheduleShift, so dock time is