示例#1
0
 private function validateForm($bookValues, &$bookErrors, \Application\BookingChange &$bookingData)
 {
     if (\Utility\Validator::IsFieldNotEmpty($bookValues, 'start')) {
         $bookingData->setStart($bookValues['start']);
     } else {
         $bookErrors['time'] = 'start time should be filled.';
         return;
     }
     if (\Utility\Validator::IsFieldNotEmpty($bookValues, 'end')) {
         $bookingData->setEnd($bookValues['end']);
     } else {
         $bookErrors['time'] = 'end time should be filled.';
         return;
     }
     if (!$bookingData->isTimeValid()) {
         $bookErrors['time'] = $bookingData->getErrorMessage();
     }
     if (\Utility\Validator::IsFieldNotEmpty($bookValues, 'notes')) {
         $bookingData->setNotes($bookValues['notes']);
     } else {
         $bookErrors['notes'] = 'notes should be filled.';
     }
     $bookingData->setEmpId($bookValues['employee']);
     $bookingData->setApplyChain($bookValues['apply_chain_proxy'] == 1);
 }
示例#2
0
 public function applyChangeToMember($empId, \Application\BookingChange $bookingData)
 {
     $this->rewind();
     foreach ($this as $member) {
         if ($member->getId() == $empId) {
             $member->setNewTime($bookingData->getStart(), $bookingData->getEnd());
             $member->setNotes($bookingData->getNotes());
             $member->setEmpId($bookingData->getEmpId());
             break;
         }
     }
 }