diff --git a/dev/tools/codespell/codespell-lines-ignore.txt b/dev/tools/codespell/codespell-lines-ignore.txt index b3557522702..4a92b80dc80 100644 --- a/dev/tools/codespell/codespell-lines-ignore.txt +++ b/dev/tools/codespell/codespell-lines-ignore.txt @@ -2,17 +2,14 @@ if (empty($objMod->dictionaries) && !empty($objMod->{"dictionnaries"})) { print 'id.'&token='.newToken().'">'; $object->date_ech = $object->periode; - $object->periode = $object->date_ech; $reponsesadd = str_split($obj->reponses); $sql .= " SET reponses = '".$db->escape($reponsesadd)."'"; $sql .= " SET reponses = '0".$db->escape($obj->reponses)."'"; $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0); - // $object->periode = dol_get_last_day(year of $object->date_ech - 1m, month or $object->date_ech -1m) //$pice = ''; //$typea = ($objp->typea == 'birth') ? $picb : $pice; print ''; $dateemail = dol_stringtotime((string) $overview[0]->udate, 'gmt'); - $object->periode = $newdateperiod; $pice = ''; $typea = ($data[$j]->typea == 'birth') ? $picb : $pice; GETPOSTINT("mouvement"), @@ -25,8 +22,6 @@ $date_liv = dol_mktime(GETPOST('rehour'), GETPOST('remin'), GETPOST('resec'), GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $newfiletmp = preg_replace('/\.od(s|t)/i', '', $newfile); $newfiletmp = preg_replace('/\.od[ts]/i', '', $newfile); - $object->period = dol_time_plus_duree($object->periode, 1, 'm'); - $object->periode = dol_time_plus_duree($object->periode, 1, 'm'); $this->category->childs[] = $this->_cleanObjectDatas($cat); $this->periode = $this->db->jdate($obj->period); $tmp = array('id_users' => $obj->id_users, 'nom' => $obj->name, 'reponses' => $obj->reponses); @@ -58,12 +53,9 @@ if (empty($reyear) || empty($remonth) || empty($reday)) { jQuery("#mouvement").change(function() { preg_match('/:([!<>=\s]+|in|notin|like|notlike):/', $tmpcrit, $reg); - print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); print ''.$langs->trans("TransferStock").''; print ''.$langs->trans("ClinkOnALinkOfColumn", $langs->transnoentitiesnoconv("Referers")).''; print ''.dol_print_date($db->jdate($obj->periode), 'day').''; - print ''.$langs->trans("AddIn").''; - print dol_print_date($object->periode, "day"); "sme", $action = 'transfert'; $cle_rib = strtolower(checkES($rib, $CCC)); @@ -97,9 +89,7 @@ if ($user->hasRight('stock', 'mouvement', 'creer')) { if (GETPOSTISSET("reday") && GETPOSTISSET("remonth") && GETPOSTISSET("reyear")) { if (empty($reyear) || empty($remonth) || empty($reday)) { - print ''; - print ''.$langs->trans("AddIn").''; - * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing. + * @param float|string $selectedrate Force preselected vat rate. Can be '8.5' or '8.5 (NOO)' for example. Use '' for no forcing. $date = $obj->periode; $datepaid = dol_mktime(12, 0, 0, GETPOST("remonth"), GETPOST("reday"), GETPOST("reyear")); $datepaid = dol_mktime(12, 0, 0, GETPOSTINT("remonth"), GETPOSTINT("reday"), GETPOSTINT("reyear")); @@ -132,14 +122,12 @@ // ceci afin d'etre compatible avec les cas ou la periode n'etait pas obligatoire TaskItem(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt)

if ($action == "transfert") { - if ($object->id > 0 && $action == 'addin') { if (GETPOST('reday')) { if (GETPOSTINT("reyear") && GETPOSTINT("remonth") && GETPOSTINT("reday")) { print ''; print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'maxwidth200'); print ''; } if (!empty($arrayfields['m.fk_user_author']['checked'])) { diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index a3f7348a332..b6ea1c26941 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -173,7 +173,7 @@ if (empty($reshook)) { //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be 'include', not 'include_once' if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', '', 'date', '', $user, $triggermodname); + $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOSTINT('projectid')); diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index 6eb5076da8b..e4cfc5b8435 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -33,6 +33,7 @@ global $noMoreLinkedObjectBlockAfter; $langs = $GLOBALS['langs']; '@phan-var-force Translate $langs'; $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; +'@phan-var-force array $linkedObjectBlock'; $object = $GLOBALS['object']; // Load translation files required by the page @@ -45,8 +46,9 @@ if ($object->element == 'mo') { $mo_static = new Mo($db); $res = $mo_static->fetch($object->id); $TMoChilds = $mo_static->getMoChilds(); + '@phan-var-force Mo[] $TMoChilds'; - $hookmanager->initHooks('LinesLinkedObjectBlock'); + $hookmanager->initHooks(array('LinesLinkedObjectBlock')); $parameters = array('TMoChilds' => $TMoChilds); $reshook = $hookmanager->executeHooks('LinesLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { @@ -90,7 +92,7 @@ if ($object->element == 'mo') { } } else { $linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); - + '@phan-var-force array $linkedObjectBlock'; $total = 0; $ilink = 0; foreach ($linkedObjectBlock as $key => $objectlink) { diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index a4b5d968079..bdc155c78cd 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -54,7 +54,13 @@ class Partnership extends CommonObject */ public $picto = 'partnership'; + /** + * @var string + */ public $type_code; + /** + * @var string + */ public $type_label; @@ -119,26 +125,89 @@ class Partnership extends CommonObject 'ip' => array('type' => 'ip', 'label' => 'IPOfApplicant', 'enabled' => 1, 'position' => 74, 'notnull' => 0, 'visible' => -2,), 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 2000, 'notnull' => 1, 'visible' => 2, 'default' => '0', 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '2' => 'Approved', '3' => 'Refused', '9' => 'Terminated'),), ); + /** + * @var int + */ public $rowid; + /** + * @var string + */ public $ref; + /** + * @var int + */ public $entity; + /** + * @var int + */ public $fk_type; + /** + * @var string + */ public $note_public; + /** + * @var string + */ public $note_private; + /** + * @var int + */ public $fk_user_creat; + /** + * @var int + */ public $fk_user_modif; + /** + * @var string + */ public $last_main_doc; + /** + * @var string + */ public $import_key; + /** + * @var string + */ public $model_pdf; + /** + * @var int|string + */ public $date_partnership_start; + /** + * @var int|string + */ public $date_partnership_end; + /** + * @var string + */ public $url_to_check; + /** + * @var int|float + */ public $count_last_url_check_error; + /** + * @var int|string + */ public $last_check_backlink; + /** + * @var string + */ public $reason_decline_or_cancel; + /** + * @var int + */ public $fk_soc; + /** + * @var int + */ public $fk_member; + /** + * @var string + */ public $ip; + /** + * @var int + */ public $status; // END MODULEBUILDER PROPERTIES @@ -422,9 +491,9 @@ class Partnership extends CommonObject * @param string $sortfield Sort field * @param int $limit Limit * @param int $offset Offset page - * @param string|array $filter Filter USF. - * @param string $filtermode Filter mode (AND or OR) - * @return array|int int <0 if KO, array of pages if OK + * @param string|array $filter Filter USF. + * @param 'AND'|'OR' $filtermode Filter mode (AND or OR) + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { @@ -1177,7 +1246,7 @@ class Partnership extends CommonObject /** * Create an array of lines * - * @return array|int array of lines if OK, <0 if KO + * @return PartnershipLine[]|int array of lines if OK, <0 if KO */ public function getLinesArray() { @@ -1232,6 +1301,7 @@ class Partnership extends CommonObject if (class_exists($classname)) { $obj = new $classname(); + '@phan-var-force ModeleNumRefPartnership $obj'; $numref = $obj->getNextValue($this); if ($numref != '' && $numref != '-1') { @@ -1256,10 +1326,10 @@ class Partnership extends CommonObject * * @param string $modele Force template to use ('' to not force) * @param Translate $outputlangs object lang a utiliser pour traduction - * @param int $hidedetails Hide details of lines - * @param int $hidedesc Hide description - * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param int<0,1> $hidedetails Hide details of lines + * @param int<0,1> $hidedesc Hide description + * @param int<0,1> $hideref Hide ref + * @param ?array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 82719f1338f..73653c0dc46 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -61,6 +61,9 @@ class PartnershipType extends CommonObject */ public $label; + /** + * @var int<0,1> + */ public $active; @@ -122,9 +125,9 @@ class PartnershipType extends CommonObject /** * Create object into database * - * @param User $user User that creates - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int Return integer <0 if KO, Id of created object if OK + * @param User $user User that creates + * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers + * @return int Return integer <0 if KO, Id of created object if OK */ public function create(User $user, $notrigger = 0) { @@ -154,8 +157,8 @@ class PartnershipType extends CommonObject * @param int $offset Offset * @param string $filter Filter as an Universal Search string. * Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')' - * @param string $filtermode No more used - * @return array|int int <0 if KO, array of pages if OK + * @param 'AND'|'OR' $filtermode No more used + * @return self[]|int int <0 if KO, array of pages if OK */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = '', $filtermode = 'AND') { diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 20309559f0e..fa158f5b0df 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -38,11 +38,23 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; */ class PartnershipUtils { + /** + * @var DoliDB + */ public $db; //!< To store db handler + /** + * @var string + */ public $error; //!< To return error code (or message) + /** + * @var string[] + */ public $errors = array(); //!< To return several error codes (or messages) - public $output; // To store output of some cron methods + /** + * @var string To store output of some cron methods + */ + public $output; /** @@ -107,6 +119,7 @@ class PartnershipUtils $sql .= $this->db->order('d.rowid', 'ASC'); // Limit is managed into loop later + $numofexpiredmembers = 0; $resql = $this->db->query($sql); if ($resql) { $numofexpiredmembers = $this->db->num_rows($resql); @@ -326,6 +339,7 @@ class PartnershipUtils $sql .= $this->db->order('p.rowid', 'ASC'); // Limit is managed into loop later + $numofexpiredmembers = 0; $resql = $this->db->query($sql); if ($resql) { $numofexpiredmembers = $this->db->num_rows($resql); @@ -541,6 +555,7 @@ class PartnershipUtils for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i); + '@phan-var-force DOMElement $href'; $url = $href->getAttribute('href'); $url = filter_var($url, FILTER_SANITIZE_URL); if (!(!filter_var($url, FILTER_VALIDATE_URL))) { diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php index b447a44ac35..1c677e2b282 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_advanced.php @@ -125,8 +125,8 @@ class mod_partnership_advanced extends ModeleNumRefPartnership /** * Return next free value * - * @param Object $object Object we need next value for - * @return string|0 Next value if OK, 0 if KO + * @param Partnership $object Object we need next value for + * @return string|int<-1,0> Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php index 4ab8eb6eace..710fbc60d38 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php @@ -117,8 +117,8 @@ class mod_partnership_standard extends ModeleNumRefPartnership /** * Return next free value * - * @param Object $object Object we need next value for - * @return string|-1 Next value if OK, -1 if KO + * @param Partnership $object Object we need next value for + * @return string|int<-1,0> Next value if OK, 0 if KO */ public function getNextValue($object) { diff --git a/htdocs/partnership/core/modules/partnership/modules_partnership.php b/htdocs/partnership/core/modules/partnership/modules_partnership.php index 0f8fde60cfa..d76dfb63473 100644 --- a/htdocs/partnership/core/modules/partnership/modules_partnership.php +++ b/htdocs/partnership/core/modules/partnership/modules_partnership.php @@ -6,6 +6,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2014 Marcos García + * Copyright (C) 2024 MDW * * 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 @@ -42,9 +43,9 @@ abstract class ModelePDFPartnership extends CommonDocGenerator /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { @@ -68,5 +69,11 @@ abstract class ModelePDFPartnership extends CommonDocGenerator */ abstract class ModeleNumRefPartnership extends CommonNumRefGenerator { - // No overload code + /** + * Return next free value + * + * @param Partnership $object Object we need next value for + * @return string|int<-1,0> Next value if OK, 0 if KO + */ + abstract public function getNextValue($object); } diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index d8ff622ae65..b4b75732c66 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -1,6 +1,7 @@ * Copyright (C) 2021 NextGestion + * Copyright (C) 2024 MDW * * 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 @@ -238,7 +239,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; if ($action == 'set_thirdparty' && $permissiontoadd) { - $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', '', 'date', '', $user, $triggermodname); + $object->setValueFrom('fk_soc', GETPOSTINT('fk_soc'), '', null, 'date', '', $user, $triggermodname); } if ($action == 'classin' && $permissiontoadd) { $object->setProject(GETPOSTINT('projectid')); diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 20a9dc71d7b..ba4f793a898 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -1,6 +1,7 @@ * Copyright (C) 2014-2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -69,6 +70,7 @@ if ($action == 'setconst' && $user->admin) { $error = 0; $db->begin(); foreach ($_POST['setupdriver'] as $setupconst) { + '@phan-var-force array $setupconst'; //print '
'.print_r($setupconst, true).'
'; $result = dolibarr_set_const($db, $setupconst['varname'], $setupconst['value'], 'chaine', 0, '', $conf->entity); if (!($result > 0)) { @@ -334,6 +336,7 @@ if ($mode == 'test' && $user->admin) { require_once $classfile; $classname = 'printing_'.$driver; $printer = new $classname($db); + '@phan-var-force PrintingDriver $printer'; $langs->load($driver); $langs->load('printing'); diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index c68bbaa96f9..be06a33f5e7 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -446,6 +446,7 @@ foreach ($dirmodels as $reldir) { require_once $dir . '/' . $file; $module = new $classname($db); + '@phan-var-force ModelePDFProductBatch $module'; $modulequalified = 1; if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -460,7 +461,7 @@ foreach ($dirmodels as $reldir) { print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { - print $module->info($langs); + print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod } else { print $module->description; } diff --git a/htdocs/product/ajax/product_lot.php b/htdocs/product/ajax/product_lot.php index 3c2596e1e10..71de65202a8 100644 --- a/htdocs/product/ajax/product_lot.php +++ b/htdocs/product/ajax/product_lot.php @@ -1,6 +1,7 @@ * Copyright (C) 2023 Lionel Vessiller + * Copyright (C) 2024 MDW * * 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 @@ -60,7 +61,7 @@ $rows = array(); if ($action == 'search' && $batch != '' && $permissiontoread) { $productLot = new Productlot($db); - $result = $productLot->fetch('', $productId, $batch); + $result = $productLot->fetch(0, $productId, $batch); if ($result > 0 && $productLot->id > 0) { $rows[] = array( diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 6ccec546297..03d81e8a421 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -34,27 +35,69 @@ class ActionsCardProduct */ public $db; + /** + * @var string + */ public $dirmodule; + /** + * @var string + */ public $targetmodule; + /** + * @var string + */ public $canvas; + /** + * @var string + */ public $card; + /** + * @var string + */ public $name; + /** + * @var string + */ public $definition; + /** + * @var string + */ public $description; + /** + * @var string + */ public $price_base_type; + /** + * @var string + */ public $accountancy_code_sell; + /** + * @var string + */ public $accountancy_code_buy; + /** + * @var string + */ public $fieldListName; + /** + * @var string + */ public $next_prev_filter; - //! Object container + /** + * @var Product Object container + */ public $object; - //! Template container + /** + * @var array Template container + */ public $tpl = array(); - // List of fields for action=list + /** + * array,enabled:int<0,1>,order:int}> List of fields for action=list + */ public $field_list = array(); /** @@ -96,8 +139,8 @@ class ActionsCardProduct /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param string $action Type of action - * @param integer $id Id of object + * @param string $action Type of action + * @param int $id Id of object * @param string $ref Ref of object * @return void */ @@ -107,6 +150,9 @@ class ActionsCardProduct global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; + '@phan-var-force Form $form'; + '@phan-var-force FormProduct $formproduct'; + $tmpobject = new Product($this->db); if (!empty($id) || !empty($ref)) { $tmpobject->fetch($id, $ref); @@ -147,7 +193,7 @@ class ActionsCardProduct $this->tpl['price_base_type'] = $form->selectPriceBaseType($this->price_base_type, "price_base_type"); // VAT - $this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, ''); + $this->tpl['tva_tx'] = $form->load_tva("tva_tx", -1, $mysoc, null); } if ($action == 'view') { @@ -290,7 +336,6 @@ class ActionsCardProduct $fieldlist["visible"] = $obj->visible; $fieldlist["enabled"] = verifCond($obj->enabled); $fieldlist["order"] = $obj->rang; - array_push($this->field_list, $fieldlist); $i++; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d2e547e5e65..a2634994085 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -97,6 +97,7 @@ $error = 0; $errors = array(); $refalreadyexists = 0; +$formbarcode = null; // Get parameters $id = GETPOSTINT('id'); @@ -1057,8 +1058,11 @@ if (empty($reshook)) { // Add product into object (when PRODUCT_ADD_FORM_ADD_TO is set) if ($object->id > 0 && $action == 'addin') { // Test on permission not required here. it is done later according to object. - $thirpdartyid = 0; + $thirdpartyid = 0; $permissiontoaddline = false; + $propal = null; + $facture = null; + $commande = null; // Get object and test permission if (GETPOST('propalid') > 0) { @@ -1068,7 +1072,7 @@ if (empty($reshook)) { dol_print_error($db, $propal->error); exit; } - $thirpdartyid = $propal->socid; + $thirdpartyid = $propal->socid; $permissiontoaddline = $user->hasRight('propal', 'creer'); } elseif (GETPOST('commandeid') > 0) { $commande = new Commande($db); @@ -1077,7 +1081,7 @@ if (empty($reshook)) { dol_print_error($db, $commande->error); exit; } - $thirpdartyid = $commande->socid; + $thirdpartyid = $commande->socid; $permissiontoaddline = $user->hasRight('commande', 'creer'); } elseif (GETPOST('factureid') > 0) { $facture = new Facture($db); @@ -1086,13 +1090,13 @@ if (empty($reshook)) { dol_print_error($db, $facture->error); exit; } - $thirpdartyid = $facture->socid; + $thirdpartyid = $facture->socid; $permissiontoaddline = $user->hasRight('facture', 'creer'); } - if ($thirpdartyid > 0) { + if ($thirdpartyid > 0) { $soc = new Societe($db); - $result = $soc->fetch($thirpdartyid); + $result = $soc->fetch($thirdpartyid); if ($result <= 0) { dol_print_error($db, $soc->error); exit; @@ -1148,7 +1152,7 @@ if (empty($reshook)) { } } - if (GETPOST('propalid') > 0 && $permissiontoaddline) { + if (GETPOST('propalid') > 0 && $permissiontoaddline && is_object($propal)) { // Define cost price for margin calculation $buyprice = 0; if (($result = $propal->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { @@ -1188,7 +1192,7 @@ if (empty($reshook)) { } setEventMessages($langs->trans("ErrorUnknown").": $result", null, 'errors'); - } elseif (GETPOST('commandeid') > 0 && $permissiontoaddline) { + } elseif (GETPOST('commandeid') > 0 && $permissiontoaddline && is_object($commande)) { // Define cost price for margin calculation $buyprice = 0; if (($result = $commande->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { @@ -1207,8 +1211,8 @@ if (empty($reshook)) { $localtax2_tx, // localtax2 $object->id, price2num(GETPOST('remise_percent'), '', 2), - '', - '', + 0, + 0, $price_base_type, $pu_ttc, '', @@ -1217,10 +1221,10 @@ if (empty($reshook)) { -1, 0, 0, - null, + 0, $buyprice, '', - 0, + array(), $object->fk_unit ); @@ -1230,7 +1234,7 @@ if (empty($reshook)) { } setEventMessages($langs->trans("ErrorUnknown").": $result", null, 'errors'); - } elseif (GETPOST('factureid') > 0 && $permissiontoaddline) { + } elseif (GETPOST('factureid') > 0 && $permissiontoaddline && is_object($facture)) { // Define cost price for margin calculation $buyprice = 0; if (($result = $facture->defineBuyPrice($pu_ht, price2num(GETPOST('remise_percent'), '', 2), $object->id)) < 0) { @@ -1251,9 +1255,9 @@ if (empty($reshook)) { price2num(GETPOST('remise_percent'), '', 2), '', '', - '', - '', - '', + 0, + 0, + 0, $price_base_type, $pu_ttc, Facture::TYPE_STANDARD, @@ -1262,12 +1266,12 @@ if (empty($reshook)) { '', 0, 0, - null, + 0, $buyprice, '', - 0, + array(), 100, - '', + 0, $object->fk_unit ); @@ -1328,6 +1332,7 @@ llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-product page-card'); // Load object modBarCodeProduct $res = 0; +$modBarCodeProduct = null; if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { $module = strtolower(getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')); $dirbarcode = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); @@ -1339,6 +1344,7 @@ if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) } if ($res > 0) { $modBarCodeProduct = new $module(); + '@phan-var-force ModeleBarCode $modBarCodeProduct'; } } @@ -1522,7 +1528,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $showbarcode = 0; } - if ($showbarcode) { + if ($showbarcode && is_object($modBarCodeProduct)) { print ''.$langs->trans('BarcodeType').''; if (GETPOSTISSET('fk_barcode_type')) { $fk_barcode_type = GETPOST('fk_barcode_type') ? GETPOST('fk_barcode_type') : 0; @@ -1740,7 +1746,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 3); - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -1802,7 +1808,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $accountancy_code_sell = (GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_ACCOUNT")); } - print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); print ''; // Accountancy_code_sell_intra @@ -1814,7 +1820,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $accountancy_code_sell_intra = (GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT")); } - print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); print ''; } @@ -1826,7 +1832,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $accountancy_code_sell_export = (GETPOST('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT")); } - print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($accountancy_code_sell_export, 'accountancy_code_sell_export', 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); print ''; // Accountancy_code_buy @@ -1837,7 +1843,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : getDolGlobalString("ACCOUNTING_SERVICE_BUY_ACCOUNT")); } - print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); print ''; // Accountancy_code_buy_intra @@ -1849,7 +1855,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $accountancy_code_buy_intra = (GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT")); } - print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); print ''; } @@ -1861,7 +1867,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } else { $accountancy_code_buy_export = (GETPOST('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export', 'alpha') : getDolGlobalString("ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT")); } - print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, 'minwidth150 maxwidth300', 1); + print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, array(), 1, 1, 'minwidth150 maxwidth300', 1); print ''; } else {// For external software if (!empty($accountancy_code_sell)) { @@ -2367,7 +2373,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $arrayselected[] = $cat; } } - print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -2392,41 +2398,41 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Accountancy_code_sell print ''.$langs->trans("ProductAccountancySellCode").''; print ''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell), 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell), 'accountancy_code_sell', 1, array(), 1, 1, 'minwidth150 maxwidth300'); print ''; // Accountancy_code_sell_intra if ($mysoc->isInEEC()) { print ''.$langs->trans("ProductAccountancySellIntraCode").''; print ''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra), 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra), 'accountancy_code_sell_intra', 1, array(), 1, 1, 'minwidth150 maxwidth300'); print ''; } // Accountancy_code_sell_export print ''.$langs->trans("ProductAccountancySellExportCode").''; print ''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export), 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export), 'accountancy_code_sell_export', 1, array(), 1, 1, 'minwidth150 maxwidth300'); print ''; // Accountancy_code_buy print ''.$langs->trans("ProductAccountancyBuyCode").''; print ''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy), 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy), 'accountancy_code_buy', 1, array(), 1, 1, 'minwidth150 maxwidth300'); print ''; // Accountancy_code_buy_intra if ($mysoc->isInEEC()) { print ''.$langs->trans("ProductAccountancyBuyIntraCode").''; print ''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra), 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra), 'accountancy_code_buy_intra', 1, array(), 1, 1, 'minwidth150 maxwidth300'); print ''; } // Accountancy_code_buy_export print ''.$langs->trans("ProductAccountancyBuyExportCode").''; print ''; - print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export), 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); + print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export), 'accountancy_code_buy_export', 1, array(), 1, 1, 'minwidth150 maxwidth300'); print ''; } else { // For external software @@ -2535,7 +2541,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } $fk_barcode_type = ''; - if ($action == 'editbarcodetype') { + if ($action == 'editbarcodetype' && is_object($formbarcode)) { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); $fk_barcode_type = $object->barcode_type; } else { @@ -2601,7 +2607,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { if (!empty($object->accountancy_code_sell)) { $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch('', $object->accountancy_code_sell, 1); + $accountingaccount->fetch(0, $object->accountancy_code_sell, 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); } @@ -2618,7 +2624,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { if (!empty($object->accountancy_code_sell_intra)) { $accountingaccount2 = new AccountingAccount($db); - $accountingaccount2->fetch('', $object->accountancy_code_sell_intra, 1); + $accountingaccount2->fetch(0, $object->accountancy_code_sell_intra, 1); print $accountingaccount2->getNomUrl(0, 1, 1, '', 1); } @@ -2635,7 +2641,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { if (!empty($object->accountancy_code_sell_export)) { $accountingaccount3 = new AccountingAccount($db); - $accountingaccount3->fetch('', $object->accountancy_code_sell_export, 1); + $accountingaccount3->fetch(0, $object->accountancy_code_sell_export, 1); print $accountingaccount3->getNomUrl(0, 1, 1, '', 1); } @@ -2651,7 +2657,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { if (!empty($object->accountancy_code_buy)) { $accountingaccount4 = new AccountingAccount($db); - $accountingaccount4->fetch('', $object->accountancy_code_buy, 1); + $accountingaccount4->fetch(0, $object->accountancy_code_buy, 1); print $accountingaccount4->getNomUrl(0, 1, 1, '', 1); } @@ -2668,7 +2674,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { if (!empty($object->accountancy_code_buy_intra)) { $accountingaccount5 = new AccountingAccount($db); - $accountingaccount5->fetch('', $object->accountancy_code_buy_intra, 1); + $accountingaccount5->fetch(0, $object->accountancy_code_buy_intra, 1); print $accountingaccount5->getNomUrl(0, 1, 1, '', 1); } @@ -2685,7 +2691,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled('accounting')) { if (!empty($object->accountancy_code_buy_export)) { $accountingaccount6 = new AccountingAccount($db); - $accountingaccount6->fetch('', $object->accountancy_code_buy_export, 1); + $accountingaccount6->fetch(0, $object->accountancy_code_buy_export, 1); print $accountingaccount6->getNomUrl(0, 1, 1, '', 1); } @@ -2930,7 +2936,7 @@ if ($action == 'merge') { 'name' => 'product_origin', 'label' => $langs->trans('MergeOriginProduct'), 'type' => 'other', - 'value' => $form->select_produits('', 'product_origin', '', 0, 0, 1, 2, '', 1, array(), 0, 1, 0, 'minwidth200', 0, '', null, 1), + 'value' => $form->select_produits(0, 'product_origin', '', 0, 0, 1, 2, '', 1, array(), 0, 1, 0, 'minwidth200', 0, '', null, 1), ) ); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("MergeProducts"), $langs->trans("ConfirmMergeProducts"), "confirm_merge", $formquestion, 'no', 1, 250); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 665aea2e831..e61257b216b 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2019 Cedric Ancelin + * Copyright (C) 2019 Cedric Ancelin * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 MDW * * 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 @@ -291,7 +292,7 @@ class Products extends DolibarrApi $obj_ret['pagination'] = array( 'total' => (int) $total, 'page' => $page, //count starts from 0 - 'page_count' => ceil((int) $total/$limit), + 'page_count' => ceil((int) $total / $limit), 'limit' => $limit ); } @@ -466,13 +467,23 @@ class Products extends DolibarrApi if ($this->product->multiprices_base_type[$key] != $oldproduct->multiprices_base_type[$key]) { $pricemodified = true; } else { - if ($this->product->multiprices_tva_tx[$key] != $oldproduct->multiprices_tva_tx[$key]) $pricemodified = true; + if ($this->product->multiprices_tva_tx[$key] != $oldproduct->multiprices_tva_tx[$key]) { + $pricemodified = true; + } if ($this->product->multiprices_base_type[$key] == 'TTC') { - if ($this->product->multiprices_ttc[$key] != $oldproduct->multiprices_ttc[$key]) $pricemodified = true; - if ($this->product->multiprices_min_ttc[$key] != $oldproduct->multiprices_min_ttc[$key]) $pricemodified = true; + if ($this->product->multiprices_ttc[$key] != $oldproduct->multiprices_ttc[$key]) { + $pricemodified = true; + } + if ($this->product->multiprices_min_ttc[$key] != $oldproduct->multiprices_min_ttc[$key]) { + $pricemodified = true; + } } else { - if ($this->product->multiprices[$key] != $oldproduct->multiprices[$key]) $pricemodified = true; - if ($this->product->multiprices_min[$key] != $oldproduct->multiprices[$key]) $pricemodified = true; + if ($this->product->multiprices[$key] != $oldproduct->multiprices[$key]) { + $pricemodified = true; + } + if ($this->product->multiprices_min[$key] != $oldproduct->multiprices[$key]) { + $pricemodified = true; + } } } if ($pricemodified && $result > 0) { @@ -700,12 +711,12 @@ class Products extends DolibarrApi } return array( - 'multiprices'=>$this->product->multiprices, - 'multiprices_inc_tax'=>$this->product->multiprices_ttc, - 'multiprices_min'=>$this->product->multiprices_min, - 'multiprices_min_inc_tax'=>$this->product->multiprices_min_ttc, - 'multiprices_vat'=>$this->product->multiprices_tva_tx, - 'multiprices_base_type'=>$this->product->multiprices_base_type, + 'multiprices' => $this->product->multiprices, + 'multiprices_inc_tax' => $this->product->multiprices_ttc, + 'multiprices_min' => $this->product->multiprices_min, + 'multiprices_min_inc_tax' => $this->product->multiprices_min_ttc, + 'multiprices_vat' => $this->product->multiprices_tva_tx, + 'multiprices_base_type' => $this->product->multiprices_base_type, //'multiprices_default_vat_code'=>$this->product->multiprices_default_vat_code ); } @@ -791,8 +802,8 @@ class Products extends DolibarrApi } return array( - 'prices_by_qty'=>$this->product->prices_by_qty[0], // 1 if price by quantity was activated for the product - 'prices_by_qty_list'=>$this->product->prices_by_qty_list[0] + 'prices_by_qty' => $this->product->prices_by_qty[0], // 1 if price by quantity was activated for the product + 'prices_by_qty_list' => $this->product->prices_by_qty_list[0] ); } diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index f983652d561..53ab522f66e 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -267,6 +267,8 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."
\n"; } + $thirdparty = null; + if (!$error) { // Check if attendee already exists (by email and for this event) $filter = array(); @@ -327,7 +329,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } } - $resultconforbooth = -1; + $resultconfattendee = -1; if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) { $error++; @@ -375,7 +377,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if (!getDolGlobalString('EVENTORGANIZATION_DISABLE_RETREIVE_THIRDPARTY_FROM_NAME')) { // Fetch using the field input by end user if we have just created the attendee if ($resultfetchthirdparty <= 0 && !empty($societe) && !empty($emailcompany)) { - $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $emailcompany); + $resultfetchthirdparty = $thirdparty->fetch(0, $societe, '', '', '', '', '', '', '', '', $emailcompany); if ($resultfetchthirdparty > 0) { // We found a unique result with the name + emailcompany, so we set the fk_soc of attendee $confattendee->fk_soc = $thirdparty->id; @@ -386,7 +388,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } // Fetch using the field input by end user if we have just created the attendee if ($resultfetchthirdparty <= 0 && !empty($societe) && !empty($email) && $email != $emailcompany) { - $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', $email); + $resultfetchthirdparty = $thirdparty->fetch(0, $societe, '', '', '', '', '', '', '', '', $email); if ($resultfetchthirdparty > 0) { // We found a unique result with the name + email, so we set the fk_soc of attendee $confattendee->fk_soc = $thirdparty->id; @@ -398,7 +400,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } if ($resultfetchthirdparty <= 0 && !empty($emailcompany)) { // Try to find thirdparty from the email only - $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $emailcompany); + $resultfetchthirdparty = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $emailcompany); if ($resultfetchthirdparty > 0) { // We found a unique result with that email only, so we set the fk_soc of attendee $confattendee->fk_soc = $thirdparty->id; @@ -409,7 +411,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } if ($resultfetchthirdparty <= 0 && !empty($email) && $email != $emailcompany) { // Try to find thirdparty from the email only - $resultfetchthirdparty = $thirdparty->fetch('', '', '', '', '', '', '', '', '', '', $email); + $resultfetchthirdparty = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $email); if ($resultfetchthirdparty > 0) { // We found a unique result with that email only, so we set the fk_soc of attendee $confattendee->fk_soc = $thirdparty->id; @@ -420,7 +422,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } if ($resultfetchthirdparty <= 0 && !empty($genericcompanyname)) { // Try to find thirdparty from the generic mail only - $resultfetchthirdparty = $thirdparty->fetch('', $genericcompanyname, '', '', '', '', '', '', '', '', ''); + $resultfetchthirdparty = $thirdparty->fetch(0, $genericcompanyname, '', '', '', '', '', '', '', '', ''); if ($resultfetchthirdparty > 0) { // We found a unique result with that name + email, so we set the fk_soc of attendee $confattendee->fk_soc = $thirdparty->id; @@ -434,7 +436,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if ($resultfetchthirdparty <= 0 && !empty($email)) { // Try to find the thirdparty from the contact - $resultfetchcontact = $contact->fetch('', null, '', $email); + $resultfetchcontact = $contact->fetch(0, null, '', $email); if ($resultfetchcontact > 0 && $contact->fk_soc > 0) { $thirdparty->fetch($contact->fk_soc); $confattendee->fk_soc = $thirdparty->id; @@ -445,7 +447,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if ($resultfetchthirdparty <= 0 && !empty($societe)) { // Try to find thirdparty from the company name only - $resultfetchthirdparty = $thirdparty->fetch('', $societe, '', '', '', '', '', '', '', '', ''); + $resultfetchthirdparty = $thirdparty->fetch(0, $societe, '', '', '', '', '', '', '', '', ''); if ($resultfetchthirdparty > 0) { // We found a unique result with that name only, so we set the fk_soc of attendee $confattendee->fk_soc = $thirdparty->id; @@ -495,6 +497,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } } $modCodeClient = new $module($db); + '@phan-var-force ModeleThirdPartyCode $modCodeClient'; if (empty($tmpcode) && !empty($modCodeClient->code_auto)) { $tmpcode = $modCodeClient->getNextValue($thirdparty, 0); @@ -517,7 +520,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } } - if (!$error) { + if (!$error && is_object($thirdparty)) { // If the registration needs a payment if (!empty((float) $project->price_registration)) { $outputlangs = $langs; @@ -535,6 +538,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $resultprod = $productforinvoicerow->fetch(getDolGlobalString('SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION')); } + $facture = null; // Create the draft invoice for the payment if ($resultprod < 0) { $error++; @@ -596,7 +600,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen $pu_ht = 0; $price_base_type = 'TTC'; - $result = $facture->addline($labelforproduct, $pu_ht, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, '', $price_base_type, $pu_ttc, 1); + $result = $facture->addline($labelforproduct, $pu_ht, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, $date_start, $date_end, 0, 0, 0, $price_base_type, $pu_ttc, 1); if ($result <= 0) { $confattendee->error = $facture->error; $confattendee->errors = $facture->errors; @@ -605,7 +609,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen } } - if (!$error) { + if (!$error && is_object($facture)) { $db->commit(); // Registration was recorded and invoice was generated, but payment not yet done. @@ -657,6 +661,9 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; + } else { + $subject = null; + $msg = null; } $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index da85456f3ad..a7cb09f6b37 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -94,10 +94,10 @@ $user->loadDefaultValues(); * * @param string $title Title * @param string $head Head array - * @param int $disablejs More content into html header - * @param int $disablehead More content into html header - * @param string[]|string $arrayofjs Array of complementary js files - * @param string[]|string $arrayofcss Array of complementary css files + * @param int<0,1> $disablejs More content into html header + * @param int<0,1> $disablehead More content into html header + * @param string[] $arrayofjs Array of complementary js files + * @param string[] $arrayofcss Array of complementary css files * @return void */ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) @@ -604,13 +604,13 @@ foreach ($listofpartnershipobj as $partnershipobj) { $listofpartnership[$partnershipobj->id] = $partnershipobj->label; } -if (getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { - print $listofpartnership[getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')]; - print ''; +if (getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE')) { + print $listofpartnership[getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE')]; + print ''; } print ''."\n"; -if (!getDolGlobalString('PARTNERSHIP_NEWFORM_FORCETYPE')) { +if (!getDolGlobalInt('PARTNERSHIP_NEWFORM_FORCETYPE')) { print ''."\n"; diff --git a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php index f8f68ff261c..ecd08ea71a6 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/pdf_standard_recruitmentjobposition.modules.php @@ -645,9 +645,9 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show - * @return array List of templates + * @param DoliDB $db Database handler + * @param int<0,max> $maxfilenamelength Max length of value to show + * @return string[]|int<-1,0> List of templates */ public static function liste_modeles($db, $maxfilenamelength = 0) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 563269809c4..0e8fee90371 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2570,7 +2570,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } $i++; } - if ($NBCOLS > 0 && $j % 2 == 1) { + if ($NBCOLS > 0 && ($j % 2) == 1) { print ''; } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index b757b28c6b0..2362599a432 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2018 Pierre Chéné - * Copyright (C) 2019 Cedric Ancelin + * Copyright (C) 2019 Cedric Ancelin * Copyright (C) 2020-2024 Frédéric France * Copyright (C) 2023 Alexandre Janniaux * Copyright (C) 2024 MDW diff --git a/htdocs/workstation/class/api_workstations.class.php b/htdocs/workstation/class/api_workstations.class.php index a35388697d7..263a7b28c77 100644 --- a/htdocs/workstation/class/api_workstations.class.php +++ b/htdocs/workstation/class/api_workstations.class.php @@ -1,7 +1,8 @@ - * Copyright (C) 2019 Cedric Ancelin - * Copyright (C) 2024 Christian Humpel +/* Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Cedric Ancelin + * Copyright (C) 2024 Christian Humpel + * Copyright (C) 2024 MDW * * 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 @@ -170,7 +171,7 @@ class Workstations extends DolibarrApi $obj_ret['pagination'] = array( 'total' => (int) $total, 'page' => $page, //count starts from 0 - 'page_count' => ceil((int) $total/$limit), + 'page_count' => ceil((int) $total / $limit), 'limit' => $limit ); } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 502b0961488..4dbc3a640b4 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -51,9 +51,11 @@ parameters: - '#(?:Variable \$(?:_(?:FILES|POST|SERVER)|array_propal_object|baseUri|current_fiscal_period|d(?:b_create_(?:database|user)|olibarr_main_(?:db_prefix|url_root)|raftchecked)|erreur_ajout_date|isImageValid|keyforstripeterminalbank|(?:lo|mar)gin|max|n(?:ewProperty|um)|p(?:ermsgroupbyentitypluszero|ro(?:gressCalculated|parrayofkeyval)|ublic)|t(?:(?:itl|otal_tim)e|va_tx)|var)) in isset\(\) always exists and is not nullable#' - '#(?:Property CommonOrderLine::\$multicurrency_subprice \(float\) on left side of \?\?|isset\(\)) is not nullable#' - '#(?:(?:Elsei|I)f condition|Left side of (?:&&|\|\|)|Negated boolean expression|R(?:esult of (?:&&|\|\|)|ight side of (?:&&|\|\|))|Ternary operator condition) is always false#' - - '#(?:Comparison operation "(?:<(?:" between (?:0(?:(?:\|1)? and 0)|21(?: and 14|\.0 and 17)|int<(?:0, max>(?:(?:\|false)? and 0)|1, max> and 1)|null and 0)|=" between int<2, max> and 1)|>(?:" between (?:(?:-1|0) and 0|0(?: and 1(?:000)?|\|1\|2\|3 and 999)|1 and 1)|=" between 0 and 8))) is always fal#' + - '#(?:Comparison operation "(?:<(?:" between (?:0(?:(?:\|1)? and 0)|int<(?:0, max>(?:(?:\|false)? and 0)|1, max> and 1)|null and 0)|=" between int<2, max> and 1)|>(?:" between (?:(?:-1|0) and 0|0(?: and 1(?:000)?|\|1\|2\|3 and 999)|1 and 1)))) is always false#' + - '#(?:Comparison operation ">=" between 0 and 8) is always false#' + - "#(?:Comparison operation .<. between '' and 0 is always) true#" - - '#(?:Comparison operation "(?:<(?:" between (?:(?:..|-1) and 0|0 and 4)|=" between (?:0 and 0|int<100, 999> and 999))|>(?:" between (?:1(?:(?:\|2)? and 0)|int<(?:1, max> and 0|2, max> and 1))|=" between (?:\S+ and 0|21\.0 and (?:15|6\.0)|int<(?:0, max> and 0|1, max> and 1))))) is always true#' + - '#(?:Comparison operation "(?:<(?:" between (?:(?:..|-1) and 0|0 and 4)|=" between (?:0 and 0|int<100, 999> and 999))|>(?:" between (?:1(?:(?:\|2)? and 0)|int<(?:1, max> and 0|2, max> and 1))|=" between (?:\S+ and 0|int<(?:0, max> and 0|1, max> and 1))))) is always true#' - '#(?:Else branch is unreachable because (?:(?:previous|ternary operator) condition)) is always true#' - '#(?:(?:Elsei|I)f condition|Left side of (?:&&|\|\|)|Negated boolean expression|R(?:esult of (?:&&|\|\|)|ight side of (?:&&|\|\|))|Ternary operator condition) is always true#' - '#is_object\(\) with mixed will always evaluate to false#' @@ -78,7 +80,8 @@ parameters: - '#EvalMath::trigger\(\) expects string, int given#' - '# Diff::generatePartialDiff\(\) expects array#' - '# EmailCollector::getpart\(\) expects string#' - - '#expects int, float#' + - '#(?:convertSecondToTime) expects int, float\|string given#' + - '#(?:Comm(?:(?:ande::updateline|on(?:Invoice::getLibStatut|StickerGenerator::(?:Set_Char_Size|_Croix|convertMetric)))\(\))|Facture(?:(?:::update|FournisseurRec::add)line\(\))|(?:Holiday::addLogCP|Loan::getLibStatut|SupplierProposal::updateline)\(\)|c(?:alcul_price_total|onvert(?:DurationtoHour|SecondToTime))|dol_(?:substr|time_plus_duree)|pdf_(?:azur::_tableau_(?:(?:info|tot)\(\))|ban(?:::_tableau\(\)|k)|c(?:anelle::_tableau_(?:(?:tot|versements)\(\))|ornas::_tableau_(?:(?:info|tot)\(\))|rabe::_tableau_(?:(?:info|tot|versements)\(\))|yan::draw(?:(?:Info|Total)Table\(\)))|e(?:agle(?:(?:::_tableau_tot|_proforma::drawTotalTable)\(\))|instein::_tableau_(?:(?:info|tot)\(\))|ratosthene::draw(?:(?:Info|Total)Table\(\))|spadon::_tableau_tot\(\))|muscadet::_tableau_(?:(?:info|tot)\(\))|octopus::(?:_table(?:(?:FirstPage|au)\(\))|draw(?:(?:Info|Total)Table\(\)))|page(?:foot|head)|(?:rouget::_tableau_tot|s(?:epamandate::_tableau(?:_info)?|ponge::draw(?:(?:Info|Total)Table)|quille::_tableau_tot|t(?:andard_(?:e(?:(?:valuation|xpensereport)::_tableau|xpensereport::tablePayments)|(?:myobjec|supplierpaymen)t::_tableau|supplierpayment::_tableau_cheque)|orm::_tableau_info|rato::tabSignature))|t(?:cpdflabel::writeBarcode|yphon::_tableau_info)|vinci::_tableau_info)\(\)|w(?:atermark|rite(?:LinkedObjects|linedesc))|zenith::_tableau_tot\(\))|usleep) expects int, float given\.#' - '#::saveboxorder\(\) expects int, array#' - '# (fetchObjectByElement|print_actions_filter|dol_mktime|dol_remove_file_process) expects int, array\|string given.#' - '# (CSMSFile) constructor expects int, array\|string given.#'
'.$langs->trans('PartnershipType').' *'."\n"; print $form->selectarray("partnershiptype", $listofpartnership, GETPOSTISSET('partnershiptype') ? GETPOSTINT('partnershiptype') : 'ifone', 1); print '