Fix some php codce smell

This commit is contained in:
Hystepik 2023-12-20 14:22:45 +01:00
parent fe1b6c2723
commit 5e4a4da130
18 changed files with 38 additions and 38 deletions

View file

@ -740,7 +740,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '')
function fieldListAccountModel($fieldlist, $obj = null, $tabname = '', $context = '')
{
global $langs, $db;
global $form;

View file

@ -958,7 +958,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $context = '')
function fieldListAccountingCategories($fieldlist, $obj = null, $tabname = '', $context = '')
{
global $conf, $langs, $db;
global $form, $mysoc;

View file

@ -691,7 +691,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
function fieldListJournal($fieldlist, $obj = null, $tabname = '', $context = '')
{
global $conf, $langs, $db;
global $form, $mysoc;

View file

@ -829,7 +829,7 @@ class AccountancyExport
* @param array $objectLines data
* @param resource $exportFile [=null] File resource to export or print if null
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
* @return array Archive file list : array of ['path', 'name']
*/
public function exportQuadratus($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
@ -1309,7 +1309,7 @@ class AccountancyExport
* @param array $objectLines data
* @param resource $exportFile [=null] File resource to export or print if null
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
* @return array Archive file list : array of ['path', 'name']
*/
public function exportFEC($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)
@ -1520,7 +1520,7 @@ class AccountancyExport
* @param array $objectLines data
* @param resource $exportFile [=null] File resource to export or print if null
* @param array $archiveFileList [=array()] Archive file list : array of ['path', 'name']
* @param bool $withAttachment [=0] Not add files or 1 to have attached in an archive
* @param int $withAttachment [=0] Not add files or 1 to have attached in an archive
* @return array Archive file list : array of ['path', 'name']
*/
public function exportFEC2($objectLines, $exportFile = null, $archiveFileList = array(), $withAttachment = 0)

View file

@ -2124,7 +2124,7 @@ class BookKeeping extends CommonObject
* @param array $event Event options
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* @param string $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* @return string String with HTML select
*/
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')

View file

@ -1361,7 +1361,7 @@ class Adherent extends CommonObject
* @param bool $fetch_subscriptions To load member subscriptions
* @return int >0 if OK, 0 if not found, <0 if KO
*/
public function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
public function fetch($rowid, $ref = '', $fk_soc = 0, $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
{
global $langs;
@ -1679,7 +1679,7 @@ class Adherent extends CommonObject
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @param int $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @param string $ext_payment_id External id of payment (for example Stripe charge id)
* @param string $ext_payment_site Name of external paymentmode (for example 'stripe')
* @return int Return integer <0 if KO, >0 if OK

View file

@ -2540,7 +2540,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return string '' or value of entity into table
*/
function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
{
global $conf, $langs, $db, $mysoc;
global $form;

View file

@ -1354,7 +1354,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
{
global $langs, $user, $db;
global $form;

View file

@ -681,7 +681,7 @@ $db->close();
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
function fieldListWebsites($fieldlist, $obj = null, $tabname = '', $context = '')
{
global $conf, $langs, $db;
global $form;

View file

@ -797,7 +797,7 @@ class BlockedLog
* Encode data
*
* @param string $data Data to serialize
* @param string $mode 0=serialize, 1=json_encode
* @param int $mode 0=serialize, 1=json_encode
* @return string Value serialized, an object (stdClass)
*/
public function dolEncodeBlockedData($data, $mode = 0)
@ -817,7 +817,7 @@ class BlockedLog
* Decode data
*
* @param string $data Data to unserialize
* @param string $mode 0=unserialize, 1=json_decode
* @param int $mode 0=unserialize, 1=json_decode
* @return object Value unserialized, an object (stdClass)
*/
public function dolDecodeBlockedData($data, $mode = 0)
@ -852,7 +852,7 @@ class BlockedLog
* Create blocked log in database.
*
* @param User $user Object user that create
* @param int $forcesignature Force signature (for example '0000000000' when we disabled the module)
* @param string $forcesignature Force signature (for example '0000000000' when we disabled the module)
* @return int Return integer <0 if KO, >0 if OK
*/
public function create($user, $forcesignature = '')

View file

@ -602,7 +602,7 @@ class BOM extends CommonObject
* @param int $fk_default_workstation Default workstation
* @return int Return integer <0 if KO, Id of created object if OK
*/
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0, $fk_default_workstation = null)
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = array(), $fk_default_workstation = null)
{
global $mysoc, $conf, $langs, $user;
@ -710,7 +710,7 @@ class BOM extends CommonObject
* @param int $fk_default_workstation Default workstation
* @return int Return integer <0 if KO, Id of updated BOM-Line if OK
*/
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = 0, $fk_default_workstation = null)
public function updateLine($rowid, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $import_key = null, $fk_unit = 0, $array_options = array(), $fk_default_workstation = null)
{
global $mysoc, $conf, $langs, $user;
@ -1594,7 +1594,7 @@ class BOM extends CommonObject
* @param int $level Protection against infinite loop
* @return void
*/
public function getParentBomTreeRecursive(&$TParentBom, $bom_id = '', $level = 1)
public function getParentBomTreeRecursive(&$TParentBom, $bom_id = 0, $level = 1)
{
// Protection against infinite loop

View file

@ -1385,7 +1385,7 @@ class Categorie extends CommonObject
* @param string $sep Separator
* @param string $url Url ('', 'none' or 'urltouse')
* @param int $nocolor 0
* @param string $addpicto Add picto into link
* @param int $addpicto Add picto into link
* @return array
*/
public function print_all_ways($sep = '&gt;&gt;', $url = '', $nocolor = 0, $addpicto = 0)

View file

@ -784,7 +784,7 @@ class ActionComm extends CommonObject
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @param string $loadresources 1=Load also resources
* @param int $loadresources 1=Load also resources
* @return int Return integer <0 if KO, >0 if OK
*/
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
@ -1328,7 +1328,7 @@ class ActionComm extends CommonObject
* @param string $filter Other filter
* @param string $sortfield Sort on this field
* @param string $sortorder ASC or DESC
* @param string $limit Limit number of answers
* @param int $limit Limit number of answers
* @return ActionComm[]|string Error string if KO, array with actions if OK
*/
public function getActions($socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0)
@ -1542,7 +1542,7 @@ class ActionComm extends CommonObject
* @param int $percent Percent
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @param int $datestart Date start of event
* @param int|string $datestart Date start of event
* @return string Label
*/
public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')

View file

@ -103,7 +103,7 @@ class AgendaEvents extends DolibarrApi
* @param string $properties Restrict the data returned to theses properties. Ignored if empty. Comma separated list of properties names
* @return array Array of Agenda Events objects
*/
public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '', $properties = '')
public function index($sortfield = "t.id", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = '', $sqlfilters = '', $properties = '')
{
global $db, $conf;

View file

@ -109,7 +109,7 @@ class ICal
*
* @param string $uri Url
* @param string $usecachefile Full path of a cache file to use a cache file
* @param string $delaycache Delay in seconds for cache (by default 3600 secondes)
* @param int $delaycache Delay in seconds for cache (by default 3600 secondes)
* @return array|string
*/
public function parse($uri, $usecachefile = '', $delaycache = 3600)

View file

@ -1743,8 +1743,8 @@ $db->close();
* @param string $newparam Parameters on current URL
* @param int $showinfo Add extended information (used by day and week view)
* @param int $minheight Minimum height for each event. 60px by default.
* @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @param string $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
* @param int $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button"
* @param array $bookcalcalendarsarray Used for Bookcal module array of calendar of bookcal
* @return void
*/
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0, $bookcalcalendarsarray = array())

View file

@ -577,8 +577,8 @@ class Propal extends CommonObject
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price without tax
* @param string $label ???
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param int|string $date_start Start date of the line
* @param int|string $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
@ -589,7 +589,7 @@ class Propal extends CommonObject
* @return int >0 if OK, <0 if KO
* @see add_product()
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0)
{
global $mysoc, $conf, $langs;
@ -827,8 +827,8 @@ class Propal extends CommonObject
* @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label ???
* @param int $type 0/1=Product/service
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param int|string $date_start Start date of the line
* @param int|string $date_end End date of the line
* @param array $array_options extrafields array
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Unit price in currency
@ -836,7 +836,7 @@ class Propal extends CommonObject
* @param integer $rang line rank
* @return int 0 if OK, <0 if KO
*/
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
public function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $rang = 0)
{
global $mysoc, $langs;

View file

@ -1483,8 +1483,8 @@ class Commande extends CommonOrder
* @param int $fk_remise_except Id remise
* @param string $price_base_type HT or TTC
* @param float $pu_ttc Prix unitaire TTC
* @param int $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int|string $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int|string $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param int $type Type of line (0=product, 1=service). Not used if fk_product is defined, the type of product is used.
* @param int $rang Position of line
* @param int $special_code Special code (also used by externals modules!)
@ -1508,7 +1508,7 @@ class Commande extends CommonOrder
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
*/
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0)
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $ref_ext = '', $noupdateafterinsertline = 0)
{
global $mysoc, $conf, $langs, $user;
@ -1755,8 +1755,8 @@ class Commande extends CommonOrder
* @param int $idproduct Product Id
* @param float $qty Quantity
* @param float $remise_percent Product discount relative
* @param int $date_start Start date of the line
* @param int $date_end End date of the line
* @param int|string $date_start Start date of the line
* @param int|string $date_end End date of the line
* @return void
*
* TODO Remplacer les appels a cette fonction par generation objet Ligne
@ -2728,7 +2728,7 @@ class Commande extends CommonOrder
* @param string $sortorder Sort order
* @return int|array -1 if KO, array with result if OK
*/
public function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
public function liste_array($shortlist = 0, $draft = 0, $excluser = null, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC')
{
// phpcs:enable
global $user;