diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 9ae4bd842840c8ebd01bfc2c0e185ed9325d4ef7..c4110b698204de472eaa04f4c9997090b8ee2018 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -939,10 +939,10 @@ class notice_integration { 'Updated' => dateDuJour(0), 'Quality' => $this->qualite_bib]); - if (!$serial = Class_Notice_SerialArticles::updateOrInsert($instance)) + if (null === ($serial = Class_Notice_SerialArticles::updateOrInsert($instance))) return; - $this->statut = $serial->isNew() + $this->statut = $serial ? static::RECORD_INSERT : static::RECORD_RENEW; } diff --git a/library/Class/Notice/SerialArticles.php b/library/Class/Notice/SerialArticles.php index 2b6823ab1a5a2d64252ebc31533a7a389264445f..7b668bfe1816674431f1b048489627932208db8c 100644 --- a/library/Class/Notice/SerialArticles.php +++ b/library/Class/Notice/SerialArticles.php @@ -37,8 +37,9 @@ class NoticeSerialArticlesLoader extends Storm_Model_Loader { 'qualite' => $instance->getQuality()]); $serial->updateAttributes($update_columns); + $is_new = $serial->isNew(); $serial->save(); - return $serial; + return $is_new; } diff --git a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTest.php b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTest.php index 21215f0a43d249dd9278e8399a1b5fa7efe0e23d..2808f39cb81938108f54d2e314863f6688f92773 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhaseNoticeTest.php @@ -184,6 +184,10 @@ class PhaseNoticeImportFullTest extends PhaseNoticeImportTestCase { $this->assertEquals(110, $this->_phase->getCount(Class_Cosmogramme_Integration_Phase::RECORD_INSERT)); } + /** @test */ + public function phaseCounterShouldNotContainsRecordsRenew() { + $this->assertEquals(0, $this->_phase->getCount(Class_Cosmogramme_Integration_Phase::RECORD_RENEW)); + } /** @test */ public function phaseCounterShouldContain17RecordsRejected() {