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) {
|
if ($devis != null) {
|
||||||
$userPrincipalName = $this->gestionBdd->getCalendarPrincipalNameByCalendarId($targetCalendarId);
|
$userPrincipalName = $this->gestionBdd->getCalendarPrincipalNameByCalendarId($targetCalendarId);
|
||||||
if ($userPrincipalName != null) {
|
if ($userPrincipalName != null) {
|
||||||
$thanatoId = $this->gestionBdd->getThanatoIdByUserUuid($userPrincipalName);
|
$thanato = $this->gestionBdd->getThanatoByUserUuid($userPrincipalName);
|
||||||
if ($thanatoId != null) {
|
if ($thanato != null) {
|
||||||
$thanatoHasBeenChanged = $thanatoId != $devis["id_thanato"];
|
$thanatoHasBeenChanged = $thanato['id'] != $devis["id_thanato"];
|
||||||
if ($thanatoHasBeenChanged) {
|
if ($thanatoHasBeenChanged) {
|
||||||
|
$oldThanato = $this->gestionBdd->getThanatoByThanatoId($devis['id_thanato']);
|
||||||
|
$oldThanatoUserUuid = $oldThanato['fk_user_uuid'];
|
||||||
//delete ligne trajet from old devis
|
//delete ligne trajet from old devis
|
||||||
$this->gestionBdd->deleteLigneTrajetByDevisId($devis['id']);
|
$this->gestionBdd->deleteLigneTrajetByDevisId($devis['id']);
|
||||||
//delete from home and to home trajet if there is no devis at all for this date
|
//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){
|
if(!$thereIsThanatoDevisRattachedToLigneTrajetForADate){
|
||||||
//delete all ligne trajet for this date
|
//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);
|
$this->gestionBdd->reArrangeLigneTrajetyByDevisId($devis['id'], $userPrincipalName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user