From 580a5adde8dcdb5f32ad9c8a1d3d16f438f0d17e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Jun 2026 16:03:50 +0200 Subject: [PATCH] Clean code - removed old deprecated module Deplacement --- ChangeLog | 3 +- htdocs/comm/card.php | 6 - htdocs/compta/deplacement/card.php | 517 ------------------ .../deplacement/class/deplacement.class.php | 481 ---------------- .../class/deplacementstats.class.php | 186 ------- htdocs/compta/deplacement/document.php | 150 ----- htdocs/compta/deplacement/index.php | 240 -------- htdocs/compta/deplacement/info.php | 75 --- htdocs/compta/deplacement/list.php | 244 --------- htdocs/compta/deplacement/stats/index.php | 343 ------------ htdocs/core/lib/trip.lib.php | 64 --- htdocs/core/menus/init_menu_auguria.sql | 6 - htdocs/core/menus/standard/eldy.lib.php | 9 - htdocs/core/modules/modDeplacement.class.php | 173 ------ .../core/modules/modExpenseReport.class.php | 3 +- .../doc/doc_generic_project_odt.modules.php | 10 - .../project/doc/pdf_beluga.modules.php | 11 - .../task/doc/doc_generic_task_odt.modules.php | 3 - htdocs/core/search.php | 4 - htdocs/hrm/index.php | 3 - htdocs/projet/element.php | 17 - 21 files changed, 3 insertions(+), 2545 deletions(-) delete mode 100644 htdocs/compta/deplacement/card.php delete mode 100644 htdocs/compta/deplacement/class/deplacement.class.php delete mode 100644 htdocs/compta/deplacement/class/deplacementstats.class.php delete mode 100644 htdocs/compta/deplacement/document.php delete mode 100644 htdocs/compta/deplacement/index.php delete mode 100644 htdocs/compta/deplacement/info.php delete mode 100644 htdocs/compta/deplacement/list.php delete mode 100644 htdocs/compta/deplacement/stats/index.php delete mode 100644 htdocs/core/lib/trip.lib.php delete mode 100644 htdocs/core/modules/modDeplacement.class.php diff --git a/ChangeLog b/ChangeLog index 709c1706201..d8ea24a760a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -202,7 +202,8 @@ The following changes may create regressions for some external modules, but were * The substitution variable __MYCOUNTRY_ID__ has been removed (duplicate of standard __MYCOMPANY_COUNTRY_ID__). * Renamed hook "info_admin" into "messageOfTheDay". * Library jeditable was not used by the core (used by a hidden option with no security rules), so it has been removed. -* Module Paybox has been removed. +* Old deprecated module Paybox has been removed. +* Old deprecated module Deplacement has been removed. ***** ChangeLog for 23.0.3 compared to 23.0.2 ***** diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index c22610350f9..61d52712d5c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1777,12 +1777,6 @@ if ($object->id > 0) { print '
'.$langs->trans("AddIntervention").'
'; } - // Add invoice - if (isModEnabled('deplacement') && $object->status == 1) { - $langs->load("trips"); - print '
'.$langs->trans("AddTrip").'
'; - } - if (isModEnabled('invoice') && $object->status == 1) { if (!$user->hasRight('facture', 'creer')) { $langs->load("bills"); diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php deleted file mode 100644 index 22668734d78..00000000000 --- a/htdocs/compta/deplacement/card.php +++ /dev/null @@ -1,517 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2018-2024 Frédéric France - * Copyright (C) 2024-2025 MDW - * - * 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 htdocs/compta/deplacement/card.php - * \brief Page to show a trip card - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->load("trips"); - - -// Security check -$id = GETPOSTINT('id'); -if ($user->socid) { - $socid = $user->socid; -} - -// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context -$hookmanager->initHooks(array('tripsandexpensescard', 'globalcard')); - -$result = restrictedArea($user, 'deplacement', $id, ''); - -$action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); - -$object = new Deplacement($db); - -$permissionnote = $user->hasRight('deplacement', 'creer'); // Used by the include of actions_setnotes.inc.php - - -/* - * Actions - */ - -include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once - -if ($action == 'validate' && $user->hasRight('deplacement', 'creer')) { - $object->fetch($id); - if ($object->statut == Deplacement::STATUS_DRAFT) { - $result = $object->setStatut(Deplacement::STATUS_REFUNDED, null, '', 'DELIVERY_MODIFY'); - if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } -} elseif ($action == 'classifyrefunded' && $user->hasRight('deplacement', 'creer')) { - $object->fetch($id); - if ($object->statut == Deplacement::STATUS_VALIDATED) { - $result = $object->setStatut(Deplacement::STATUS_REFUNDED, null, '', 'DELIVERY_MODIFY'); - if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } -} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->hasRight('deplacement', 'supprimer')) { - $result = $object->delete($user); - if ($result >= 0) { - header("Location: index.php"); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } -} elseif ($action == 'add' && $user->hasRight('deplacement', 'creer')) { - if (!GETPOST('cancel', 'alpha')) { - $error = 0; - - $object->date = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); - $object->km = (float) price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formatted amount - $object->type = GETPOST('type', 'alpha'); - $object->socid = GETPOSTINT('socid'); - $object->fk_user = GETPOSTINT('fk_user'); - $object->note_private = GETPOST('note_private', 'alpha'); - $object->note_public = GETPOST('note_public', 'alpha'); - $object->statut = Deplacement::STATUS_DRAFT; - - if (!$object->date) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - $error++; - } - if ($object->type == '-1') { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $error++; - } - if (!($object->fk_user > 0)) { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Person")), null, 'errors'); - $error++; - } - - if (!$error) { - $id = $object->create($user); - - if ($id > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create'; - } - } else { - $action = 'create'; - } - } else { - header("Location: index.php"); - exit; - } -} elseif ($action == 'update' && $user->hasRight('deplacement', 'creer')) { - // Update record - if (!GETPOST('cancel', 'alpha')) { - $result = $object->fetch($id); - - $object->date = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); - $object->km = (float) price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formatted amount - $object->type = GETPOST('type', 'alpha'); - $object->socid = GETPOSTINT('socid'); - $object->fk_user = GETPOSTINT('fk_user'); - $object->note_private = GETPOST('note_private', 'alpha'); - $object->note_public = GETPOST('note_public', 'alpha'); - - $result = $object->update($user); - - if ($result > 0) { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - } else { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); - exit; - } -} elseif ($action == 'classin' && $user->hasRight('deplacement', 'creer')) { - // Set into a project - $object->fetch($id); - $result = $object->setProject(GETPOSTINT('projectid')); - if ($result < 0) { - dol_print_error($db, $object->error); - } -} elseif ($action == 'setdated' && $user->hasRight('deplacement', 'creer')) { - // Set fields - $dated = dol_mktime(GETPOSTINT('datedhour'), GETPOSTINT('datedmin'), GETPOSTINT('datedsec'), GETPOSTINT('datedmonth'), GETPOSTINT('datedday'), GETPOSTINT('datedyear')); - $object->fetch($id); - $result = $object->setValueFrom('dated', $dated, '', null, 'date', '', $user, 'DEPLACEMENT_MODIFY'); - if ($result < 0) { - dol_print_error($db, $object->error); - } -} elseif ($action == 'setkm' && $user->hasRight('deplacement', 'creer')) { - $object->fetch($id); - $result = $object->setValueFrom('km', GETPOSTINT('km'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY'); - if ($result < 0) { - dol_print_error($db, $object->error); - } -} - - -/* - * View - */ - -llxHeader(); - -$form = new Form($db); - -/* - * Action create -*/ -if ($action == 'create') { - //WYSIWYG Editor - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - - print load_fiche_titre($langs->trans("NewTrip")); - - $datec = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear')); - - print '
'."\n"; - print ''; - print ''; - - print ''; - - print ""; - print ''; - - print ""; - print ''; - - print ""; - print ''; - - // Km - print ''; - - // Company - print ""; - print ''; - - // Public note - print ''; - print ''; - print ''; - - // Private note - if (empty($user->socid)) { - print ''; - print ''; - print ''; - } - - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print '
'.$langs->trans("Type").''; - $form->select_type_fees((string) GETPOSTINT('type'), 'type', 1); - print '
'.$langs->trans("Person").''; - print $form->select_dolusers(GETPOSTINT('fk_user'), 'fk_user', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth300'); - print '
'.$langs->trans("Date").''; - print $form->selectDate($datec ? $datec : -1, '', 0, 0, 0, 'add', 1, 1); - print '
'.$langs->trans("FeesKilometersOrAmout").'
'.$langs->trans("CompanyVisited").''; - print $form->select_company(GETPOSTINT('socid'), 'socid', '', 1); - print '
'.$langs->trans('NotePublic').''; - - $doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_8, '90%'); - print $doleditor->Create(1); - - print '
'.$langs->trans('NotePrivate').''; - - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_8, '90%'); - print $doleditor->Create(1); - - print '
'; - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; -} elseif ($id) { - $result = $object->fetch($id); - if ($result > 0) { - $head = trip_prepare_head($object); - - print dol_get_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip'); - - if ($action == 'edit' && $user->hasRight('deplacement', 'creer')) { - //WYSIWYG Editor - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - - $soc = new Societe($db); - if ($object->socid) { - $soc->fetch($object->socid); - } - - print '
'."\n"; - print ''; - print ''; - print ''; - - print ''; - - // Ref - print ""; - print ''; - - // Type - print ""; - print ''; - - // Who - print ""; - print ''; - - // Date - print ''; - - // Km - print ''; - - // Where - print ""; - print ''; - - // Public note - print ''; - print '"; - - // Private note - if (empty($user->socid)) { - print ''; - print '"; - } - - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - print '
'.$langs->trans("Ref").''; - print $object->ref; - print '
'.$langs->trans("Type").''; - $form->select_type_fees(GETPOSTINT('type') ? GETPOSTINT('type') : $object->type, 'type', 0); - print '
'.$langs->trans("Person").''; - print $form->select_dolusers(GETPOSTINT('fk_user') ? GETPOSTINT('fk_user') : $object->fk_user, 'fk_user', 0, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth300'); - print '
'.$langs->trans("Date").''; - print $form->selectDate($object->date, '', 0, 0, 0, 'update', 1, 0); - print '
'.$langs->trans("FeesKilometersOrAmout").''; - print ''; - print '
'.$langs->trans("CompanyVisited").''; - print $form->select_company($soc->id, 'socid', '', 1); - print '
'.$langs->trans("NotePublic").''; - - $doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PUBLIC') ? 0 : 1, ROWS_8, '90%'); - print $doleditor->Create(1); - - print "
'.$langs->trans("NotePrivate").''; - - $doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, !getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE') ? 0 : 1, ROWS_8, '90%'); - print $doleditor->Create(1); - - print "
'; - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; - - print ''; - } else { - /* - * Confirm delete trip - */ - if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".urlencode((string) ($id)), $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete"); - } - - $soc = new Societe($db); - if ($object->socid) { - $soc->fetch($object->socid); - } - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - $form->load_cache_types_fees(); - - // Type - print ''; - - // Who - print ''; - - // Date - print ''; - - // Km/Price - print '"; - - // Where - print ''; - print ''; - - // Project - if (isModEnabled('project')) { - $langs->load('projects'); - print ''; - print ''; - print ''; - } - - // Statut - print ''; - - // Other attributes - $parameters = array('socid' => $object->id); - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); - print '
'; - print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $user->hasRight('deplacement', 'creer'), 'select:types_fees'); - print ''; - print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->hasRight('deplacement', 'creer'), 'select:types_fees'); - print '
'.$langs->trans("Person").''; - $userfee = new User($db); - $userfee->fetch($object->fk_user); - print $userfee->getNomUrl(1); - print '
'; - print $form->editfieldkey("Date", 'dated', $object->date, $object, $user->hasRight('deplacement', 'creer'), 'datepicker'); - print ''; - print $form->editfieldval("Date", 'dated', $object->date, $object, $user->hasRight('deplacement', 'creer'), 'datepicker'); - print '
'; - print $form->editfieldkey("FeesKilometersOrAmout", 'km', (string) $object->km, $object, $user->hasRight('deplacement', 'creer'), 'numeric:6'); - print ''; - print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $user->hasRight('deplacement', 'creer'), 'numeric:6'); - print "
'.$langs->trans("CompanyVisited").''; - if ($soc->id) { - print $soc->getNomUrl(1); - } - print '
'; - - print ''; - if ($action != 'classify' && $user->hasRight('deplacement', 'creer')) { - print ''; - } - print '
'; - print $langs->trans('Project'); - print 'id.'">'; - print img_edit($langs->trans('SetProject'), 1); - print '
'; - print '
'; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'projectid', 0, 0, 1); - } else { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, 'none', 0, 0); - } - print '
'.$langs->trans("Status").''.$object->getLibStatut(4).'

"; - - // Notes - $blocname = 'notes'; - $title = $langs->trans('Notes'); - include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php'; - - print ''; - - /* - * Action bar - */ - print '
'; - - if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded - if ($user->hasRight('deplacement', 'creer')) { - print ''.$langs->trans('Modify').''; - } else { - print ''.$langs->trans('Modify').''; - } - } - - if ($object->statut == Deplacement::STATUS_DRAFT) { // if draft - if ($user->hasRight('deplacement', 'creer')) { - print ''.$langs->trans('Validate').''; - } else { - print ''.$langs->trans('Validate').''; - } - } - - if ($object->statut == Deplacement::STATUS_VALIDATED) { // if validated - if ($user->hasRight('deplacement', 'creer')) { - print ''.$langs->trans('ClassifyRefunded').''; - } else { - print ''.$langs->trans('ClassifyRefunded').''; - } - } - - $permissiontodelete = $user->hasRight('deplacement', 'supprimer'); - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); - - print '
'; - } - } else { - dol_print_error($db); - } -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php deleted file mode 100644 index d46aac2b6af..00000000000 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ /dev/null @@ -1,481 +0,0 @@ - - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2013 Florian Henry - * Copyright (C) 2019-2025 Frédéric France - * Copyright (C) 2024-2025 MDW - * - * 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 htdocs/compta/deplacement/class/deplacement.class.php - * \ingroup deplacement - * \brief File of class to manage trips - */ - -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; - -/** - * Class to manage trips and working credit notes - */ -class Deplacement extends CommonObject -{ - /** - * @var string ID to identify managed object - */ - public $element = 'deplacement'; - - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'deplacement'; - - /** - * @var string Name of subtable line - */ - public $table_element_line = ''; - - /** - * @var string Fieldname with ID of parent key if this field has a parent - */ - public $fk_element = ''; - - /** - * @var int - */ - public $fk_soc; - /** - * @var int|string - */ - public $date; - /** - * @var string - */ - public $type; - - /** - * Date creation record (datec) - * - * @var integer - */ - public $datec; - - /** - * Date (dated) - * - * @var integer - */ - public $dated; - - /** - * @var int ID - */ - public $fk_user_author; - - /** - * @var int User ID - */ - public $fk_user; - - /** - * @var float km value formatted - */ - public $km; - - /** - * @var int Thirdparty id - */ - public $socid; - - /** - * @var int Status 0=draft, 1=validated, 2=Refunded - */ - public $statut; - /** - * @var array (Encoded as JSON in database) - */ - public $extraparams = array(); - - - /** - * Draft status - */ - const STATUS_DRAFT = 0; - - /** - * Validated status - */ - const STATUS_VALIDATED = 1; - - /** - * Refunded status - */ - const STATUS_REFUNDED = 2; - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct(DoliDB $db) - { - $this->db = $db; - - $this->ismultientitymanaged = 0; - } - - /** - * Create object in database - * TODO Add ref number - * - * @param User $user User that creates - * @return int Return integer <0 if KO, >0 if OK - */ - public function create($user) - { - global $conf; - - // Check parameters - if (empty($this->type) || $this->type < 0) { - $this->error = 'ErrorBadParameter'; - return -1; - } - if (empty($this->fk_user) || $this->fk_user < 0) { - $this->error = 'ErrorBadParameter'; - return -1; - } - - $now = dol_now(); - - $this->db->begin(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."deplacement ("; - $sql .= "datec"; - //$sql.= ", dated"; - $sql .= ", entity"; - $sql .= ", fk_user_author"; - $sql .= ", fk_user"; - $sql .= ", type"; - $sql .= ", note_private"; - $sql .= ", note_public"; - $sql .= ", fk_projet"; - $sql .= ", fk_soc"; - $sql .= ") VALUES ("; - $sql .= " '".$this->db->idate($now)."'"; - $sql .= ", ".((int) $conf->entity); - $sql .= ", ".((int) $user->id); - $sql .= ", ".((int) $this->fk_user); - $sql .= ", '".$this->db->escape($this->type)."'"; - $sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); - $sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); - $sql .= ", ".($this->fk_project > 0 ? ((int) $this->fk_project) : 0); - $sql .= ", ".($this->fk_soc > 0 ? ((int) $this->fk_soc) : "null"); - $sql .= ")"; - - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."deplacement"); - - // Call trigger - $result = $this->call_trigger('DEPLACEMENT_CREATE', $user); - if ($result < 0) { - $this->db->rollback(); - return -2; - } - // End call triggers - - $result = $this->update($user); - if ($result > 0) { - $this->db->commit(); - return $this->id; - } else { - $this->error = $this->db->error(); - $this->db->rollback(); - return $result; - } - } else { - $this->error = $this->db->error()." sql=".$sql; - $this->db->rollback(); - return -1; - } - } - - /** - * Update record - * - * @param User $user User making update - * @return int Return integer <0 if KO, >0 if OK - */ - public function update($user) - { - // Clean parameters - $this->km = (float) price2num($this->km); - - // Check parameters - if (!is_numeric($this->km)) { - $this->km = 0; - } - if (empty($this->date)) { - $this->error = 'ErrorBadParameter'; - return -1; - } - if (empty($this->type) || $this->type < 0) { - $this->error = 'ErrorBadParameter'; - return -1; - } - if (empty($this->fk_user) || $this->fk_user < 0) { - $this->error = 'ErrorBadParameter'; - return -1; - } - - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."deplacement "; - $sql .= " SET km = ".((float) $this->km); // This is a distance or amount - $sql .= " , dated = '".$this->db->idate($this->date)."'"; - $sql .= " , type = '".$this->db->escape($this->type)."'"; - $sql .= " , fk_statut = '".$this->db->escape((string) $this->statut)."'"; - $sql .= " , fk_user = ".((int) $this->fk_user); - $sql .= " , fk_user_modif = ".((int) $user->id); - $sql .= " , fk_soc = ".($this->socid > 0 ? $this->socid : 'null'); - $sql .= " , note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null"); - $sql .= " , note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null"); - $sql .= " , fk_projet = ".($this->fk_project > 0 ? $this->fk_project : 0); - $sql .= " WHERE rowid = ".((int) $this->id); - - dol_syslog(get_class($this)."::update", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->lasterror(); - $this->db->rollback(); - return -1; - } - } - - /** - * Load an object from database - * - * @param int $id Id of record to load - * @param string $ref Ref of record - * @return int Return integer <0 if KO, >0 if OK - */ - public function fetch($id, $ref = '') - { - $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet as fk_project, extraparams"; - $sql .= " FROM ".MAIN_DB_PREFIX."deplacement"; - $sql .= " WHERE entity IN (".getEntity('deplacement').")"; - if ($ref) { - $sql .= " AND ref ='".$this->db->escape($ref)."'"; - } else { - $sql .= " AND rowid = ".((int) $id); - } - - dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $obj = $this->db->fetch_object($result); - - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->date = $this->db->jdate($obj->dated); - $this->fk_user = $obj->fk_user; - $this->socid = $obj->fk_soc; - $this->km = $obj->km; - $this->type = $obj->type; - $this->statut = $obj->fk_statut; - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->fk_project = $obj->fk_project; - - $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); - - return 1; - } else { - $this->error = $this->db->error(); - return -1; - } - } - - /** - * Delete record - * - * @param User $user USer that Delete - * @return int Return integer <0 if KO, >0 if OK - */ - public function delete($user) - { - $this->db->begin(); - - $id = $this->id; - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."deplacement WHERE rowid = ".((int) $id); - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $this->db->commit(); - return 1; - } else { - $this->error = $this->db->error(); - $this->db->rollback(); - return -1; - } - } - - - /** - * Return the label of the status - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function getLibStatut($mode = 0) - { - return $this->LibStatut($this->statut, $mode); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return the label of a given status - * - * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label of status - */ - public function LibStatut($status, $mode = 0) - { - // phpcs:enable - global $langs; - - if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - global $langs; - //$langs->load("mymodule@mymodule"); - $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->labelStatus[self::STATUS_REFUNDED] = $langs->transnoentitiesnoconv('Refunded'); - $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft'); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated'); - $this->labelStatusShort[self::STATUS_REFUNDED] = $langs->transnoentitiesnoconv('Refunded'); - } - - $status_logo = array(0 => 'status0', 1 => 'status4', 2 => 'status1', 4 => 'status6', 5 => 'status4', 6 => 'status6', 99 => 'status5'); - $statusType = $status_logo[$status]; - - return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); - } - - /** - * Return clickable name (with picto eventually) - * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @return string String with URL - */ - public function getNomUrl($withpicto = 0) - { - global $langs; - - $result = ''; - $label = $langs->trans("Show").': '.$this->ref; - - $link = ''; - $linkend = ''; - - $picto = 'trip'; - - - if ($withpicto) { - $result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); - } - if ($withpicto && $withpicto != 2) { - $result .= ' '; - } - if ($withpicto != 2) { - $result .= $link.$this->ref.$linkend; - } - return $result; - } - - - /** - * List of types - * - * @param int $active Active or not - * @return array - */ - public function listOfTypes($active = 1) - { - global $langs; - - $ret = array(); - - $sql = "SELECT id, code, label"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees"; - $sql .= " WHERE active = ".((int) $active); - - dol_syslog(get_class($this)."::listOfTypes", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { - $num = $this->db->num_rows($result); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($result); - $ret[$obj->code] = (($langs->trans($obj->code) != $obj->code) ? $langs->trans($obj->code) : $obj->label); - $i++; - } - } else { - dol_print_error($this->db); - } - - return $ret; - } - - /** - * Information on record - * - * @param int $id Id of record - * @return void - */ - public function info($id) - { - $sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,'; - $sql .= ' c.tms as datem'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'deplacement as c'; - $sql .= ' WHERE c.rowid = '.((int) $id); - - dol_syslog(get_class($this).'::info', LOG_DEBUG); - $result = $this->db->query($sql); - - if ($result) { - if ($this->db->num_rows($result)) { - $obj = $this->db->fetch_object($result); - - $this->id = $obj->rowid; - - $this->user_creation_id = $obj->fk_user_author; - $this->user_modification_id = $obj->fk_user_modif; - $this->date_creation = $this->db->jdate($obj->datec); - $this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem); - } - $this->db->free($result); - } else { - dol_print_error($this->db); - } - } -} diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php deleted file mode 100644 index 0f366002baf..00000000000 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ /dev/null @@ -1,186 +0,0 @@ - - * Copyright (c) 2005-2008 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2024-2026 MDW - * - * 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 htdocs/compta/deplacement/class/deplacementstats.class.php - * \ingroup invoices - * \brief File for class managaging the statistics of travel and expense notes - */ -include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php'; -include_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; - -/** - * Class to manage the statistics of travel and expense notes - */ -class DeplacementStats extends Stats -{ - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element; - - /** - * @var int - */ - public $socid; - /** - * @var int - */ - public $userid; - - /** - * @var string - */ - public $from; - /** - * @var string - */ - public $field; - /** - * @var string - */ - public $where; - - /** - * Constructor - * - * @param DoliDB $db Database handler - * @param int $socid Id third party - * @param int|int[] $userid Id user for filter or array of user ids - * @return void - */ - public function __construct($db, $socid = 0, $userid = 0) - { - global $conf; - - $this->db = $db; - $this->socid = $socid; - $this->userid = $userid; - - $object = new Deplacement($this->db); - $this->from = MAIN_DB_PREFIX.$object->table_element; - $this->field = 'km'; - - $this->where = " fk_statut > 0"; - $this->where .= " AND entity = ".$conf->entity; - if ($this->socid > 0) { - $this->where .= " AND fk_soc = ".((int) $this->socid); - } - if (is_array($this->userid) && count($this->userid) > 0) { - $this->where .= ' AND fk_user IN ('.$this->db->sanitize(implode(',', $this->userid)).')'; - } elseif ($this->userid > 0) { - $this->where .= ' AND fk_user = '.((int) $this->userid); - } - } - - - /** - * Return the number of invoices per year - * - * @return array Array of nb each year - */ - public function getNbByYear() - { - $sql = "SELECT YEAR(dated) as dm, count(*)"; - $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); - $sql .= " GROUP BY dm DESC"; - $sql .= " WHERE ".$this->where; - - return $this->_getNbByYear($sql); - } - - - /** - * Return the number of invoices for the given year - * - * @param int $year Year to scan - * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array,array{0:int<1,12>,1:int}> Array with number by month - */ - public function getNbByMonth($year, $format = 0) - { - $sql = "SELECT MONTH(dated) as dm, count(*)"; - $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); - $sql .= " WHERE YEAR(dated) = ".((int) $year); - $sql .= " AND ".$this->where; - $sql .= " GROUP BY dm"; - $sql .= $this->db->order('dm', 'DESC'); - - $res = $this->_getNbByMonth($year, $sql, $format); - //var_dump($res);print '
'; - return $res; - } - - - /** - * Renvoie le montant de facture par mois pour une annee donnee - * - * @param int $year Year to scan - * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month - * @return array,array{0:int<1,12>,1:int|float}> Array of values - */ - public function getAmountByMonth($year, $format = 0) - { - $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->db->sanitize($this->field).")"; - $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); - $sql .= " WHERE date_format(dated,'%Y') = '".$this->db->escape((string) $year)."'"; - $sql .= " AND ".$this->where; - $sql .= " GROUP BY dm"; - $sql .= $this->db->order('dm', 'DESC'); - - $res = $this->_getAmountByMonth($year, $sql, $format); - //var_dump($res);print '
'; - return $res; - } - - /** - * Return average amount - * - * @param int $year Year to scan - * @return array,array{0:int<1,12>,1:int|float}> Array with number by month - */ - public function getAverageByMonth($year) - { - $sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->db->sanitize($this->field).")"; - $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); - $sql .= " WHERE date_format(dated,'%Y') = '".$this->db->escape((string) $year)."'"; - $sql .= " AND ".$this->where; - $sql .= " GROUP BY dm"; - $sql .= $this->db->order('dm', 'DESC'); - - return $this->_getAverageByMonth($year, $sql); - } - - /** - * Return nb, total and average - * - * @return array Array of values - */ - public function getAllByYear() - { - $sql = "SELECT date_format(dated,'%Y') as year, count(*) as nb, sum(".$this->db->sanitize($this->field).") as total, avg(".$this->db->sanitize($this->field).") as avg"; - $sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1); - $sql .= " WHERE ".$this->where; - $sql .= " GROUP BY year"; - $sql .= $this->db->order('year', 'DESC'); - - return $this->_getAllByYear($sql); - } -} diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php deleted file mode 100644 index 55b339b66c5..00000000000 --- a/htdocs/compta/deplacement/document.php +++ /dev/null @@ -1,150 +0,0 @@ - - * Copyright (C) 2004-2010 Laurent Destailleur - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2011-2012 Juanjo Menent - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2024 Frédéric France - * - * 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 htdocs/compta/deplacement/document.php - * \ingroup deplacement - * \brief Page of linked files onto trip and expenses - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->loadLangs(array('other', 'trips', 'companies', 'interventions')); - -$id = GETPOSTINT('id'); -$ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); - - -// Get parameters -$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (!$sortorder) { - $sortorder = "ASC"; -} -if (!$sortfield) { - $sortfield = "name"; -} - - -$object = new Deplacement($db); -$object->fetch($id, $ref); - -$upload_dir = $conf->deplacement->dir_output.'/'.dol_sanitizeFileName($object->ref); -$modulepart = 'trip'; - -// Security check -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'deplacement', $id, ''); - -$permissiontoadd = $user->hasRight('deplacement', 'creer'); // Used by the include of actions_dellink.inc.php - - -/* - * Actions - */ - -include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; - - -/* - * View - */ - -$form = new Form($db); - -llxHeader("", "", $langs->trans("TripCard")); - - -if ($object->id) { - $object->fetch_thirdparty(); - - $head = trip_prepare_head($object); - - print dol_get_fiche_head($head, 'documents', $langs->trans("TripCard"), 0, 'trip'); - - - // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); - $totalsize = 0; - foreach ($filearray as $key => $file) { - $totalsize += $file['size']; - } - - - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - // Societe - //print ""; - - print ''; - print ''; - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); - print '
".$langs->trans("Company")."".$object->client->getNomUrl(1)."
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; - - print ''; - - $modulepart = 'deplacement'; - $permissiontoadd = $user->hasRight('deplacement', 'creer'); - $param = '&id='.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} else { - print $langs->trans("ErrorUnknown"); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php deleted file mode 100644 index e3de80cfdb0..00000000000 --- a/htdocs/compta/deplacement/index.php +++ /dev/null @@ -1,240 +0,0 @@ - - * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2024 Frédéric France - * - * 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 htdocs/compta/deplacement/index.php - * \brief Page list of expenses - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->loadLangs(array('companies', 'users', 'trips')); - -// Security check -$socid = GETPOSTINT('socid'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'deplacement', '', ''); - -$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -if (empty($page) || $page == -1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (!$sortorder) { - $sortorder = "DESC"; -} -if (!$sortfield) { - $sortfield = "d.dated"; -} -$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; - - -/* - * View - */ - -$tripandexpense_static = new Deplacement($db); - -$childids = $user->getAllChildIds(); -$childids[] = $user->id; - -//$help_url='EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'; -$help_url = ''; -llxHeader('', $langs->trans("TripsAndExpenses"), $help_url); - - - -$totalnb = 0; -$sql = "SELECT count(d.rowid) as nb, sum(d.km) as km, d.type"; -$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d"; -$sql .= " WHERE d.entity = ".$conf->entity; -if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) { - $sql .= ' AND d.fk_user IN ('.$db->sanitize(implode(',', $childids)).')'; -} -$sql .= " GROUP BY d.type"; -$sql .= " ORDER BY d.type"; - -$result = $db->query($sql); -$somme = array(); -$nb = array(); -if ($result) { - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) { - $objp = $db->fetch_object($result); - - $somme[$objp->type] = $objp->km; - $nb[$objp->type] = $objp->nb; - $totalnb += $objp->nb; - $i++; - } - $db->free($result); -} else { - dol_print_error($db); -} - - -print load_fiche_titre($langs->trans("ExpensesArea")); - - -print '
'; - - -// Statistics -print ''; -print ''; -print ''; -print "\n"; - -$listoftype = $tripandexpense_static->listOfTypes(); -$dataseries = array(); -foreach ($listoftype as $code => $label) { - $dataseries[] = array($label, (isset($nb[$code]) ? (int) $nb[$code] : 0)); -} - -if ($conf->use_javascript_ajax) { - print ''; -} - -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans("Statistics").'
'; - - include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; - $dolgraph = new DolGraph(); - $dolgraph->SetData($dataseries); - $dolgraph->setShowLegend(2); - $dolgraph->setShowPercent(1); - $dolgraph->SetType(array('pie')); - $dolgraph->setHeight('200'); - $dolgraph->draw('idgraphstatus'); - print $dolgraph->show($totalnb ? 0 : 1); - - print '
'.$langs->trans("Total").''.$totalnb.'
'; - - - -print '
'; - - -$max = 10; - -$langs->load("boxes"); - -$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut"; -$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; -$sql .= " WHERE u.rowid = d.fk_user"; -$sql .= " AND d.entity = ".$conf->entity; -if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) { - $sql .= ' AND d.fk_user IN ('.$db->sanitize(implode(',', $childids)).')'; -} -// If the internal user must only see his customers, force searching by him -$search_sale = 0; -if (!$user->hasRight('societe', 'client', 'voir')) { - $search_sale = $user->id; -} -// Search on sale representative -if ($search_sale && $search_sale != '-1') { - if ($search_sale == -2) { - $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = d.fk_soc)"; - } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = d.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; - } -} -// Search on socid -if ($socid) { - $sql .= " AND d.fk_soc = ".((int) $socid); -} -$sql .= $db->order("d.tms", "DESC"); -$sql .= $db->plimit($max, 0); - -$result = $db->query($sql); -if ($result) { - $var = false; - $num = $db->num_rows($result); - - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($num) { - $total_ttc = $totalam = $total = 0; - - $deplacementstatic = new Deplacement($db); - $userstatic = new User($db); - while ($i < $num && $i < $max) { - $obj = $db->fetch_object($result); - $deplacementstatic->ref = $obj->rowid; - $deplacementstatic->id = $obj->rowid; - $userstatic->id = $obj->uid; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i++; - } - } else { - print ''; - } - print '
'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm), 'day').''.$deplacementstatic->LibStatut($obj->fk_statut, 3).'
'.$langs->trans("None").'

'; -} else { - dol_print_error($db); -} - - -print '
'; - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/deplacement/info.php b/htdocs/compta/deplacement/info.php deleted file mode 100644 index 02b597c8cb3..00000000000 --- a/htdocs/compta/deplacement/info.php +++ /dev/null @@ -1,75 +0,0 @@ - - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2024 Frédéric France - * - * 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 htdocs/compta/deplacement/info.php - * \ingroup trip - * \brief Page to show a trip information - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/trip.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->load("trips"); - -// Security check -$id = GETPOSTINT('id'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'deplacement', $id, ''); - - -/* - * View - */ - -llxHeader(); - -if ($id) { - $object = new Deplacement($db); - $object->fetch($id); - $object->info($id); - - $head = trip_prepare_head($object); - - print dol_get_fiche_head($head, 'info', $langs->trans("TripCard"), 0, 'trip'); - - print '
'; - dol_print_object_info($object); - print '
'; - - print ''; -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php deleted file mode 100644 index 7865114cd54..00000000000 --- a/htdocs/compta/deplacement/list.php +++ /dev/null @@ -1,244 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2018 charlene Benke - * Copyright (C) 2024 Frédéric France - * - * 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 htdocs/compta/deplacement/list.php - * \brief Page to list trips and expenses - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var Form $form - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->loadLangs(array('companies', 'users', 'trips')); - -// Security check -$socid = GETPOSTINT('socid'); -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'deplacement', '', ''); - -$search_ref = GETPOST('search_ref', 'alpha'); -$search_name = GETPOST('search_name', 'alpha'); -$search_company = GETPOST('search_company', 'alpha'); -// $search_amount=GETPOST('search_amount','alpha'); -$sortfield = GETPOST('sortfield', 'aZ09comma'); -$sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); -$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; -if (empty($page) || $page == -1) { - $page = 0; -} // If $page is not defined, or '' or -1 -$offset = $limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; -if (!$sortorder) { - $sortorder = "DESC"; -} -if (!$sortfield) { - $sortfield = "d.dated"; -} - -$year = GETPOST("year"); -$month = GETPOST("month"); -$day = GETPOST("day"); - -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // Both test are required to be compatible with all browsers - $search_ref = ""; - $search_name = ""; - $search_company = ""; - // $search_amount=""; - $year = ""; - $month = ""; - $day = ""; -} - -/* - * View - */ - -$formother = new FormOther($db); -$tripandexpense_static = new Deplacement($db); -$userstatic = new User($db); - -$childids = $user->getAllChildIds(); -$childids[] = $user->id; - -llxHeader(); - -$sql = "SELECT s.nom, d.fk_user, s.rowid as socid,"; // Ou -$sql .= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment -$sql .= " d.fk_statut,"; -$sql .= " u.lastname, u.firstname"; // Qui -$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; -$sql .= ", ".MAIN_DB_PREFIX."deplacement as d"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid"; -$sql .= " WHERE d.fk_user = u.rowid"; -$sql .= " AND d.entity = ".$conf->entity; -if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) { - $sql .= ' AND d.fk_user IN ('.$db->sanitize(implode(',', $childids)).')'; -} -// If the internal user must only see his customers, force searching by him -$search_sale = 0; -if (!$user->hasRight('societe', 'client', 'voir')) { - $search_sale = $user->id; -} -// Search on sale representative -if ($search_sale && $search_sale != '-1') { - if ($search_sale == -2) { - $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = d.fk_soc)"; - } elseif ($search_sale > 0) { - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = d.fk_soc AND sc.fk_user = ".((int) $search_sale).")"; - } -} -// Search on socid -if ($socid) { - $sql .= " AND d.fk_soc = ".((int) $socid); -} - -if ($search_ref) { - $sql .= " AND d.rowid = ".((int) $search_ref); -} -if ($search_name) { - $sql .= natural_search('u.lastname', $search_name); -} -if ($search_company) { - $sql .= natural_search('s.nom', $search_company); -} -$sql .= dolSqlDateFilter("d.dated", $day, $month, $year); - -$sql .= $db->order($sortfield, $sortorder); -$sql .= $db->plimit($limit + 1, $offset); - -//print $sql; -$resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); - - print_barre_liste($langs->trans("TripsAndExpenses"), $page, $_SERVER["PHP_SELF"], "&socid=$socid", $sortfield, $sortorder, '', $num); - - $i = 0; - print '
'."\n"; - print ''; - print ""; - print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", "&socid=$socid", '', $sortfield, $sortorder); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "d.type", "", "&socid=$socid", '', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.dated", "", "&socid=$socid", 'align="center"', $sortfield, $sortorder); - print_liste_field_titre("Person", $_SERVER["PHP_SELF"], "u.lastname", "", "&socid=$socid", '', $sortfield, $sortorder); - print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=$socid", '', $sortfield, $sortorder); - print_liste_field_titre("FeesKilometersOrAmout", $_SERVER["PHP_SELF"], "d.km", "", "&socid=$socid", 'class="right"', $sortfield, $sortorder); - print_liste_field_titre(''); - print "\n"; - - // Filters lines - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - while ($i < min($num, $limit)) { - $obj = $db->fetch_object($resql); - - $soc = new Societe($db); - if ($obj->socid) { - $soc->fetch($obj->socid); - } - - print ''; - // Id - print ''; - // Type - print ''; - // Date - print ''; - // User - print ''; - - if ($obj->socid) { - print ''; - } else { - print ''; - } - - print ''; - - $tripandexpense_static->statut = $obj->fk_statut; - print ''; - print "\n"; - - $i++; - } - - print "
'; - print ''; - print ''; - print ' '; - print ''; - if (getDolGlobalString('MAIN_LIST_FILTER_ON_DAY')) { - print ''; - } - print ''; - print $formother->selectyear($year ? $year : -1, 'year', 1, 20, 5); - print ''; - print ''; - print ''; - print ''; - print ''; - // print ''; - print ''; - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; - print '
'.img_object($langs->trans("ShowTrip"), "trip").' '.$obj->rowid.''.$langs->trans($obj->type).''.dol_print_date($db->jdate($obj->dd), 'day').''; - $userstatic->id = $obj->fk_user; - $userstatic->lastname = $obj->lastname; - $userstatic->firstname = $obj->firstname; - print $userstatic->getNomUrl(1); - print ''.$soc->getNomUrl(1).' '.$obj->km.''.$tripandexpense_static->getLibStatut(5).'
"; - print "
\n"; - $db->free($resql); -} else { - dol_print_error($db); -} - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php deleted file mode 100644 index 4780f7943bd..00000000000 --- a/htdocs/compta/deplacement/stats/index.php +++ /dev/null @@ -1,343 +0,0 @@ - - * Copyright (c) 2004-2012 Laurent Destailleur - * Copyright (C) 2012 Marcos García - * Copyright (C) 2024-2025 MDW - * Copyright (C) 2024-2025 Frédéric France - * - * 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 htdocs/compta/deplacement/stats/index.php - * \ingroup deplacement - * \brief Page for statistics of module trips and expenses - */ - -// Load Dolibarr environment -require '../../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacementstats.class.php'; - -/** - * @var Conf $conf - * @var DoliDB $db - * @var HookManager $hookmanager - * @var Translate $langs - * @var User $user - */ - -// Load translation files required by the page -$langs->loadLangs(array('trips', 'companies')); - -$WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); -$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); - -$userid = GETPOSTINT('userid'); -if ($userid < 0) { - $userid = 0; -} -$socid = GETPOSTINT('socid'); -if ($socid < 0) { - $socid = 0; -} -$id = GETPOSTINT('id'); - -// Security check -if ($user->socid > 0) { - $action = ''; - $socid = $user->socid; -} -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'deplacement', $id, ''); - -// Other security check -$childids = $user->getAllChildIds(1); -if ($userid > 0) { - if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous') && !in_array($userid, $childids)) { - accessforbidden(); - } -} - -$nowyear = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt'); -$year = GETPOSTINT('year') > 0 ? GETPOSTINT('year') : $nowyear; -$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS')))); -$endyear = $year; - -$mode = GETPOST("mode") ? GETPOST("mode") : 'customer'; - - -/* - * View - */ - -$form = new Form($db); - - -llxHeader(); - -$title = $langs->trans("TripsAndExpensesStatistics"); -$dir = $conf->deplacement->dir_temp; - -print load_fiche_titre($title); - -dol_mkdir($dir); - -$useridtofilter = $userid; // Filter from parameters -if (empty($useridtofilter)) { - $useridtofilter = $childids; - if ($user->hasRight('deplacement', 'readall') || $user->hasRight('deplacement', 'lire_tous')) { - $useridtofilter = 0; - } -} - -$stats = new DeplacementStats($db, $socid, $useridtofilter); - - -// Build graphic number of object -// $data = array(array('Lib',val1,val2,val3),...) -//print "$endyear, $startyear"; -$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); -//var_dump($data); - -$filenamenb = $dir."/tripsexpensesnbinyear-".$year.".png"; -$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesnbinyear-'.$year.'.png'; - -$px1 = new DolGraph(); -$mesg = $px1->isGraphKo(); -if (!$mesg) { - $px1->SetData($data); - $i = $startyear; - $legend = array(); - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px1->SetLegend($legend); - $px1->SetMaxValue($px1->GetCeilMaxValue()); - $px1->SetWidth($WIDTH); - $px1->SetHeight($HEIGHT); - $px1->SetYLabel($langs->trans("Number")); - $px1->SetShading(3); - $px1->SetHorizTickIncrement(1); - $px1->mode = 'depth'; - $px1->SetTitle($langs->trans("NumberByMonth")); - - $px1->draw($filenamenb, $fileurlnb); -} - -// Build graphic amount of object -$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear); -//var_dump($data); -// $data = array(array('Lib',val1,val2,val3),...) - -$filenameamount = $dir."/tripsexpensesamountinyear-".$year.".png"; -$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=tripsexpensesstats&file=tripsexpensesamountinyear-'.$year.'.png'; - -$px2 = new DolGraph(); -$mesg = $px2->isGraphKo(); -if (!$mesg) { - $px2->SetData($data); - $i = $startyear; - $legend = array(); - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px2->SetLegend($legend); - $px2->SetMaxValue($px2->GetCeilMaxValue()); - $px2->SetMinValue(min(0, $px2->GetFloorMinValue())); - $px2->SetWidth($WIDTH); - $px2->SetHeight($HEIGHT); - $px2->SetYLabel($langs->trans("Amount")); - $px2->SetShading(3); - $px2->SetHorizTickIncrement(1); - $px2->mode = 'depth'; - $px2->SetTitle($langs->trans("AmountTotal")); - - $px2->draw($filenameamount, $fileurlamount); -} - - -$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear); - -$filename_avg = ''; -$fileurl_avg = ''; -if (!$user->hasRight('societe', 'client', 'voir')) { - $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; - if ($mode == 'customer') { - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; - } - if ($mode == 'supplier') { - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; - } -} else { - $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; - if ($mode == 'customer') { - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; - } - if ($mode == 'supplier') { - $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; - } -} - -$px3 = new DolGraph(); -$mesg = $px3->isGraphKo(); -if (!$mesg) { - $px3->SetData($data); - $i = $startyear; - $legend = array(); - while ($i <= $endyear) { - $legend[] = $i; - $i++; - } - $px3->SetLegend($legend); - $px3->SetYLabel($langs->trans("AmountAverage")); - $px3->SetMaxValue($px3->GetCeilMaxValue()); - $px3->SetMinValue((int) $px3->GetFloorMinValue()); - $px3->SetWidth($WIDTH); - $px3->SetHeight($HEIGHT); - $px3->SetShading(3); - $px3->SetHorizTickIncrement(1); - $px3->mode = 'depth'; - $px3->SetTitle($langs->trans("AmountAverage")); - - $px3->draw($filename_avg, $fileurl_avg); -} - - -// Show array -$data = $stats->getAllByYear(); -$arrayyears = array(); -foreach ($data as $val) { - $arrayyears[$val['year']] = $val['year']; -} -if (!count($arrayyears)) { - $arrayyears[$nowyear] = $nowyear; -} - - -$h = 0; -$head = array(); -$head[$h][0] = DOL_URL_ROOT.'/compta/deplacement/stats/index.php'; -$head[$h][1] = $langs->trans("ByMonthYear"); -$head[$h][2] = 'byyear'; -$h++; - -complete_head_from_modules($conf, $langs, null, $head, $h, 'trip_stats'); - -print dol_get_fiche_head($head, 'byyear', '', -1); - - -print '
'; - - -// Show filter box -print '
'; -print ''; -print ''; - -print ''; -print ''; -// Company -print ''; -// User -print ''; -// Year -print ''; -print ''; -print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; -print img_picto('', 'company', 'class="pictofixedwidth"'); -print $form->select_company($socid, 'socid', '', 1, 1, 0, array(), 0, 'widthcentpercentminusx maxwidth300', ''); -print '
'.$langs->trans("User").''; -$include = ''; -if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) { - $include = 'hierarchy'; -} -print img_picto('', 'user', 'class="pictofixedwidth"'); -print $form->select_dolusers($userid, 'userid', 1, null, 0, $include, '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300'); -print '
'.$langs->trans("Year").''; -if (!in_array($year, $arrayyears)) { - $arrayyears[$year] = $year; -} -arsort($arrayyears); -print img_picto('', 'calendar', 'class="pictofixedwidth"'); -print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75'); -print '
'; -print '
'; -print '

'; - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - -$oldyear = 0; -foreach ($data as $val) { - $year = $val['year']; - while ($year && $oldyear > (int) $year + 1) { // If we have empty year - $oldyear--; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - } - - // Total - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $oldyear = $year; -} - -print '
'.$langs->trans("Year").''.$langs->trans("Number").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
'.$oldyear.'000
'.$year.''.$val['nb'].''.price(price2num($val['total'], 'MT'), 1).''.price(price2num($val['avg'], 'MT'), 1).'
'; -print '
'; - -print '
'; - - -// Show graphs -print '
'; -if ($mesg) { - print $mesg; -} else { - print $px1->show(); - print "
\n"; - print $px2->show(); - print "
\n"; - print $px3->show(); -} -print '
'; - - -print '
'; -print '
'; - - -print dol_get_fiche_end(); - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/core/lib/trip.lib.php b/htdocs/core/lib/trip.lib.php deleted file mode 100644 index 73a7f81267d..00000000000 --- a/htdocs/core/lib/trip.lib.php +++ /dev/null @@ -1,64 +0,0 @@ - - * Copyright (C) 2024 MDW - * Copyright (C) 2025 Frédéric France - * - * 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 . - * or see https://www.gnu.org/ - */ - -/** - * \file htdocs/core/lib/trip.lib.php - * \brief Ensemble de functions de base pour les deplacements - */ - -/** - * Prepare array with list of tabs - * - * @param Deplacement $object Object related to tabs - * @return array Array of tabs to show - */ -function trip_prepare_head(Deplacement $object) -{ - global $langs, $conf; - - $h = 0; - $head = array(); - - $query = ['id' => $object->id]; - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/compta/deplacement/card.php', $query); - $head[$h][1] = $langs->trans("Trip"); - $head[$h][2] = 'card'; - $h++; - - // Show more tabs from modules - // Entries must be declared in modules descriptor with line - // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab - // $this->tabs = array('entity:-tabname); to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip'); - - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/compta/deplacement/document.php', $query); - $head[$h][1] = $langs->trans("Documents"); - $head[$h][2] = 'documents'; - $h++; - - $head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/compta/deplacement/info.php', $query); - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; - - complete_head_from_modules($conf, $langs, $object, $head, $h, 'trip', 'remove'); - - return $head; -} diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 2d7a9668612..518edd3d602 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -474,12 +474,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("holiday")', __HANDLER__, 'left', 5005__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?mainmenu=hrm', 'MenuConfCP', 1, 'holiday', '$user->hasRight("holiday", "define_holiday")', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("holiday")', __HANDLER__, 'left', 5006__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?mainmenu=hrm', 'MenuLogCP', 1, 'holiday', '$user->hasRight("holiday", "define_holiday")', '', 0, 3, __ENTITY__); --- HRM - Trips and expenses (old module) -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("deplacement")', __HANDLER__, 'left', 2100__+MAX_llx_menu__, 'accountancy', 'tripsandexpenses', 15__+MAX_llx_menu__, '/compta/deplacement/index.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'TripsAndExpenses', 0, 'trips', '$user->hasRight("deplacement","lire")', '', 0, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("deplacement")', __HANDLER__, 'left', 2101__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/card.php?mainmenu=accountancy&action=create&leftmenu=tripsandexpenses', 'New', 1, 'trips', '$user->hasRight("deplacement","creer")', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("deplacement")', __HANDLER__, 'left', 2102__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/list.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'List', 1, 'trips', '$user->hasRight("deplacement","lire")', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("deplacement")', __HANDLER__, 'left', 2103__+MAX_llx_menu__, 'accountancy', '', 2100__+MAX_llx_menu__, '/compta/deplacement/stats/index.php?mainmenu=accountancy&leftmenu=tripsandexpenses', 'Statistics', 1, 'trips', '$user->hasRight("deplacement","lire")', '', 0, 2, __ENTITY__); - -- HRM - Expense reports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("expensereport")', __HANDLER__, 'left', 5300__+MAX_llx_menu__, 'hrm', 'expensereport', 15__+MAX_llx_menu__, '/expensereport/index.php?mainmenu=hrm&leftmenu=expensereport', 'TripsAndExpenses', 0, 'trips', '$user->hasRight("expensereport","lire")', '', 0, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("expensereport")', __HANDLER__, 'left', 5301__+MAX_llx_menu__, 'hrm', '', 5300__+MAX_llx_menu__, '/expensereport/card.php?mainmenu=hrm&action=create&leftmenu=expensereport', 'New', 1, 'trips', '$user->hasRight("expensereport","creer")', '', 0, 1, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 97cfba52775..1a01c380727 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -2525,15 +2525,6 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $newmenu->add(dolBuildUrl('/holiday/view_log.php', ['mainmenu' => 'hrm', 'leftmenu' => 'holiday']), $langs->trans("MenuLogCP"), 1, $user->hasRight('holiday', 'define_holiday'), '', $mainmenu, 'holiday_sm'); } - // Trips and expenses (old module) - if (isModEnabled('deplacement')) { - $langs->load("trips"); - $newmenu->add(dolBuildUrl('/compta/deplacement/index.php', ['leftmenu' => 'tripsandexpenses', 'mainmenu' => 'hrm']), $langs->trans("TripsAndExpenses"), 0, $user->hasRight('deplacement', 'lire'), '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); - $newmenu->add(dolBuildUrl('/compta/deplacement/card.php', ['action' => 'create', 'leftmenu' => 'tripsandexpenses', 'mainmenu' => 'hrm']), $langs->trans("New"), 1, $user->hasRight('deplacement', 'creer')); - $newmenu->add(dolBuildUrl('/compta/deplacement/list.php', ['leftmenu' => 'tripsandexpenses', 'mainmenu' => 'hrm']), $langs->trans("List"), 1, $user->hasRight('deplacement', 'lire')); - $newmenu->add(dolBuildUrl('/compta/deplacement/stats/index.php', ['leftmenu' => 'tripsandexpenses', 'mainmenu' => 'hrm']), $langs->trans("Statistics"), 1, $user->hasRight('deplacement', 'lire')); - } - // Expense report if (isModEnabled('expensereport')) { $langs->loadLangs(array("trips", "bills")); diff --git a/htdocs/core/modules/modDeplacement.class.php b/htdocs/core/modules/modDeplacement.class.php deleted file mode 100644 index 3d799722cc5..00000000000 --- a/htdocs/core/modules/modDeplacement.class.php +++ /dev/null @@ -1,173 +0,0 @@ - - * Copyright (C) 2005-2012 Regis Houssin - * - * 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 . - */ - -/** - * \defgroup deplacement Module traves - * \brief Module pour gerer les deplacements et notes de frais - * \file htdocs/core/modules/modDeplacement.class.php - * \ingroup deplacement - * \brief Description and activation file for the module trips (deprecated) - */ -include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; - - -/** - * Class to describe and enable module Deplacement - */ -class modDeplacement extends DolibarrModules -{ - /** - * Constructor. Define names, constants, directories, boxes, permissions - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - global $conf, $user; - - $this->db = $db; - $this->numero = 75; - - $this->family = "hr"; - $this->module_position = '43'; - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i', '', get_class($this)); - $this->description = "Gestion des notes de frais et deplacements"; // Si traduction Module75Desc non trouvee - - // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version - $this->version = 'dolibarr_deprecated'; - - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); - $this->picto = "trip"; - - // Data directories to create when module is enabled - $this->dirs = array(); - - // Config pages - $this->config_page_url = array(); - $this->langfiles = array("companies", "trips"); - - // Dependencies - $this->depends = array(); - $this->requiredby = array(); - - // Constants - $this->const = array(); - - // Boxes - $this->boxes = array(); - - // Permissions - $this->rights = array(); - $this->rights_class = 'deplacement'; - - $this->rights[1][0] = 171; - $this->rights[1][1] = 'View own expense and travel reports, and its hierarchy'; - $this->rights[1][2] = 'r'; - $this->rights[1][3] = 0; - $this->rights[1][4] = 'lire'; - - $this->rights[2][0] = 172; - $this->rights[2][1] = 'Creer/modifier une note de frais et deplacements'; - $this->rights[2][2] = 'w'; - $this->rights[2][3] = 0; - $this->rights[2][4] = 'creer'; - - $this->rights[3][0] = 173; - $this->rights[3][1] = 'Supprimer les notes de frais et deplacements'; - $this->rights[3][2] = 'd'; - $this->rights[3][3] = 0; - $this->rights[3][4] = 'supprimer'; - - $this->rights[4][0] = 174; - $this->rights[4][1] = 'Lire toutes les notes de frais'; - $this->rights[4][2] = 'd'; - $this->rights[4][3] = 0; - $this->rights[4][4] = 'readall'; - - $this->rights[5][0] = 178; - $this->rights[5][1] = 'Exporter les notes de frais et deplacements'; - $this->rights[5][2] = 'd'; - $this->rights[5][3] = 0; - $this->rights[5][4] = 'export'; - - - // Menus - //------- - $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - - // Exports - $r = 0; - - $r++; - $this->export_code[$r] = 'trips_'.$r; - $this->export_label[$r] = 'ListTripsAndExpenses'; - $this->export_permission[$r] = array(array("deplacement", "export")); - $this->export_fields_array[$r] = array('u.login'=>'Login', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'd.rowid'=>"TripId", 'd.type'=>"Type", 'd.km'=>"FeesKilometersOrAmout", 'd.dated'=>"Date", 'd.note_private'=>'NotePrivate', 'd.note_public'=>'NotePublic', 's.nom'=>'ThirdParty'); - $this->export_TypeFields_array[$r] = array('u.rowid'=>'List:user:name', 'u.login'=>'Text', 'u.lastname'=>'Text', 'u.firstname'=>'Text', 'd.type'=>"Text", 'd.km'=>"Numeric", 'd.dated'=>"Date", 'd.note_private'=>'Text', 'd.note_public'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>'Text'); - $this->export_entities_array[$r] = array('u.login'=>'user', 'u.lastname'=>'user', 'u.firstname'=>'user', 'd.rowid'=>"trip", 'd.type'=>"trip", 'd.km'=>"trip", 'd.dated'=>"trip", 'd.note_private'=>'trip', 'd.note_public'=>'trip', 's.nom'=>'company'); - $this->export_dependencies_array[$r] = array('trip'=>'d.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - - $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; - $this->export_sql_end[$r] .= ', '.MAIN_DB_PREFIX.'deplacement as d'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON d.fk_soc = s.rowid'; - if (!empty($user) && !$user->hasRight('societe', 'client', 'voir')) { - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; - } - $this->export_sql_end[$r] .= ' WHERE d.fk_user = u.rowid'; - $this->export_sql_end[$r] .= ' AND d.entity IN ('.getEntity('deplacement').')'; - if (!empty($user) && !$user->hasRight('societe', 'client', 'voir')) { - $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR d.fk_soc IS NULL)'; - } - - if (!empty($user)) { // Not defined during migration process - $childids = $user->getAllChildIds(); - $childids[] = $user->id; - - if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) { - $this->export_sql_end[$r] .= ' AND d.fk_user IN ('.$this->db->sanitize(implode(',', $childids)).')'; - } - } - } - - - /** - * Function called when module is enabled. - * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. - * It also creates data directories - * - * @param string $options Options when enabling module ('', 'noboxes') - * @return int 1 if OK, 0 if KO - */ - public function init($options = '') - { - $result = $this->_load_tables('/install/mysql/', 'deplacement'); - if ($result < 0) { - return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') - } - - // Permissions - $this->remove($options); - - $sql = array(); - - return $this->_init($sql, $options); - } -} diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index c9853cacc45..f2da576ddca 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -21,7 +21,7 @@ /** * \defgroup expensereport Module expensereport - * \brief Module to manage expense report. Replace old module Deplacement. + * \brief Module to manage expense report. * \file htdocs/core/modules/modExpenseReport.class.php * \ingroup expensereport * \brief Description and activation file for the module ExpenseReport @@ -65,7 +65,6 @@ class modExpenseReport extends DolibarrModules // Dependencies $this->hidden = false; // A condition to hide module $this->depends = []; // List of module class names as string that must be enabled if this module is enabled - // $this->conflictwith = ["modDeplacement"]; // Deactivate for access on old information $this->requiredby = []; // List of modules id to disable if this one is disabled $this->langfiles = ["companies", "trips"]; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 48d385943d4..6baf64f97c5 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -63,9 +63,6 @@ if (isModEnabled('contract')) { if (isModEnabled('intervention')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } -if (isModEnabled('deplacement')) { - require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -} if (isModEnabled('agenda')) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; } @@ -1005,13 +1002,6 @@ class doc_generic_project_odt extends ModelePDFProjects 'disableamount' => 1, 'test' => isModEnabled('shipping') && $user->hasRight('expedition', 'lire') ), - 'trip' => array( - 'title' => "ListTripAssociatedProject", - 'class' => 'Deplacement', - 'table' => 'deplacement', - 'disableamount' => 1, - 'test' => isModEnabled('deplacement') && $user->hasRight('deplacement', 'lire') - ), 'expensereport' => array( 'title' => "ListExpenseReportsAssociatedProject", 'class' => 'ExpenseReportLine', diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 6e1e0a27988..e0abc79a036 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -45,7 +45,6 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -414,16 +413,6 @@ class pdf_beluga extends ModelePDFProjects 'disableamount' => 1, 'test' => isModEnabled('intervention') && $user->hasRight('ficheinter', 'lire'), 'lang' => 'interventions'), - 'trip' => array( - 'name' => "TripsAndExpenses", - 'title' => "ListExpenseReportsAssociatedProject", - 'class' => 'Deplacement', - 'table' => 'deplacement', - 'datefieldname' => 'dated', - 'margin' => 'minus', - 'disableamount' => 1, - 'test' => isModEnabled('deplacement') && $user->hasRight('deplacement', 'lire'), - 'lang' => 'trip'), 'expensereport' => array( 'name' => "ExpensesReports", 'title' => "ListExpenseReportsAssociatedProject", diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index ff16ad34b5b..d1ecda3381c 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -65,9 +65,6 @@ if (isModEnabled('contract')) { if (isModEnabled('intervention')) { require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; } -if (isModEnabled('deplacement')) { - require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -} if (isModEnabled('agenda')) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; } diff --git a/htdocs/core/search.php b/htdocs/core/search.php index e17779bb1b1..2abb89e0332 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -103,10 +103,6 @@ if (GETPOST('search_contact') != '') { header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact'))); exit; } -if (GETPOST('search_deplacement') != '') { - header("Location: ".DOL_URL_ROOT.'/compta/deplacement/list.php?mode=search&sall='.urlencode(GETPOST('search_deplacement'))); - exit; -} if (GETPOST('search_expensereport') != '') { header("Location: ".DOL_URL_ROOT.'/expensereport/list.php?mode=search&sall='.urlencode(GETPOST('search_expensereport'))); exit; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 2fd363484b5..dade725d966 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -45,9 +45,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; -if (isModEnabled('deplacement')) { - require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -} if (isModEnabled('expensereport')) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index d4d450b8d2a..29c26b01096 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -68,9 +68,6 @@ if (isModEnabled('order')) { if (isModEnabled('contract')) { require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; } -if (isModEnabled('deplacement')) { - require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -} if (isModEnabled('don')) { require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; } @@ -659,20 +656,6 @@ $listofreferent = array( 'nototal' => 1, 'test' => isModEnabled('mrp') && $user->hasRight('mrp', 'read') ), - 'trip' => array( - 'name' => "TripsAndExpenses", - 'title' => "ListExpenseReportsAssociatedProject", - 'class' => 'Deplacement', - 'table' => 'deplacement', - 'datefieldname' => 'dated', - 'margin' => 'minus', - 'disableamount' => 1, - 'urlnew' => DOL_URL_ROOT.'/deplacement/card.php?action=create&projectid='.$id.'&socid='.$socid.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), - 'lang' => 'trips', - 'buttonnew' => 'AddTrip', - 'testnew' => $user->hasRight('deplacement', 'creer'), - 'test' => isModEnabled('deplacement') && $user->hasRight('deplacement', 'lire') - ), 'expensereport' => array( 'name' => "ExpenseReports", 'title' => "ListExpenseReportsAssociatedProject",