fix create agenda don't create thanato automatically but set default to 0
This commit is contained in:
parent
e35a6da064
commit
131e457045
File diff suppressed because one or more lines are too long
@ -747,6 +747,17 @@ class Bdd {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFirstThanatoIdByName($name) {
|
||||
$sql = "SELECT min(id) as FIRST_INSERT_ID
|
||||
FROM ".$this->tableprefix."thanato
|
||||
WHERE nom = ?";
|
||||
$res = $this->execSQLNoJsonReturn($sql,array($name));
|
||||
if($res){
|
||||
return $res[0]['FIRST_INSERT_ID'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert lieu
|
||||
*/
|
||||
|
||||
@ -63,14 +63,17 @@ class GestionService {
|
||||
return $summaryValue;
|
||||
}
|
||||
|
||||
private function GetOrCreateThanatoFromVCalendarString(string $vCalendarString)
|
||||
private function GetThanatoIdFromVCalendarString(string $vCalendarString)
|
||||
{
|
||||
$thanatoName = "Nom du défunt";
|
||||
$thanatoId = 0;
|
||||
$thanatoNames = $this->GetAttendeesNameFromVCalendarString($vCalendarString);
|
||||
if(count($thanatoNames) > 0){
|
||||
$thanatoName = $thanatoNames[0];
|
||||
$thanatoIdFromDb = $this->gestionBdd->getFirstThanatoIdByName($thanatoName);
|
||||
if($thanatoIdFromDb != null){
|
||||
$thanatoId = $thanatoIdFromDb;
|
||||
}
|
||||
}
|
||||
$thanatoId = $this->gestionBdd->getOrCreateThanatoIdByLastName($thanatoName);
|
||||
return $thanatoId;
|
||||
}
|
||||
private function GetAttendeesNameFromVCalendarString(string $vCalendarString): array
|
||||
@ -93,7 +96,7 @@ class GestionService {
|
||||
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||
$thanatoId = $this->GetOrCreateThanatoFromVCalendarString($vCalendarString);
|
||||
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
|
||||
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$calendarSummary);
|
||||
if($devisAlreadyCreated){
|
||||
return;
|
||||
@ -120,12 +123,6 @@ class GestionService {
|
||||
return $locationId;
|
||||
}
|
||||
|
||||
private function GetThanatoIdFromVCalendarString(string $vCalendarString){
|
||||
$thanatoValue = $this->GetValueFromKeyInVCalendarString("EMBALMER", $vCalendarString);
|
||||
$thanatoId = $this->gestionBdd->getLastThanatoIdByName($thanatoValue) ?? 0;
|
||||
return $thanatoId;
|
||||
}
|
||||
|
||||
private function GetArticlesNameFromVCalendarString(string $vCalendarString): array {
|
||||
$devisArticleValue = $this->GetValueFromKeyInVCalendarString("DESCRIPTION", $vCalendarString);
|
||||
$this->logger->debug('LIST OF ARTICLES',["" => $devisArticleValue]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user