Commit db38132f authored by Patrick Barroca's avatar Patrick Barroca 😠

Merge branch 'hotline#90727_bdp64_pb_module_resa_multi_sigb' into 'hotline'

hotline #90727 : fix link to ILS when user is promoted to patron

See merge request afi/opacce!3116
parents eddb72ad 9f8373fc
- 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
...@@ -73,10 +73,18 @@ class Class_User_ILSSubscription { ...@@ -73,10 +73,18 @@ class Class_User_ILSSubscription {
$date = new DateTime($this->getTimeSource()->dateYmd()); $date = new DateTime($this->getTimeSource()->dateYmd());
$date->modify('+1 year'); $date->modify('+1 year');
if ($this->_isLibrarySendData())
$this->_user->setIdIntBib($this->_user->getIdSite());
return $this->_user->setDateFin($date->format('Y-m-d')); return $this->_user->setDateFin($date->format('Y-m-d'));
} }
protected function _isLibrarySendData() {
return $this->_user->hasBib() && $this->_user->getBib()->isSIGBSendData();
}
public function registerNotificationsOn($notifiable) { public function registerNotificationsOn($notifiable) {
if(($user = Class_Users::getIdentity()) && $this->_user->getId() == $user->getId()) if(($user = Class_Users::getIdentity()) && $this->_user->getId() == $user->getId())
return $this->registerNotificationsForMeOn($notifiable); return $this->registerNotificationsForMeOn($notifiable);
......
...@@ -74,28 +74,26 @@ class Class_UsersNonValidActivateTest extends ModelTestCase { ...@@ -74,28 +74,26 @@ class Class_UsersNonValidActivateTest extends ModelTestCase {
} }
} }
class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase { class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase {
protected protected $_new_user;
$_storm_default_to_volatile = true,
$_new_user;
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$int_bib = $this->fixture('Class_IntBib', ['id' => 3])
$int_bib =$this->fixture('Class_IntBib',
['id' => 3
])
->beKoha() ->beKoha()
->beCommKoha() ->beCommKoha()
->setCommParams(['use_card_number'=>'12414C12']); ->setCommParams(['url_serveur' => 'https://mon.koha.la',
'use_card_number'=>'12414C12']);
$int_bib->assertSave(); $int_bib->assertSave();
$bib= $this->fixture('Class_Bib', $bib = $this->fixture('Class_Bib',
['id' => 3, ['id' => 3,
'libelle' => 'Tatoine', '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')); Class_User_ILSSubscription::setTimeSource(new TimeSourceForTest('2019-02-12 11:25:31'));
...@@ -123,7 +121,7 @@ class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase ...@@ -123,7 +121,7 @@ class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase
/** @test */ /** @test */
public function userRoleShouldBeAbonneSIGB() { public function userRoleShouldBeAbonneSIGB() {
$this->assertTrue( $this->_new_user->isAbonne()); $this->assertTrue($this->_new_user->isAbonne());
} }
...@@ -131,4 +129,11 @@ class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase ...@@ -131,4 +129,11 @@ class Class_UsersNonValidActivateWithConnectionToSIGBTest extends ModelTestCase
public function userDateFinShouldBesetToNextyear() { public function userDateFinShouldBesetToNextyear() {
$this->assertEquals('2020-02-12', $this->_new_user->getDateFin()); $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());
}
} }
Markdown is supported
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