Skip to content
Snippets Groups Projects
Commit c8dff8e6 authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #111127 : drive : go to date choice if only one possible library

parent 6e4cc994
Branches
Tags
2 merge requests!3552Dev#111127 suivi webinaire drive,!3551Dev#111127 suivi webinaire drive
Pipeline #10375 passed with stage
in 46 minutes and 51 seconds
......@@ -2,4 +2,5 @@
- administration : ajout des colonnes Section et Emplacement dans l'export des documents
- administration : possibilité de visualiser plusieurs journées de rendez-vous
- confirmation de rendez-vous : utilisation du mail renseigné dans la fiche bibliothèque en priorité
- popup de connexion : n'affiche le bouton "planifier le retrait de mes documents" seulement si un document en attente de retrait dans une bibliothèque avec drive activé
\ No newline at end of file
- popup de connexion : n'affiche le bouton "planifier le retrait de mes documents" seulement si un document en attente de retrait dans une bibliothèque avec drive activé
- prise de rendez-vous : s'il n'y a qu'un site de retrait possible l'abonné est dirigé directement sur le choix d'une date pour ce site
\ No newline at end of file
......@@ -42,6 +42,12 @@ class DriveCheckoutController extends ZendAfi_Controller_Action {
return;
}
if ($library = $plan->onlyPossibleLibrary()) {
$this->getHelper('ViewRenderer')->setNoRender();
$this->_redirect($this->view->url($plan->libraryUrlFor($library)));
return;
}
if ($this->_request->isPost()
&& ($checkout = $plan->persist())) {
$this->getHelper('ViewRenderer')->setNoRender();
......
......@@ -79,6 +79,16 @@ class Class_DriveCheckout_Plan {
}
public function onlyPossibleLibrary() {
return (!$this->selectedLibrary()
&& 1 == $this->_getLibraries()->count()
&& ($library = $this->_getLibraries()->first())
&& !$this->findFutureFor($library))
? $library
: null;
}
public function injectIntoOpenings($value, $closure) {
return $this->_getOpenings()->injectInto($value, $closure);
}
......
......@@ -876,4 +876,42 @@ class DriveCheckOutBookingPlanWithoutHoldsTest extends DriveCheckOutBookingTestC
public function pageShouldContainsNoHoldMessage() {
$this->assertXPathContentContains('//div//p', 'Aucun document à retirer pour l\'instant');
}
}
class DriveCheckOutBookingPlanWithOnlyOnePossibleLibrary
extends DriveCheckOutBookingTestCase {
public function setUp() {
parent::setUp();
$fiche = (new Class_WebService_SIGB_Emprunteur('10', 'Marcus'))
->reservationsAddAll([$this->_holdIn(1)]);
$this->_marcus
->setFicheSigb(['type_comm' => Class_IntBib::COM_NANOOK,
'fiche' => $fiche]);
}
/** @test */
public function withoutFuturCheckoutshouldRedirectToDateChoiceOfFirstLibrary() {
$this->dispatch('/opac/drive-checkout/plan');
$this->assertRedirectTo('/drive-checkout/plan/id_bib/1');
}
/** @test */
public function withFutureCheckoutShouldNotRedirect() {
$this->fixture('Class_DriveCheckout',
['id' => 2,
'library_id' => 1,
'user_id' => $this->_marcus->getId(),
'start_at' => '2020-05-12 09:00:00']);
$this->dispatch('/opac/drive-checkout/plan');
$this->assertNotRedirect();
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment