From 8217587b5e53eddd4098224436d7457527c2ce25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Mar 2018 10:34:21 +0100 Subject: [PATCH] Dolibarize new module --- htdocs/ticketsup/card.php | 15 +++-------- .../class/actions_ticketsup.class.php | 5 ++-- htdocs/ticketsup/class/ticketsup.class.php | 6 ++--- .../ticketsup/class/ticketsuplogs.class.php | 6 ++--- .../ticketsup/class/ticketsupstats.class.php | 4 +-- htdocs/ticketsup/class/utils_diff.class.php | 26 +++++++++---------- htdocs/ticketsup/contacts.php | 18 +++++-------- htdocs/ticketsup/document.php | 15 +++-------- htdocs/ticketsup/history.php | 16 +++--------- htdocs/ticketsup/index.php | 17 +++--------- htdocs/ticketsup/list.php | 25 +++--------------- htdocs/ticketsup/new.php | 19 ++++---------- .../ticketsup/tpl/linkedobjectblock.tpl.php | 4 +-- 13 files changed, 52 insertions(+), 124 deletions(-) diff --git a/htdocs/ticketsup/card.php b/htdocs/ticketsup/card.php index 79cc87a52d8..5d005063b8b 100644 --- a/htdocs/ticketsup/card.php +++ b/htdocs/ticketsup/card.php @@ -1,7 +1,6 @@ - * 2016 Christophe Battarel +/* Copyright (C) - 2013-2016 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel * * 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 @@ -23,15 +22,7 @@ * @package ticketsup */ -// Change this following line to use the correct relative path (../, ../../, etc) -$res = 0; -if (file_exists("../main.inc.php")) { - $res = include "../main.inc.php"; // From htdocs directory -} elseif (!$res && file_exists("../../main.inc.php")) { - $res = include "../../main.inc.php"; // From "custom" directory -} else { - die("Include of main fails"); -} +require '../main.inc.php'; require_once 'class/actions_ticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticketsup.class.php'; diff --git a/htdocs/ticketsup/class/actions_ticketsup.class.php b/htdocs/ticketsup/class/actions_ticketsup.class.php index d72e8388905..3c1c2febdae 100644 --- a/htdocs/ticketsup/class/actions_ticketsup.class.php +++ b/htdocs/ticketsup/class/actions_ticketsup.class.php @@ -1,6 +1,6 @@ - * 2016 Christophe Battarel +/* Copyright (C) 2013-2015 Jean-François FERRY + * Copyright (C) 2016 Christophe Battarel * * 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 @@ -24,7 +24,6 @@ */ require_once "ticketsup.class.php"; - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php index 289a865b4e8..03179cc36d9 100644 --- a/htdocs/ticketsup/class/ticketsup.class.php +++ b/htdocs/ticketsup/class/ticketsup.class.php @@ -1,7 +1,6 @@ - * 2016 Christophe Battarel +/* Copyright (C) 2013-2018 Jean-François Ferry + * Copyright (C) 2016 Christophe Battarel * * 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 @@ -29,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php'; //require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); //require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); + /** * Put here description of your class */ diff --git a/htdocs/ticketsup/class/ticketsuplogs.class.php b/htdocs/ticketsup/class/ticketsuplogs.class.php index 30d1f49f21c..e8f30d5db9f 100644 --- a/htdocs/ticketsup/class/ticketsuplogs.class.php +++ b/htdocs/ticketsup/class/ticketsuplogs.class.php @@ -1,6 +1,5 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY * * 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 @@ -27,8 +26,9 @@ require_once DOL_DOCUMENT_ROOT . "/core/class/commonobject.class.php"; //require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); //require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); + /** - * Put here description of your class + * Class of log for ticketsup */ class Ticketsuplogs// extends CommonObject { diff --git a/htdocs/ticketsup/class/ticketsupstats.class.php b/htdocs/ticketsup/class/ticketsupstats.class.php index 8af852eeb01..3c299b911af 100644 --- a/htdocs/ticketsup/class/ticketsupstats.class.php +++ b/htdocs/ticketsup/class/ticketsupstats.class.php @@ -23,9 +23,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php'; require_once 'ticketsup.class.php'; + /** - * \class DeplacementStats - * \brief Classe permettant la gestion des stats des deplacements et notes de frais + * Classe permettant la gestion des stats des deplacements et notes de frais */ class TicketsupStats extends Stats { diff --git a/htdocs/ticketsup/class/utils_diff.class.php b/htdocs/ticketsup/class/utils_diff.class.php index f09be232148..4f0d276b192 100644 --- a/htdocs/ticketsup/class/utils_diff.class.php +++ b/htdocs/ticketsup/class/utils_diff.class.php @@ -1,22 +1,20 @@ + * + * A class containing a diff implementation + * + * Created by Stephen Morley - http://stephenmorley.org/ - and released under the + * terms of the CC0 1.0 Universal legal code: + * + * http://creativecommons.org/publicdomain/zero/1.0/legalcode */ -// A class containing functions for computing diffs and formatting the output. + +/** + * A class containing functions for computing diffs and formatting the output. + */ class Diff { - // define the constants const UNMODIFIED = 0; const DELETED = 1; diff --git a/htdocs/ticketsup/contacts.php b/htdocs/ticketsup/contacts.php index 39f6976e795..0a04c8ce509 100644 --- a/htdocs/ticketsup/contacts.php +++ b/htdocs/ticketsup/contacts.php @@ -1,7 +1,7 @@ - * Copyright (C) 2011 Regis Houssin - * 2016 Christophe Battarel +/* Copyright (C) 2011-2016 Jean-François Ferry + * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2016 Christophe Battarel * * 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 @@ -23,16 +23,10 @@ * \ingroup ticketsup * \brief Contacts des tickets */ -$res = 0; -if (file_exists("../main.inc.php")) { - $res = include "../main.inc.php"; // From htdocs directory -} elseif (!$res && file_exists("../../main.inc.php")) { - $res = include "../../main.inc.php"; // From "custom" directory -} else { - die("Include of main fails"); -} -require_once 'class/ticketsup.class.php'; +require '../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/ticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/ticketsup.lib.php'; require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; diff --git a/htdocs/ticketsup/document.php b/htdocs/ticketsup/document.php index 9ffdcd35048..ee1fc47f5d3 100644 --- a/htdocs/ticketsup/document.php +++ b/htdocs/ticketsup/document.php @@ -1,6 +1,5 @@ +/* Copyright (C) 2002-2007 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent @@ -26,17 +25,9 @@ * \brief files linked to a ticket */ -$res = 0; -if (file_exists("../main.inc.php")) { - $res = include "../main.inc.php"; // From htdocs directory -} elseif (!$res && file_exists("../../main.inc.php")) { - $res = include "../../main.inc.php"; // From "custom" directory -} else { - die("Include of main fails"); -} - +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/ticketsup.lib.php'; -require_once 'class/ticketsup.class.php'; +require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/ticketsup.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/company.lib.php"; diff --git a/htdocs/ticketsup/history.php b/htdocs/ticketsup/history.php index 43e35244e0c..fe0194e759c 100644 --- a/htdocs/ticketsup/history.php +++ b/htdocs/ticketsup/history.php @@ -1,6 +1,5 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY * * 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 @@ -17,20 +16,13 @@ */ /** - * History of ticket + * History of ticket * * @package ticketsup */ -$res = 0; -if (file_exists("../main.inc.php")) { - $res = include "../main.inc.php"; // From htdocs directory -} elseif (!$res && file_exists("../../main.inc.php")) { - $res = include "../../main.inc.php"; // From "custom" directory -} else { - die("Include of main fails"); -} -require_once 'class/actions_ticketsup.class.php'; +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/actions_ticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/ticketsup.lib.php'; require_once DOL_DOCUMENT_ROOT . "/core/lib/company.lib.php"; diff --git a/htdocs/ticketsup/index.php b/htdocs/ticketsup/index.php index 6b44d930e07..74a6000c2ee 100644 --- a/htdocs/ticketsup/index.php +++ b/htdocs/ticketsup/index.php @@ -1,6 +1,5 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY * * 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 @@ -22,17 +21,9 @@ * @package ticketsup */ -$res = 0; -if (file_exists("../main.inc.php")) { - $res = include "../main.inc.php"; // From htdocs directory -} elseif (!$res && file_exists("../../main.inc.php")) { - $res = include "../../main.inc.php"; // From "custom" directory -} else { - die("Include of main fails"); -} - -require_once 'class/actions_ticketsup.class.php'; -require_once 'class/ticketsupstats.class.php'; +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/actions_ticketsup.class.php'; +require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/ticketsupstats.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php'; // Load traductions files requiredby by page diff --git a/htdocs/ticketsup/list.php b/htdocs/ticketsup/list.php index bb4aa27b0f2..5661a78de71 100644 --- a/htdocs/ticketsup/list.php +++ b/htdocs/ticketsup/list.php @@ -1,6 +1,5 @@ +/* Copyright (C) - 2013-2018 Jean-François FERRY * 2016 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -23,30 +22,14 @@ * @package ticketsup */ - -// 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 caluclated 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) die("Include of main fails"); - - -require_once 'class/actions_ticketsup.class.php'; +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . '/ticketsup/class/actions_ticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php'; if (!empty($conf->projet->enabled)) { - include DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/project.lib.php'; } diff --git a/htdocs/ticketsup/new.php b/htdocs/ticketsup/new.php index 590c4b5db46..3fb4294f150 100644 --- a/htdocs/ticketsup/new.php +++ b/htdocs/ticketsup/new.php @@ -1,6 +1,5 @@ +/* Copyright (C) - 2013-2016 Jean-François FERRY * 2016 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -18,21 +17,13 @@ */ /** - * Display form to add new ticket + * Display form to add new ticket * - * @package ticketsup + * @package ticketsup */ -$res = 0; -if (file_exists("../main.inc.php")) { - $res = include "../main.inc.php"; // From htdocs directory -} elseif (!$res && file_exists("../../main.inc.php")) { - $res = include "../../main.inc.php"; // From "custom" directory -} else { - die("Include of main fails"); -} - -require_once 'class/actions_ticketsup.class.php'; +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT . 'class/actions_ticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticketsup.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/ticketsup.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; diff --git a/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php b/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php index f834ff10cb4..e071881b506 100644 --- a/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php +++ b/htdocs/ticketsup/tpl/linkedobjectblock.tpl.php @@ -37,11 +37,9 @@ print_titre($langs->trans('RelatedTickets')); trans("Status"); ?> -> + subject) ? ' '.$object->subject : ''); ?>