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