🔒 Vérifie si l'annonce a déjà une demande de suppression
This commit is contained in:
parent
c0c02459f8
commit
ac21f74c11
@ -130,6 +130,7 @@ class Actions
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$crawler = $this->account->getClient()->request('GET', self::ADD_URL);
|
$crawler = $this->account->getClient()->request('GET', self::ADD_URL);
|
||||||
|
$this->addPageDebug('add-form', $crawler);
|
||||||
$form = $crawler->selectButton('Valider')->form();
|
$form = $crawler->selectButton('Valider')->form();
|
||||||
$path = $deal->getPath();
|
$path = $deal->getPath();
|
||||||
if (empty($path)) {
|
if (empty($path)) {
|
||||||
@ -207,11 +208,15 @@ class Actions
|
|||||||
];
|
];
|
||||||
$crawler = $this->account->getClient()->request('POST', self::DELETE_URL, $fields);
|
$crawler = $this->account->getClient()->request('POST', self::DELETE_URL, $fields);
|
||||||
$this->addPageDebug('delete', $crawler);
|
$this->addPageDebug('delete', $crawler);
|
||||||
|
// 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
|
// confirmation
|
||||||
$form = $crawler->selectButton('Valider')->form();
|
$form = $crawler->selectButton('Valider')->form();
|
||||||
$crawler = $this->account->getClient()->submit($form, ['delete_reason' => '1']);
|
$crawler = $this->account->getClient()->submit($form, ['delete_reason' => '1']);
|
||||||
$this->addPageDebug('delete-validation', $crawler);
|
|
||||||
// TODO return if it's the validation page or not
|
// TODO return if it's the validation page or not
|
||||||
|
$this->addPageDebug('delete-validation', $crawler);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user