Skip to content
Snippets Groups Projects
Commit fcd02d5f authored by pbarroca's avatar pbarroca
Browse files

Téléphone: Correction non prise en charge prolongation des prêts

parent 7937b590
Branches
Tags
No related merge requests found
......@@ -22,6 +22,20 @@
require_once ROOT_PATH.'application/modules/opac/controllers/AbonneController.php';
class Telephone_AbonneController extends AbonneController {
protected $_messenger;
public function init() {
parent::init();
$this->_messenger = $this->_helper->getHelper('FlashMessenger');
}
public function ficheAction() {
parent::ficheAction();
$this->view->messages = $this->_messenger->getMessages();
}
public function cancelHoldAction() {
$this->_helper->getHelper('ViewRenderer')->setLayoutScript('empty.phtml');
$fiche_sigb = $this->_user->getFicheSigb();
......@@ -44,6 +58,16 @@ class Telephone_AbonneController extends AbonneController {
}
public function prolongerpretAction() {
$sigb = new Class_CommSigb();
$result = $sigb->prolongerPret($this->_user, $this->_getParam('id_pret'));
$this->_messenger->addMessage((1 == $result['statut']) ?
$this->view->_('Prêt prolongé') :
$result['erreur']);
$this->_redirect('/abonne/fiche');
}
protected function _detectReservation($reservations) {
foreach($reservations as $resa) {
if ($resa->getId() == $this->_getParam('id')) {
......
<?php echo $this->toolbar($this->_('Fiche abonné')); ?>
<?php echo $this->partial('abonne/identity.phtml', array('user' => $this->user));?>
<ul data-role="listview">
<li data-role="list-divider"><?php echo $this->_('Abonnement');?></li>
<?php if ($this->messages) { ?>
<div data-role="navbar" data-iconpos="left">
<ul>
<?php foreach($this->messages as $message) { ?>
<li><a href="#" data-icon="info" data-theme="a"><?php echo $this->escape($message);?></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php
if ($this->user->isAbonne()) {
$date_fin = formatDate($this->user->getDateFin(), '1');
......@@ -10,28 +18,28 @@ if ($this->user->isAbonne()) {
"Votre abonnement est valide jusqu'au %s." :
"Votre abonnement est terminé depuis le %s.";
?>
<ul data-role="listview">
<li data-role="list-divider"><?php echo $this->_('Abonnement');?></li>
<li><?php echo $this->_($format, $date_fin);?></li>
<?php } else { ?>
<li><?php echo $this->_('Vous n\'avez aucun abonnement en cours');?></li>
<?php } ?>
</ul>
<?php } ?>
<?php
$fiche_sigb = $this->user->getFicheSigb();
if (array_key_exists("erreur", $fiche_sigb)) { ?>
<div data-role="navbar" data-theme="a" data-iconpos="left">
<div data-role="navbar" data-iconpos="left">
<ul>
<li><a href="#" data-icon="alert" ><?php echo $this->escape($fiche_sigb["erreur"]);?></a></li>
<li><a href="#" data-icon="alert" data-theme="a"><?php echo $this->escape($fiche_sigb["erreur"]);?></a></li>
</ul>
</div>
<?php } ?>
<?php if (array_key_exists("message", $fiche_sigb)) { ?>
<div data-role="navbar" data-theme="a" data-iconpos="left">
<div data-role="navbar" data-iconpos="left">
<ul>
<li><a href="#" data-icon="info" ><?php echo $this->escape($fiche_sigb["message"]);?></a></li>
<li><a href="#" data-icon="info" data-theme="a"><?php echo $this->escape($fiche_sigb["message"]);?></a></li>
</ul>
</div>
<?php } ?>
......@@ -62,7 +70,7 @@ if (array_key_exists("fiche", $fiche_sigb)) {
<?php if ($emprunt->isRenewable()) { ?>
<a href="<?php echo $this->url(array('action' => 'prolongerpret',
'id_pret' => $emprunt->getId()));?>"
data-theme="c" data-position="notext"><?php echo $this->_('Prolonger');?></a>
data-theme="c"><?php echo $this->_('Prolonger');?></a>
<?php } ?>
</li>
<?php } ?>
......
......@@ -190,4 +190,29 @@ class AbonneControllerTelephoneConfirmedCancelHoldTest extends AbonneControllerT
}
}
class AbonneControllerTelephoneRenewSuccessTest extends AbonneControllerTelephoneTestCase {
public function setUp() {
parent::setUp();
$this->_service = Storm_Test_ObjectWrapper::mock()
->whenCalled('prolongerPret')
->answers(true)
->whenCalled('isConnected')
->answers(true);
Class_WebService_SIGB_VSmart::setService($this->_service);
$this->dispatch('/abonne/prolongerpret/id_pret/11', true);
}
/** @test */
public function shouldRedirectToFicheAbonne() {
$this->assertRedirectTo('/abonne/fiche');
}
}
?>
\ 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