Compare commits
24 Commits
develop-ez
...
production
| Author | SHA1 | Date | |
|---|---|---|---|
| d2bb1a9cc6 | |||
| 8cacac1efc | |||
| a28b7f6ea6 | |||
| 03784fd8e6 | |||
| 411cc2d5a8 | |||
| 34717b772d | |||
| b6ea2550bc | |||
| 65d13d70f9 | |||
| b60bb6e0b2 | |||
| 9bdab31b52 | |||
| f0356cea10 | |||
| 5855be2655 | |||
| 1a4068481f | |||
| cfe88df7ba | |||
| a027f5928a | |||
| c35d0efec1 | |||
| 4957a67ba5 | |||
|
|
ce18ebdb9a | ||
| bccfc0b7ed | |||
| 49ecf4b1ed | |||
| 21fff9d4c0 | |||
| 0c6d9577a3 | |||
| 06a2e8fb2a | |||
|
|
085acaf193 |
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
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
@ -26,8 +26,8 @@
|
|||||||
:class="{ 'property-title__input--readonly': isReadOnly }">
|
:class="{ 'property-title__input--readonly': isReadOnly }">
|
||||||
<input v-if="!isReadOnly"
|
<input v-if="!isReadOnly"
|
||||||
v-focus
|
v-focus
|
||||||
type="text"
|
:type="type"
|
||||||
:placeholder="t('calendar', 'Nom et prénom du défunt')"
|
:placeholder="computedPlaceholder"
|
||||||
:value="value"
|
:value="value"
|
||||||
@input.prevent.stop="changeValue">
|
@input.prevent.stop="changeValue">
|
||||||
<!-- eslint-disable-next-line vue/singleline-html-element-content-newline -->
|
<!-- eslint-disable-next-line vue/singleline-html-element-content-newline -->
|
||||||
@ -53,6 +53,19 @@ export default {
|
|||||||
type: String,
|
type: String,
|
||||||
default: '',
|
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: {
|
methods: {
|
||||||
changeValue(event) {
|
changeValue(event) {
|
||||||
|
|||||||
@ -118,6 +118,14 @@ export default {
|
|||||||
return this.calendarObjectInstance?.embalmer ?? null
|
return this.calendarObjectInstance?.embalmer ?? null
|
||||||
},
|
},
|
||||||
|
|
||||||
|
lieuDeces() {
|
||||||
|
return this.calendarObjectInstance?.lieuDeces ?? null
|
||||||
|
},
|
||||||
|
|
||||||
|
dateNaissance() {
|
||||||
|
return this.calendarObjectInstance?.dateNaissance ?? null
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the isleave property
|
* Returns the isleave property
|
||||||
*
|
*
|
||||||
@ -155,7 +163,6 @@ export default {
|
|||||||
return this.calendarObjectInstance?.isPrivate ?? false
|
return this.calendarObjectInstance?.isPrivate ?? false
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the description or null if the event is still loading
|
* Returns the description or null if the event is still loading
|
||||||
*
|
*
|
||||||
@ -456,16 +463,16 @@ export default {
|
|||||||
* @return {string|null}
|
* @return {string|null}
|
||||||
*/
|
*/
|
||||||
absenceType() {
|
absenceType() {
|
||||||
const isleave = this.calendarObjectInstance?.isLeave ?? false
|
const isleave = this.calendarObjectInstance?.isLeave ?? false
|
||||||
const absenceType = this.calendarObjectInstance?.absenceType ?? null
|
const absenceType = this.calendarObjectInstance?.absenceType ?? null
|
||||||
if (absenceType) {
|
if (absenceType) {
|
||||||
return this.calendarObjectInstance?.absenceType
|
return this.calendarObjectInstance?.absenceType
|
||||||
}
|
}
|
||||||
if (isleave && !absenceType ) {
|
if (isleave && !absenceType) {
|
||||||
return 'LEAVE'
|
return 'LEAVE'
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return ''
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -583,7 +590,7 @@ export default {
|
|||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
this.isSaving = true
|
this.isSaving = true
|
||||||
try {
|
try {
|
||||||
this.setPendingCalendar(false);
|
this.setPendingCalendar(false)
|
||||||
await this.$store.dispatch('saveCalendarObjectInstance', {
|
await this.$store.dispatch('saveCalendarObjectInstance', {
|
||||||
thisAndAllFuture,
|
thisAndAllFuture,
|
||||||
calendarId: this.calendarId,
|
calendarId: this.calendarId,
|
||||||
@ -601,8 +608,6 @@ export default {
|
|||||||
setPendingCalendar(isPending = true) {
|
setPendingCalendar(isPending = true) {
|
||||||
this.calendarObjectInstance.eventComponent.isCalendarPending = isPending
|
this.calendarObjectInstance.eventComponent.isCalendarPending = isPending
|
||||||
this.calendarObjectInstance.isCalendarPending = isPending
|
this.calendarObjectInstance.isCalendarPending = isPending
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
async savePendingCalendar(thisAndAllFuture = false) {
|
async savePendingCalendar(thisAndAllFuture = false) {
|
||||||
if (!this.calendarObject) {
|
if (!this.calendarObject) {
|
||||||
@ -620,7 +625,7 @@ export default {
|
|||||||
this.isSaving = true
|
this.isSaving = true
|
||||||
try {
|
try {
|
||||||
this.setPendingCalendar();
|
this.setPendingCalendar();
|
||||||
await this.$store.dispatch('saveCalendarObjectInstance', {
|
await this.$store.dispatch('saveCalendarObjectInstance', {
|
||||||
thisAndAllFuture,
|
thisAndAllFuture,
|
||||||
calendarId: this.calendarId,
|
calendarId: this.calendarId,
|
||||||
})
|
})
|
||||||
@ -762,7 +767,6 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the start date of this event
|
* Updates the start date of this event
|
||||||
*
|
*
|
||||||
@ -827,7 +831,7 @@ export default {
|
|||||||
toggleIsPrivate(isPrivate) {
|
toggleIsPrivate(isPrivate) {
|
||||||
this.$store.commit('toggleIsPrivate', {
|
this.$store.commit('toggleIsPrivate', {
|
||||||
calendarObjectInstance: this.calendarObjectInstance,
|
calendarObjectInstance: this.calendarObjectInstance,
|
||||||
isPrivate
|
isPrivate,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -835,23 +839,23 @@ export default {
|
|||||||
// * Toggles the event between all-day and timed
|
// * Toggles the event between all-day and timed
|
||||||
// */
|
// */
|
||||||
// toggleIsLeave(isLeave) {
|
// toggleIsLeave(isLeave) {
|
||||||
// this.$store.commit('toggleIsLeave', {
|
// this.$store.commit('toggleIsLeave', {
|
||||||
// calendarObjectInstance: this.calendarObjectInstance,
|
// calendarObjectInstance: this.calendarObjectInstance,
|
||||||
// isLeave
|
// isLeave
|
||||||
// })
|
// })
|
||||||
// },
|
// },
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the event pending
|
* Toggles the event pending
|
||||||
|
* @param isCalendarPending
|
||||||
*/
|
*/
|
||||||
toggleIsCalendarPending(isCalendarPending) {
|
toggleIsCalendarPending(isCalendarPending) {
|
||||||
this.$store.commit('toggleIsCalendarPending', {
|
this.$store.commit('toggleIsCalendarPending', {
|
||||||
calendarObjectInstance: this.calendarObjectInstance,
|
calendarObjectInstance: this.calendarObjectInstance,
|
||||||
isCalendarPending
|
isCalendarPending,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resets the internal state after changing the viewed calendar-object
|
* Resets the internal state after changing the viewed calendar-object
|
||||||
*/
|
*/
|
||||||
@ -895,7 +899,31 @@ export default {
|
|||||||
calendarObjectInstance: this.calendarObjectInstance,
|
calendarObjectInstance: this.calendarObjectInstance,
|
||||||
absenceType,
|
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
|
* This is executed before entering the Editor routes
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getDateFromDateTimeValue } from '../utils/date.js'
|
import { getDateFromDateTimeValue } from '../utils/date.js'
|
||||||
import { DurationValue, DateTimeValue } from '@nextcloud/calendar-js'
|
import { DurationValue, DateTimeValue, Property } from '@nextcloud/calendar-js'
|
||||||
import { getHexForColorName, getClosestCSS3ColorNameForHex } from '../utils/color.js'
|
import { getHexForColorName, getClosestCSS3ColorNameForHex } from '../utils/color.js'
|
||||||
import { mapAlarmComponentToAlarmObject } from './alarm.js'
|
import { mapAlarmComponentToAlarmObject } from './alarm.js'
|
||||||
import { mapAttendeePropertyToAttendeeObject } from './attendee.js'
|
import { mapAttendeePropertyToAttendeeObject } from './attendee.js'
|
||||||
@ -52,24 +52,28 @@ const getDefaultEventObject = (props = {}) => Object.assign({}, {
|
|||||||
endTimezoneId: null,
|
endTimezoneId: null,
|
||||||
// Indicator whether or not event is all-day
|
// Indicator whether or not event is all-day
|
||||||
isAllDay: false,
|
isAllDay: false,
|
||||||
//leave
|
// leave
|
||||||
isLeave: false,
|
isLeave: false,
|
||||||
//calendarPending
|
// calendarPending
|
||||||
isCalendarPending: false,
|
isCalendarPending: false,
|
||||||
// Whether or not the user is allowed to toggle the all-day checkbox
|
// Whether or not the user is allowed to toggle the all-day checkbox
|
||||||
canModifyAllDay: true,
|
canModifyAllDay: true,
|
||||||
// Location that the event takes places in
|
// Location that the event takes places in
|
||||||
location: null,
|
location: null,
|
||||||
//client of the event
|
// client of the event
|
||||||
client : null,
|
client: null,
|
||||||
//embalmer(Thanato) of the event
|
// embalmer(Thanato) of the event
|
||||||
embalmer : null,
|
embalmer: null,
|
||||||
//absenceType
|
// lieu de décès
|
||||||
absenceType : null,
|
lieuDeces: null,
|
||||||
//Private
|
// date de naissance
|
||||||
|
dateNaissance: null,
|
||||||
|
// absenceType
|
||||||
|
absenceType: null,
|
||||||
|
// Private
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
//comment of the event
|
// comment of the event
|
||||||
comment : null,
|
comment: null,
|
||||||
// description of the event
|
// description of the event
|
||||||
description: null,
|
description: null,
|
||||||
// Access class of the event (PUBLIC, PRIVATE, CONFIDENTIAL)
|
// Access class of the event (PUBLIC, PRIVATE, CONFIDENTIAL)
|
||||||
@ -118,10 +122,12 @@ const mapEventComponentToEventObject = (eventComponent) => {
|
|||||||
isCalendarPending: false,
|
isCalendarPending: false,
|
||||||
canModifyAllDay: eventComponent.canModifyAllDay(),
|
canModifyAllDay: eventComponent.canModifyAllDay(),
|
||||||
location: eventComponent.location,
|
location: eventComponent.location,
|
||||||
client : "CLIENT",
|
client: 'CLIENT',
|
||||||
embalmer : "TEST",
|
embalmer: 'TEST',
|
||||||
absenceType : "",
|
lieuDeces: null,
|
||||||
comment : "",
|
dateNaissance: null,
|
||||||
|
absenceType: '',
|
||||||
|
comment: '',
|
||||||
description: eventComponent.description,
|
description: eventComponent.description,
|
||||||
accessClass: eventComponent.accessClass,
|
accessClass: eventComponent.accessClass,
|
||||||
status: eventComponent.status,
|
status: eventComponent.status,
|
||||||
@ -207,39 +213,46 @@ const mapEventComponentToEventObject = (eventComponent) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eventComponent.hasProperty('CLIENT')){
|
if (eventComponent.hasProperty('CLIENT')) {
|
||||||
eventObject.client = eventComponent.getFirstPropertyFirstValue('CLIENT');
|
eventObject.client = eventComponent.getFirstPropertyFirstValue('CLIENT')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eventComponent.hasProperty('EMBALMER')){
|
if (eventComponent.hasProperty('EMBALMER')) {
|
||||||
eventObject.embalmer = eventComponent.getFirstPropertyFirstValue('EMBALMER');
|
eventObject.embalmer = eventComponent.getFirstPropertyFirstValue('EMBALMER')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eventComponent.hasProperty('COMMENT')){
|
if (eventComponent.hasProperty('COMMENT')) {
|
||||||
eventObject.comment = eventComponent.getFirstPropertyFirstValue('COMMENT');
|
eventObject.comment = eventComponent.getFirstPropertyFirstValue('COMMENT')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eventComponent.hasProperty('ISPRIVATE')){
|
if (eventComponent.hasProperty('ISPRIVATE')) {
|
||||||
eventObject.isPrivate = eventComponent.getFirstPropertyFirstValue('ISPRIVATE') === '1' ? true : false;
|
eventObject.isPrivate = eventComponent.getFirstPropertyFirstValue('ISPRIVATE') === '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (eventComponent.hasProperty('ABSENCETYPE')) {
|
||||||
|
eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE')
|
||||||
|
|
||||||
if(eventComponent.hasProperty('ABSENCETYPE')){
|
} else {
|
||||||
eventObject.absenceType = eventComponent.getFirstPropertyFirstValue('ABSENCETYPE');
|
if (eventComponent.hasProperty('ISLEAVE')) {
|
||||||
|
if (eventComponent.getFirstPropertyFirstValue('ISLEAVE') === '1') {
|
||||||
}else{
|
eventObject.absenceType = 'LEAVE'
|
||||||
if(eventComponent.hasProperty('ISLEAVE')){
|
|
||||||
if( eventComponent.getFirstPropertyFirstValue('ISLEAVE') === '1'){
|
|
||||||
eventObject.absenceType = 'LEAVE';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eventComponent.hasProperty('ISCALENDARPENDING')){
|
if (eventComponent.hasProperty('ISCALENDARPENDING')) {
|
||||||
eventObject.isCalendarPending = eventComponent.getFirstPropertyFirstValue('ISCALENDARPENDING') === '1' ? true : false;
|
eventObject.isCalendarPending = eventComponent.getFirstPropertyFirstValue('ISCALENDARPENDING') === '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
return eventObject;
|
if (eventComponent.hasProperty('LIEUDECES')) {
|
||||||
|
eventObject.lieuDeces = eventComponent.getFirstPropertyFirstValue('LIEUDECES')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventComponent.hasProperty('DATENAISSANCE')) {
|
||||||
|
eventObject.dateNaissance = eventComponent.getFirstPropertyFirstValue('DATENAISSANCE')
|
||||||
|
}
|
||||||
|
|
||||||
|
return eventObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -253,6 +266,20 @@ const copyCalendarObjectInstanceIntoEventComponent = (eventObject, eventComponen
|
|||||||
eventComponent.location = eventObject.location
|
eventComponent.location = eventObject.location
|
||||||
eventComponent.client = eventObject.client
|
eventComponent.client = eventObject.client
|
||||||
eventComponent.embalmer = eventObject.embalmer
|
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.isPrivate = eventObject.isPrivate
|
||||||
eventComponent.isCalendarPending = eventObject.isCalendarPending
|
eventComponent.isCalendarPending = eventObject.isCalendarPending
|
||||||
eventComponent.comment = eventObject.comment
|
eventComponent.comment = eventObject.comment
|
||||||
|
|||||||
@ -22,7 +22,6 @@
|
|||||||
import { translate as t } from '@nextcloud/l10n'
|
import { translate as t } from '@nextcloud/l10n'
|
||||||
import { getDefaultCategories } from '../defaults/defaultCategories.js'
|
import { getDefaultCategories } from '../defaults/defaultCategories.js'
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all supported RFC properties
|
* Gets all supported RFC properties
|
||||||
*
|
*
|
||||||
@ -158,7 +157,6 @@ const getRFCProperties = () => {
|
|||||||
options: [],
|
options: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
embalmer: {
|
embalmer: {
|
||||||
readableName: t('calendar', 'Embalmer'),
|
readableName: t('calendar', 'Embalmer'),
|
||||||
placeholder: t('calendar', 'Add a thanatopracteur'),
|
placeholder: t('calendar', 'Add a thanatopracteur'),
|
||||||
@ -183,7 +181,21 @@ const getRFCProperties = () => {
|
|||||||
placeholder: t('calendar', 'Commentaires'),
|
placeholder: t('calendar', 'Commentaires'),
|
||||||
tagPlaceholder: t('calendar', 'Commentaires'),
|
tagPlaceholder: t('calendar', 'Commentaires'),
|
||||||
options: [],
|
options: [],
|
||||||
defaultNumberOfRows: 4
|
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',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -292,6 +292,7 @@ const mutations = {
|
|||||||
* @param {object} state The Vuex state
|
* @param {object} state The Vuex state
|
||||||
* @param {object} data The destructuring object
|
* @param {object} data The destructuring object
|
||||||
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
|
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
|
||||||
|
* @param data.isPrivate
|
||||||
*/
|
*/
|
||||||
toggleIsPrivate(state, { calendarObjectInstance, isPrivate }) {
|
toggleIsPrivate(state, { calendarObjectInstance, isPrivate }) {
|
||||||
calendarObjectInstance.eventComponent.isPrivate = isPrivate
|
calendarObjectInstance.eventComponent.isPrivate = isPrivate
|
||||||
@ -403,6 +404,40 @@ const mutations = {
|
|||||||
calendarObjectInstance.embalmer = embalmer
|
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
|
* Change the absence type of an event
|
||||||
*
|
*
|
||||||
@ -410,6 +445,7 @@ const mutations = {
|
|||||||
* @param {object} data The destructuring object
|
* @param {object} data The destructuring object
|
||||||
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
|
* @param {object} data.calendarObjectInstance The calendarObjectInstance object
|
||||||
* @param {string} data.embalmer New embalmer to set
|
* @param {string} data.embalmer New embalmer to set
|
||||||
|
* @param data.absenceType
|
||||||
*/
|
*/
|
||||||
changeAbsenceType(state, { calendarObjectInstance, absenceType }) {
|
changeAbsenceType(state, { calendarObjectInstance, absenceType }) {
|
||||||
calendarObjectInstance.eventComponent.absenceType = absenceType ?? null
|
calendarObjectInstance.eventComponent.absenceType = absenceType ?? null
|
||||||
@ -1790,8 +1826,10 @@ const actions = {
|
|||||||
eventComponent.isPrivate != null ||
|
eventComponent.isPrivate != null ||
|
||||||
eventComponent.comment != null ||
|
eventComponent.comment != null ||
|
||||||
eventComponent.isLeave != null ||
|
eventComponent.isLeave != null ||
|
||||||
eventComponent.absenceType ||
|
eventComponent.absenceType ||
|
||||||
eventComponent.isCalendarPending != null;
|
eventComponent.isCalendarPending != null ||
|
||||||
|
state.calendarObjectInstance.lieuDeces != null ||
|
||||||
|
state.calendarObjectInstance.dateNaissance != null;
|
||||||
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
if (eventComponent.isDirty() || additionalFieldWasUpdated) {
|
||||||
const isForkedItem = eventComponent.primaryItem !== null
|
const isForkedItem = eventComponent.primaryItem !== null
|
||||||
let original = null
|
let original = null
|
||||||
|
|||||||
@ -101,8 +101,29 @@
|
|||||||
@update-start-timezone="updateStartTimezone"
|
@update-start-timezone="updateStartTimezone"
|
||||||
@update-end-date="updateEndDate"
|
@update-end-date="updateEndDate"
|
||||||
@update-end-timezone="updateEndTimezone"
|
@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='margin-top: 13px; display:flex ;width: 81%;'>
|
||||||
<div style='width:100%'>
|
<div style='width:100%'>
|
||||||
@ -889,4 +910,26 @@ export default {
|
|||||||
padding: 0 20px;
|
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>
|
</style>
|
||||||
|
|||||||
@ -22,15 +22,13 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Popover
|
<Popover ref="popover"
|
||||||
ref="popover"
|
|
||||||
:shown="showPopover"
|
:shown="showPopover"
|
||||||
:auto-hide="false"
|
:auto-hide="false"
|
||||||
:placement="placement"
|
:placement="placement"
|
||||||
:boundary="boundaryElement"
|
:boundary="boundaryElement"
|
||||||
popover-base-class="event-popover"
|
popover-base-class="event-popover"
|
||||||
:triggers="[]"
|
:triggers="[]">
|
||||||
>
|
|
||||||
<div class="event-popover__inner">
|
<div class="event-popover__inner">
|
||||||
<template v-if="isLoading && !isSaving">
|
<template v-if="isLoading && !isSaving">
|
||||||
<PopoverLoadingIndicator />
|
<PopoverLoadingIndicator />
|
||||||
@ -48,10 +46,8 @@
|
|||||||
</Actions>
|
</Actions>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<EmptyContent
|
<EmptyContent :name="$t('calendar', 'Event does not exist')"
|
||||||
:name="$t('calendar', 'Event does not exist')"
|
:description="error">
|
||||||
:description="error"
|
|
||||||
>
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<CalendarBlank :size="20" decorative />
|
<CalendarBlank :size="20" decorative />
|
||||||
</template>
|
</template>
|
||||||
@ -61,28 +57,22 @@
|
|||||||
<template v-else>
|
<template v-else>
|
||||||
<div class="event-popover__top-right-actions">
|
<div class="event-popover__top-right-actions">
|
||||||
<Actions v-if="!isLoading && !isError && !isNew" :force-menu="true">
|
<Actions v-if="!isLoading && !isError && !isNew" :force-menu="true">
|
||||||
<ActionLink
|
<ActionLink v-if="!hideEventExport && hasDownloadURL"
|
||||||
v-if="!hideEventExport && hasDownloadURL"
|
:href="downloadURL">
|
||||||
:href="downloadURL"
|
|
||||||
>
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Download :size="20" decorative />
|
<Download :size="20" decorative />
|
||||||
</template>
|
</template>
|
||||||
{{ $t("calendar", "Export") }}
|
{{ $t("calendar", "Export") }}
|
||||||
</ActionLink>
|
</ActionLink>
|
||||||
<ActionButton
|
<ActionButton v-if="!canCreateRecurrenceException && !isReadOnly"
|
||||||
v-if="!canCreateRecurrenceException && !isReadOnly"
|
@click="duplicateEvent()">
|
||||||
@click="duplicateEvent()"
|
|
||||||
>
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<ContentDuplicate :size="20" decorative />
|
<ContentDuplicate :size="20" decorative />
|
||||||
</template>
|
</template>
|
||||||
{{ $t("calendar", "Duplicate") }}
|
{{ $t("calendar", "Duplicate") }}
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
<ActionButton
|
<ActionButton v-if="canDelete && !canCreateRecurrenceException"
|
||||||
v-if="canDelete && !canCreateRecurrenceException"
|
@click="deleteAndLeave(false)">
|
||||||
@click="deleteAndLeave(false)"
|
|
||||||
>
|
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<Delete :size="20" decorative />
|
<Delete :size="20" decorative />
|
||||||
</template>
|
</template>
|
||||||
@ -117,160 +107,162 @@
|
|||||||
</Actions>
|
</Actions>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CalendarPickerHeader
|
<!-- Zone de contenu scrollable -->
|
||||||
:value="selectedCalendar"
|
<div class="popover-content-wrapper">
|
||||||
:calendars="calendars"
|
<CalendarPickerHeader :value="selectedCalendar"
|
||||||
:is-read-only="isReadOnlyOrViewing || !canModifyCalendar"
|
:calendars="calendars"
|
||||||
@update:value="changeCalendar"
|
:is-read-only="isReadOnlyOrViewing || !canModifyCalendar"
|
||||||
/>
|
@update:value="changeCalendar" />
|
||||||
|
|
||||||
<PropertyTitle
|
<PropertyTitle :value="titleOrPlaceholder"
|
||||||
:value="titleOrPlaceholder"
|
:is-read-only="isReadOnlyOrViewing"
|
||||||
:is-read-only="isReadOnlyOrViewing"
|
@update:value="updateTitle" />
|
||||||
@update:value="updateTitle"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<PropertyTitleTimePicker
|
<PropertyTitleTimePicker :start-date="startDate"
|
||||||
:start-date="startDate"
|
:start-timezone="startTimezone"
|
||||||
:start-timezone="startTimezone"
|
:end-date="endDate"
|
||||||
:end-date="endDate"
|
:end-timezone="endTimezone"
|
||||||
:end-timezone="endTimezone"
|
:is-all-day="isAllDay"
|
||||||
:is-all-day="isAllDay"
|
:is-read-only="isReadOnlyOrViewing"
|
||||||
:is-read-only="isReadOnlyOrViewing"
|
:can-modify-all-day="canModifyAllDay"
|
||||||
:can-modify-all-day="canModifyAllDay"
|
:user-timezone="currentUserTimezone"
|
||||||
:user-timezone="currentUserTimezone"
|
@update-start-date="updateStartDate"
|
||||||
@update-start-date="updateStartDate"
|
@update-start-timezone="updateStartTimezone"
|
||||||
@update-start-timezone="updateStartTimezone"
|
@update-end-date="updateEndDate"
|
||||||
@update-end-date="updateEndDate"
|
@update-end-timezone="updateEndTimezone"
|
||||||
@update-end-timezone="updateEndTimezone"
|
@toggle-all-day="toggleAllDay" />
|
||||||
@toggle-all-day="toggleAllDay"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div style='display:flex ;margin-left: 7%;'>
|
<!-- Lieu du décès - plus petit -->
|
||||||
<div style='width:70%'>
|
<PropertyTitle class="property-lieu-deces property-small"
|
||||||
<PropertySelectAbsenceType
|
|
||||||
:value="absenceType"
|
|
||||||
:is-read-only="isReadOnly"
|
|
||||||
:prop-model="rfcProps.absenceType"
|
|
||||||
:noWrap='true'
|
|
||||||
sle
|
|
||||||
@update:value="updateAbsenceType" />
|
|
||||||
</div>
|
|
||||||
<!-- <div style='width:30% ;margin-top: -11px;'>
|
|
||||||
<PropertyIsPrivate
|
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
:is-private="isPrivate"
|
:prop-model="rfcProps.lieuDeces"
|
||||||
@toggle-is-private="toggleIsPrivate"/>
|
:value="lieuDeces"
|
||||||
</div> -->
|
: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='display:flex ;margin-left: 7%;'>
|
||||||
|
<div style='width:70%'>
|
||||||
|
<PropertySelectAbsenceType
|
||||||
|
:value="absenceType"
|
||||||
|
:is-read-only="isReadOnly"
|
||||||
|
:prop-model="rfcProps.absenceType"
|
||||||
|
:noWrap='true'
|
||||||
|
@update:value="updateAbsenceType" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<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"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <PropertyIsLeave
|
<!-- Zone des boutons fixes -->
|
||||||
:is-read-only="isReadOnlyOrViewing"
|
<div class="popover-buttons-wrapper">
|
||||||
:is-leave="isLeave"
|
<SaveButtons
|
||||||
@toggle-is-leave="toggleIsLeave"
|
v-if="!isWidget"
|
||||||
/> -->
|
class="event-popover__buttons"
|
||||||
|
:can-create-recurrence-exception="canCreateRecurrenceException"
|
||||||
<!-- <PropertyIsCalendarPending
|
:is-new="isNew"
|
||||||
:is-read-only="isReadOnlyOrViewing"
|
:is-read-only="isReadOnlyOrViewing"
|
||||||
:is-calendar-pending="isCalendarPending"
|
:force-this-and-all-future="forceThisAndAllFuture"
|
||||||
@toggle-is-calendar-pending="toggleIsCalendarPending" /> -->
|
:show-more-button="true"
|
||||||
|
:more-button-type="isViewing ? 'tertiary' : undefined"
|
||||||
<PropertySelectClient
|
:grow-horizontally="!isViewing && canCreateRecurrenceException"
|
||||||
class="property-location"
|
:disabled="isSaving"
|
||||||
url="/apps/gestion/ajaxGetClientsName"
|
:is-calendar-pending="isCalendarPending"
|
||||||
:is-read-only="isReadOnly"
|
@save-this-only="saveAndView(false)"
|
||||||
:prop-model="rfcProps.clients"
|
@save-this-and-all-future="saveAndView(true)"
|
||||||
:value="client"
|
@show-more="showMore"
|
||||||
:linkify-links="true"
|
@save-pending-calendar-event="saveAsPendingCalendarEvent"
|
||||||
@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'"
|
|
||||||
>
|
>
|
||||||
Voir le defunt
|
<NcButton
|
||||||
</NcButton>
|
@click="viewDefunt"
|
||||||
<NcButton
|
v-if="defuntUrl"
|
||||||
v-if="!isReadOnly && isViewing"
|
:type="undefined"
|
||||||
:type="isViewedByAttendee ? 'tertiary' : undefined"
|
:class="'d-flex w-max-content'"
|
||||||
@click="isViewing = false"
|
>
|
||||||
>
|
Voir le defunt
|
||||||
<template #icon>
|
</NcButton>
|
||||||
<EditIcon :size="20" />
|
<NcButton
|
||||||
</template>
|
v-if="!isReadOnly && isViewing"
|
||||||
{{ $t("calendar", "Edit") }}
|
:type="isViewedByAttendee ? 'tertiary' : undefined"
|
||||||
</NcButton>
|
@click="isViewing = false"
|
||||||
</SaveButtons>
|
>
|
||||||
|
<template #icon>
|
||||||
|
<EditIcon :size="20" />
|
||||||
|
</template>
|
||||||
|
{{ $t("calendar", "Edit") }}
|
||||||
|
</NcButton>
|
||||||
|
</SaveButtons>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</Popover>
|
</Popover>
|
||||||
@ -297,7 +289,7 @@ import InvitationResponseButtons from "../components/Editor/InvitationResponseBu
|
|||||||
import CalendarPickerHeader from "../components/Editor/CalendarPickerHeader.vue";
|
import CalendarPickerHeader from "../components/Editor/CalendarPickerHeader.vue";
|
||||||
import InviteesList from "../components/Editor/Invitees/InviteesList.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 Close from "vue-material-design-icons/Close.vue";
|
||||||
import Delete from "vue-material-design-icons/Delete.vue";
|
import Delete from "vue-material-design-icons/Delete.vue";
|
||||||
import Download from "vue-material-design-icons/Download.vue";
|
import Download from "vue-material-design-icons/Download.vue";
|
||||||
@ -361,7 +353,7 @@ export default {
|
|||||||
boundaryElement: null,
|
boundaryElement: null,
|
||||||
isVisible: true,
|
isVisible: true,
|
||||||
isViewing: true,
|
isViewing: true,
|
||||||
defuntUrl: undefined,
|
defuntUrl: undefined
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -607,7 +599,148 @@ export default {
|
|||||||
},
|
},
|
||||||
viewDefunt() {
|
viewDefunt() {
|
||||||
window.open(this.defuntUrl, "_blank");
|
window.open(this.defuntUrl, "_blank");
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</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>
|
||||||
|
|
||||||
|
|||||||
@ -99,6 +99,7 @@ return [
|
|||||||
|
|
||||||
// generation attestation pacemaker, rapport de soins, de bijoux
|
// generation attestation pacemaker, rapport de soins, de bijoux
|
||||||
['name' => 'page#saveAttestationPacemaker', 'url' => '/saveAttestationPacemaker', 'verb' => 'POST'],
|
['name' => 'page#saveAttestationPacemaker', 'url' => '/saveAttestationPacemaker', 'verb' => 'POST'],
|
||||||
|
['name' => 'page#saveAttestationAbsentPacemaker', 'url' => '/saveAttestationAbsentPacemaker', 'verb' => 'POST'],
|
||||||
['name' => 'page#saveRapportSoin', 'url' => '/saveRapportSoin', 'verb' => 'POST'],
|
['name' => 'page#saveRapportSoin', 'url' => '/saveRapportSoin', 'verb' => 'POST'],
|
||||||
['name' => 'page#saveRapportBijoux', 'url' => '/saveRapportBijoux', 'verb' => 'POST'],
|
['name' => 'page#saveRapportBijoux', 'url' => '/saveRapportBijoux', 'verb' => 'POST'],
|
||||||
|
|
||||||
|
|||||||
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
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
@ -2028,265 +2028,268 @@ class PageController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
*/
|
*/
|
||||||
public function apiReloadFec() {
|
public function apiReloadFec()
|
||||||
$this->reloadFec();
|
{
|
||||||
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
|
$this->reloadFec();
|
||||||
}
|
return new DataResponse("", 200, ['Content-Type' => 'application/json']);
|
||||||
|
}
|
||||||
|
|
||||||
private function reloadFec(){
|
private function reloadFec()
|
||||||
$current_config = json_decode($this->myDb->getConfiguration($this->idNextcloud));
|
{
|
||||||
$clean_folder = html_entity_decode($current_config[0]->path).'/';
|
$current_config = json_decode($this->myDb->getConfiguration($this->idNextcloud));
|
||||||
|
$clean_folder = html_entity_decode($current_config[0]->path).'/';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
$data_factures = array();
|
$data_factures = array();
|
||||||
$factures = json_decode($this->myDb->getFacturesListWithDependencies());
|
$factures = json_decode($this->myDb->getFacturesListWithDependencies());
|
||||||
foreach ($factures as $key => $facture) {
|
foreach ($factures as $key => $facture) {
|
||||||
$factureIsSingle = $facture->facture_type == FactureTypeConstant::TYPE_SINGLE;
|
$factureIsSingle = $facture->facture_type == FactureTypeConstant::TYPE_SINGLE;
|
||||||
$facture_temp = array(
|
$facture_temp = array(
|
||||||
'num' => $facture->num,
|
'num' => $facture->num,
|
||||||
'client' => $facture->entreprise,
|
'client' => $facture->entreprise,
|
||||||
'nom_client' => $facture->nom,
|
'nom_client' => $facture->nom,
|
||||||
'date' => $facture->date,
|
'date' => $facture->date,
|
||||||
'date_facture' => $facture->date_paiement,
|
'date_facture' => $facture->date_paiement,
|
||||||
'defunt' => $facture->nom_defunt,
|
'defunt' => $facture->nom_defunt,
|
||||||
'montant_htc' => 0,
|
'montant_htc' => 0,
|
||||||
'tva' => $current_config[0]->tva_default,
|
'tva' => $current_config[0]->tva_default,
|
||||||
'montant_tva' => 0,
|
'montant_tva' => 0,
|
||||||
'montant_ttc' => 0,
|
'montant_ttc' => 0,
|
||||||
);
|
);
|
||||||
if($factureIsSingle){
|
if($factureIsSingle) {
|
||||||
$produits = json_decode($this->getProduitsById($facture->id_devis));
|
$produits = json_decode($this->getProduitsById($facture->id_devis));
|
||||||
foreach ($produits as $key => $produit) {
|
foreach ($produits as $key => $produit) {
|
||||||
$htPrice = $produit->prix_unitaire;
|
$htPrice = $produit->prix_unitaire;
|
||||||
if($facture->fk_client_group_id != null || $facture->fk_client_group_id != 0){
|
if($facture->fk_client_group_id != null || $facture->fk_client_group_id != 0) {
|
||||||
$price = $this->myDb->getProductPriceByClientGroupId($facture->fk_client_group_id,$produit->id);
|
$price = $this->myDb->getProductPriceByClientGroupId($facture->fk_client_group_id, $produit->id);
|
||||||
if($price != null){
|
if($price != null) {
|
||||||
$htPrice = $price;
|
$htPrice = $price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$facture_temp['montant_htc'] += $htPrice * $produit->quantite;
|
$facture_temp['montant_htc'] += $htPrice * $produit->quantite;
|
||||||
};
|
};
|
||||||
$facture_temp['montant_tva'] = ($facture_temp['montant_htc'] * $facture_temp['tva'])/100;
|
$facture_temp['montant_tva'] = ($facture_temp['montant_htc'] * $facture_temp['tva']) / 100;
|
||||||
$facture_temp['montant_ttc'] = $facture_temp['montant_tva'] + $facture_temp['montant_htc'];
|
$facture_temp['montant_ttc'] = $facture_temp['montant_tva'] + $facture_temp['montant_htc'];
|
||||||
}
|
} else {
|
||||||
else{
|
$devis = $this->myDb->getDevisByFkFactureId($facture->id);
|
||||||
$devis = $this->myDb->getDevisByFkFactureId($facture->id);
|
$factureGroupIsRelatedToAnyDevis = $devis != null;
|
||||||
$factureGroupIsRelatedToAnyDevis = $devis != null;
|
$mentionFilters = [
|
||||||
$mentionFilters = [
|
DevisMentionConstant::FACTURED,
|
||||||
DevisMentionConstant::FACTURED,
|
DevisMentionConstant::FACTURED_FORMATTED
|
||||||
DevisMentionConstant::FACTURED_FORMATTED
|
];
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
$isFactureGroupForSingleClient = $facture->facture_client_id != null && $facture->facture_client_id != 0;
|
$isFactureGroupForSingleClient = $facture->facture_client_id != null && $facture->facture_client_id != 0;
|
||||||
if($isFactureGroupForSingleClient){
|
if($isFactureGroupForSingleClient) {
|
||||||
$facture_temp["client"] = $facture->facture_client_entreprise;
|
$facture_temp["client"] = $facture->facture_client_entreprise;
|
||||||
$facture_temp["nom_client"] = $facture->facture_client_name;
|
$facture_temp["nom_client"] = $facture->facture_client_name;
|
||||||
|
|
||||||
if(!$factureGroupIsRelatedToAnyDevis ){
|
if(!$factureGroupIsRelatedToAnyDevis) {
|
||||||
$devisList = $this->myDb->getDevisByClientIdAndMonthYear(
|
$devisList = $this->myDb->getDevisByClientIdAndMonthYear(
|
||||||
$facture->facture_client_id,
|
$facture->facture_client_id,
|
||||||
$facture->facture_month,
|
$facture->facture_month,
|
||||||
$facture->facture_year,
|
$facture->facture_year,
|
||||||
$mentionFilters
|
$mentionFilters
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
$facture_temp["client"] = $facture->group_code_comptable ?? '-';
|
||||||
$facture_temp["client"] = $facture->group_code_comptable ??'-';
|
$facture_temp["nom_client"] = $facture->facture_group_name;
|
||||||
$facture_temp["nom_client"] = $facture->facture_group_name;
|
|
||||||
|
|
||||||
if(!$factureGroupIsRelatedToAnyDevis ){
|
if(!$factureGroupIsRelatedToAnyDevis) {
|
||||||
$devisList = $this->myDb->getDevisByClientGroupFacturationIdAndMonthYear(
|
$devisList = $this->myDb->getDevisByClientGroupFacturationIdAndMonthYear(
|
||||||
$facture->facture_client_group_facturation_id,
|
$facture->facture_client_group_facturation_id,
|
||||||
$facture->facture_month,
|
$facture->facture_month,
|
||||||
$facture->facture_year,
|
$facture->facture_year,
|
||||||
[
|
[
|
||||||
DevisMentionConstant::FACTURED,
|
DevisMentionConstant::FACTURED,
|
||||||
DevisMentionConstant::FACTURED_FORMATTED
|
DevisMentionConstant::FACTURED_FORMATTED
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($factureGroupIsRelatedToAnyDevis){
|
if($factureGroupIsRelatedToAnyDevis) {
|
||||||
$devisList = $this->myDb->getDevisByClientIdByFactureId($facture->id, $mentionFilters );
|
$devisList = $this->myDb->getDevisByClientIdByFactureId($facture->id, $mentionFilters);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($devisList as $currentDevis){
|
foreach($devisList as $currentDevis) {
|
||||||
$produits = json_decode($this->getProduitsById($currentDevis['id']));
|
$produits = json_decode($this->getProduitsById($currentDevis['id']));
|
||||||
foreach ($produits as $key => $produit) {
|
foreach ($produits as $key => $produit) {
|
||||||
$htPrice = $produit->prix_unitaire;
|
$htPrice = $produit->prix_unitaire;
|
||||||
if($currentDevis["fk_client_group_id"] != null || $currentDevis["fk_client_group_id"] != 0){
|
if($currentDevis["fk_client_group_id"] != null || $currentDevis["fk_client_group_id"] != 0) {
|
||||||
$price = $this->myDb->getProductPriceByClientGroupId($currentDevis["fk_client_group_id"],$produit->id);
|
$price = $this->myDb->getProductPriceByClientGroupId($currentDevis["fk_client_group_id"], $produit->id);
|
||||||
if($price != null){
|
if($price != null) {
|
||||||
$htPrice = $price;
|
$htPrice = $price;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$facture_temp['montant_htc'] += $htPrice * $produit->quantite;
|
$facture_temp['montant_htc'] += $htPrice * $produit->quantite;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
$facture_temp['montant_tva'] = ($facture_temp['montant_htc'] * $facture_temp['tva'])/100;
|
$facture_temp['montant_tva'] = ($facture_temp['montant_htc'] * $facture_temp['tva']) / 100;
|
||||||
$facture_temp['montant_ttc'] = $facture_temp['montant_tva'] + $facture_temp['montant_htc'];
|
$facture_temp['montant_ttc'] = $facture_temp['montant_tva'] + $facture_temp['montant_htc'];
|
||||||
}
|
}
|
||||||
|
|
||||||
array_push($data_factures, $facture_temp);
|
array_push($data_factures, $facture_temp);
|
||||||
};
|
};
|
||||||
$data_temp = array();
|
$data_temp = array();
|
||||||
foreach ($data_factures as $key => $facture) {
|
foreach ($data_factures as $key => $facture) {
|
||||||
$datesplit = explode('-', $facture['date_facture']);
|
$datesplit = explode('-', $facture['date_facture']);
|
||||||
if($data_temp[strval($datesplit[0])]==NULL) {
|
if($data_temp[strval($datesplit[0])] == null) {
|
||||||
$data_temp[strval($datesplit[0])][strval($datesplit[1])] = array(0=>$facture);
|
$data_temp[strval($datesplit[0])][strval($datesplit[1])] = array(0 => $facture);
|
||||||
} else {
|
} else {
|
||||||
if($data_temp[strval($datesplit[0])][strval($datesplit[1])]==NULL) {
|
if($data_temp[strval($datesplit[0])][strval($datesplit[1])] == null) {
|
||||||
$data_temp[strval($datesplit[0])][strval($datesplit[1])] = array(0=>$facture);
|
$data_temp[strval($datesplit[0])][strval($datesplit[1])] = array(0 => $facture);
|
||||||
} else {
|
} else {
|
||||||
array_push($data_temp[strval($datesplit[0])][strval($datesplit[1])], $facture);
|
array_push($data_temp[strval($datesplit[0])][strval($datesplit[1])], $facture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fec_headers_txt = [
|
$fec_headers_txt = [
|
||||||
utf8_decode('JOURNALCODE'),
|
utf8_decode('JOURNALCODE'),
|
||||||
utf8_decode('JOURNALLIB'),
|
utf8_decode('JOURNALLIB'),
|
||||||
utf8_decode('ECRITURENUM'),
|
utf8_decode('ECRITURENUM'),
|
||||||
utf8_decode('ECRITUREDATE'),
|
utf8_decode('ECRITUREDATE'),
|
||||||
utf8_decode('COMPTENUM'),
|
utf8_decode('COMPTENUM'),
|
||||||
utf8_decode('COMPTELIB'),
|
utf8_decode('COMPTELIB'),
|
||||||
utf8_decode('COMPAUXLIB'),
|
utf8_decode('COMPAUXLIB'),
|
||||||
utf8_decode('COMPAUXNUM'),
|
utf8_decode('COMPAUXNUM'),
|
||||||
utf8_decode('PIECEREF'),
|
utf8_decode('PIECEREF'),
|
||||||
utf8_decode('PIECEDATE'),
|
utf8_decode('PIECEDATE'),
|
||||||
utf8_decode('ECRITURELIB'),
|
utf8_decode('ECRITURELIB'),
|
||||||
utf8_decode('DEBIT'),
|
utf8_decode('DEBIT'),
|
||||||
utf8_decode('CREDIT'),
|
utf8_decode('CREDIT'),
|
||||||
utf8_decode('ECRITURELET'),
|
utf8_decode('ECRITURELET'),
|
||||||
utf8_decode('DATELET'),
|
utf8_decode('DATELET'),
|
||||||
utf8_decode('VALIDDATE'),
|
utf8_decode('VALIDDATE'),
|
||||||
utf8_decode('MONTANTDEVISE'),
|
utf8_decode('MONTANTDEVISE'),
|
||||||
utf8_decode('IDEVISE'),
|
utf8_decode('IDEVISE'),
|
||||||
];
|
];
|
||||||
//parcours annee
|
//parcours annee
|
||||||
foreach ($data_temp as $key_annee => $annee) {
|
foreach ($data_temp as $key_annee => $annee) {
|
||||||
//parcours annee
|
//parcours annee
|
||||||
$_clean_folder = $clean_folder.'FEC/'.$key_annee.'/';
|
$_clean_folder = $clean_folder.'FEC/'.$key_annee.'/';
|
||||||
try {
|
try {
|
||||||
$this->storage->newFolder($_clean_folder);
|
$this->storage->newFolder($_clean_folder);
|
||||||
} catch(\OCP\Files\NotPermittedException $e) { }
|
} catch(\OCP\Files\NotPermittedException $e) {
|
||||||
foreach ($annee as $key_mois => $mois) {
|
}
|
||||||
// Initialize FEC headers
|
foreach ($annee as $key_mois => $mois) {
|
||||||
|
// Initialize FEC headers
|
||||||
|
|
||||||
$fec_temp_txt = implode(TAB1, $fec_headers_txt) . PHP_EOL . PHP_EOL;
|
$fec_temp_txt = implode(TAB1, $fec_headers_txt) . PHP_EOL . PHP_EOL;
|
||||||
$fec_temp = implode(';', $fec_headers_txt) . "\n\n";
|
$fec_temp = implode(';', $fec_headers_txt) . "\n\n";
|
||||||
|
|
||||||
foreach ($mois as $key => $facture) {
|
foreach ($mois as $key => $facture) {
|
||||||
// Define FEC entry data
|
// Define FEC entry data
|
||||||
$fec_entries = [
|
$fec_entries = [
|
||||||
[
|
[
|
||||||
'journal' => 'VT',
|
'journal' => 'VT',
|
||||||
'journal_lib' => 'VENTES',
|
'journal_lib' => 'VENTES',
|
||||||
'ecriturenum' => '',
|
'ecriturenum' => '',
|
||||||
'date' => $facture['date_facture'],
|
'date' => $facture['date_facture'],
|
||||||
'compte' => $facture['client'],
|
'compte' => $facture['client'],
|
||||||
'libelle_compte' => $facture['client'],
|
'libelle_compte' => $facture['client'],
|
||||||
'compauxlib' => '',
|
'compauxlib' => '',
|
||||||
'compauxnum' => '',
|
'compauxnum' => '',
|
||||||
'piece' => $facture['num'],
|
'piece' => $facture['num'],
|
||||||
'piece_date' => '',
|
'piece_date' => '',
|
||||||
'libelle_ecriture' => $facture['nom_client'],
|
'libelle_ecriture' => $facture['nom_client'],
|
||||||
'debit' => $facture['montant_ttc'],
|
'debit' => $facture['montant_ttc'],
|
||||||
'credit' => '0',
|
'credit' => '0',
|
||||||
'ecriture_lettrage' => '',
|
'ecriture_lettrage' => '',
|
||||||
'date_lettrage' => '',
|
'date_lettrage' => '',
|
||||||
'valid_date' => '',
|
'valid_date' => '',
|
||||||
'montant_devise' => '',
|
'montant_devise' => '',
|
||||||
'devise' => 'EUR',
|
'devise' => 'EUR',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'journal' => 'VT',
|
'journal' => 'VT',
|
||||||
'journal_lib' => 'VENTES',
|
'journal_lib' => 'VENTES',
|
||||||
'ecriturenum' => '',
|
'ecriturenum' => '',
|
||||||
'date' => $facture['date_facture'],
|
'date' => $facture['date_facture'],
|
||||||
'compte' => '706000',
|
'compte' => '706000',
|
||||||
'libelle_compte' => 'VENTES DE MARCHANDISES',
|
'libelle_compte' => 'VENTES DE MARCHANDISES',
|
||||||
'compauxlib' => '',
|
'compauxlib' => '',
|
||||||
'compauxnum' => '',
|
'compauxnum' => '',
|
||||||
'piece' => $facture['num'],
|
'piece' => $facture['num'],
|
||||||
'piece_date' => '',
|
'piece_date' => '',
|
||||||
'libelle_ecriture' => $facture['client'],
|
'libelle_ecriture' => $facture['client'],
|
||||||
'debit' => '0',
|
'debit' => '0',
|
||||||
'credit' => $facture['montant_htc'],
|
'credit' => $facture['montant_htc'],
|
||||||
'ecriture_lettrage' => '',
|
'ecriture_lettrage' => '',
|
||||||
'date_lettrage' => '',
|
'date_lettrage' => '',
|
||||||
'valid_date' => '',
|
'valid_date' => '',
|
||||||
'montant_devise' => '',
|
'montant_devise' => '',
|
||||||
'devise' => 'EUR',
|
'devise' => 'EUR',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'journal' => 'VT',
|
'journal' => 'VT',
|
||||||
'journal_lib' => 'VENTES',
|
'journal_lib' => 'VENTES',
|
||||||
'ecriturenum' => '',
|
'ecriturenum' => '',
|
||||||
'date' => $facture['date_facture'],
|
'date' => $facture['date_facture'],
|
||||||
'compte' => '445710',
|
'compte' => '445710',
|
||||||
'compauxlib' => '',
|
'compauxlib' => '',
|
||||||
'compauxnum' => '',
|
'compauxnum' => '',
|
||||||
'libelle_compte' => '',
|
'libelle_compte' => '',
|
||||||
'piece' => $facture['num'],
|
'piece' => $facture['num'],
|
||||||
'piece_date' => '',
|
'piece_date' => '',
|
||||||
'libelle_ecriture' => $facture['client'],
|
'libelle_ecriture' => $facture['client'],
|
||||||
'debit' => '',
|
'debit' => '',
|
||||||
'credit' => $facture['montant_tva'],
|
'credit' => $facture['montant_tva'],
|
||||||
'ecriture_lettrage' => '',
|
'ecriture_lettrage' => '',
|
||||||
'date_lettrage' => '',
|
'date_lettrage' => '',
|
||||||
'valid_date' => '',
|
'valid_date' => '',
|
||||||
'montant_devise' => '',
|
'montant_devise' => '',
|
||||||
'devise' => 'EUR',
|
'devise' => 'EUR',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
// Generate FEC entries
|
// Generate FEC entries
|
||||||
foreach ($fec_entries as $entry) {
|
foreach ($fec_entries as $entry) {
|
||||||
$fec_line_txt = [
|
$fec_line_txt = [
|
||||||
$entry['journal'], $entry['journal_lib'], $entry['ecriturenum'], $entry['date'],
|
$entry['journal'], $entry['journal_lib'], $entry['ecriturenum'], $entry['date'],
|
||||||
$entry['compte'], $entry['libelle_compte'],
|
$entry['compte'], $entry['libelle_compte'],
|
||||||
$entry['compauxlib'], $entry['compauxnum'],
|
$entry['compauxlib'], $entry['compauxnum'],
|
||||||
$entry['piece'], $entry['piece_date'],
|
$entry['piece'], $entry['piece_date'],
|
||||||
$entry['libelle_ecriture'], $entry['debit'],$entry['credit'],$entry['ecriture_lettrage'],
|
$entry['libelle_ecriture'], $entry['debit'],$entry['credit'],$entry['ecriture_lettrage'],
|
||||||
$entry['date_lettrage'], $entry['valid_date'], $entry['montant_devise'], $entry['devise']
|
$entry['date_lettrage'], $entry['valid_date'], $entry['montant_devise'], $entry['devise']
|
||||||
];
|
];
|
||||||
|
|
||||||
$fec_line_csv = [
|
$fec_line_csv = [
|
||||||
$entry['journal'], $entry['journal_lib'], $entry['ecriturenum'], $entry['date'],
|
$entry['journal'], $entry['journal_lib'], $entry['ecriturenum'], $entry['date'],
|
||||||
$entry['compte'], $entry['libelle_compte'],
|
$entry['compte'], $entry['libelle_compte'],
|
||||||
$entry['compauxlib'], $entry['compauxnum'],
|
$entry['compauxlib'], $entry['compauxnum'],
|
||||||
$entry['piece'], $entry['piece_date'],
|
$entry['piece'], $entry['piece_date'],
|
||||||
$entry['libelle_ecriture'], $entry['debit'],$entry['credit'],$entry['ecriture_lettrage'],
|
$entry['libelle_ecriture'], $entry['debit'],$entry['credit'],$entry['ecriture_lettrage'],
|
||||||
$entry['date_lettrage'], $entry['valid_date'], $entry['montant_devise'], $entry['devise']
|
$entry['date_lettrage'], $entry['valid_date'], $entry['montant_devise'], $entry['devise']
|
||||||
];
|
];
|
||||||
|
|
||||||
$fec_temp_txt .= implode(TAB1, $fec_line_txt) . PHP_EOL . PHP_EOL;
|
$fec_temp_txt .= implode(TAB1, $fec_line_txt) . PHP_EOL . PHP_EOL;
|
||||||
$fec_temp .= implode(';', $fec_line_csv) . "\n\n";
|
$fec_temp .= implode(';', $fec_line_csv) . "\n\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ff = $_clean_folder.'FEC_'.$key_mois.'_'.$key_annee.'.csv';
|
$ff = $_clean_folder.'FEC_'.$key_mois.'_'.$key_annee.'.csv';
|
||||||
$this->storage->newFile($ff);
|
$this->storage->newFile($ff);
|
||||||
$file = $this->storage->get($ff);
|
$file = $this->storage->get($ff);
|
||||||
$file->putContent($fec_temp);
|
$file->putContent($fec_temp);
|
||||||
|
|
||||||
$ff_txt = $_clean_folder.'FEC_'.$key_mois.'_'.$key_annee.'.txt';
|
$ff_txt = $_clean_folder.'FEC_'.$key_mois.'_'.$key_annee.'.txt';
|
||||||
$this->storage->newFile($ff_txt);
|
$this->storage->newFile($ff_txt);
|
||||||
$file_txt = $this->storage->get($ff_txt);
|
$file_txt = $this->storage->get($ff_txt);
|
||||||
$file_txt->putContent($fec_temp_txt);
|
$file_txt->putContent($fec_temp_txt);
|
||||||
// $file->putContent(implode(';', array('Jane Smith', 'janesmith@example.com', '555-5678')) . "\n");
|
// $file->putContent(implode(';', array('Jane Smith', 'janesmith@example.com', '555-5678')) . "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch(\OCP\Files\NotFoundException $e) { }
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
|
}
|
||||||
|
|
||||||
} catch(\OCP\Files\NotPermittedException $e) { }
|
} catch(\OCP\Files\NotPermittedException $e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function refreshFEC()
|
private function refreshFEC()
|
||||||
{
|
{
|
||||||
@ -2985,9 +2988,14 @@ class PageController extends Controller
|
|||||||
$pdf->Cell($pdf->GetPageWidth() - 30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[0]->prenom)), 0, 0, 'L');
|
$pdf->Cell($pdf->GetPageWidth() - 30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[0]->prenom)), 0, 0, 'L');
|
||||||
$pdf->setY($pdf->GetY() + 5);
|
$pdf->setY($pdf->GetY() + 5);
|
||||||
|
|
||||||
|
$signatureExist = $this->signatureImageExists('sign.jpg');
|
||||||
|
if($signatureExist) {
|
||||||
|
$pdf->Image($this->defaultImagePath."sign.jpg", 13, $pdf->GetY() + 8, 55, 25);
|
||||||
|
}
|
||||||
|
|
||||||
$signatureExist = $this->signatureImageExists('sign.png');
|
$signatureExist = $this->signatureImageExists('sign.png');
|
||||||
if($signatureExist) {
|
if($signatureExist) {
|
||||||
$pdf->Image($this->defaultImagePath."sign.png", 13, $pdf->GetY(), 40, 15);
|
$pdf->Image($this->defaultImagePath."sign.png", 13, $pdf->GetY() + 40, 40, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->setY($pdf->GetY() - 5);
|
$pdf->setY($pdf->GetY() - 5);
|
||||||
@ -3193,9 +3201,14 @@ class PageController extends Controller
|
|||||||
$pdf->Cell($pdf->GetPageWidth() - 30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[0]->prenom)), 0, 0, 'L');
|
$pdf->Cell($pdf->GetPageWidth() - 30, 0, utf8_decode(html_entity_decode($defaultConfig[0]->nom).' '.html_entity_decode($defaultConfig[0]->prenom)), 0, 0, 'L');
|
||||||
$pdf->setY($pdf->GetY() + 5);
|
$pdf->setY($pdf->GetY() + 5);
|
||||||
|
|
||||||
|
$signatureExist = $this->signatureImageExists('sign.jpg');
|
||||||
|
if($signatureExist) {
|
||||||
|
$pdf->Image($this->defaultImagePath."sign.jpg", 10, $pdf->GetY() + 5, 55, 25);
|
||||||
|
}
|
||||||
|
|
||||||
$signatureExist = $this->signatureImageExists('sign.png');
|
$signatureExist = $this->signatureImageExists('sign.png');
|
||||||
if ($signatureExist) {
|
if ($signatureExist) {
|
||||||
$pdf->Image($this->defaultImagePath."sign.png", 10, $pdf->GetY(), 40, 15);
|
$pdf->Image($this->defaultImagePath."sign.png", 10, $pdf->GetY() + 35, 40, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdf->setY($pdf->GetY() - 5);
|
$pdf->setY($pdf->GetY() - 5);
|
||||||
@ -3649,6 +3662,29 @@ class PageController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @NoCSRFRequired
|
||||||
|
* @param int $defuntId
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function saveAttestationAbsentPacemaker($defuntId, $email = '')
|
||||||
|
{
|
||||||
|
|
||||||
|
try {
|
||||||
|
$careCertificateFilename = $this->certificateService->generatePacemakerAbsentCertificate($defuntId, $this->idNextcloud);
|
||||||
|
if($careCertificateFilename != null && trim($email) != '') {
|
||||||
|
//send email
|
||||||
|
$this->sendAttachmentToClientByDefunt($defuntId, $careCertificateFilename, $email, "Retrait de pile", "Vous trouverez en pièce jointe l'attestation de retrait de pile ", true);
|
||||||
|
|
||||||
|
}
|
||||||
|
return $careCertificateFilename;
|
||||||
|
|
||||||
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class Bdd
|
|||||||
"quantite", "date_paiement", "type_paiement", "id_devis", "reference", "description", "prix_unitaire", "legal_two", "path", "tva_default", "coefficient_ik",
|
"quantite", "date_paiement", "type_paiement", "id_devis", "reference", "description", "prix_unitaire", "legal_two", "path", "tva_default", "coefficient_ik",
|
||||||
"mentions_default", "version", "mentions", "comment", "status_paiement", "devise", "auto_invoice_number", "changelog", "format", "comment", "user_id",
|
"mentions_default", "version", "mentions", "comment", "status_paiement", "devise", "auto_invoice_number", "changelog", "format", "comment", "user_id",
|
||||||
"facture_prefixe", "arrivee", "depart", "latitude", "longitude", "id_lieu", "rang", "mois", "annee", "id_trajet", "commentaire","source",
|
"facture_prefixe", "arrivee", "depart", "latitude", "longitude", "id_lieu", "rang", "mois", "annee", "id_trajet", "commentaire","source",
|
||||||
"date_habilitation", "sexe", "observations_generales", "ref_pacemaker", "id_defunt", "article_id", "corpulence",
|
"date_habilitation", "sexe", "observations_generales", "ref_pacemaker", "id_defunt", "article_id", "corpulence", "lieu_deces",
|
||||||
"date_naissance", "heure_debut", "heure_fin", "rigidite", "lividite", "observations_corps", "acces", "acces_recherche", "acces_etat",
|
"date_naissance", "heure_debut", "heure_fin", "rigidite", "lividite", "observations_corps", "acces", "acces_recherche", "acces_etat",
|
||||||
"injection", "injection_diffusion", "injection_qte", "preinjection", "preinjection_qte", "coinjection", "coinjection_qte",
|
"injection", "injection_diffusion", "injection_qte", "preinjection", "preinjection_qte", "coinjection", "coinjection_qte",
|
||||||
"drainage", "drainage_qte", "drainage_etat", "ponction", "ponction_qte", "cavite", "cavite_qte", "desinfection", "lavage",
|
"drainage", "drainage_qte", "drainage_etat", "ponction", "ponction_qte", "cavite", "cavite_qte", "desinfection", "lavage",
|
||||||
@ -740,7 +740,7 @@ class Bdd
|
|||||||
|
|
||||||
public function getDefunts($idNextcloud, $isUserThanatoOnly = false)
|
public function getDefunts($idNextcloud, $isUserThanatoOnly = false)
|
||||||
{
|
{
|
||||||
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, "
|
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, ".$this->tableprefix."defunt.lieu_deces as lieu_deces, "
|
||||||
.$this->tableprefix."client.nom as nom_client, ".$this->tableprefix."client.id as id_client, "
|
.$this->tableprefix."client.nom as nom_client, ".$this->tableprefix."client.id as id_client, "
|
||||||
.$this->tableprefix."devis.num as numero_devis, ".$this->tableprefix."devis.id as id_devis, ".$this->tableprefix."devis.user_id as user_id, "
|
.$this->tableprefix."devis.num as numero_devis, ".$this->tableprefix."devis.id as id_devis, ".$this->tableprefix."devis.user_id as user_id, "
|
||||||
.$this->tableprefix."devis.date as devis_date, "
|
.$this->tableprefix."devis.date as devis_date, "
|
||||||
@ -783,7 +783,7 @@ class Bdd
|
|||||||
|
|
||||||
public function getUnusedDefunts($idNextcloud)
|
public function getUnusedDefunts($idNextcloud)
|
||||||
{
|
{
|
||||||
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe,"
|
$sql = "SELECT ".$this->tableprefix."defunt.id, ".$this->tableprefix."defunt.nom, ".$this->tableprefix."defunt.date_naissance, ".$this->tableprefix."defunt.ref_pacemaker, ".$this->tableprefix."defunt.sexe, ".$this->tableprefix."defunt.lieu_deces,"
|
||||||
.$this->tableprefix."devis.user_id as user_id
|
.$this->tableprefix."devis.user_id as user_id
|
||||||
FROM ".$this->tableprefix."defunt
|
FROM ".$this->tableprefix."defunt
|
||||||
LEFT JOIN ".$this->tableprefix."devis ON ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
|
LEFT JOIN ".$this->tableprefix."devis ON ".$this->tableprefix."devis.id_defunt = ".$this->tableprefix."defunt.id
|
||||||
@ -822,6 +822,7 @@ class Bdd
|
|||||||
.$this->tableprefix."defunt.heure_debut,"
|
.$this->tableprefix."defunt.heure_debut,"
|
||||||
.$this->tableprefix."defunt.heure_fin,"
|
.$this->tableprefix."defunt.heure_fin,"
|
||||||
.$this->tableprefix."defunt.corpulence,"
|
.$this->tableprefix."defunt.corpulence,"
|
||||||
|
.$this->tableprefix."defunt.lieu_deces,"
|
||||||
.$this->tableprefix."defunt.rigidite,"
|
.$this->tableprefix."defunt.rigidite,"
|
||||||
.$this->tableprefix."defunt.lividite,"
|
.$this->tableprefix."defunt.lividite,"
|
||||||
.$this->tableprefix."defunt.observations_corps,"
|
.$this->tableprefix."defunt.observations_corps,"
|
||||||
@ -1143,19 +1144,39 @@ class Bdd
|
|||||||
/**
|
/**
|
||||||
* Insert Defunt
|
* Insert Defunt
|
||||||
*/
|
*/
|
||||||
public function insertDefuntByName($name)
|
public function insertDefuntByName($name, $lieuDeces = null, $dateNaissance = null)
|
||||||
{
|
{
|
||||||
|
// 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` (
|
$sql = "INSERT INTO `".$this->tableprefix."defunt` (
|
||||||
`id_nextcloud`, `nom`, `sexe`, `date_naissance`, `ref_pacemaker`, `date`,
|
`id_nextcloud`, `nom`, `sexe`, `date_naissance`, `ref_pacemaker`, `date`,
|
||||||
`corpulence`, `observations_corps`, `observations_generales`
|
`corpulence`, `observations_corps`, `observations_generales`, `lieu_deces`
|
||||||
) VALUES (?,?,?,?,?,NOW(),?,?,?);";
|
) VALUES (?,?,?,?,?,NOW(),?,?,?,?);";
|
||||||
$this->execSQLNoData($sql, array('admin',$name, 'm', '1973-11-11', '', '', '', ''));
|
|
||||||
|
$this->execSQLNoData($sql, array(
|
||||||
|
'admin',
|
||||||
|
$name,
|
||||||
|
'm',
|
||||||
|
$dateNaissance,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
$lieuDecesValue
|
||||||
|
));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function insertDefuntByNameAndReturnId($name)
|
public function insertDefuntByNameAndReturnId($name, $lieuDeces = null, $dateNaissance = null)
|
||||||
{
|
{
|
||||||
$this->insertDefuntByName($name);
|
$this->insertDefuntByName($name, $lieuDeces, $dateNaissance);
|
||||||
return $this->getLastDefuntIdByName($name);
|
return $this->getLastDefuntIdByName($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2594,7 +2615,7 @@ class Bdd
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getThanatoDevisListByDate($thanatoId, $date)
|
private function getThanatoDevisListByDateSave($thanatoId, $date)
|
||||||
{
|
{
|
||||||
$dateFormatted = $date->format('Y-m-d');
|
$dateFormatted = $date->format('Y-m-d');
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
@ -2635,6 +2656,42 @@ class Bdd
|
|||||||
return $devisList;
|
return $devisList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getThanatoDevisListByDate($thanatoId, $date)
|
||||||
|
{
|
||||||
|
$dateFormatted = $date->format('Y-m-d');
|
||||||
|
$sql = "SELECT
|
||||||
|
devis.id,
|
||||||
|
devis.date,
|
||||||
|
devis.mentions,
|
||||||
|
devis.num as calendar_uuid,
|
||||||
|
devis.id_defunt as id_defunt,
|
||||||
|
devis.id_lieu as id_lieu,
|
||||||
|
devis.id_client as id_client,
|
||||||
|
devis.id_thanato as id_thanato,
|
||||||
|
thanato.nom as nom_thanato,
|
||||||
|
thanato.prenom as prenom_thanato,
|
||||||
|
defunt.nom as nom_defunt,
|
||||||
|
lieu.nom as nom_lieu,
|
||||||
|
lieu.latitude as lieu_latitude,
|
||||||
|
lieu.longitude as lieu_longitude,
|
||||||
|
client.nom as nom_client,
|
||||||
|
client.entreprise as client_entreprise,
|
||||||
|
client.adresse as client_adresse
|
||||||
|
FROM ".$this->tableprefix."devis as devis
|
||||||
|
LEFT JOIN ".$this->tableprefix."thanato as thanato on devis.id_thanato = thanato.id
|
||||||
|
LEFT JOIN ".$this->tableprefix."lieu as lieu on devis.id_lieu = lieu.id
|
||||||
|
LEFT JOIN ".$this->tableprefix."defunt as defunt on devis.id_defunt = defunt.id
|
||||||
|
LEFT JOIN ".$this->tableprefix."client as client on devis.id_client = client.id
|
||||||
|
WHERE devis.date = ? AND
|
||||||
|
devis.id_thanato = ?
|
||||||
|
ORDER BY devis.date ASC;";
|
||||||
|
$devisList = $this->execSQLNoJsonReturn(
|
||||||
|
$sql,
|
||||||
|
[$dateFormatted,$thanatoId]
|
||||||
|
);
|
||||||
|
return $devisList;
|
||||||
|
}
|
||||||
|
|
||||||
public function getThanatoById($thanatoId)
|
public function getThanatoById($thanatoId)
|
||||||
{
|
{
|
||||||
$sql = "SELECT id, nom, prenom,fk_user_uuid FROM ".$this->tableprefix."thanato WHERE id = ? LIMIT 1;";
|
$sql = "SELECT id, nom, prenom,fk_user_uuid FROM ".$this->tableprefix."thanato WHERE id = ? LIMIT 1;";
|
||||||
@ -3132,7 +3189,7 @@ class Bdd
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getClientFactureStatisticPerMonth($clientId, array $produitList)
|
private function getClientFactureStatisticPerMonthSave($clientId, array $produitList)
|
||||||
{
|
{
|
||||||
$currentYear = date('Y');
|
$currentYear = date('Y');
|
||||||
$monthLists = range(1, 12);
|
$monthLists = range(1, 12);
|
||||||
@ -3153,12 +3210,11 @@ class Bdd
|
|||||||
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
|
LEFT JOIN ".$this->tableprefix."devis as devis on facture.id_devis = devis.id
|
||||||
WHERE YEAR(facture.date_paiement) = ? AND
|
WHERE YEAR(facture.date_paiement) = ? AND
|
||||||
MONTH(facture.date_paiement) = ? AND
|
MONTH(facture.date_paiement) = ? AND
|
||||||
devis.id_client = ? AND
|
devis.id_client = ?
|
||||||
(devis.mentions = ? OR devis.mentions = ?)
|
|
||||||
ORDER BY facture.date_paiement ASC;";
|
ORDER BY facture.date_paiement ASC;";
|
||||||
$factureList = $this->execSQLNoJsonReturn(
|
$factureList = $this->execSQLNoJsonReturn(
|
||||||
$sql,
|
$sql,
|
||||||
[$currentYear,$monthValue,$clientId,DevisMentionConstant::FACTURED,DevisMentionConstant::FACTURED_FORMATTED]
|
[$currentYear,$monthValue,$clientId]
|
||||||
);
|
);
|
||||||
|
|
||||||
$factureDevisIds = [];
|
$factureDevisIds = [];
|
||||||
@ -3188,6 +3244,58 @@ class Bdd
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getClientFactureStatisticPerMonth($clientId, array $produitList, $clientGroupId = null)
|
||||||
|
{
|
||||||
|
$currentYear = date('Y');
|
||||||
|
$monthLists = range(1, 12);
|
||||||
|
$data = [] ;
|
||||||
|
foreach($monthLists as $monthValue) {
|
||||||
|
if(!isset($data[$monthValue])) {
|
||||||
|
$data[$monthValue] = [];
|
||||||
|
}
|
||||||
|
$sql = "SELECT
|
||||||
|
devis.id as devis_id,
|
||||||
|
devis.id_client as devis_client_id,
|
||||||
|
devis.date as devis_date,
|
||||||
|
devis.mentions as devis_mention
|
||||||
|
FROM ".$this->tableprefix."devis as devis
|
||||||
|
WHERE YEAR(devis.date) = ? AND
|
||||||
|
MONTH(devis.date) = ? AND
|
||||||
|
devis.id_client = ?
|
||||||
|
ORDER BY devis.date ASC;";
|
||||||
|
$factureList = $this->execSQLNoJsonReturn(
|
||||||
|
$sql,
|
||||||
|
[$currentYear,$monthValue,$clientId]
|
||||||
|
);
|
||||||
|
|
||||||
|
$factureDevisIds = [];
|
||||||
|
foreach($factureList as $facture) {
|
||||||
|
$factureDevisIds[] = $facture['devis_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$defuntCount = count($factureList);
|
||||||
|
$produitsPrice = 0;
|
||||||
|
$statisticForeachProductPerMonth = [];
|
||||||
|
foreach($produitList as $produit) {
|
||||||
|
if(!isset($statisticForeachProductPerMonth[$produit['id']])) {
|
||||||
|
$statisticForeachProductPerMonth[$produit['id']] = 0;
|
||||||
|
}
|
||||||
|
$productTotalCount = $this->getDevisProductsQuantityByDevisListAndProductId($factureDevisIds, $produit['id']);
|
||||||
|
$prixUnitaire = is_null($clientGroupId) ? $produit["prix_unitaire"] : $this->getProductPriceByClientGroupId($clientGroupId, $produit['id']);
|
||||||
|
$totalWithoutVat = $productTotalCount * $prixUnitaire;
|
||||||
|
$statisticForeachProductPerMonth[$produit['id']] += $productTotalCount;
|
||||||
|
$produitsPrice += $totalWithoutVat;
|
||||||
|
}
|
||||||
|
$data[$monthValue] = [
|
||||||
|
"defunt_count" => $defuntCount,
|
||||||
|
"total_price" => $produitsPrice,
|
||||||
|
"year" => $currentYear,
|
||||||
|
"products" => $statisticForeachProductPerMonth
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
public function getExportClientStatData(array $clientIds)
|
public function getExportClientStatData(array $clientIds)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
@ -3201,9 +3309,10 @@ class Bdd
|
|||||||
$client = $this->getClientById($clientId);
|
$client = $this->getClientById($clientId);
|
||||||
if($client != null) {
|
if($client != null) {
|
||||||
$clientName = trim($client["client_nom"]) . '-' .trim($client['client_entreprise']);
|
$clientName = trim($client["client_nom"]) . '-' .trim($client['client_entreprise']);
|
||||||
|
$clientGroupId = $client['fk_client_group_id'];
|
||||||
}
|
}
|
||||||
$data[$clientId]["client_name"] = $clientName;
|
$data[$clientId]["client_name"] = $clientName;
|
||||||
$data[$clientId]["client_data"] = $this->getClientFactureStatisticPerMonth($clientId, $produitList);
|
$data[$clientId]["client_data"] = $this->getClientFactureStatisticPerMonth($clientId, $produitList, $clientGroupId);
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -3463,6 +3572,7 @@ class Bdd
|
|||||||
devis.comment as devis_comment,
|
devis.comment as devis_comment,
|
||||||
devis.id_client as devis_id_client,
|
devis.id_client as devis_id_client,
|
||||||
devis.devis_full_number,
|
devis.devis_full_number,
|
||||||
|
devis.mentions,
|
||||||
client.nom as client_nom,
|
client.nom as client_nom,
|
||||||
client.entreprise as client_entreprise,
|
client.entreprise as client_entreprise,
|
||||||
client.adresse as client_adresse,
|
client.adresse as client_adresse,
|
||||||
@ -3517,6 +3627,7 @@ class Bdd
|
|||||||
devis.comment as devis_comment,
|
devis.comment as devis_comment,
|
||||||
devis.id_client as devis_id_client,
|
devis.id_client as devis_id_client,
|
||||||
devis.devis_full_number,
|
devis.devis_full_number,
|
||||||
|
devis.mentions,
|
||||||
client.nom as client_nom,
|
client.nom as client_nom,
|
||||||
client.entreprise as client_entreprise,
|
client.entreprise as client_entreprise,
|
||||||
client.adresse as client_adresse,
|
client.adresse as client_adresse,
|
||||||
@ -4076,6 +4187,7 @@ class Bdd
|
|||||||
lieu.adresse as lieu_adresse,
|
lieu.adresse as lieu_adresse,
|
||||||
defunt.nom as defunt_nom,
|
defunt.nom as defunt_nom,
|
||||||
defunt.sexe as defunt_sexe,
|
defunt.sexe as defunt_sexe,
|
||||||
|
defunt.lieu_deces as lieu_deces,
|
||||||
defunt.ref_pacemaker as defunt_reference_pacemaker,
|
defunt.ref_pacemaker as defunt_reference_pacemaker,
|
||||||
defunt.product_brand as defunt_product_brand,
|
defunt.product_brand as defunt_product_brand,
|
||||||
defunt.product_reference as defunt_product_reference,
|
defunt.product_reference as defunt_product_reference,
|
||||||
@ -4107,11 +4219,13 @@ class Bdd
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDefuntById($defuntId)
|
public function getDefuntById($defuntId)
|
||||||
{
|
{
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
defunt.id as id,
|
defunt.id as id,
|
||||||
defunt.nom as defunt_nom,
|
defunt.nom as defunt_nom,
|
||||||
|
defunt.lieu_deces as lieu_deces,
|
||||||
|
defunt.date_naissance as date_naissance,
|
||||||
devis.id as devis_id
|
devis.id as devis_id
|
||||||
FROM ".$this->tableprefix."defunt as defunt
|
FROM ".$this->tableprefix."defunt as defunt
|
||||||
LEFT JOIN ".$this->tableprefix."devis as devis on defunt.id = devis.id_defunt
|
LEFT JOIN ".$this->tableprefix."devis as devis on defunt.id = devis.id_defunt
|
||||||
@ -4454,23 +4568,60 @@ COMMENTAIRES: ".$comment;
|
|||||||
$this->execSQLNoData($sql, [DevisMentionConstant::CANCELED,$devisId]);
|
$this->execSQLNoData($sql, [DevisMentionConstant::CANCELED,$devisId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function updateDefuntByName($defuntId, $requestedDefuntName)
|
/**
|
||||||
|
* Met à jour un défunt avec tous ses détails
|
||||||
|
*/
|
||||||
|
public function updateDefuntByNameAndDetails($defuntId, $name, $lieuDeces = null, $dateNaissance = null)
|
||||||
{
|
{
|
||||||
$sql = "UPDATE ".$this->tableprefix."defunt as defunt
|
// Gérer la date de naissance par défaut si null ou vide
|
||||||
SET defunt.nom = ?
|
if (empty($dateNaissance) || trim($dateNaissance) === '') {
|
||||||
WHERE defunt.id = ?";
|
$dateNaissance = '1973-11-11';
|
||||||
$this->execSQLNoData($sql, [$requestedDefuntName,$defuntId]);
|
}
|
||||||
|
|
||||||
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createOrUpdateDefuntByNameAndReturnDefuntId($defuntId, $currentDefuntName, $requestedDefuntName)
|
/**
|
||||||
|
* Version simplifiée pour rétrocompatibilité
|
||||||
|
*/
|
||||||
|
public function updateDefuntByName($defuntId, $name)
|
||||||
{
|
{
|
||||||
if($defuntId != null) {
|
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);
|
||||||
|
|
||||||
$defuntNameIsUpdated = $currentDefuntName != $requestedDefuntName;
|
$defuntNameIsUpdated = $currentDefuntName != $requestedDefuntName;
|
||||||
if($defuntNameIsUpdated) {
|
$lieuDecesIsUpdated = ($currentDefunt['lieu_deces'] ?? null) != $lieuDeces;
|
||||||
$this->updateDefuntByName($defuntId, $requestedDefuntName);
|
$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);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->insertDefuntByName($requestedDefuntName);
|
// Créer un nouveau défunt
|
||||||
|
$this->insertDefuntByName($requestedDefuntName, $lieuDeces, $dateNaissance);
|
||||||
$defunt = $this->getLastDefuntIdByName($requestedDefuntName);
|
$defunt = $this->getLastDefuntIdByName($requestedDefuntName);
|
||||||
$defuntId = $defunt['id'];
|
$defuntId = $defunt['id'];
|
||||||
}
|
}
|
||||||
@ -5222,21 +5373,22 @@ COMMENTAIRES: ".$comment;
|
|||||||
return $devisList;
|
return $devisList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDevisIdsGroupByFactureId($factureId,$mentionFilters = []){
|
public function getDevisIdsGroupByFactureId($factureId, $mentionFilters = [])
|
||||||
|
{
|
||||||
$sql = "SELECT devis.id
|
$sql = "SELECT devis.id
|
||||||
FROM ".$this->tableprefix."devis as devis
|
FROM ".$this->tableprefix."devis as devis
|
||||||
WHERE devis.fk_facture_id = ? ";
|
WHERE devis.fk_facture_id = ? ";
|
||||||
|
|
||||||
$conditions = [$factureId];
|
$conditions = [$factureId];
|
||||||
if(!empty($mentionFilters)){
|
if(!empty($mentionFilters)) {
|
||||||
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
|
$mentionsFilterPlaceholders = implode(',', array_fill(0, count($mentionFilters), '?'));
|
||||||
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
|
$sql .= " AND devis.mentions IN ($mentionsFilterPlaceholders)";
|
||||||
$conditions = array_merge($conditions, $mentionFilters);
|
$conditions = array_merge($conditions, $mentionFilters);
|
||||||
}
|
}
|
||||||
$sql.= ";";
|
$sql .= ";";
|
||||||
$devisList = $this->execSQLNoJsonReturn($sql,$conditions);
|
$devisList = $this->execSQLNoJsonReturn($sql, $conditions);
|
||||||
$devisIds = [];
|
$devisIds = [];
|
||||||
foreach($devisList as $devis){
|
foreach($devisList as $devis) {
|
||||||
$devisIds[] = $devis['id'];
|
$devisIds[] = $devis['id'];
|
||||||
}
|
}
|
||||||
return $devisIds;
|
return $devisIds;
|
||||||
@ -5683,7 +5835,7 @@ COMMENTAIRES: ".$comment;
|
|||||||
private function getProductsTotalPrices($products)
|
private function getProductsTotalPrices($products)
|
||||||
{
|
{
|
||||||
$configs = json_decode($this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
|
$configs = json_decode($this->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
|
||||||
$currentConfig = $configs[0];
|
$currentConfig = $configs[0];
|
||||||
$totalHt = 0;
|
$totalHt = 0;
|
||||||
$totalTtc = 0;
|
$totalTtc = 0;
|
||||||
foreach ($products as $product) {
|
foreach ($products as $product) {
|
||||||
@ -5699,11 +5851,12 @@ COMMENTAIRES: ".$comment;
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDevisIdsListByFactureId($factureId){
|
private function getDevisIdsListByFactureId($factureId)
|
||||||
|
{
|
||||||
$factureData = $this->getFactureByFactureId(factureId: $factureId);
|
$factureData = $this->getFactureByFactureId(factureId: $factureId);
|
||||||
$isFactureGroupOfDevis = $factureData["facture_type"] == FactureTypeConstant::TYPE_GROUP;
|
$isFactureGroupOfDevis = $factureData["facture_type"] == FactureTypeConstant::TYPE_GROUP;
|
||||||
$factureDevisIdsList = [];
|
$factureDevisIdsList = [];
|
||||||
if($isFactureGroupOfDevis){
|
if($isFactureGroupOfDevis) {
|
||||||
$isFactureForSingleClient = $factureData['fk_client_id'] != null && $factureData['fk_client_id'] != 0;
|
$isFactureForSingleClient = $factureData['fk_client_id'] != null && $factureData['fk_client_id'] != 0;
|
||||||
$devisMentionFilters = [
|
$devisMentionFilters = [
|
||||||
DevisMentionConstant::FACTURED_FORMATTED,
|
DevisMentionConstant::FACTURED_FORMATTED,
|
||||||
@ -5712,24 +5865,25 @@ COMMENTAIRES: ".$comment;
|
|||||||
$devis = $this->getDevisByFkFactureId($factureId);
|
$devis = $this->getDevisByFkFactureId($factureId);
|
||||||
$factureGroupIsRelatedToAnyDevis = $devis != null;
|
$factureGroupIsRelatedToAnyDevis = $devis != null;
|
||||||
if (!$factureGroupIsRelatedToAnyDevis) {
|
if (!$factureGroupIsRelatedToAnyDevis) {
|
||||||
if($isFactureForSingleClient){
|
if($isFactureForSingleClient) {
|
||||||
$factureDevisIdsList = $this->getDevisIdsByClientIdAndMonthYear(
|
$factureDevisIdsList = $this->getDevisIdsByClientIdAndMonthYear(
|
||||||
$factureData['fk_client_id'],
|
$factureData['fk_client_id'],
|
||||||
$factureData['month'],
|
$factureData['month'],
|
||||||
$factureData['year'],$devisMentionFilters
|
$factureData['year'],
|
||||||
|
$devisMentionFilters
|
||||||
);
|
);
|
||||||
}else{
|
} else {
|
||||||
$factureDevisIdsList = $this->getDevisIdsByClientGroupFacturationIdAndMonthYear(
|
$factureDevisIdsList = $this->getDevisIdsByClientGroupFacturationIdAndMonthYear(
|
||||||
$factureData['fk_client_group_facturation_id'],
|
$factureData['fk_client_group_facturation_id'],
|
||||||
$factureData['month'],
|
$factureData['month'],
|
||||||
$factureData['year'],$devisMentionFilters
|
$factureData['year'],
|
||||||
|
$devisMentionFilters
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$factureDevisIdsList = $this->getDevisIdsGroupByFactureId($factureId, $devisMentionFilters );
|
$factureDevisIdsList = $this->getDevisIdsGroupByFactureId($factureId, $devisMentionFilters);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$factureDevisIdsList = $factureData['id_devis'] ? [$factureData['id_devis']] : [];
|
$factureDevisIdsList = $factureData['id_devis'] ? [$factureData['id_devis']] : [];
|
||||||
}
|
}
|
||||||
return $factureDevisIdsList;
|
return $factureDevisIdsList;
|
||||||
@ -5741,7 +5895,7 @@ COMMENTAIRES: ".$comment;
|
|||||||
$totalHt = 0;
|
$totalHt = 0;
|
||||||
$totalTtc = 0;
|
$totalTtc = 0;
|
||||||
$tva = 0;
|
$tva = 0;
|
||||||
foreach($factureDevisIds as $devisId){
|
foreach($factureDevisIds as $devisId) {
|
||||||
$products = $this->getDevisProduits($devisId);
|
$products = $this->getDevisProduits($devisId);
|
||||||
$totalPrices = $this->getProductsTotalPrices($products);
|
$totalPrices = $this->getProductsTotalPrices($products);
|
||||||
$totalHt += $totalPrices["total_ht"];
|
$totalHt += $totalPrices["total_ht"];
|
||||||
|
|||||||
@ -34,35 +34,33 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class CalendarObjectCreatedListener implements IEventListener
|
class CalendarObjectCreatedListener implements IEventListener
|
||||||
{
|
{
|
||||||
|
/** @var LoggerInterface */
|
||||||
|
private $logger;
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var GestionService */
|
||||||
private $logger;
|
private $gestionService;
|
||||||
|
|
||||||
/** @var GestionService */
|
public function __construct(
|
||||||
private $gestionService;
|
LoggerInterface $logger,
|
||||||
|
GestionService $gestionService
|
||||||
public function __construct(
|
) {
|
||||||
LoggerInterface $logger,
|
$this->logger = $logger;
|
||||||
GestionService $gestionService
|
$this->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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,35 +35,34 @@ use Psr\Log\LoggerInterface;
|
|||||||
|
|
||||||
class CalendarObjectUpdatedListener implements IEventListener
|
class CalendarObjectUpdatedListener implements IEventListener
|
||||||
{
|
{
|
||||||
|
/** @var LoggerInterface */
|
||||||
|
private $logger;
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var GestionService */
|
||||||
private $logger;
|
private $gestionService;
|
||||||
|
|
||||||
/** @var GestionService */
|
public function __construct(
|
||||||
private $gestionService;
|
LoggerInterface $logger,
|
||||||
|
GestionService $gestionService
|
||||||
|
) {
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->gestionService = $gestionService;
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct(
|
public function handle(Event $event): void
|
||||||
LoggerInterface $logger,
|
{
|
||||||
GestionService $gestionService
|
if (!($event instanceof CalendarObjectUpdatedEvent)) {
|
||||||
) {
|
return;
|
||||||
$this->logger = $logger;
|
}
|
||||||
$this->gestionService = $gestionService;
|
$calendarData = $event->getObjectData();
|
||||||
}
|
try {
|
||||||
|
$vCalendarString = $calendarData["calendardata"];
|
||||||
public function handle(Event $event): void
|
$this->gestionService->HandleUpdatedCalendarObject($vCalendarString);
|
||||||
{
|
} catch (\OC\OCS\Exception $e) {
|
||||||
if (!($event instanceof CalendarObjectUpdatedEvent)) {
|
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
|
||||||
return;
|
} catch (\Throwable $e) {
|
||||||
}
|
$this->logger->debug("Error while handling updated calendar object: " . $e->getMessage());
|
||||||
$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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
70
gestion/lib/Migration/Version8Date20250904141530.php
Normal file
70
gestion/lib/Migration/Version8Date20250904141530.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace OCA\Gestion\Migration;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use OCP\IDBConnection;
|
||||||
|
use OCP\DB\ISchemaWrapper;
|
||||||
|
use OCP\Migration\IOutput;
|
||||||
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated migration step: Ajout du champ lieu_deces à la table defunt
|
||||||
|
*/
|
||||||
|
class Version8Date20250904141530 extends SimpleMigrationStep
|
||||||
|
{
|
||||||
|
private IDbConnection $db;
|
||||||
|
|
||||||
|
public function __construct(IDbConnection $db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param IOutput $output
|
||||||
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||||
|
* @param array $options
|
||||||
|
*/
|
||||||
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param IOutput $output
|
||||||
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||||
|
* @param array $options
|
||||||
|
* @return null|ISchemaWrapper
|
||||||
|
*/
|
||||||
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options)
|
||||||
|
{
|
||||||
|
/** @var ISchemaWrapper $schema */
|
||||||
|
$schema = $schemaClosure();
|
||||||
|
$tableprefix = "gestion_";
|
||||||
|
|
||||||
|
/** DEFUNT - Ajout du champ lieu_deces **/
|
||||||
|
if ($schema->hasTable($tableprefix.'defunt')) {
|
||||||
|
$table = $schema->getTable($tableprefix.'defunt');
|
||||||
|
|
||||||
|
if (!$table->hasColumn('lieu_deces')) {
|
||||||
|
$table->addColumn('lieu_deces', 'string', [
|
||||||
|
'length' => 255,
|
||||||
|
'notnull' => false,
|
||||||
|
'default' => null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param IOutput $output
|
||||||
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||||
|
* @param array $options
|
||||||
|
*/
|
||||||
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,119 +29,124 @@ namespace OCA\Gestion\Service\Certificate;
|
|||||||
use DateTime;
|
use DateTime;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use OCA\Gestion\Db\Bdd;
|
use OCA\Gestion\Db\Bdd;
|
||||||
|
use OCP\Files\IRootFolder;
|
||||||
use OCA\Gestion\Helpers\DateHelpers;
|
use OCA\Gestion\Helpers\DateHelpers;
|
||||||
use OCA\Gestion\Service\Certificate\PdfHandler\CareCertificatePdfHandler;
|
use OCA\Gestion\Service\Certificate\PdfHandler\CareCertificatePdfHandler;
|
||||||
use OCA\Gestion\Service\Certificate\PdfHandler\PacemakerCertificatePdfHandler;
|
use OCA\Gestion\Service\Certificate\PdfHandler\PacemakerCertificatePdfHandler;
|
||||||
use OCP\Files\IRootFolder;
|
use OCA\Gestion\Service\Certificate\PdfHandler\PacemakerAbsentCertificatePdfHandler;
|
||||||
|
|
||||||
class CertificateService {
|
class CertificateService
|
||||||
/** @var Bdd */
|
{
|
||||||
private $gestionBdd;
|
/** @var Bdd */
|
||||||
|
private $gestionBdd;
|
||||||
|
|
||||||
/** @var IRootFolder */
|
/** @var IRootFolder */
|
||||||
private $rootFolder;
|
private $rootFolder;
|
||||||
|
|
||||||
private const DEFAULT_NEXTCLOUD_ADMIN = "admin";
|
private const DEFAULT_NEXTCLOUD_ADMIN = "admin";
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
IRootFolder $rootFolder) {
|
IRootFolder $rootFolder
|
||||||
|
) {
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->gestionBdd = $gestionBdd;
|
||||||
$this->rootFolder = $rootFolder;
|
$this->rootFolder = $rootFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function signatureImageExists(){
|
private function signatureImageExists()
|
||||||
|
{
|
||||||
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
|
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
|
||||||
try{
|
try {
|
||||||
if(isset($storage)){
|
if(isset($storage)) {
|
||||||
$storage->get("/.gestion/sign.png");
|
$storage->get("/.gestion/sign.png");
|
||||||
$signatureExist = true;
|
$signatureExist = true;
|
||||||
}else{
|
} else {
|
||||||
$signatureExist = false;
|
$signatureExist = false;
|
||||||
}
|
}
|
||||||
}
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
catch(\OCP\Files\NotFoundException $e) {
|
$signatureExist = false;
|
||||||
$signatureExist = false;
|
}
|
||||||
}
|
return $signatureExist;
|
||||||
return $signatureExist;
|
}
|
||||||
}
|
private function tamponImageExist()
|
||||||
private function tamponImageExist(){
|
{
|
||||||
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
|
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
|
||||||
try{
|
try {
|
||||||
if(isset($storage)){
|
if(isset($storage)) {
|
||||||
$storage->get("/.gestion/sign.jpg"); // tampon image
|
$storage->get("/.gestion/sign.jpg"); // tampon image
|
||||||
$signatureExist = true;
|
$signatureExist = true;
|
||||||
}else{
|
} else {
|
||||||
$signatureExist = false;
|
$signatureExist = false;
|
||||||
}
|
}
|
||||||
}
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
catch(\OCP\Files\NotFoundException $e) {
|
$signatureExist = false;
|
||||||
$signatureExist = false;
|
}
|
||||||
}
|
return $signatureExist;
|
||||||
return $signatureExist;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function getLogo(){
|
private function getLogo()
|
||||||
|
{
|
||||||
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
|
$storage = $this->rootFolder->getUserFolder(self::DEFAULT_NEXTCLOUD_ADMIN);
|
||||||
try{
|
try {
|
||||||
try {
|
try {
|
||||||
if(isset($storage)){
|
if(isset($storage)) {
|
||||||
$file = $storage->get('/.gestion/logo.png');
|
$file = $storage->get('/.gestion/logo.png');
|
||||||
}else{
|
} else {
|
||||||
return "nothing";
|
return "nothing";
|
||||||
}
|
}
|
||||||
} catch(\OCP\Files\NotFoundException $e) {
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
$file = $storage->get('/.gestion/logo.jpeg');
|
$file = $storage->get('/.gestion/logo.jpeg');
|
||||||
}
|
}
|
||||||
}
|
} catch(\OCP\Files\NotFoundException $e) {
|
||||||
catch(\OCP\Files\NotFoundException $e) {
|
return "nothing";
|
||||||
return "nothing";
|
}
|
||||||
}
|
return base64_encode($file->getContent());
|
||||||
return base64_encode($file->getContent());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private function setDevisOfDefuntDefaultValue($devisOfDefunt){
|
private function setDevisOfDefuntDefaultValue($devisOfDefunt)
|
||||||
|
{
|
||||||
$devisOfDefunt["devis_date"] = new DateTimeImmutable($devisOfDefunt["devis_date"]);
|
$devisOfDefunt["devis_date"] = new DateTimeImmutable($devisOfDefunt["devis_date"]);
|
||||||
$locationOfDevis = "";
|
$locationOfDevis = "";
|
||||||
if($devisOfDefunt['lieu_nom'] != null){
|
if($devisOfDefunt['lieu_nom'] != null) {
|
||||||
$locationOfDevis .= $devisOfDefunt['lieu_nom'];
|
$locationOfDevis .= $devisOfDefunt['lieu_nom'];
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['lieu_adresse'] != null){
|
if($devisOfDefunt['lieu_adresse'] != null) {
|
||||||
$locationOfDevis .= " ". $devisOfDefunt['lieu_adresse'];
|
$locationOfDevis .= " ". $devisOfDefunt['lieu_adresse'];
|
||||||
}
|
}
|
||||||
$devisOfDefunt['location_of_devis'] = $locationOfDevis;
|
$devisOfDefunt['location_of_devis'] = $locationOfDevis;
|
||||||
if($devisOfDefunt['thanato_nom'] == null){
|
if($devisOfDefunt['thanato_nom'] == null) {
|
||||||
$devisOfDefunt['thanato_nom'] = "";
|
$devisOfDefunt['thanato_nom'] = "";
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['thanato_prenom'] == null){
|
if($devisOfDefunt['thanato_prenom'] == null) {
|
||||||
$devisOfDefunt['thanato_prenom'] = "";
|
$devisOfDefunt['thanato_prenom'] = "";
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['thanato_reference'] == null){
|
if($devisOfDefunt['thanato_reference'] == null) {
|
||||||
$devisOfDefunt['thanato_reference'] = "";
|
$devisOfDefunt['thanato_reference'] = "";
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['client_nom'] == null){
|
if($devisOfDefunt['client_nom'] == null) {
|
||||||
$devisOfDefunt['client_nom'] = "";
|
$devisOfDefunt['client_nom'] = "";
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['client_prenom'] == null){
|
if($devisOfDefunt['client_prenom'] == null) {
|
||||||
$devisOfDefunt['client_prenom'] = "";
|
$devisOfDefunt['client_prenom'] = "";
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['client_entreprise'] == null){
|
if($devisOfDefunt['client_entreprise'] == null) {
|
||||||
$devisOfDefunt['client_entreprise'] = "";
|
$devisOfDefunt['client_entreprise'] = "";
|
||||||
}
|
}
|
||||||
if($devisOfDefunt['client_adresse'] == null){
|
if($devisOfDefunt['client_adresse'] == null) {
|
||||||
$devisOfDefunt['client_adresse'] = "";
|
$devisOfDefunt['client_adresse'] = "";
|
||||||
}
|
}
|
||||||
return $devisOfDefunt;
|
return $devisOfDefunt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateCareCertificate($defuntId,$idNextCloud){
|
public function generateCareCertificate($defuntId, $idNextCloud)
|
||||||
|
{
|
||||||
$storage = $this->rootFolder->getUserFolder($idNextCloud);
|
$storage = $this->rootFolder->getUserFolder($idNextCloud);
|
||||||
$configs = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
$configs = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
||||||
$currentConfig = $configs[0];
|
$currentConfig = $configs[0];
|
||||||
$logo = $this->getLogo();
|
$logo = $this->getLogo();
|
||||||
$devisOfDefunt = $this->gestionBdd->getDevisOfDefunt($defuntId);
|
$devisOfDefunt = $this->gestionBdd->getDevisOfDefunt($defuntId);
|
||||||
if($devisOfDefunt == null){
|
if($devisOfDefunt == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$devisOfDefunt["configuration"] = $currentConfig;
|
$devisOfDefunt["configuration"] = $currentConfig;
|
||||||
$devisOfDefunt = $this->setDevisOfDefuntDefaultValue($devisOfDefunt);
|
$devisOfDefunt = $this->setDevisOfDefuntDefaultValue($devisOfDefunt);
|
||||||
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
||||||
@ -150,63 +155,67 @@ class CertificateService {
|
|||||||
$pdfFilename = $this->GetCareCertificateFilename($devisOfDefunt);
|
$pdfFilename = $this->GetCareCertificateFilename($devisOfDefunt);
|
||||||
$filenamePath = $clean_folder.$careCertificateFolder.$pdfFilename.'.pdf';
|
$filenamePath = $clean_folder.$careCertificateFolder.$pdfFilename.'.pdf';
|
||||||
$pdf = new CareCertificatePdfHandler();
|
$pdf = new CareCertificatePdfHandler();
|
||||||
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
|
$pdf->AddFont('ComicSans', '', 'Comic Sans MS.php');
|
||||||
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
|
$pdf->AddFont('ComicSans', 'B', 'comic-sans-bold.php');
|
||||||
$signatureImageExist = $this->signatureImageExists();
|
$signatureImageExist = $this->signatureImageExists();
|
||||||
$tamponImageExist = $this->tamponImageExist();
|
$tamponImageExist = $this->tamponImageExist();
|
||||||
$pdf->SetCareCertificateData($devisOfDefunt,$logo,$signatureImageExist ,$tamponImageExist);
|
$pdf->SetCareCertificateData($devisOfDefunt, $logo, $signatureImageExist, $tamponImageExist);
|
||||||
$pdf->SetCareCertificate();
|
$pdf->SetCareCertificate();
|
||||||
try {
|
try {
|
||||||
$storage->newFolder($folderDestination);
|
$storage->newFolder($folderDestination);
|
||||||
|
} catch(\OCP\Files\NotPermittedException $e) {
|
||||||
}
|
}
|
||||||
catch(\OCP\Files\NotPermittedException $e) {
|
$pdfContent = $pdf->Output('', 'S');
|
||||||
}
|
|
||||||
$pdfContent = $pdf->Output('','S');
|
|
||||||
$storage->newFile($filenamePath);
|
$storage->newFile($filenamePath);
|
||||||
$pdfFile = $storage->get($filenamePath);
|
$pdfFile = $storage->get($filenamePath);
|
||||||
$pdfFile->putContent($pdfContent);
|
$pdfFile->putContent($pdfContent);
|
||||||
return $filenamePath;
|
return $filenamePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getCareCertificateFolder($devisOfDefunt){
|
private function getCareCertificateFolder($devisOfDefunt)
|
||||||
|
{
|
||||||
$careCertificateFolder = 'CLIENTS/'
|
$careCertificateFolder = 'CLIENTS/'
|
||||||
.mb_strtoupper($devisOfDefunt["client_nom"],'UTF-8')
|
.mb_strtoupper($devisOfDefunt["client_nom"], 'UTF-8')
|
||||||
.'/DEFUNTS/'
|
.'/DEFUNTS/'
|
||||||
.mb_strtoupper($devisOfDefunt["defunt_nom"],'UTF-8').'/'
|
.mb_strtoupper($devisOfDefunt["defunt_nom"], 'UTF-8').'/'
|
||||||
.'ATTESTATION/';
|
.'ATTESTATION/';
|
||||||
|
|
||||||
return $careCertificateFolder;
|
return $careCertificateFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetCareCertificateFilename($devisOfDefunt){
|
private function GetCareCertificateFilename($devisOfDefunt)
|
||||||
$filename = 'ATTESTATION_SOIN_'.mb_strtoupper($devisOfDefunt['defunt_nom'],'UTF-8');
|
{
|
||||||
|
$filename = 'ATTESTATION_SOIN_'.mb_strtoupper($devisOfDefunt['defunt_nom'], 'UTF-8');
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPacemakerCertificateFolder($devisOfDefunt){
|
private function getPacemakerCertificateFolder($devisOfDefunt)
|
||||||
|
{
|
||||||
$folder = 'CLIENTS/'
|
$folder = 'CLIENTS/'
|
||||||
.mb_strtoupper($devisOfDefunt["client_nom"],'UTF-8')
|
.mb_strtoupper($devisOfDefunt["client_nom"], 'UTF-8')
|
||||||
.'/DEFUNTS/'
|
.'/DEFUNTS/'
|
||||||
.mb_strtoupper($devisOfDefunt["defunt_nom"],'UTF-8').'/'
|
.mb_strtoupper($devisOfDefunt["defunt_nom"], 'UTF-8').'/'
|
||||||
.'ATTESTATION/';
|
.'ATTESTATION/';
|
||||||
|
|
||||||
return $folder;
|
return $folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getPacemakerCertificateFilename($devisOfDefunt){
|
private function getPacemakerCertificateFilename($devisOfDefunt)
|
||||||
$filename = 'ATTESTATION_PACEMAKER_'.mb_strtoupper($devisOfDefunt['defunt_nom'],'UTF-8');
|
{
|
||||||
|
$filename = 'ATTESTATION_PACEMAKER_'.mb_strtoupper($devisOfDefunt['defunt_nom'], 'UTF-8');
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generatePacemakerCertificate($defuntId,$idNextCloud){
|
public function generatePacemakerCertificate($defuntId, $idNextCloud)
|
||||||
|
{
|
||||||
$storage = $this->rootFolder->getUserFolder($idNextCloud);
|
$storage = $this->rootFolder->getUserFolder($idNextCloud);
|
||||||
$configs = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
$configs = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
||||||
$currentConfig = $configs[0];
|
$currentConfig = $configs[0];
|
||||||
$logo = $this->getLogo();
|
$logo = $this->getLogo();
|
||||||
$devisOfDefunt = $this->gestionBdd->getDevisOfDefunt($defuntId);
|
$devisOfDefunt = $this->gestionBdd->getDevisOfDefunt($defuntId);
|
||||||
if($devisOfDefunt == null){
|
if($devisOfDefunt == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$devisOfDefunt["configuration"] = $currentConfig;
|
$devisOfDefunt["configuration"] = $currentConfig;
|
||||||
$devisOfDefunt = $this->setDevisOfDefuntDefaultValue($devisOfDefunt);
|
$devisOfDefunt = $this->setDevisOfDefuntDefaultValue($devisOfDefunt);
|
||||||
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
||||||
@ -215,18 +224,58 @@ class CertificateService {
|
|||||||
$pdfFilename = $this->getPacemakerCertificateFilename($devisOfDefunt);
|
$pdfFilename = $this->getPacemakerCertificateFilename($devisOfDefunt);
|
||||||
$filenamePath = $clean_folder.$pacemakerCertificateFolder.$pdfFilename.'.pdf';
|
$filenamePath = $clean_folder.$pacemakerCertificateFolder.$pdfFilename.'.pdf';
|
||||||
$pdf = new PacemakerCertificatePdfHandler();
|
$pdf = new PacemakerCertificatePdfHandler();
|
||||||
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
|
$pdf->AddFont('ComicSans', '', 'Comic Sans MS.php');
|
||||||
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
|
$pdf->AddFont('ComicSans', 'B', 'comic-sans-bold.php');
|
||||||
$signatureImageExist = $this->signatureImageExists();
|
$signatureImageExist = $this->signatureImageExists();
|
||||||
$tamponImageExist = $this->tamponImageExist();
|
$tamponImageExist = $this->tamponImageExist();
|
||||||
$pdf->SetPacemakerCertificateData($devisOfDefunt,$logo,$signatureImageExist ,$tamponImageExist);
|
$pdf->SetPacemakerCertificateData($devisOfDefunt, $logo, $signatureImageExist, $tamponImageExist);
|
||||||
$pdf->SetPacemakerCertificate();
|
$pdf->SetPacemakerCertificate();
|
||||||
try {
|
try {
|
||||||
$storage->newFolder($folderDestination);
|
$storage->newFolder($folderDestination);
|
||||||
|
} catch(\OCP\Files\NotPermittedException $e) {
|
||||||
}
|
}
|
||||||
catch(\OCP\Files\NotPermittedException $e) {
|
$pdfContent = $pdf->Output('', 'S');
|
||||||
|
$storage->newFile($filenamePath);
|
||||||
|
$pdfFile = $storage->get($filenamePath);
|
||||||
|
$pdfFile->putContent($pdfContent);
|
||||||
|
return $filenamePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getPacemakerAbsentCertificateFilename($devisOfDefunt)
|
||||||
|
{
|
||||||
|
$filename = 'ATTESTATION_ABSENCE_PACEMAKER_'.mb_strtoupper($devisOfDefunt['defunt_nom'], 'UTF-8');
|
||||||
|
return $filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generatePacemakerAbsentCertificate($defuntId, $idNextCloud)
|
||||||
|
{
|
||||||
|
$storage = $this->rootFolder->getUserFolder($idNextCloud);
|
||||||
|
$configs = json_decode($this->gestionBdd->getConfiguration(self::DEFAULT_NEXTCLOUD_ADMIN));
|
||||||
|
$currentConfig = $configs[0];
|
||||||
|
$logo = $this->getLogo();
|
||||||
|
$devisOfDefunt = $this->gestionBdd->getDevisOfDefunt($defuntId);
|
||||||
|
if($devisOfDefunt == null) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
$pdfContent = $pdf->Output('','S');
|
$devisOfDefunt["configuration"] = $currentConfig;
|
||||||
|
$devisOfDefunt = $this->setDevisOfDefuntDefaultValue($devisOfDefunt);
|
||||||
|
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
||||||
|
$pacemakerCertificateFolder = $this->getPacemakerCertificateFolder($devisOfDefunt);
|
||||||
|
$folderDestination = $clean_folder.$pacemakerCertificateFolder;
|
||||||
|
$pdfFilename = $this->getPacemakerAbsentCertificateFilename($devisOfDefunt);
|
||||||
|
$filenamePath = $clean_folder.$pacemakerCertificateFolder.$pdfFilename.'.pdf';
|
||||||
|
$pdf = new PacemakerAbsentCertificatePdfHandler();
|
||||||
|
$pdf->AddFont('ComicSans', '', 'Comic Sans MS.php');
|
||||||
|
$pdf->AddFont('ComicSans', 'B', 'comic-sans-bold.php');
|
||||||
|
$signatureImageExist = $this->signatureImageExists();
|
||||||
|
$tamponImageExist = $this->tamponImageExist();
|
||||||
|
$pdf->SetPacemakerCertificateData($devisOfDefunt, $logo, $signatureImageExist, $tamponImageExist);
|
||||||
|
$pdf->SetPacemakerCertificate();
|
||||||
|
try {
|
||||||
|
$storage->newFolder($folderDestination);
|
||||||
|
} catch(\OCP\Files\NotPermittedException $e) {
|
||||||
|
}
|
||||||
|
$pdfContent = $pdf->Output('', 'S');
|
||||||
$storage->newFile($filenamePath);
|
$storage->newFile($filenamePath);
|
||||||
$pdfFile = $storage->get($filenamePath);
|
$pdfFile = $storage->get($filenamePath);
|
||||||
$pdfFile->putContent($pdfContent);
|
$pdfFile->putContent($pdfContent);
|
||||||
|
|||||||
@ -27,136 +27,142 @@ declare(strict_types=1);
|
|||||||
namespace OCA\Gestion\Service\Certificate\PdfHandler;
|
namespace OCA\Gestion\Service\Certificate\PdfHandler;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use \FPDF;
|
use FPDF;
|
||||||
use OCA\Gestion\Helpers\DateHelpers;
|
use OCA\Gestion\Helpers\DateHelpers;
|
||||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||||
use OCA\Gestion\Helpers\PriceHelpers;
|
use OCA\Gestion\Helpers\PriceHelpers;
|
||||||
|
|
||||||
class CareCertificatePdfHandler extends FPDF {
|
class CareCertificatePdfHandler extends FPDF
|
||||||
|
{
|
||||||
private $devisOfDefunt = [];
|
private $devisOfDefunt = [];
|
||||||
private $logo = null;
|
private $logo = null;
|
||||||
private $signatureImageExist = false;
|
private $signatureImageExist = false;
|
||||||
private $tamponImageExist = false;
|
private $tamponImageExist = false;
|
||||||
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
|
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
|
||||||
|
|
||||||
function Header()
|
public function Header()
|
||||||
{
|
{
|
||||||
if($this->logo != "nothing"){
|
if($this->logo != "nothing") {
|
||||||
$this->Image($this->imagePath."logo.png", 4, 2, 40, 45);
|
$this->Image($this->imagePath."logo.png", 4, 2, 40, 45);
|
||||||
}
|
} else {
|
||||||
else{
|
$this->Cell(55, 30, '');
|
||||||
$this->Cell(55,30,'');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function Footer()
|
public function Footer()
|
||||||
{
|
{
|
||||||
$this->SetY(-18);
|
$this->SetY(-18);
|
||||||
$this->SetFont('Arial', '', 10);
|
$this->SetFont('Arial', '', 10);
|
||||||
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
|
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
|
||||||
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0,'C');
|
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetCareCertificateData(array $devisOfDefunt,$logo = null,$signatureImageExist = false , $tamponImageExist = false){
|
public function SetCareCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false, $tamponImageExist = false)
|
||||||
|
{
|
||||||
$this->devisOfDefunt = $devisOfDefunt;
|
$this->devisOfDefunt = $devisOfDefunt;
|
||||||
$this->logo = $logo;
|
$this->logo = $logo;
|
||||||
$this->signatureImageExist = $signatureImageExist;
|
$this->signatureImageExist = $signatureImageExist;
|
||||||
$this->tamponImageExist = $tamponImageExist;
|
$this->tamponImageExist = $tamponImageExist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetCareCertificate(){
|
public function SetCareCertificate()
|
||||||
|
{
|
||||||
$this->AddPage();
|
$this->AddPage();
|
||||||
$this->SetMargins(left:20,top:0,right:20);
|
$this->SetMargins(left:20, top:0, right:20);
|
||||||
$this->SetCareCertificateTitle();
|
$this->SetCareCertificateTitle();
|
||||||
$this->SetCareCertificateContent();
|
$this->SetCareCertificateContent();
|
||||||
$this->SetSigning();
|
$this->SetSigning();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function SetSigning(){
|
private function SetSigning()
|
||||||
$this->SetXY(140,$this->GetY() + 15);
|
{
|
||||||
$this->Cell(0,10,'Cachet et signature');
|
$this->SetXY(140, $this->GetY() + 15);
|
||||||
|
$this->Cell(0, 10, 'Cachet et signature');
|
||||||
|
|
||||||
if($this->tamponImageExist){
|
if($this->tamponImageExist) {
|
||||||
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY() + 8, 80, 35);
|
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY() + 8, 80, 35);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($this->signatureImageExist){
|
if($this->signatureImageExist) {
|
||||||
$this->Image($this->imagePath."sign.png", 140, $this->GetY() + 40, 40, 16);
|
$this->Image($this->imagePath."sign.png", 140, $this->GetY() + 40, 40, 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function SetCareCertificateContent(){
|
private function SetCareCertificateContent()
|
||||||
|
{
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->MultiCell(0,7,FileExportHelpers::FormatTextForExport('La Société '. $this->devisOfDefunt['configuration']->entreprise. ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
|
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société '. $this->devisOfDefunt['configuration']->entreprise. ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
|
||||||
$this->SetFont('Arial', 'B', 14);
|
$this->SetFont('Arial', 'B', 14);
|
||||||
$this->Cell(0,12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']),0,1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']), 0, 1);
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->MultiCell(0,7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a effectué des soins de conservation sur le corps du défunt :'));
|
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a effectué des soins de conservation sur le corps du défunt :'));
|
||||||
$this->SetFont('Arial', 'B', 14);
|
$this->SetFont('Arial', 'B', 14);
|
||||||
$this->Cell(0,12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']),0,1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']), 0, 1);
|
||||||
$this->SetFont('Arial', '', 14);
|
|
||||||
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'] , 0, 1);
|
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->Cell(0,12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ',0,1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'], 0, 1);
|
||||||
|
$this->SetFont('Arial', '', 14);
|
||||||
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Lieu du décès") . ' : ' . $this->devisOfDefunt['lieu_deces'], 0, 1);
|
||||||
|
$this->SetFont('Arial', '', 14);
|
||||||
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
|
||||||
$this->SetFont('Arial', 'B', 14);
|
$this->SetFont('Arial', 'B', 14);
|
||||||
$this->MultiCell(0,6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
|
$this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->Cell(0,12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."),0,5);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5);
|
||||||
$this->Ln(5);
|
$this->Ln(5);
|
||||||
$this->MultiAlignCell(120,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']),0);
|
// $this->MultiAlignCell(120,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']),0);
|
||||||
$this->SetX(140);
|
// $this->SetX(140);
|
||||||
$this->Cell(0,7,'le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'),0);
|
$this->Cell(0, 7, 'Fait le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function SetCareCertificateTitle(){
|
private function SetCareCertificateTitle()
|
||||||
|
{
|
||||||
$this->SetY(60);
|
$this->SetY(60);
|
||||||
$this->SetFont('Arial', 'B', 20);
|
$this->SetFont('Arial', 'B', 20);
|
||||||
$this->Cell(0, 10, 'ATTESTATION DE SOINS DE CONSERVATION', 0, 1,'C');
|
$this->Cell(0, 10, 'ATTESTATION DE SOINS DE CONSERVATION', 0, 1, 'C');
|
||||||
$this->Ln(20);
|
$this->Ln(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MultiAlignCell($w,$h,$text,$border=0,$ln=0,$align='L',$fill=false)
|
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||||
{
|
{
|
||||||
// Store reset values for (x,y) positions
|
// Store reset values for (x,y) positions
|
||||||
$x = $this->GetX() + $w;
|
$x = $this->GetX() + $w;
|
||||||
$y = $this->GetY();
|
$y = $this->GetY();
|
||||||
|
|
||||||
// Make a call to FPDF's MultiCell
|
// Make a call to FPDF's MultiCell
|
||||||
$this->MultiCell($w,$h,$text,$border,$align,$fill);
|
$this->MultiCell($w, $h, $text, $border, $align, $fill);
|
||||||
|
|
||||||
// Reset the line position to the right, like in Cell
|
// Reset the line position to the right, like in Cell
|
||||||
if( $ln==0 )
|
if($ln == 0) {
|
||||||
{
|
$this->SetXY($x, $y);
|
||||||
$this->SetXY($x,$y);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function NbLines($w, $txt)
|
public function NbLines($w, $txt)
|
||||||
{
|
{
|
||||||
// Compute the number of lines a MultiCell of width w will take
|
// Compute the number of lines a MultiCell of width w will take
|
||||||
if(!isset($this->CurrentFont))
|
if(!isset($this->CurrentFont)) {
|
||||||
$this->Error('No font has been set');
|
$this->Error('No font has been set');
|
||||||
|
}
|
||||||
$cw = $this->CurrentFont['cw'];
|
$cw = $this->CurrentFont['cw'];
|
||||||
if($w==0)
|
if($w == 0) {
|
||||||
$w = $this->w-$this->rMargin-$this->x;
|
$w = $this->w - $this->rMargin - $this->x;
|
||||||
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
|
}
|
||||||
$s = str_replace("\r",'',(string)$txt);
|
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
||||||
|
$s = str_replace("\r", '', (string)$txt);
|
||||||
$nb = strlen($s);
|
$nb = strlen($s);
|
||||||
if($nb>0 && $s[$nb-1]=="\n")
|
if($nb > 0 && $s[$nb - 1] == "\n") {
|
||||||
$nb--;
|
$nb--;
|
||||||
|
}
|
||||||
$sep = -1;
|
$sep = -1;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
$l = 0;
|
$l = 0;
|
||||||
$nl = 1;
|
$nl = 1;
|
||||||
while($i<$nb)
|
while($i < $nb) {
|
||||||
{
|
|
||||||
$c = $s[$i];
|
$c = $s[$i];
|
||||||
if($c=="\n")
|
if($c == "\n") {
|
||||||
{
|
|
||||||
$i++;
|
$i++;
|
||||||
$sep = -1;
|
$sep = -1;
|
||||||
$j = $i;
|
$j = $i;
|
||||||
@ -164,25 +170,25 @@ class CareCertificatePdfHandler extends FPDF {
|
|||||||
$nl++;
|
$nl++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($c==' ')
|
if($c == ' ') {
|
||||||
$sep = $i;
|
$sep = $i;
|
||||||
|
}
|
||||||
$l += $cw[$c];
|
$l += $cw[$c];
|
||||||
if($l>$wmax)
|
if($l > $wmax) {
|
||||||
{
|
if($sep == -1) {
|
||||||
if($sep==-1)
|
if($i == $j) {
|
||||||
{
|
|
||||||
if($i==$j)
|
|
||||||
$i++;
|
$i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$i = $sep + 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$i = $sep+1;
|
|
||||||
$sep = -1;
|
$sep = -1;
|
||||||
$j = $i;
|
$j = $i;
|
||||||
$l = 0;
|
$l = 0;
|
||||||
$nl++;
|
$nl++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
$i++;
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $nl;
|
return $nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,239 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
/**
|
||||||
|
* Calendar App
|
||||||
|
*
|
||||||
|
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
|
||||||
|
*
|
||||||
|
* @author Anna Larch <anna.larch@gmx.net>
|
||||||
|
* @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 3 of the License, or any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OCA\Gestion\Service\Certificate\PdfHandler;
|
||||||
|
|
||||||
|
use DateTime;
|
||||||
|
use FPDF;
|
||||||
|
use OCA\Gestion\Helpers\DateHelpers;
|
||||||
|
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||||
|
use OCA\Gestion\Helpers\PriceHelpers;
|
||||||
|
|
||||||
|
class PacemakerAbsentCertificatePdfHandler extends FPDF
|
||||||
|
{
|
||||||
|
private $devisOfDefunt = [];
|
||||||
|
private $logo = null;
|
||||||
|
private $signatureImageExist = false;
|
||||||
|
private $tamponImageExist = false;
|
||||||
|
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
|
||||||
|
|
||||||
|
public function Header()
|
||||||
|
{
|
||||||
|
if ($this->logo != "nothing") {
|
||||||
|
$this->Image($this->imagePath . "logo.png", 10, 10, 50, 35);
|
||||||
|
}
|
||||||
|
|
||||||
|
// En-tête avec les informations de l'entreprise - SOUS le logo
|
||||||
|
$this->SetXY(10, 50); // Position sous le logo
|
||||||
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->entreprise), 0, 1);
|
||||||
|
$this->SetFont('Arial', '', 10);
|
||||||
|
$this->MultiCell(0, 4, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->adresse), 0, 'L');
|
||||||
|
|
||||||
|
if (isset($this->devisOfDefunt['configuration']->telephone)) {
|
||||||
|
$this->Cell(0, 4, 'Tel : ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->telephone), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->devisOfDefunt['thanato_reference'])) {
|
||||||
|
$this->Cell(0, 4, 'Habilitation : ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_reference']), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->devisOfDefunt['configuration']->siret)) {
|
||||||
|
$this->Cell(0, 4, 'Siret : ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->siret), 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Footer()
|
||||||
|
{
|
||||||
|
$this->SetY(-15);
|
||||||
|
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
|
||||||
|
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SetPacemakerCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false, $tamponImageExist = false)
|
||||||
|
{
|
||||||
|
$this->devisOfDefunt = $devisOfDefunt;
|
||||||
|
$this->logo = $logo;
|
||||||
|
$this->signatureImageExist = $signatureImageExist;
|
||||||
|
$this->tamponImageExist = $tamponImageExist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function SetPacemakerCertificate()
|
||||||
|
{
|
||||||
|
$this->AddPage();
|
||||||
|
$this->SetMargins(left: 20, top: 0, right: 20);
|
||||||
|
$this->SetPacemakerCertificateTitle();
|
||||||
|
$this->SetPacemakerCertificateContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function SetPacemakerCertificateContent()
|
||||||
|
{
|
||||||
|
$this->SetY(100); // Position réduite après le titre
|
||||||
|
|
||||||
|
$this->SetFont('Arial', '', 12);
|
||||||
|
|
||||||
|
// Déterminer le genre selon la civilité
|
||||||
|
$civilite = isset($this->devisOfDefunt['thanato_civilite']) ? $this->devisOfDefunt['thanato_civilite'] : 'Madame';
|
||||||
|
$pronom = 'Je soussignée';
|
||||||
|
$profession = 'thanatopractrice diplômée';
|
||||||
|
|
||||||
|
// Adaptation selon la civilité
|
||||||
|
if (strtolower($civilite) === 'monsieur' || strtolower($civilite) === 'm.' || strtolower($civilite) === 'mr') {
|
||||||
|
$pronom = 'Je soussigné';
|
||||||
|
$profession = 'thanatopracteur diplômé';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Texte principal avec genre adapté
|
||||||
|
$mainText = $pronom . ', ' . $civilite . ' ' .
|
||||||
|
mb_convert_encoding(html_entity_decode($this->devisOfDefunt['thanato_prenom']), 'ISO-8859-1', 'UTF-8'). ' ' .mb_convert_encoding(html_entity_decode($this->devisOfDefunt['thanato_nom']), 'ISO-8859-1', 'UTF-8').
|
||||||
|
', ' . $profession . ', certifie ne pas avoir constaté, à la palpation, la présence d\'un pacemaker pour :';
|
||||||
|
|
||||||
|
$this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($mainText));
|
||||||
|
$this->Ln(8);
|
||||||
|
|
||||||
|
// Nom du défunt
|
||||||
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->Cell(20, 8, 'Nom :', 0, 0);
|
||||||
|
$this->SetFont('Arial', '', 12);
|
||||||
|
$this->Cell(0, 8, FileExportHelpers::FormatTextForExport(mb_convert_encoding(html_entity_decode($this->devisOfDefunt['defunt_nom']), 'ISO-8859-1', 'UTF-8')), 0, 1);
|
||||||
|
$this->Ln(3);
|
||||||
|
|
||||||
|
// Date
|
||||||
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->Cell(20, 8, 'Date :', 0, 0);
|
||||||
|
$this->SetFont('Arial', '', 12);
|
||||||
|
if (isset($this->devisOfDefunt['devis_date'])) {
|
||||||
|
$this->Cell(0, 8, $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0, 1);
|
||||||
|
} else {
|
||||||
|
$this->Cell(0, 8, '', 0, 1);
|
||||||
|
}
|
||||||
|
$this->Ln(3);
|
||||||
|
|
||||||
|
// Lieu d'intervention
|
||||||
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->Cell(40, 8, 'Lieu d\'intervention :', 0, 0);
|
||||||
|
$this->SetFont('Arial', '', 12);
|
||||||
|
$lieu = isset($this->devisOfDefunt['lieu_intervention']) ?
|
||||||
|
$this->devisOfDefunt['lieu_intervention'] :
|
||||||
|
$this->devisOfDefunt['location_of_devis'];
|
||||||
|
|
||||||
|
// Utiliser MultiCell pour permettre le retour à la ligne
|
||||||
|
$this->SetX(20); // Retour au début de la ligne
|
||||||
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->Cell(40, 8, 'Lieu d\'intervention :', 0, 1); // 1 pour aller à la ligne suivante
|
||||||
|
$this->SetFont('Arial', '', 12);
|
||||||
|
$this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($lieu), 0, 'L');
|
||||||
|
|
||||||
|
// Signatures et cachet - juste après le lieu d'intervention
|
||||||
|
$this->Ln(15); // Petit espace après le lieu d'intervention
|
||||||
|
|
||||||
|
if ($this->signatureImageExist) {
|
||||||
|
$this->Image($this->imagePath."sign.png", 140, $this->GetY(), 40, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($this->tamponImageExist) {
|
||||||
|
$this->SetXY(120, $this->GetY() + 20); // Augmenté de 5 à 20 pour plus d'espace
|
||||||
|
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY(), 80, 35);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function SetPacemakerCertificateTitle()
|
||||||
|
{
|
||||||
|
$this->SetY(y: 85); // Titre plus bas pour éviter l'en-tête
|
||||||
|
$this->SetFont('Arial', 'B', 16);
|
||||||
|
$this->Cell(0, 10, FileExportHelpers::FormatTextForExport('ATTESTATION D\'ABSENCE DE PACEMAKER'), 0, 1, 'C');
|
||||||
|
$this->Ln(5); // Espace réduit après le titre
|
||||||
|
}
|
||||||
|
|
||||||
|
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||||
|
{
|
||||||
|
// Store reset values for (x,y) positions
|
||||||
|
$x = $this->GetX() + $w;
|
||||||
|
$y = $this->GetY();
|
||||||
|
|
||||||
|
// Make a call to FPDF's MultiCell
|
||||||
|
$this->MultiCell($w, $h, $text, $border, $align, $fill);
|
||||||
|
|
||||||
|
// Reset the line position to the right, like in Cell
|
||||||
|
if ($ln == 0) {
|
||||||
|
$this->SetXY($x, $y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function NbLines($w, $txt)
|
||||||
|
{
|
||||||
|
// Compute the number of lines a MultiCell of width w will take
|
||||||
|
if (!isset($this->CurrentFont)) {
|
||||||
|
$this->Error('No font has been set');
|
||||||
|
}
|
||||||
|
$cw = $this->CurrentFont['cw'];
|
||||||
|
if ($w == 0) {
|
||||||
|
$w = $this->w - $this->rMargin - $this->x;
|
||||||
|
}
|
||||||
|
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
||||||
|
$s = str_replace("\r", '', (string) $txt);
|
||||||
|
$nb = strlen($s);
|
||||||
|
if ($nb > 0 && $s[$nb - 1] == "\n") {
|
||||||
|
$nb--;
|
||||||
|
}
|
||||||
|
$sep = -1;
|
||||||
|
$i = 0;
|
||||||
|
$j = 0;
|
||||||
|
$l = 0;
|
||||||
|
$nl = 1;
|
||||||
|
while ($i < $nb) {
|
||||||
|
$c = $s[$i];
|
||||||
|
if ($c == "\n") {
|
||||||
|
$i++;
|
||||||
|
$sep = -1;
|
||||||
|
$j = $i;
|
||||||
|
$l = 0;
|
||||||
|
$nl++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($c == ' ') {
|
||||||
|
$sep = $i;
|
||||||
|
}
|
||||||
|
$l += $cw[$c];
|
||||||
|
if ($l > $wmax) {
|
||||||
|
if ($sep == -1) {
|
||||||
|
if ($i == $j) {
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$i = $sep + 1;
|
||||||
|
}
|
||||||
|
$sep = -1;
|
||||||
|
$j = $i;
|
||||||
|
$l = 0;
|
||||||
|
$nl++;
|
||||||
|
} else {
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -27,36 +27,38 @@ declare(strict_types=1);
|
|||||||
namespace OCA\Gestion\Service\Certificate\PdfHandler;
|
namespace OCA\Gestion\Service\Certificate\PdfHandler;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use \FPDF;
|
use FPDF;
|
||||||
use OCA\Gestion\Helpers\DateHelpers;
|
use OCA\Gestion\Helpers\DateHelpers;
|
||||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||||
use OCA\Gestion\Helpers\PriceHelpers;
|
use OCA\Gestion\Helpers\PriceHelpers;
|
||||||
|
|
||||||
class PacemakerCertificatePdfHandler extends FPDF
|
class PacemakerCertificatePdfHandler extends FPDF
|
||||||
{
|
{
|
||||||
|
|
||||||
private $devisOfDefunt = [];
|
private $devisOfDefunt = [];
|
||||||
private $logo = null;
|
private $logo = null;
|
||||||
private $signatureImageExist = false;
|
private $signatureImageExist = false;
|
||||||
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
|
private $imagePath = "/var/www/html/data/admin/files/.gestion/";
|
||||||
private $tamponImageExist = false;
|
private $tamponImageExist = false;
|
||||||
function Header()
|
|
||||||
|
public function Header()
|
||||||
{
|
{
|
||||||
if ($this->logo != "nothing") {
|
if ($this->logo != "nothing") {
|
||||||
$this->Image($this->imagePath."logo.png", 4, 2, 40, 45);
|
$this->Image($this->imagePath."logo.png", 4, 2, 40, 45);
|
||||||
} else {
|
} else {
|
||||||
$this->Cell(55, 30, '');
|
$this->Cell(55, 30, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function Footer()
|
|
||||||
|
public function Footer()
|
||||||
{
|
{
|
||||||
|
// Augmenter l'espace pour le footer pour éviter les chevauchements
|
||||||
$this->SetY(-18);
|
$this->SetY(-18);
|
||||||
$this->SetFont('Arial', '', 10);
|
$this->SetFont('Arial', '', 10);
|
||||||
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
|
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
|
||||||
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
|
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetPacemakerCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false , $tamponImageExist = false)
|
public function SetPacemakerCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false, $tamponImageExist = false)
|
||||||
{
|
{
|
||||||
$this->devisOfDefunt = $devisOfDefunt;
|
$this->devisOfDefunt = $devisOfDefunt;
|
||||||
$this->logo = $logo;
|
$this->logo = $logo;
|
||||||
@ -75,17 +77,27 @@ class PacemakerCertificatePdfHandler extends FPDF
|
|||||||
|
|
||||||
private function SetSigning()
|
private function SetSigning()
|
||||||
{
|
{
|
||||||
$this->SetXY(140, $this->GetY() + 10);
|
// Ajouter plus d'espace avant la signature et le tampon
|
||||||
// $this->Cell(0, 10, 'Cachet et signatures');
|
$this->Ln(5); // Ajouter de l'espace vertical
|
||||||
|
|
||||||
if($this->tamponImageExist){
|
// Calculer la position Y pour éviter le chevauchement avec le footer
|
||||||
$this->Image($this->imagePath."sign.jpg", 120, $this->GetY() + 8, 80, 30);
|
$maxY = $this->GetPageHeight() - 65;
|
||||||
|
$currentY = $this->GetY();
|
||||||
|
|
||||||
|
// Si on est trop bas, ne pas dépasser la limite
|
||||||
|
if ($currentY > $maxY) {
|
||||||
|
$currentY = $maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Positionner le tampon
|
||||||
|
if($this->tamponImageExist) {
|
||||||
|
$this->Image($this->imagePath."sign.jpg", 120, $currentY, 80, 25); // Réduire la hauteur de 30 à 25
|
||||||
|
}
|
||||||
|
|
||||||
|
// Positionner la signature sous le tampon
|
||||||
if ($this->signatureImageExist) {
|
if ($this->signatureImageExist) {
|
||||||
$this->Image($this->imagePath."sign.png", 140, $this->GetY() + 38, 40, 16);
|
$this->Image($this->imagePath."sign.png", 140, $currentY + 28, 40, 16); // Ajuster la position Y
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function SetPacemakerCertificateContent()
|
private function SetPacemakerCertificateContent()
|
||||||
@ -93,13 +105,15 @@ class PacemakerCertificatePdfHandler extends FPDF
|
|||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société ' . $this->devisOfDefunt['configuration']->entreprise . ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
|
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société ' . $this->devisOfDefunt['configuration']->entreprise . ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
|
||||||
$this->SetFont('Arial', 'B', 14);
|
$this->SetFont('Arial', 'B', 14);
|
||||||
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']), 0, 1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']), 0, 1);
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a retiré ce jour, la prothèse fonctionnant à pile implantée sur le corps du défunt :'));
|
$this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a retiré ce jour, la prothèse fonctionnant à pile implantée sur le corps du défunt :'));
|
||||||
$this->SetFont('Arial', 'B', 14);
|
$this->SetFont('Arial', 'B', 14);
|
||||||
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']), 0, 1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']), 0, 1);
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'] , 0, 1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Date du décès") . ' : ' . $this->devisOfDefunt['defunt_date'], 0, 1);
|
||||||
|
$this->SetFont('Arial', '', 14);
|
||||||
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Lieu du décès") . ' : ' . $this->devisOfDefunt['lieu_deces'], 0, 1);
|
||||||
$this->SetFont('Arial', '', 14);
|
$this->SetFont('Arial', '', 14);
|
||||||
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
|
||||||
|
|
||||||
@ -123,24 +137,26 @@ class PacemakerCertificatePdfHandler extends FPDF
|
|||||||
0,
|
0,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5);
|
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 1);
|
||||||
$this->Ln(5);
|
$this->Ln(5);
|
||||||
|
|
||||||
$this->MultiAlignCell(120, 7, FileExportHelpers::FormatTextForExport('Fait à ') . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']), 0);
|
// Positionner "Fait le" de manière relative plutôt qu'absolue
|
||||||
$this->SetX(140);
|
$this->SetX(140);
|
||||||
$this->Cell(0, 7, 'le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
|
$this->Cell(0, 7, 'Fait le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function SetPacemakerCertificateTitle()
|
private function SetPacemakerCertificateTitle()
|
||||||
{
|
{
|
||||||
$this->SetY(y: 50);
|
$this->SetY(y: 50);
|
||||||
$this->SetFont('Arial', 'B', 20);
|
$this->SetFont('Arial', 'B', 15);
|
||||||
$this->Cell(0, 10, 'ATTESTATION DE RETRAIT DE LA', 0, 1, 'C');
|
$this->Cell(0, 10, 'ATTESTATION DE RECUPERATION DE', 0, 1, 'C');
|
||||||
$this->Cell(0, 10, 'PROTHESE FONCTIONNANT A PILE', 0, 1, 'C');
|
$this->Cell(0, 10, 'PROTHESE FONCTIONNANT AU MOYEN D\'UNE PILE', 0, 1, 'C');
|
||||||
$this->Ln(20);
|
$this->SetFont('Arial', 'B', 12);
|
||||||
|
$this->Cell(0, 10, '(dernier alinea de l\'article R.2213-15 du code des collectivites territoriales)', 0, 1, 'C');
|
||||||
|
$this->Ln(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
public function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
|
||||||
{
|
{
|
||||||
// Store reset values for (x,y) positions
|
// Store reset values for (x,y) positions
|
||||||
$x = $this->GetX() + $w;
|
$x = $this->GetX() + $w;
|
||||||
@ -155,19 +171,22 @@ class PacemakerCertificatePdfHandler extends FPDF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function NbLines($w, $txt)
|
public function NbLines($w, $txt)
|
||||||
{
|
{
|
||||||
// Compute the number of lines a MultiCell of width w will take
|
// Compute the number of lines a MultiCell of width w will take
|
||||||
if (!isset($this->CurrentFont))
|
if (!isset($this->CurrentFont)) {
|
||||||
$this->Error('No font has been set');
|
$this->Error('No font has been set');
|
||||||
|
}
|
||||||
$cw = $this->CurrentFont['cw'];
|
$cw = $this->CurrentFont['cw'];
|
||||||
if ($w == 0)
|
if ($w == 0) {
|
||||||
$w = $this->w - $this->rMargin - $this->x;
|
$w = $this->w - $this->rMargin - $this->x;
|
||||||
|
}
|
||||||
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
$wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
|
||||||
$s = str_replace("\r", '', (string) $txt);
|
$s = str_replace("\r", '', (string) $txt);
|
||||||
$nb = strlen($s);
|
$nb = strlen($s);
|
||||||
if ($nb > 0 && $s[$nb - 1] == "\n")
|
if ($nb > 0 && $s[$nb - 1] == "\n") {
|
||||||
$nb--;
|
$nb--;
|
||||||
|
}
|
||||||
$sep = -1;
|
$sep = -1;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$j = 0;
|
$j = 0;
|
||||||
@ -183,21 +202,25 @@ class PacemakerCertificatePdfHandler extends FPDF
|
|||||||
$nl++;
|
$nl++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($c == ' ')
|
if ($c == ' ') {
|
||||||
$sep = $i;
|
$sep = $i;
|
||||||
|
}
|
||||||
$l += $cw[$c];
|
$l += $cw[$c];
|
||||||
if ($l > $wmax) {
|
if ($l > $wmax) {
|
||||||
if ($sep == -1) {
|
if ($sep == -1) {
|
||||||
if ($i == $j)
|
if ($i == $j) {
|
||||||
$i++;
|
$i++;
|
||||||
} else
|
}
|
||||||
|
} else {
|
||||||
$i = $sep + 1;
|
$i = $sep + 1;
|
||||||
|
}
|
||||||
$sep = -1;
|
$sep = -1;
|
||||||
$j = $i;
|
$j = $i;
|
||||||
$l = 0;
|
$l = 0;
|
||||||
$nl++;
|
$nl++;
|
||||||
} else
|
} else {
|
||||||
$i++;
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $nl;
|
return $nl;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,11 @@ class DevisDataProcessor
|
|||||||
$data_devis = [];
|
$data_devis = [];
|
||||||
|
|
||||||
foreach ($devisData as $devis) {
|
foreach ($devisData as $devis) {
|
||||||
|
// Exclure les devis annulés des récapitulatifs
|
||||||
|
if (isset($devis['mentions']) && $devis['mentions'] === 'CANCELED') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$devis_temp = $this->createDevisStructure($devis, $currentConfig);
|
$devis_temp = $this->createDevisStructure($devis, $currentConfig);
|
||||||
$devis_temp = $this->calculateDevisAmounts($devis_temp, $devis, $filter, $idNextCloud);
|
$devis_temp = $this->calculateDevisAmounts($devis_temp, $devis, $filter, $idNextCloud);
|
||||||
$data_devis[] = $devis_temp;
|
$data_devis[] = $devis_temp;
|
||||||
@ -41,6 +46,8 @@ class DevisDataProcessor
|
|||||||
'devis_date' => $devis['devis_date'],
|
'devis_date' => $devis['devis_date'],
|
||||||
'lieu_nom' => $devis['lieu_nom'],
|
'lieu_nom' => $devis['lieu_nom'],
|
||||||
'lieu_adresse' => $devis['lieu_adresse'],
|
'lieu_adresse' => $devis['lieu_adresse'],
|
||||||
|
'thanato_nom' => $devis['thanato_nom'],
|
||||||
|
'thanato_prenom' => $devis['thanato_prenom'],
|
||||||
'defunt_nom' => $devis['defunt_nom'],
|
'defunt_nom' => $devis['defunt_nom'],
|
||||||
'defunt_sexe' => $devis['defunt_sexe'],
|
'defunt_sexe' => $devis['defunt_sexe'],
|
||||||
'client_nom' => $devis['client_nom'],
|
'client_nom' => $devis['client_nom'],
|
||||||
@ -78,9 +85,9 @@ class DevisDataProcessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Traitement identique aux factures
|
// Traitement identique aux factures
|
||||||
$produitsReferenceArray = array_unique($produitsReferenceArray);
|
// $produitsReferenceArray = array_unique($produitsReferenceArray);
|
||||||
$produitsReferenceAsString = implode("-", $produitsReferenceArray);
|
$produitsReferenceAsString = implode("-", $produitsReferenceArray);
|
||||||
$devis_temp['article'] = !empty($produitsReferenceAsString) ? $produitsReferenceAsString : 'SOINS';
|
$devis_temp['article'] = !empty($produitsReferenceAsString) ? $produitsReferenceAsString : '';
|
||||||
|
|
||||||
$devis_temp['montant_tva'] = ($devis_temp['montant_htc'] * $devis_temp['tva']) / 100;
|
$devis_temp['montant_tva'] = ($devis_temp['montant_htc'] * $devis_temp['tva']) / 100;
|
||||||
$devis_temp['montant_ttc'] = $devis_temp['montant_tva'] + $devis_temp['montant_htc'];
|
$devis_temp['montant_ttc'] = $devis_temp['montant_tva'] + $devis_temp['montant_htc'];
|
||||||
|
|||||||
@ -81,16 +81,31 @@ class DevisPdfGenerator
|
|||||||
|
|
||||||
private function calculatePagination($totalItems)
|
private function calculatePagination($totalItems)
|
||||||
{
|
{
|
||||||
|
if ($totalItems <= 8) {
|
||||||
|
// Tout sur 1 page
|
||||||
|
return [
|
||||||
|
'nb_pages' => 1,
|
||||||
|
'items_per_page' => 15,
|
||||||
|
'current_index' => 0
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Réserver 8 items pour dernière page
|
||||||
|
$itemsAvantDernierePage = $totalItems - 8;
|
||||||
|
$nbPagesNormales = ceil($itemsAvantDernierePage / 15);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'nb_pages' => ceil($totalItems / 12), // RÉDUIRE à 12 par page
|
'nb_pages' => $nbPagesNormales + 1,
|
||||||
'items_per_page' => 12,
|
'items_per_page' => 15,
|
||||||
'current_index' => 0
|
'current_index' => 0
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// VOICI LA FONCTION CORRIGÉE - 4 paramètres au lieu de 10
|
|
||||||
private function generateSinglePage(PageContext $context, $num_page, &$pagination, &$totals)
|
private function generateSinglePage(PageContext $context, $num_page, &$pagination, &$totals)
|
||||||
{
|
{
|
||||||
|
$startIndex = $pagination['current_index'];
|
||||||
|
$remainingItems = count($context->dataDevis) - $startIndex;
|
||||||
|
|
||||||
$context->pdf->AddPage();
|
$context->pdf->AddPage();
|
||||||
$context->pdf->SetAutoPagebreak(false);
|
$context->pdf->SetAutoPagebreak(false);
|
||||||
$context->pdf->SetMargins(0, 0, 10);
|
$context->pdf->SetMargins(0, 0, 10);
|
||||||
@ -100,7 +115,17 @@ class DevisPdfGenerator
|
|||||||
$this->layoutManager->addClientInfoSection($context->pdf, $context->clientInfo, $context->dataDevis[0]);
|
$this->layoutManager->addClientInfoSection($context->pdf, $context->clientInfo, $context->dataDevis[0]);
|
||||||
$this->layoutManager->addDocumentTitle($context->pdf, $context->dataDevis[0], $context->year);
|
$this->layoutManager->addDocumentTitle($context->pdf, $context->dataDevis[0], $context->year);
|
||||||
|
|
||||||
$itemsToProcess = min($pagination['items_per_page'], count($context->dataDevis) - $pagination['current_index']);
|
// ✅ Calculer items
|
||||||
|
$isLastPage = ($num_page == $pagination['nb_pages']);
|
||||||
|
$hasAmounts = !$context->montant;
|
||||||
|
|
||||||
|
if ($isLastPage && $hasAmounts) {
|
||||||
|
// Dernière page avec totaux : max 8 items
|
||||||
|
$itemsToProcess = min(8, $remainingItems);
|
||||||
|
} else {
|
||||||
|
// Pages normales : 15 items
|
||||||
|
$itemsToProcess = min(15, $remainingItems);
|
||||||
|
}
|
||||||
|
|
||||||
$config = [
|
$config = [
|
||||||
'pagination' => $pagination,
|
'pagination' => $pagination,
|
||||||
@ -111,7 +136,7 @@ class DevisPdfGenerator
|
|||||||
'sansMontant' => $context->montant
|
'sansMontant' => $context->montant
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->tableRenderer->createDevisTable(
|
$finalY = $this->tableRenderer->createDevisTable(
|
||||||
$context->pdf,
|
$context->pdf,
|
||||||
$context->dataDevis,
|
$context->dataDevis,
|
||||||
$config
|
$config
|
||||||
|
|||||||
@ -63,17 +63,18 @@ class DevisPdfLayoutManager
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addLegalFooter($pdf, $config)
|
public function addLegalFooter($pdf, $config, $tableEndY = 0)
|
||||||
{
|
{
|
||||||
$y0 = 260;
|
$y0 = 280;
|
||||||
|
|
||||||
$pageWidth = $pdf->GetPageWidth();
|
$pageWidth = $pdf->GetPageWidth();
|
||||||
|
|
||||||
$pdf->SetFont('Arial', '', 6);
|
$pdf->SetFont('Arial', '', 6);
|
||||||
$pdf->SetXY(1, $y0 + 4);
|
$pdf->SetXY(1, $y0);
|
||||||
$pdf->Cell($pageWidth, 5, mb_convert_encoding(html_entity_decode($config->legal_one), 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
|
$pdf->Cell($pageWidth, 5, mb_convert_encoding(html_entity_decode($config->legal_one), 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
|
||||||
$pdf->SetXY(1, $y0 + 8);
|
$pdf->SetXY(1, $y0 + 4);
|
||||||
$pdf->Cell($pageWidth, 5, mb_convert_encoding(html_entity_decode($config->legal_two), 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
|
$pdf->Cell($pageWidth, 5, mb_convert_encoding(html_entity_decode($config->legal_two), 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
|
||||||
$pdf->SetXY(1, $y0 + 12);
|
$pdf->SetXY(1, $y0 + 8);
|
||||||
$pdf->Cell($pageWidth, 5, mb_convert_encoding(html_entity_decode($config->telephone), 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
|
$pdf->Cell($pageWidth, 5, mb_convert_encoding(html_entity_decode($config->telephone), 'ISO-8859-1', 'UTF-8'), 0, 0, 'C');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,17 +119,17 @@ class DevisPdfLayoutManager
|
|||||||
$pdf->MultiCell(0, 7, trim(\OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($clientInfo['address'])));
|
$pdf->MultiCell(0, 7, trim(\OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($clientInfo['address'])));
|
||||||
$pdf->SetMargins(0, 0, 0);
|
$pdf->SetMargins(0, 0, 0);
|
||||||
|
|
||||||
$clientInfoYAxis += 14;
|
$clientInfoYAxis += 7;
|
||||||
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
|
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
|
||||||
$pdf->Cell(0, 7, trim(mb_convert_encoding(html_entity_decode($clientInfo['city']), 'ISO-8859-1', 'UTF-8')));
|
$pdf->Cell(0, 7, trim(mb_convert_encoding(html_entity_decode($clientInfo['city']), 'ISO-8859-1', 'UTF-8')));
|
||||||
|
|
||||||
if (!empty($clientInfo['siret'])) {
|
if (isset($clientInfo['siret']) && trim($clientInfo['siret']) !== '' && $clientInfo['siret'] !== null) {
|
||||||
$clientInfoYAxis += 7;
|
$clientInfoYAxis += 7;
|
||||||
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
|
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
|
||||||
$pdf->Cell(0, 7, 'Siret: ' . \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($clientInfo['siret']));
|
$pdf->Cell(0, 7, 'Siret: ' . \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($clientInfo['siret']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($clientInfo['email'])) {
|
if (isset($clientInfo['email']) && trim($clientInfo['email']) !== '' && $clientInfo['email'] !== null) {
|
||||||
$clientInfoYAxis += 7;
|
$clientInfoYAxis += 7;
|
||||||
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
|
$pdf->SetXY($clientInfoXAxis, $clientInfoYAxis);
|
||||||
$pdf->Cell(0, 7, 'Email: ' . mb_convert_encoding(html_entity_decode($clientInfo['email']), 'ISO-8859-1', 'UTF-8'));
|
$pdf->Cell(0, 7, 'Email: ' . mb_convert_encoding(html_entity_decode($clientInfo['email']), 'ISO-8859-1', 'UTF-8'));
|
||||||
|
|||||||
@ -13,41 +13,59 @@ class DevisPdfTableRenderer
|
|||||||
$totals = &$config['totals'];
|
$totals = &$config['totals'];
|
||||||
$sansMontant = $config['sansMontant'] ?? false;
|
$sansMontant = $config['sansMontant'] ?? false;
|
||||||
|
|
||||||
// Système de pagination comme les factures
|
|
||||||
$maxItemsPerPage = 22; // Nombre maximum d'éléments par page
|
|
||||||
$startIndex = $pagination['current_index'];
|
$startIndex = $pagination['current_index'];
|
||||||
$itemsThisPage = min($itemsToProcess, count($dataDevis) - $startIndex);
|
$itemsThisPage = min($itemsToProcess, count($dataDevis) - $startIndex);
|
||||||
|
|
||||||
$this->drawTableStructure($pdf, $numPage, $nbPage, $sansMontant);
|
$tableEndY = $this->drawTableStructure($pdf, $numPage, $nbPage, $sansMontant, $itemsThisPage);
|
||||||
$this->addTableHeaders($pdf, $sansMontant);
|
$this->addTableHeaders($pdf, $sansMontant);
|
||||||
$this->populateTableData($pdf, $dataDevis, $startIndex, $itemsThisPage, $totals, $sansMontant);
|
$this->populateTableData($pdf, $dataDevis, $startIndex, $itemsThisPage, $totals, $sansMontant);
|
||||||
|
|
||||||
// Totaux seulement sur la dernière page
|
|
||||||
if ($numPage == $nbPage && !$sansMontant) {
|
if ($numPage == $nbPage && !$sansMontant) {
|
||||||
$this->addTableTotals($pdf, $totals);
|
$finalY = $this->addTableTotals($pdf, $totals, $tableEndY);
|
||||||
|
} else {
|
||||||
|
$finalY = $tableEndY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $finalY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function drawTableStructure($pdf, $numPage, $nbPage, $sansMontant)
|
private function drawTableStructure($pdf, $numPage, $nbPage, $sansMontant, $itemsOnPage)
|
||||||
{
|
{
|
||||||
$pdf->SetLineWidth(0.2);
|
$pdf->SetLineWidth(0.2);
|
||||||
$pdf->Rect(5, 105, 200, 130, "D");
|
|
||||||
|
$headerHeight = 10;
|
||||||
|
$rowHeight = 10;
|
||||||
|
|
||||||
|
$tableHeight = $headerHeight + ($itemsOnPage * $rowHeight);
|
||||||
|
$endY = 105 + $tableHeight;
|
||||||
|
|
||||||
|
$isLastPage = ($numPage == $nbPage);
|
||||||
|
$hasAmounts = !$sansMontant;
|
||||||
|
|
||||||
|
if ($isLastPage && $hasAmounts) {
|
||||||
|
// Dessiner 3 côtés seulement (haut, gauche, droite)
|
||||||
|
$pdf->Line(5, 105, 205, 105); // Haut
|
||||||
|
$pdf->Line(5, 105, 5, $endY); // Gauche
|
||||||
|
$pdf->Line(205, 105, 205, $endY); // Droite
|
||||||
|
// Pas de ligne du bas - elle sera tracée dans addTableTotals
|
||||||
|
} else {
|
||||||
|
// Dessiner rectangle complet
|
||||||
|
$pdf->Rect(5, 105, 200, $tableHeight, "D");
|
||||||
|
}
|
||||||
|
|
||||||
$pdf->Line(5, 115, 205, 115);
|
$pdf->Line(5, 115, 205, 115);
|
||||||
|
|
||||||
$endY = ($numPage == $nbPage && !$sansMontant) ? 225 : 235;
|
|
||||||
|
|
||||||
if (!$sansMontant) {
|
if (!$sansMontant) {
|
||||||
// Ajustement final des positions des lignes verticales
|
$verticalLines = [24, 41, 58, 77, 102, 127, 147, 167, 178, 189];
|
||||||
// Article et Défunt de même taille, TTC réduit
|
|
||||||
$verticalLines = [22, 39, 56, 75, 105, 135, 155, 170, 185];
|
|
||||||
} else {
|
} else {
|
||||||
// Pour sans montant: Article et Défunt de même taille
|
$verticalLines = [27, 47, 67, 85, 110, 135, 160];
|
||||||
$verticalLines = [27, 47, 67, 85, 115, 145];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($verticalLines as $x) {
|
foreach ($verticalLines as $x) {
|
||||||
$pdf->Line($x, 105, $x, $endY);
|
$pdf->Line($x, 105, $x, $endY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $endY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addTableHeaders($pdf, $sansMontant)
|
private function addTableHeaders($pdf, $sansMontant)
|
||||||
@ -56,16 +74,17 @@ class DevisPdfTableRenderer
|
|||||||
|
|
||||||
if (!$sansMontant) {
|
if (!$sansMontant) {
|
||||||
$headers = [
|
$headers = [
|
||||||
[5, 17, "N° Devis"],
|
[5, 19, "N° Devis"],
|
||||||
[22, 17, "N° Dossier"],
|
[24, 17, "N° Dossier"],
|
||||||
[39, 17, "N° Commande"],
|
[41, 17, "N° Commande"],
|
||||||
[56, 19, "Date"],
|
[58, 19, "Date"],
|
||||||
[75, 30, "Article"], // Taille augmentée
|
[77, 25, "Article"],
|
||||||
[105, 30, "Lieu du soin"],
|
[102, 25, "Lieu du soin"],
|
||||||
[135, 20, "Défunt"], // Taille réduite pour équilibrer
|
[127, 20, "Thanato"],
|
||||||
[155, 15, "H.T."],
|
[147, 20, "Défunt"],
|
||||||
[170, 15, "TVA"],
|
[167, 11, "H.T."],
|
||||||
[185, 15, "T.T.C"] // Taille réduite
|
[178, 11, "TVA"],
|
||||||
|
[189, 16, "T.T.C"]
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$headers = [
|
$headers = [
|
||||||
@ -73,9 +92,10 @@ class DevisPdfTableRenderer
|
|||||||
[27, 20, "N° Dossier"],
|
[27, 20, "N° Dossier"],
|
||||||
[47, 20, "N° Commande"],
|
[47, 20, "N° Commande"],
|
||||||
[67, 18, "Date"],
|
[67, 18, "Date"],
|
||||||
[85, 30, "Article"], // Même taille que Défunt
|
[85, 25, "Article"],
|
||||||
[115, 30, "Lieu du soin"],
|
[110, 25, "Lieu du soin"],
|
||||||
[145, 30, "Défunt"] // Même taille que Article
|
[135, 25, "Thanato"],
|
||||||
|
[160, 45, "Défunt"]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,28 +146,34 @@ class DevisPdfTableRenderer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!$sansMontant) {
|
// Préparer le nom complet du thanatopracteur
|
||||||
// LARGEURS ÉQUILIBRÉES avec Article et Défunt de même taille
|
$thanatoNom = trim(($devis['thanato_prenom'] ?? '') . ' ' . ($devis['thanato_nom'] ?? ''));
|
||||||
$addSmartCell($pdf, 6, $yDevis, 16, $devis['devis_full_number']);
|
$thanatoNom = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($thanatoNom);
|
||||||
$addSmartCell($pdf, 23, $yDevis, 16, $devis['case_number'] ?? '');
|
|
||||||
$addSmartCell($pdf, 40, $yDevis, 16, $devis['order_number'] ?? '');
|
|
||||||
|
|
||||||
$addSmartCell($pdf, 57, $yDevis, 18, mb_convert_encoding($formatterDate->format($dateSoin), 'ISO-8859-1', 'UTF-8'));
|
if (!$sansMontant) {
|
||||||
|
$addSmartCell($pdf, 6, $yDevis, 18, $devis['devis_full_number']);
|
||||||
|
$addSmartCell($pdf, 25, $yDevis, 16, $devis['case_number'] ?? '');
|
||||||
|
$addSmartCell($pdf, 42, $yDevis, 16, $devis['order_number'] ?? '');
|
||||||
|
|
||||||
|
$addSmartCell($pdf, 59, $yDevis, 18, mb_convert_encoding($formatterDate->format($dateSoin), 'ISO-8859-1', 'UTF-8'));
|
||||||
|
|
||||||
$articleText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['article'] ?? 'SOINS');
|
$articleText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['article'] ?? 'SOINS');
|
||||||
$addSmartCell($pdf, 76, $yDevis, 29, $articleText); // Article agrandi
|
$addSmartCell($pdf, 78, $yDevis, 24, $articleText);
|
||||||
|
|
||||||
$lieuText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['lieu_nom'] ?? '');
|
$lieuText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['lieu_nom'] ?? '');
|
||||||
$addSmartCell($pdf, 106, $yDevis, 29, $lieuText);
|
$addSmartCell($pdf, 103, $yDevis, 24, $lieuText);
|
||||||
|
|
||||||
|
// COLONNE Thanatopracteur (après Lieu du soin)
|
||||||
|
$addSmartCell($pdf, 128, $yDevis, 19, $thanatoNom);
|
||||||
|
|
||||||
|
// COLONNE Défunt (après Thanato)
|
||||||
$defuntText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['defunt_nom'] ?? '');
|
$defuntText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['defunt_nom'] ?? '');
|
||||||
$addSmartCell($pdf, 136, $yDevis, 19, $defuntText); // Défunt réduit
|
$addSmartCell($pdf, 148, $yDevis, 19, $defuntText);
|
||||||
|
|
||||||
$addSmartCell($pdf, 156, $yDevis, 14, number_format($devis['montant_htc'], 2, '.', '') . chr(128), 'R');
|
$addSmartCell($pdf, 168, $yDevis, 10, number_format($devis['montant_htc'], 2, '.', '') . chr(128), 'R');
|
||||||
$addSmartCell($pdf, 171, $yDevis, 14, number_format($devis['montant_tva'], 2, '.', '') . chr(128), 'R');
|
$addSmartCell($pdf, 179, $yDevis, 10, number_format($devis['montant_tva'], 2, '.', '') . chr(128), 'R');
|
||||||
$addSmartCell($pdf, 186, $yDevis, 14, number_format($devis['montant_ttc'], 2, '.', '') . chr(128), 'R'); // TTC réduit
|
$addSmartCell($pdf, 190, $yDevis, 15, number_format($devis['montant_ttc'], 2, '.', '') . chr(128), 'R');
|
||||||
} else {
|
} else {
|
||||||
// Pour sans montant: Article et Défunt de même taille
|
|
||||||
$addSmartCell($pdf, 6, $yDevis, 21, $devis['devis_full_number']);
|
$addSmartCell($pdf, 6, $yDevis, 21, $devis['devis_full_number']);
|
||||||
$addSmartCell($pdf, 28, $yDevis, 19, $devis['case_number'] ?? '');
|
$addSmartCell($pdf, 28, $yDevis, 19, $devis['case_number'] ?? '');
|
||||||
$addSmartCell($pdf, 48, $yDevis, 19, $devis['order_number'] ?? '');
|
$addSmartCell($pdf, 48, $yDevis, 19, $devis['order_number'] ?? '');
|
||||||
@ -155,52 +181,58 @@ class DevisPdfTableRenderer
|
|||||||
$addSmartCell($pdf, 68, $yDevis, 17, mb_convert_encoding($formatterDate->format($dateSoin), 'ISO-8859-1', 'UTF-8'));
|
$addSmartCell($pdf, 68, $yDevis, 17, mb_convert_encoding($formatterDate->format($dateSoin), 'ISO-8859-1', 'UTF-8'));
|
||||||
|
|
||||||
$articleText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['article'] ?? 'SOINS');
|
$articleText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['article'] ?? 'SOINS');
|
||||||
$addSmartCell($pdf, 86, $yDevis, 29, $articleText); // Article agrandi
|
$addSmartCell($pdf, 86, $yDevis, 24, $articleText);
|
||||||
|
|
||||||
$lieuText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['lieu_nom'] ?? '');
|
$lieuText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['lieu_nom'] ?? '');
|
||||||
$addSmartCell($pdf, 116, $yDevis, 29, $lieuText);
|
$addSmartCell($pdf, 111, $yDevis, 24, $lieuText);
|
||||||
|
|
||||||
|
// COLONNE Thanatopracteur (après Lieu du soin)
|
||||||
|
$addSmartCell($pdf, 136, $yDevis, 24, $thanatoNom);
|
||||||
|
|
||||||
|
// COLONNE Défunt (après Thanato)
|
||||||
$defuntText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['defunt_nom'] ?? '');
|
$defuntText = \OCA\Gestion\Helpers\FileExportHelpers::FormatTextForExport($devis['defunt_nom'] ?? '');
|
||||||
$addSmartCell($pdf, 146, $yDevis, 29, $defuntText); // Défunt réduit
|
$addSmartCell($pdf, 161, $yDevis, 44, $defuntText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addTableTotals($pdf, $totals)
|
private function addTableTotals($pdf, $totals, $tableEndY)
|
||||||
{
|
{
|
||||||
$pdf->Line(5, 225, 205, 225);
|
$totalEndY = $tableEndY + 8;
|
||||||
|
|
||||||
|
$pdf->SetLineWidth(0.2);
|
||||||
|
|
||||||
|
// Juste les lignes horizontales haut et bas
|
||||||
|
$pdf->Line(5, $tableEndY, 205, $tableEndY);
|
||||||
|
$pdf->Line(5, $totalEndY, 205, $totalEndY);
|
||||||
|
|
||||||
|
$pdf->Line(5, $tableEndY, 5, $totalEndY);
|
||||||
|
$pdf->Line(205, $tableEndY, 205, $totalEndY);
|
||||||
|
|
||||||
$pdf->SetFont('Arial', 'B', 8);
|
$pdf->SetFont('Arial', 'B', 8);
|
||||||
|
|
||||||
// Alignement des totaux avec les colonnes HT, TVA, TTC
|
$pdf->SetXY(5, $tableEndY);
|
||||||
$pdf->SetXY(5, 225);
|
$pdf->Cell(162, 8, 'TOTAL', 0, 0, 'C');
|
||||||
$pdf->Cell(130, 8, 'TOTAL', 0, 0, 'C');
|
|
||||||
|
|
||||||
// POSITIONS alignées avec les colonnes du tableau
|
$pdf->SetXY(167, $tableEndY);
|
||||||
$pdf->SetXY(155, 225);
|
$pdf->Cell(9, 8, number_format($totals['ht'], 2, '.', '') . chr(128), 0, 0, 'R');
|
||||||
$pdf->Cell(15, 8, number_format($totals['ht'], 2, '.', '') . chr(128), 0, 0, 'R');
|
|
||||||
$pdf->SetXY(170, 225);
|
|
||||||
$pdf->Cell(15, 8, number_format($totals['tva'], 2, '.', '') . chr(128), 0, 0, 'R');
|
|
||||||
$pdf->SetXY(185, 225);
|
|
||||||
$pdf->Cell(15, 8, number_format($totals['ttc'], 2, '.', '') . chr(128), 0, 0, 'R');
|
|
||||||
|
|
||||||
// CADRE TOTAL TTC - Texte à l'intérieur du cadre aligné à droite
|
$pdf->SetXY(181, $tableEndY);
|
||||||
$pdf->SetXY(155, 240);
|
$pdf->Cell(9, 8, number_format($totals['tva'], 2, '.', '') . chr(128), 0, 0, 'R');
|
||||||
$pdf->Cell(30, 8, 'TOTAL TTC', 0, 0, 'C');
|
|
||||||
|
|
||||||
// Valeur alignée avec la fin du tableau tout à droite
|
$pdf->SetXY(189, $tableEndY);
|
||||||
$pdf->SetXY(185, 240);
|
$pdf->Cell(16, 8, number_format($totals['ttc'], 2, '.', '') . chr(128), 0, 0, 'R');
|
||||||
$pdf->Cell(15, 8, number_format($totals['ttc'], 2, '.', '') . chr(128), 0, 0, 'R');
|
|
||||||
|
|
||||||
// Cadre TOTAL TTC aligné avec la fin du tableau (205)
|
$cadreY = $totalEndY + 3;
|
||||||
$lines = [
|
|
||||||
[155, 240, 155, 248], // Ligne verticale gauche
|
|
||||||
[185, 240, 185, 248], // Ligne de séparation
|
|
||||||
[205, 240, 205, 248], // Ligne verticale droite (alignée avec fin du tableau)
|
|
||||||
[155, 240, 205, 240], // Ligne horizontale haute
|
|
||||||
[155, 248, 205, 248] // Ligne horizontale basse
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
$pdf->SetXY(170, $cadreY + 1);
|
||||||
$pdf->Line($line[0], $line[1], $line[2], $line[3]);
|
$pdf->Cell(19, 6, 'TOTAL TTC', 0, 0, 'C');
|
||||||
}
|
|
||||||
|
$pdf->SetXY(189, $cadreY + 1);
|
||||||
|
$pdf->Cell(16, 6, number_format($totals['ttc'], 2, '.', '') . chr(128), 0, 0, 'C');
|
||||||
|
|
||||||
|
$pdf->Rect(170, $cadreY, 35, 8, 'D');
|
||||||
|
$pdf->Line(189, $cadreY, 189, $cadreY + 8);
|
||||||
|
|
||||||
|
return $cadreY + 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,94 +30,102 @@ use OCA\Gestion\Db\Bdd;
|
|||||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class ExportClientStatisticService {
|
class ExportClientStatisticService
|
||||||
/** @var Bdd */
|
{
|
||||||
private $gestionBdd;
|
/** @var Bdd */
|
||||||
|
private $gestionBdd;
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
LoggerInterface $logger) {
|
LoggerInterface $logger
|
||||||
$this->logger = $logger;
|
) {
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->logger = $logger;
|
||||||
}
|
$this->gestionBdd = $gestionBdd;
|
||||||
|
}
|
||||||
|
|
||||||
public function getFileName(array $clientIds){
|
public function getFileName(array $clientIds)
|
||||||
|
{
|
||||||
$filename = "";
|
$filename = "";
|
||||||
$clients = $this->gestionBdd->getClientsByClientsID($clientIds);
|
$clients = $this->gestionBdd->getClientsByClientsID($clientIds);
|
||||||
foreach($clients as $client){
|
foreach($clients as $client) {
|
||||||
$filename .= $client['client_nom'] . '-' . $client['client_entreprise'] . '--';
|
$filename .= $client['client_nom'] . '-' . $client['client_entreprise'] . '--';
|
||||||
}
|
}
|
||||||
$filename = rtrim($filename, '-');
|
$filename = rtrim($filename, '-');
|
||||||
$filename = str_replace(' ','-', $filename);
|
$filename = str_replace(' ', '-', $filename);
|
||||||
$filename = str_replace(' ','-', $filename);
|
$filename = str_replace(' ', '-', $filename);
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getExportClientFileHeader(): string{
|
public function getExportClientFileHeader(): string
|
||||||
$fileHeader =
|
{
|
||||||
'CLIENT'.';'.
|
$fileHeader =
|
||||||
|
'CLIENT'.';'.
|
||||||
'MOIS'.';'.
|
'MOIS'.';'.
|
||||||
'ANNEE'.';'.
|
'ANNEE'.';'.
|
||||||
'NB DE DEFUNTS'.';';
|
'NB DE DEFUNTS'.';';
|
||||||
|
|
||||||
$produitList = $this->gestionBdd->getProduitsListAsArray();
|
$produitList = $this->gestionBdd->getProduitsListAsArray();
|
||||||
foreach($produitList as $produit){
|
foreach($produitList as $produit) {
|
||||||
$fileHeader .= FileExportHelpers::FormatTextForExport($produit['reference']).';';
|
$fileHeader .= FileExportHelpers::FormatTextForExport($produit['reference']).';';
|
||||||
}
|
}
|
||||||
$fileHeader .= 'TOTAL HT'.';'."\n";
|
$fileHeader .= 'TOTAL HT'.';'."\n";
|
||||||
return $fileHeader;
|
return $fileHeader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{
|
public function populateExportDataIntoFileContent(array $exportData, string $fileContent): string
|
||||||
foreach($exportData as $clientId => $clientData){
|
{
|
||||||
$clientName = $clientData["client_name"];
|
foreach($exportData as $clientId => $clientData) {
|
||||||
$clientStatPerMonth = $clientData["client_data"];
|
$clientName = $clientData["client_name"];
|
||||||
$totalPrice = 0;
|
$clientStatPerMonth = $clientData["client_data"];
|
||||||
if(!empty($clientStatPerMonth)){
|
$totalPrice = 0;
|
||||||
foreach($clientStatPerMonth as $month => $stat){
|
if(!empty($clientStatPerMonth)) {
|
||||||
$stat["client_name"] = $clientName;
|
foreach($clientStatPerMonth as $month => $stat) {
|
||||||
$totalPrice+=$stat["total_price"];
|
$stat["client_name"] = $clientName;
|
||||||
$fileContent = $this->populateClientStatDataIntoFileContent($fileContent,$month,$stat);
|
$totalPrice += $stat["total_price"];
|
||||||
}
|
$fileContent = $this->populateClientStatDataIntoFileContent($fileContent, $month, $stat);
|
||||||
$fileContent = $this->populateTotalPriceIntoFileContent($fileContent,$totalPrice,count($stat["products"]));
|
}
|
||||||
}
|
$fileContent = $this->populateTotalPriceIntoFileContent($fileContent, $totalPrice, count($stat["products"]));
|
||||||
}
|
}
|
||||||
return $fileContent;
|
}
|
||||||
}
|
return $fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
private function populateTotalPriceIntoFileContent(string $fileContent,$totalPrice,$productsCount){
|
private function populateTotalPriceIntoFileContent(string $fileContent, $totalPrice, $productsCount)
|
||||||
$fileContent = $fileContent.
|
{
|
||||||
''.';'.
|
$fileContent = $fileContent.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';';
|
''.';'.
|
||||||
while($productsCount > 0){
|
''.';';
|
||||||
$fileContent .= ''.';';
|
while($productsCount > 0) {
|
||||||
$productsCount--;
|
$fileContent .= ''.';';
|
||||||
}
|
$productsCount--;
|
||||||
$fileContent .= "$totalPrice".";"."\n";
|
}
|
||||||
return $fileContent;
|
$fileContent .= "$totalPrice".";"."\n";
|
||||||
}
|
return $fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
private function populateClientStatDataIntoFileContent(string $fileContent,$month,array $statPerMonth){
|
private function populateClientStatDataIntoFileContent(string $fileContent, $month, array $statPerMonth)
|
||||||
$yearValue = $statPerMonth["year"];
|
{
|
||||||
$defuntCount = $statPerMonth["defunt_count"];
|
$yearValue = $statPerMonth["year"];
|
||||||
$products = $statPerMonth["products"];
|
$defuntCount = $statPerMonth["defunt_count"];
|
||||||
|
$products = $statPerMonth["products"];
|
||||||
|
$priceTotal = $statPerMonth["total_price"];
|
||||||
|
|
||||||
$fileContent = $fileContent.
|
$fileContent = $fileContent.
|
||||||
FileExportHelpers::FormatTextForExport($statPerMonth['client_name']).';'.
|
FileExportHelpers::FormatTextForExport($statPerMonth['client_name']).';'.
|
||||||
"$month".';'.
|
"$month".';'.
|
||||||
"$yearValue".';'.
|
"$yearValue".';'.
|
||||||
"$defuntCount".';';
|
"$defuntCount".';';
|
||||||
|
|
||||||
foreach($products as $productCount){
|
foreach($products as $productCount) {
|
||||||
$fileContent .= "$productCount".";";
|
$fileContent .= "$productCount".";";
|
||||||
}
|
}
|
||||||
$fileContent .= "\n";
|
$fileContent .= "$priceTotal".';'."\n";
|
||||||
return $fileContent;
|
return $fileContent;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,149 +34,158 @@ use OCA\Gestion\Constants\BddConstant;
|
|||||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||||
use OCA\Gestion\Constants\AbsenceTypeConstant;
|
use OCA\Gestion\Constants\AbsenceTypeConstant;
|
||||||
|
|
||||||
class ExportThanatoStatisticService {
|
class ExportThanatoStatisticService
|
||||||
/** @var Bdd */
|
{
|
||||||
private $gestionBdd;
|
/** @var Bdd */
|
||||||
|
private $gestionBdd;
|
||||||
|
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/** @var IRootFolder */
|
/** @var IRootFolder */
|
||||||
private $rootFolder;
|
private $rootFolder;
|
||||||
|
|
||||||
private $geoService;
|
private $geoService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
LoggerInterface $logger,
|
LoggerInterface $logger,
|
||||||
IRootFolder $rootFolder,
|
IRootFolder $rootFolder,
|
||||||
GeoService $geoService) {
|
GeoService $geoService
|
||||||
$this->geoService = $geoService;
|
) {
|
||||||
$this->rootFolder = $rootFolder;
|
$this->geoService = $geoService;
|
||||||
$this->logger = $logger;
|
$this->rootFolder = $rootFolder;
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->logger = $logger;
|
||||||
}
|
$this->gestionBdd = $gestionBdd;
|
||||||
|
}
|
||||||
|
|
||||||
private function getFilename($thanatoName,$thanatoLastName,$month,$year){
|
private function getFilename($thanatoName, $thanatoLastName, $month, $year)
|
||||||
$filename = "$year-$month-";
|
{
|
||||||
$filename .= $thanatoName . '-' . $thanatoLastName;
|
$filename = "$year-$month-";
|
||||||
$filename = str_replace(' ','-', $filename);
|
$filename .= $thanatoName . '-' . $thanatoLastName;
|
||||||
$filename = str_replace(' ','-', $filename);
|
$filename = str_replace(' ', '-', $filename);
|
||||||
|
$filename = str_replace(' ', '-', $filename);
|
||||||
return $filename;
|
return $filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function exportThanatoStatistic($thanatoId,$month,$year,$idNextcloud){
|
private function exportThanatoStatistic($thanatoId, $month, $year, $idNextcloud)
|
||||||
$thanato = $this->gestionBdd->getThanatoById($thanatoId);
|
{
|
||||||
if($thanato == null){
|
$thanato = $this->gestionBdd->getThanatoById($thanatoId);
|
||||||
return null;
|
if($thanato == null) {
|
||||||
}
|
return null;
|
||||||
$exportData = $this->gestionBdd->getExportThanatoStatisticData($thanatoId,$month,$year);
|
}
|
||||||
if(empty($exportData)){
|
$exportData = $this->gestionBdd->getExportThanatoStatisticData($thanatoId, $month, $year);
|
||||||
return null;
|
if(empty($exportData)) {
|
||||||
}
|
return null;
|
||||||
$defaultConfig = json_decode($this->gestionBdd->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
|
}
|
||||||
$racineFolder = html_entity_decode($defaultConfig[0]->path).'/';
|
$defaultConfig = json_decode($this->gestionBdd->getConfiguration(BddConstant::DEFAULT_ADMIN_ID_NEXTCLOUD));
|
||||||
$thanatoFolder = $racineFolder.'STATISTIQUES/THANATOS/';
|
$racineFolder = html_entity_decode($defaultConfig[0]->path).'/';
|
||||||
$fileHeader = $this->getExportThanatoFileHeader();
|
$thanatoFolder = $racineFolder.'STATISTIQUES/THANATOS/';
|
||||||
$fileContent = $this->populateExportDataIntoFileContent($exportData,$fileHeader);
|
$fileHeader = $this->getExportThanatoFileHeader();
|
||||||
$storage = $this->rootFolder->getUserFolder($idNextcloud);
|
$fileContent = $this->populateExportDataIntoFileContent($exportData, $fileHeader);
|
||||||
try{
|
$storage = $this->rootFolder->getUserFolder($idNextcloud);
|
||||||
$storage->newFolder($thanatoFolder);
|
try {
|
||||||
}
|
$storage->newFolder($thanatoFolder);
|
||||||
catch(\OCP\Files\NotPermittedException $e) {
|
} catch(\OCP\Files\NotPermittedException $e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
$filename = $this->getFilename($thanato["nom"],$thanato["prenom"],$month,$year);
|
$filename = $this->getFilename($thanato["nom"], $thanato["prenom"], $month, $year);
|
||||||
$fileNamePath = $thanatoFolder."STAT-THANATO-" . $filename . '.csv';
|
$fileNamePath = $thanatoFolder."STAT-THANATO-" . $filename . '.csv';
|
||||||
$storage->newFile($fileNamePath);
|
$storage->newFile($fileNamePath);
|
||||||
$file = $storage->get($fileNamePath);
|
$file = $storage->get($fileNamePath);
|
||||||
$file->putContent($fileContent);
|
$file->putContent($fileContent);
|
||||||
return $fileNamePath;
|
return $fileNamePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function exportThanatosListStatistic(array $thanatoIds,$month,$year,$idNextcloud){
|
public function exportThanatosListStatistic(array $thanatoIds, $month, $year, $idNextcloud)
|
||||||
$filenames = [];
|
{
|
||||||
foreach($thanatoIds as $thanatoId){
|
$filenames = [];
|
||||||
$filename = $this->exportThanatoStatistic($thanatoId,$month,$year,$idNextcloud);
|
foreach($thanatoIds as $thanatoId) {
|
||||||
if($filename != null){
|
$filename = $this->exportThanatoStatistic($thanatoId, $month, $year, $idNextcloud);
|
||||||
$filenames[] = $filename;
|
if($filename != null) {
|
||||||
}
|
$filenames[] = $filename;
|
||||||
}
|
}
|
||||||
return $filenames;
|
}
|
||||||
}
|
return $filenames;
|
||||||
|
}
|
||||||
|
|
||||||
public function getExportThanatoFileHeader(): string{
|
public function getExportThanatoFileHeader(): string
|
||||||
$fileHeader =
|
{
|
||||||
'FACTURE'.';'.
|
$fileHeader =
|
||||||
'THANATOPRACTEUR'.';'.
|
'DEVIS'.';'.
|
||||||
'DATE'.';'.
|
'THANATOPRACTEUR'.';'.
|
||||||
'HEURE DE DEBUT'.';'.
|
'DATE'.';'.
|
||||||
'HEURE DE FIN'.';'.
|
'HEURE DE DEBUT'.';'.
|
||||||
'SOINS'.';'.
|
'HEURE DE FIN'.';'.
|
||||||
'JOUR/FERIE'.';'.
|
'SOINS'.';'.
|
||||||
'CONGE'.';'.
|
'JOUR/FERIE'.';'.
|
||||||
'REPOS'.';'.
|
'CONGE'.';'.
|
||||||
'MALADIE'.';'.
|
'REPOS'.';'.
|
||||||
'NOM ET PRENOM'.';'.
|
'MALADIE'.';'.
|
||||||
'LIEU'.';'.
|
'NOM ET PRENOM'.';'.
|
||||||
'POMPES FUNEBRES'.';'.
|
'LIEU'.';'.
|
||||||
'ADRESSE'.';'.
|
'POMPES FUNEBRES'.';'.
|
||||||
'DISTANCE TOTALE KM'.';'.
|
'ADRESSE'.';'.
|
||||||
'HEURES TOTAL DE SOIN'.';'.
|
'DISTANCE TOTALE KM'.';'.
|
||||||
'HEURES TOTAL DE CONGE'.';'.
|
'HEURES TOTAL DE SOIN'.';'.
|
||||||
'HEURES TOTAL DE REPOS'.';'.
|
'HEURES TOTAL DE CONGE'.';'.
|
||||||
'HEURES TOTAL DE MALADIE'.';'.
|
'HEURES TOTAL DE REPOS'.';'.
|
||||||
'HEURES TOTAL DE TRAVAIL'.';'.
|
'HEURES TOTAL DE MALADIE'.';'.
|
||||||
'HEURES TOTAL DE PARCOURS ENTRE DEVIS'.';'.
|
'HEURES TOTAL DE TRAVAIL'.';'.
|
||||||
'NOMBRE DE SOINS ET TOILETTES'.';'.
|
'HEURES TOTAL DE PARCOURS ENTRE DEVIS'.';'.
|
||||||
"\n";
|
'NOMBRE DE SOINS ET TOILETTES'.';'.
|
||||||
return $fileHeader;
|
"\n";
|
||||||
}
|
return $fileHeader;
|
||||||
|
}
|
||||||
|
|
||||||
private function populateNoDevisDataInADay(string $fileContent,$leave){
|
private function populateNoDevisDataInADay(string $fileContent, $leave)
|
||||||
$startTimeValue = "";
|
{
|
||||||
$endTimeValue = "";
|
$startTimeValue = "";
|
||||||
$leaveValue = "Non";
|
$endTimeValue = "";
|
||||||
if($leave["onLeave"]){
|
$leaveValue = "Non";
|
||||||
$startTimeValue = $leave["startTime"];
|
$restValue = "Non"; // AJOUTER CETTE LIGNE
|
||||||
$endTimeValue = $leave["endTime"];
|
$diseaseValue = "Non"; // AJOUTER CETTE LIGNE
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE){
|
if($leave["onLeave"]) {
|
||||||
$leaveValue = "Oui";
|
$startTimeValue = $leave["startTime"];
|
||||||
}
|
$endTimeValue = $leave["endTime"];
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE){
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE) {
|
||||||
$diseaseValue = "Oui";
|
$leaveValue = "Oui";
|
||||||
}
|
}
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST){
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE) {
|
||||||
$restValue = "Oui";
|
$diseaseValue = "Oui";
|
||||||
}
|
}
|
||||||
}
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST) {
|
||||||
$fileContent = $fileContent.
|
$restValue = "Oui";
|
||||||
''.';'.
|
}
|
||||||
FileExportHelpers::FormatTextForExport($leave['thanatoName']).';'.
|
}
|
||||||
$leave['date'].';'.
|
$fileContent = $fileContent.
|
||||||
$startTimeValue.';'.
|
''.';'.
|
||||||
$endTimeValue.';'.
|
FileExportHelpers::FormatTextForExport($leave['thanatoName']).';'.
|
||||||
''.';'.
|
$leave['date'].';'.
|
||||||
DateHelpers::getPublicHolidayText($leave['isPublicHoliday']).';'.
|
$startTimeValue.';'.
|
||||||
$leaveValue.';'.
|
$endTimeValue.';'.
|
||||||
$restValue.';'.
|
''.';'.
|
||||||
$diseaseValue.';'.
|
DateHelpers::getPublicHolidayText($leave['isPublicHoliday']).';'.
|
||||||
''.';'.
|
$leaveValue.';'.
|
||||||
''.';'.
|
$restValue.';'.
|
||||||
''.';'.
|
$diseaseValue.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'."\n";
|
''.';'.
|
||||||
return $fileContent;
|
''.';'.
|
||||||
}
|
''.';'.
|
||||||
|
''.';'."\n";
|
||||||
|
return $fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
public function populateExportDataIntoFileContent(array $exportData,string $fileContent): string{
|
public function populateExportDataIntoFileContent(array $exportData, string $fileContent): string
|
||||||
|
{
|
||||||
|
|
||||||
$g_totalDistance = 0;
|
$g_totalDistance = 0;
|
||||||
$g_totalDevisHours = 0;
|
$g_totalDevisHours = 0;
|
||||||
@ -185,81 +194,81 @@ class ExportThanatoStatisticService {
|
|||||||
$g_totalTravelingHoursBetweenDevisLocation = 0;
|
$g_totalTravelingHoursBetweenDevisLocation = 0;
|
||||||
$g_totalDiseaseHours = 0;
|
$g_totalDiseaseHours = 0;
|
||||||
$g_totalRestHours = 0;
|
$g_totalRestHours = 0;
|
||||||
$g_totalDevisCount = 0;
|
$g_totalDevisCount = 0;
|
||||||
|
|
||||||
foreach($exportData as $devisDate => $devisData){
|
foreach($exportData as $devisDate => $devisData) {
|
||||||
$totalDevisHours = 0;
|
$totalDevisHours = 0;
|
||||||
$totalWorkedHours = 8;
|
$totalWorkedHours = 8;
|
||||||
$totalLeaveHours = 0;
|
$totalLeaveHours = 0;
|
||||||
$totalDiseaseHours = 0;
|
$totalDiseaseHours = 0;
|
||||||
$totalRestHours = 0;
|
$totalRestHours = 0;
|
||||||
$totalDistance = 0;
|
$totalDistance = 0;
|
||||||
$totalDevisCount = 0;
|
$totalDevisCount = 0;
|
||||||
$totalTravelingHoursBetweenDevisLocation = 0;
|
$totalTravelingHoursBetweenDevisLocation = 0;
|
||||||
$hasDevisInTheCurrentDate = $devisData['hasDevis'];
|
$hasDevisInTheCurrentDate = $devisData['hasDevis'];
|
||||||
if($hasDevisInTheCurrentDate === false){
|
if($hasDevisInTheCurrentDate === false) {
|
||||||
$leaves = $devisData["leaves"];
|
$leaves = $devisData["leaves"];
|
||||||
foreach($leaves as $leave){
|
foreach($leaves as $leave) {
|
||||||
$fileContent = $this->populateNoDevisDataInADay($fileContent,$leave);
|
$fileContent = $this->populateNoDevisDataInADay($fileContent, $leave);
|
||||||
if($leave["onLeave"]){
|
if($leave["onLeave"]) {
|
||||||
$totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"];
|
$totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"];
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE ){
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE) {
|
||||||
$totalLeaveHours += $totalLeaveHoursInsideWorkingHours;
|
$totalLeaveHours += $totalLeaveHoursInsideWorkingHours;
|
||||||
}
|
}
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST){
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST) {
|
||||||
$totalRestHours += $totalLeaveHoursInsideWorkingHours;
|
$totalRestHours += $totalLeaveHoursInsideWorkingHours;
|
||||||
}
|
}
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE){
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE) {
|
||||||
$totalDiseaseHours += $totalLeaveHoursInsideWorkingHours;
|
$totalDiseaseHours += $totalLeaveHoursInsideWorkingHours;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours;
|
$totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours;
|
||||||
$totalWorkedHours -= $totalAbsenceHours;
|
$totalWorkedHours -= $totalAbsenceHours;
|
||||||
}
|
} else {
|
||||||
else{
|
$totalDevisCount += count($devisData["devisId"]);
|
||||||
$totalDevisCount += count($devisData["devisId"]);
|
$routeLines = $this->gestionBdd->getRouteLinesByDevisIdList($devisData["devisId"]);
|
||||||
$routeLines = $this->gestionBdd->getRouteLinesByDevisIdList($devisData["devisId"]);
|
$totalDistanceAndTotalTravelingHoursBetweenDevis = $this->geoService->getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLines($routeLines);
|
||||||
$totalDistanceAndTotalTravelingHoursBetweenDevis = $this->geoService->getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLines($routeLines);
|
$totalDistance = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalDistance"];
|
||||||
$totalDistance = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalDistance"];
|
$totalTravelingHoursBetweenDevisLocation = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalTravelingHours"];
|
||||||
$totalTravelingHoursBetweenDevisLocation = $totalDistanceAndTotalTravelingHoursBetweenDevis["totalTravelingHours"];
|
$devisList = $devisData["devis"];
|
||||||
$devisList = $devisData["devis"];
|
$leaves = $devisData["leaves"];
|
||||||
$leaves = $devisData["leaves"];
|
if(!empty($devisList)) {
|
||||||
if(!empty($devisList)){
|
foreach($devisList as $devis) {
|
||||||
foreach($devisList as $devis){
|
$fileContent = $this->populateDevisDataIntoThanatoExportFileContent($fileContent, $devis);
|
||||||
$fileContent = $this->populateDevisDataIntoThanatoExportFileContent($fileContent,$devis);
|
$totalDevisHours += $devis["totalHours"];
|
||||||
$totalDevisHours += $devis["totalHours"];
|
}
|
||||||
}
|
}
|
||||||
}
|
foreach($leaves as $leave) {
|
||||||
foreach($leaves as $leave){
|
$fileContent = $this->populateNoDevisDataInADay($fileContent, $leave);
|
||||||
$fileContent = $this->populateNoDevisDataInADay($fileContent,$leave);
|
if($leave["onLeave"]) {
|
||||||
if($leave["onLeave"]){
|
$totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"];
|
||||||
$totalLeaveHoursInsideWorkingHours = $leave["totalWorkedHours"];
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE) {
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::LEAVE){
|
$totalLeaveHours += $totalLeaveHoursInsideWorkingHours;
|
||||||
$totalLeaveHours += $totalLeaveHoursInsideWorkingHours;
|
}
|
||||||
}
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST) {
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::REST){
|
$totalRestHours += $totalLeaveHoursInsideWorkingHours;
|
||||||
$totalRestHours += $totalLeaveHoursInsideWorkingHours;
|
}
|
||||||
}
|
if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE) {
|
||||||
if($leave["absenceTypeKey"] == AbsenceTypeConstant::DISEASE){
|
$totalDiseaseHours += $totalLeaveHoursInsideWorkingHours;
|
||||||
$totalDiseaseHours += $totalLeaveHoursInsideWorkingHours;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
$totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours;
|
||||||
$totalAbsenceHours = $totalLeaveHours + $totalRestHours + $totalDiseaseHours;
|
$totalWorkedHours -= $totalAbsenceHours;
|
||||||
$totalWorkedHours -= $totalAbsenceHours;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$fileContent = $this->populateLastRecapForTheLine(
|
$fileContent = $this->populateLastRecapForTheLine(
|
||||||
$fileContent,
|
$fileContent,
|
||||||
$totalDistance,
|
$totalDistance,
|
||||||
$totalDevisHours,
|
$totalDevisHours,
|
||||||
$totalWorkedHours,
|
$totalWorkedHours,
|
||||||
$totalLeaveHours,
|
$totalLeaveHours,
|
||||||
$totalTravelingHoursBetweenDevisLocation,
|
$totalTravelingHoursBetweenDevisLocation,
|
||||||
$totalDiseaseHours,
|
$totalDiseaseHours,
|
||||||
$totalRestHours,$totalDevisCount
|
$totalRestHours,
|
||||||
);
|
$totalDevisCount
|
||||||
|
);
|
||||||
|
|
||||||
$g_totalDistance += $totalDistance;
|
$g_totalDistance += $totalDistance;
|
||||||
$g_totalDevisHours += $totalDevisHours;
|
$g_totalDevisHours += $totalDevisHours;
|
||||||
@ -268,8 +277,8 @@ class ExportThanatoStatisticService {
|
|||||||
$g_totalTravelingHoursBetweenDevisLocation += $totalTravelingHoursBetweenDevisLocation;
|
$g_totalTravelingHoursBetweenDevisLocation += $totalTravelingHoursBetweenDevisLocation;
|
||||||
$g_totalDiseaseHours += $totalDiseaseHours;
|
$g_totalDiseaseHours += $totalDiseaseHours;
|
||||||
$g_totalRestHours += $totalRestHours;
|
$g_totalRestHours += $totalRestHours;
|
||||||
$g_totalDevisCount += $totalDevisCount;
|
$g_totalDevisCount += $totalDevisCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fileContent = $this->populateLastRecapForTheLine(
|
$fileContent = $this->populateLastRecapForTheLine(
|
||||||
$fileContent,
|
$fileContent,
|
||||||
@ -279,77 +288,113 @@ class ExportThanatoStatisticService {
|
|||||||
$g_totalLeaveHours,
|
$g_totalLeaveHours,
|
||||||
$g_totalTravelingHoursBetweenDevisLocation,
|
$g_totalTravelingHoursBetweenDevisLocation,
|
||||||
$g_totalDiseaseHours,
|
$g_totalDiseaseHours,
|
||||||
$g_totalRestHours,$g_totalDevisCount
|
$g_totalRestHours,
|
||||||
|
$g_totalDevisCount
|
||||||
);
|
);
|
||||||
|
|
||||||
return $fileContent;
|
return $fileContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function populateLastRecapForTheLine(string $fileContent,$distance,$totalDevisHours,$totalWorkedHours,$totalLeaveHours,$totalTravelingHours ,$totalDiseaseHours = 0,$totalRestHours = 0,$totalDevisCount = 0){
|
private function populateLastRecapForTheLine(string $fileContent, $distance, $totalDevisHours, $totalWorkedHours, $totalLeaveHours, $totalTravelingHours, $totalDiseaseHours = 0, $totalRestHours = 0, $totalDevisCount = 0)
|
||||||
$fileContent = $fileContent.
|
{
|
||||||
''.';'.
|
$fileContent = $fileContent.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
"$distance".';'.
|
''.';'.
|
||||||
"$totalDevisHours".';'.
|
"$distance".';'.
|
||||||
"$totalLeaveHours".';'.
|
"$totalDevisHours".';'.
|
||||||
"$totalRestHours".';'.
|
"$totalLeaveHours".';'.
|
||||||
"$totalDiseaseHours".';'.
|
"$totalRestHours".';'.
|
||||||
"$totalWorkedHours".';'.
|
"$totalDiseaseHours".';'.
|
||||||
"$totalTravelingHours".';'.
|
"$totalWorkedHours".';'.
|
||||||
"$totalDevisCount"."\n";
|
"$totalTravelingHours".';'.
|
||||||
return $fileContent;
|
"$totalDevisCount"."\n";
|
||||||
}
|
return $fileContent;
|
||||||
|
}
|
||||||
|
|
||||||
private function getFormatDevisProduitsAsString($devisProduits){
|
private function getFormatDevisProduitsAsString($devisProduits)
|
||||||
$result = '';
|
{
|
||||||
foreach ($devisProduits as $produit) {
|
$result = '';
|
||||||
$result .= $produit['produit_reference'] . '-' . $produit['produit_description'] . '--';
|
foreach ($devisProduits as $produit) {
|
||||||
}
|
$result .= $produit['produit_reference'] . '-' . $produit['produit_description'] . '--';
|
||||||
// Remove the trailing "--" at the end
|
}
|
||||||
$result = rtrim($result, '-');
|
// Remove the trailing "--" at the end
|
||||||
return $result;
|
$result = rtrim($result, '-');
|
||||||
}
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
private function populateDevisDataIntoThanatoExportFileContent(string $fileContent,array $devis){
|
private function populateDevisDataIntoThanatoExportFileContentSave(string $fileContent, array $devis)
|
||||||
$produitAsString = $this->getFormatDevisProduitsAsString($devis["produits"]);
|
{
|
||||||
$factureNum = $devis["facture_num"] ?? $devis["facture_on_group_num"] ?? "";
|
$produitAsString = $this->getFormatDevisProduitsAsString($devis["produits"]);
|
||||||
$fileContent = $fileContent.
|
$factureNum = $devis["facture_num"] ?? $devis["facture_on_group_num"] ?? "";
|
||||||
FileExportHelpers::FormatTextForExport($factureNum).';'.
|
$fileContent = $fileContent.
|
||||||
FileExportHelpers::FormatTextForExport($devis['nom_thanato'] . ' ' . $devis['prenom_thanatho']).';'.
|
FileExportHelpers::FormatTextForExport($factureNum).';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["date"]).';'.
|
FileExportHelpers::FormatTextForExport($devis['nom_thanato'] . ' ' . $devis['prenom_thanatho']).';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["startTime"]).';'.
|
FileExportHelpers::FormatTextForExport($devis["date"]).';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["endTime"]).';'.
|
FileExportHelpers::FormatTextForExport($devis["startTime"]).';'.
|
||||||
FileExportHelpers::FormatTextForExport($produitAsString).';'.
|
FileExportHelpers::FormatTextForExport($devis["endTime"]).';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["dayType"]).';'.
|
FileExportHelpers::FormatTextForExport($produitAsString).';'.
|
||||||
FileExportHelpers::FormatTextForExport('Non').';'.
|
FileExportHelpers::FormatTextForExport($devis["dayType"]).';'.
|
||||||
''.';'.
|
FileExportHelpers::FormatTextForExport('Non').';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["nom_defunt"]).';'.
|
''.';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["nom_lieu"] ?? "").';'.
|
FileExportHelpers::FormatTextForExport($devis["nom_defunt"]).';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["nom_client"] ?? "").';'.
|
FileExportHelpers::FormatTextForExport($devis["nom_lieu"] ?? "").';'.
|
||||||
FileExportHelpers::FormatTextForExport($devis["client_adresse"] ?? "").
|
FileExportHelpers::FormatTextForExport($devis["nom_client"] ?? "").';'.
|
||||||
''.';'.
|
FileExportHelpers::FormatTextForExport($devis["client_adresse"] ?? "").
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'.
|
''.';'.
|
||||||
''.';'."\n";
|
''.';'.
|
||||||
|
''.';'."\n";
|
||||||
|
|
||||||
return $fileContent;
|
return $fileContent;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function populateDevisDataIntoThanatoExportFileContent(string $fileContent, array $devis)
|
||||||
|
{
|
||||||
|
$produitAsString = $this->getFormatDevisProduitsAsString($devis["produits"]);
|
||||||
|
$devisNum = (string)($devis["calendar_uuid"] ?? "");
|
||||||
|
|
||||||
|
$fileContent = $fileContent.
|
||||||
|
FileExportHelpers::FormatTextForExport($devisNum).';'.
|
||||||
|
FileExportHelpers::FormatTextForExport(($devis['nom_thanato'] ?? '') . ' ' . ($devis['prenom_thanato'] ?? '')).';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["date"] ?? "").';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["startTime"] ?? "").';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["endTime"] ?? "").';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($produitAsString).';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["dayType"] ?? "").';'.
|
||||||
|
'Non'.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["nom_defunt"] ?? "").';'. // ICI
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["nom_lieu"] ?? "").';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["nom_client"] ?? "").';'.
|
||||||
|
FileExportHelpers::FormatTextForExport($devis["client_adresse"] ?? "").';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'.
|
||||||
|
''.';'."\n";
|
||||||
|
|
||||||
|
return $fileContent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,28 +30,31 @@ use Exception;
|
|||||||
use OCA\Gestion\Constants\GeoConstant;
|
use OCA\Gestion\Constants\GeoConstant;
|
||||||
use OCA\Gestion\Helpers\GeoHelpers;
|
use OCA\Gestion\Helpers\GeoHelpers;
|
||||||
|
|
||||||
class GeoService {
|
class GeoService
|
||||||
|
{
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calcul la distance entre les deux points à vol d'oiseau
|
* Calcul la distance entre les deux points à vol d'oiseau
|
||||||
*/
|
*/
|
||||||
private function getDistanceInKmBetweenTwoPoints($lat1, $lon1, $lat2, $lon2) {
|
private function getDistanceInKmBetweenTwoPoints($lat1, $lon1, $lat2, $lon2)
|
||||||
|
{
|
||||||
$R = 6371; // Rayon moyen de la Terre en kilomètres
|
$R = 6371; // Rayon moyen de la Terre en kilomètres
|
||||||
$dLat = deg2rad($lat2 - $lat1);
|
$dLat = deg2rad($lat2 - $lat1);
|
||||||
$dLon = deg2rad($lon2 - $lon1);
|
$dLon = deg2rad($lon2 - $lon1);
|
||||||
$a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($dLon/2) * sin($dLon/2);
|
$a = sin($dLat / 2) * sin($dLat / 2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($dLon / 2) * sin($dLon / 2);
|
||||||
$c = 2 * atan2(sqrt($a), sqrt(1-$a));
|
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
|
||||||
$d = $R * $c;
|
$d = $R * $c;
|
||||||
return round($d, 2);
|
return round($d, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTravelingHourBetweenTwoPoints(array $origin,array $destination,$mode = "driving"){
|
private function getTravelingHourBetweenTwoPoints(array $origin, array $destination, $mode = "driving")
|
||||||
|
{
|
||||||
$baseUrl = "https://api.geoapify.com/v1/routing";
|
$baseUrl = "https://api.geoapify.com/v1/routing";
|
||||||
$originPoints = GeoHelpers::getPointsTextFromLatitudeAndLongitude($origin["latitude"],$origin["longitude"]);
|
$originPoints = GeoHelpers::getPointsTextFromLatitudeAndLongitude($origin["latitude"], $origin["longitude"]);
|
||||||
$destinationPoints = GeoHelpers::getPointsTextFromLatitudeAndLongitude($destination["latitude"],$destination["longitude"]);
|
$destinationPoints = GeoHelpers::getPointsTextFromLatitudeAndLongitude($destination["latitude"], $destination["longitude"]);
|
||||||
|
|
||||||
$fullUrl = $baseUrl."?waypoints=$originPoints|$destinationPoints&mode=$mode&apiKey=9e23d93e7f454c988344f9171bf867aa";
|
$fullUrl = $baseUrl."?waypoints=$originPoints|$destinationPoints&mode=$mode&apiKey=9e23d93e7f454c988344f9171bf867aa";
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
@ -79,39 +82,39 @@ class GeoService {
|
|||||||
$travelTimeHours = round($travelTimeHours, 2);
|
$travelTimeHours = round($travelTimeHours, 2);
|
||||||
return $travelTimeHours;
|
return $travelTimeHours;
|
||||||
}
|
}
|
||||||
}
|
} catch(Exception $e) {
|
||||||
catch(Exception $e){
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLines(array $routeLines){
|
public function getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLinesSave(array $routeLines)
|
||||||
|
{
|
||||||
$distanceCumul = 0;
|
$distanceCumul = 0;
|
||||||
$totalTravelingHoursBetweenTwoDevisLocation = 0;
|
$totalTravelingHoursBetweenTwoDevisLocation = 0;
|
||||||
$lastPoint = NULL;
|
$lastPoint = null;
|
||||||
for ($i=0; $i < sizeof($routeLines); $i++) {
|
for ($i = 0; $i < sizeof($routeLines); $i++) {
|
||||||
$currentDistance = 0;
|
$currentDistance = 0;
|
||||||
if($routeLines[$i]['lieu_id'] != NULL){
|
if($routeLines[$i]['lieu_id'] != null) {
|
||||||
$lastPoint = $routeLines[$i];
|
$lastPoint = $routeLines[$i];
|
||||||
}
|
}
|
||||||
if($lastPoint['lieu_id'] != NULL && $routeLines[$i+1]['lieu_id'] != NULL){
|
if($lastPoint['lieu_id'] != null && $routeLines[$i + 1]['lieu_id'] != null) {
|
||||||
$currentDistance = $this->getDistanceInKmBetweenTwoPoints(
|
$currentDistance = $this->getDistanceInKmBetweenTwoPoints(
|
||||||
floatval(value: $lastPoint['latitude']),
|
floatval(value: $lastPoint['latitude']),
|
||||||
floatval($lastPoint['longitude']),
|
floatval($lastPoint['longitude']),
|
||||||
floatval($routeLines[$i+1]['latitude']),
|
floatval($routeLines[$i + 1]['latitude']),
|
||||||
floatval($routeLines[$i+1]['longitude'])
|
floatval($routeLines[$i + 1]['longitude'])
|
||||||
);
|
);
|
||||||
$targetIsBetweenTwoDevisLocation = $lastPoint['source'] != "siege" && $routeLines[$i+1]["source"] != "siege";
|
$targetIsBetweenTwoDevisLocation = $lastPoint['source'] != "siege" && $routeLines[$i + 1]["source"] != "siege";
|
||||||
if($targetIsBetweenTwoDevisLocation){
|
if($targetIsBetweenTwoDevisLocation) {
|
||||||
$originPoints = [
|
$originPoints = [
|
||||||
"latitude" => $lastPoint["latitude"],
|
"latitude" => $lastPoint["latitude"],
|
||||||
"longitude" => $lastPoint["longitude"]
|
"longitude" => $lastPoint["longitude"]
|
||||||
];
|
];
|
||||||
$destinationPoints = [
|
$destinationPoints = [
|
||||||
"latitude" => $routeLines[$i+1]["latitude"],
|
"latitude" => $routeLines[$i + 1]["latitude"],
|
||||||
"longitude" => $routeLines[$i+1]["longitude"]
|
"longitude" => $routeLines[$i + 1]["longitude"]
|
||||||
];
|
];
|
||||||
$totalTravelingHoursBetweenTwoDevisLocation+= $this->getTravelingHourBetweenTwoPoints(
|
$totalTravelingHoursBetweenTwoDevisLocation += $this->getTravelingHourBetweenTwoPoints(
|
||||||
$originPoints,
|
$originPoints,
|
||||||
$destinationPoints,
|
$destinationPoints,
|
||||||
GeoConstant::DRIVING_MODE
|
GeoConstant::DRIVING_MODE
|
||||||
@ -125,4 +128,65 @@ class GeoService {
|
|||||||
"totalTravelingHours" => $totalTravelingHoursBetweenTwoDevisLocation
|
"totalTravelingHours" => $totalTravelingHoursBetweenTwoDevisLocation
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTotalDistanceAndTotalTravelingHoursBetweenDevisLocationByRouteLines(array $routeLines)
|
||||||
|
{
|
||||||
|
$distanceCumul = 0;
|
||||||
|
$totalTravelingHoursBetweenTwoDevisLocation = 0;
|
||||||
|
$lastPoint = null;
|
||||||
|
|
||||||
|
for ($i = 0; $i < sizeof($routeLines); $i++) {
|
||||||
|
$currentDistance = 0;
|
||||||
|
|
||||||
|
// Vérifier que l'élément actuel existe
|
||||||
|
if(!isset($routeLines[$i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($routeLines[$i]['lieu_id'] != null) {
|
||||||
|
$lastPoint = $routeLines[$i];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vérifier que $i+1 existe ET que $lastPoint n'est pas null
|
||||||
|
if($lastPoint !== null &&
|
||||||
|
isset($routeLines[$i + 1]) &&
|
||||||
|
isset($lastPoint['lieu_id']) &&
|
||||||
|
isset($routeLines[$i + 1]['lieu_id']) &&
|
||||||
|
$lastPoint['lieu_id'] != null &&
|
||||||
|
$routeLines[$i + 1]['lieu_id'] != null) {
|
||||||
|
|
||||||
|
$currentDistance = $this->getDistanceInKmBetweenTwoPoints(
|
||||||
|
floatval($lastPoint['latitude']),
|
||||||
|
floatval($lastPoint['longitude']),
|
||||||
|
floatval($routeLines[$i + 1]['latitude']),
|
||||||
|
floatval($routeLines[$i + 1]['longitude'])
|
||||||
|
);
|
||||||
|
|
||||||
|
$targetIsBetweenTwoDevisLocation = $lastPoint['source'] != "siege" && $routeLines[$i + 1]["source"] != "siege";
|
||||||
|
|
||||||
|
if($targetIsBetweenTwoDevisLocation) {
|
||||||
|
$originPoints = [
|
||||||
|
"latitude" => $lastPoint["latitude"],
|
||||||
|
"longitude" => $lastPoint["longitude"]
|
||||||
|
];
|
||||||
|
$destinationPoints = [
|
||||||
|
"latitude" => $routeLines[$i + 1]["latitude"],
|
||||||
|
"longitude" => $routeLines[$i + 1]["longitude"]
|
||||||
|
];
|
||||||
|
$totalTravelingHoursBetweenTwoDevisLocation += $this->getTravelingHourBetweenTwoPoints(
|
||||||
|
$originPoints,
|
||||||
|
$destinationPoints,
|
||||||
|
GeoConstant::DRIVING_MODE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$distanceCumul += $currentDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
"totalDistance" => round($distanceCumul, 2),
|
||||||
|
"totalTravelingHours" => round($totalTravelingHoursBetweenTwoDevisLocation, 2)
|
||||||
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class GestionService
|
|||||||
private $userConnectedUuid;
|
private $userConnectedUuid;
|
||||||
|
|
||||||
/** @var DevisPdfService */
|
/** @var DevisPdfService */
|
||||||
private $devisPdfService;
|
private $devisPdfService;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Bdd $gestionBdd,
|
Bdd $gestionBdd,
|
||||||
@ -58,12 +58,11 @@ class GestionService
|
|||||||
TalkService $talkService,
|
TalkService $talkService,
|
||||||
IUserSession $userSession,
|
IUserSession $userSession,
|
||||||
DevisPdfService $devisPdfService
|
DevisPdfService $devisPdfService
|
||||||
|
|
||||||
) {
|
) {
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->gestionBdd = $gestionBdd;
|
$this->gestionBdd = $gestionBdd;
|
||||||
$this->talkService = $talkService;
|
$this->talkService = $talkService;
|
||||||
$this->devisPdfService = $devisPdfService;
|
$this->devisPdfService = $devisPdfService;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->userConnectedUuid = $userSession->getUser()->getUID();
|
$this->userConnectedUuid = $userSession->getUser()->getUID();
|
||||||
@ -163,9 +162,10 @@ class GestionService
|
|||||||
return $calendarStartDate;
|
return $calendarStartDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function GetIsPivateFromVCalendarString(string $vCalendarString): bool{
|
private function GetIsPivateFromVCalendarString(string $vCalendarString): bool
|
||||||
|
{
|
||||||
$isPrivateValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_PRIVATE, $vCalendarString);
|
$isPrivateValue = VCalendarHelpers::GetValueFromKeyInVCalendarString(VCalendarPropertyConstant::PROPERTY_IS_PRIVATE, $vCalendarString);
|
||||||
return $isPrivateValue === "1" ? true : false;
|
return $isPrivateValue === "1" ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -182,7 +182,16 @@ class GestionService
|
|||||||
private function UpdateDevisDataByVCalendarString($devis, $vCalendarString)
|
private function UpdateDevisDataByVCalendarString($devis, $vCalendarString)
|
||||||
{
|
{
|
||||||
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||||
$defuntId = $this->gestionBdd->createOrUpdateDefuntByNameAndReturnDefuntId($devis['defunt_id'], $devis['defunt_nom'], $requestedDefuntName);
|
|
||||||
|
$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
|
||||||
|
);
|
||||||
$this->gestionBdd->updateDevisDefunt($devis['id'], $defuntId, $devis['defunt_id']);
|
$this->gestionBdd->updateDevisDefunt($devis['id'], $defuntId, $devis['defunt_id']);
|
||||||
|
|
||||||
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||||
@ -206,6 +215,11 @@ class GestionService
|
|||||||
private function CheckIfDevisIsAlreadyUpdated($devis, $vCalendarString)
|
private function CheckIfDevisIsAlreadyUpdated($devis, $vCalendarString)
|
||||||
{
|
{
|
||||||
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
$requestedDefuntName = $this->GetCalendarSummaryFromVCalendarString($vCalendarString);
|
||||||
|
|
||||||
|
$requestedLieuDeces = $this->getLieuDecesFromVCalendarString($vCalendarString);
|
||||||
|
$requestedDateNaissance = $this->getDateNaissanceFromVCalendarString($vCalendarString);
|
||||||
|
$currentDefunt = $this->gestionBdd->getDefuntById($devis['defunt_id']);
|
||||||
|
|
||||||
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
$requestedClientId = $this->GetClientIdFromVCalendarString($vCalendarString);
|
||||||
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
$requestLocationId = $this->GetLocationIdFromVCalendarString($vCalendarString);
|
||||||
$requestedDevisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
|
$requestedDevisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
|
||||||
@ -226,15 +240,17 @@ class GestionService
|
|||||||
$devis['lieu_id'] == $requestLocationId &&
|
$devis['lieu_id'] == $requestLocationId &&
|
||||||
$devis['comment'] == $requestedDevisComment &&
|
$devis['comment'] == $requestedDevisComment &&
|
||||||
$requestedArticleIds == $articleDevisIds &&
|
$requestedArticleIds == $articleDevisIds &&
|
||||||
$devis['date'] == $requestedDevisDate;
|
$devis['date'] == $requestedDevisDate &&
|
||||||
|
($currentDefunt['lieu_deces'] ?? null) == $requestedLieuDeces &&
|
||||||
|
($currentDefunt['date_naissance'] ?? null) == $requestedDateNaissance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function HandleUpdatedCalendarObject(string $vCalendarString)
|
public function HandleUpdatedCalendarObject(string $vCalendarString)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
||||||
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
|
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE', $vCalendarString);
|
||||||
if ($isPrivate || $absenceType ) {
|
if ($isPrivate || $absenceType) {
|
||||||
//from devis calendar to leave calendar
|
//from devis calendar to leave calendar
|
||||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||||
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
$devis = $this->gestionBdd->getDevisByCalendarUuid($calendarUuid);
|
||||||
@ -296,10 +312,10 @@ class GestionService
|
|||||||
$month,
|
$month,
|
||||||
$year
|
$year
|
||||||
);
|
);
|
||||||
if($oldThanatoTrajet != null){
|
if($oldThanatoTrajet != null) {
|
||||||
$thereIsThanatoDevisRattachedToLigneTrajetForADate = $this->gestionBdd->thereIsThanatoDevisRattachedToLigneTrajetForADate($devis['date'], $oldThanatoTrajet['id'] );
|
$thereIsThanatoDevisRattachedToLigneTrajetForADate = $this->gestionBdd->thereIsThanatoDevisRattachedToLigneTrajetForADate($devis['date'], $oldThanatoTrajet['id']);
|
||||||
if(!$thereIsThanatoDevisRattachedToLigneTrajetForADate){
|
if(!$thereIsThanatoDevisRattachedToLigneTrajetForADate) {
|
||||||
$this->gestionBdd->deleteThanatoLigneTrajetForADateByIdTrajet($devis['date'], $oldThanatoTrajet['id'] );
|
$this->gestionBdd->deleteThanatoLigneTrajetForADateByIdTrajet($devis['date'], $oldThanatoTrajet['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->gestionBdd->updateDevisThanato($devis['id'], $thanato['id']);
|
$this->gestionBdd->updateDevisThanato($devis['id'], $thanato['id']);
|
||||||
@ -321,8 +337,8 @@ class GestionService
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
$isPrivate = $this->GetIsPivateFromVCalendarString($vCalendarString);
|
||||||
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE',$vCalendarString);
|
$absenceType = VCalendarHelpers::GetValueFromKeyInVCalendarString('ABSENCETYPE', $vCalendarString);
|
||||||
if($isPrivate || $absenceType){
|
if($isPrivate || $absenceType) {
|
||||||
//Nothing to do manage fo a private calendar
|
//Nothing to do manage fo a private calendar
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -336,11 +352,15 @@ class GestionService
|
|||||||
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
|
$thanatoId = $this->GetThanatoIdFromVCalendarString($vCalendarString);
|
||||||
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
$calendarUuid = $this->GetCalendarUuidFromVCalendarString($vCalendarString);
|
||||||
$userName = $this->GetThanatoNameFromVCalendarString($vCalendarString);
|
$userName = $this->GetThanatoNameFromVCalendarString($vCalendarString);
|
||||||
|
|
||||||
|
$lieuDeces = $this->getLieuDecesFromVCalendarString($vCalendarString);
|
||||||
|
$dateNaissance = $this->getDateNaissanceFromVCalendarString($vCalendarString);
|
||||||
|
|
||||||
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId, $locationId, $thanatoId, $calendarSummary, $calendarUuid);
|
$devisAlreadyCreated = $this->IsDevisAlreadyCreated($clientId, $locationId, $thanatoId, $calendarSummary, $calendarUuid);
|
||||||
if ($devisAlreadyCreated) {
|
if ($devisAlreadyCreated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary);
|
$defuntId = $this->gestionBdd->insertDefuntByNameAndReturnId($calendarSummary, $lieuDeces, $dateNaissance);
|
||||||
$calendarStartDate = $this->GetCalendarDateFromVCalendarString($vCalendarString);
|
$calendarStartDate = $this->GetCalendarDateFromVCalendarString($vCalendarString);
|
||||||
$devisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
|
$devisComment = $this->GetDevisCommentFromVCalendarString($vCalendarString);
|
||||||
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId, $clientId, $locationId, $defuntId, $calendarUuid, $calendarStartDate, $devisComment);
|
$devisId = $this->gestionBdd->insertDevisFromVCalendarAndReturnId($thanatoId, $clientId, $locationId, $defuntId, $calendarUuid, $calendarStartDate, $devisComment);
|
||||||
@ -352,7 +372,7 @@ class GestionService
|
|||||||
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId, $userName);
|
$devisTalkMessage = $this->gestionBdd->getDevisTalkRoomMessage($devisId, $userName);
|
||||||
$this->talkService->sendDevisTalkNotifications($devisTalkMessage, $userName, $this->userConnectedUuid);
|
$this->talkService->sendDevisTalkNotifications($devisTalkMessage, $userName, $this->userConnectedUuid);
|
||||||
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId, $userName);
|
$this->gestionBdd->createDevisTrajetFromVCalendar($devisId, $userName);
|
||||||
$this->devisPdfService->generateDevisPdfByDevisId($devisId , $this->userConnectedUuid);
|
$this->devisPdfService->generateDevisPdfByDevisId($devisId, $this->userConnectedUuid);
|
||||||
} catch (\OC\OCS\Exception $e) {
|
} catch (\OC\OCS\Exception $e) {
|
||||||
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
$this->logger->debug("Error while handling created calendar object: " . $e->getMessage());
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@ -360,7 +380,6 @@ class GestionService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function GetThanatoNameFromVCalendarString($vCalendarString)
|
private function GetThanatoNameFromVCalendarString($vCalendarString)
|
||||||
{
|
{
|
||||||
$thanatoName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);
|
$thanatoName = $this->getPrincipalUsernameFromVCalendarString($vCalendarString);
|
||||||
@ -393,4 +412,16 @@ class GestionService
|
|||||||
$mapped = array_map('trim', $articles);
|
$mapped = array_map('trim', $articles);
|
||||||
return $mapped;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ class MailerService {
|
|||||||
$cordialement = "<p> Cordialement,</p>";
|
$cordialement = "<p> Cordialement,</p>";
|
||||||
$userName = "<p> {$userName} </p>" ;
|
$userName = "<p> {$userName} </p>" ;
|
||||||
$signatureImage = $this->getSignatureHtmlEmailContent();
|
$signatureImage = $this->getSignatureHtmlEmailContent();
|
||||||
return $wish . $cordialement .$userName . $signatureImage ;
|
return $wish.$cordialement.$signatureImage ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getSignatureHtmlEmailContent (){
|
private function getSignatureHtmlEmailContent (){
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import "datatables.net-dt/css/jquery.dataTables.css";
|
|||||||
import "../css/mycss.css";
|
import "../css/mycss.css";
|
||||||
|
|
||||||
import "./listener/main_listener";
|
import "./listener/main_listener";
|
||||||
import { getBibliotheques, exportCareCertificate,getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker, saveRapportBijoux, saveRapportSoin, setBijouxPhoto, setDefuntCover, setDefuntPacemakerPhoto, updateDB } from "./modules/ajaxRequest.mjs";
|
import { getBibliotheques, exportCareCertificate,getBijouxById, getHypodermiquesyId, getObservationsById, getproduits, saveAttestationPacemaker, saveAttestationAbsentPacemaker, saveRapportBijoux, saveRapportSoin, setBijouxPhoto, setDefuntCover, setDefuntPacemakerPhoto, updateDB } from "./modules/ajaxRequest.mjs";
|
||||||
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
import { globalConfiguration } from "./modules/mainFunction.mjs";
|
||||||
|
|
||||||
let bibliotheques = [];
|
let bibliotheques = [];
|
||||||
@ -77,6 +77,7 @@ window.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var pacemakerBtn = document.getElementById("pacemakerBtn");
|
var pacemakerBtn = document.getElementById("pacemakerBtn");
|
||||||
|
var pacemakerAbsentBtn = document.getElementById("pacemakerAbsentBtn");
|
||||||
var rapportSoinBtn = document.getElementById("rapportSoinBtn");
|
var rapportSoinBtn = document.getElementById("rapportSoinBtn");
|
||||||
var exportCareCertificateButton = document.getElementById("exportCareCertificate");
|
var exportCareCertificateButton = document.getElementById("exportCareCertificate");
|
||||||
var setDefuntCoverButton = this.document.getElementById("coverProductsSetButton");
|
var setDefuntCoverButton = this.document.getElementById("coverProductsSetButton");
|
||||||
@ -144,6 +145,9 @@ window.addEventListener("DOMContentLoaded", function () {
|
|||||||
case 'pacemaker':
|
case 'pacemaker':
|
||||||
saveAttestationPacemaker({ defuntId: defuntid ,email: isSendEmail ? email: ''});
|
saveAttestationPacemaker({ defuntId: defuntid ,email: isSendEmail ? email: ''});
|
||||||
break;
|
break;
|
||||||
|
case 'pacemakerAbsent':
|
||||||
|
saveAttestationAbsentPacemaker({ defuntId: defuntid ,email: isSendEmail ? email: ''});
|
||||||
|
break;
|
||||||
case 'rapport-soin':
|
case 'rapport-soin':
|
||||||
saveRapportSoin({ numdefunt: defuntid ,email: isSendEmail ? email: ''});
|
saveRapportSoin({ numdefunt: defuntid ,email: isSendEmail ? email: ''});
|
||||||
break;
|
break;
|
||||||
@ -182,6 +186,12 @@ window.addEventListener("DOMContentLoaded", function () {
|
|||||||
modalElement.modal('show')
|
modalElement.modal('show')
|
||||||
// saveAttestationPacemaker({ defuntId: defuntid });
|
// saveAttestationPacemaker({ defuntId: defuntid });
|
||||||
});
|
});
|
||||||
|
pacemakerAbsentBtn.addEventListener("click", function(){
|
||||||
|
modalTitle.text("Générer l'attestation d'absence pacemaker")
|
||||||
|
modalElement.data('export-type', 'pacemakerAbsent')
|
||||||
|
modalElement.modal('show')
|
||||||
|
// saveAttestationPacemaker({ defuntId: defuntid });
|
||||||
|
});
|
||||||
|
|
||||||
rapportSoinBtn.addEventListener("click", function(){
|
rapportSoinBtn.addEventListener("click", function(){
|
||||||
modalElement.data('export-type', 'rapport-soin')
|
modalElement.data('export-type', 'rapport-soin')
|
||||||
|
|||||||
@ -678,6 +678,31 @@ export function saveAttestationPacemaker(myData) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save pdf in nextcloud
|
||||||
|
* @param {*} myData
|
||||||
|
*/
|
||||||
|
export function saveAttestationAbsentPacemaker(myData) {
|
||||||
|
showLoader();
|
||||||
|
$.ajax({
|
||||||
|
url: baseUrl + '/saveAttestationAbsentPacemaker',
|
||||||
|
type: 'POST',
|
||||||
|
contentType: 'application/json',
|
||||||
|
data: JSON.stringify(myData)
|
||||||
|
}).done(function (response) {
|
||||||
|
if(!response) {
|
||||||
|
showMessage('Ce defunt n\'appartient à aucun devis.');
|
||||||
|
} else {
|
||||||
|
showSuccess('Sauvegardé dans '+ response);
|
||||||
|
}
|
||||||
|
}).fail(function (response, code) {
|
||||||
|
showMessage(t('gestion', 'Erreur dans la génération d\'attestation pacemaker'));
|
||||||
|
}).always(function () {
|
||||||
|
hideLoader();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save pdf in nextcloud
|
* Save pdf in nextcloud
|
||||||
* @param {*} myData
|
* @param {*} myData
|
||||||
|
|||||||
@ -21,6 +21,7 @@ export class Defunt {
|
|||||||
this.pompe = ((myresp.nom_client == null) ? '-' : myresp.nom_client);
|
this.pompe = ((myresp.nom_client == null) ? '-' : myresp.nom_client);
|
||||||
this.lieu = ((myresp.lieu == null) ? '-' : myresp.lieu);
|
this.lieu = ((myresp.lieu == null) ? '-' : myresp.lieu);
|
||||||
this.numero_devis = ((myresp.user_id == null) ? '-' : myresp.user_id);
|
this.numero_devis = ((myresp.user_id == null) ? '-' : myresp.user_id);
|
||||||
|
this.lieu_deces = ((myresp.lieu_deces == null) ? '-' : myresp.lieu_deces);
|
||||||
this.baseUrl = generateUrl(`/apps/gestion/defunt/${this.id}/show`);
|
this.baseUrl = generateUrl(`/apps/gestion/defunt/${this.id}/show`);
|
||||||
this.productCoverDescription = Defunt.getDefuntProductCoverDescriptionFromApiResponse(myresp);
|
this.productCoverDescription = Defunt.getDefuntProductCoverDescriptionFromApiResponse(myresp);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
$quantiteOptions = [0];
|
$quantiteOptions = [0];
|
||||||
for ($i = 1; $i <= 10; $i++) {
|
for ($i = 1; $i <= 10; $i++) {
|
||||||
$quantiteOptions[] = $i / 10;
|
$quantiteOptions[] = $i / 10;
|
||||||
}
|
}
|
||||||
for ($i = 1; $i <= 15; $i++) {
|
for ($i = 1; $i <= 15; $i++) {
|
||||||
if ($i > 1) $quantiteOptions[] = $i;
|
if ($i > 1) {
|
||||||
if ($i < 15) $quantiteOptions[] = $i + 0.5;
|
$quantiteOptions[] = $i;
|
||||||
|
}
|
||||||
|
if ($i < 15) {
|
||||||
|
$quantiteOptions[] = $i + 0.5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$coverProducts = $_['coverProducts'];
|
$coverProducts = $_['coverProducts'];
|
||||||
?>
|
?>
|
||||||
@ -13,7 +17,7 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div id="defuntid" data-table="defunt" data-id="<?php echo $_['defunt'][0]->id; ?>"></div>
|
<div id="defuntid" data-table="defunt" data-id="<?php echo $_['defunt'][0]->id; ?>"></div>
|
||||||
<div class="breadcrumb" data-html2canvas-ignore>
|
<div class="breadcrumb" data-html2canvas-ignore>
|
||||||
<div class="crumb svg crumbhome">
|
<div class="crumb svg crumbhome">
|
||||||
<a href="<?php echo ($_['url']['index']); ?>" class="icon-home"></a>
|
<a href="<?php echo($_['url']['index']); ?>" class="icon-home"></a>
|
||||||
<span style="display: none;"></span>
|
<span style="display: none;"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="crumb svg crumbhome">
|
<div class="crumb svg crumbhome">
|
||||||
@ -26,6 +30,7 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="div">
|
<div class="div">
|
||||||
<button id="exportCareCertificate" class="btn btn-secondary" type="button">Générer l'attestation de soins</button>
|
<button id="exportCareCertificate" class="btn btn-secondary" type="button">Générer l'attestation de soins</button>
|
||||||
<button id="pacemakerBtn" class="btn btn-secondary" type="button">Générer l'attestation retrait de pile</button>
|
<button id="pacemakerBtn" class="btn btn-secondary" type="button">Générer l'attestation retrait de pile</button>
|
||||||
|
<button id="pacemakerAbsentBtn" class="btn btn-secondary" type="button">Générer l'attestation d'Absence de Pacemacker</button>
|
||||||
<button id="rapportSoinBtn" class="btn btn-secondary" type="button">Générer le rapport de soins</button>
|
<button id="rapportSoinBtn" class="btn btn-secondary" type="button">Générer le rapport de soins</button>
|
||||||
<button id="showRapportBijouxExportModal" class="btn btn-secondary" type="button" data-toggle="modal" data-target="#saveRapportBijouxModal">Générer le rapport des bijoux</button>
|
<button id="showRapportBijouxExportModal" class="btn btn-secondary" type="button" data-toggle="modal" data-target="#saveRapportBijouxModal">Générer le rapport des bijoux</button>
|
||||||
</div>
|
</div>
|
||||||
@ -71,13 +76,24 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<input class="gestion-input w-100" type="date" value="<?php echo $_['defunt'][0]->date_naissance ?>" data-table="defunt" data-column="date_naissance" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
<input class="gestion-input w-100" type="date" value="<?php echo $_['defunt'][0]->date_naissance ?>" data-table="defunt" data-column="date_naissance" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Lieu décès -->
|
||||||
|
<div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 8px">
|
||||||
|
<div class="col-3">Lieu de décès</div>
|
||||||
|
<div class="col-9">
|
||||||
|
<input class="gestion-input w-100" type="text" value="<?php echo $_['defunt'][0]->lieu_deces ?>" data-table="defunt" data-column="lieu_deces" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Sexe -->
|
<!-- Sexe -->
|
||||||
<!-- <div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 8px">
|
<!-- <div class="d-flex flex-row align-items-center col-12" style="margin-bottom: 8px">
|
||||||
<div class="col-3">Sexe</div>
|
<div class="col-3">Sexe</div>
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="sexe" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="sexe" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<option value="m" <?php if (strcmp($_['defunt'][0]->sexe, 'm') == 0) echo 'selected' ?>>Masculin</option>
|
<option value="m" <?php if (strcmp($_['defunt'][0]->sexe, 'm') == 0) {
|
||||||
<option value="f" <?php if (strcmp($_['defunt'][0]->sexe, 'f') == 0) echo 'selected' ?>>Féminin</option>
|
echo 'selected';
|
||||||
|
} ?>>Masculin</option>
|
||||||
|
<option value="f" <?php if (strcmp($_['defunt'][0]->sexe, 'f') == 0) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>>Féminin</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
@ -109,11 +125,11 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<input class="w-100 uploadDefuntPacemakerPhoto" accept="image/*" type="file" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
<input class="w-100 uploadDefuntPacemakerPhoto" accept="image/*" type="file" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
||||||
<?php
|
<?php
|
||||||
if ($_['defunt'][0]->product_photo != null) {
|
if ($_['defunt'][0]->product_photo != null) {
|
||||||
?>
|
?>
|
||||||
<label id="pacemakerPhotoLabel" for=""><?php echo ($_['defunt'][0]->product_photo_name ?? "") ?></label>
|
<label id="pacemakerPhotoLabel" for=""><?php echo ($_['defunt'][0]->product_photo_name ?? "") ?></label>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -202,8 +218,12 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="acces_etat" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="acces_etat" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<option>Selectionner un état</option>
|
<option>Selectionner un état</option>
|
||||||
<option value="mauvais" <?php if (strcmp($_['defunt'][0]->acces_etat, 'mauvais') == 0) echo 'selected' ?>>Mauvais</option>
|
<option value="mauvais" <?php if (strcmp($_['defunt'][0]->acces_etat, 'mauvais') == 0) {
|
||||||
<option value="bon" <?php if (strcmp($_['defunt'][0]->acces_etat, 'bon') == 0) echo 'selected' ?>>Bon</option>
|
echo 'selected';
|
||||||
|
} ?>>Mauvais</option>
|
||||||
|
<option value="bon" <?php if (strcmp($_['defunt'][0]->acces_etat, 'bon') == 0) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>>Bon</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -225,7 +245,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="preinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="preinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
||||||
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->preinjection_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option>
|
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->preinjection_qte == $quantiteOptions[$i]) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>><?php echo $quantiteOptions[$i] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -248,8 +270,12 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="injection_diffusion" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="injection_diffusion" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<option>Selectionner un état</option>
|
<option>Selectionner un état</option>
|
||||||
<option value="mauvaise" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'mauvaise') == 0) echo 'selected' ?>>Mauvaise</option>
|
<option value="mauvaise" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'mauvaise') == 0) {
|
||||||
<option value="bonne" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'bonne') == 0) echo 'selected' ?>>Bonne</option>
|
echo 'selected';
|
||||||
|
} ?>>Mauvaise</option>
|
||||||
|
<option value="bonne" <?php if (strcmp($_['defunt'][0]->injection_diffusion, 'bonne') == 0) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>>Bonne</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -259,7 +285,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="injection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="injection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
||||||
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->injection_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option>
|
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->injection_qte == $quantiteOptions[$i]) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>><?php echo $quantiteOptions[$i] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -282,7 +310,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="coinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="coinjection_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
||||||
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->coinjection_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option>
|
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->coinjection_qte == $quantiteOptions[$i]) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>><?php echo $quantiteOptions[$i] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -305,8 +335,12 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="drainage_etat" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="drainage_etat" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<option>Selectionner un état</option>
|
<option>Selectionner un état</option>
|
||||||
<option value="mauvaise" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'mauvaise') == 0) echo 'selected' ?>>Mauvaise</option>
|
<option value="mauvaise" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'mauvaise') == 0) {
|
||||||
<option value="bonne" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'bonne') == 0) echo 'selected' ?>>Bonne</option>
|
echo 'selected';
|
||||||
|
} ?>>Mauvaise</option>
|
||||||
|
<option value="bonne" <?php if (strcmp($_['defunt'][0]->drainage_etat, 'bonne') == 0) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>>Bonne</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -316,7 +350,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="drainage_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="drainage_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
||||||
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->drainage_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option>
|
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->drainage_qte == $quantiteOptions[$i]) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>><?php echo $quantiteOptions[$i] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -339,7 +375,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="ponction_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="ponction_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
||||||
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->ponction_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option>
|
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->ponction_qte == $quantiteOptions[$i]) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>><?php echo $quantiteOptions[$i] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -362,7 +400,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
<select class="gestion-select w-100" data-table="defunt" data-column="cavite_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
<select class="gestion-select w-100" data-table="defunt" data-column="cavite_qte" data-id="<?php echo $_['defunt'][0]->id ?>">
|
||||||
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
<?php for ($i = 0; $i < sizeof($quantiteOptions); $i++) { ?>
|
||||||
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->cavite_qte == $quantiteOptions[$i]) echo 'selected' ?>><?php echo $quantiteOptions[$i] ?></option>
|
<option value="<?php echo $quantiteOptions[$i] ?>" <?php if ($_['defunt'][0]->cavite_qte == $quantiteOptions[$i]) {
|
||||||
|
echo 'selected';
|
||||||
|
} ?>><?php echo $quantiteOptions[$i] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -417,7 +457,9 @@ $coverProducts = $_['coverProducts'];
|
|||||||
<div class="d-flex flex-row col-12 align-items-center" style="margin-bottom: 8px">
|
<div class="d-flex flex-row col-12 align-items-center" style="margin-bottom: 8px">
|
||||||
<div class="col-3">Rasage</div>
|
<div class="col-3">Rasage</div>
|
||||||
<div class="d-flex col-9 justify-content-start align-items-start">
|
<div class="d-flex col-9 justify-content-start align-items-start">
|
||||||
<input class="gestion-checkbox" type="checkbox" <?php if ($_['defunt'][0]->rasage == 1) echo 'checked' ?> data-table="defunt" data-column="rasage" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
<input class="gestion-checkbox" type="checkbox" <?php if ($_['defunt'][0]->rasage == 1) {
|
||||||
|
echo 'checked';
|
||||||
|
} ?> data-table="defunt" data-column="rasage" data-id="<?php echo $_['defunt'][0]->id ?>" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user