Skip to content
Snippets Groups Projects
Commit 59e2fd9d authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

Merge branch...

Merge branch 'hotline#115667_magasin_de_themes_affichage_du_nombre_de_reservations_pour_un_exemplaire_ou_une_notice_donnee_sur_le_site_bootstrap' into 'hotline'

hotline #115667 Templates : adds number of holds on item

See merge request !3688
parents d110bf76 df6e4f85
Branches
Tags
2 merge requests!3694Merge Hotline pour intégrer 8.0.83,!3688hotline #115667 Templates : adds number of holds on item
Pipeline #11364 passed with stage
in 56 minutes and 30 seconds
- ticket #115667 : Magasin de thèmes : ajout de l'affichage du nombre de réservations pour un exemplaire
\ No newline at end of file
......@@ -40,9 +40,11 @@ class Class_Article_MailRenderer {
if (!$article)
return '';
$transformer = new Class_CmsUrlTransformer();
return '<div style="padding:5px">' .
'<h1>' . Class_CmsUrlTransformer::transformLinksToAbsoluteUrl($article->getLabel()). '</h1>' .
'<div>' . Class_CmsUrlTransformer::transformLinksToAbsoluteUrl($article->getFullContent()) . '</div>' .
'<h1>' . $transformer->transformLinksToAbsoluteUrl($article->getLabel()). '</h1>' .
'<div>' . $transformer->transformLinksToAbsoluteUrl($article->getFullContent()) . '</div>' .
'<div style="clear:both"></div>'.
'</div>';
}
......
......@@ -142,6 +142,20 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
$this->_model->getCodeBarres())))
];
if ($this->_model->getNbResas())
$badges []= ((new Intonation_Library_Badge)
->setTag('span')
->setClass('warning')
->setImage(Class_Template::current()->getIco($this->_view,
'hold',
'library'))
->setText($this->_plural($this->_model->getNbResas(),
'aucune réservation',
'1 réservation',
'%s réservations',
$this->_model->getNbResas())));
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -405,14 +405,25 @@ abstract class TemplatesSearchWithItemsLinkToSIGBTestCase extends TemplatesSearc
'id_notice' => 34,
'id_bib' => 23,
'int_bib' => $int_bib,
'sigb_exemplaire' => (new Class_WebService_SIGB_Exemplaire(12))->beReservable()
'sigb_exemplaire' => (new Class_WebService_SIGB_Exemplaire(12))
->beReservable()
->setNbReservations(8)
]);
$this->fixture('Class_Exemplaire',
['id' => 13,
'id_notice' => 34,
'id_bib' => 23,
'int_bib' => $int_bib
'int_bib' => $int_bib,
'sigb_exemplaire' => (new Class_WebService_SIGB_Exemplaire(13))->setNbReservations(0)
]);
$this->fixture('Class_Exemplaire',
['id' => 14,
'id_notice' => 34,
'id_bib' => 23,
'int_bib' => $int_bib,
'sigb_exemplaire' => (new Class_WebService_SIGB_Exemplaire(14))->setNbReservations(1)
]);
$this->fixture('Class_Bib',
......@@ -438,9 +449,9 @@ class TemplatesSearchDispatchNoticeAjaxResourcesTest extends TemplatesSearchWith
/** @test */
public function pageShouldDisplayTwoItems() {
public function pageShouldDisplayThreeItems() {
$this->assertXPathCount('//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_Item")]',
2);
3);
}
......@@ -454,6 +465,26 @@ class TemplatesSearchDispatchNoticeAjaxResourcesTest extends TemplatesSearchWith
public function firstItemShouldHaveLinkToPickupAjax() {
$this->assertXPath('//div[contains(@class, "card_body_Intonation_Library_View_Wrapper_Item")]//a[contains(@href, "/recherche/reservation-pickup-ajax/id/34/id_notice/34/id_int_bib/2/id_bib/23")]');
}
/** @test */
public function anItemShouldHaveBadgeHoldCount() {
$this->assertXPathContentContains('//div[contains(@class, "badge_group_Intonation_Library_View_Wrapper_Item")]//i[contains(@class, "fa-thumbtack library")]/following-sibling::span',
utf8_encode('8 réservations'));
}
/** @test */
public function anItemShouldHaveBadgeWithOneReservation() {
$this->assertXPath('//div[contains(@class, "badge_group_Intonation_Library_View_Wrapper_Item")]//span[text()="' . utf8_encode('1 réservation') . '"]');
}
/** @test */
public function noItemShouldHaveBadgeWithZeroReservations() {
$this->assertNotXPathContentContains('//div[contains(@class, "badge_group_Intonation_Library_View_Wrapper_Item")]//span',
utf8_encode('0 réservations'));
}
}
......
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