public function testIsWeekend()
 {
     $this->assertTrue(Weekends::isWeekend("2008-07-27"));
     $this->assertFalse(Weekends::isWeekend("2008-07-26"));
     $this->assertFalse(Weekends::isWeekend("2008-07-25"));
 }
Exemplo n.º 2
0
                    if (!empty($holiday) && is_a($holiday, 'Holidays')) {
                        echo $holiday->getDescription();
                    } else {
                        echo $lang_Leave_Closed;
                    }
                    ?>
  				<input type="hidden" name="cmbStatus[]" value="<?php 
                    echo $record->getLeaveStatus();
                    ?>
" />
  			<?php 
                }
                ?>
    	<?php 
            } else {
                if (Weekends::isWeekend($record->getLeaveDate())) {
                    echo $lang_Leave_Closed;
                } else {
                    echo $statusArr[$record->getLeaveStatus()];
                }
                ?>
    			<input type="hidden" name="cmbStatus[]" value="<?php 
                echo $record->getLeaveStatus();
                ?>
" />
    			<input type="hidden" name="id[]" value="<?php 
                echo $record->getLeaveId();
                ?>
" />
    	<?php 
            }
Exemplo n.º 3
0
 /**
  * Adds Leave
  *
  * @access protected
  */
 protected function _addLeave()
 {
     $this->leaveId = UniqueIDGenerator::getInstance()->getNextID('hs_hr_leave', 'leave_id');
     $this->_getLeaveTypeName();
     $this->setDateApplied(date('Y-m-d'));
     $this->_adjustLeaveLength();
     $insertFields[0] = '`leave_id`';
     $insertFields[1] = '`leave_date`';
     $insertFields[2] = '`leave_length_hours`';
     $insertFields[3] = '`leave_length_days`';
     $insertFields[4] = '`leave_status`';
     $insertFields[5] = '`leave_comments`';
     $insertFields[6] = '`leave_request_id`';
     $insertFields[7] = '`leave_type_id`';
     $insertFields[8] = '`employee_id`';
     $arrRecordsList[0] = $this->getLeaveId();
     $arrRecordsList[1] = "'" . $this->getLeaveDate() . "'";
     $arrRecordsList[2] = "'" . $this->getLeaveLengthHours() . "'";
     $arrRecordsList[3] = "'" . $this->getLeaveLengthDays() . "'";
     $hours = $this->getLeaveLengthHours();
     $days = $this->getLeaveLengthDays();
     if ($hours == 0 && $days == 0) {
         $arrRecordsList[4] = self::LEAVE_STATUS_LEAVE_CANCELLED;
     } else {
         $arrRecordsList[4] = $this->statusLeavePendingApproval;
     }
     $holidays = new Holidays();
     $weekends = new Weekends();
     if ($weekends->isWeekend($this->getLeaveDate())) {
         $arrRecordsList[4] = self::LEAVE_STATUS_LEAVE_WEEKEND;
     } elseif ($holidays->isHoliday($this->getLeaveDate())) {
         $arrRecordsList[4] = self::LEAVE_STATUS_LEAVE_HOLIDAY;
     }
     $arrRecordsList[5] = "'" . $this->getLeaveComments() . "'";
     $arrRecordsList[6] = "'" . $this->getLeaveRequestId() . "'";
     $arrRecordsList[7] = "'" . $this->getLeaveTypeId() . "'";
     $arrRecordsList[8] = "'" . $this->getEmployeeId() . "'";
     if ($this->getStartTime() != null && $this->getEndTime() != null) {
         $insertFields[9] = '`start_time`';
         $arrRecordsList[9] = "'" . $this->getStartTime() . "'";
         $insertFields[10] = '`end_time`';
         $arrRecordsList[10] = "'" . $this->getEndTime() . "'";
     }
     $arrTable = "`hs_hr_leave`";
     $sqlBuilder = new SQLQBuilder();
     $query = $sqlBuilder->simpleInsert($arrTable, $arrRecordsList, $insertFields);
     $dbConnection = new DMLFunctions();
     $result = $dbConnection->executeQuery($query);
     return $result;
 }