This commit is contained in:
Laurent Destailleur 2024-09-04 22:27:18 +02:00
parent 8121c82ad3
commit 227e13fe31
3 changed files with 12 additions and 5 deletions

View file

@ -100,9 +100,9 @@ class mod_task_simple extends ModeleNumRefTask
$posindice = strlen($this->prefix) + 6;
$sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM ".$posindice.") AS SIGNED)) as max";
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task AS task, ";
$sql .= MAIN_DB_PREFIX."projet AS project WHERE task.fk_projet=project.rowid";
$sql .= MAIN_DB_PREFIX."projet AS project WHERE task.fk_projet = project.rowid";
$sql .= " AND task.ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql .= " AND project.entity = ".$conf->entity;
$sql .= " AND project.entity = ".((int) $conf->entity);
$resql = $db->query($sql);
if ($resql) {
$row = $db->fetch_row($resql);
@ -130,7 +130,7 @@ class mod_task_simple extends ModeleNumRefTask
*/
public function getNextValue($objsoc, $object)
{
global $db, $conf;
global $db;
// First, we get the max value
$posindice = strlen($this->prefix) + 6;

View file

@ -106,7 +106,7 @@ class mod_task_universal extends ModeleNumRefTask
*/
public function getExample()
{
global $conf, $langs, $mysoc;
global $langs, $mysoc;
$old_code_client = $mysoc->code_client;
$mysoc->code_client = 'CCCCCCCCCC';
@ -128,7 +128,7 @@ class mod_task_universal extends ModeleNumRefTask
*/
public function getNextValue($objsoc, $object)
{
global $db, $conf;
global $db;
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

View file

@ -84,4 +84,11 @@ abstract class ModeleNumRefTask extends CommonNumRefGenerator
* @return string|int<-1,0> Value if OK, <=0 if KO
*/
abstract public function getNextValue($objsoc, $object);
/**
* Return an example of numbering
*
* @return string Example
*/
abstract public function getExample();
}