--- /tmp/dsg/dolibarr/htdocs/core/modules/ticket/github_19.0.3_mod_ticket_simple.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/ticket/client_mod_ticket_simple.php
@@ -61,2 +61 @@
- * @param Translate $langs Lang object to use for output
- * @return string Descriptive text
+ * @return string Text with description
@@ -64 +63 @@
- public function info($langs)
+ public function info()
@@ -84,2 +83 @@
- * @param Object $object Object we need next value for
- * @return boolean false if conflict, true if ok
+ * @return boolean false if conflict, true if ok
@@ -87 +85 @@
- public function canBeActivated($object)
+ public function canBeActivated()
@@ -98 +96 @@
- $sql .= " WHERE ref LIKE '".$db->escape($search)."'";
+ $sql .= " WHERE ref LIKE '".$search."'";
@@ -120,3 +118,3 @@
- * @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
@@ -126 +124 @@
- global $db;
+ global $db, $conf;
@@ -133,2 +131,2 @@
- $sql .= " WHERE ref LIKE '".$db->escape($search)."'";
- $sql .= " AND entity IN (".getEntity('ticketnumber', 1, $ticket).")";
+ $sql .= " WHERE ref LIKE '".$search."'";
+ $sql .= " AND entity = ".$conf->entity;
@@ -152 +150 @@
- $yymm = dol_print_date($date, "%y%m");
+ $yymm = strftime("%y%m", $date);
@@ -156,2 +154,2 @@
- } else {
- // If counter > 9999, we do not format on 4 chars, we take number as it is
+ } // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else {
--- /tmp/dsg/dolibarr/htdocs/core/modules/ticket/github_19.0.3_mod_ticket_universal.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/ticket/client_mod_ticket_universal.php
@@ -22 +22 @@
- * \brief File with class to manage the numbering module Universal for Ticket references
+ * \brief Fichier contenant la classe du modele de numerotation de reference de projet Universal
@@ -28 +28 @@
- * Class to manage the numbering module Universal for Ticket references
+ * Classe du modele de numerotation de reference de projet Universal
@@ -32,5 +32,5 @@
- /**
- * 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'
@@ -38,4 +38,4 @@
- /**
- * @var string Error code (or message)
- */
- public $error = '';
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
@@ -43,4 +43,4 @@
- /**
- * @var string Nom du modele
- * @deprecated
- * @see $name
+ /**
+ * @var string Nom du modele
+ * @deprecated
+ * @see $name
@@ -51 +51 @@
- * @var string model name
+ * @var string model name
@@ -55,9 +55,8 @@
- /**
- * Returns the description of the numbering model
- *
- * @param Translate $langs Lang object to use for output
- * @return string Descriptive text
- */
- public function info($langs)
- {
- global $db, $langs;
+ /**
+ * Returns the description of the numbering model
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $db, $conf, $langs;
@@ -65,2 +64,2 @@
- // Load translation files required by the page
- $langs->loadLangs(array("ticket", "admin"));
+ // Load translation files required by the page
+ $langs->loadLangs(array("ticket", "admin"));
@@ -68 +67 @@
- $form = new Form($db);
+ $form = new Form($db);
@@ -70,6 +69,6 @@
- $texte = $langs->trans('GenericNumRefModelDesc')."
\n";
- $texte .= '
';
@@ -94,2 +93,2 @@
- return $texte;
- }
+ return $texte;
+ }
@@ -97,8 +96,8 @@
- /**
- * 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;
@@ -106,4 +105,4 @@
- $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;
@@ -111,5 +110,5 @@
- if (!$numExample) {
- $numExample = $langs->trans('NotConfigured');
- }
- return $numExample;
- }
+ if (!$numExample) {
+ $numExample = $langs->trans('NotConfigured');
+ }
+ return $numExample;
+ }
@@ -117,10 +116,10 @@
- /**
- * 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;
@@ -128 +127 @@
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@@ -130,2 +129,2 @@
- // We define criterion search counter
- $mask = getDolGlobalString("TICKET_UNIVERSAL_MASK");
+ // On defini critere recherche compteur
+ $mask = $conf->global->TICKET_UNIVERSAL_MASK;
@@ -133,4 +132,4 @@
- if (!$mask) {
- $this->error = 'NotConfigured';
- return 0;
- }
+ if (!$mask) {
+ $this->error = 'NotConfigured';
+ return 0;
+ }
@@ -138,2 +137,2 @@
- // Get entities
- $entity = getEntity('ticketnumber', 1, $ticket);
+ $date = empty($ticket->date_c) ? dol_now() : $ticket->datec;
+ $numFinal = get_next_value($db, $mask, 'ticket', 'ref', '', $objsoc->code_client, $date);
@@ -141,5 +140,2 @@
- $date = empty($ticket->datec) ? dol_now() : $ticket->datec;
- $numFinal = get_next_value($db, $mask, 'ticket', 'ref', '', $objsoc->code_client, $date, 'next', false, null, $entity);
-
- return $numFinal;
- }
+ return $numFinal;
+ }
--- /tmp/dsg/dolibarr/htdocs/core/modules/ticket/github_19.0.3_modules_ticket.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/ticket/client_modules_ticket.php
@@ -2,3 +2,2 @@
-/* Copyright (C) 2010-2014 Regis Houssin
- * Copyright (C) 2014 Marcos García
- * Copyright (C) 2020 Charlene Benke
+/* Copyright (C) 2010-2014 Regis Houssin
+ * Copyright (C) 2014 Marcos García
@@ -22,2 +21,2 @@
- * \file htdocs/core/modules/ticket/modules_ticket.php
- * \ingroup ticket
+ * \file htdocs/core/modules/ticket/modules_ticket.php
+ * \ingroup project
@@ -28,31 +26,0 @@
-require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
-require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.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
- $type = 'ticket';
- $list = array();
-
- include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- $list = getListOfModels($db, $type, $maxfilenamelength);
-
- return $list;
- }
-}
-
-
@@ -62 +30 @@
-abstract class ModeleNumRefTicket extends CommonNumRefGenerator
+abstract class ModeleNumRefTicket
@@ -64 +32,91 @@
- // No overload code
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
+
+ /**
+ * Renvoi la description par defaut du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("ticket");
+ return $langs->trans("NoDescription");
+ }
+
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load("ticket");
+ return $langs->trans("NoExample");
+ }
+
+ /**
+ * Checks if the numbers already in the database do not
+ * cause conflicts that would prevent this numbering working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
+
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @param Societe $objsoc Object third party
+ * @param Project $project Object project
+ * @return string Valeur
+ */
+ public function getNextValue($objsoc, $project)
+ {
+ global $langs;
+ return $langs->trans("NotAvailable");
+ }
+
+ /**
+ * Renvoi version du module numerotation
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
+
+ if ($this->version == 'development') {
+ return $langs->trans("VersionDevelopment");
+ }
+
+ if ($this->version == 'experimental') {
+ return $langs->trans("VersionExperimental");
+ }
+
+ if ($this->version == 'dolibarr') {
+ return DOL_VERSION;
+ }
+
+ if ($this->version) {
+ return $this->version;
+ }
+
+ return $langs->trans("NotAvailable");
+ }