fix calendar attendee (using default attendee behaviour, but considere attendee as thanato (checking in thanato if the name already exist, if not create the thanato related to the user)
This commit is contained in:
parent
d1de6d901e
commit
603ab0d6ff
@ -21590,19 +21590,35 @@ var render = function render() {
|
||||
},
|
||||
proxy: true
|
||||
}], null, false, 3695810495)
|
||||
}, [_vm._v(" "), _c("PropertySelectAjax", {
|
||||
staticClass: "property-embalmer",
|
||||
}, [_vm._v(" "), _c("div", {
|
||||
staticClass: "app-sidebar-tab__content"
|
||||
}, [!_vm.isLoading ? _c("InviteesList", {
|
||||
attrs: {
|
||||
url: "/apps/gestion/ajaxGetThanatopracteurs",
|
||||
"calendar-object-instance": _vm.calendarObjectInstance,
|
||||
"is-read-only": _vm.isReadOnly,
|
||||
"prop-model": _vm.rfcProps.embalmers,
|
||||
value: _vm.embalmer,
|
||||
"linkify-links": true
|
||||
"is-shared-with-me": _vm.isSharedWithMe,
|
||||
"show-header": false
|
||||
},
|
||||
on: {
|
||||
"update:value": _vm.updateEmbalmer
|
||||
"update-dates": _vm.updateDates
|
||||
}
|
||||
})], 1) : _vm._e(), _vm._v(" "), !_vm.isLoading && !_vm.isError && _vm.showResources ? _c("NcAppSidebarTab", {
|
||||
}) : _vm._e()], 1), _vm._v(" "), _vm.showSaveButtons ? _c("SaveButtons", {
|
||||
staticClass: "app-sidebar-tab__buttons",
|
||||
attrs: {
|
||||
"can-create-recurrence-exception": _vm.canCreateRecurrenceException,
|
||||
"is-new": _vm.isNew,
|
||||
isReadOnly: false,
|
||||
"force-this-and-all-future": _vm.forceThisAndAllFuture
|
||||
},
|
||||
on: {
|
||||
"save-this-only": function ($event) {
|
||||
return _vm.prepareAccessForAttachments(false);
|
||||
},
|
||||
"save-this-and-all-future": function ($event) {
|
||||
return _vm.prepareAccessForAttachments(true);
|
||||
}
|
||||
}
|
||||
}) : _vm._e()], 1) : _vm._e(), _vm._v(" "), !_vm.isLoading && !_vm.isError && _vm.showResources ? _c("NcAppSidebarTab", {
|
||||
staticClass: "app-sidebar-tab",
|
||||
attrs: {
|
||||
id: "app-sidebar-tab-resources",
|
||||
@ -309075,4 +309091,4 @@ appointmentsConfigsStore.addInitialConfigs((0,_nextcloud_initial_state__WEBPACK_
|
||||
|
||||
/******/ })()
|
||||
;
|
||||
//# sourceMappingURL=calendar-main.js.map?v=b371aebe0de86b72dc4d
|
||||
//# sourceMappingURL=calendar-main.js.map?v=69665488261a4dab61c2
|
||||
File diff suppressed because one or more lines are too long
@ -254,13 +254,22 @@
|
||||
<template #icon>
|
||||
<AccountMultiple :size="20" decorative />
|
||||
</template>
|
||||
<PropertySelectAjax class="property-embalmer"
|
||||
url="/apps/gestion/ajaxGetThanatopracteurs"
|
||||
:is-read-only="isReadOnly"
|
||||
:prop-model="rfcProps.embalmers"
|
||||
:value="embalmer"
|
||||
:linkify-links="true"
|
||||
@update:value="updateEmbalmer" />
|
||||
<div class="app-sidebar-tab__content">
|
||||
<InviteesList v-if="!isLoading"
|
||||
:calendar-object-instance="calendarObjectInstance"
|
||||
:is-read-only="isReadOnly"
|
||||
:is-shared-with-me="isSharedWithMe"
|
||||
:show-header="false"
|
||||
@update-dates="updateDates" />
|
||||
</div>
|
||||
<SaveButtons v-if="showSaveButtons"
|
||||
class="app-sidebar-tab__buttons"
|
||||
:can-create-recurrence-exception="canCreateRecurrenceException"
|
||||
:is-new="isNew"
|
||||
:isReadOnly="false"
|
||||
:force-this-and-all-future="forceThisAndAllFuture"
|
||||
@save-this-only="prepareAccessForAttachments(false)"
|
||||
@save-this-and-all-future="prepareAccessForAttachments(true)" />
|
||||
</NcAppSidebarTab>
|
||||
<NcAppSidebarTab v-if="!isLoading && !isError && showResources"
|
||||
id="app-sidebar-tab-resources"
|
||||
|
||||
@ -674,6 +674,10 @@ class Bdd {
|
||||
|
||||
public function insertDefuntByNameAndReturnId($name) {
|
||||
$this->insertDefuntByName($name);
|
||||
return $this->getLastDefuntIdByName($name);
|
||||
}
|
||||
|
||||
public function getLastDefuntIdByName( $name ) {
|
||||
$sql = "SELECT max(id) as LAST_INSERT_ID
|
||||
FROM ".$this->tableprefix."defunt
|
||||
WHERE nom = ?";
|
||||
@ -706,6 +710,27 @@ class Bdd {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getOrCreateThanatoIdByLastName($name){
|
||||
$thanatoId = $this->getLastThanatoIdByName($name);
|
||||
if($thanatoId == null){
|
||||
$this->createThanatoByLastName($name);
|
||||
$thanatoId = $this->getLastThanatoIdByName($name);
|
||||
}
|
||||
return $thanatoId;
|
||||
}
|
||||
|
||||
private function createThanatoByLastName($name){
|
||||
$idNextcloud = "admin";
|
||||
$sql = "INSERT INTO `".$this->tableprefix."thanato` (`id_nextcloud`,`nom`,`prenom`,`reference`,`date_habilitation`) VALUES (?,?,?,?,NOW())";
|
||||
$this->execSQLNoData($sql,array($idNextcloud,
|
||||
$name,
|
||||
$this->l->t('First name'),
|
||||
'reference',
|
||||
)
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getLastThanatoIdByName($name) {
|
||||
$sql = "SELECT max(id) as LAST_INSERT_ID
|
||||
FROM ".$this->tableprefix."thanato
|
||||
@ -774,6 +799,7 @@ class Bdd {
|
||||
}
|
||||
|
||||
public function insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId){
|
||||
|
||||
$idNextcloud = "admin";
|
||||
$last=0;
|
||||
$last = $this->lastinsertid("devis", "admin") + 1;
|
||||
@ -806,7 +832,7 @@ class Bdd {
|
||||
return $this->getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId);
|
||||
}
|
||||
|
||||
private function getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId){
|
||||
public function getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId){
|
||||
$sql = "SELECT max(id) as LAST_INSERT_ID
|
||||
FROM ".$this->tableprefix."devis
|
||||
WHERE id_defunt = ? AND id_lieu = ? AND id_client = ? AND id_thanato = ?";
|
||||
|
||||
@ -63,14 +63,42 @@ class GestionService {
|
||||
return $summaryValue;
|
||||
}
|
||||
|
||||
private function GetOrCreateThanatoFromVCalendarString(string $vCalendarString)
|
||||
{
|
||||
$thanatoName = "Nom du défunt";
|
||||
$thanatoNames = $this->GetAttendeesNameFromVCalendarString($vCalendarString);
|
||||
if(count($thanatoNames) > 0){
|
||||
$thanatoName = $thanatoNames[0];
|
||||
}
|
||||
$thanatoId = $this->gestionBdd->getOrCreateThanatoIdByLastName($thanatoName);
|
||||
return $thanatoId;
|
||||
}
|
||||
private function GetAttendeesNameFromVCalendarString(string $vCalendarString): array
|
||||
{
|
||||
$names = [];
|
||||
preg_match_all('/CN=([^;]+)/', $vCalendarString, $matches);
|
||||
if (isset($matches[1])) {
|
||||
$names = $matches[1];
|
||||
}
|
||||
return $names;
|
||||
}
|
||||
|
||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||
private function IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$defuntName){
|
||||
$defuntId = $this->gestionBdd->getLastDefuntIdByName($defuntName);
|
||||
$devisId = $this->gestionBdd->getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId);
|
||||
return $devisId != null;
|
||||
}
|
||||
|
||||
public function HandleCreatedCalendarObject(string $vCalendarString){
|
||||
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary);
|
||||
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||
$locationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);key:
|
||||
|
||||
$thanatoId = $this->GetOrCreateThanatoFromVCalendarString($vCalendarString);
|
||||
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId,$locationId,$thanatoId,$calendarSummary);
|
||||
if($devisAlreadyCreated){
|
||||
return;
|
||||
}
|
||||
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary);
|
||||
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId);
|
||||
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
||||
if(!empty($articlesValue)){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user