--- /tmp/dsg/dolibarr/htdocs/core/modules/ticket/github_mod_ticket_simple.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/ticket/client_mod_ticket_simple.php
@@ -93,7 +93,7 @@
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";

 		$sql .= " FROM ".MAIN_DB_PREFIX."ticket";

 		$search = $this->prefix."____-%";

-		$sql .= " WHERE ref LIKE '".$db->escape($search)."'";

+		$sql .= " WHERE ref LIKE '".$search."'";

 		$sql .= " AND entity = ".$conf->entity;

 		$resql = $db->query($sql);

 		if ($resql) {

@@ -115,9 +115,9 @@
 	/**

 	 *  Return next value

 	 *

-	 *  @param  Societe $objsoc    	Object third party

-	 *  @param  Ticket 	$ticket 	Object ticket

-	 *  @return string              Value if OK, 0 if KO

+	 *  @param  Societe $objsoc    Object third party

+	 *  @param  Project $ticket Object ticket

+	 *  @return string                Value if OK, 0 if KO

 	 */

 	public function getNextValue($objsoc, $ticket)

 	{

@@ -128,7 +128,7 @@
 		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";

 		$sql .= " FROM ".MAIN_DB_PREFIX."ticket";

 		$search = $this->prefix."____-%";

-		$sql .= " WHERE ref LIKE '".$db->escape($search)."'";

+		$sql .= " WHERE ref LIKE '".$search."'";

 		$sql .= " AND entity = ".$conf->entity;

 

 		$resql = $db->query($sql);

--- /tmp/dsg/dolibarr/htdocs/core/modules/ticket/github_mod_ticket_universal.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/ticket/client_mod_ticket_universal.php
@@ -29,18 +29,18 @@
  */

 class mod_ticket_universal extends ModeleNumRefTicket

 {

-	/**

-	 * Dolibarr version of the loaded document

-	 * @var string

-	 */

-	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'

+    /**

+     * Dolibarr version of the loaded document

+     * @var string

+     */

+    public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'

 

-	/**

-	 * @var string Error code (or message)

-	 */

-	public $error = '';

+    /**

+     * @var string Error code (or message)

+     */

+    public $error = '';

 

-	/**

+    /**

 	 * @var string Nom du modele

 	 * @deprecated

 	 * @see $name

@@ -52,91 +52,91 @@
 	 */

 	public $name = 'Universal';

 

-	/**

-	 *  Returns the description of the numbering model

-	 *

-	 *  @return string      Texte descripif

-	 */

-	public function info()

-	{

-		global $db, $conf, $langs;

+    /**

+     *  Returns the description of the numbering model

+     *

+     *  @return string      Texte descripif

+     */

+    public function info()

+    {

+        global $db, $conf, $langs;

 

-		// Load translation files required by the page

-		$langs->loadLangs(array("ticket", "admin"));

+        // Load translation files required by the page

+        $langs->loadLangs(array("ticket", "admin"));

 

-		$form = new Form($db);

+        $form = new Form($db);

 

-		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";

-		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

-		$texte .= '<input type="hidden" name="token" value="'.newToken().'">';

-		$texte .= '<input type="hidden" name="action" value="updateMask">';

-		$texte .= '<input type="hidden" name="maskconstticket" value="TICKET_UNIVERSAL_MASK">';

-		$texte .= '<table class="nobordernopadding" width="100%">';

+        $texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";

+        $texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';

+        $texte .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

+        $texte .= '<input type="hidden" name="action" value="updateMask">';

+        $texte .= '<input type="hidden" name="maskconstticket" value="TICKET_UNIVERSAL_MASK">';

+        $texte .= '<table class="nobordernopadding" width="100%">';

 

-		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Ticket"), $langs->transnoentities("Ticket"));

-		$tooltip .= $langs->trans("GenericMaskCodes2");

-		$tooltip .= $langs->trans("GenericMaskCodes3");

-		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Ticket"), $langs->transnoentities("Ticket"));

-		$tooltip .= $langs->trans("GenericMaskCodes5");

+        $tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Ticket"), $langs->transnoentities("Ticket"));

+        $tooltip .= $langs->trans("GenericMaskCodes2");

+        $tooltip .= $langs->trans("GenericMaskCodes3");

+        $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Ticket"), $langs->transnoentities("Ticket"));

+        $tooltip .= $langs->trans("GenericMaskCodes5");

 

-		// Parametrage du prefix

-		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';

-		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskticket" value="'.$conf->global->TICKET_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';

+        // Parametrage du prefix

+        $texte .= '<tr><td>'.$langs->trans("Mask").':</td>';

+        $texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskticket" value="'.$conf->global->TICKET_UNIVERSAL_MASK.'">', $tooltip, 1, 1).'</td>';

 

-		$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';

+        $texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';

 

-		$texte .= '</tr>';

+        $texte .= '</tr>';

 

-		$texte .= '</table>';

-		$texte .= '</form>';

+        $texte .= '</table>';

+        $texte .= '</form>';

 

-		return $texte;

-	}

+        return $texte;

+    }

 

-	/**

-	 *  Return an example of numbering

-	 *

-	 *  @return string      Example

-	 */

-	public function getExample()

-	{

-		global $conf, $langs, $mysoc;

+    /**

+     *  Return an example of numbering

+     *

+     *  @return string      Example

+     */

+    public function getExample()

+    {

+        global $conf, $langs, $mysoc;

 

-		$old_code_client = $mysoc->code_client;

-		$mysoc->code_client = 'CCCCCCCCCC';

-		$numExample = $this->getNextValue($mysoc, '');

-		$mysoc->code_client = $old_code_client;

+        $old_code_client = $mysoc->code_client;

+        $mysoc->code_client = 'CCCCCCCCCC';

+        $numExample = $this->getNextValue($mysoc, '');

+        $mysoc->code_client = $old_code_client;

 

-		if (!$numExample) {

-			$numExample = $langs->trans('NotConfigured');

-		}

-		return $numExample;

-	}

+        if (!$numExample) {

+            $numExample = $langs->trans('NotConfigured');

+        }

+        return $numExample;

+    }

 

-	/**

-	 *  Return next value

-	 *

-	 *  @param  Societe $objsoc     Object third party

-	 *  @param  Ticket  $ticket 	Object ticket

-	 *  @return string              Value if OK, 0 if KO

-	 */

-	public function getNextValue($objsoc, $ticket)

-	{

-		global $db, $conf;

+    /**

+     *  Return next value

+     *

+     *  @param  Societe $objsoc    Object third party

+     *  @param  Project $ticket Object ticket

+     *  @return string                    Value if OK, 0 if KO

+     */

+    public function getNextValue($objsoc, $ticket)

+    {

+        global $db, $conf;

 

-		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

+        include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

 

-		// On defini critere recherche compteur

-		$mask = $conf->global->TICKET_UNIVERSAL_MASK;

+        // On defini critere recherche compteur

+        $mask = $conf->global->TICKET_UNIVERSAL_MASK;

 

-		if (!$mask) {

-			$this->error = 'NotConfigured';

-			return 0;

-		}

+        if (!$mask) {

+            $this->error = 'NotConfigured';

+            return 0;

+        }

 

-		$date = empty($ticket->datec) ? dol_now() : $ticket->datec;

-		$numFinal = get_next_value($db, $mask, 'ticket', 'ref', '', $objsoc->code_client, $date);

+        $date = empty($ticket->date_c) ? dol_now() : $ticket->datec;

+        $numFinal = get_next_value($db, $mask, 'ticket', 'ref', '', $objsoc->code_client, $date);

 

-		return $numFinal;

-	}

+        return $numFinal;

+    }

 }

--- /tmp/dsg/dolibarr/htdocs/core/modules/ticket/github_modules_ticket.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/ticket/client_modules_ticket.php
@@ -1,7 +1,6 @@
 <?php

-/* Copyright (C) 2010-2014  Regis Houssin    <regis.houssin@inodbox.com>

- * Copyright (C) 2014       Marcos García    <marcosgdf@gmail.com>

- * Copyright (C) 2020       Charlene Benke   <charlie@patas-monkey.com>

+/* Copyright (C) 2010-2014    Regis Houssin    <regis.houssin@inodbox.com>

+ * Copyright (C) 2014       Marcos García   <marcosgdf@gmail.com>

  *

  * 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

@@ -19,43 +18,11 @@
  */

 

 /**

- *      \file       htdocs/core/modules/ticket/modules_ticket.php

- *      \ingroup    ticket

+ *        \file       htdocs/core/modules/ticket/modules_ticket.php

+ *      \ingroup    project

  *      \brief      File that contain parent class for projects models

  *                  and parent class for projects numbering models

  */

-

-require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';

-

-/**

- *	Parent class for documents models

- */

-abstract class ModelePDFTicket extends CommonDocGenerator

-{

-

-	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

-	/**

-	 *  Return list of active generation modules

-	 *

-	 *  @param	DoliDB	$db     			Database handler

-	 *  @param  integer	$maxfilenamelength  Max length of value to show

-	 *  @return	array						List of templates

-	 */

-	public static function liste_modeles($db, $maxfilenamelength = 0)

-	{

-		// phpcs:enable

-		global $conf;

-

-		$type = 'ticket';

-		$list = array();

-

-		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

-		$list = getListOfModels($db, $type, $maxfilenamelength);

-

-		return $list;

-	}

-}

-

 

 /**

  *  Classe mere des modeles de numerotation des references de projets