mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 12:01:23 +01:00
NEW Factorize a lot of code for numbering modules
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
|
||||
|
||||
@@ -83,98 +84,7 @@ abstract class ModelePDFCommandes extends CommonDocGenerator
|
||||
/**
|
||||
* Parent class to manage numbering of Sale Orders
|
||||
*/
|
||||
abstract class ModeleNumRefCommandes
|
||||
abstract class ModeleNumRefCommandes extends CommonNumRefGenerator
|
||||
{
|
||||
/**
|
||||
* @var string Version
|
||||
*/
|
||||
public $version = '';
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default description of the numbering pattern
|
||||
*
|
||||
* @return string Descriptive text
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("orders");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Renvoie un exemple de numerotation
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
public function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("orders");
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns next assigned value
|
||||
*
|
||||
* @param Societe $objsoc Object thirdparty
|
||||
* @param Object $object Object we need next value for
|
||||
* @return string Valeur
|
||||
*/
|
||||
public function getNextValue($objsoc, $object)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns version of numbering module
|
||||
*
|
||||
* @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");
|
||||
}
|
||||
// No overload code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user