Skip to content

Commit 7e1c06a

Browse files
authored
#1437 fix article save (#1567)
1 parent 0d08d61 commit 7e1c06a

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

htdocs/pages/administration/site_articles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ function checkNoSpace($value): bool
126126
$formulaire->addRule('titre' , 'Titre manquant' , 'required');
127127
$formulaire->addRule('contenu' , 'Contenu manquant' , 'required');
128128
$formulaire->addRule('raccourci' , 'Raccourci manquant' , 'required');
129+
$formulaire->addRule('id_site_rubrique' , 'Rubrique manquante' , 'required');
129130

130131
$formulaire->registerRule('checkNoSpace', 'callback', 'checkNoSpace');
131132
$formulaire->addRule('raccourci', 'Ne doit pas contenir d\'espace', 'checkNoSpace', true);

sources/Afup/Corporate/Article.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ function modifier()
230230
$requete = 'UPDATE afup_site_article
231231
SET
232232
id_site_rubrique = ' . $this->bdd->echapper($this->id_site_rubrique) . ',
233-
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique) . ',
233+
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique ?: null) . ',
234234
titre = ' . $this->bdd->echapper($this->titre) . ',
235235
raccourci = ' . $this->bdd->echapper($this->raccourci) . ',
236236
chapeau = ' . $this->bdd->echapper($this->chapeau) . ',
237237
contenu = ' . $this->bdd->echapper($this->contenu) . ',
238238
type_contenu = ' . $this->bdd->echapper($this->type_contenu) . ',
239239
position = ' . $this->bdd->echapper($this->position) . ',
240240
date = ' . $this->bdd->echapper($this->date) . ',
241-
theme = ' . $this->bdd->echapper($this->theme) . ',
242-
id_forum = ' . $this->bdd->echapper($this->id_forum) . ',
241+
theme = ' . $this->bdd->echapper($this->theme ?: null) . ',
242+
id_forum = ' . $this->bdd->echapper($this->id_forum ?: null) . ',
243243
etat = ' . $this->bdd->echapper($this->etat) . '
244244
WHERE
245245
id = ' . $this->bdd->echapper($this->id);
@@ -252,16 +252,16 @@ function inserer()
252252
$requete = 'INSERT INTO afup_site_article
253253
SET
254254
id_site_rubrique = ' . $this->bdd->echapper($this->id_site_rubrique) . ',
255-
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique) . ',
255+
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique ?: null) . ',
256256
titre = ' . $this->bdd->echapper($this->titre) . ',
257257
raccourci = ' . $this->bdd->echapper($this->raccourci) . ',
258258
chapeau = ' . $this->bdd->echapper($this->chapeau) . ',
259259
contenu = ' . $this->bdd->echapper($this->contenu) . ',
260260
type_contenu = ' . $this->bdd->echapper($this->type_contenu) . ',
261261
position = ' . $this->bdd->echapper($this->position) . ',
262262
date = ' . $this->bdd->echapper($this->date) . ',
263-
theme = ' . $this->bdd->echapper($this->theme) . ',
264-
id_forum = ' . $this->bdd->echapper($this->id_forum) . ',
263+
theme = ' . $this->bdd->echapper($this->theme ?: null) . ',
264+
id_forum = ' . $this->bdd->echapper($this->id_forum ?: null) . ',
265265
etat = ' . $this->bdd->echapper($this->etat);
266266
if ($this->id > 0) {
267267
$requete .= ', id = ' . $this->bdd->echapper($this->id);

tests/behat/features/Admin/Site/AdminSiteArticles.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
Feature: Administration - Partie Site
22

3+
Scenario: Ajout d'un article avec le minimum d'info
4+
Given I am logged in as admin and on the Administration
5+
And I follow "Articles"
6+
Then I should see "Liste des articles"
7+
And I should see "Actualités"
8+
When I follow "Ajouter"
9+
Then I should see "Ajouter un article"
10+
And I fill in "titre" with "Le titre mini"
11+
And I fill in "contenu" with "Le contenu mini"
12+
And I fill in "raccourci" with "url-article-mini"
13+
And I select "Actualités" from "id_site_rubrique"
14+
And I select "9" from "position"
15+
And I press "Ajouter"
16+
When I should see "Liste des articles"
17+
Then the ".content table" element should contain "Le titre mini"
18+
319
@reloadDbWithTestData
420
Scenario: Ajout/modification/suppression d'un article
521
Given I am logged in as admin and on the Administration

0 commit comments

Comments
 (0)