🔒 Vérifie si l'annonce a déjà une demande de suppression

This commit is contained in:
Shikiryu 2017-11-07 21:24:59 +01:00
parent c0c02459f8
commit ac21f74c11
1 changed files with 10 additions and 5 deletions

View File

@ -130,6 +130,7 @@ class Actions
{
try {
$crawler = $this->account->getClient()->request('GET', self::ADD_URL);
$this->addPageDebug('add-form', $crawler);
$form = $crawler->selectButton('Valider')->form();
$path = $deal->getPath();
if (empty($path)) {
@ -207,11 +208,15 @@ class Actions
];
$crawler = $this->account->getClient()->request('POST', self::DELETE_URL, $fields);
$this->addPageDebug('delete', $crawler);
// confirmation
$form = $crawler->selectButton('Valider')->form();
$crawler = $this->account->getClient()->submit($form, ['delete_reason' => '1']);
$this->addPageDebug('delete-validation', $crawler);
// TODO return if it's the validation page or not
// check s'il y a un bouton "Valider", s'il y en a pas c'est que la demande a déjà été faite
$node = $crawler->filterXPath('//input[@value="Valider"]');
if ($node->count() == 1) {
// confirmation
$form = $crawler->selectButton('Valider')->form();
$crawler = $this->account->getClient()->submit($form, ['delete_reason' => '1']);
// TODO return if it's the validation page or not
$this->addPageDebug('delete-validation', $crawler);
}
return true;
}
}