Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qual: Fix phan/stan notices for conferenceorbooth, productcustomerprice #31541

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dev/tools/phan/baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ return [
'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanPossiblyUndeclaredVariable', 'PhanUndeclaredProperty'],
'htdocs/emailcollector/class/emailcollectoraction.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/emailcollector/class/emailcollectorfilter.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanPluginUnknownPropertyType', 'PhanPossiblyNullTypeMismatchProperty', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/eventorganization/conferenceorbooth_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorbooth_contact.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
Expand Down Expand Up @@ -639,7 +639,6 @@ return [
'htdocs/product/class/html.formproduct.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/product/class/product.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/product/class/productbatch.class.php' => ['PhanPluginEmptyStatementIf', 'PhanPluginUnknownPropertyType'],
'htdocs/product/class/productcustomerprice.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/product/class/productfournisseurprice.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/product/class/propalmergepdfproduct.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/product/document.php' => ['PhanPossiblyNullTypeMismatchProperty', 'PhanPossiblyUndeclaredGlobalVariable'],
Expand Down
6 changes: 3 additions & 3 deletions htdocs/comm/propal/class/propal.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public function add_product($idproduct, $qty, $remise_percent = 0)

$productdesc = $prod->description;

$tva_tx = get_default_tva($mysoc, $this->thirdparty, $prod->id);
$tva_tx = (string) get_default_tva($mysoc, $this->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $this->thirdparty, $prod->id);
if (empty($tva_tx)) {
$tva_npr = 0;
Expand Down Expand Up @@ -1488,14 +1488,14 @@ public function createFromClone(User $user, $socid = 0, $forceentity = null, $up
if ($res > 0) {
if ($update_prices === true) {
$pu_ht = $prod->price;
$tva_tx = get_default_tva($mysoc, $objsoc, $prod->id);
$tva_tx = (string) get_default_tva($mysoc, $objsoc, $prod->id);
$remise_percent = $objsoc->remise_percent;

if (getDolGlobalString('PRODUIT_MULTIPRICES') && $objsoc->price_level > 0) {
$pu_ht = $prod->multiprices[$objsoc->price_level];
if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility
if (isset($prod->multiprices_tva_tx[$objsoc->price_level])) {
$tva_tx = $prod->multiprices_tva_tx[$objsoc->price_level];
$tva_tx = (string) $prod->multiprices_tva_tx[$objsoc->price_level];
}
}
} elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
Expand Down
4 changes: 2 additions & 2 deletions htdocs/commande/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@
$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
$price_base_type = $prodcustprice->lines[0]->price_base_type;
$tva_tx = $prodcustprice->lines[0]->tva_tx;
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', (string) $tva_tx)) {
$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
}
$tva_npr = $prodcustprice->lines[0]->recuperableonly;
Expand All @@ -871,7 +871,7 @@
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}

if ( !$pricebycustomerexist && !empty($object->thirdparty->price_level)) { //// If price per segment
if (!$pricebycustomerexist && !empty($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
2 changes: 1 addition & 1 deletion htdocs/core/lib/date.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function getServerTimeZoneInt($refgmtdate = 'now')
/**
* Add a delay to a date
*
* @param int $time Date timestamp (or string with format YYYY-MM-DD)
* @param int|string $time Date timestamp (or string with format YYYY-MM-DD)
* @param float $duration_value Value of delay to add
* @param string $duration_unit Unit of added delay (d, m, y, w, h, i)
* @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -12700,7 +12700,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
* An function to complete dropdown url in dolGetButtonAction
*
* @param string $url the Url to complete
* @param array|array<string> $params params of dolGetButtonAction function
* @param array<string,mixed> $params params of dolGetButtonAction function
* @param bool $addDolUrlRoot to add root url
* @return string
*/
Expand Down
73 changes: 68 additions & 5 deletions htdocs/eventorganization/class/conferenceorboothattendee.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class ConferenceOrBoothAttendee extends CommonObject
*/
public $picto = 'contact';

/**
* @var int<0,1>
*/
public $paid = 0;

const STATUS_DRAFT = 0;
Expand Down Expand Up @@ -116,25 +119,85 @@ class ConferenceOrBoothAttendee extends CommonObject
'ip' => array('type' => 'varchar(250)', 'label' => 'IPAddress', 'enabled' => 1, 'position' => 900, 'notnull' => -1, 'visible' => -2,),
'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '0', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array('0' => 'Draft', '1' => 'Validated', '9' => 'Canceled'),),
);
/**
* @var int
*/
public $rowid;
/**
* @var string
*/
public $ref;
/**
* @var int
*/
public $fk_actioncomm;
/**
* @var int
*/
public $fk_project;
/**
* @var string
*/
public $email;
/**
* @var string
*/
public $firstname;
/**
* @var string
*/
public $lastname;
/**
* @var int
*/
public $fk_soc;
/**
* @var string
*/
public $email_company;
/**
* @var int|string
*/
public $date_subscription;
/**
* @var int
*/
public $fk_invoice;
/**
* @var string|float (Price)
*/
public $amount;
/**
* @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
*/
public $status;
// END MODULEBUILDER PROPERTIES

Expand Down Expand Up @@ -556,12 +619,12 @@ public function validate($user, $notrigger = 0)
$this->db->begin();

// Define new ref
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
$num = (string) $this->ref;
if (!$error && (preg_match('/^[\(]?PROV/i', $num) || empty($num))) { // empty should not happened, but when it occurs, the test saves life
$num = $this->getNextNumRef();
} else {
$num = $this->ref;
}
$this->newref = $num;

$this->newref = (string) $num;

if (!empty($num)) {
// Validate
Expand Down Expand Up @@ -1108,7 +1171,7 @@ public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id)
*
* @param Translate $langs Language object for translation of civility (used only if option is 1)
* @param int $option 0=No option
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
* @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
* @param int $maxlen Maximum length
* @return string String with full name
*/
Expand Down
2 changes: 1 addition & 1 deletion htdocs/fourn/facture/card-rec.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->model_pdf = GETPOST('modelpdf', 'alpha');
$object->usenewprice = GETPOST('usenewprice', 'alpha');
$object->usenewprice = GETPOSTINT('usenewprice');

$object->frequency = $frequency;
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
Expand Down
Loading