Esempio n. 1
0
 public function PageLoad()
 {
     try {
         $reservation = $this->_presenter->BuildReservation();
         $this->_presenter->HandleReservation($reservation);
         if ($this->_reservationSavedSuccessfully) {
             $this->Display('Ajax/reservation/update_successful.tpl');
         } else {
             $this->Display('Ajax/reservation/save_failed.tpl');
         }
     } catch (Exception $ex) {
         Log::Error('ReservationUpdatePage - Critical error saving reservation: %s', $ex);
         $this->Display('Ajax/reservation/reservation_error.tpl');
     }
 }
Esempio n. 2
0
 public function PageLoad()
 {
     try {
         $reservation = $this->_presenter->BuildReservation();
         $this->_presenter->HandleReservation($reservation);
         if ($this->_reservationSavedSuccessfully) {
             $this->Set('Resources', $reservation->AllResources());
             $this->Set('Instances', $reservation->Instances());
             $this->Set('Timezone', ServiceLocator::GetServer()->GetUserSession()->Timezone);
             $this->Display('Ajax/reservation/update_successful.tpl');
         } else {
             $this->Display('Ajax/reservation/save_failed.tpl');
         }
     } catch (Exception $ex) {
         Log::Error('ReservationUpdatePage - Critical error saving reservation: %s', $ex);
         $this->Display('Ajax/reservation/reservation_error.tpl');
     }
 }
 public function testUsesFirstAdditionalResourceIfPrimaryIsRemoved()
 {
     $referenceNumber = $this->page->existingReferenceNumber;
     $builder = new ExistingReservationSeriesBuilder();
     $builder->WithPrimaryResource(new FakeBookableResource(100));
     $expectedSeries = $builder->Build();
     $additionalId = 5;
     $this->page->resourceId = null;
     $this->page->resourceIds = array($additionalId);
     $resource = new FakeBookableResource($additionalId);
     $this->persistenceService->expects($this->once())->method('LoadByReferenceNumber')->with($this->equalTo($referenceNumber))->will($this->returnValue($expectedSeries));
     $this->resourceRepository->expects($this->once())->method('LoadById')->with($this->equalTo($additionalId))->will($this->returnValue($resource));
     $existingSeries = $this->presenter->BuildReservation();
     $this->assertEquals($resource, $existingSeries->Resource());
 }