Compare commits

..

No commits in common. "a027f5928ac33d586ad98b2ea7f35bd5570a5c29" and "ce18ebdb9a60c4f6c54ee63a50e9e76fbd512c92" have entirely different histories.

34 changed files with 378 additions and 762 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -26,8 +26,8 @@
:class="{ 'property-title__input--readonly': isReadOnly }">
<input v-if="!isReadOnly"
v-focus
:type="type"
:placeholder="computedPlaceholder"
type="text"
:placeholder="t('calendar', 'Nom et prénom du défunt')"
:value="value"
@input.prevent.stop="changeValue">
<!-- eslint-disable-next-line vue/singleline-html-element-content-newline -->
@ -53,19 +53,6 @@ export default {
type: String,
default: '',
},
type: {
type: String,
default: 'text',
},
placeholder: {
type: String,
default: '',
},
},
computed: {
computedPlaceholder() {
return this.placeholder || this.t('calendar', 'Nom et prénom du défunt')
},
},
methods: {
changeValue(event) {

View File

@ -118,14 +118,6 @@ export default {
return this.calendarObjectInstance?.embalmer ?? null
},
lieuDeces() {
return this.calendarObjectInstance?.lieuDeces ?? null
},
dateNaissance() {
return this.calendarObjectInstance?.dateNaissance ?? null
},
/**
* Returns the isleave property
*
@ -163,6 +155,7 @@ export default {
return this.calendarObjectInstance?.isPrivate ?? false
},
/**
* Returns the description or null if the event is still loading
*
@ -456,23 +449,23 @@ export default {
return false
},
/**
* Returns the absence type
*
* @return {string|null}
*/
absenceType() {
const isleave = this.calendarObjectInstance?.isLeave ?? false
const isleave = this.calendarObjectInstance?.isLeave ?? false
const absenceType = this.calendarObjectInstance?.absenceType ?? null
if (absenceType) {
return this.calendarObjectInstance?.absenceType
}
if (isleave && !absenceType) {
return 'LEAVE'
if (isleave && !absenceType ) {
return 'LEAVE'
}
return ''
return '';
},
},
methods: {
@ -590,7 +583,7 @@ export default {
this.isLoading = true
this.isSaving = true
try {
this.setPendingCalendar(false)
this.setPendingCalendar(false);
await this.$store.dispatch('saveCalendarObjectInstance', {
thisAndAllFuture,
calendarId: this.calendarId,
@ -608,6 +601,8 @@ export default {
setPendingCalendar(isPending = true) {
this.calendarObjectInstance.eventComponent.isCalendarPending = isPending
this.calendarObjectInstance.isCalendarPending = isPending
},
async savePendingCalendar(thisAndAllFuture = false) {
if (!this.calendarObject) {
@ -625,7 +620,7 @@ export default {
this.isSaving = true
try {
this.setPendingCalendar();
await this.$store.dispatch('saveCalendarObjectInstance', {
await this.$store.dispatch('saveCalendarObjectInstance', {
thisAndAllFuture,
calendarId: this.calendarId,
})
@ -766,6 +761,7 @@ export default {
embalmer,
})
},
/**
* Updates the start date of this event
@ -831,7 +827,7 @@ export default {
toggleIsPrivate(isPrivate) {
this.$store.commit('toggleIsPrivate', {
calendarObjectInstance: this.calendarObjectInstance,
isPrivate,
isPrivate
})
},
@ -839,23 +835,23 @@ export default {
// * Toggles the event between all-day and timed
// */
// toggleIsLeave(isLeave) {
// this.$store.commit('toggleIsLeave', {
// calendarObjectInstance: this.calendarObjectInstance,
// isLeave
// })
// this.$store.commit('toggleIsLeave', {
// calendarObjectInstance: this.calendarObjectInstance,
// isLeave
// })
// },
/**
* Toggles the event pending
* @param isCalendarPending
*/
toggleIsCalendarPending(isCalendarPending) {
this.$store.commit('toggleIsCalendarPending', {
calendarObjectInstance: this.calendarObjectInstance,
isCalendarPending,
isCalendarPending
})
},
/**
* Resets the internal state after changing the viewed calendar-object
*/
@ -899,31 +895,7 @@ export default {
calendarObjectInstance: this.calendarObjectInstance,
absenceType,
})
},
/**
* Updates the lieu de décès of this event
*
* @param {string} lieuDeces New lieu de décès
*/
updateLieuDeces(lieuDeces) {
this.$store.commit('changeLieuDeces', {
calendarObjectInstance: this.calendarObjectInstance,
lieuDeces,
})
},
/**
* Updates the date de naissance of this event
*
* @param {string} dateNaissance New date de naissance
*/
updateDateNaissance(dateNaissance) {
this.$store.commit('changeDateNaissance', {
calendarObjectInstance: this.calendarObjectInstance,
dateNaissance,
})
},
}
},
/**
* This is executed before entering the Editor routes

View File

@ -21,7 +21,7 @@
*/
import { getDateFromDateTimeValue } from '../utils/date.js'
import { DurationValue, DateTimeValue, Property } from '@nextcloud/calendar-js'
import { DurationValue, DateTimeValue } from '@nextcloud/calendar-js'
import { getHexForColorName, getClosestCSS3ColorNameForHex } from '../utils/color.js'
import { mapAlarmComponentToAlarmObject } from './alarm.js'
import { mapAttendeePropertyToAttendeeObject } from './attendee.js'
@ -52,28 +52,24 @@ const getDefaultEventObject = (props = {}) => Object.assign({}, {
endTimezoneId: null,
// Indicator whether or not event is all-day
isAllDay: false,
// leave
//leave
isLeave: false,
// calendarPending
//calendarPending
isCalendarPending: false,
// Whether or not the user is allowed to toggle the all-day checkbox
canModifyAllDay: true,
// Location that the event takes places in
location: null,
// client of the event
client: null,
// embalmer(Thanato) of the event
embalmer: null,
// lieu de décès
lieuDeces: null,
// date de naissance
dateNaissance: null,
// absenceType
absenceType: null,
// Private
//client of the event
client : null,
//embalmer(Thanato) of the event
embalmer : null,
//absenceType
absenceType : null,
//Private
isPrivate: false,
// comment of the event
comment: null,
//comment of the event
comment : null,
// description of the event
description: null,
// Access class of the event (PUBLIC, PRIVATE, CONFIDENTIAL)
@ -122,12 +118,10 @@ const mapEventComponentToEventObject = (eventComponent) => {
isCalendarPending: false,
canModifyAllDay: eventComponent.canModifyAllDay(),
location: eventComponent.location,
client: 'CLIENT',
embalmer: 'TEST',
lieuDeces: null,
dateNaissance: null,
absenceType: '',
comment: '',
client : "CLIENT",
embalmer : "TEST",
absenceType : "",
comment : "",
description: eventComponent.description,
accessClass: eventComponent.accessClass,
status: eventComponent.status,
@ -213,46 +207,39 @@ const mapEventComponentToEventObject = (eventComponent) => {
}
}
if (eventComponent.hasProperty('CLIENT')) {
eventObject.client = eventComponent.getFirstPropertyFirstValue('CLIENT')
if(eventComponent.hasProperty('CLIENT')){
eventObject.client = eventComponent.getFirstPropertyFirstValue('CLIENT');
}
if (eventComponent.hasProperty('EMBALMER')) {
eventObject.embalmer = eventComponent.getFirstPropertyFirstValue('EMBALMER')
if(eventComponent.hasProperty('EMBALMER')){
eventObject.embalmer = eventComponent.getFirstPropertyFirstValue('EMBALMER');
}
if (eventComponent.hasProperty('COMMENT')) {
eventObject.comment = eventComponent.getFirstPropertyFirstValue('COMMENT')
if(eventComponent.hasProperty('COMMENT')){
eventObject.comment = eventComponent.getFirstPropertyFirstValue('COMMENT');
}
if (eventComponent.hasProperty('ISPRIVATE')) {
eventObject.isPrivate = eventComponent.getFirstPropertyFirstValue('ISPRIVATE') === '1'
if(eventComponent.hasProperty('ISPRIVATE')){
eventObject.isPrivate = eventComponent.getFirstPropertyFirstValue('ISPRIVATE') === '1' ? true : false;
}
if (eventComponent.hasProperty('ABSENCETYPE')) {
eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE')
} else {
if (eventComponent.hasProperty('ISLEAVE')) {
if (eventComponent.getFirstPropertyFirstValue('ISLEAVE') === '1') {
eventObject.absenceType = 'LEAVE'
if(eventComponent.hasProperty('ABSENCETYPE')){
eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE');
}else{
if(eventComponent.hasProperty('ISLEAVE')){
if( eventComponent.getFirstPropertyFirstValue('ISLEAVE') === '1'){
eventObject.absenceType = 'LEAVE';
}
}
}
if (eventComponent.hasProperty('ISCALENDARPENDING')) {
eventObject.isCalendarPending = eventComponent.getFirstPropertyFirstValue('ISCALENDARPENDING') === '1'
if(eventComponent.hasProperty('ISCALENDARPENDING')){
eventObject.isCalendarPending = eventComponent.getFirstPropertyFirstValue('ISCALENDARPENDING') === '1' ? true : false;
}
if (eventComponent.hasProperty('LIEUDECES')) {
eventObject.lieuDeces = eventComponent.getFirstPropertyFirstValue('LIEUDECES')
}
if (eventComponent.hasProperty('DATENAISSANCE')) {
eventObject.dateNaissance = eventComponent.getFirstPropertyFirstValue('DATENAISSANCE')
}
return eventObject
return eventObject;
}
/**
@ -266,20 +253,6 @@ const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponen
eventComponent.location = eventObject.location
eventComponent.client = eventObject.client
eventComponent.embalmer = eventObject.embalmer
if (eventObject.lieuDeces) {
eventComponent.deleteAllProperties('LIEUDECES')
const lieuDecesProperty = new Property('LIEUDECES', eventObject.lieuDeces)
eventComponent.addProperty(lieuDecesProperty)
}
// Gérer dateNaissance comme une propriété ICS personnalisée
if (eventObject.dateNaissance) {
eventComponent.deleteAllProperties('DATENAISSANCE')
const dateNaissanceProperty = new Property('DATENAISSANCE', eventObject.dateNaissance)
eventComponent.addProperty(dateNaissanceProperty)
}
eventComponent.isPrivate = eventObject.isPrivate
eventComponent.isCalendarPending = eventObject.isCalendarPending
eventComponent.comment = eventObject.comment

View File

@ -22,6 +22,7 @@
import { translate as t } from '@nextcloud/l10n'
import { getDefaultCategories } from '../defaults/defaultCategories.js'
/**
* Gets all supported RFC properties
*
@ -145,7 +146,7 @@ const getRFCProperties = () => {
readableName: t('calendar', 'Type d\'absence'),
placeholder: t('calendar', 'Type d\'absence'),
},
embalmers: {
readableName: t('calendar', 'Embalmers'),
icon: 'Human',
@ -156,6 +157,7 @@ const getRFCProperties = () => {
tagPlaceholder: t('calendar', 'Choose thanatopracteur'),
options: [],
},
embalmer: {
readableName: t('calendar', 'Embalmer'),
@ -181,21 +183,7 @@ const getRFCProperties = () => {
placeholder: t('calendar', 'Commentaires'),
tagPlaceholder: t('calendar', 'Commentaires'),
options: [],
defaultNumberOfRows: 4,
},
lieuDeces: {
readableName: t('calendar', 'Lieu du décès'),
placeholder: t('calendar', 'Lieu du décès'),
icon: 'MapMarker',
type: 'text',
},
dateNaissance: {
readableName: t('calendar', 'Date de naissance'),
placeholder: t('calendar', 'Date de naissance'),
icon: 'Tag',
type: 'date',
defaultNumberOfRows: 4
},
}
}

View File

@ -285,14 +285,13 @@ const mutations = {
calendarObjectInstance.eventComponent.endDate.addDuration(DurationValue.fromSeconds(60 * 60 * 24))
}
},
/**
* Is private
*
* @param {object} state The Vuex state
* @param {object} data The destructuring object
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
* @param data.isPrivate
*/
toggleIsPrivate(state, { calendarObjectInstance, isPrivate }) {
calendarObjectInstance.eventComponent.isPrivate = isPrivate
@ -404,40 +403,6 @@ const mutations = {
calendarObjectInstance.embalmer = embalmer
},
/**
* Change the lieu de décès of an event
*
* @param {object} state The Vuex state
* @param {object} data The destructuring object
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
* @param {string} data.lieuDeces New lieu de décès to set
*/
changeLieuDeces(state, { calendarObjectInstance, lieuDeces }) {
calendarObjectInstance.eventComponent.deleteAllProperties('LIEUDECES')
if (lieuDeces && lieuDeces.trim() !== '') {
const lieuDecesProperty = new Property('LIEUDECES', lieuDeces)
calendarObjectInstance.eventComponent.addProperty(lieuDecesProperty)
}
calendarObjectInstance.lieuDeces = lieuDeces
},
/**
* Change the date de naissance of an event
*
* @param {object} state The Vuex state
* @param {object} data The destructuring object
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
* @param {string} data.dateNaissance New date de naissance to set
*/
changeDateNaissance(state, { calendarObjectInstance, dateNaissance }) {
calendarObjectInstance.eventComponent.deleteAllProperties('DATENAISSANCE')
if (dateNaissance && dateNaissance.trim() !== '') {
const dateNaissanceProperty = new Property('DATENAISSANCE', dateNaissance)
calendarObjectInstance.eventComponent.addProperty(dateNaissanceProperty)
}
calendarObjectInstance.dateNaissance = dateNaissance
},
/**
* Change the absence type of an event
*
@ -445,7 +410,6 @@ const mutations = {
* @param {object} data The destructuring object
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
* @param {string} data.embalmer New embalmer to set
* @param data.absenceType
*/
changeAbsenceType(state, { calendarObjectInstance, absenceType }) {
calendarObjectInstance.eventComponent.absenceType = absenceType ?? null
@ -1822,14 +1786,12 @@ const actions = {
let client = eventComponent.client;
let additionalFieldWasUpdated =
eventComponent.client != null ||
eventComponent.client != null ||
eventComponent.isPrivate != null ||
eventComponent.comment != null ||
eventComponent.isLeave != null ||
eventComponent.absenceType ||
eventComponent.isCalendarPending != null ||
state.calendarObjectInstance.lieuDeces != null ||
state.calendarObjectInstance.dateNaissance != null;
eventComponent.absenceType ||
eventComponent.isCalendarPending != null;
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
const isForkedItem = eventComponent.primaryItem !== null
let original = null

View File

@ -101,29 +101,8 @@
@update-start-timezone="updateStartTimezone"
@update-end-date="updateEndDate"
@update-end-timezone="updateEndTimezone"
@toggle-all-day="toggleAllDay" />
@toggle-all-day="toggleAllDay"/>
<!-- Lieu du décès - plus petit -->
<PropertyTitle class="property-lieu-deces property-small property-spaced"
:is-read-only="isReadOnly"
:prop-model="rfcProps.lieuDeces"
:value="lieuDeces"
:placeholder="'Lieu du décès'"
type="text"
@update:value="updateLieuDeces" />
<!-- Date de naissance avec libellé -->
<div class="field-with-label">
<label class="field-label">Date de naissance</label>
<PropertyTitle class="property-date-naissance property-small"
:is-read-only="isReadOnly"
:prop-model="rfcProps.dateNaissance"
:value="dateNaissance"
:placeholder="'Date de naissance'"
type="date"
title="Saisissez la date de naissance du défunt"
@update:value="updateDateNaissance" />
</div>
<div style='margin-top: 13px; display:flex ;width: 81%;'>
<div style='width:100%'>
@ -910,26 +889,4 @@ export default {
padding: 0 20px;
}
}
.property-small {
max-width: 250px;
}
.field-with-label {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 10px;
}
.field-label {
font-weight: 500;
font-size: 14px;
color: #333;
margin-bottom: 2px;
}
.property-spaced {
margin-top: 15px;
}
</style>

View File

@ -22,13 +22,15 @@
-->
<template>
<Popover ref="popover"
<Popover
ref="popover"
:shown="showPopover"
:auto-hide="false"
:placement="placement"
:boundary="boundaryElement"
popover-base-class="event-popover"
:triggers="[]">
:triggers="[]"
>
<div class="event-popover__inner">
<template v-if="isLoading && !isSaving">
<PopoverLoadingIndicator />
@ -46,8 +48,10 @@
</Actions>
</div>
<EmptyContent :name="$t('calendar', 'Event does not exist')"
:description="error">
<EmptyContent
:name="$t('calendar', 'Event does not exist')"
:description="error"
>
<template #icon>
<CalendarBlank :size="20" decorative />
</template>
@ -57,22 +61,28 @@
<template v-else>
<div class="event-popover__top-right-actions">
<Actions v-if="!isLoading && !isError && !isNew" :force-menu="true">
<ActionLink v-if="!hideEventExport && hasDownloadURL"
:href="downloadURL">
<ActionLink
v-if="!hideEventExport && hasDownloadURL"
:href="downloadURL"
>
<template #icon>
<Download :size="20" decorative />
</template>
{{ $t("calendar", "Export") }}
</ActionLink>
<ActionButton v-if="!canCreateRecurrenceException && !isReadOnly"
@click="duplicateEvent()">
<ActionButton
v-if="!canCreateRecurrenceException && !isReadOnly"
@click="duplicateEvent()"
>
<template #icon>
<ContentDuplicate :size="20" decorative />
</template>
{{ $t("calendar", "Duplicate") }}
</ActionButton>
<ActionButton v-if="canDelete && !canCreateRecurrenceException"
@click="deleteAndLeave(false)">
<ActionButton
v-if="canDelete && !canCreateRecurrenceException"
@click="deleteAndLeave(false)"
>
<template #icon>
<Delete :size="20" decorative />
</template>
@ -107,163 +117,160 @@
</Actions>
</div>
<!-- Zone de contenu scrollable -->
<div class="popover-content-wrapper">
<CalendarPickerHeader :value="selectedCalendar"
:calendars="calendars"
:is-read-only="isReadOnlyOrViewing || !canModifyCalendar"
@update:value="changeCalendar" />
<CalendarPickerHeader
:value="selectedCalendar"
:calendars="calendars"
:is-read-only="isReadOnlyOrViewing || !canModifyCalendar"
@update:value="changeCalendar"
/>
<PropertyTitle :value="titleOrPlaceholder"
:is-read-only="isReadOnlyOrViewing"
@update:value="updateTitle" />
<PropertyTitle
:value="titleOrPlaceholder"
:is-read-only="isReadOnlyOrViewing"
@update:value="updateTitle"
/>
<PropertyTitleTimePicker :start-date="startDate"
:start-timezone="startTimezone"
:end-date="endDate"
:end-timezone="endTimezone"
:is-all-day="isAllDay"
:is-read-only="isReadOnlyOrViewing"
:can-modify-all-day="canModifyAllDay"
:user-timezone="currentUserTimezone"
@update-start-date="updateStartDate"
@update-start-timezone="updateStartTimezone"
@update-end-date="updateEndDate"
@update-end-timezone="updateEndTimezone"
@toggle-all-day="toggleAllDay" />
<PropertyTitleTimePicker
:start-date="startDate"
:start-timezone="startTimezone"
:end-date="endDate"
:end-timezone="endTimezone"
:is-all-day="isAllDay"
:is-read-only="isReadOnlyOrViewing"
:can-modify-all-day="canModifyAllDay"
:user-timezone="currentUserTimezone"
@update-start-date="updateStartDate"
@update-start-timezone="updateStartTimezone"
@update-end-date="updateEndDate"
@update-end-timezone="updateEndTimezone"
@toggle-all-day="toggleAllDay"
/>
<!-- Lieu du décès - plus petit -->
<PropertyTitle class="property-lieu-deces property-small"
:is-read-only="isReadOnly"
:prop-model="rfcProps.lieuDeces"
:value="lieuDeces"
:placeholder="'Lieu du décès'"
type="text"
@update:value="updateLieuDeces" />
<!-- Date de naissance avec libellé -->
<div class="field-with-label">
<label class="field-label">Date de naissance</label>
<PropertyTitle class="property-date-naissance property-small"
<div style='display:flex ;margin-left: 7%;'>
<div style='width:70%'>
<PropertySelectAbsenceType
:value="absenceType"
:is-read-only="isReadOnly"
:prop-model="rfcProps.dateNaissance"
:value="dateNaissance"
:placeholder="'Date de naissance'"
type="date"
title="Saisissez la date de naissance du défunt"
@update:value="updateDateNaissance" />
:prop-model="rfcProps.absenceType"
:noWrap='true'
sle
@update:value="updateAbsenceType" />
</div>
<div style='display:flex ;margin-left: 7%;'>
<div style='width:70%'>
<PropertySelectAbsenceType
:value="absenceType"
:is-read-only="isReadOnly"
:prop-model="rfcProps.absenceType"
:noWrap='true'
sle
@update:value="updateAbsenceType" />
</div>
</div>
<PropertySelectClient
class="property-location"
url="/apps/gestion/ajaxGetClientsName"
<!-- <div style='width:30% ;margin-top: -11px;'>
<PropertyIsPrivate
:is-read-only="isReadOnly"
:prop-model="rfcProps.clients"
:value="client"
:linkify-links="true"
@update:value="updateClient"
/>
<PropertySelectLieu
class="property-location"
url="/apps/gestion/ajaxGetLieux"
:is-read-only="isReadOnly"
:prop-model="rfcProps.locations"
:value="location"
:linkify-links="true"
@update:value="updateLocation"
/>
<PropertySelectArticle
:is-read-only="isReadOnlyOrViewing"
url="/apps/gestion/ajaxGetProduits?orderDirection=ASC"
:prop-model="rfcProps.articles"
:value="description"
:linkify-links="true"
@add-single-value="addArticle"
@remove-single-value="removeArticle"
/>
<PropertyText
:is-read-only="isReadOnly"
:prop-model="rfcProps.comment"
:value="comment"
:linkify-links="false"
@update:value="updateComment"
/>
<InviteesList
class="event-popover__invitees"
:hide-if-empty="true"
:hide-buttons="true"
:hide-errors="true"
:show-header="true"
:is-read-only="isReadOnlyOrViewing"
:is-shared-with-me="isSharedWithMe"
:calendar-object-instance="calendarObjectInstance"
:limit="3"
/>
<InvitationResponseButtons
v-if="isViewedByAttendee && isViewing"
class="event-popover__response-buttons"
:attendee="userAsAttendee"
:calendar-id="calendarId"
@close="closeEditorAndSkipAction"
/>
:is-private="isPrivate"
@toggle-is-private="toggleIsPrivate"/>
</div> -->
</div>
<!-- Zone des boutons fixes -->
<div class="popover-buttons-wrapper">
<SaveButtons
v-if="!isWidget"
class="event-popover__buttons"
:can-create-recurrence-exception="canCreateRecurrenceException"
:is-new="isNew"
:is-read-only="isReadOnlyOrViewing"
:force-this-and-all-future="forceThisAndAllFuture"
:show-more-button="true"
:more-button-type="isViewing ? 'tertiary' : undefined"
:grow-horizontally="!isViewing && canCreateRecurrenceException"
:disabled="isSaving"
:is-calendar-pending="isCalendarPending"
@save-this-only="saveAndView(false)"
@save-this-and-all-future="saveAndView(true)"
@show-more="showMore"
@save-pending-calendar-event="saveAsPendingCalendarEvent"
<!-- <PropertyIsLeave
:is-read-only="isReadOnlyOrViewing"
:is-leave="isLeave"
@toggle-is-leave="toggleIsLeave"
/> -->
<!-- <PropertyIsCalendarPending
:is-read-only="isReadOnlyOrViewing"
:is-calendar-pending="isCalendarPending"
@toggle-is-calendar-pending="toggleIsCalendarPending" /> -->
<PropertySelectClient
class="property-location"
url="/apps/gestion/ajaxGetClientsName"
:is-read-only="isReadOnly"
:prop-model="rfcProps.clients"
:value="client"
:linkify-links="true"
@update:value="updateClient"
/>
<PropertySelectLieu
class="property-location"
url="/apps/gestion/ajaxGetLieux"
:is-read-only="isReadOnly"
:prop-model="rfcProps.locations"
:value="location"
:linkify-links="true"
@update:value="updateLocation"
/>
<PropertySelectArticle
:is-read-only="isReadOnlyOrViewing"
url="/apps/gestion/ajaxGetProduits?orderDirection=ASC"
:prop-model="rfcProps.articles"
:value="description"
:linkify-links="true"
@add-single-value="addArticle"
@remove-single-value="removeArticle"
/>
<PropertyText
:is-read-only="isReadOnly"
:prop-model="rfcProps.comment"
:value="comment"
:linkify-links="false"
@update:value="updateComment"
/>
<InviteesList
class="event-popover__invitees"
:hide-if-empty="true"
:hide-buttons="true"
:hide-errors="true"
:show-header="true"
:is-read-only="isReadOnlyOrViewing"
:is-shared-with-me="isSharedWithMe"
:calendar-object-instance="calendarObjectInstance"
:limit="3"
/>
<InvitationResponseButtons
v-if="isViewedByAttendee && isViewing"
class="event-popover__response-buttons"
:attendee="userAsAttendee"
:calendar-id="calendarId"
@close="closeEditorAndSkipAction"
/>
<SaveButtons
v-if="!isWidget"
class="event-popover__buttons"
:can-create-recurrence-exception="canCreateRecurrenceException"
:is-new="isNew"
:is-read-only="isReadOnlyOrViewing"
:force-this-and-all-future="forceThisAndAllFuture"
:show-more-button="true"
:more-button-type="isViewing ? 'tertiary' : undefined"
:grow-horizontally="!isViewing && canCreateRecurrenceException"
:disabled="isSaving"
:is-calendar-pending="isCalendarPending"
@save-this-only="saveAndView(false)"
@save-this-and-all-future="saveAndView(true)"
@show-more="showMore"
@save-pending-calendar-event="saveAsPendingCalendarEvent"
>
<NcButton
@click="viewDefunt"
v-if="defuntUrl"
:type="undefined"
:class="'d-flex w-max-content'"
>
<NcButton
@click="viewDefunt"
v-if="defuntUrl"
:type="undefined"
:class="'d-flex w-max-content'"
>
Voir le defunt
</NcButton>
<NcButton
v-if="!isReadOnly && isViewing"
:type="isViewedByAttendee ? 'tertiary' : undefined"
@click="isViewing = false"
>
<template #icon>
<EditIcon :size="20" />
</template>
{{ $t("calendar", "Edit") }}
</NcButton>
</SaveButtons>
</div>
Voir le defunt
</NcButton>
<NcButton
v-if="!isReadOnly && isViewing"
:type="isViewedByAttendee ? 'tertiary' : undefined"
@click="isViewing = false"
>
<template #icon>
<EditIcon :size="20" />
</template>
{{ $t("calendar", "Edit") }}
</NcButton>
</SaveButtons>
</template>
</div>
</Popover>
@ -290,7 +297,7 @@ import InvitationResponseButtons from "../components/Editor/InvitationResponseBu
import CalendarPickerHeader from "../components/Editor/CalendarPickerHeader.vue";
import InviteesList from "../components/Editor/Invitees/InviteesList.vue";
import CalendarBlank from 'vue-material-design-icons/CalendarBlank.vue';
import CalendarBlank from "vue-material-design-icons/CalendarBlank.vue";
import Close from "vue-material-design-icons/Close.vue";
import Delete from "vue-material-design-icons/Delete.vue";
import Download from "vue-material-design-icons/Download.vue";
@ -354,7 +361,7 @@ export default {
boundaryElement: null,
isVisible: true,
isViewing: true,
defuntUrl: undefined
defuntUrl: undefined,
};
},
computed: {
@ -600,148 +607,7 @@ export default {
},
viewDefunt() {
window.open(this.defuntUrl, "_blank");
}
},
},
};
</script>
<style scoped>
.property-small {
max-width: 250px;
}
.field-with-label {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 10px;
}
.field-label {
font-weight: 500;
font-size: 14px;
color: #333;
margin-bottom: 2px;
}
/* Structure du popover - CSS SCOPED */
:deep(.event-popover) {
max-height: calc(100vh - 80px) !important;
min-width: 500px !important;
display: flex !important;
flex-direction: column !important;
left: 50% !important;
transform: translateX(-50%) !important;
}
:deep(.event-popover__inner) {
display: flex !important;
flex-direction: column !important;
height: 100% !important;
max-height: calc(100vh - 80px) !important;
overflow: hidden !important;
}
/* Zone de contenu scrollable */
.popover-content-wrapper {
flex: 1 1 auto !important;
overflow-y: auto !important;
padding: 15px !important;
min-height: 0 !important;
}
/* Zone des boutons fixes */
.popover-buttons-wrapper {
flex: 0 0 auto !important;
border-top: 1px solid #e0e0e0 !important;
background: white !important;
padding: 15px !important;
margin: 0 !important;
position: relative !important;
bottom: 0 !important;
width: 100% !important;
box-shadow: 0 -2px 8px rgba(0,0,0,0.1) !important;
z-index: 1000 !important;
}
:deep(.event-popover__buttons) {
margin: 0 !important;
padding: 0 !important;
}
</style>
<!-- CSS GLOBAL pour forcer absolument tout -->
<style>
/* CSS GLOBAL - SOLUTION BRUTALE POUR FORCER */
.event-popover {
max-height: calc(100vh - 80px) !important;
min-width: 500px !important;
max-width: calc(100vw - 350px) !important; /* Évite le débordement à droite */
display: flex !important;
flex-direction: column !important;
/* Forcer le positionnement pour éviter les débordements */
position: fixed !important;
top: auto !important;
bottom: auto !important;
left: 320px !important; /* Position fixe après la sidebar */
right: auto !important;
z-index: 10000 !important;
}
/* S'assurer que le popover ne sort jamais de l'écran */
.event-popover[data-popper-placement] {
left: 320px !important;
right: auto !important;
max-width: calc(100vw - 350px) !important;
}
/* Si pas assez d'espace à droite, positionner à gauche de la sidebar */
@media (max-width: 1200px) {
.event-popover {
left: 20px !important;
max-width: 280px !important;
}
}
.event-popover .event-popover__inner {
display: flex !important;
flex-direction: column !important;
height: 100% !important;
max-height: calc(100vh - 80px) !important;
overflow: hidden !important;
}
.event-popover .popover-buttons-wrapper {
position: sticky !important;
bottom: 0 !important;
background: white !important;
border-top: 1px solid #ddd !important;
padding: 15px !important;
z-index: 9999 !important;
box-shadow: 0 -2px 10px rgba(0,0,0,0.2) !important;
flex: 0 0 auto !important;
margin: 0 !important;
width: 100% !important;
}
.event-popover .popover-content-wrapper {
flex: 1 1 auto !important;
overflow-y: auto !important;
min-height: 0 !important;
padding: 15px !important;
}
/* Forcer une largeur minimale convenable */
.event-popover .popover__wrapper,
.event-popover .popover__inner {
min-width: 500px !important;
max-height: calc(100vh - 80px) !important;
}
/* Centrer verticalement le popover */
.event-popover {
top: 50% !important;
transform: translateY(-50%) !important;
}
</style>

View File

@ -1144,39 +1144,19 @@ class Bdd
/**
* Insert Defunt
*/
public function insertDefuntByName($name, $lieuDeces = null, $dateNaissance = null)
public function insertDefuntByName($name)
{
// Gérer la date de naissance par défaut si null ou vide
if (empty($dateNaissance) || trim($dateNaissance) === '') {
$dateNaissance = '1973-11-11';
}
// Gérer le lieu de décès (peut être null)
$lieuDecesValue = !empty($lieuDeces) ? trim($lieuDeces) : null;
$sql = "INSERT INTO `".$this->tableprefix."defunt` (
`id_nextcloud`, `nom`, `sexe`, `date_naissance`, `ref_pacemaker`, `date`,
`corpulence`, `observations_corps`, `observations_generales`, `lieu_deces`
) VALUES (?,?,?,?,?,NOW(),?,?,?,?);";
$this->execSQLNoData($sql, array(
'admin',
$name,
'm',
$dateNaissance,
'',
'',
'',
'',
$lieuDecesValue
));
`id_nextcloud`, `nom`, `sexe`, `date_naissance`, `ref_pacemaker`, `date`,
`corpulence`, `observations_corps`, `observations_generales`
) VALUES (?,?,?,?,?,NOW(),?,?,?);";
$this->execSQLNoData($sql, array('admin',$name, 'm', '1973-11-11', '', '', '', ''));
return true;
}
public function insertDefuntByNameAndReturnId($name, $lieuDeces = null, $dateNaissance = null)
public function insertDefuntByNameAndReturnId($name)
{
$this->insertDefuntByName($name, $lieuDeces, $dateNaissance);
$this->insertDefuntByName($name);
return $this->getLastDefuntIdByName($name);
}
@ -4129,13 +4109,12 @@ class Bdd
return null;
}
public function getDefuntById($defuntId)
private function getDefuntById($defuntId)
{
$sql = "SELECT
defunt.id as id,
defunt.nom as defunt_nom,
defunt.lieu_deces as lieu_deces,
defunt.date_naissance as date_naissance,
devis.id as devis_id
FROM ".$this->tableprefix."defunt as defunt
LEFT JOIN ".$this->tableprefix."devis as devis on defunt.id = devis.id_defunt
@ -4478,60 +4457,23 @@ COMMENTAIRES: ".$comment;
$this->execSQLNoData($sql, [DevisMentionConstant::CANCELED,$devisId]);
}
/**
* Met à jour un défunt avec tous ses détails
*/
public function updateDefuntByNameAndDetails($defuntId, $name, $lieuDeces = null, $dateNaissance = null)
private function updateDefuntByName($defuntId, $requestedDefuntName)
{
// Gérer la date de naissance par défaut si null ou vide
if (empty($dateNaissance) || trim($dateNaissance) === '') {
$dateNaissance = '1973-11-11';
}
// Gérer le lieu de décès (peut être null)
$lieuDecesValue = !empty($lieuDeces) ? trim($lieuDeces) : null;
$sql = "UPDATE `".$this->tableprefix."defunt` SET
`nom` = ?,
`lieu_deces` = ?,
`date_naissance` = ?
WHERE `id` = ?";
$this->execSQLNoData($sql, array(
$name,
$lieuDecesValue,
$dateNaissance,
$defuntId
));
return true;
$sql = "UPDATE ".$this->tableprefix."defunt as defunt
SET defunt.nom = ?
WHERE defunt.id = ?";
$this->execSQLNoData($sql, [$requestedDefuntName,$defuntId]);
}
/**
* Version simplifiée pour rétrocompatibilité
*/
public function updateDefuntByName($defuntId, $name)
public function createOrUpdateDefuntByNameAndReturnDefuntId($defuntId, $currentDefuntName, $requestedDefuntName)
{
return $this->updateDefuntByNameAndDetails($defuntId, $name);
}
public function createOrUpdateDefuntByNameAndReturnDefuntId($defuntId, $currentDefuntName, $requestedDefuntName, $lieuDeces = null, $dateNaissance = null)
{
if ($defuntId != null) {
// Récupérer les données actuelles du défunt pour comparaison
$currentDefunt = $this->getDefuntById($defuntId);
if($defuntId != null) {
$defuntNameIsUpdated = $currentDefuntName != $requestedDefuntName;
$lieuDecesIsUpdated = ($currentDefunt['lieu_deces'] ?? null) != $lieuDeces;
$dateNaissanceIsUpdated = ($currentDefunt['date_naissance'] ?? null) != $dateNaissance;
// Mettre à jour si au moins un champ a changé
if ($defuntNameIsUpdated || $lieuDecesIsUpdated || $dateNaissanceIsUpdated) {
$this->updateDefuntByNameAndDetails($defuntId, $requestedDefuntName, $lieuDeces, $dateNaissance);
if($defuntNameIsUpdated) {
$this->updateDefuntByName($defuntId, $requestedDefuntName);
}
} else {
// Créer un nouveau défunt
$this->insertDefuntByName($requestedDefuntName, $lieuDeces, $dateNaissance);
$this->insertDefuntByName($requestedDefuntName);
$defunt = $this->getLastDefuntIdByName($requestedDefuntName);
$defuntId = $defunt['id'];
}
@ -5283,22 +5225,21 @@ COMMENTAIRES: ".$comment;
return $devisList;
}
public function getDevisIdsGroupByFactureId($factureId, $mentionFilters = [])
{
public function getDevisIdsGroupByFactureId($factureId,$mentionFilters = []){
$sql = "SELECT devis.id
FROM ".$this->tableprefix."devis as devis
WHERE devis.fk_facture_id = ? ";
$conditions = [$factureId];
if(!empty($mentionFilters)) {
if(!empty($mentionFilters)){
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
$conditions = array_merge($conditions, $mentionFilters);
}
$sql .= ";";
$devisList = $this->execSQLNoJsonReturn($sql, $conditions);
$sql.= ";";
$devisList = $this->execSQLNoJsonReturn($sql,$conditions);
$devisIds = [];
foreach($devisList as $devis) {
foreach($devisList as $devis){
$devisIds[] = $devis['id'];
}
return $devisIds;
@ -5745,7 +5686,7 @@ COMMENTAIRES: ".$comment;
private function getProductsTotalPrices($products)
{
$configs = json_decode($this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
$currentConfig = $configs[0];
$currentConfig = $configs[0];
$totalHt = 0;
$totalTtc = 0;
foreach ($products as $product) {
@ -5761,12 +5702,11 @@ COMMENTAIRES: ".$comment;
];
}
private function getDevisIdsListByFactureId($factureId)
{
private function getDevisIdsListByFactureId($factureId){
$factureData = $this->getFactureByFactureId(factureId: $factureId);
$isFactureGroupOfDevis = $factureData["facture_type"] == FactureTypeConstant::TYPE_GROUP;
$factureDevisIdsList = [];
if($isFactureGroupOfDevis) {
if($isFactureGroupOfDevis){
$isFactureForSingleClient = $factureData['fk_client_id'] != null && $factureData['fk_client_id'] != 0;
$devisMentionFilters = [
DevisMentionConstant::FACTURED_FORMATTED,
@ -5775,25 +5715,24 @@ COMMENTAIRES: ".$comment;
$devis = $this->getDevisByFkFactureId($factureId);
$factureGroupIsRelatedToAnyDevis = $devis != null;
if (!$factureGroupIsRelatedToAnyDevis) {
if($isFactureForSingleClient) {
if($isFactureForSingleClient){
$factureDevisIdsList = $this->getDevisIdsByClientIdAndMonthYear(
$factureData['fk_client_id'],
$factureData['month'],
$factureData['year'],
$devisMentionFilters
$factureData['year'],$devisMentionFilters
);
} else {
}else{
$factureDevisIdsList = $this->getDevisIdsByClientGroupFacturationIdAndMonthYear(
$factureData['fk_client_group_facturation_id'],
$factureData['month'],
$factureData['year'],
$devisMentionFilters
);
$factureData['month'],
$factureData['year'],$devisMentionFilters
);
}
} else {
$factureDevisIdsList = $this->getDevisIdsGroupByFactureId($factureId, $devisMentionFilters);
}else{
$factureDevisIdsList = $this->getDevisIdsGroupByFactureId($factureId, $devisMentionFilters );
}
} else {
}
else{
$factureDevisIdsList = $factureData['id_devis'] ? [$factureData['id_devis']] : [];
}
return $factureDevisIdsList;
@ -5805,7 +5744,7 @@ COMMENTAIRES: ".$comment;
$totalHt = 0;
$totalTtc = 0;
$tva = 0;
foreach($factureDevisIds as $devisId) {
foreach($factureDevisIds as $devisId){
$products = $this->getDevisProduits($devisId);
$totalPrices = $this->getProductsTotalPrices($products);
$totalHt += $totalPrices["total_ht"];

View File

@ -34,33 +34,35 @@ use Psr\Log\LoggerInterface;
class CalendarObjectCreatedListener implements IEventListener
{
/** @var LoggerInterface */
private $logger;
/** @var GestionService */
private $gestionService;
/** @var LoggerInterface */
private $logger;
public function __construct(
LoggerInterface $logger,
GestionService $gestionService
) {
$this->logger = $logger;
$this->gestionService = $gestionService;
}
/** @var GestionService */
private $gestionService;
public function __construct(
LoggerInterface $logger,
GestionService $gestionService
) {
$this->logger = $logger;
$this->gestionService = $gestionService;
}
public function handle(Event $event): void
{
if (!($event instanceof CalendarObjectCreatedEvent)) {
return;
}
$calendarData = $event->getObjectData();
try {
$vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleCreatedCalendarObject($vCalendarString);
} catch (\OC\OCS\Exception $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
} catch (\Throwable $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
}
}
public function handle(Event $event): void
{
if (!($event instanceof CalendarObjectCreatedEvent)) {
return;
}
$calendarData = $event->getObjectData();
try {
$vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleCreatedCalendarObject($vCalendarString);
} catch (\OC\OCS\Exception $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
} catch (\Throwable $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
}
}
}

View File

@ -35,34 +35,35 @@ use Psr\Log\LoggerInterface;
class CalendarObjectUpdatedListener implements IEventListener
{
/** @var LoggerInterface */
private $logger;
/** @var GestionService */
private $gestionService;
/** @var LoggerInterface */
private $logger;
public function __construct(
LoggerInterface $logger,
GestionService $gestionService
) {
$this->logger = $logger;
$this->gestionService = $gestionService;
}
/** @var GestionService */
private $gestionService;
public function handle(Event $event): void
{
if (!($event instanceof CalendarObjectUpdatedEvent)) {
return;
}
$calendarData = $event->getObjectData();
try {
$vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
} catch (\OC\OCS\Exception $e) {
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
} catch (\Throwable $e) {
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
}
}
public function __construct(
LoggerInterface $logger,
GestionService $gestionService
) {
$this->logger = $logger;
$this->gestionService = $gestionService;
}
public function handle(Event $event): void
{
if (!($event instanceof CalendarObjectUpdatedEvent)) {
return;
}
$calendarData = $event->getObjectData();
try {
$vCalendarString = $calendarData["calendardata"];
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
} catch (\OC\OCS\Exception $e) {
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
} catch (\Throwable $e) {
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
}
}
}

View File

@ -50,7 +50,7 @@ class GestionService
private $userConnectedUuid;
/** @var DevisPdfService */
private $devisPdfService;
private $devisPdfService;
public function __construct(
Bdd $gestionBdd,
@ -58,11 +58,12 @@ class GestionService
TalkService $talkService,
IUserSession $userSession,
DevisPdfService $devisPdfService
) {
$this->logger = $logger;
$this->gestionBdd = $gestionBdd;
$this->talkService = $talkService;
$this->devisPdfService = $devisPdfService;
$this->devisPdfService = $devisPdfService;
try {
$this->userConnectedUuid = $userSession->getUser()->getUID();
@ -162,10 +163,9 @@ class GestionService
return $calendarStartDate;
}
private function GetIsPivateFromVCalendarString(string $vCalendarString): bool
{
private function GetIsPivateFromVCalendarString(string $vCalendarString): bool{
$isPrivateValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_PRIVATE, $vCalendarString);
return $isPrivateValue === "1" ? true : false;
return $isPrivateValue === "1" ? true : false;
}
@ -182,16 +182,7 @@ class GestionService
private function UpdateDevisDataByVCalendarString($devis, $vCalendarString)
{
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
$lieuDeces = $this->getLieuDecesFromVCalendarString($vCalendarString);
$dateNaissance = $this->getDateNaissanceFromVCalendarString($vCalendarString);
$defuntId = $this->gestionBdd->createOrUpdateDefuntByNameAndReturnDefuntId($devis['defunt_id'], $devis['defunt_nom'], $requestedDefuntName, $lieuDeces, $dateNaissance);
file_put_contents(
'/var/www/html/data/nextcloud_calendar_debug.log',
date('Y-m-d H:i:s') . " - defuntId: " . $defuntId . "\n",
FILE_APPEND
);
$defuntId = $this->gestionBdd->createOrUpdateDefuntByNameAndReturnDefuntId($devis['defunt_id'], $devis['defunt_nom'], $requestedDefuntName);
$this->gestionBdd->updateDevisDefunt($devis['id'], $defuntId, $devis['defunt_id']);
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
@ -215,11 +206,6 @@ class GestionService
private function CheckIfDevisIsAlreadyUpdated($devis, $vCalendarString)
{
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
$requestedLieuDeces = $this->getLieuDecesFromVCalendarString($vCalendarString);
$requestedDateNaissance = $this->getDateNaissanceFromVCalendarString($vCalendarString);
$currentDefunt = $this->gestionBdd->getDefuntById($devis['defunt_id']);
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
$requestedDevisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
@ -240,17 +226,15 @@ class GestionService
$devis['lieu_id'] == $requestLocationId &&
$devis['comment'] == $requestedDevisComment &&
$requestedArticleIds == $articleDevisIds &&
$devis['date'] == $requestedDevisDate &&
($currentDefunt['lieu_deces'] ?? null) == $requestedLieuDeces &&
($currentDefunt['date_naissance'] ?? null) == $requestedDateNaissance;
$devis['date'] == $requestedDevisDate;
}
public function HandleUpdatedCalendarObject(string $vCalendarString)
{
try {
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE', $vCalendarString);
if ($isPrivate || $absenceType) {
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
if ($isPrivate || $absenceType ) {
//from devis calendar to leave calendar
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
@ -312,10 +296,10 @@ class GestionService
$month,
$year
);
if($oldThanatoTrajet != null) {
$thereIsThanatoDevisRattachedToLigneTrajetForADate = $this->gestionBdd->thereIsThanatoDevisRattachedToLigneTrajetForADate($devis['date'], $oldThanatoTrajet['id']);
if(!$thereIsThanatoDevisRattachedToLigneTrajetForADate) {
$this->gestionBdd->deleteThanatoLigneTrajetForADateByIdTrajet($devis['date'], $oldThanatoTrajet['id']);
if($oldThanatoTrajet != null){
$thereIsThanatoDevisRattachedToLigneTrajetForADate = $this->gestionBdd->thereIsThanatoDevisRattachedToLigneTrajetForADate($devis['date'], $oldThanatoTrajet['id'] );
if(!$thereIsThanatoDevisRattachedToLigneTrajetForADate){
$this->gestionBdd->deleteThanatoLigneTrajetForADateByIdTrajet($devis['date'], $oldThanatoTrajet['id'] );
}
}
$this->gestionBdd->updateDevisThanato($devis['id'], $thanato['id']);
@ -335,10 +319,10 @@ class GestionService
public function HandleCreatedCalendarObject(string $vCalendarString)
{
try {
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE', $vCalendarString);
if($isPrivate || $absenceType) {
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
if($isPrivate || $absenceType){
//Nothing to do manage fo a private calendar
return;
}
@ -352,15 +336,11 @@ class GestionService
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
$userName = $this->GetThanatoNameFromVCalendarString($vCalendarString);
$lieuDeces = $this->getLieuDecesFromVCalendarString($vCalendarString);
$dateNaissance = $this->getDateNaissanceFromVCalendarString($vCalendarString);
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId, $locationId, $thanatoId, $calendarSummary, $calendarUuid);
if ($devisAlreadyCreated) {
return;
}
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary, $lieuDeces, $dateNaissance);
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary);
$calendarStartDate = $this->GetCalendarDateFromVCalendarString($vCalendarString);
$devisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId, $clientId, $locationId, $defuntId, $calendarUuid, $calendarStartDate, $devisComment);
@ -372,13 +352,14 @@ class GestionService
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId, $userName);
$this->talkService->sendDevisTalkNotifications($devisTalkMessage, $userName, $this->userConnectedUuid);
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId, $userName);
$this->devisPdfService->generateDevisPdfByDevisId($devisId, $this->userConnectedUuid);
$this->devisPdfService->generateDevisPdfByDevisId($devisId , $this->userConnectedUuid);
} catch (\OC\OCS\Exception $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
} catch (\Throwable $e) {
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
}
}
private function GetThanatoNameFromVCalendarString($vCalendarString)
{
@ -412,16 +393,4 @@ class GestionService
$mapped = array_map('trim', $articles);
return $mapped;
}
private function getLieuDecesFromVCalendarString(string $vCalendarString): ?string
{
$lieuDecesValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("LIEUDECES", $vCalendarString);
return !empty($lieuDecesValue) ? trim($lieuDecesValue) : null;
}
private function getDateNaissanceFromVCalendarString(string $vCalendarString): ?string
{
$dateNaissanceValue = VCalendarHelpers::GetValueFromKeyInVCalendarString("DATENAISSANCE", $vCalendarString);
return !empty($dateNaissanceValue) ? trim($dateNaissanceValue) : null;
}
}