-
-
-
-
diff --git a/core/tpl/signature/index.php b/core/tpl/signature/index.php
deleted file mode 100644
index cd6990e..0000000
--- a/core/tpl/signature/index.php
+++ /dev/null
@@ -1,2 +0,0 @@
-
---
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- This program 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 General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see https://www.gnu.org/licenses/.
-
-ALTER TABLE llx_dolisirh_object_signature ADD INDEX idx_dolisirh_object_signature_rowid (rowid);
-ALTER TABLE llx_dolisirh_object_signature ADD INDEX idx_dolisirh_object_signature_status (status);
-ALTER TABLE llx_dolisirh_object_signature ADD INDEX idx_dolisirh_object_signature_element_id (element_id);
-ALTER TABLE llx_dolisirh_object_signature ADD INDEX idx_dolisirh_object_signature_fk_object (fk_object);
diff --git a/sql/signature/llx_dolisirh_object_signature.sql b/sql/signature/llx_dolisirh_object_signature.sql
deleted file mode 100644
index 69f1ccb..0000000
--- a/sql/signature/llx_dolisirh_object_signature.sql
+++ /dev/null
@@ -1,41 +0,0 @@
--- Copyright (C) 2023 EVARISK
---
--- This program is free software: you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation, either version 3 of the License, or
--- (at your option) any later version.
---
--- This program 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 General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program. If not, see https://www.gnu.org/licenses/.
-
-CREATE TABLE llx_dolisirh_object_signature(
- rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
- entity integer DEFAULT 1 NOT NULL,
- date_creation datetime NOT NULL,
- tms timestamp,
- import_key integer DEFAULT NULL,
- status smallint,
- role varchar(255),
- firstname varchar(255),
- lastname varchar(255),
- email varchar(255),
- phone varchar(255),
- society_name varchar(255),
- signature_date datetime DEFAULT NULL,
- signature_location varchar(255),
- signature_comment text DEFAULT NULL,
- element_id integer NOT NULL,
- element_type varchar(255),
- signature longtext,
- stamp text,
- last_email_sent_date datetime DEFAULT NULL,
- signature_url varchar(255),
- transaction_url varchar(255),
- object_type varchar(255),
- fk_object integer NOT NULL
-) ENGINE=innodb;
diff --git a/view/timesheet/timesheet_attendants.php b/view/timesheet/timesheet_attendants.php
deleted file mode 100644
index 72baae5..0000000
--- a/view/timesheet/timesheet_attendants.php
+++ /dev/null
@@ -1,482 +0,0 @@
-
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/**
- * \file view/timesheet/timesheet_attendants.php
- * \ingroup dolisirh
- * \brief Page to add/edit/view timesheet_signature
- */
-
-// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
- $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-}
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
- $i--; $j--;
-}
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
- $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-}
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
- $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-}
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) {
- $res = @include "../main.inc.php";
-}
-if (!$res && file_exists("../../main.inc.php")) {
- $res = @include "../../main.inc.php";
-}
-if (!$res && file_exists("../../../main.inc.php")) {
- $res = @include "../../../main.inc.php";
-}
-if (!$res && file_exists("../../../../main.inc.php")) {
- $res = @include "../../../../main.inc.php";
-}
-if (!$res) {
- die("Include of main fails");
-}
-
-require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
-require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
-
-require_once __DIR__ . '/../../class/timesheet.class.php';
-require_once __DIR__ . '/../../lib/dolisirh_timesheet.lib.php';
-require_once __DIR__ . '/../../lib/dolisirh_function.lib.php';
-
-global $db, $hookmanager, $langs, $user;
-
-// Load translation files required by the page
-$langs->loadLangs(array("dolisirh@dolisirh", "other"));
-
-// Get parameters
-$id = GETPOST('id', 'int');
-$ref = GETPOST('ref', 'alpha');
-$action = GETPOST('action', 'aZ09');
-$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'timesheetsignature'; // To manage different context of search
-$backtopage = GETPOST('backtopage', 'alpha');
-$cancel = GETPOST('cancel', 'aZ09');
-
-// Initialize technical objects
-$object = new TimeSheet($db);
-$signatory = new TimeSheetSignature($db);
-$usertmp = new User($db);
-$contact = new Contact($db);
-$form = new Form($db);
-$project = new Project($db);
-$thirdparty = new Societe($db);
-
-$object->fetch($id);
-
-$hookmanager->initHooks(array($object->element.'signature', 'globalcard')); // Note that conf->hooks_modules contains array
-
-// Load object
-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
-
-//Security check
-$object_type = $object->element;
-$permissiontoread = $user->rights->dolisirh->$object_type->read;
-$permissiontoadd = $user->rights->dolisirh->$object_type->write;
-$permissiontodelete = $user->rights->dolisirh->$object_type->delete;
-
-if ( ! $permissiontoread) accessforbidden();
-
-/*
- * Actions
- */
-
-$parameters = array();
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-
-if (empty($backtopage) || ($cancel && empty($id))) {
- if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
- $backtopage = dol_buildpath('/dolisirh/view/'. $object->element .'/' . $object->element .'_attendants.php', 1) . '?id=' . ($object->id > 0 ? $object->id : '__ID__');
- }
-}
-
-// Action to add internal attendant
-if ($action == 'addSocietyAttendant') {
- $error = 0;
- $object->fetch($id);
- $attendant_id = GETPOST('user_attendant');
-
- if ( ! $error) {
- $role = strtoupper(GETPOST('attendantRole'));
- $result = $signatory->setSignatory($object->id, $object->element, 'user', array($attendant_id), strtoupper($object->element).'_' . $role, $role == 'SOCIETY_RESPONSIBLE ' ? 0 : 1);
- if ($result > 0) {
- $usertmp = $user;
- $usertmp->fetch($attendant_id);
- setEventMessages($langs->trans('AddAttendantMessage') . ' ' . $usertmp->firstname . ' ' . $usertmp->lastname, array());
- $signatory->call_trigger('DOLISIRHSIGNATURE_ADDATTENDANT', $user);
- // Creation attendant OK
- $urltogo = str_replace('__ID__', $result, $backtopage);
- $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
- header("Location: " . $urltogo);
- exit;
- } else {
- // Creation attendant KO
- if ( ! empty($object->errors)) setEventMessages(null, $object->errors, 'errors');
- else setEventMessages($object->error, null, 'errors');
- }
- }
-}
-
-// Action to add record
-if ($action == 'addSignature') {
- $signatoryID = GETPOST('signatoryID');
- $data = json_decode(file_get_contents('php://input'), true);
-
- $signatory->fetch($signatoryID);
- $signatory->signature = $data['signature'];
- $signatory->signature_date = dol_now('tzuser');
-
- if ( ! $error) {
- $result = $signatory->update($user, false);
-
- if ($result > 0) {
- // Creation signature OK
- $signatory->setSigned($user, 0);
- setEventMessages($langs->trans('SignatureEvent') . ' ' . $signatory->firstname . ' ' . $signatory->lastname, array());
- $urltogo = str_replace('__ID__', $result, $backtopage);
- $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
- header("Location: " . $urltogo);
- exit;
- } else {
- // Creation signature KO
- if ( ! empty($signatory->errors)) setEventMessages(null, $signatory->errors, 'errors');
- else setEventMessages($signatory->error, null, 'errors');
- }
- }
-}
-
-// Action to set status STATUS_ABSENT
-if ($action == 'setAbsent') {
- $signatoryID = GETPOST('signatoryID');
-
- $signatory->fetch($signatoryID);
-
- if ( ! $error) {
- $result = $signatory->setAbsent($user, 0);
- if ($result > 0) {
- // set absent OK
- setEventMessages($langs->trans('Attendant') . ' ' . $signatory->firstname . ' ' . $signatory->lastname . ' ' . $langs->trans('SetAbsentAttendant'), array());
- $urltogo = str_replace('__ID__', $result, $backtopage);
- $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $id, $urltogo); // New method to autoselect project after a New on another form object creation
- header("Location: " . $urltogo);
- exit;
- } else {
- // set absent KO
- if ( ! empty($signatory->errors)) setEventMessages(null, $signatory->errors, 'errors');
- else setEventMessages($signatory->error, null, 'errors');
- }
- }
-}
-
-// Action to send Email
-if ($action == 'send') {
- $signatoryID = GETPOST('signatoryID');
- $signatory->fetch($signatoryID);
-
- if ( ! $error) {
- $langs->load('mails');
-
- if (!dol_strlen($signatory->email)) {
- if ($signatory->element_type == 'user') {
- $usertmp = $user;
- $usertmp->fetch($signatory->element_id);
- if (dol_strlen($usertmp->email)) {
- $signatory->email = $usertmp->email;
- $signatory->update($user, true);
- }
- } elseif ($signatory->element_type == 'socpeople') {
- $contact->fetch($signatory->element_id);
- if (dol_strlen($contact->email)) {
- $signatory->email = $contact->email;
- $signatory->update($user, true);
- }
- }
- }
-
- $sendto = $signatory->email;
-
- if (dol_strlen($sendto) && ( ! empty($conf->global->MAIN_MAIL_EMAIL_FROM))) {
- require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
-
- $from = $conf->global->MAIN_MAIL_EMAIL_FROM;
- $url = dol_buildpath('/custom/dolisirh/public/signature/add_signature.php?track_id=' . $signatory->signature_url . '&type=' . $object->element, 3);
-
- $message = $langs->trans('SignatureEmailMessage') . ' ' . $url;
- $subject = $langs->trans('SignatureEmailSubject') . ' ' . $object->ref;
-
- // Create form object
- // Send mail (substitutionarray must be done just before this)
- $mailfile = new CMailFile($subject, $sendto, $from, $message, array(), array(), array(), "", "", 0, -1, '', '', '', '', 'mail');
-
- if ($mailfile->error) {
- setEventMessages($mailfile->error, $mailfile->errors, 'errors');
- } else {
- if ( ! empty($conf->global->MAIN_MAIL_SMTPS_ID)) {
- $result = $mailfile->sendfile();
- if ($result) {
- $signatory->last_email_sent_date = dol_now('tzuser');
- $signatory->update($user, true);
- $signatory->setPending($user, false);
- setEventMessages($langs->trans('SendEmailAt') . ' ' . $signatory->email, array());
- // This avoid sending mail twice if going out and then back to page
- header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
- exit;
- } else {
- $langs->load("other");
- $mesg = '