From 468d10c614ea448513cf0b4b2d0c78d2f2829cea Mon Sep 17 00:00:00 2001 From: pbarroca <pbarroca@afi-sa.fr> Date: Wed, 11 Jun 2014 10:50:42 +0200 Subject: [PATCH] fix #13906 : No longer apply first found item location to all record items --- cosmogramme/php/classes/classe_unimarc.php | 14 ++++++-------- .../tests/php/classes/NoticeIntegrationTest.php | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/cosmogramme/php/classes/classe_unimarc.php b/cosmogramme/php/classes/classe_unimarc.php index 8155103eed4..29bf390b19b 100644 --- a/cosmogramme/php/classes/classe_unimarc.php +++ b/cosmogramme/php/classes/classe_unimarc.php @@ -1,4 +1,4 @@ -<?PHP +<?php /** * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. * @@ -169,15 +169,13 @@ class notice_unimarc extends iso2709_record { if ($exemplaire["section"]) $notice["sections"][] = $exemplaire["section"]; + if($exemplaire["emplacement"]) + $notice["emplacements"][] = $exemplaire["emplacement"]; + if($exemplaire["genre"]) $notice["genres"][] = $exemplaire["genre"]; else $notice["exemplaires"][$i]["genre"] = $ret["genre"]; - - if($exemplaire["emplacement"]) - $notice["emplacements"][] = $exemplaire["emplacement"]; - else - $notice["exemplaires"][$i]["emplacement"] = $ret["emplacement"]; if (!$notice['cote'] and $exemplaire['cote']) $notice['cote'] = $exemplaire['cote']; @@ -1372,7 +1370,7 @@ class notice_unimarc extends iso2709_record { private function getIdCodeExemplaire($type, $champ, $sous_champ, $valeur) { - $valeur = trim(strtoupper($valeur)); + $valeur = trim(str_replace(' ', '', strtoupper($valeur))); $champ = $champ . '$' . $sous_champ; $id = $this->regles_sections_genres[$champ][$type]['='][$valeur]; if(!$id) $id = $this->regles_sections_genres['995$0'][$type]['='][$valeur]; @@ -1380,4 +1378,4 @@ class notice_unimarc extends iso2709_record { return $id; } } -?> +?> \ No newline at end of file diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index 60a5b384fbc..68e0cab626c 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -748,7 +748,6 @@ class NoticeIntegrationDimancheALaPiscineTest extends NoticeIntegrationTestCase ['id_emplacement' => 54, 'regles' => '995$u=Littératureadulte']]) - ->whenCalled('fetchAll') ->with('select * from codif_section', false) ->answers([ -- GitLab