コード例 #1
0
 function postSave()
 {
     if ($this->getEnableTimeSheetVerificationCheck()) {
         //Check to see if schedule is verified, if so unverify it on modified punch.
         //Make sure exceptions are calculated *after* this so TimeSheet Not Verified exceptions can be triggered again.
         if (is_object($this->getUserDateObject()) and is_object($this->getUserDateObject()->getPayPeriodObject()) and is_object($this->getUserDateObject()->getPayPeriodObject()->getPayPeriodScheduleObject()) and $this->getUserDateObject()->getPayPeriodObject()->getPayPeriodScheduleObject()->getTimeSheetVerifyType() != 10) {
             //Find out if timesheet is verified or not.
             $pptsvlf = TTnew('PayPeriodTimeSheetVerifyListFactory');
             $pptsvlf->getByPayPeriodIdAndUserId($this->getUserDateObject()->getPayPeriod(), $this->getUserDateObject()->getUser());
             if ($pptsvlf->getRecordCount() > 0) {
                 //Pay period is verified, delete all records and make log entry.
                 //These can be added during the maintenance jobs, so the audit records are recorded as user_id=0, check those first.
                 Debug::text('Pay Period is verified, deleting verification records: ' . $pptsvlf->getRecordCount() . ' User ID: ' . $this->getUserDateObject()->getUser() . ' Pay Period ID: ' . $this->getUserDateObject()->getPayPeriod(), __FILE__, __LINE__, __METHOD__, 10);
                 foreach ($pptsvlf as $pptsv_obj) {
                     TTLog::addEntry($pptsv_obj->getId(), 500, TTi18n::getText('Schedule Modified After Verification') . ': ' . UserListFactory::getFullNameById($this->getUserDateObject()->getUser()) . ' ' . TTi18n::getText('Schedule') . ': ' . TTDate::getDate('DATE', $this->getStartTime()), NULL, $pptsvlf->getTable());
                     $pptsv_obj->setDeleted(TRUE);
                     if ($pptsv_obj->isValid()) {
                         $pptsv_obj->Save();
                     }
                 }
             }
         }
     }
     if ($this->getEnableReCalculateDay() == TRUE) {
         //Calculate total time. Mainly for docked.
         //Calculate entire week as Over Schedule (Weekly) OT policy needs to be reapplied if the schedule changes.
         if (is_object($this->getUserDateObject()) and $this->getUserDateObject()->getUser() > 0) {
             //When shifts are assigned to different days, we need to calculate both days the schedule touches, as the shift could be assigned to either of them.
             UserDateTotalFactory::smartReCalculate($this->getUserDateObject()->getUser(), array($this->getUserDateID(), $this->getOldUserDateID(), UserDateFactory::findOrInsertUserDate($this->getUserDateObject()->getUser(), $this->getStartTime()), UserDateFactory::findOrInsertUserDate($this->getUserDateObject()->getUser(), $this->getEndTime())), TRUE, FALSE);
         }
     }
     return TRUE;
 }
コード例 #2
0
 function addLog($log_action)
 {
     //Don't do detail logging for this, as it will store entire figerprints in the log table.
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('Employee Identification - Employee') . ': ' . UserListFactory::getFullNameById($this->getUser()) . ' ' . TTi18n::getText('Type') . ': ' . Option::getByKey($this->getType(), $this->getOptions('type')), NULL, $this->getTable());
 }
コード例 #3
0
ファイル: EditPunch.php プロジェクト: J-P-Hanafin/TimeTrex-1
         if ($plf->getRecordCount() > 0) {
             $p_obj = $plf->getCurrent();
         } else {
             $punch_data = NULL;
         }
         //Get Station data.
         $station_data = FALSE;
         $slf = new StationListFactory();
         if ($p_obj->getStation() != FALSE) {
             $slf->getById($p_obj->getStation());
             if ($slf->getRecordCount() > 0) {
                 $s_obj = $slf->getCurrent();
                 $station_data = array('id' => $s_obj->getId(), 'type_id' => $s_obj->getType(), 'type' => Option::getByKey($s_obj->getType(), $s_obj->getOptions('type')), 'station_id' => $s_obj->getStation(), 'source' => $s_obj->getSource(), 'description' => Misc::TruncateString($s_obj->getDescription(), 20));
             }
         }
         $pc_data = array('id' => $pc_obj->getId(), 'user_date_id' => $pc_obj->getUserDateId(), 'user_id' => $pc_obj->getUserDateObject()->getUser(), 'user_full_name' => $pc_obj->getUserDateObject()->getUserObject()->getFullName(), 'pay_period_id' => $pc_obj->getUserDateObject()->getPayPeriod(), 'branch_id' => $pc_obj->getBranch(), 'department_id' => $pc_obj->getDepartment(), 'job_id' => $pc_obj->getJob(), 'job_item_id' => $pc_obj->getJobItem(), 'quantity' => (double) $pc_obj->getQuantity(), 'bad_quantity' => (double) $pc_obj->getBadQuantity(), 'note' => $pc_obj->getNote(), 'other_id1' => $pc_obj->getOtherID1(), 'other_id2' => $pc_obj->getOtherID2(), 'other_id3' => $pc_obj->getOtherID3(), 'other_id4' => $pc_obj->getOtherID4(), 'other_id5' => $pc_obj->getOtherID5(), 'punch_id' => $p_obj->getId(), 'status_id' => $p_obj->getStatus(), 'type_id' => $p_obj->getType(), 'station_id' => $p_obj->getStation(), 'station_data' => $station_data, 'time_stamp' => $p_obj->getTimeStamp(), 'date_stamp' => $p_obj->getTimeStamp(), 'original_time_stamp' => $p_obj->getOriginalTimeStamp(), 'actual_time_stamp' => $p_obj->getActualTimeStamp(), 'longitude' => $p_obj->getLongitude(), 'latitude' => $p_obj->getLatitude(), 'created_date' => $p_obj->getCreatedDate(), 'created_by' => $p_obj->getCreatedBy(), 'created_by_name' => (string) $ulf->getFullNameById($p_obj->getCreatedBy()), 'updated_date' => $p_obj->getUpdatedDate(), 'updated_by' => $p_obj->getUpdatedBy(), 'updated_by_name' => (string) $ulf->getFullNameById($p_obj->getUpdatedBy()), 'deleted_date' => $p_obj->getDeletedDate(), 'deleted_by' => $p_obj->getDeletedBy());
     }
 } elseif ($action != 'submit') {
     Debug::Text(' ID was NOT passed: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
     //UserID has to be set at minimum
     if ($punch_control_id != '') {
         Debug::Text(' Punch Control ID was passed: ' . $punch_control_id, __FILE__, __LINE__, __METHOD__, 10);
         //Get previous punch, and default timestamp to that.
         $plf = new PunchListFactory();
         $plf->getPreviousPunchByPunchControlID($punch_control_id);
         if ($plf->getRecordCount() > 0) {
             $prev_punch_obj = $plf->getCurrent();
             $time_stamp = $prev_punch_obj->getTimeStamp() + 3600;
             $date_stamp = $prev_punch_obj->getTimeStamp();
             //Match date with previous punch as well, incase a new day hasnt been triggered yet.
         } else {
コード例 #4
0
 function preSave()
 {
     if ($this->getPunchControlID() === FALSE) {
         $this->setPunchControlID(0);
     }
     if ($this->getOverTimePolicyID() === FALSE) {
         $this->setOverTimePolicyId(0);
     }
     if ($this->getAbsencePolicyID() === FALSE) {
         $this->setAbsencePolicyID(0);
     }
     if ($this->getPremiumPolicyID() === FALSE) {
         $this->setPremiumPolicyId(0);
     }
     if ($this->getMealPolicyID() === FALSE) {
         $this->setMealPolicyId(0);
     }
     if ($this->getBranch() === FALSE) {
         $this->setBranch(0);
     }
     if ($this->getDepartment() === FALSE) {
         $this->setDepartment(0);
     }
     if ($this->getJob() === FALSE) {
         $this->setJob(0);
     }
     if ($this->getJobItem() === FALSE) {
         $this->setJobItem(0);
     }
     if ($this->getQuantity() === FALSE) {
         $this->setQuantity(0);
     }
     if ($this->getBadQuantity() === FALSE) {
         $this->setBadQuantity(0);
     }
     if ($this->getEnableTimeSheetVerificationCheck()) {
         //Check to see if timesheet is verified, if so unverify it on modified punch.
         //Make sure exceptions are calculated *after* this so TimeSheet Not Verified exceptions can be triggered again.
         if (is_object($this->getUserDateObject()) and is_object($this->getUserDateObject()->getPayPeriodObject()) and is_object($this->getUserDateObject()->getPayPeriodObject()->getPayPeriodScheduleObject()) and $this->getUserDateObject()->getPayPeriodObject()->getPayPeriodScheduleObject()->getTimeSheetVerifyType() != 10) {
             //Find out if timesheet is verified or not.
             $pptsvlf = TTnew('PayPeriodTimeSheetVerifyListFactory');
             $pptsvlf->getByPayPeriodIdAndUserId($this->getUserDateObject()->getPayPeriod(), $this->getUserDateObject()->getUser());
             if ($pptsvlf->getRecordCount() > 0) {
                 //Pay period is verified, delete all records and make log entry.
                 //These can be added during the maintenance jobs, so the audit records are recorded as user_id=0, check those first.
                 Debug::text('Pay Period is verified, deleting verification records: ' . $pptsvlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
                 foreach ($pptsvlf as $pptsv_obj) {
                     if (is_object($this->getAbsencePolicyObject())) {
                         TTLog::addEntry($pptsv_obj->getId(), 500, TTi18n::getText('TimeSheet Modified After Verification') . ': ' . UserListFactory::getFullNameById($this->getUserDateObject()->getUser()) . ' ' . TTi18n::getText('Absence') . ': ' . $this->getAbsencePolicyObject()->getName() . ' - ' . TTDate::getDate('DATE', $this->getUserDateObject()->getDateStamp()), NULL, $pptsvlf->getTable());
                     }
                     $pptsv_obj->setDeleted(TRUE);
                     if ($pptsv_obj->isValid()) {
                         $pptsv_obj->Save();
                     }
                 }
             }
         }
     }
     return TRUE;
 }
コード例 #5
0
 function addLog($log_action)
 {
     //Should the object_id be the pay period ID instead, that way its easier to find the audit logs?
     if (is_object($this->getPayPeriodObject())) {
         return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('TimeSheet Verify') . ' - ' . TTi18n::getText('Employee') . ': ' . UserListFactory::getFullNameById($this->getUser()) . ' ' . TTi18n::getText('Pay Period') . ': ' . TTDate::getDate('DATE', $this->getPayPeriodObject()->getStartDate()) . ' -> ' . TTDate::getDate('DATE', $this->getPayPeriodObject()->getEndDate()), NULL, $this->getTable());
     }
 }
コード例 #6
0
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('Pay Stub Amendment - Employee') . ': ' . UserListFactory::getFullNameById($this->getUser()) . ' ' . TTi18n::getText('Amount') . ': ' . $this->getAmount(), NULL, $this->getTable(), $this);
 }
コード例 #7
0
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('Punch Control - Employee') . ': ' . UserListFactory::getFullNameById($this->getUser()), NULL, $this->getTable(), $this);
 }
コード例 #8
0
 function addLog($log_action)
 {
     return TTLog::addEntry($this->getId(), $log_action, TTi18n::getText('Punch - Employee') . ': ' . UserListFactory::getFullNameById($this->getUser()) . ' ' . TTi18n::getText('Timestamp') . ': ' . TTDate::getDate('DATE+TIME', $this->getTimeStamp()), NULL, $this->getTable(), $this);
 }