diff --git a/VERSIONS_STABLE/hotline_#20607_orphee_integration b/VERSIONS_STABLE/hotline_#20607_orphee_integration new file mode 100644 index 0000000000000000000000000000000000000000..ff2fa96253f13c73c3152fe0d8611faf067da8ef --- /dev/null +++ b/VERSIONS_STABLE/hotline_#20607_orphee_integration @@ -0,0 +1 @@ + - ticket: #20607: Correction d'un bug dans cosmogramme qui stoppait l'intégration des nouveaux fichiers. \ No newline at end of file diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 125abab62de4b497f83a6c0d9804f11e7bea74ff..16d52290440b283878afbc9c3afc7867b1d47dc7 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -569,8 +569,9 @@ class notice_integration { } - private function updateNotice($id_notice, $qualite) { - $existing_notice = Class_Notice::find($id_notice); + public function updateNotice($id_notice, $qualite) { + if(!$existing_notice = Class_Notice::find($id_notice)) + return $id_notice; $this->notice["qualite"] = $existing_notice->getQualite(); $this->notice["facette"] = $existing_notice->getFacettes(); @@ -684,7 +685,7 @@ class notice_integration { } - private function ecrireExemplaires($id_notice) { + public function ecrireExemplaires($id_notice) { $code_barres = []; $exemplaires = []; foreach ($this->notice['exemplaires'] as $ex) { @@ -721,9 +722,8 @@ class notice_integration { foreach($exemplaires as $exemplaire) $exemplaire->save(); - Class_Notice::find($id_notice) - ->setDateMaj(dateDuJour(2)) - ->save(); + if($record = Class_Notice::find($id_notice)) + $record->setDateMaj(dateDuJour(2))->save(); Class_Exemplaire::clearCache(); Class_Notice::clearCache(); diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 8300e9a97ded194a3a4aba7173c2190b8a427e59..dce95e10e9601cf629e4911a5b51f6053d80d814 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -2309,4 +2309,30 @@ class NoticeIntegrationPommeDeReinetteTest extends NoticeIntegrationTestCase { } -?> \ No newline at end of file + + +class NoticeIntegrationNoNoticeTest extends NoticeIntegrationTestCase { + public function tearDown() { + Storm_Model_Loader::defaultToDb(); + parent::tearDown(); + } + + + public function setUp() { + parent::setUp(); + Storm_Model_Loader::defaultToVolatile(); + $this->_notice_integration = new notice_integration(); + } + + + /** @test */ + public function updateNoticeShouldNotCrash() { + $this->assertEquals(1, $this->_notice_integration->updateNotice(1,5)); + } + + + /** @test */ + public function writeItemShouldNotCrash() { + $this->assertNull($this->_notice_integration->ecrireExemplaires(1)); + } +} \ No newline at end of file diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index 819fa1b8312d0c7dc1f7fb42832abdafd270f377..775b33a871bda7f0517650ca4cbdc735da9adda8 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -94,6 +94,45 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { } + public static function forOrphee() { + return self:: + newInstance(['libelle' => 'Unimarc Orphée', + 'accents' => self::ENCODING_ISO2709, + 'rejet_periodiques' => '0', + 'id_article_periodique' => self::SERIAL_FORMAT_ORPHEE, + 'type_fichier' => self::FT_RECORDS, + 'format' => self::FORMAT_UNIMARC, + 'attributs' => + [['type_doc' => + [[ 'code' => '0', 'label' => '', 'zone_995' => '' ], + [ 'code' => '1', 'label' => 'am;na', 'zone_995' => 'au;uu;iu;LIV;MS' ], + [ 'code' => '2', 'label' => 'as', 'zone_995' => 'PER'], + [ 'code' => '3', 'label' => 'i;j', 'zone_995' => 'jz;CD;LIVCD;LIVK7;K7'], + [ 'code' => '4', 'label' => 'g', 'zone_995' => 'gz;DIAPO;DVD;VHS;VHD;VD'], + [ 'code' => '5', 'label' => 'l;m', 'zone_995' => 'lu;CDR'], + [ 'code' => '6', 'label' => '', 'zone_995' => 'DOS' ], + [ 'code' => '7', 'label' => '', 'zone_995' => '' ], + [ 'code' => '8', 'label' => '', 'zone_995' => 'WEB;MF'] + ], + 'champ_code_barres' => 'a', + 'champ_cote' => 'f', + 'champ_type_doc' => 'c', + 'champ_genre' => '', + 'champ_section' => 'w', + 'champ_emplacement' => 'x', + 'champ_annexe' => 'g' + ], + ['zone' => '995', + 'champ' => '5', + 'format' => self::NOVELTY_DATE_FORMAT_VALUES, + 'jours' => '', + 'valeurs' => '1'] + ] + ] + ); + } + + public static function forALOES() { $type_doc = [['code' => '0', 'label' => '', 'zone_995' => ''], ['code' => '1', 'label' => 'am;na', 'zone_995' => 'LIV;MS;az'],