Skip to content

Commit

Permalink
afup#1437 fix article save
Browse files Browse the repository at this point in the history
  • Loading branch information
stakovicz committed Dec 6, 2024
1 parent cd132b2 commit 2bd40cc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions htdocs/pages/administration/site_articles.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function checkNoSpace($value): bool
$formulaire->addRule('titre' , 'Titre manquant' , 'required');
$formulaire->addRule('contenu' , 'Contenu manquant' , 'required');
$formulaire->addRule('raccourci' , 'Raccourci manquant' , 'required');
$formulaire->addRule('id_site_rubrique' , 'Rubrique manquante' , 'required');

$formulaire->registerRule('checkNoSpace', 'callback', 'checkNoSpace');
$formulaire->addRule('raccourci', 'Ne doit pas contenir d\'espace', 'checkNoSpace', true);
Expand Down
12 changes: 6 additions & 6 deletions sources/Afup/Corporate/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,16 @@ function modifier()
$requete = 'UPDATE afup_site_article
SET
id_site_rubrique = ' . $this->bdd->echapper($this->id_site_rubrique) . ',
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique) . ',
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique ?: null) . ',
titre = ' . $this->bdd->echapper($this->titre) . ',
raccourci = ' . $this->bdd->echapper($this->raccourci) . ',
chapeau = ' . $this->bdd->echapper($this->chapeau) . ',
contenu = ' . $this->bdd->echapper($this->contenu) . ',
type_contenu = ' . $this->bdd->echapper($this->type_contenu) . ',
position = ' . $this->bdd->echapper($this->position) . ',
date = ' . $this->bdd->echapper($this->date) . ',
theme = ' . $this->bdd->echapper($this->theme) . ',
id_forum = ' . $this->bdd->echapper($this->id_forum) . ',
theme = ' . $this->bdd->echapper($this->theme ?: null) . ',
id_forum = ' . $this->bdd->echapper($this->id_forum ?: null) . ',
etat = ' . $this->bdd->echapper($this->etat) . '
WHERE
id = ' . $this->bdd->echapper($this->id);
Expand All @@ -252,16 +252,16 @@ function inserer()
$requete = 'INSERT INTO afup_site_article
SET
id_site_rubrique = ' . $this->bdd->echapper($this->id_site_rubrique) . ',
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique) . ',
id_personne_physique = ' . $this->bdd->echapper($this->id_personne_physique ?: null) . ',
titre = ' . $this->bdd->echapper($this->titre) . ',
raccourci = ' . $this->bdd->echapper($this->raccourci) . ',
chapeau = ' . $this->bdd->echapper($this->chapeau) . ',
contenu = ' . $this->bdd->echapper($this->contenu) . ',
type_contenu = ' . $this->bdd->echapper($this->type_contenu) . ',
position = ' . $this->bdd->echapper($this->position) . ',
date = ' . $this->bdd->echapper($this->date) . ',
theme = ' . $this->bdd->echapper($this->theme) . ',
id_forum = ' . $this->bdd->echapper($this->id_forum) . ',
theme = ' . $this->bdd->echapper($this->theme ?: null) . ',
id_forum = ' . $this->bdd->echapper($this->id_forum ?: null) . ',
etat = ' . $this->bdd->echapper($this->etat);
if ($this->id > 0) {
$requete .= ', id = ' . $this->bdd->echapper($this->id);
Expand Down
16 changes: 16 additions & 0 deletions tests/behat/features/Admin/Site/AdminSiteArticles.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
Feature: Administration - Partie Site

Scenario: Ajout d'un article avec le minimum d'info
Given I am logged in as admin and on the Administration
And I follow "Articles"
Then I should see "Liste des articles"
And I should see "Actualités"
When I follow "Ajouter"
Then I should see "Ajouter un article"
And I fill in "titre" with "Le titre mini"
And I fill in "contenu" with "Le contenu mini"
And I fill in "raccourci" with "url-article-mini"
And I select "Actualités" from "id_site_rubrique"
And I select "9" from "position"
And I press "Ajouter"
When I should see "Liste des articles"
Then the ".content table" element should contain "Le titre mini"

@reloadDbWithTestData
Scenario: Ajout/modification/suppression d'un article
Given I am logged in as admin and on the Administration
Expand Down

0 comments on commit 2bd40cc

Please sign in to comment.