mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-06 17:13:03 +01:00
* Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add typing hint to fix phan notice. * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add typing hint in phan config to fix phan notice. * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint to fix phan notice. * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for linkedObjectBlock * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for linkedObjectBlock * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for linkedObjects * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) # Qual: Fix PhanPluginUnknownObjectMethodCall (add typing hints) Add/improve typing hint for PhanPluginUnknownObjectMethodCall * Fix: MemberNumRefNumbers getExample does not take any arguments Found thanks to adding the typing for phan! * Qual: Correct forced type for $module * Qual: Ignore phan false positive * Qual: phan/Correct module type and ignore false positive * Qual: phan/Ignore false positive * Qual: phan/Ignore false positive, replace depr.prop with method * Qual: Fix typing for count by adding is_array check * Qual: replace depr.prop `nom` with method * Qual: phan/Correct module type and ignore false positive * Qual: phan/Correct module type and ignore false positive * Qual: phan/Correct module type and ignore false positive * Qual: phan/Fix depr.prop with getter and ignore false positive * Qual: phan/Correct module type and ignore false positive * Qual: phan/Correct module type and ignore false positive * Qual: phan/Correct module type and ignore false positive * Qual: Improve typing for mymodule template * Make info method arguments match calls * Make PrintingDriver abstract class because we added abstract methods * Add phpdoc typing for phan * Update getExample function signature for compatibility * Update getExample function signature for compatibility * Update getExample function signature for compatibility * Update header wit correct information * Update getExample method signature * Update getExample method signature * Correct reference to class in comment * Force php phan typing for numbering modules * Correct $_GLOBALS to $GLOBALS * Add phpdoc to indicat type of properties * Correct default to null * Improve getNextValue typehint * Improve getNextValue typehint * Qual: Improve ModeleNumRefTakepos typing * Qual: Improve ModeleNumRefRecruitmentJobPosition typing * Fix default for $langs * Do not use non-existing ModeleNumRefTakepos::nom * Allow getNextValue argument to be null * Correct $_GLOBAL into $GLOBALS * Improve typing for ldap functions * Allow null for outputlangs argument * Improve typing for printOriginLine * Improve typing for linkedObject access * Fix PhanTypeMismatchArgumentNullableInternal and optimize * Fix PhanPossiblyUndeclaredVariable by setting default value * Ignore PhanPluginDuplicateExpressionAssignmentOperation - needs PHP7.4 * getToolTip does not accept null, changed to '' * Improve getNextValue typing * Change PrintingDriver back to normal class (instantiated) And add errors for functions that should be overloaded * Adjust pringOriginLine typing to match parent * Fix phpdoc for getNextValue * Fix phan typing * Add/Improve phpdoc typing hints * Qual: Adjustments to match typing * Update typing for unit, use GETPOSTINT * ModeleNumRefTask needs Project * Fix several notices appearing after update from develop * Index for choices is int, use GETPOSTINT * Qual: Ignore empty foreach * Force BOMLine on object line * phan typing to indicate that linked objects are BOM * Type the correct variable name (phan) * Add typing for $langs * Type to CommonNumRefGenerator (no class for availabilities) * Resolve several phan notices after update from dev branch * Extra typing fixes * Move common attributes to parent class (phan) * Add typing to Calendar class * Improve typing hints * Add typing to pdf_eagle_proforma * Qual: Add typing for token in generic_oauthcallback.php * Add typing for objMod * Correct getNextValue function signature (phpstan) * Fix typing (phpstan) * Update version declarations (fix phpstan) * Fix phpstan typing issues * Adjust typing (phpstan) * Qual: Update baseline & conf to detect 25% of PhanPluginUnknownObjectMethodCall
176 lines
4.0 KiB
PHP
176 lines
4.0 KiB
PHP
<?php
|
|
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
|
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
* or see https://www.gnu.org/
|
|
*/
|
|
|
|
/**
|
|
* \file htdocs/core/class/commonnumrefgenerator.class.php
|
|
* \ingroup core
|
|
* \brief File of parent class for num ref generators
|
|
*/
|
|
|
|
|
|
/**
|
|
* Parent class for number ref generators
|
|
*/
|
|
abstract class CommonNumRefGenerator
|
|
{
|
|
/**
|
|
* @var string Model name
|
|
*/
|
|
public $name = '';
|
|
|
|
/**
|
|
* @var string Version, possible values are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'''|'development'|'experimental'|'dolibarr' Version
|
|
*/
|
|
public $version = '';
|
|
|
|
/**
|
|
* @var string Error code (or message)
|
|
*/
|
|
public $error = '';
|
|
|
|
/**
|
|
* @var string[] Array of error strings
|
|
*/
|
|
public $errors = array();
|
|
|
|
/**
|
|
* @var DoliDB Database handler.
|
|
*/
|
|
protected $db;
|
|
|
|
/**
|
|
* @var int<0,1> Is Code optional 0 or 1
|
|
*/
|
|
public $code_null;
|
|
|
|
/**
|
|
* @var int<0,1> Is Code editable 0 or 1
|
|
*/
|
|
public $code_modifiable;
|
|
|
|
/**
|
|
* @var int<0,1> Is Code editable if invalid 0 or 1
|
|
*/
|
|
public $code_modifiable_invalide;
|
|
|
|
/**
|
|
* @var int<0,1> Is Code editable if null
|
|
*/
|
|
public $code_modifiable_null;
|
|
|
|
/**
|
|
* @var int<0,1> Automatic numbering 0 or 1
|
|
*/
|
|
public $code_auto;
|
|
|
|
/**
|
|
* @var int<0,1> The third party prefix field must be filled in when using {pre}
|
|
*/
|
|
public $prefixIsRequired;
|
|
|
|
/** Return model name
|
|
*
|
|
* @param Translate $langs Object langs
|
|
* @return string Model name
|
|
* @deprecated Use getName() instead
|
|
* @see getName()
|
|
*/
|
|
public function getNom($langs)
|
|
{
|
|
return $this->getName($langs);
|
|
}
|
|
|
|
/** 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
|
|
*
|
|
* @return boolean true if module can be used
|
|
*/
|
|
public function isEnabled()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Returns the default description of the numbering template
|
|
*
|
|
* @param Translate $langs Language
|
|
* @return string Descriptive text
|
|
*/
|
|
public function info($langs)
|
|
{
|
|
return $langs->trans("NoDescription");
|
|
}
|
|
|
|
/**
|
|
* Checks if the numbers already in the database do not
|
|
* cause conflicts that would prevent this numbering working.
|
|
*
|
|
* @param CommonObject $object Object we need next value for
|
|
* @return boolean false if conflict, true if ok
|
|
*/
|
|
public function canBeActivated($object)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 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");
|
|
}
|
|
|
|
|
|
/**
|
|
* Return an example of numbering
|
|
*
|
|
* @return string Example
|
|
*/
|
|
abstract public function getExample();
|
|
}
|