Skip to content
Snippets Groups Projects
Commit 271d1cd2 authored by Matthias Meusburger's avatar Matthias Meusburger
Browse files

Hotline#22882: RT Fix.

parent 4bb41288
Branches
Tags
4 merge requests!915Master,!914Hotline master,!913Stable,!908Hotline#22882 location information in article
......@@ -24,12 +24,30 @@ class ZendAfi_View_Helper_RenderLieu extends Zend_View_Helper_HtmlElement {
if (!$lieu)
return '';
$adresse = nl2br($lieu->getAdresse()) . '<br/>' . $lieu->getCodePostal() . ' ' . $lieu->getVille() . '<br />' . $lieu->getTelephone() . '<br />' . $lieu->getMail();
$adresse = array();
if (nl2br($lieu->getAdresse()))
$adresse[] = nl2br($lieu->getAdresse());
if ($lieu->getCodePostal())
$adresse[] = $lieu->getCodePostal();
if ($lieu->getVille())
$adresse[] = $lieu->getVille();
if ($lieu->getTelephone())
$adresse[] = $lieu->getTelephone();
if ($lieu->getMail())
$adresse[] = $lieu->getMail();
$adresse_str = implode('<br />', $adresse);
return sprintf('<div class="lieu">%s %s <p>%s</p></div>',
$this->view->mapForLieu($lieu, $map_options),
$lieu->getLibelle(),
$adresse);
$adresse_str);
}
}
......
......@@ -38,16 +38,20 @@ class ZendAfi_View_Helper_RenderLieuTest extends ViewHelperTestCase {
/** @test */
public function withLieuShouldRenderEmail() {
$this->assertContains('toto@example.com', $this->_helper->renderLieu(Class_Lieu::getLoader()
->newInstanceWithId(4)
->setMail('toto@example.com')));
$this->assertContains('toto@example.com', $this->_helper->renderLieu($this->fixture(
'Class_Lieu',
['id' => 4,
'libelle' => 'Mon lieu',
'mail' => 'toto@example.com'])));
}
/** @test */
public function withLieuShouldRenderPhoneNumber() {
$this->assertContains('010203040506', $this->_helper->renderLieu(Class_Lieu::getLoader()
->newInstanceWithId(4)
->setTelephone('010203040506')));
$this->assertContains('010203040506', $this->_helper->renderLieu($this->fixture(
'Class_Lieu',
['id' => 4,
'libelle' => 'Mon lieu',
'telephone' => '010203040506'])));
}
......
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