--- /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')."
\n"; - $texte .= '
'; - $texte .= ''; - $texte .= ''; - $texte .= ''; - $texte .= ''; + $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= ''; + $texte .= '
'; - $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 .= ''; - $texte .= ''; + // Parametrage du prefix + $texte .= ''; + $texte .= ''; - $texte .= ''; + $texte .= ''; - $texte .= ''; + $texte .= ''; - $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).'   
'; - $texte .= '
'; + $texte .= ''; + $texte .= ''; - 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 @@ - * Copyright (C) 2014 Marcos García - * Copyright (C) 2020 Charlene Benke +/* Copyright (C) 2010-2014 Regis Houssin + * Copyright (C) 2014 Marcos García * * 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