Esempio n. 1
0
 public function transferMoney()
 {
     $bookingModel = $this->getOrderBooking();
     /** @var FlightBooker[] $flightBookers  */
     $flightBookers = FlightBooker::model()->findAllByAttributes(array('orderBookingId' => $bookingModel->primaryKey));
     foreach ($flightBookers as $flightBooker) {
         $status = $flightBooker->status;
         if (strpos($status, '/') !== false) {
             $status = substr($status, strpos($status, '/') + 1);
         }
         $flightBookerComponent = new FlightBookerComponent();
         $flightBookerComponent->setFlightBookerFromId($flightBooker->id);
         $flightBookerComponent->status('transferMoney');
         //$flightBooker->timeout;
     }
     $hotelBookers = HotelBooker::model()->findAllByAttributes(array('orderBookingId' => $bookingModel->primaryKey));
     foreach ($hotelBookers as $hotelBooker) {
         $status = $hotelBooker->status;
         if (strpos($status, '/') !== false) {
             $status = substr($status, strpos($status, '/') + 1);
         }
         $hotelBookerComponent = new HotelBookerComponent();
         $hotelBookerComponent->setHotelBookerFromId($hotelBooker->id);
         $hotelBookerComponent->status('transferMoney');
     }
 }
 public function actionInjectTicketNumbers($bookingId)
 {
     $booking = new FlightBookerComponent();
     $booking->setFlightBookerFromId($bookingId);
     foreach ($_POST['tickets'] as $passId => $ticket) {
         $pass = FlightBookingPassport::model()->findByPk($passId);
         $pass->ticketNumber = $ticket;
         $pass->save();
     }
     $flightVoyage = $booking->getCurrent()->flightVoyage;
     foreach ($_POST['terminal'] as $fvkey => $value) {
         foreach ($value as $fkey => $terminalCode) {
             if ($terminalCode) {
                 $flightVoyage->flights[$fvkey]->flightParts[$fkey]->departureTerminalCode = $terminalCode;
             }
         }
     }
     //! force serialization, save will be called on later status change
     $booking->getCurrent()->flightVoyage = $flightVoyage;
     //! Fixme leave 1-2 steps max
     $booking->status('manualProcessing');
     $booking->status('manualTicketing');
     $booking->status('manualSuccess');
     $this->redirect(array('view', 'id' => $booking->getCurrent()->orderBookingId));
 }