Commit 9f588f6c authored by Patrick Barroca's avatar Patrick Barroca 🐧

Merge branch 'hotline#102336_horaires_formation' into 'hotline'

hotline #102336 : fix bug on training hour

See merge request !3434
parents 975f7adc 5d88bcbb
Pipeline #9768 passed with stage
in 47 minutes and 11 seconds
- ticket #102336 : horaires formation : correction sur la suppression de l'horaire de formation lors d'une inscription
\ No newline at end of file
......@@ -429,10 +429,11 @@ class Class_SessionActivity_Article
protected function _synchronize($model, $dependent, $force_content=false) {
$dependent
->setTitre($model->getLibelleActivity())
->setEventsDebut($model->getDateDebut())
->setEventsFin($model->hasDateFin()
? $model->getDateFin()
: $model->getDateDebut())
->setEventsDebut($this->_replaceDateInto($dependent->getEventsDebut(), $model->getDateDebut()))
->setEventsFin($this->_replaceDateInto($dependent->getEventsFin(),
$model->hasDateFin()
? $model->getDateFin()
: $model->getDateDebut()))
->setLieu($model->getLieu());
if (!$dependent->getContenu() || $force_content)
......@@ -443,6 +444,12 @@ class Class_SessionActivity_Article
}
protected function _replaceDateInto($old_datetime, $new_date) {
return $new_date
. (10 < strlen($old_datetime) ? substr($old_datetime, 10) : '');
}
protected function _contentFrom($model) {
return
$model->getActivityDescription()
......
......@@ -1042,7 +1042,7 @@ class Admin_ActivityControllerPostSessionLearnJavaTest extends Admin_ActivityCon
/** @test */
public function linkedArticleEventsFinShouldBeUpdates() {
public function linkedArticleEventsFinShouldBeUpdated() {
$this->assertEquals('2012-05-29', $this->_article->getEventsFin());
}
......
......@@ -144,6 +144,16 @@ abstract class AbstractAbonneControllerActivitiesTestCase
'stagiaires' => [],
'date_limite_inscription' => '2015-01-20']);
$this->_session_java_fevrier->setArticle($this->fixture('Class_Article',
['id' => 10,
'titre' => 'Java est mort, vive python !',
'contenu' => 'Java has been'])
->setDateMaj('2020-04-11 08:00:00')
->setEventsDebut('2020-04-11 12:00:00')
->setEventsFin('2020-04-11 17:00:00'))
->save();
$this->_session_java_mars = $this->fixture('Class_SessionActivity',
['id' => 32,
'activity' => $this->_learn_java,
......@@ -639,6 +649,7 @@ class AbonneControllerActivitiesAmadouInscritSessionMarsJavaClosedTest extends A
public function notificationShouldContainsSessionClosed() {
$this->assertFlashMessengerContentContains('cette session est fermée');
}
}
......@@ -656,6 +667,9 @@ class AbonneControllerActivitiesAmadouInscritSessionFebruaryJavaOpenTest extends
$this->dispatch('/opac/abonne/inscrire-session/id/31', true);
Class_SessionActivity::clearCache();
Class_Article::clearCache();
$this->_mails = $this->_mail_transport->getSentMails();
}
......@@ -679,6 +693,14 @@ class AbonneControllerActivitiesAmadouInscritSessionFebruaryJavaOpenTest extends
}
/** @test */
public function sessionJavaMarsShouldChangeDatesButKeepTimes() {
$article = Class_SessionActivity::find(31)->getArticle();
$this->assertEquals('2015-02-10 12:00', $article->getEventsDebut());
$this->assertEquals('2015-02-20 17:00', $article->getEventsFin());
}
/** @test */
function aNewInscriptionShouldHaveBeenCreated() {
$this->assertCount(1, Class_SessionActivityInscription::findAllBy(['stagiaire_id' => 435,
......
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