Merge branch 'fixes/fix-calendar-attendee' into staging
This commit is contained in:
commit
a548bfc7f1
@ -21590,19 +21590,35 @@ var render = function render() {
|
|||||||
},
|
},
|
||||||
proxy: true
|
proxy: true
|
||||||
}], null, false, 3695810495)
|
}], null, false, 3695810495)
|
||||||
}, [_vm._v(" "), _c("PropertySelectAjax", {
|
}, [_vm._v(" "), _c("div", {
|
||||||
staticClass: "property-embalmer",
|
staticClass: "app-sidebar-tab__content"
|
||||||
|
}, [!_vm.isLoading ? _c("InviteesList", {
|
||||||
attrs: {
|
attrs: {
|
||||||
url: "/apps/gestion/ajaxGetThanatopracteurs",
|
"calendar-object-instance": _vm.calendarObjectInstance,
|
||||||
"is-read-only": _vm.isReadOnly,
|
"is-read-only": _vm.isReadOnly,
|
||||||
"prop-model": _vm.rfcProps.embalmers,
|
"is-shared-with-me": _vm.isSharedWithMe,
|
||||||
value: _vm.embalmer,
|
"show-header": false
|
||||||
"linkify-links": true
|
|
||||||
},
|
},
|
||||||
on: {
|
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",
|
staticClass: "app-sidebar-tab",
|
||||||
attrs: {
|
attrs: {
|
||||||
id: "app-sidebar-tab-resources",
|
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>
|
<template #icon>
|
||||||
<AccountMultiple :size="20" decorative />
|
<AccountMultiple :size="20" decorative />
|
||||||
</template>
|
</template>
|
||||||
<PropertySelectAjax class="property-embalmer"
|
<div class="app-sidebar-tab__content">
|
||||||
url="/apps/gestion/ajaxGetThanatopracteurs"
|
<InviteesList v-if="!isLoading"
|
||||||
:is-read-only="isReadOnly"
|
:calendar-object-instance="calendarObjectInstance"
|
||||||
:prop-model="rfcProps.embalmers"
|
:is-read-only="isReadOnly"
|
||||||
:value="embalmer"
|
:is-shared-with-me="isSharedWithMe"
|
||||||
:linkify-links="true"
|
:show-header="false"
|
||||||
@update:value="updateEmbalmer" />
|
@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>
|
||||||
<NcAppSidebarTab v-if="!isLoading && !isError && showResources"
|
<NcAppSidebarTab v-if="!isLoading && !isError && showResources"
|
||||||
id="app-sidebar-tab-resources"
|
id="app-sidebar-tab-resources"
|
||||||
|
|||||||
@ -674,6 +674,10 @@ class Bdd {
|
|||||||
|
|
||||||
public function insertDefuntByNameAndReturnId($name) {
|
public function insertDefuntByNameAndReturnId($name) {
|
||||||
$this->insertDefuntByName($name);
|
$this->insertDefuntByName($name);
|
||||||
|
return $this->getLastDefuntIdByName($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLastDefuntIdByName( $name ) {
|
||||||
$sql = "SELECT max(id) as LAST_INSERT_ID
|
$sql = "SELECT max(id) as LAST_INSERT_ID
|
||||||
FROM ".$this->tableprefix."defunt
|
FROM ".$this->tableprefix."defunt
|
||||||
WHERE nom = ?";
|
WHERE nom = ?";
|
||||||
@ -706,6 +710,27 @@ class Bdd {
|
|||||||
return null;
|
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) {
|
public function getLastThanatoIdByName($name) {
|
||||||
$sql = "SELECT max(id) as LAST_INSERT_ID
|
$sql = "SELECT max(id) as LAST_INSERT_ID
|
||||||
FROM ".$this->tableprefix."thanato
|
FROM ".$this->tableprefix."thanato
|
||||||
@ -774,6 +799,7 @@ class Bdd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId){
|
public function insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId){
|
||||||
|
|
||||||
$idNextcloud = "admin";
|
$idNextcloud = "admin";
|
||||||
$last=0;
|
$last=0;
|
||||||
$last = $this->lastinsertid("devis", "admin") + 1;
|
$last = $this->lastinsertid("devis", "admin") + 1;
|
||||||
@ -806,7 +832,7 @@ class Bdd {
|
|||||||
return $this->getLastDevisIdFromVCalendarProperty($thanatoId,$clientId,$locationId,$defuntId);
|
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
|
$sql = "SELECT max(id) as LAST_INSERT_ID
|
||||||
FROM ".$this->tableprefix."devis
|
FROM ".$this->tableprefix."devis
|
||||||
WHERE id_defunt = ? AND id_lieu = ? AND id_client = ? AND id_thanato = ?";
|
WHERE id_defunt = ? AND id_lieu = ? AND id_client = ? AND id_thanato = ?";
|
||||||
|
|||||||
@ -63,14 +63,42 @@ class GestionService {
|
|||||||
return $summaryValue;
|
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);
|
$calendarSummary = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||||
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary);
|
|
||||||
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
$clientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||||
$locationId = $this->GetLocationIdFromVCalendarString($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);
|
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId,$clientId,$locationId,$defuntId);
|
||||||
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
$articlesValue = $this->GetArticlesNameFromVCalendarString($vCalendarString);
|
||||||
if(!empty($articlesValue)){
|
if(!empty($articlesValue)){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user