Commit bd98ae59 authored by Laurent's avatar Laurent
Browse files

hotline#61462 WIP popups for delete holds and renew loans use notifications system

parent 1bbe1556
Pipeline #2218 failed with stage
in 6 minutes and 3 seconds
......@@ -383,7 +383,7 @@ class AbonneController extends ZendAfi_Controller_Action {
$id_pret = $this->_getParam('id_pret');
$ids = array_filter(explode(';', $id_pret));
if (!count($ids)) {
$this->_renderExtendPopup($this->_('Erreur'), $this->_('Aucune prolongation éffectué.'));
$this->_renderExtendPopup($this->_('Aucune prolongation éffectué.'));
return;
}
......@@ -400,19 +400,21 @@ class AbonneController extends ZendAfi_Controller_Action {
? $this->_('Prolongation des prêts')
: $this->_('Prolongation du prêt');
$this->_renderExtendPopup($title, $this->view->abonne_LoansExtension($cards, $results, $ids));
$this->_renderExtendPopup($this->view->abonne_LoansExtension($cards,
$results,
$ids));
}
protected function _renderExtendPopup($title, $message) {
$this->view->titre = $title;
$this->view->fiche = $this->_user->getFicheSigb();
$this->renderPopupResult($title,
$message,
[
'show_modal' => 'true',
'position' => json_decode('{ "my": "center center", "at": "center center"}')
]);
protected function _renderExtendPopup($messages) {
$this->getHelper('notify')->bePopup();
if (!is_array($messages))
$messages = [$messages];
foreach($messages as $message)
$this->_helper->notify($message);
$this->_redirectToReferer();
}
......@@ -436,7 +438,7 @@ class AbonneController extends ZendAfi_Controller_Action {
? $result['erreur']
: $this->_('Votre réservation du document %s a bien été supprimée.', $title);
return $this->_renderExtendPopup($this->_('Suppression de la réservation'), $message);
return $this->_renderExtendPopup($message);
}
if ($delete = $this->_getParam('consultation_id_delete'))
......
......@@ -16,9 +16,7 @@ $loans_ids = implode(';', $renewable_loan);
$extend_all = $this->tagAnchor(['action' => 'prolongerPret',
'id_pret' => $loans_ids],
$this->_('Tout prolonger'),
['data-popup' => 'true',
'data-popup-refresh' => 'true',
'class' => 'extend_all']);
['class' => 'extend_all']);
if ($this->error)
echo '<p class="error">' . $this->error . '</p>';
......
......@@ -30,11 +30,7 @@ class ZendAfi_View_Helper_Abonne_LoanAction extends ZendAfi_View_Helper_Abonne_A
public function tagAnchor($url, $content) {
return $this->view->tagAnchor($url,
$content,
[
'data-popup' => 'true',
'data-popup-refresh' => 'true',
]);
$content);
}
......
......@@ -42,11 +42,10 @@ class ZendAfi_View_Helper_Abonne_LoansExtension extends ZendAfi_View_Helper_Base
foreach ($this->_results as $result)
$result['statut'] == 1 ? $nb_success++ : $nb_errors++;
$message = $nb_success . $this->_(' prêt(s) prolongé(s).').'<br>';
$message .= $nb_errors . $this->_(' prolongation(s) impossible(s).').'<br>';
$message .= $this->_getExtensionsErrors();
return $message;
$messages = [$nb_success . $this->_(' prêt(s) prolongé(s).'),
$nb_errors . $this->_(' prolongation(s) impossible(s).')];
return array_merge($messages,
$this->_getExtensionsErrors());
}
......@@ -58,11 +57,11 @@ class ZendAfi_View_Helper_Abonne_LoansExtension extends ZendAfi_View_Helper_Base
protected function _getExtensionsErrors() {
$message = '';
$messages = [];
foreach($this->_results as $result)
$message .= $this->_getExtensionError($result);
$messages []= $this->_getExtensionError($result);
return $message;
return array_filter($messages);
}
......@@ -74,7 +73,7 @@ class ZendAfi_View_Helper_Abonne_LoansExtension extends ZendAfi_View_Helper_Base
if ($loan->getId() != $result['id'])
continue;
return '<br>'. $this->_tag('strong', $loan->getTitre() . ':') . ' ' . $result['erreur'];
return $loan->getTitre() . ': '. $result['erreur'];
}
return '';
......
......@@ -94,9 +94,7 @@ class ZendAfi_View_Helper_Abonne_ReservationsTable extends ZendAfi_View_Helper_A
$this->view->tagImg(URL_IMG . 'bouton/cancel.gif',
['onclick' => 'return confirm(\''. str_replace("'", "\\'", $this->_('Etes vous sûr de vouloir supprimer cette réservation ?')) . '\')',
'title' => $this->_('Supprimer la réservation du document %s',
$reservation->getTitre())]),
['data-popup' => 'true',
'data-popup-refresh' => 'true']);
$reservation->getTitre())]));
}
......
......@@ -87,8 +87,6 @@
var onClose = function(event, ui) {
removeLoadingClass();
updateAndDestroyCKEditor();
if (current_anchor != undefined && current_anchor.attr('data-popup-refresh') == 'true')
refreshPage();
$('#opac-dialog').remove();
}
......@@ -99,11 +97,6 @@
}
var refreshPage = function() {
location.reload(true);
}
var fixWindowPositionAndWidth = function(dialog) {
var max_height = Math.round($(window).height() * 0.8);
dialog
......
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