FIX travis errors

This commit is contained in:
VESSILLER 2020-03-12 18:21:44 +01:00
parent 70ebc61c1f
commit 1379b2ce87
4 changed files with 92 additions and 57 deletions

View File

@ -3737,8 +3737,7 @@ class Facture extends CommonInvoice
// Include file with class // Include file with class
$dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) { foreach ($dirmodels as $reldir) {
$dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/'); $dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/');

View File

@ -31,17 +31,35 @@ dol_include_once('/core/modules/takepos/modules_takepos.php');
*/ */
class mod_takepos_ref_simple extends ModeleNumRefTakepos class mod_takepos_ref_simple extends ModeleNumRefTakepos
{ {
var $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /**
var $prefix = 'TK'; * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr'
var $error = ''; * @var string
var $nom = 'Simple'; */
public $version = 'dolibarr';
/**
* Prefix
* @var string
*/
public $prefix = 'TK';
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* Name
* @var string
*/
public $nom = 'Simple';
/** /**
* Return description of numbering module * Return description of numbering module
* *
* @return string Text with description * @return string Text with description
*/ */
function info() public function info()
{ {
global $langs; global $langs;
@ -53,7 +71,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* *
* @return string Example * @return string Example
*/ */
function getExample() public function getExample()
{ {
return $this->prefix . '0-0501-0001'; return $this->prefix . '0-0501-0001';
} }
@ -64,7 +82,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* *
* @return boolean false si conflit, true si ok * @return boolean false si conflit, true si ok
*/ */
function canBeActivated() public function canBeActivated()
{ {
global $conf, $langs, $db; global $conf, $langs, $db;
@ -103,7 +121,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Next value * @return string Next value
*/ */
function getNextValue($objsoc = null, $invoice = null, $mode = 'next') public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
{ {
global $db; global $db;
@ -168,7 +186,7 @@ class mod_takepos_ref_simple extends ModeleNumRefTakepos
* @param Object $objforref Object for number to search * @param Object $objforref Object for number to search
* @return string Next free value * @return string Next free value
*/ */
function getNumRef($objsoc, $objforref) public function getNumRef($objsoc, $objforref)
{ {
return $this->getNextValue($objsoc, $objforref); return $this->getNextValue($objsoc, $objforref);
} }

View File

@ -33,16 +33,29 @@ dol_include_once('/core/modules/takepos/modules_takepos.php');
*/ */
class mod_takepos_ref_universal extends ModeleNumRefTakepos class mod_takepos_ref_universal extends ModeleNumRefTakepos
{ {
var $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' /**
var $error = ''; * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr'
var $nom = 'Universal'; * @var string
*/
public $version = 'dolibarr';
/**
* @var string Error code (or message)
*/
public $error = '';
/**
* Name
* @var string
*/
public $nom = 'Universal';
/** /**
* Renvoi la description du modele de numerotation * Renvoi la description du modele de numerotation
* *
* @return string Texte descripif * @return string Texte descripif
*/ */
function info() public function info()
{ {
global $conf, $langs; global $conf, $langs;
@ -83,7 +96,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
* *
* @return string Example * @return string Example
*/ */
function getExample() public function getExample()
{ {
global $conf, $langs, $mysoc; global $conf, $langs, $mysoc;
@ -99,14 +112,14 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
} }
/** /**
* Return next free value * Return next free value
* *
* @param Societe $objsoc Object thirdparty * @param Societe $objsoc Object thirdparty
* @param Facture $invoice Object invoice * @param Facture $invoice Object invoice
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Value if KO, <0 if KO * @return string Value if KO, <0 if KO
*/ */
function getNextValue($objsoc = 0, $invoice = null, $mode = 'next') public function getNextValue($objsoc = 0, $invoice = null, $mode = 'next')
{ {
global $db, $conf; global $db, $conf;
@ -124,7 +137,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
$entity = getEntity('invoicenumber', 1, $invoice); $entity = getEntity('invoicenumber', 1, $invoice);
$pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0; $pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0;
$mask = str_replace('{TN}' , $pos_source, $mask); $mask = str_replace('{TN}', $pos_source, $mask);
$numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $invoice->date, $mode, false, null, $entity); $numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $invoice->date, $mode, false, null, $entity);
return $numFinal; return $numFinal;
@ -138,7 +151,7 @@ class mod_takepos_ref_universal extends ModeleNumRefTakepos
* @param Object $objforref Object for number to search * @param Object $objforref Object for number to search
* @return string Next free value * @return string Next free value
*/ */
function getNumRef($objsoc, $objforref) public function getNumRef($objsoc, $objforref)
{ {
return $this->getNextValue($objsoc, $objforref); return $this->getNextValue($objsoc, $objforref);
} }

View File

@ -33,71 +33,76 @@
*/ */
abstract class ModeleNumRefTakepos abstract class ModeleNumRefTakepos
{ {
var $error=''; /**
public $version = ''; * @var string Error code (or message)
*/
public $error='';
/**
* Return if a module can be used or not public $version = '';
*
* @return boolean true if module can be used /**
*/ * Return if a module can be used or not
function isEnabled() *
* @return boolean true if module can be used
*/
public function isEnabled()
{ {
return true; return true;
} }
/** /**
* Renvoi la description par defaut du modele de numerotation * Renvoi la description par defaut du modele de numerotation
* *
* @return string Texte descripif * @return string Texte descripif
*/ */
function info() public function info()
{ {
global $langs; global $langs;
$langs->load("cashdesk@cashdesk"); $langs->load("cashdesk@cashdesk");
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
/** /**
* Renvoi un exemple de numerotation * Return an example of numbering
* *
* @return string Example * @return string Example
*/ */
function getExample() public function getExample()
{ {
global $langs; global $langs;
$langs->load('cashdesk@cashdesk'); $langs->load('cashdesk@cashdesk');
return $langs->trans('NoExample'); return $langs->trans('NoExample');
} }
/** /**
* Test si les numeros deja en vigueur dans la base ne provoquent pas de * Checks if the numbers already in force in the data base do not
* de conflits qui empechera cette numerotation de fonctionner. * cause conflicts that would prevent this numbering from working.
* *
* @return boolean false si conflit, true si ok * @return boolean false if conflict, true if ok
*/ */
function canBeActivated() public function canBeActivated()
{ {
return true; return true;
} }
/** /**
* Renvoi prochaine valeur attribuee * Renvoi prochaine valeur attribuee
* *
* @return string Valeur * @return string Valeur
*/ */
function getNextValue() public function getNextValue()
{ {
global $langs; global $langs;
return $langs->trans('NotAvailable'); return $langs->trans('NotAvailable');
} }
/** /**
* Renvoi version du module numerotation * Renvoi version du modele de numerotation
* *
* @return string Valeur * @return string Valeur
*/ */
function getVersion() public function getVersion()
{ {
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
@ -108,4 +113,4 @@ abstract class ModeleNumRefTakepos
if ($this->version) return $this->version; if ($this->version) return $this->version;
return $langs->trans('NotAvailable'); return $langs->trans('NotAvailable');
} }
} }