diff --git a/library/Class/ModeleFusion.php b/library/Class/ModeleFusion.php index c0cbaaed54aebf4a19b1c1442322c78c70e7df43..74cab77c5907cdae41925dde453d4cf274273885 100644 --- a/library/Class/ModeleFusion.php +++ b/library/Class/ModeleFusion.php @@ -85,7 +85,14 @@ class Class_ModeleFusion extends Storm_Model_Abstract { public function getTagValueForInstance($match,$instance) { - return $instance->callGetterByAttributeName($match); + if (strpos($match,'.') === false) + return $instance->callGetterByAttributeName($match); + if (!$instance->callGetterByAttributeName($match)) + return ''; + $matches = substr($match,0,strpos($match,'.')); + return $this->getTagValueForInstance(substr($match,strpos($match,'.')+1),$instance->callGetterByAttributeName($matches)); + + } @@ -124,12 +131,8 @@ class Class_ModeleFusion extends Storm_Model_Abstract { return $this->getValue($value_or_model, $attributes); } - public function buildSection($items,$html) { - $contenu_decode=preg_replace_callback('/\{[^\}]+\}/', - create_function('$matches', - 'return html_entity_decode($matches[0],ENT_QUOTES);'), - $html); + public function decode($contenu_decode) { $matches = []; preg_match_all('/'. //ex: @session_formation.stagiaires[nom, prenom]@ '\{'. //delimiteur @@ -142,7 +145,17 @@ class Class_ModeleFusion extends Storm_Model_Abstract { $contenu_decode, $matches, PREG_SET_ORDER); + return $matches; + } + public function buildSection($items,$html) { + + $contenu_decode=preg_replace_callback('/\{[^\}]+\}/', + create_function('$matches', + 'return html_entity_decode($matches[0],ENT_QUOTES);'), + $html); + + $matches = $this->decode($contenu_decode); $result=''; foreach($items as $item) { $decode=$contenu_decode; @@ -153,7 +166,7 @@ class Class_ModeleFusion extends Storm_Model_Abstract { try { $tag= str_replace('{','',$tag); $tag= str_replace('}','',$tag); - + xdebug_break(); $tag_value = $this->getTagValueForInstance($tag,$item); } catch (Storm_Model_Exception $e) { continue; diff --git a/tests/application/modules/opac/controllers/RechercheControllerTest.php b/tests/application/modules/opac/controllers/RechercheControllerTest.php index dded174a815c77cda14bd59840391463026d4816..f764ffc56be09bb0738aa930293fd5d7b9ba8979 100644 --- a/tests/application/modules/opac/controllers/RechercheControllerTest.php +++ b/tests/application/modules/opac/controllers/RechercheControllerTest.php @@ -2757,6 +2757,7 @@ class RechercheControllerPrintActionTest extends AbstractControllerTestCase { /** @test */ public function displayShouldprintTitle() { + $this->assertXPathContentContains("//p", "pomme",$this->_response->getBody()); }