insert trajet start for thanato (lieu name is the name of the thanato) when creating an agenda
This commit is contained in:
parent
3d573145ec
commit
8c58746ed7
@ -605,7 +605,8 @@ class Bdd {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertTrajetdetails_h2f($numtrajet, $date, $idNextcloud){
|
public function insertTrajetdetails_h2f($numtrajet, $date, $idNextcloud,$lieuSiege = "siege",$devisId = 0){
|
||||||
|
$lieuSiege = strtolower($lieuSiege);
|
||||||
$last=0;
|
$last=0;
|
||||||
$last = $this->lastinsertid("ligne_trajet", $idNextcloud) + 1;
|
$last = $this->lastinsertid("ligne_trajet", $idNextcloud) + 1;
|
||||||
|
|
||||||
@ -615,8 +616,8 @@ class Bdd {
|
|||||||
|
|
||||||
$trajetdetails = json_decode($this->getTrajetsdetails_orderByDate($numtrajet, $idNextcloud));
|
$trajetdetails = json_decode($this->getTrajetsdetails_orderByDate($numtrajet, $idNextcloud));
|
||||||
|
|
||||||
$sql_h2f = "SELECT * FROM ".$this->tableprefix."lieu WHERE LOWER(".$this->tableprefix."lieu.nom) LIKE 'siege';";
|
$sql_h2f = "SELECT * FROM ".$this->tableprefix."lieu WHERE LOWER(".$this->tableprefix."lieu.nom) = ?";
|
||||||
$response_h2f = $this->execSQL($sql_h2f, array());
|
$response_h2f = $this->execSQL($sql_h2f, array($lieuSiege));
|
||||||
$h2f = json_decode($response_h2f)[0];
|
$h2f = json_decode($response_h2f)[0];
|
||||||
|
|
||||||
$id_h2f = ($h2f!=NULL)?$h2f->id:0;
|
$id_h2f = ($h2f!=NULL)?$h2f->id:0;
|
||||||
@ -631,8 +632,8 @@ class Bdd {
|
|||||||
`source`,
|
`source`,
|
||||||
`user_id`
|
`user_id`
|
||||||
)
|
)
|
||||||
VALUES (?,?,0,?,?,?,'','siege',?);";
|
VALUES (?,?,?,?,?,?,'','siege',?);";
|
||||||
$this->execSQLNoData($sql, array($idNextcloud,$date,$id_h2f,$numtrajet,$rang+1,$last));
|
$this->execSQLNoData($sql, array($idNextcloud,$date,$devisId,$id_h2f,$numtrajet,$rang+1,$last));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1142,12 +1143,11 @@ class Bdd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createDevisTrajetFromVCalendar($devisId){
|
public function createDevisTrajetFromVCalendar($devisId,$idNextcloud = "admin"){
|
||||||
$idNextcloud = 'admin';
|
|
||||||
$devis = json_decode($this->getOneDevis($devisId, $idNextcloud))[0];
|
$devis = json_decode($this->getOneDevis($devisId, $idNextcloud))[0];
|
||||||
$this->generate_ligneTrajet($devis, $idNextcloud);
|
$this->generate_ligneTrajet($devis, $idNextcloud);
|
||||||
$ligne_trajet = json_decode($this->getOneTrajetdetails_byIdDevis($devis->devisid, $idNextcloud))[0];
|
$ligne_trajet = json_decode(json: $this->getOneTrajetdetails_byIdDevis($devis->devisid, $idNextcloud))[0];
|
||||||
$this->range_ligneTrajet($ligne_trajet->id_trajet, $idNextcloud);
|
$this->range_ligneTrajet($ligne_trajet->id_trajet, $idNextcloud,$devis->devisid);
|
||||||
$this->calculer_distance_trajet($ligne_trajet->id_trajet, $idNextcloud);
|
$this->calculer_distance_trajet($ligne_trajet->id_trajet, $idNextcloud);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1300,7 +1300,7 @@ class Bdd {
|
|||||||
* ranger les lignes de trajet dans un trajet par date et par rang
|
* ranger les lignes de trajet dans un trajet par date et par rang
|
||||||
* inserer ligne siege au debut et fin de chaque journee s'il n'existe pas
|
* inserer ligne siege au debut et fin de chaque journee s'il n'existe pas
|
||||||
*/
|
*/
|
||||||
public function range_ligneTrajet($id_trajet, $idNextcloud) {
|
public function range_ligneTrajet($id_trajet, $idNextcloud,$devisId = 0) {
|
||||||
$lignes = json_decode($this->getTrajetsdetails_orderByDate($id_trajet, $idNextcloud));
|
$lignes = json_decode($this->getTrajetsdetails_orderByDate($id_trajet, $idNextcloud));
|
||||||
$nb_jour = 0;
|
$nb_jour = 0;
|
||||||
if(sizeof($lignes)>0) {
|
if(sizeof($lignes)>0) {
|
||||||
@ -1308,7 +1308,7 @@ class Bdd {
|
|||||||
$dates = array(0=>$lignes[0]->date);
|
$dates = array(0=>$lignes[0]->date);
|
||||||
$date_temp = $lignes[0]->date;
|
$date_temp = $lignes[0]->date;
|
||||||
foreach ($lignes as $key => $ligne) {
|
foreach ($lignes as $key => $ligne) {
|
||||||
if(strcmp($date_temp, $ligne->date)!=0) {
|
if(strcmp($date_temp, string2: $ligne->date)!=0) {
|
||||||
$date_temp = $ligne->date;
|
$date_temp = $ligne->date;
|
||||||
array_push($dates, $date_temp);
|
array_push($dates, $date_temp);
|
||||||
$nb_jour++;
|
$nb_jour++;
|
||||||
@ -1318,7 +1318,7 @@ class Bdd {
|
|||||||
// on verifie si le nombre de ligne ets correspond à 2*nb_jour (debut et fin de journee)
|
// on verifie si le nombre de ligne ets correspond à 2*nb_jour (debut et fin de journee)
|
||||||
$reste = (2*$nb_jour) - (sizeof(array_filter($lignes, function($ligne) {return strcmp($ligne->source,'siege')==0;})));
|
$reste = (2*$nb_jour) - (sizeof(array_filter($lignes, function($ligne) {return strcmp($ligne->source,'siege')==0;})));
|
||||||
while ($reste>0) {
|
while ($reste>0) {
|
||||||
$this->insertTrajetdetails_h2f($id_trajet, $lignes[0]->date, $idNextcloud);
|
$this->insertTrajetdetails_h2f($id_trajet, $lignes[0]->date, $idNextcloud,$idNextcloud,$devisId);
|
||||||
$reste--;
|
$reste--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1899,8 +1899,8 @@ class Bdd {
|
|||||||
if(empty($thanatoIds)){
|
if(empty($thanatoIds)){
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$currentYear = date('Y');
|
$currentYear = '2025';
|
||||||
$currentMonth = date('m');
|
$currentMonth = '1';
|
||||||
|
|
||||||
$sqlConditionsPlaceholder = implode(',', array_fill(0, count($thanatoIds), '?'));
|
$sqlConditionsPlaceholder = implode(',', array_fill(0, count($thanatoIds), '?'));
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
|
|||||||
@ -67,8 +67,7 @@ class GestionService {
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//get from calendar object
|
//get from calendar object
|
||||||
$calendarUuid = VCalendarHelpers::GetValueFromKeyInVCalendarString("UID", $vCalendarString);
|
$organizerName = $this->getOrganizerNameFromVCalendarString($vCalendarString);
|
||||||
$organizerName = $this->gestionBdd->getCalendarOrganizerNameByCalendarObjectUuid($calendarUuid);
|
|
||||||
if($organizerName != null){
|
if($organizerName != null){
|
||||||
$thanatoIdFromDb = $this->gestionBdd->getFirstThanatoIdByName($organizerName);
|
$thanatoIdFromDb = $this->gestionBdd->getFirstThanatoIdByName($organizerName);
|
||||||
if($thanatoIdFromDb != null){
|
if($thanatoIdFromDb != null){
|
||||||
@ -78,6 +77,12 @@ class GestionService {
|
|||||||
}
|
}
|
||||||
return $thanatoId;
|
return $thanatoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getOrganizerNameFromVCalendarString(string $vCalendarString){
|
||||||
|
$calendarUuid = VCalendarHelpers::GetValueFromKeyInVCalendarString("UID", $vCalendarString);
|
||||||
|
$organizerName = $this->gestionBdd->getCalendarOrganizerNameByCalendarObjectUuid($calendarUuid);
|
||||||
|
return $organizerName;
|
||||||
|
}
|
||||||
private function GetAttendeesNameFromVCalendarString(string $vCalendarString): array
|
private function GetAttendeesNameFromVCalendarString(string $vCalendarString): array
|
||||||
{
|
{
|
||||||
$names = [];
|
$names = [];
|
||||||
@ -127,7 +132,8 @@ class GestionService {
|
|||||||
$articlesId = $this->gestionBdd->getArticlesIdFromArticlesNameArray($articlesValue);
|
$articlesId = $this->gestionBdd->getArticlesIdFromArticlesNameArray($articlesValue);
|
||||||
$this->gestionBdd->insertDevisArticleFromDevisIdAndArticlesIdArray($devisId, $articlesId);
|
$this->gestionBdd->insertDevisArticleFromDevisIdAndArticlesIdArray($devisId, $articlesId);
|
||||||
}
|
}
|
||||||
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId);
|
$organizerName = $this->getOrganizerNameFromVCalendarString($vCalendarString);
|
||||||
|
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId,$organizerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetClientIdFromVCalendarString(string $vCalendarString){
|
private function GetClientIdFromVCalendarString(string $vCalendarString){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user