Skip to content

Commit

Permalink
Qual: Fix phan notices
Browse files Browse the repository at this point in the history
# Qual: Fix phan notices

Fix phan notices in several classes that have UnknownObjectMethod calls and classes
that had notices in relation with these classes
  • Loading branch information
mdeweerd committed Sep 29, 2024
1 parent 1754ee6 commit e8175af
Show file tree
Hide file tree
Showing 42 changed files with 614 additions and 217 deletions.
100 changes: 40 additions & 60 deletions dev/tools/phan/baseline.txt

Large diffs are not rendered by default.

115 changes: 115 additions & 0 deletions dev/tools/phan/stubs/ovhsms.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php
/* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/

namespace {
/**
* Use an OVH account to send SMS with Dolibarr
*/
class OvhSms extends \CommonObject
{
public $db;
//!< To store db handler
public $error;
//!< To return error code (or message)
public $errors = array();
//!< To return several error codes (or messages)
public $element = 'ovhsms';
//!< Id that identify managed object
public $id;
public $account;
public $socid;
public $contact_id;
public $member_id;
public $fk_project;
public $nostop;
public $expe;
public $dest;
public $message;
public $validity;
public $class;
public $deferred;
public $priority;
public $soap;
// Old API
public $conn;
// New API
public $endpoint;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
}
/**
* Logout
*
* @return void
*/
public function logout()
{
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Send SMS
*
* @return int <=0 if error, >0 if OK
*/
public function SmsSend()
{
}
/**
* Show HTML select box to select account
*
* @return void
*/
public function printListAccount()
{
}
/**
* Return list of SMSAccounts
*
* @return array
*/
public function getSmsListAccount()
{
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Return Credit
*
* @return array
*/
public function CreditLeft()
{
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Return History
*
* @return array
*/
public function SmsHistory()
{
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps,PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Return list of possible SMS senders
*
* @return array|int <0 if KO, array with list of available senders if OK
*/
public function SmsSenderList()
{
}
/**
* Call soapDebug method to output traces
*
* @return void
*/
public function soapDebug()
{
}
}
}
4 changes: 2 additions & 2 deletions htdocs/barcode/codeinit.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
$thirdpartystatic->id = $obj->rowid;
$nextvalue = $modBarCodeThirdparty->getNextValue($thirdpartystatic, '');

$result = $thirdpartystatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'THIRDPARTY_MODIFY');
$result = $thirdpartystatic->setValueFrom('barcode', $nextvalue, '', null, 'text', '', $user, 'THIRDPARTY_MODIFY');

$nbtry++;
if ($result > 0) {
Expand Down Expand Up @@ -249,7 +249,7 @@
$nextvalue = $modBarCodeProduct->getNextValue($productstatic, '');

//print 'Set value '.$nextvalue.' to product '.$productstatic->id." ".$productstatic->ref." ".$productstatic->type."<br>\n";
$result = $productstatic->setValueFrom('barcode', $nextvalue, '', '', 'text', '', $user, 'PRODUCT_MODIFY');
$result = $productstatic->setValueFrom('barcode', $nextvalue, '', null, 'text', '', $user, 'PRODUCT_MODIFY');

$nbtry++;
if ($result > 0) {
Expand Down
7 changes: 4 additions & 3 deletions htdocs/bookcal/availabilities_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -180,8 +181,8 @@
}


// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';

// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
Expand All @@ -196,7 +197,7 @@
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'));
Expand Down
3 changes: 2 additions & 1 deletion htdocs/bookcal/calendar_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2023 Alice Adminson <aadminson@example.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -158,7 +159,7 @@
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'));
Expand Down
4 changes: 2 additions & 2 deletions htdocs/comm/propal/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@
$line->multicurrency_total_tva = $line->tva_tx * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
$line->multicurrency_total_ttc = (1 + $line->tva_tx) * $line->qty * (float) $subprice * $line->multicurrency_subprice / $line->subprice;
// Used previous $line->subprice and $line->multicurrency_subprice above, now they can be set to their new values
$line->subprice = $subprice;
$line->subprice = (float) $subprice;
$line->multicurrency_subprice = $multicurrency_subprice;
}
} elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && !GETPOST('submitforallmargins', 'alpha') && $usercancreate) { // Add line
Expand Down Expand Up @@ -1170,7 +1170,7 @@
}
}

if ( !$pricebycustomerexist && $object->thirdparty->price_level) { // If price per segment
if (!$pricebycustomerexist && $object->thirdparty->price_level) { // If price per segment
$pu_ht = $prod->multiprices[$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level];
Expand Down
52 changes: 30 additions & 22 deletions htdocs/commande/class/commande.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class Commande extends CommonOrder
public $date_commande;

/**
* @var null|int|'' Date expected of shipment (date of start of shipment, not the reception that occurs some days after)
* @var null|int|'' Expected shipment date (date of start of shipment, not the reception that occurs some days after)
*/
public $delivery_date;

Expand All @@ -213,10 +213,14 @@ class Commande extends CommonOrder
public $fk_remise_except;

/**
* @deprecated
* @var string
* @deprecated See $fk_remise_except
*/
public $remise_percent;

/**
* @var int
*/
public $source; // Order mode. How we received order (by phone, by email, ...)

/**
Expand Down Expand Up @@ -253,13 +257,17 @@ class Commande extends CommonOrder
public $lines = array();


//! key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...)
/**
* @var string key of module source when order generated from a dedicated module ('cashdesk', 'takepos', ...)
*/
public $module_source;
//! key of pos source ('0', '1', ...)
/**
* @var string key of pos source ('0', '1', ...)
*/
public $pos_source;

/**
* @var array Array with line of all shipments
* @var array<int,float> Array with lines of all shipments (qty)
*/
public $expeditions;

Expand Down Expand Up @@ -1325,7 +1333,7 @@ public function createFromClone(User $user, $socid = 0)
/**
* Load an object from a proposal and create a new order into database
*
* @param Object $object Object source
* @param Propal $object Object source
* @param User $user User making creation
* @return int Return integer <0 if KO, 0 if nothing done, 1 if OK
*/
Expand Down Expand Up @@ -1506,11 +1514,11 @@ public function createFromProposal($object, User $user)
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax)
* @param string $label Label
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
* @param array<string,mixed> $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* @param ?int $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,'....
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
* @param double $pu_ht_devise Unit price in currency
* @param float $pu_ht_devise Unit price in currency
* @param string $ref_ext line external reference
* @param int $noupdateafterinsertline No update after insert of line
* @return int >0 if OK, <0 if KO
Expand Down Expand Up @@ -3116,12 +3124,12 @@ public function classifyUnBilled(User $user, $notrigger = 0)
* @param int $pa_ht Price (without tax) of product when it was bought
* @param string $label Label
* @param int $special_code Special code (also used by externals modules!)
* @param array $array_options extrafields array
* @param int|null $fk_unit Code of the unit to use. Null to use the default one
* @param double $pu_ht_devise Amount in currency
* @param array<string,mixed> $array_options extrafields array
* @param ?int $fk_unit Code of the unit to use. Null to use the default one
* @param float $pu_ht_devise Amount in currency
* @param int $notrigger disable line update trigger
* @param string $ref_ext external reference
* @param integer $rang line rank
* @param int $rang line rank
* @return int Return integer < 0 if KO, > 0 if OK
*/
public function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = array(), $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $ref_ext = '', $rang = 0)
Expand Down Expand Up @@ -4132,11 +4140,11 @@ public function getLinesArray()
*
* @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
* @return int 0 if KO, 1 if OK
* @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<string,mixed> $moreparams Array to provide more information
* @return int<0,1> 0 if KO, 1 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
{
Expand Down Expand Up @@ -4235,10 +4243,10 @@ public function showDelay()
/**
* Set signed status
*
* @param User $user Object user that modify
* @param int $status Newsigned status to set (often a constant like self::STATUS_XXX)
* @param int $notrigger 1 = Does not execute triggers, 0 = Execute triggers
* @param string $triggercode Trigger code to use
* @param User $user Object user that modify
* @param int $status Newsigned status to set (often a constant like self::STATUS_XXX)
* @param int<0,1> $notrigger 1 = Does not execute triggers, 0 = Execute triggers
* @param string $triggercode Trigger code to use
* @return int 0 < if KO, > 0 if OK
*/
public function setSignedStatus(User $user, int $status = 0, int $notrigger = 0, $triggercode = ''): int
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/accounting-files.php
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@
} elseif ($data['item'] == 'ExpenseReport') {
$expensereport->id = $data['id'];
$expensereport->ref = $data['ref'];
print $expensereport->getNomUrl(1, 0, 0, '', 0, 0);
print $expensereport->getNomUrl(1, 0, 0, 0, 0, 0);
} elseif ($data['item'] == 'SalaryPayment') {
$salary_payment->id = $data['id'];
$salary_payment->ref = $data['ref'];
Expand Down
3 changes: 2 additions & 1 deletion htdocs/compta/bank/various_payment/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
*/

$form = new Form($db);
$proj = null;
if ($arrayfields['account']['checked'] || $arrayfields['subledger']['checked']) {
$formaccounting = new FormAccounting($db);
}
Expand Down Expand Up @@ -783,7 +784,7 @@
// Project
if ($arrayfields['project']['checked']) {
print '<td class="nowraponall">';
if ($obj->fk_project > 0) {
if ($obj->fk_project > 0 && is_object($proj)) {
$proj->fetch($obj->fk_project);
print $proj->getNomUrl(1);
}
Expand Down
3 changes: 2 additions & 1 deletion htdocs/compta/deplacement/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -172,7 +173,7 @@
// Set fields
$dated = dol_mktime(GETPOSTINT('datedhour'), GETPOSTINT('datedmin'), GETPOSTINT('datedsec'), GETPOSTINT('datedmonth'), GETPOSTINT('datedday'), GETPOSTINT('datedyear'));
$object->fetch($id);
$result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY');
$result = $object->setValueFrom('dated', $dated, '', null, 'date', '', $user, 'DEPLACEMENT_MODIFY');
if ($result < 0) {
dol_print_error($db, $object->error);
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/compta/facture/class/facture.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class Facture extends CommonInvoice
*/
public $module_source;
/**
* @var int key of pos source ('0', '1', ...)
* @var string key of pos source ('0', '1', ...)
*/
public $pos_source;
/**
Expand Down
Loading

0 comments on commit e8175af

Please sign in to comment.