Exemple #1
0
 /**
  * @param \DDD\Domain\Booking\BookingTicket $booking
  * @param array $data
  * @param array $permission
  */
 private function setGinosiComment($booking, $data, $permission)
 {
     /**
      * @var Logger $logger
      */
     $logger = $this->getServiceLocator()->get('ActionLogger');
     if ($permission['credit']) {
         if ($booking->getFunds_confirmed() != $data['finance_valid_card']) {
             $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_BOOKING_CC_STATUS, (int) $data['finance_valid_card'] + 1);
         }
     }
     if ($booking->isKiViewed() != (int) $data['finance_key_instructions']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_KI_VIEWED, (int) $data['finance_key_instructions']);
     }
     if ($booking->getApartelId() != (int) $data['apartel_id']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_APARTEL_ID, (int) $data['apartel_id']);
     }
     if ($booking->getPartnerSettled() != (int) $data['finance_paid_affiliate']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_PARTNER_SETTLED, (int) $data['finance_paid_affiliate']);
     }
     if ($booking->getNo_collection() != (int) $data['finance_no_collection']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_NO_COLLECTION, (int) $data['finance_no_collection']);
     }
     if ($booking->getCccaVerified() != (int) $data['ccca_verified']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_CCCA_VERIFIED, (int) $data['ccca_verified']);
     }
     if ($permission['fin']) {
         if ($booking->getPayment_settled() != (int) $data['finance_reservation_settled']) {
             $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_RESERVATION_SETTLED, (int) $data['finance_reservation_settled']);
         }
     }
     if (isset($data['booking_statuses']) && $booking->getStatus() != $data['booking_statuses']) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_BOOKING_STATUSES, Objects::getBookingStatusMapping()[$data['booking_statuses']]);
     }
     if (isset($data['finance_booked_state']) && $booking->getArrivalStatus() != $data['finance_booked_state'] && ($booking->getArrivalStatus() != self::INSPECTED_STATE || $booking->getArrivalStatus() == self::INSPECTED_STATE && $data['finance_booked_state'] != self::CHECKOUT_STATE) && $data['finance_booked_state_changed'] == self::BOOKED_STATE_CHANGED) {
         $logger->save(Logger::MODULE_BOOKING, $booking->getId(), Logger::ACTION_CHECK_IN, $data['finance_booked_state']);
     }
     $msg = $data['booking_ginosi_comment'];
     if ($data['booking_ginosi_comment_team']) {
         $teamDao = $this->getServiceLocator()->get('dao_team_team');
         $teamName = $teamDao->getTeamNameById($data['booking_ginosi_comment_team']);
         $msg .= '</br><b>' . $teamName . ' Notified</b>';
     }
     if ($data['booking_ginosi_comment'] != '') {
         $logId = $logger->save(Logger::MODULE_BOOKING, $booking->getId(), empty($data['booking_ginosi_comment_frontier']) ? Logger::ACTION_COMMENT : Logger::ACTION_HOUSEKEEPING_COMMENT, $msg);
         if ($data['booking_ginosi_comment_team']) {
             $logsTeamDao = $this->getServiceLocator()->get('dao_action_logs_logs_team');
             $logsTeamDao->save(['action_log_id' => $logId, 'team_id' => $data['booking_ginosi_comment_team']]);
         }
     }
 }