debug-delete-old-trajet-if-change-thanato
This commit is contained in:
parent
0beb2a6540
commit
0f67a210ea
@ -631,19 +631,21 @@ class GestionService {
|
||||
if ($devis != null) {
|
||||
$userPrincipalName = $this->gestionBdd->getCalendarPrincipalNameByCalendarId($targetCalendarId);
|
||||
if ($userPrincipalName != null) {
|
||||
$thanatoId = $this->gestionBdd->getThanatoIdByUserUuid($userPrincipalName);
|
||||
if ($thanatoId != null) {
|
||||
$thanatoHasBeenChanged = $thanatoId != $devis["id_thanato"];
|
||||
$thanato = $this->gestionBdd->getThanatoByUserUuid($userPrincipalName);
|
||||
if ($thanato != null) {
|
||||
$thanatoHasBeenChanged = $thanato['id'] != $devis["id_thanato"];
|
||||
if ($thanatoHasBeenChanged) {
|
||||
$oldThanato = $this->gestionBdd->getThanatoByThanatoId($devis['id_thanato']);
|
||||
$oldThanatoUserUuid = $oldThanato['fk_user_uuid'];
|
||||
//delete ligne trajet from old devis
|
||||
$this->gestionBdd->deleteLigneTrajetByDevisId($devis['id']);
|
||||
//delete from home and to home trajet if there is no devis at all for this date
|
||||
$thereIsThanatoDevisRattachedToLigneTrajetForADate = $this->gestionBdd->thereIsThanatoDevisRattachedToLigneTrajetForADate($devis['date'],$userPrincipalName);
|
||||
$thereIsThanatoDevisRattachedToLigneTrajetForADate = $this->gestionBdd->thereIsThanatoDevisRattachedToLigneTrajetForADate($devis['date'], $oldThanatoUserUuid );
|
||||
if(!$thereIsThanatoDevisRattachedToLigneTrajetForADate){
|
||||
//delete all ligne trajet for this date
|
||||
$this->gestionBdd->deleteThanatoLigneTrajetForADate($devis['date'],$userPrincipalName);
|
||||
$this->gestionBdd->deleteThanatoLigneTrajetForADate($devis['date'], $oldThanatoUserUuid );
|
||||
}
|
||||
$this->gestionBdd->updateDevisThanato($devis['id'], $thanatoId);
|
||||
$this->gestionBdd->updateDevisThanato($devis['id'], $thanato['id']);
|
||||
$this->gestionBdd->reArrangeLigneTrajetyByDevisId($devis['id'], $userPrincipalName);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user