private function mapDrivingOrder(DrivingOrder $drivingOrder, $mission)
 {
     /*
      * map DrivingOrder infos to body array
      */
     $body = new DrivingConfigPrinterBodyDTO();
     $body->colA = $mission;
     $body->colB = $drivingOrder->getDrivingMission()->getDirection() > 0 ? 'R' : '';
     $timeService = $this->container->get('tixi_api.datetimeservice');
     $body->colC = $timeService->convertToLocalTimeString($drivingOrder->getPickUpTime());
     $body->colD = $drivingOrder->getPassenger()->getHasMonthlyBilling() > 0 ? 'X' : '';
     $passenger = $drivingOrder->getPassenger();
     $home = $passenger->getAddress();
     $body->colE = $passenger->getTitle() . ' ' . $passenger->getFirstname() . ' ' . $passenger->getLastname();
     $body->colF = $this->getRideNodeAddress($drivingOrder->getRoute()->getStartAddress(), $home, $passenger->getTelephone());
     $body->colG = $this->getRideNodeAddress($drivingOrder->getRoute()->getTargetAddress(), $home, $passenger->getTelephone());
     $comment1 = $drivingOrder->getMemo();
     $comment2 = $passenger->getNotice();
     if (!empty($comment1) and !empty($comment1)) {
         $body->colH = $comment1 . '<br>' . $comment2;
     } else {
         $body->colH = $comment1 . $comment2;
     }
     $body->colI = $passenger->getIsInWheelChair() > 0 ? 'X' : '';
     /** @var ArrayCollection $handicaps */
     $handicaps = $passenger->getHandicaps();
     $body->colJ = $handicaps->count() > 0 ? 'X' : '';
     $body->colK = $passenger->getInsurancesAsString();
     /** @var Zone $zone */
     $zone = $drivingOrder->getZone();
     $longDistance = false;
     if ($zone instanceof Zone) {
         $body->colL = $drivingOrder->getZone()->getName();
         $longDistance = $zone->isUnclassified();
     } else {
         $body->colL = '?';
     }
     $body->colM = $drivingOrder->getCompanion();
     $body->colX = '';
     if ($longDistance) {
         /** @var DrivingOrder $returnOrder */
         $returnOrder = $drivingOrder->getCorrespondingReturnOrder();
         if ($returnOrder instanceof DrivingOrder) {
             $body->colX = $returnOrder->getPickUpDate()->format('d.m.Y') . ' ' . $returnOrder->getPickUpTime()->format('H:i');
         }
     }
     return $body->getArray();
 }
Exemplo n.º 2
0
 /**
  * @param DrivingOrder $drivingOrder
  * @return DrivingOrderEditDTO
  */
 public function drivingOrderToEditDto(DrivingOrder $drivingOrder)
 {
     $dto = new DrivingOrderEditDTO();
     $dto->id = $drivingOrder->getId();
     $dto->pickupDate = $this->dateTimeService->convertToLocalDateTime($drivingOrder->getPickUpDate())->format('d.m.Y');
     $dto->pickupTime = $this->dateTimeService->convertToLocalDateTime($drivingOrder->getPickUpTime())->format('H:i');
     $dto->lookaheadaddressFrom = $drivingOrder->getRoute()->getStartAddress()->toString();
     $dto->lookaheadaddressTo = $drivingOrder->getRoute()->getTargetAddress()->toString();
     $dto->zoneName = $drivingOrder->getZone()->getName();
     $dto->compagnion = $drivingOrder->getCompanion();
     $dto->memo = $drivingOrder->getMemo();
     $dto->additionalTime = $drivingOrder->getAdditionalTime();
     $dto->orderStatus = $drivingOrder->getStatus();
     /** @var RepeatedDrivingOrderPlan $repeatedDrivingOrderPlan */
     $repeatedDrivingOrderPlan = $drivingOrder->getRepeatedDrivingOrderPlan();
     if (isset($repeatedDrivingOrderPlan)) {
         $dto->parentId = $repeatedDrivingOrderPlan->getId();
     } else {
         $dto->parentId = null;
     }
     $dto->notice = null;
     return $dto;
 }