Merge branch 'fixes/fix-create-agenda-default-thanato' into staging
This commit is contained in:
commit
b0cf632d87
File diff suppressed because one or more lines are too long
@ -747,6 +747,17 @@ class Bdd {
|
|||||||
return null;
|
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
|
* Insert lieu
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -63,15 +63,18 @@ class GestionService {
|
|||||||
return $summaryValue;
|
return $summaryValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetOrCreateThanatoFromVCalendarString(string $vCalendarString)
|
private function GetThanatoIdFromVCalendarString(string $vCalendarString)
|
||||||
{
|
{
|
||||||
$thanatoName = "Nom du défunt";
|
$thanatoId = 0;
|
||||||
$thanatoNames = $this->GetAttendeesNameFromVCalendarString($vCalendarString);
|
$thanatoNames = $this->GetAttendeesNameFromVCalendarString($vCalendarString);
|
||||||
if(count($thanatoNames) > 0){
|
if(count($thanatoNames) > 0){
|
||||||
$thanatoName = $thanatoNames[0];
|
$thanatoName = $thanatoNames[0];
|
||||||
|
$thanatoIdFromDb = $this->gestionBdd->getFirstThanatoIdByName($thanatoName);
|
||||||
|
if($thanatoIdFromDb != null){
|
||||||
|
$thanatoId = $thanatoIdFromDb;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$thanatoId = $this->gestionBdd->getOrCreateThanatoIdByLastName($thanatoName);
|
return $thanatoId;
|
||||||
return $thanatoId;
|
|
||||||
}
|
}
|
||||||
private function GetAttendeesNameFromVCalendarString(string $vCalendarString): array
|
private function GetAttendeesNameFromVCalendarString(string $vCalendarString): array
|
||||||
{
|
{
|
||||||
@ -93,7 +96,7 @@ class GestionService {
|
|||||||
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||||
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||||
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||||
$thanatoId = $this->GetOrCreateThanatoFromVCalendarString($vCalendarString);
|
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
|
||||||
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$calendarSummary);
|
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$calendarSummary);
|
||||||
if($devisAlreadyCreated){
|
if($devisAlreadyCreated){
|
||||||
return;
|
return;
|
||||||
@ -120,12 +123,6 @@ class GestionService {
|
|||||||
return $locationId;
|
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 {
|
private function GetArticlesNameFromVCalendarString(string $vCalendarString): array {
|
||||||
$devisArticleValue = $this->GetValueFromKeyInVCalendarString("DESCRIPTION", $vCalendarString);
|
$devisArticleValue = $this->GetValueFromKeyInVCalendarString("DESCRIPTION", $vCalendarString);
|
||||||
$this->logger->debug('LIST OF ARTICLES',["" => $devisArticleValue]);
|
$this->logger->debug('LIST OF ARTICLES',["" => $devisArticleValue]);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user