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

rel #31316: fix test failures

parent bec8b1ed
Branches
Tags
3 merge requests!1267Master,!1250Stable,!1234Hotline#31316 affichage du titre dans les prets en cours du compte lecteur
......@@ -1113,12 +1113,7 @@ class Class_Users extends Storm_Model_Abstract {
if ($user === null)
$user = $this; // compatibilité
if (isset($this->_fiche_sigb))
return $this->_fiche_sigb;
$ret = $user->getIdabon()
? Class_CommSigb::getInstance()->ficheAbonne($user)
: ['message' => $this->_("Vous devez vous connecter en tant qu'abonné de la bibliothèque pour obtenir plus d'informations.")];
$ret = $this->_ilsPatronInit();
if (!isset($ret['fiche']))
$ret['fiche'] = Class_WebService_SIGB_Emprunteur::nullInstance();
......@@ -1130,6 +1125,16 @@ class Class_Users extends Storm_Model_Abstract {
}
protected function _ilsPatronInit() {
if (isset($this->_fiche_sigb))
return $this->_fiche_sigb;
return $user->getIdabon()
? Class_CommSigb::getInstance()->ficheAbonne($user)
: ['message' => $this->_("Vous devez vous connecter en tant qu'abonné de la bibliothèque pour obtenir plus d'informations.")];
}
public function getSIGBComm() {
if (null == $int_bib = $this->getIntBib())
return null;
......
......@@ -145,13 +145,14 @@ class Class_WebService_SIGB_Exemplaire {
public function getTitre() {
return ($notice = $this->getNoticeOPAC())
? $notice->getTitrePrincipal() : $this->titre;
return ($record = $this->getNoticeOPAC())
&& ($record_title = $record->getTitrePrincipal())
? $record_title : $this->titre;
}
public function setTitre($titre) {
$this->titre=$titre;
$this->titre = $titre;
return $this;
}
......
......@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class ZendAfi_View_Helper_Accueil_AbonneAbstract extends ZendAfi_View_Helper_Accueil_Base {
protected $_titre_action;
protected $_abonne;
protected $_boite_id;
......@@ -26,8 +27,6 @@ abstract class ZendAfi_View_Helper_Accueil_AbonneAbstract extends ZendAfi_View_H
public function getHTML() {
$this->titre = $this->getTitre();
if (!$this->checkIdentity())
return $this->getHtmlArray() ;
......@@ -43,7 +42,7 @@ abstract class ZendAfi_View_Helper_Accueil_AbonneAbstract extends ZendAfi_View_H
}
public function getTitre(){
public function getTitre() {
return $this->_titre_action
? $this->view->tagAnchor([ 'controller' => 'abonne',
'action' => $this->_titre_action],
......@@ -53,11 +52,12 @@ abstract class ZendAfi_View_Helper_Accueil_AbonneAbstract extends ZendAfi_View_H
public function getContenu() {
$renderer = function($html, $model) {
return $html . $this->renderModel($model);
};
return (new Storm_Collection($this->getModels()))
->injectInto('',
function($html, $model) {
return $html.$this->renderModel($model);
});
->injectInto('', $renderer);
}
......@@ -69,7 +69,4 @@ abstract class ZendAfi_View_Helper_Accueil_AbonneAbstract extends ZendAfi_View_H
public function shouldCacheContent() {
return false;
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -16,9 +16,12 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_View_Helper_Accueil_Prets extends ZendAfi_View_Helper_Accueil_AbonneAbstract {
class ZendAfi_View_Helper_Accueil_Prets
extends ZendAfi_View_Helper_Accueil_AbonneAbstract {
protected $_titre_action = 'prets';
protected $_boite_id = 'prets';
......@@ -26,16 +29,15 @@ class ZendAfi_View_Helper_Accueil_Prets extends ZendAfi_View_Helper_Accueil_Abon
return $this->_abonne->getEmprunts();
}
public function renderModel($emprunt) {
$start_li='<li>';
$start_li = '<li>';
if ($emprunt->enRetard())
$start_li='<li class="pret_en_retard">';
$date_retour='<span class="date_retour"> ['.$emprunt->getDateRetour().']</span> ';
$start_li = '<li class="pret_en_retard">';
$date_retour = '<span class="date_retour"> [' . $emprunt->getDateRetour() . ']</span> ';
$tag_anchor = $this->view->tagAnchor($this->view->urlNotice($emprunt->getNoticeOPAC()),
$emprunt->getTitre());
return $start_li.$date_retour.$tag_anchor.'</li>';
}
}
?>
\ No newline at end of file
return $start_li . $date_retour . $tag_anchor . '</li>';
}
}
\ No newline at end of file
......@@ -18,7 +18,6 @@
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php';
class PretsTestWithConnectedUser extends ViewHelperTestCase {
......@@ -28,38 +27,35 @@ class PretsTestWithConnectedUser extends ViewHelperTestCase {
public function setUp() {
parent::setUp();
$helper = new ZendAfi_View_Helper_Accueil_Prets(2, [
'type_module'=>'PRETS',
'division' => '1',
'preferences' => [
'titre' => 'Mes documents']]);
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
$prefs = ['type_module'=>'PRETS',
'division' => '1',
'preferences' => ['titre' => 'Mes documents']];
$helper = new ZendAfi_View_Helper_Accueil_Prets(2, $prefs);
$helper->setView(new ZendAfi_Controller_Action_Helper_View());
$alice = new Class_WebService_SIGB_Emprunt('13', new Class_WebService_SIGB_Exemplaire(456));
$alice = new Class_WebService_SIGB_Emprunt(456, new Class_WebService_SIGB_Exemplaire(456));
$alice->getExemplaire()
->setTitre('Alice')
->setNoticeOPAC(Class_Notice::newInstanceWithId(1234))
->setDateRetour('21/10/2021');
$klein = new Class_WebService_SIGB_Emprunt('13', new Class_WebService_SIGB_Exemplaire(458));
$klein = new Class_WebService_SIGB_Emprunt(458, new Class_WebService_SIGB_Exemplaire(458));
$klein->getExemplaire()->setTitre('La stratégie du choc');
$klein->parseExtraAttributes(array(
'Dateretourprevue' => '21/10/2000',
'Section' => 'Essais',
'Auteur' => 'Naomie Klein',
'Bibliotheque' => 'Almont'));
$klein->parseExtraAttributes(['Dateretourprevue' => '21/10/2000',
'Section' => 'Essais',
'Auteur' => 'Naomie Klein',
'Bibliotheque' => 'Almont']);
$emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Estelle');
$emprunteur->empruntsAddAll([$klein, $alice]);
ZendAfi_Auth::getInstance()->logUser(Class_Users
::newInstanceWithId('123456',['nom'=>'Estelle'])
->setFicheSigb(['fiche'=>$emprunteur]));
->setFicheSigb(['fiche' => $emprunteur]));
$emprunteur->empruntsAddAll(array( $klein, $alice));
$this->html = $helper->getBoite();
}
......@@ -144,7 +140,4 @@ class PretsTestWithNonConnectedUser extends ViewHelperTestCase {
public function boitePretsShouldNotCacheContents () {
$this->assertFalse($this->helper->shouldCacheContent());
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
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