diff --git a/VERSIONS_HOTLINE/90727 b/VERSIONS_HOTLINE/90727 new file mode 100644 index 0000000000000000000000000000000000000000..db598554d89a503c67781ff04584aeb705bdebb5 --- /dev/null +++ b/VERSIONS_HOTLINE/90727 @@ -0,0 +1 @@ + - ticket #90727 : SIGB Koha : Correction du rattachement automatique d'un abonné à une bibliothèque lors de son inscription par Bokeh \ No newline at end of file diff --git a/library/Class/User/ILSSubscription.php b/library/Class/User/ILSSubscription.php index a69b868328dbe0929ee8e3f9d4bcdbdd765d3914..5d98d5388f34599a7ce93519e1ae984c3a491081 100644 --- a/library/Class/User/ILSSubscription.php +++ b/library/Class/User/ILSSubscription.php @@ -73,10 +73,18 @@ class Class_User_ILSSubscription { $date = new DateTime($this->getTimeSource()->dateYmd()); $date->modify('+1 year'); + if ($this->_isLibrarySendData()) + $this->_user->setIdIntBib($this->_user->getIdSite()); + return $this->_user->setDateFin($date->format('Y-m-d')); } + protected function _isLibrarySendData() { + return $this->_user->hasBib() && $this->_user->getBib()->isSIGBSendData(); + } + + public function registerNotificationsOn($notifiable) { if(($user = Class_Users::getIdentity()) && $this->_user->getId() == $user->getId()) return $this->registerNotificationsForMeOn($notifiable); diff --git a/tests/library/Class/UsersNonValidTest.php b/tests/library/Class/UsersNonValidTest.php index 812e6bc70241dbc40387fbc699b5486ba161e7c2..8c1f808ffad7dc5120bebec10456d08d7d77cc53 100644 --- a/tests/library/Class/UsersNonValidTest.php +++ b/tests/library/Class/UsersNonValidTest.php @@ -74,28 +74,26 @@ class Class_UsersNonValidActivateTest extends ModelTestCase { } } + + class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase { - protected - $_storm_default_to_volatile = true, - $_new_user; + protected $_new_user; public function setUp() { parent::setUp(); - - $int_bib =$this->fixture('Class_IntBib', - ['id' => 3 - ]) - ->beKoha() - ->beCommKoha() - ->setCommParams(['use_card_number'=>'12414C12']); + $int_bib = $this->fixture('Class_IntBib', ['id' => 3]) + ->beKoha() + ->beCommKoha() + ->setCommParams(['url_serveur' => 'https://mon.koha.la', + 'use_card_number'=>'12414C12']); $int_bib->assertSave(); - $bib= $this->fixture('Class_Bib', + $bib = $this->fixture('Class_Bib', ['id' => 3, 'libelle' => 'Tatoine', - 'int_bib' => $int_bib - ]); + 'int_bib' => $int_bib, + 'visibilite' => Class_Bib::V_DATA]); Class_User_ILSSubscription::setTimeSource(new TimeSourceForTest('2019-02-12 11:25:31')); @@ -123,7 +121,7 @@ class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase /** @test */ public function userRoleShouldBeAbonneSIGB() { - $this->assertTrue( $this->_new_user->isAbonne()); + $this->assertTrue($this->_new_user->isAbonne()); } @@ -131,4 +129,11 @@ class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase public function userDateFinShouldBesetToNextyear() { $this->assertEquals('2020-02-12', $this->_new_user->getDateFin()); } + + + /** @test */ + public function userShouldHaveTatoineSigbComm() { + $this->assertNotNull($comm = $this->_new_user->getSIGBComm()); + $this->assertEquals('https://mon.koha.la', $comm->getServerRoot()); + } }