2
0
forked from Wavyzz/dolibarr

Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur
2024-03-10 01:53:32 +01:00
21 changed files with 165 additions and 118 deletions

View File

@@ -183,9 +183,40 @@ $VALID_MODULE_MAPPING = array(
'zapier' => 'Zapier',
);
// From ExtraFields class
$EXTRAFIELDS_TYPE2LABEL = array(
'varchar' => 'String1Line',
'text' => 'TextLongNLines',
'html' => 'HtmlText',
'int' => 'Int',
'double' => 'Float',
'date' => 'Date',
'datetime' => 'DateAndTime',
//'datetimegmt'=>'DateAndTimeUTC',
'boolean' => 'Boolean', // Remove as test
'price' => 'ExtrafieldPrice',
'pricecy' => 'ExtrafieldPriceWithCurrency',
'phone' => 'ExtrafieldPhone',
'mail' => 'ExtrafieldMail',
'url' => 'ExtrafieldUrl',
'ip' => 'ExtrafieldIP',
'icon' => 'Icon',
'password' => 'ExtrafieldPassword',
'select' => 'ExtrafieldSelect',
'sellist' => 'ExtrafieldSelectList',
'radio' => 'ExtrafieldRadio',
'checkbox' => 'ExtrafieldCheckBox',
'chkbxlst' => 'ExtrafieldCheckBoxFromList',
'link' => 'ExtrafieldLink',
'separate' => 'ExtrafieldSeparator',
);
$moduleNameRegex = '/^(?:'.implode('|', array_merge(array_keys($DEPRECATED_MODULE_MAPPING), array_keys($VALID_MODULE_MAPPING), array('\$modulename'))).')$/';
$deprecatedModuleNameRegex = '/^(?!(?:'.implode('|', array_keys($DEPRECATED_MODULE_MAPPING)).')$).*/';
$extraFieldTypeRegex = '/^(?:'.implode('|', array_keys($EXTRAFIELDS_TYPE2LABEL)).')$/';
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
@@ -270,7 +301,8 @@ return [
'/^isModEnabled$/' => [0, $moduleNameRegex, 'UnknownModuleName'],
// Note: trick to have different key for same regex:
'/^isModEnable[d]$/' => [0, $deprecatedModuleNameRegex, "DeprecatedModuleName"],
'/^sanitizeVal$/' => [1, $sanitizeRegex],
'/^sanitizeVal$/' => [1, $sanitizeRegex,"UnknownSanitizeType"],
'/^\\\\ExtraFields::addExtraField$/' => [2, $extraFieldTypeRegex,"UnknownExtrafieldTypeBack"],
],
'plugins' => [
__DIR__.'/plugins/NoVarDumpPlugin.php',

View File

@@ -773,7 +773,7 @@ class AccountancyCategory // extends CommonObject
*
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
* @param int $active 1= active, 0=not active
* @return array|int Array of groups or -1 if error
* @return array<array{code:string,label:string,formula:string,position:string,category_type:string,sens:string,bc:string}>|int Array of groups or -1 if error
* @see getCatsCpts(), getCptsCat()
*/
public function getCats($categorytype = -1, $active = 1)

View File

@@ -2464,7 +2464,7 @@ class BookKeeping extends CommonObject
* Get list of fiscal period
*
* @param string $filter Filter
* @return array|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...]
* @return array<array{id:int,data_start:string,date_end:string,label:string}>|int Return integer <0 if KO, Fiscal periods : [[id, date_start, date_end, label], ...]
*/
public function getFiscalPeriods($filter = '')
{

View File

@@ -47,7 +47,7 @@ $langs->loadLangs(array("errors", "admin", "modulebuilder"));
// if we set another view list mode, we keep it (till we change one more time)
if (GETPOSTISSET('mode')) {
$mode = GETPOST('mode', 'alpha');
if ($mode =='common' || $mode =='commonkanban') {
if ($mode == 'common' || $mode == 'commonkanban') {
dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
}
} else {
@@ -78,18 +78,18 @@ if (!$user->admin) {
}
$familyinfo = array(
'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
'srm'=>array('position'=>'007', 'label'=>$langs->trans("ModuleFamilySrm")),
'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
'products'=>array('position'=>'012', 'label'=>$langs->trans("ModuleFamilyProducts")),
'projects'=>array('position'=>'015', 'label'=>$langs->trans("ModuleFamilyProjects")),
'ecm'=>array('position'=>'018', 'label'=>$langs->trans("ModuleFamilyECM")),
'technic'=>array('position'=>'021', 'label'=>$langs->trans("ModuleFamilyTechnic")),
'portal'=>array('position'=>'040', 'label'=>$langs->trans("ModuleFamilyPortal")),
'interface'=>array('position'=>'050', 'label'=>$langs->trans("ModuleFamilyInterface")),
'base'=>array('position'=>'060', 'label'=>$langs->trans("ModuleFamilyBase")),
'other'=>array('position'=>'100', 'label'=>$langs->trans("ModuleFamilyOther")),
'hr' => array('position' => '001', 'label' => $langs->trans("ModuleFamilyHr")),
'crm' => array('position' => '006', 'label' => $langs->trans("ModuleFamilyCrm")),
'srm' => array('position' => '007', 'label' => $langs->trans("ModuleFamilySrm")),
'financial' => array('position' => '009', 'label' => $langs->trans("ModuleFamilyFinancial")),
'products' => array('position' => '012', 'label' => $langs->trans("ModuleFamilyProducts")),
'projects' => array('position' => '015', 'label' => $langs->trans("ModuleFamilyProjects")),
'ecm' => array('position' => '018', 'label' => $langs->trans("ModuleFamilyECM")),
'technic' => array('position' => '021', 'label' => $langs->trans("ModuleFamilyTechnic")),
'portal' => array('position' => '040', 'label' => $langs->trans("ModuleFamilyPortal")),
'interface' => array('position' => '050', 'label' => $langs->trans("ModuleFamilyInterface")),
'base' => array('position' => '060', 'label' => $langs->trans("ModuleFamilyBase")),
'other' => array('position' => '100', 'label' => $langs->trans("ModuleFamilyOther")),
);
$param = '';
@@ -360,7 +360,7 @@ llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss,
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("NativeModules"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
$arrayofnatures = array('core' => $langs->transnoentitiesnoconv("NativeModules"), 'external' => $langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
$arrayofwarnings = array(); // Array of warning each module want to show when activated
$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
$filename = array();
@@ -395,6 +395,7 @@ foreach ($modulesdir as $dir) {
$res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
if (class_exists($modName)) {
$objMod = new $modName($db);
'@phan-var-force DolibarrModules $objMod';
$modNameLoaded[$modName] = $dir;
if (!$objMod->numero > 0 && $modName != 'modUser') {
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
@@ -443,6 +444,7 @@ foreach ($modulesdir as $dir) {
} else {
$familykey = $objMod->family;
}
'@phan-var-force string $familykey'; // if not, phan considers $familykey may be null
$moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) {
@@ -603,10 +605,10 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter = '<div class="valignmiddle">';
$moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss' => 'reposition'));
$moreforfilter .= dolGetButtonTitleSeparator();
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss' => 'reposition'));
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss' => 'reposition'));
$moreforfilter .= '</li></ul></div>';
$moreforfilter .= '<div class="divfilteralone colorbacktimesheet float valignmiddle">';
@@ -618,7 +620,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '</div>';
if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
$array_version = array('stable' => $langs->transnoentitiesnoconv("Stable"));
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 0) {
$array_version['deprecated'] = $langs->trans("Deprecated");
}
@@ -632,7 +634,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>';
}
$array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled"));
$array_status = array('active' => $langs->transnoentitiesnoconv("Enabled"), 'disabled' => $langs->transnoentitiesnoconv("Disabled"));
$moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
$moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
$moreforfilter .= '</div>';

View File

@@ -231,7 +231,7 @@ if ($modecompta == "CREANCES-DETTES") {
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$arraylist = array('no'=>$langs->trans("None"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
$arraylist = array('no' => $langs->trans("None"), 'yes' => $langs->trans("AccountWithNonZeroValues"), 'all' => $langs->trans("All"));
$period .= ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("DetailBy").'</span> '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
$periodlink = $textprevyear.$textnextyear;
$exportlink = '';
@@ -240,7 +240,7 @@ if ($modecompta == "CREANCES-DETTES") {
$builddate = dol_now();
}
report_header($name, '', $period, $periodlink ?? '', $description, $builddate, $exportlink ?? '', array('modecompta'=>$modecompta, 'action' => ''), $calcmode);
report_header($name, '', $period, $periodlink ?? '', $description, $builddate, $exportlink ?? '', array('modecompta' => $modecompta, 'action' => ''), $calcmode);
if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
@@ -356,6 +356,9 @@ if ($modecompta == 'CREANCES-DETTES') {
print '<td class="liste_total right"><span class="amount">'.price($r).'</span></td>';
}
if (!isset($sommes[$code])) {
$sommes[$code] = array();
}
// Year N
$code = $cat['code']; // code of categorie ('VTE', 'MAR', ...)
if (empty($sommes[$code]['NP'])) {
@@ -438,6 +441,9 @@ if ($modecompta == 'CREANCES-DETTES') {
foreach ($months as $k => $v) {
$totCat['M'][$k] = 0;
}
if (!isset($sommes[$code])) {
$sommes[$code] = array();
}
// Set $cpts with array of accounts in the category/group
$cpts = $AccCat->getCptsCat($cat['rowid']);

View File

@@ -138,8 +138,9 @@ abstract class CommonObject
*/
public $array_options = array();
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array<string,array{type:string,label:string,enabled:int<0,2>,position:int,notnull:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array();
@@ -775,7 +776,7 @@ abstract class CommonObject
public $extraparams = array();
/**
* @var array List of child tables. To test if we can delete object.
* @var array<string,string[]|array{parent:string,parentkey:string}> List of child tables. To test if we can delete object.
*/
protected $childtables = array();

View File

@@ -296,7 +296,7 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
* protected Set format
*
* @param TCPDF $pdf PDF reference
* @param string $format Format
* @param array{metric:string,name:string,code:string,marginLeft:float,marginTip:float,SpaceX:float,SpaceY:float,NX:int,NY:int,width:float,height:float,font-size:float} $format Format
* @return void
*/
protected function _Set_Format(&$pdf, $format)

View File

@@ -44,12 +44,12 @@ class ExtraFields
public $db;
/**
* @var array New array to store extrafields definition
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed[]>,list:array<string,mixed[]>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>,isameasure?:array<string,string>}> New array to store extrafields definition
*/
public $attributes;
/**
* @var array Array with boolean of status of groups
* @var array<string,bool> Array with boolean of status of groups
*/
public $expand_display;
@@ -69,25 +69,25 @@ class ExtraFields
public $errno;
/**
* @var array Array of type to label
* @var array<string,string> Array of type to label
*/
public static $type2label = array(
'varchar'=>'String1Line',
'text'=>'TextLongNLines',
'html'=>'HtmlText',
'int'=>'Int',
'double'=>'Float',
'date'=>'Date',
'datetime'=>'DateAndTime',
'varchar' => 'String1Line',
'text' => 'TextLongNLines',
'html' => 'HtmlText',
'int' => 'Int',
'double' => 'Float',
'date' => 'Date',
'datetime' => 'DateAndTime',
//'datetimegmt'=>'DateAndTimeUTC',
'boolean'=>'Boolean',
'price'=>'ExtrafieldPrice',
'pricecy'=>'ExtrafieldPriceWithCurrency',
'phone'=>'ExtrafieldPhone',
'mail'=>'ExtrafieldMail',
'url'=>'ExtrafieldUrl',
'ip'=>'ExtrafieldIP',
'icon'=>'Icon',
'boolean' => 'Boolean',
'price' => 'ExtrafieldPrice',
'pricecy' => 'ExtrafieldPriceWithCurrency',
'phone' => 'ExtrafieldPhone',
'mail' => 'ExtrafieldMail',
'url' => 'ExtrafieldUrl',
'ip' => 'ExtrafieldIP',
'icon' => 'Icon',
'password' => 'ExtrafieldPassword',
'select' => 'ExtrafieldSelect',
'sellist' => 'ExtrafieldSelectList',
@@ -253,9 +253,9 @@ class ExtraFields
}
}
$field_desc = array(
'type'=>$typedb,
'value'=>$lengthdb,
'null'=>($required ? 'NOT NULL' : 'NULL'),
'type' => $typedb,
'value' => $lengthdb,
'null' => ($required ? 'NOT NULL' : 'NULL'),
'default' => $default_value
);
@@ -602,11 +602,11 @@ class ExtraFields
$typedb = $type;
$lengthdb = $length;
}
$field_desc = array('type'=>$typedb, 'value'=>$lengthdb, 'null'=>($required ? 'NOT NULL' : 'NULL'), 'default'=>$default);
$field_desc = array('type' => $typedb, 'value' => $lengthdb, 'null' => ($required ? 'NOT NULL' : 'NULL'), 'default' => $default);
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('extrafieldsdao'));
$parameters = array('field_desc'=>&$field_desc, 'table'=>$table, 'attr_name'=>$attrname, 'label'=>$label, 'type'=>$type, 'length'=>$length, 'unique'=>$unique, 'required'=>$required, 'pos'=>$pos, 'param'=>$param, 'alwayseditable'=>$alwayseditable, 'perms'=>$perms, 'list'=>$list, 'help'=>$help, 'default'=>$default, 'computed'=>$computed, 'entity'=>$entity, 'langfile'=>$langfile, 'enabled'=>$enabled, 'totalizable'=>$totalizable, 'printable'=>$printable);
$parameters = array('field_desc' => &$field_desc, 'table' => $table, 'attr_name' => $attrname, 'label' => $label, 'type' => $type, 'length' => $length, 'unique' => $unique, 'required' => $required, 'pos' => $pos, 'param' => $param, 'alwayseditable' => $alwayseditable, 'perms' => $perms, 'list' => $list, 'help' => $help, 'default' => $default, 'computed' => $computed, 'entity' => $entity, 'langfile' => $langfile, 'enabled' => $enabled, 'totalizable' => $totalizable, 'printable' => $printable);
$reshook = $hookmanager->executeHooks('updateExtrafields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@@ -1078,24 +1078,24 @@ class ExtraFields
$out ='<link rel="stylesheet" href="'.dol_buildpath('/myfield/css/fontawesome-iconpicker.min.css', 1).'">';
$out.='<script src="'.dol_buildpath('/myfield/js/fontawesome-iconpicker.min.js', 1).'"></script>';
*/
$out.= '<input type="text" class="form-control icp icp-auto iconpicker-element iconpicker-input flat '.$morecss.' maxwidthonsmartphone"';
$out.= ' name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
$out .= '<input type="text" class="form-control icp icp-auto iconpicker-element iconpicker-input flat '.$morecss.' maxwidthonsmartphone"';
$out .= ' name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
if (getDolGlobalInt('MAIN_ADD_ICONPICKER_JS')) {
$out.='<script>';
$options="{ title: '<b>".$langs->trans("IconFieldSelector")."</b>', placement: 'right', showFooter: false, templates: {";
$options.="iconpicker: '<div class=\"iconpicker\"><div style=\"background-color:#EFEFEF;\" class=\"iconpicker-items\"></div></div>',";
$options.="iconpickerItem: '<a role=\"button\" href=\"#\" class=\"iconpicker-item\" style=\"background-color:#DDDDDD;\"><i></i></a>',";
$out .= '<script>';
$options = "{ title: '<b>".$langs->trans("IconFieldSelector")."</b>', placement: 'right', showFooter: false, templates: {";
$options .= "iconpicker: '<div class=\"iconpicker\"><div style=\"background-color:#EFEFEF;\" class=\"iconpicker-items\"></div></div>',";
$options .= "iconpickerItem: '<a role=\"button\" href=\"#\" class=\"iconpicker-item\" style=\"background-color:#DDDDDD;\"><i></i></a>',";
// $options.="buttons: '<button style=\"background-color:#FFFFFF;\" class=\"iconpicker-btn iconpicker-btn-cancel btn btn-default btn-sm\">".$langs->trans("Cancel")."</button>";
// $options.="<button style=\"background-color:#FFFFFF;\" class=\"iconpicker-btn iconpicker-btn-accept btn btn-primary btn-sm\">".$langs->trans("Save")."</button>',";
$options.="footer: '<div class=\"popover-footer\" style=\"background-color:#EFEFEF;\"></div>',";
$options.="search: '<input type=\"search\" class\"form-control iconpicker-search\" placeholder=\"".$langs->trans("TypeToFilter")."\" />',";
$options.="popover: '<div class=\"iconpicker-popover popover\">";
$options.=" <div class=\"arrow\" ></div>";
$options.=" <div class=\"popover-title\" style=\"text-align:center;background-color:#EFEFEF;\"></div>";
$options.=" <div class=\"popover-content \" ></div>";
$options.="</div>'}}";
$out.="$('#".$keyprefix.$key.$keysuffix."').iconpicker(".$options.");";
$out.='</script>';
$options .= "footer: '<div class=\"popover-footer\" style=\"background-color:#EFEFEF;\"></div>',";
$options .= "search: '<input type=\"search\" class\"form-control iconpicker-search\" placeholder=\"".$langs->trans("TypeToFilter")."\" />',";
$options .= "popover: '<div class=\"iconpicker-popover popover\">";
$options .= " <div class=\"arrow\" ></div>";
$options .= " <div class=\"popover-title\" style=\"text-align:center;background-color:#EFEFEF;\"></div>";
$options .= " <div class=\"popover-content \" ></div>";
$options .= "</div>'}}";
$out .= "$('#".$keyprefix.$key.$keysuffix."').iconpicker(".$options.");";
$out .= '</script>';
}
} elseif ($type == 'text') {
if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field
@@ -1598,7 +1598,7 @@ class ExtraFields
$element = $extrafieldsobjectkey; // $extrafieldsobjectkey comes from $object->table_element but we need $object->element
if ($element == 'socpeople') {
$element = 'contact';
} elseif ( $element == 'projet' ) {
} elseif ($element == 'projet') {
$element = 'project';
}
@@ -2029,13 +2029,13 @@ class ExtraFields
{
global $conf, $langs;
$tagtype='tr';
$tagtype_dyn='td';
$tagtype = 'tr';
$tagtype_dyn = 'td';
if ($display_type=='line') {
$tagtype='div';
$tagtype_dyn='span';
$colspan=0;
if ($display_type == 'line') {
$tagtype = 'div';
$tagtype_dyn = 'span';
$colspan = 0;
}
$extrafield_param = $this->attributes[$object->table_element]['param'][$key];

View File

@@ -28,6 +28,11 @@
*/
class Menu
{
/**
* List of menu items
*
* @var array<array{url:string,titre:string,level:string,enabled:int<0,2>,target:string,mainmenu:string,leftmenu:string,position:int,id:string,idsel:string,classname:string,prefix:string}>
*/
public $liste;
/**
@@ -67,7 +72,7 @@ class Menu
*/
public function add($url, $titre, $level = 0, $enabled = 1, $target = '', $mainmenu = '', $leftmenu = '', $position = 0, $id = '', $idsel = '', $classname = '', $prefix = '')
{
$this->liste[] = array('url'=>$url, 'titre'=>$titre, 'level'=>$level, 'enabled'=>$enabled, 'target'=>$target, 'mainmenu'=>$mainmenu, 'leftmenu'=>$leftmenu, 'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname, 'prefix'=>$prefix);
$this->liste[] = array('url' => $url, 'titre' => $titre, 'level' => $level, 'enabled' => $enabled, 'target' => $target, 'mainmenu' => $mainmenu, 'leftmenu' => $leftmenu, 'position' => $position, 'id' => $id, 'idsel' => $idsel, 'classname' => $classname, 'prefix' => $prefix);
}
/**
@@ -91,7 +96,7 @@ class Menu
public function insert($idafter, $url, $titre, $level = 0, $enabled = 1, $target = '', $mainmenu = '', $leftmenu = '', $position = 0, $id = '', $idsel = '', $classname = '', $prefix = '')
{
$array_start = array_slice($this->liste, 0, ($idafter + 1));
$array_new = array(0=>array('url'=>$url, 'titre'=>$titre, 'level'=>$level, 'enabled'=>$enabled, 'target'=>$target, 'mainmenu'=>$mainmenu, 'leftmenu'=>$leftmenu, 'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname, 'prefix'=>$prefix));
$array_new = array(0 => array('url' => $url, 'titre' => $titre, 'level' => $level, 'enabled' => $enabled, 'target' => $target, 'mainmenu' => $mainmenu, 'leftmenu' => $leftmenu, 'position' => $position, 'id' => $id, 'idsel' => $idsel, 'classname' => $classname, 'prefix' => $prefix));
$array_end = array_slice($this->liste, ($idafter + 1));
$this->liste = array_merge($array_start, $array_new, $array_end);
}

View File

@@ -100,7 +100,7 @@ class SMTPs
/**
* Message Content
*
* @var array $_msgContent Array of messages
* @var array{html?:array{mimeType:string,data:string,dataText:string,md5?:string},plain?:array{mimeType:string,data:string,dataText:string,md5?:string},image:array<string,array{imageName:string,cid:string,md5?:string,data:string}>,attachment:array<string,array{filename:string,cid?:string,md5?:string,data:string}>} $msgContent Array of messages
*/
private $_msgContent = array();

View File

@@ -101,6 +101,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
if (!empty($object->isextrafieldmanaged) && isset($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || (int) dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) {
// @phan-suppress-next-line PhanTypeMismatchDimAssignment
$position = (!empty($val['position']) ? $val['position'] : 0);
$arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-sum'] = array(
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>',

View File

@@ -682,7 +682,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
{
global $mysoc, $user, $conf;
if (empty($paramname)) {
if (empty($paramname)) { // Explicit test for null for phan.
return 'BadFirstParameterForGETPOST';
}
if (empty($check)) {
@@ -874,6 +874,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value, when using variable parameters __XXX__ in the GET URL)
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOMPANY_COUNTRY_ID__, __USER_ID__, ...
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
'@phan-var-force string $paramname';
if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
$reg = array();
$maxloop = 20;
@@ -951,7 +952,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
$out = preg_replace('/([<>])([-+]?\d)/', '\1 \2', $out);
}
// @phan-suppress-next-line ParamMatchRegexError
// @phan-suppress-next-line UnknownSanitizeType
$out = sanitizeVal($out, $check, $filter, $options);
}

View File

@@ -69,7 +69,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $family;
/**
* @var array Custom family information
* @var array<string,array{position:string,label:string}> Custom family information
* @see $family
*
* e.g.:
@@ -140,7 +140,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
public $menu = array();
/**
* @var array Module parts
* @var array{triggers:int,login:int,substitutions:int,menus:int,theme:int,tpl:int,barcode:int,models:int,css:string,js:string,hooks:string[]} Module parts
* array(
* // Set this to 1 if module has its own trigger directory (/mymodule/core/triggers)
* 'triggers' => 0,
@@ -691,7 +691,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$content='';
$content = '';
$pathoffile = $this->getDescLongReadmeFound();
if ($pathoffile) { // Mostly for external modules
@@ -801,7 +801,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if ((float) DOL_VERSION >= 6.0) {
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
$content = dolMd2Html($content, 'parsedown', array('doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1)));
$content = dolMd2Html($content, 'parsedown', array('doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1)));
} else {
$content = nl2br($content);
}
@@ -2493,7 +2493,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
$versionTitle = $langs->trans("Version").' '.$this->getVersion(1);
if ($this->needUpdate) {
$versionTitle.= '<br>'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion;
$versionTitle .= '<br>'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion;
}
$return .= '<span class="info-box-icon-version'.($versiontrans ? ' '.$versiontrans : '').' classfortooltip" title="'.dol_escape_js($versionTitle).'" >';

View File

@@ -280,7 +280,7 @@ class Delivery extends CommonObject
* @param array $array_options Array options
* @return int Return integer <0 if KO, >0 if OK
*/
public function create_line($origin_id, $qty, $fk_product, $description, $array_options = null)
public function create_line($origin_id, $qty, $fk_product, $description, $array_options = [])
{
// phpcs:enable
$error = 0;
@@ -636,7 +636,7 @@ class Delivery extends CommonObject
* @param array $array_options Array options
* @return void
*/
public function addline($origin_id, $qty, $array_options = null)
public function addline($origin_id, $qty, $array_options = [])
{
global $conf;

View File

@@ -497,7 +497,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int Return integer <0 if KO, line_id if OK
*/
public function create_line($entrepot_id, $origin_line_id, $qty, $rang = 0, $array_options = null)
public function create_line($entrepot_id, $origin_line_id, $qty, $rang = 0, $array_options = [])
{
//phpcs:enable
global $user;
@@ -525,7 +525,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int Return integer <0 if KO, >0 if OK
*/
public function create_line_batch($line_ext, $array_options = 0)
public function create_line_batch($line_ext, $array_options = [])
{
// phpcs:enable
$error = 0;
@@ -898,7 +898,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int Return integer <0 if KO, >0 if OK
*/
public function addline($entrepot_id, $id, $qty, $array_options = 0)
public function addline($entrepot_id, $id, $qty, $array_options = [])
{
global $conf, $langs;
@@ -981,7 +981,7 @@ class Expedition extends CommonObject
* @param array $array_options extrafields array
* @return int Return integer <0 if KO, >0 if OK
*/
public function addline_batch($dbatch, $array_options = 0)
public function addline_batch($dbatch, $array_options = [])
{
// phpcs:enable
global $conf, $langs;

View File

@@ -2210,8 +2210,8 @@ class CommandeFournisseur extends CommonOrder
* @param int $entrepot Id of warehouse to add product
* @param double $price Unit Price for PMP value calculation (Unit price without Tax and taking into account discount)
* @param string $comment Comment for stock movement
* @param integer $eatby eat-by date
* @param integer $sellby sell-by date
* @param int|string $eatby eat-by date
* @param int|string $sellby sell-by date
* @param string $batch Lot number
* @param int $fk_commandefourndet Id of supplier order line
* @param int $notrigger 1 = notrigger
@@ -2894,7 +2894,7 @@ class CommandeFournisseur extends CommonOrder
* @param string $ref_supplier Supplier ref
* @return int Return integer < 0 if error, > 0 if ok
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $notrigger = 0, $date_start = '', $date_end = '', $array_options = [], $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '')
{
global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type, $fk_unit");

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@@ -521,7 +522,7 @@ class MultiCurrency extends CommonObject
*
* @param DoliDB $dbs Object db
* @param string $code Code value search
* @param integer $date_document Date from document (propal, order, invoice, ...)
* @param integer|string $date_document Date from document (propal, order, invoice, ...)
*
* @return array [0] => id currency
* [1] => rate

View File

@@ -5725,8 +5725,8 @@ class Product extends CommonObject
* @param int $movement 0 = add, 1 = remove
* @param string $label Label of stock movement
* @param double $price Price to use for stock eval
* @param integer $dlc eat-by date
* @param integer $dluo sell-by date
* @param int|string $dlc eat-by date
* @param int|string $dluo sell-by date
* @param string $lot Lot number
* @param string $inventorycode Inventory code
* @param string $origin_element Origin element type

View File

@@ -813,9 +813,9 @@ class MouvementStock extends CommonObject
* @param int $qty Quantity
* @param int $price Price
* @param string $label Label of stock movement
* @param integer|string $datem Force date of movement
* @param integer $eatby eat-by date
* @param integer $sellby sell-by date
* @param int|string $datem Force date of movement
* @param int|string $eatby eat-by date
* @param int|string $sellby sell-by date
* @param string $batch batch number
* @param int $id_product_batch Id product_batch
* @param string $inventorycode Inventory code

View File

@@ -2184,6 +2184,7 @@ class Project extends CommonObject
$date = explode('-', $obj->element_date);
$week_number = getWeekNumber($date[2], $date[1], $date[0]);
}
'@phan-var-force int $week_number'; // Needed because phan considers it might be null
if (empty($weekalreadyfound[$week_number])) {
$this->monthWorkLoad[$week_number] = $obj->element_duration;
$this->monthWorkLoadPerTask[$week_number][$obj->fk_element] = $obj->element_duration;

View File

@@ -174,9 +174,6 @@ if (GETPOST('lang', 'aZ09')) {
$langs->setDefaultLang('auto');
}
$bc[false] = ' class="bg1"';
$bc[true] = ' class="bg2"';
/**
* Load conf file (file must exists)