bug edit galeri nom vide

This commit is contained in:
Fred Tempez 2020-09-22 19:20:35 +02:00
parent b8d464fea4
commit 027e75dd7e

View File

@ -253,7 +253,7 @@ class gallery extends common {
break; break;
} }
} }
if ( $this->getInput('galleryEditName') ) { if ( $this->getInput('galleryConfigName') ) {
$this->setData(['module', $this->getUrl(0), $galleryId, [ $this->setData(['module', $this->getUrl(0), $galleryId, [
'config' => [ 'config' => [
'name' => $this->getInput('galleryConfigName'), 'name' => $this->getInput('galleryConfigName'),
@ -352,7 +352,7 @@ class gallery extends common {
// Soumission du formulaire // Soumission du formulaire
if($this->isPost()) { if($this->isPost()) {
// Si l'id a changée // Si l'id a changée
$galleryId = $this->getInput('galleryEditName', helper::FILTER_ID, true); $galleryId = !empty($this->getInput('galleryEditName')) ? $this->getInput('galleryEditName', helper::FILTER_ID, true) : $this->getUrl(2);
if($galleryId !== $this->getUrl(2)) { if($galleryId !== $this->getUrl(2)) {
// Incrémente le nouvel id de la galerie // Incrémente le nouvel id de la galerie
$galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0)])); $galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0)]));
@ -376,6 +376,7 @@ class gallery extends common {
$homePicture = $d[0]; $homePicture = $d[0];
} }
// Sauvegarder // Sauvegarder
if ($this->getInput('galleryEditName')) {
$this->setData(['module', $this->getUrl(0), $galleryId, [ $this->setData(['module', $this->getUrl(0), $galleryId, [
'config' => [ 'config' => [
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true), 'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
@ -390,6 +391,7 @@ class gallery extends common {
'legend' => $legends, 'legend' => $legends,
'positions' => empty($oldPositions) ? $this->getdata(['module', $this->getUrl(0), $galleryId, 'positions']) : $oldPositions 'positions' => empty($oldPositions) ? $this->getdata(['module', $this->getUrl(0), $galleryId, 'positions']) : $oldPositions
]]); ]]);
}
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'] , 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'] ,