--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/github_mod_facture_fournisseur_cactus.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/client_mod_facture_fournisseur_cactus.php
@@ -33,16 +33,16 @@
  */

 class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices

 {

-	/**

-	 * Dolibarr version of the loaded document

-	 * @var string

-	 */

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

-

-	/**

-	 * @var string Error code (or message)

-	 */

-	public $error = '';

+    /**

+     * Dolibarr version of the loaded document

+     * @var string

+     */

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

+

+	/**

+     * @var string Error code (or message)

+     */

+    public $error = '';

 

 	/**

 	 * @var string Nom du modele

@@ -63,28 +63,28 @@
 	public $prefixdeposit = 'SD';

 

 

-	/**

-	 *  Return description of numbering model

-	 *

-	 *  @return     string      Text with description

-	 */

-	public function info()

-	{

-		global $langs;

-		$langs->load("bills");

-		return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);

-	}

-

-

-	/**

-	 *  Returns a numbering example

-	 *

-	 *  @return     string      Example

-	 */

-	public function getExample()

-	{

-		return $this->prefixinvoice."1301-0001";

-	}

+    /**

+     *  Return description of numbering model

+     *

+     *  @return     string      Text with description

+     */

+    public function info()

+    {

+        global $langs;

+        $langs->load("bills");

+        return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);

+    }

+

+

+    /**

+     *  Returns a numbering example

+     *

+     *  @return     string      Example

+     */

+    public function getExample()

+    {

+        return $this->prefixinvoice."1301-0001";

+    }

 

 

 	/**

@@ -160,84 +160,89 @@
 			$this->error = $langs->trans('ErrorNumRefModel', $max);

 			return false;

 		}

-	}

-

-	/**

-	 * Return next value

-	 *

-	 * @param	Societe		$objsoc     Object third party

-	 * @param  	Object		$object		Object invoice

-	 * @param   string		$mode       'next' for next value or 'last' for last value

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

-	 */

-	public function getNextValue($objsoc, $object, $mode = 'next')

-	{

-		global $db, $conf;

-

-		$prefix = $this->prefixinvoice;

-		if ($object->type == 2) $prefix = $this->prefixcreditnote;

-		elseif ($object->type == 3) $prefix = $this->prefixdeposit;

-

-		// First, we get the max value

-		$posindice = strlen($prefix) + 6;

-		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL

-		$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn";

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

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

-

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

-		dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

-		if ($resql)

-		{

-			$obj = $db->fetch_object($resql);

-			if ($obj) $max = intval($obj->max);

-			else $max = 0;

-		} else {

-			return -1;

-		}

-

-		if ($mode == 'last')

-		{

-			if ($max >= (pow(10, 4) - 1)) $num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is

-			else $num = sprintf("%04s", $max);

-

-			$ref = '';

-			$sql = "SELECT ref as ref";

-			$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn";

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

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

-

-			dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

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

-			if ($resql)

-			{

-				$obj = $db->fetch_object($resql);

-				if ($obj) $ref = $obj->ref;

-			} else dol_print_error($db);

-

-			return $ref;

-		} elseif ($mode == 'next')

-		{

-			$date = $object->date; // This is invoice date (not creation date)

-			$yymm = strftime("%y%m", $date);

-

-			if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is

-			else $num = sprintf("%04s", $max + 1);

-

-			dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);

-			return $prefix.$yymm."-".$num;

-		} else dol_print_error('', 'Bad parameter for getNextValue');

-	}

-

-

-	/**

-	 * Return next free value

-	 *

-	 * @param	Societe		$objsoc     	Object third party

-	 * @param	string		$objforref		Object for number to search

-	 * @param   string		$mode       	'next' for next value or 'last' for last value

-	 * @return  string      				Next free value

-	 */

+    }

+

+    /**

+     * Return next value

+     *

+     * @param	Societe		$objsoc     Object third party

+     * @param  	Object		$object		Object invoice

+     * @param   string		$mode       'next' for next value or 'last' for last value

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

+     */

+    public function getNextValue($objsoc, $object, $mode = 'next')

+    {

+        global $db, $conf;

+

+        $prefix = $this->prefixinvoice;

+        if ($object->type == 2) $prefix = $this->prefixcreditnote;

+        elseif ($object->type == 3) $prefix = $this->prefixdeposit;

+

+        // First, we get the max value

+        $posindice = strlen($prefix) + 6;

+        $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL

+        $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn";

+        $sql .= " WHERE ref LIKE '".$prefix."____-%'";

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

+

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

+        dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

+        if ($resql)

+        {

+        	$obj = $db->fetch_object($resql);

+        	if ($obj) $max = intval($obj->max);

+        	else $max = 0;

+        }

+        else

+        {

+        	return -1;

+        }

+

+        if ($mode == 'last')

+        {

+    		if ($max >= (pow(10, 4) - 1)) $num = $max; // If counter > 9999, we do not format on 4 chars, we take number as it is

+    		else $num = sprintf("%04s", $max);

+

+        	$ref = '';

+        	$sql = "SELECT ref as ref";

+        	$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn";

+        	$sql .= " WHERE ref LIKE '".$prefix."____-".$num."'";

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

+

+        	dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

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

+        	if ($resql)

+        	{

+        		$obj = $db->fetch_object($resql);

+        		if ($obj) $ref = $obj->ref;

+        	}

+        	else dol_print_error($db);

+

+        	return $ref;

+        }

+        elseif ($mode == 'next')

+        {

+        	$date = $object->date; // This is invoice date (not creation date)

+        	$yymm = strftime("%y%m", $date);

+

+        	if ($max >= (pow(10, 4) - 1)) $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is

+        	else $num = sprintf("%04s", $max + 1);

+

+        	dol_syslog(get_class($this)."::getNextValue return ".$prefix.$yymm."-".$num);

+        	return $prefix.$yymm."-".$num;

+        }

+        else dol_print_error('', 'Bad parameter for getNextValue');

+    }

+

+

+    /**

+     * Return next free value

+     *

+     * @param	Societe		$objsoc     	Object third party

+     * @param	string		$objforref		Object for number to search

+     * @param   string		$mode       	'next' for next value or 'last' for last value

+     * @return  string      				Next free value

+     */

 	public function getNumRef($objsoc, $objforref, $mode = 'next')

 	{

 		return $this->getNextValue($objsoc, $objforref, $mode);

--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/github_mod_facture_fournisseur_tulip.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/client_mod_facture_fournisseur_tulip.php
@@ -37,15 +37,15 @@
 class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices

 {

 	/**

-	 * Dolibarr version of the loaded document

-	 * @var string

-	 */

+     * 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

@@ -60,17 +60,17 @@
 	public $name = 'Tulip';

 

 

-	/**

-	 *  Returns the description of the model numbering

-	 *

-	 * 	@return     string      Description Text

-	 */

-	public function info()

-	{

-		global $conf, $langs;

+    /**

+     *  Returns the description of the model numbering

+     *

+     * 	@return     string      Description Text

+     */

+    public function info()

+    {

+        global $conf, $langs;

 

 		// Load translation files required by the page

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

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

 

 		$form = new Form($this->db);

 

@@ -79,8 +79,8 @@
 		$texte .= '<input type="hidden" name="token" value="'.newToken().'">';

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

 		$texte .= '<input type="hidden" name="maskconstinvoice" value="SUPPLIER_INVOICE_TULIP_MASK">';

-		$texte .= '<input type="hidden" name="maskconstreplacement" value="SUPPLIER_REPLACEMENT_TULIP_MASK">';

-		$texte .= '<input type="hidden" name="maskconstcredit" value="SUPPLIER_CREDIT_TULIP_MASK">';

+        $texte .= '<input type="hidden" name="maskconstreplacement" value="SUPPLIER_REPLACEMENT_TULIP_MASK">';

+        $texte .= '<input type="hidden" name="maskconstcredit" value="SUPPLIER_CREDIT_TULIP_MASK">';

 		$texte .= '<input type="hidden" name="maskconstdeposit" value="SUPPLIER_DEPOSIT_TULIP_MASK">';

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

 

@@ -106,36 +106,36 @@
 

 		if ($conf->global->MAIN_FEATURE_LEVEL >= 2)

 		{

-			// Parametrage du prefix des replacement

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

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

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

+    		// Parametrage du prefix des replacement

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

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

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

 

 

-			// Parametrage du prefix des acomptes

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

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

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

+    		// Parametrage du prefix des acomptes

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

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

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

 		}

 

 		$texte .= '</table>';

 		$texte .= '</form>';

 

 		return $texte;

-	}

+    }

 

-	/**

-	 *  Returns a numbering example

-	 *

-	 *  @return     string     Example

-	 */

-	public function getExample()

-	{

-		global $conf, $langs, $mysoc;

+    /**

+     *  Returns a numbering example

+     *

+     *  @return     string     Example

+     */

+    public function getExample()

+    {

+    	global $conf, $langs, $mysoc;

 

-		$old_code_client = $mysoc->code_client;

-		$mysoc->code_client = 'CCCCCCCCCC';

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

+    	$old_code_client = $mysoc->code_client;

+    	$mysoc->code_client = 'CCCCCCCCCC';

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

 		$mysoc->code_client = $old_code_client;

 

 		if (!$numExample)

@@ -143,18 +143,18 @@
 			$numExample = $langs->trans('NotConfigured');

 		}

 		return $numExample;

-	}

+    }

 

 	/**

 	 * Return next value

 	 *

 	 * @param	Societe		$objsoc     Object third party

 	 * @param  	Object	    $object		Object invoice

-	 * @param	string		$mode       'next' for next value or 'last' for last value

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

+     * @param	string		$mode       'next' for next value or 'last' for last value

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

 	 */

-	public function getNextValue($objsoc, $object, $mode = 'next')

-	{

+    public function getNextValue($objsoc, $object, $mode = 'next')

+    {

 		global $db, $conf;

 

 		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

@@ -168,7 +168,8 @@
 			{

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

 			}

-		} elseif (is_object($object) && $object->type == 2) $mask = $conf->global->SUPPLIER_CREDIT_TULIP_MASK;

+		}

+		elseif (is_object($object) && $object->type == 2) $mask = $conf->global->SUPPLIER_CREDIT_TULIP_MASK;

 		elseif (is_object($object) && $object->type == 3) $mask = $conf->global->SUPPLIER_DEPOSIT_TULIP_MASK;

 		else $mask = $conf->global->SUPPLIER_INVOICE_TULIP_MASK;

 		if (!$mask)

@@ -181,18 +182,18 @@
 		$numFinal = get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date);

 

 		return  $numFinal;

-	}

+    }

 

-	/**

-	 * Return next free value

-	 *

-	 *  @param  Societe     $objsoc         Object third party

-	 *  @param  string      $objforref      Object for number to search

-	 *  @param  string      $mode           'next' for next value or 'last' for last value

-	 *  @return string                      Next free value

-	 */

-	public function getNumRef($objsoc, $objforref, $mode = 'next')

-	{

-		return $this->getNextValue($objsoc, $objforref, $mode);

-	}

+    /**

+     * Return next free value

+     *

+     *  @param  Societe     $objsoc         Object third party

+     *  @param  string      $objforref      Object for number to search

+     *  @param  string      $mode           'next' for next value or 'last' for last value

+     *  @return string                      Next free value

+     */

+    public function getNumRef($objsoc, $objforref, $mode = 'next')

+    {

+        return $this->getNextValue($objsoc, $objforref, $mode);

+    }

 }

--- /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/github_modules_facturefournisseur.php
+++ /tmp/dsg/dolibarr/htdocs/core/modules/supplier_invoice/client_modules_facturefournisseur.php
@@ -40,17 +40,17 @@
 	public $error = '';

 

 

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

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

 	/**

 	 *  Return list of active generation models

 	 *

-	 *  @param	DoliDB	$db     			Database handler

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

-	 *  @return	array						List of numbers

+     *  @param	DoliDB	$db     			Database handler

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

+     *  @return	array						List of numbers

 	 */

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

 	{

-		// phpcs:enable

+        // phpcs:enable

 		global $conf;

 

 		$type = 'invoice_supplier';

@@ -77,7 +77,7 @@
 	 *

 	 *   @return	boolean     true if model can be used

 	 */

-	public function isEnabled()

+    public function isEnabled()

 	{

 		return true;

 	}

@@ -86,7 +86,7 @@
 	 *

 	 *   @return    string      Description Text

 	 */

-	public function info()

+    public function info()

 	{

 		global $langs;

 		$langs->load("invoices");

@@ -97,7 +97,7 @@
 	 *

 	 *    @return   string      Example

 	 */

-	public function getExample()

+    public function getExample()

 	{

 		global $langs;

 		$langs->load("invoices");

@@ -108,30 +108,30 @@
 	 *

 	 *   @return	boolean     false if conflict, true if ok

 	 */

-	public function canBeActivated()

+    public function canBeActivated()

 	{

 		return true;

 	}

 

-	/**  Returns next value assigned

-	 *

-	 * @param	Societe		$objsoc     Object third party

-	 * @param  	Object	    $object		Object

-	 * @param	string		$mode       'next' for next value or 'last' for last value

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

-	 */

-	public function getNextValue($objsoc, $object, $mode)

-	{

+    /**  Returns next value assigned

+     *

+     * @param	Societe		$objsoc     Object third party

+     * @param  	Object	    $object		Object

+     * @param	string		$mode       'next' for next value or 'last' for last value

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

+     */

+    public function getNextValue($objsoc, $object, $mode)

+    {

 		global $langs;

 		return $langs->trans("NotAvailable");

-	}

+    }

 

 	/**   Returns version of the model numbering

 	 *

 	 *    @return     string      Value

 	 */

-	public function getVersion()

-	{

+    public function getVersion()

+    {

 		global $langs;

 		$langs->load("admin");

 

@@ -140,5 +140,5 @@
 		if ($this->version == 'dolibarr') return DOL_VERSION;

 		if ($this->version) return $this->version;

 		return $langs->trans("NotAvailable");

-	}

+    }

 }