Commit 1316951e authored by Sebastien ANDRE's avatar Sebastien ANDRE

Merge branch 'hotline#115609_magasin_de_theme_probleme_sur_les_notices' into 'hotline'

hotline #115609 templates / records : fix navigation on action /record/description

See merge request !3605
parents 8ca53ce5 78600f37
Pipeline #10883 failed with stage
in 55 minutes and 24 seconds
- ticket #115609 : Magasin de thème : visualisation des notices : correction des liens des boutons suivant / précédent après visualisation du bloc description
\ No newline at end of file
......@@ -394,8 +394,8 @@ class RechercheController extends ZendAfi_Controller_Action {
$notice_to_show = ($navigation ==='suivant'
? $notice_navigation->getNoticeSuivante()
: $notice_navigation->getNoticePrecedente());
return $this->_redirect($this->view->absoluteUrl(['id'=>$notice_to_show->getId(),
'clef'=>$notice_to_show->getClefAlpha(),
return $this->_redirect($this->view->absoluteUrl(['id' => $notice_to_show->getId(),
'clef' => null,
'navigation'=> null]));
}
......
......@@ -175,16 +175,14 @@ class Class_Notice extends Storm_Model_Abstract {
TYPE_AUTHORITY = 2,
TYPE_SERIAL_ARTICLE = 3;
protected $_loader_class = 'NoticeLoader';
protected $_table_name = 'notices';
protected $_table_primary = 'id_notice';
/** @var Class_NoticeUnimarc */
protected $_notice_unimarc;
protected $_has_many = ['exemplaires' => ['model' => 'Class_Exemplaire',
'role' => 'notice',
'dependents' => 'delete']];
protected
$_loader_class = 'NoticeLoader',
$_table_name = 'notices',
$_table_primary = 'id_notice',
$_notice_unimarc,
$_has_many = ['exemplaires' => ['model' => 'Class_Exemplaire',
'role' => 'notice',
'dependents' => 'delete']],
$_titre_principal,
$_auteur_principal,
$_avis,
......@@ -193,7 +191,8 @@ class Class_Notice extends Storm_Model_Abstract {
$_editeur,
$_langueCodes,
$_first_exemplaire,
$_data_map;
$_data_map,
$_collation;
protected $_default_attribute_values = ['type_doc' => 0,
'annee' => null,
......
......@@ -303,7 +303,7 @@ class ZendAfi_View_Helper_Accueil_Library extends ZendAfi_View_Helper_Accueil_Ba
$order = ($this->getPreference('order') == Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA)
? 'libelle'
: 'FIELD (id_site, ' . implode($id_libraries, ',') . ')';
: 'FIELD (id_site, ' . implode(',', $id_libraries) . ')';
return Class_Bib::findAllBy(['id_site' => $id_libraries,
'order' => $order]);
......
......@@ -49,7 +49,9 @@ class Intonation_Library_View_Wrapper_Record_RichContent_Navigation {
if (($this->_view->notice_navigation->getCurrentNoticeIndex() +1) <= 1)
$disabled = ' disabled';
return $this->_view->tagAnchor(['navigation' => 'precedent'],
return $this->_view->tagAnchor(['controller' => 'recherche',
'action' => 'viewnotice',
'navigation' => 'precedent'],
Class_Template::current()->getIco($this->_view, 'previous', 'utils', ['class' => 'ico_xl']),
['title' => $this->_('Document précédent : %s',
$this->_view->notice_navigation->getNoticePrecedente()->getTitrePrincipal(' ')),
......@@ -66,7 +68,9 @@ class Intonation_Library_View_Wrapper_Record_RichContent_Navigation {
if (($this->_view->notice_navigation->getCurrentNoticeIndex() +1) >= $this->_view->notice_navigation->getNombreNotices())
$disabled = ' disabled';
return $this->_view->tagAnchor(['navigation' => 'suivant'],
return $this->_view->tagAnchor(['controller' => 'recherche',
'action' => 'viewnotice',
'navigation' => 'suivant'],
Class_Template::current()->getIco($this->_view, 'next', 'utils', ['class' => 'ico_xl']),
['title' => $this->_('Document suivant : %s',
$this->_view->notice_navigation->getNoticeSuivante()->getTitrePrincipal(' ')),
......
......@@ -2688,41 +2688,41 @@ class RechercheControllerNavigationTest extends RechercheControllerNoticeTestCas
/** @test */
public function navigationSuivantShouldRedirectToBatmanViewnotice() {
$this->dispatch('/recherche/viewnotice/id/345/tri/alpha_titre/navigation/suivant',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/1/tri/alpha_titre/clef/batman|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/1/tri/alpha_titre|');
}
/** @test */
public function navigationPrecedentShouldRedirectToTarzanViewnotice() {
$this->dispatch('/recherche/viewnotice/id/345/tri/alpha_titre/navigation/precedent',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/12/tri/alpha_titre/clef/tarzan|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/12/tri/alpha_titre|');
}
/** @test */
public function navigationPrecedentOnTheFirstNoticeMussoOfResultatRechercheShouldRedirectToMusso() {
$this->dispatch('/recherche/viewnotice/id/28/tri/alpha_titre/navigation/precedent',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/28/tri/alpha_titre/clef/musso|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/28/tri/alpha_titre|');
}
/** @test */
public function navigationSuivantOnTheLastNoticeLesArbresOfResultatRechercheShouldRedirectToLesarbres() {
$this->dispatch('/recherche/viewnotice/id/99/tri/alpha_titre/navigation/suivant',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/99/tri/alpha_titre/clef/lesarbres|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/99/tri/alpha_titre|');
}
/** @test */
public function navigationSuivantOnTheFirstNoticeMussoOfResultatRechercheShouldRedirectToTarzan() {
$this->dispatch('/recherche/viewnotice/id/28/tri/alpha_titre/navigation/suivant',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/12/tri/alpha_titre/clef/tarzan|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/12/tri/alpha_titre|');
}
/** @test */
public function navigationPrecedentOnTheLastNoticeLesarbresOfResultatRechercheShouldRedirectToBatman() {
$this->dispatch('/recherche/viewnotice/id/99/tri/alpha_titre/navigation/precedent',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/1/tri/alpha_titre/clef/batman|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/1/tri/alpha_titre|');
}
......@@ -2735,7 +2735,7 @@ class RechercheControllerNavigationTest extends RechercheControllerNoticeTestCas
$this->dispatch('/recherche/viewnotice/id/99/tri/alpha_titre/navigation/suivant',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/99/tri/alpha_titre/clef/lesarbres|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/99/tri/alpha_titre|');
}
......@@ -2747,7 +2747,7 @@ class RechercheControllerNavigationTest extends RechercheControllerNoticeTestCas
->answers([ [28, '' ] ]);
$this->dispatch('/recherche/viewnotice/id/28/tri/alpha_titre/navigation/suivant',true);
$this->assertRedirectRegex('|/recherche/viewnotice/id/28/tri/alpha_titre/clef/musso|');
$this->assertRedirectRegex('|/recherche/viewnotice/id/28/tri/alpha_titre|');
}
}
......
......@@ -1409,6 +1409,7 @@ class TemplatesViewRecordTest extends TemplatesIntonationTestCase {
'date_creation' => date('Y-m-d', Class_Notice::getTimeSource()->time()),
'titre_principal' => 'Psycho',
'clef_oeuvre' => 'PSYKO',
'clef_alpha' => 'PSYKO',
'facettes' => 'G13 M12']);
$this->fixture('Class_TypeDoc',
......@@ -1772,18 +1773,52 @@ class TemplatesDispatchNoticeAjaxTracksTest extends TemplatesIntonationTestCase
class TemplatesDispatchRecordDescriptionTest extends TemplatesIntonationTestCase {
public function setUp() {
parent::setUp();
$ids = range(455, 459);
foreach($ids as $i)
$this->fixture('Class_Notice',
['id' => $i,
'type_doc' => 8,
'clef_oeuvre' => 'VIE ADELE ' . $i,
'unimarc' => file_get_contents(ROOT_PATH . 'tests/fixtures/vie_adele.uni'),
'facettes' => 'G13 M12']);
$this->mock_sql = $this->mock()
->whenCalled('fetchAll')
->with('select id_notice, facettes from notices Where type=1 order by annee desc', true, false)
->answers(array_map(function($i) {return [$i, ''];}, $ids))
->beStrict();
Zend_Registry::set('sql', $this->mock_sql);
$this->onLoaderOfModel('Class_Notice')
->whenCalled('getNoticeIdsByRequeteRecherche')
->answers($ids);
$this->dispatch('/record/description/id/456/id_profil/72/id_catalogue/22');
}
/** @test */
public function shouldRenderDescription() {
$record = $this->fixture('Class_Notice',
['id' => 456,
'type_doc' => 8,
'clef_oeuvre' => 'THE BOOK OF SOULS',
'facettes' => 'G13 M12']);
public function pageShouldContainsDlDDWithCollation() {
$this->assertXPathContentContains('//dl//dd', '2 DVD');
}
$this->dispatch('/record/description/id/456/id_profil/72');
$this->assertXPath('//dl');
/** @test */
public function linkToNavigationNextShouldHaveControllerRechercheActionNavigationSuivant() {
$this->assertXPath('//a[contains(@class, "next")][@href="/recherche/viewnotice/id/456/id_profil/72/id_catalogue/22/navigation/suivant"]');
}
/** @test */
public function linkToNavigationNextShouldHaveControllerRechercheActionNavigationPrecedent() {
$this->assertXPath('//a[contains(@class, "previous")][@href="/recherche/viewnotice/id/456/id_profil/72/id_catalogue/22/navigation/precedent"]');
}
}
......
Markdown is supported
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