diff --git a/htdocs/core/class/commonnumrefgenerator.class.php b/htdocs/core/class/commonnumrefgenerator.class.php index e7a4646f085..c808b4e8be5 100644 --- a/htdocs/core/class/commonnumrefgenerator.class.php +++ b/htdocs/core/class/commonnumrefgenerator.class.php @@ -54,6 +54,27 @@ abstract class CommonNumRefGenerator protected $db; + /** Return model name + * TODO Replace with getName() + * + * @param Translate $langs Object langs + * @return string Model name + */ + public function getNom($langs) + { + return empty($this->name) ? get_class($this) : $this->name; + } + + /** Return model name + * + * @param Translate $langs Object langs + * @return string Model name + */ + public function getName($langs) + { + return empty($this->name) ? get_class($this) : $this->name; + } + /** * Return if a module can be used or not * diff --git a/htdocs/core/modules/asset/modules_asset.php b/htdocs/core/modules/asset/modules_asset.php index 8fa620a0d25..87ac7c723dd 100644 --- a/htdocs/core/modules/asset/modules_asset.php +++ b/htdocs/core/modules/asset/modules_asset.php @@ -29,6 +29,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 @@ -37,42 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFAsset extends CommonDocGenerator { - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -99,98 +64,7 @@ abstract class ModelePDFAsset extends CommonDocGenerator /** * Parent class to manage numbering of Asset */ -abstract class ModeleNumRefAsset +abstract class ModeleNumRefAsset 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("asset@asset"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("asset@asset"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 } diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php index cfe7d406248..682c9fe4de9 100644 --- a/htdocs/core/modules/bank/modules_bank.php +++ b/htdocs/core/modules/bank/modules_bank.php @@ -31,12 +31,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModeleBankAccountDoc extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules diff --git a/htdocs/core/modules/barcode/modules_barcode.class.php b/htdocs/core/modules/barcode/modules_barcode.class.php index 0452ae614f0..1a61ead4131 100644 --- a/htdocs/core/modules/barcode/modules_barcode.class.php +++ b/htdocs/core/modules/barcode/modules_barcode.class.php @@ -22,6 +22,7 @@ * \brief File with parent classes for barcode document modules and numbering modules */ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -50,50 +51,8 @@ abstract class ModeleBarCode /** * Parent class for barcode numbering models */ -abstract class ModeleNumRefBarCode +abstract class ModeleNumRefBarCode extends CommonNumRefGenerator { - /** - * @var string Version - */ - public $version = ''; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** Return default description of numbering model - * - * @param Translate $langs Object langs - * @return string Descriptive text - */ - public function info($langs) - { - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** Return model name - * - * @param Translate $langs Object langs - * @return string Model name - */ - public function getNom($langs) - { - return empty($this->name) ? get_class($this) : $this->name; - } - - /** Return a numbering example - * - * @param Translate $langs Object langs - * @return string Example - */ - public function getExample($langs) - { - $langs->load("bills"); - return $langs->trans("NoExample"); - } - /** * Return next value available * @@ -107,30 +66,6 @@ abstract class ModeleNumRefBarCode return $langs->trans("Function_getNextValue_InModuleNotWorking"); } - /** Return version of module - * - * @return string Version - */ - 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"); - } - /** * Return description of module parameters * diff --git a/htdocs/core/modules/bom/modules_bom.php b/htdocs/core/modules/bom/modules_bom.php index bc2923ac39c..5e639f02554 100644 --- a/htdocs/core/modules/bom/modules_bom.php +++ b/htdocs/core/modules/bom/modules_bom.php @@ -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 @@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFBom extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -65,98 +65,7 @@ abstract class ModelePDFBom extends CommonDocGenerator /** * Parent class to manage numbering of BOMs */ -abstract class ModeleNumRefBoms +abstract class ModeleNumRefBoms 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("mrp"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("mrp"); - 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 } diff --git a/htdocs/core/modules/bookcal/modules_booking.php b/htdocs/core/modules/bookcal/modules_booking.php index 2070af4e404..6025515954e 100644 --- a/htdocs/core/modules/bookcal/modules_booking.php +++ b/htdocs/core/modules/bookcal/modules_booking.php @@ -29,6 +29,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 @@ -37,43 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFBooking extends CommonDocGenerator { - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -102,93 +66,7 @@ abstract class ModelePDFBooking extends CommonDocGenerator /** * Parent class to manage numbering of MyObject */ -abstract class ModeleNumRefBooking +abstract class ModeleNumRefBooking extends CommonNumRefGenerator { - /** - * @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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("mymodule@mymodule"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("mymodule@mymodule"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 } diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index 7241c8c2d45..b367361a60e 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -27,107 +27,16 @@ */ 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.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent /** - * \class ModeleNumRefChequeReceipts - * \brief Cheque Receipts numbering references mother class + * Class parent for cheque Receipts numbering references mother class */ -abstract class ModeleNumRefChequeReceipts +abstract class ModeleNumRefChequeReceipts 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; - } - - /** - * Return the default description of numbering module - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** - * Return numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("bills"); - 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 the next 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 the module numbering version - * - * @return string Value - */ - 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 } /** diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index bb4a4b022fc..4d438407a76 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -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 } diff --git a/htdocs/core/modules/contract/modules_contract.php b/htdocs/core/modules/contract/modules_contract.php index 577ec4be5d9..818e9519198 100644 --- a/htdocs/core/modules/contract/modules_contract.php +++ b/htdocs/core/modules/contract/modules_contract.php @@ -29,7 +29,8 @@ * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -37,12 +38,6 @@ */ abstract class ModelePDFContract extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -68,92 +63,7 @@ abstract class ModelePDFContract extends CommonDocGenerator /** * Parent class for all contract numbering modules */ -class ModelNumRefContracts +class ModelNumRefContracts extends CommonNumRefGenerator { - /** - * @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; - } - - /** - * Return default description of numbering model - * - * @return string text description - */ - public function info() - { - global $langs; - $langs->load("contracts"); - return $langs->trans("NoDescription"); - } - - /** - * Return numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("contracts"); - return $langs->trans("NoExample"); - } - - /** - * Test if existing numbers make problems with numbering - * - * @return boolean false if conflict, true if ok - */ - public function canBeActivated() - { - return true; - } - - /** - * Return next value - * - * @param Societe $objsoc third party object - * @param Object $contract contract object - * @return string Value - */ - public function getNextValue($objsoc, $contract) - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Return numbering version module - * - * @return string Value - */ - 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 } diff --git a/htdocs/core/modules/delivery/modules_delivery.php b/htdocs/core/modules/delivery/modules_delivery.php index 967652fb7a0..eab3918dace 100644 --- a/htdocs/core/modules/delivery/modules_delivery.php +++ b/htdocs/core/modules/delivery/modules_delivery.php @@ -29,6 +29,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -36,11 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -63,101 +59,10 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator } - /** - * \class ModeleNumRefDeliveryOrder - * \brief Classe mere des modeles de numerotation des references de bon de livraison + * Classe mere des modeles de numerotation des references de bon de livraison */ -abstract class ModeleNumRefDeliveryOrder +abstract class ModeleNumRefDeliveryOrder 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("deliveries"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("deliveries"); - 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 Object $object Object delivery - * @return string Valeur - */ - public function getNextValue($objsoc, $object) - { - 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"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index 6c1d297e59e..a6c9d4f3e65 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -25,6 +25,7 @@ * \brief File of class to manage donation document generation */ 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.'/don/class/don.class.php'; @@ -34,11 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; */ abstract class ModeleDon extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -64,96 +60,7 @@ abstract class ModeleDon extends CommonDocGenerator /** * Parent class of donation numbering templates */ -abstract class ModeleNumRefDons +abstract class ModeleNumRefDons 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("bills"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("bills"); - 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 - * - * @return string Valeur - */ - public function getNextValue() - { - 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"); - } + // No overload code } diff --git a/htdocs/core/modules/expedition/modules_expedition.php b/htdocs/core/modules/expedition/modules_expedition.php index 5c638e71425..75c5e6bfeee 100644 --- a/htdocs/core/modules/expedition/modules_expedition.php +++ b/htdocs/core/modules/expedition/modules_expedition.php @@ -29,19 +29,16 @@ * \brief File that contains parent class for sending receipts models * and parent class for sending receipts numbering models */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + /** * Parent class of sending receipts models */ abstract class ModelePdfExpedition extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation models @@ -67,94 +64,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator /** * Parent Class of numbering models of sending receipts references */ -abstract class ModelNumRefExpedition +abstract class ModelNumRefExpedition extends CommonNumRefGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - public $version; - - - /** Return if a model can be used or not - * - * @return boolean true if model can be used - */ - public function isEnabled() - { - return true; - } - - /** - * Return default description of numbering model - * - * @return string text description - */ - public function info() - { - global $langs; - $langs->load("sendings"); - return $langs->trans("NoDescription"); - } - - /** - * Returns numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("sendings"); - return $langs->trans("NoExample"); - } - - /** - * Test if existing numbers make problems with numbering - * - * @return boolean false if conflict, true if ok - */ - public function canBeActivated() - { - return true; - } - - /** - * Returns next value assigned - * - * @param Societe $objsoc Third party object - * @param Object $shipment Shipment object - * @return string Value - */ - public function getNextValue($objsoc, $shipment) - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Returns version of the numbering model - * - * @return string Value - */ - 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 } diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index 5d2575d1fad..b7222eb725c 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.php @@ -16,6 +16,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -23,47 +24,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModeleExpenseReport extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active models generation @@ -104,99 +64,9 @@ function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $ } /** - * \class ModeleNumRefExpenseReport - * \brief Parent class for numbering masks of expense reports + * Parent class for numbering masks of expense reports */ - -abstract class ModeleNumRefExpenseReport +abstract class ModeleNumRefExpenseReport extends CommonNumRefGenerator { - /** - * @var string Version - */ - public $version = ''; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - - /** - * Return if a model can be used or not - * - * @return boolean true if model can be used - */ - public function isEnabled() - { - return true; - } - - /** - * Returns the default description of the numbering model - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("orders"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("trips"); - return $langs->trans("NoExample"); - } - - /** - * Test whether the numbers already in force in the base 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 Object $object Object we need next value for - * @return string Value - */ - public function getNextValue($object) - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Returns the version of the numbering module - * - * @return string Value - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index a9eae1596ce..d57d604f11c 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -28,6 +28,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.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required because used in classes that inherit @@ -39,11 +40,6 @@ use Sprain\SwissQrBill; */ abstract class ModelePDFFactures extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - public $posxpicture; public $posxtva; public $posxup; @@ -61,6 +57,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator public $atleastonediscount = 0; public $atleastoneratenotnull = 0; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -251,98 +248,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator /** * Parent class of invoice reference numbering templates */ -abstract class ModeleNumRefFactures +abstract class ModeleNumRefFactures 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("bills"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("bills"); - 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 Objet societe - * @param Facture $invoice Objet facture - * @param string $mode 'next' for next value or 'last' for last value - * @return string Value - */ - public function getNextValue($objsoc, $invoice, $mode = 'next') - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Renvoi version du modele de numerotation - * - * @return string Valeur - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 8c9fd284390..ba39c364c1d 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -27,6 +27,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -34,12 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFFicheinter extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -65,99 +60,9 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator /** * Parent class numbering models of intervention sheet references */ -abstract class ModeleNumRefFicheinter +abstract class ModeleNumRefFicheinter 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("ficheinter"); - return $langs->trans("NoDescription"); - } - - /** - * Return a numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("ficheinter"); - 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; - } - - /** - * Return the next assigned value - * - * @param Societe $objsoc Object thirdparty - * @param Object $object Object we need next value for - * @return string Value if KO, <0 if KO - */ - public function getNextValue($objsoc = 0, $object = '') - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Return the version of the numbering module - * - * @return string Value - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } @@ -177,7 +82,7 @@ abstract class ModeleNumRefFicheinter function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { // phpcs:enable - global $conf, $langs, $user; + global $conf, $langs; $langs->load("ficheinter"); $error = 0; diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index e38801a052e..ef57eff7aa4 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -30,7 +30,8 @@ * \brief File with parent class for generating holiday to PDF and File of class to manage contract numbering */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -38,12 +39,6 @@ */ abstract class ModelePDFHoliday extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -69,90 +64,7 @@ abstract class ModelePDFHoliday extends CommonDocGenerator /** * Parent class for all holidays numbering modules */ -class ModelNumRefHolidays +class ModelNumRefHolidays extends CommonNumRefGenerator { - /** - * @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; - } - - /** - * Return default description of numbering model - * - * @return string text description - */ - public function info() - { - global $langs; - $langs->load("holiday"); - return $langs->trans("NoDescription"); - } - - /** - * Return numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("holiday"); - return $langs->trans("NoExample"); - } - - /** - * Test if existing numbers make problems with numbering - * - * @return boolean false if conflict, true if ok - */ - public function canBeActivated() - { - return true; - } - - /** - * Return next value - * - * @param Societe $objsoc third party object - * @param Object $holiday Holiday object - * @return string Value if OK, 0 if KO - */ - public function getNextValue($objsoc, $holiday) - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Return numbering version module - * - * @return string Value - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } diff --git a/htdocs/core/modules/hrm/modules_evaluation.php b/htdocs/core/modules/hrm/modules_evaluation.php index 83604e08804..1e10efcd599 100644 --- a/htdocs/core/modules/hrm/modules_evaluation.php +++ b/htdocs/core/modules/hrm/modules_evaluation.php @@ -29,6 +29,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 @@ -37,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFEvaluation extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -64,99 +64,7 @@ abstract class ModelePDFEvaluation extends CommonDocGenerator /** * Parent class to manage numbering of Evaluation */ -abstract class ModeleNumRefEvaluation +abstract class ModeleNumRefEvaluation 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("hrm"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("hrm"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 } diff --git a/htdocs/core/modules/member/modules_member.class.php b/htdocs/core/modules/member/modules_member.class.php index 422d514d6e6..476b9d848aa 100644 --- a/htdocs/core/modules/member/modules_member.class.php +++ b/htdocs/core/modules/member/modules_member.class.php @@ -27,19 +27,15 @@ * \brief File with parent class for generating members to PDF */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + /** * Parent class to manage intervention document templates */ abstract class ModelePDFMember extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -65,13 +61,8 @@ abstract class ModelePDFMember extends CommonDocGenerator /** * Classe mere des modeles de numerotation des references de members */ -abstract class ModeleNumRefMembers +abstract class ModeleNumRefMembers extends CommonNumRefGenerator { - /** - * @var string Version - */ - public $version = ''; - public $code_modifiable; // Editable code public $code_modifiable_invalide; // Modified code if it is invalid @@ -80,101 +71,6 @@ abstract class ModeleNumRefMembers public $code_null; // - /** - * @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("members"); - return $langs->trans("NoDescription"); - } - - /** - * Return name of module - * - * @return string Module name - */ - public function getName() - { - return $this->name; - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("members"); - 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 Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($objsoc, $object) - { - 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"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } /** * Return description of module parameters @@ -197,10 +93,10 @@ abstract class ModeleNumRefMembers } $s = ''; - $s .= $langs->trans("Name").': '.$this->getName().'
'; + $s .= $langs->trans("Name").': '.$this->getName($langs).'
'; $s .= $langs->trans("Version").': '.$this->getVersion().'
'; $s .= $langs->trans("MemberCodeDesc").'
'; - $s .= $langs->trans("ValidityControledByModule").': '.$this->getName().'
'; + $s .= $langs->trans("ValidityControledByModule").': '.$this->getName($langs).'
'; $s .= '
'; $s .= ''.$langs->trans("ThisIsModuleRules").':
'; diff --git a/htdocs/core/modules/movement/modules_movement.php b/htdocs/core/modules/movement/modules_movement.php index a058d685114..864f1bd4c7c 100644 --- a/htdocs/core/modules/movement/modules_movement.php +++ b/htdocs/core/modules/movement/modules_movement.php @@ -30,47 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFMovement extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - public $option_codestockservice; diff --git a/htdocs/core/modules/mrp/modules_mo.php b/htdocs/core/modules/mrp/modules_mo.php index 9938b44086a..9d542be1208 100644 --- a/htdocs/core/modules/mrp/modules_mo.php +++ b/htdocs/core/modules/mrp/modules_mo.php @@ -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 @@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFMo extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -61,103 +61,10 @@ abstract class ModelePDFMo extends CommonDocGenerator } - /** * Parent class to manage numbering of MOs */ -abstract class ModeleNumRefMos +abstract class ModeleNumRefMos 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("mrp"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("mrp"); - 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 } diff --git a/htdocs/core/modules/payment/modules_payment.php b/htdocs/core/modules/payment/modules_payment.php index 1738dc9aea5..d0913c71e23 100644 --- a/htdocs/core/modules/payment/modules_payment.php +++ b/htdocs/core/modules/payment/modules_payment.php @@ -16,102 +16,12 @@ * or see https://www.gnu.org/ */ +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + /** - * \class ModeleNumRefPayments - * \brief Payment numbering references mother class + * Payment numbering references mother class */ - -abstract class ModeleNumRefPayments +abstract class ModeleNumRefPayments 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; - } - - /** - * Return the default description of numbering module - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** - * Return numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("bills"); - 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 the next 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 the module numbering version - * - * @return string Value - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index e5f5e7e09eb..934b7c3a5c0 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -26,54 +26,15 @@ * \brief File with parent class for generating products to PDF and File of class to manage product numbering */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + /** * Parent class to manage intervention document templates */ abstract class ModelePDFProduct extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -97,56 +58,8 @@ abstract class ModelePDFProduct extends CommonDocGenerator /** * Class template for classes of numbering product */ -abstract class ModeleProductCode +abstract class ModeleProductCode extends CommonNumRefGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** Returns the default description of the numbering pattern - * - * @param Translate $langs Object langs - * @return string Descriptive text - */ - public function info($langs) - { - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** Renvoi nom module - * - * @param Translate $langs Object langs - * @return string Nom du module - */ - public function getNom($langs) - { - return empty($this->name) ? $this->nom : $this->name; - } - - - /** Return an example of numbering - * - * @param Translate $langs Object langs - * @return string Example - */ - public function getExample($langs) - { - 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; - } - /** * Return next value available * @@ -160,31 +73,6 @@ abstract class ModeleProductCode return $langs->trans("Function_getNextValue_InModuleNotWorking"); } - - /** Return version of module - * - * @return string Version - */ - 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"); - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoi la liste des modeles de numérotation diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 6522d0d9185..d38e5eef379 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -31,19 +31,15 @@ * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + /** * Parent class to manage intervention document templates */ abstract class ModelePDFProductBatch extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -67,90 +63,7 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator /** * Parent class to manage numbering of batch products */ -abstract class ModeleNumRefBatch +abstract class ModeleNumRefBatch 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("productbatch"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("productbatch"); - 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 Productlot $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 } diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 4349b4b6acc..11a60bc4a4e 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -24,6 +24,7 @@ * and parent class for projects numbering models */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -36,61 +37,11 @@ abstract class ModelePDFProjects extends CommonDocGenerator */ public $db; - /** - * @var string model name - */ - public $name; - /** * @var string model description (short text) */ public $description; - /** - * @var string document type - */ - public $type; - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - /** - * @var string Error code (or message) - */ - public $error = ''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** @@ -118,96 +69,7 @@ abstract class ModelePDFProjects extends CommonDocGenerator /** * Classe mere des modeles de numerotation des references de projets */ -abstract class ModeleNumRefProjects +abstract class ModeleNumRefProjects 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("projects"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("projects"); - 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"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } + // No overload code } diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 1beeee92097..b897e029969 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -28,6 +28,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'; // Requis car utilise dans les classes qui heritent @@ -36,11 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis */ abstract class ModelePDFPropales extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - public $posxpicture; public $posxtva; public $posxup; @@ -84,99 +80,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator /** * Parent class for numbering rules of proposals */ -abstract class ModeleNumRefPropales +abstract class ModeleNumRefPropales 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("propale"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("propale"); - 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 Propal $propal Object commercial proposal - * @return string Valeur - */ - public function getNextValue($objsoc, $propal) - { - 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"); - } + // No overload code } diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php index 1536b550fff..75f6d309cd7 100644 --- a/htdocs/core/modules/reception/modules_reception.php +++ b/htdocs/core/modules/reception/modules_reception.php @@ -22,16 +22,15 @@ * \brief File that contains parent class for sending receipts models * and parent class for sending receipts numbering models */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** * Parent class of sending receipts models */ abstract class ModelePdfReception extends CommonDocGenerator { - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -57,89 +56,7 @@ abstract class ModelePdfReception extends CommonDocGenerator /** * Parent Class of numbering models of sending receipts references */ -abstract class ModelNumRefReception +abstract class ModelNumRefReception extends CommonNumRefGenerator { - public $error = ''; - - public $version; - - - /** - * Return if a model can be used or not - * - * @return boolean true if model can be used - */ - public function isEnabled() - { - return true; - } - - /** - * Return default description of numbering model - * - * @return string text description - */ - public function info() - { - global $langs; - $langs->load("reception"); - return $langs->trans("NoDescription"); - } - - /** - * Returns numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("reception"); - return $langs->trans("NoExample"); - } - - /** - * Test if existing numbers make problems with numbering - * - * @return boolean false if conflit, true if ok - */ - public function canBeActivated() - { - return true; - } - - /** - * Returns next value assigned - * - * @param Societe $objsoc Third party object - * @param Object $reception Reception object - * @return string Value - */ - public function getNextValue($objsoc, $reception) - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** - * Returns version of the numbering model - * - * @return string Value - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } - return $langs->trans("NotAvailable"); - } + // No overload code } diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index 105333d815b..f5757f00bac 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -25,6 +25,7 @@ * \brief File with parent class of submodules to manage numbering and document generation */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -32,11 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModeleThirdPartyDoc extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -61,63 +57,8 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator /** * Parent class for third parties code generators */ -abstract class ModeleThirdPartyCode +abstract class ModeleThirdPartyCode extends CommonNumRefGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var array Error code (or message) array - */ - public $errors; - - - /** Returns the default description of the numbering pattern - * - * @param Translate $langs Object langs - * @return string Descriptive text - */ - public function info($langs) - { - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** Return name of module - * - * @param Translate $langs Object langs - * @return string Nom du module - */ - public function getNom($langs) - { - return $this->name; - } - - - /** Return an example of numbering - * - * @param Translate $langs Object langs - * @return string Example - */ - public function getExample($langs) - { - $langs->load("bills"); - 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; - } - /** * Return next value available * @@ -131,30 +72,6 @@ abstract class ModeleThirdPartyCode return $langs->trans("Function_getNextValue_InModuleNotWorking"); } - - /** - * Return version of module - * - * @return string Version - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Renvoie la liste des modeles de numérotation @@ -273,74 +190,8 @@ abstract class ModeleThirdPartyCode /** * Parent class for third parties accountancy code generators */ -abstract class ModeleAccountancyCode +abstract class ModeleAccountancyCode extends CommonNumRefGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - - /** - * Return description of module - * - * @param Translate $langs Object langs - * @return string Description of module - */ - public function info($langs) - { - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of result returned by getNextValue - * - * @param Translate $langs Object langs - * @param societe $objsoc Object thirdparty - * @param int $type Type of third party (1:customer, 2:supplier, -1:autodetect) - * @return string Example - */ - public function getExample($langs, $objsoc = 0, $type = -1) - { - $langs->load("bills"); - 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; - } - - /** - * Return version of module - * - * @return string Version - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } else { - return $langs->trans("NotAvailable"); - } - } - /** * Return description of module parameters * diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php index d1dc684d1d2..5966c27755c 100644 --- a/htdocs/core/modules/stock/modules_stock.php +++ b/htdocs/core/modules/stock/modules_stock.php @@ -23,47 +23,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFStock extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules diff --git a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php index 00b1b23f684..c68ae5d3d7a 100644 --- a/htdocs/core/modules/stocktransfer/modules_stocktransfer.php +++ b/htdocs/core/modules/stocktransfer/modules_stocktransfer.php @@ -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 @@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFStockTransfer extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -65,91 +65,7 @@ abstract class ModelePDFStockTransfer extends CommonDocGenerator /** * Parent class to manage numbering of StockTransfer */ -abstract class ModeleNumRefStockTransfer +abstract class ModeleNumRefStockTransfer 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("stocktransfer@stocktransfer"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("stocktransfer@stocktransfer"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 } diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index b59f6f9f78a..c42cfc88c8c 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -26,6 +26,7 @@ * and parent class for supplier invoices numbering models */ 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 @@ -34,12 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation models @@ -64,93 +59,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator /** * Parent Class of numbering models of suppliers invoices references */ -abstract class ModeleNumRefSuppliersInvoices +abstract class ModeleNumRefSuppliersInvoices extends CommonNumRefGenerator { - /** - * @var string Version - */ - public $version = ''; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - - /** Return if a model can be used or not - * - * @return boolean true if model can be used - */ - public function isEnabled() - { - return true; - } - - /** Returns the default description of the model numbering - * - * @return string Description Text - */ - public function info() - { - global $langs; - $langs->load("invoices"); - return $langs->trans("NoDescription"); - } - - /** Returns a numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("invoices"); - return $langs->trans("NoExample"); - } - - /** Tests if the numbers already in force in the database do not cause conflicts that would prevent this numbering. - * - * @return boolean false if conflict, true if ok - */ - 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 = 'next') - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** Returns version of the model numbering - * - * @return string Value - */ - 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 } diff --git a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php index a68983c2ee8..c59db0ada98 100644 --- a/htdocs/core/modules/supplier_order/modules_commandefournisseur.php +++ b/htdocs/core/modules/supplier_order/modules_commandefournisseur.php @@ -29,6 +29,7 @@ * and parent class for supplier orders numbering models */ 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 @@ -54,12 +55,6 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator public $atleastoneratenotnull = 0; public $atleastonediscount = 0; - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation models @@ -86,92 +81,7 @@ abstract class ModelePDFSuppliersOrders extends CommonDocGenerator /** * Parent Class of numbering models of suppliers orders references */ -abstract class ModeleNumRefSuppliersOrders +abstract class ModeleNumRefSuppliersOrders extends CommonNumRefGenerator { - /** - * @var string Version - */ - public $version = ''; - - /** - * @var string Error code (or message) - */ - public $error = ''; - - - /** Return if a model can be used or not - * - * @return boolean true if model can be used - */ - public function isEnabled() - { - return true; - } - - /** Returns default description of numbering model - * - * @return string Description Text - */ - public function info() - { - global $langs; - $langs->load("orders"); - return $langs->trans("NoDescription"); - } - - /** Returns a numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("orders"); - return $langs->trans("NoExample"); - } - - /** Tests if existing numbers make problems with numbering - * - * @return boolean false if conflict, true if ok - */ - public function canBeActivated() - { - return true; - } - - /** Returns next value assigned - * - * @param Societe $objsoc Object third party - * @param Object $object Object - * @return string Valeur - */ - public function getNextValue($objsoc = 0, $object = '') - { - global $langs; - return $langs->trans("NotAvailable"); - } - - /** Returns version of the numbering model - * - * @return string Value - */ - 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 } diff --git a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php index 4269140332b..a748d734d51 100644 --- a/htdocs/core/modules/supplier_payment/modules_supplier_payment.php +++ b/htdocs/core/modules/supplier_payment/modules_supplier_payment.php @@ -17,6 +17,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; /** @@ -24,47 +25,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; */ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation models @@ -91,97 +51,7 @@ abstract class ModelePDFSuppliersPayments extends CommonDocGenerator * * Payment numbering references mother class */ - -abstract class ModeleNumRefSupplierPayments +abstract class ModeleNumRefSupplierPayments 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; - } - - /** - * Return the default description of numbering module - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("bills"); - return $langs->trans("NoDescription"); - } - - /** - * Return numbering example - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("bills"); - 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 the next 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 the module numbering version - * - * @return string Value - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); - - if ($this->version == 'development') { - return $langs->trans("VersionDevelopment"); - } elseif ($this->version == 'experimental') { - return $langs->trans("VersionExperimental"); - } elseif ($this->version == 'dolibarr') { - return DOL_VERSION; - } elseif ($this->version) { - return $this->version; - } - return $langs->trans("NotAvailable"); - } + // No overload code } diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index b4654ee488f..d54b9629178 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -28,6 +28,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'; // Requis car utilise dans les classes qui heritent @@ -36,12 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis */ abstract class ModelePDFSupplierProposal extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -67,99 +62,7 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator /** * Classe mere des modeles de numerotation des references de propales */ -abstract class ModeleNumRefSupplierProposal +abstract class ModeleNumRefSupplierProposal 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("supplier_proposal"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("supplier_proposal"); - 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 SupplierProposal $supplier_proposal Object commercial proposal - * @return string Valeur - */ - public function getNextValue($objsoc, $supplier_proposal) - { - 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"); - } + // No overload code } diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php index dc61ca41855..7a296d85f15 100644 --- a/htdocs/core/modules/takepos/modules_takepos.php +++ b/htdocs/core/modules/takepos/modules_takepos.php @@ -26,105 +26,13 @@ * \brief File containing the parent class for the numbering of cash register receipts */ +require_once DOL_DOCUMENT_ROOT.'/core/class/commonnumrefgenerator.class.php'; + /** - * \class ModeleNumRefTakepos - * \brief Classe mere des modeles de numerotation des tickets de caisse + * Classe mere des modeles de numerotation des tickets de caisse */ -abstract class ModeleNumRefTakepos +abstract class ModeleNumRefTakepos 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("cashdesk@cashdesk"); - return $langs->trans("NoDescription"); - } - - /** - * Return an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load('cashdesk@cashdesk'); - 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 thirdparty - * @param Facture $invoice Object invoice - * @param string $mode 'next' for next value or 'last' for last value - * @return string Value if KO, <0 if KO - */ - public function getNextValue($objsoc = null, $invoice = null, $mode = 'next') - { - global $langs; - return $langs->trans('NotAvailable'); - } - - /** - * Renvoi version du modele de 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'); - } + // No overload code } diff --git a/htdocs/core/modules/ticket/modules_ticket.php b/htdocs/core/modules/ticket/modules_ticket.php index 788b5dbd863..b8c2754ad12 100644 --- a/htdocs/core/modules/ticket/modules_ticket.php +++ b/htdocs/core/modules/ticket/modules_ticket.php @@ -26,13 +26,14 @@ */ 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 @@ -58,103 +59,7 @@ abstract class ModelePDFTicket extends CommonDocGenerator /** * Classe mere des modeles de numerotation des references de projets */ -abstract class ModeleNumRefTicket +abstract class ModeleNumRefTicket 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("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 Ticket $ticket Object ticket - * @return string Valeur - */ - public function getNextValue($objsoc, $ticket) - { - 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"); - } + // No overload code } diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php index 2c4aebe1e6f..0e31611b3db 100644 --- a/htdocs/core/modules/usergroup/modules_usergroup.class.php +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -19,31 +19,20 @@ * or see https://www.gnu.org/ */ - -/** - * \class ModeleProductCode - * \brief Parent class for product code generators - */ - /** * \file htdocs/core/modules/contract/modules_contract.php * \ingroup contract * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering */ - require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + /** * Parent class to manage intervention document templates */ abstract class ModelePDFUserGroup extends CommonDocGenerator { - /** - * @var string Error code (or message) - */ - public $error = ''; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules diff --git a/htdocs/core/modules/workstation/modules_workstation.php b/htdocs/core/modules/workstation/modules_workstation.php index 23cfec1c19d..afa884c27d7 100644 --- a/htdocs/core/modules/workstation/modules_workstation.php +++ b/htdocs/core/modules/workstation/modules_workstation.php @@ -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 @@ -38,7 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFWorkstation extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -61,103 +61,10 @@ abstract class ModelePDFWorkstation extends CommonDocGenerator } - /** * Parent class to manage numbering of Workstation */ -abstract class ModeleNumRefWorkstation +abstract class ModeleNumRefWorkstation 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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("workstation@workstation"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("workstation@workstation"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php index 1037dba63b6..11b103bc5de 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/modules_myobject.php @@ -29,7 +29,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.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/commonnumrefgenerator.class.php'; /** @@ -37,43 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFMyObject extends CommonDocGenerator { - - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -85,8 +48,6 @@ abstract class ModelePDFMyObject extends CommonDocGenerator public static function liste_modeles($db, $maxfilenamelength = 0) { // phpcs:enable - global $conf; - $type = 'myobject'; $list = array(); @@ -98,97 +59,10 @@ abstract class ModelePDFMyObject extends CommonDocGenerator } - /** * Parent class to manage numbering of MyObject */ -abstract class ModeleNumRefMyObject +abstract class ModeleNumRefMyObject extends CommonNumRefGenerator { - /** - * @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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("mymodule@mymodule"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("mymodule@mymodule"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 } diff --git a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php index 1402e5d7f5f..3bd754881a2 100644 --- a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php +++ b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentcandidature.php @@ -29,6 +29,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 @@ -66,91 +67,5 @@ abstract class ModelePDFRecruitmentCandidature extends CommonDocGenerator */ abstract class ModeleNumRefRecruitmentCandidature { - /** - * @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 template - * - * @return string Descriptive text - */ - public function info() - { - global $langs; - $langs->load("recruitment"); - return $langs->trans("NoDescription"); - } - - /** - * Returns an example of numbering - * - * @return string Example - */ - public function getExample() - { - global $langs; - $langs->load("recruitment"); - return $langs->trans("NoExample"); - } - - /** - * Checks if the numbers already in the database do not - * cause conflicts that would prevent this numbering working. - * - * @param Object $object Object we need next value for - * @return boolean false if conflict, true if ok - */ - public function canBeActivated($object) - { - return true; - } - - /** - * Returns next assigned value - * - * @param Object $object Object we need next value for - * @return string Valeur - */ - public function getNextValue($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 overloaded code } diff --git a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php index 9fabad92bc7..ba9729aa047 100644 --- a/htdocs/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php +++ b/htdocs/recruitment/core/modules/recruitment/modules_recruitmentjobposition.php @@ -38,42 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFRecruitmentJobPosition extends CommonDocGenerator { - /** - * @var int page_largeur - */ - public $page_largeur; - - /** - * @var int page_hauteur - */ - public $page_hauteur; - - /** - * @var array format - */ - public $format; - - /** - * @var int marge_gauche - */ - public $marge_gauche; - - /** - * @var int marge_droite - */ - public $marge_droite; - - /** - * @var int marge_haute - */ - public $marge_haute; - - /** - * @var int marge_basse - */ - public $marge_basse; - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules @@ -102,5 +66,5 @@ abstract class ModelePDFRecruitmentJobPosition extends CommonDocGenerator */ abstract class ModeleNumRefRecruitmentJobPosition extends CommonNumRefGenerator { - // No overloaded code + // No overload code }