mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
qual fix PHAN warning when using $product->fetch($id) with $id not being an integer (#30019)
* qual fix phan warning on $object->fetch('')
TypeError PhanTypeMismatchArgumentProbablyReal Argument 1 ($id) is '' of type '' but \Product::fetch() takes int (no real type) defined at htdocs/product/class/product.class.php:2540 (the inferred real argument type has nothing in common with the parameter's phpdoc type)
htdocs/variants/class/ProductCombination.class.php 773
* Update api_categories.class.php
* Update api_categories.class.php
* Update api_products.class.php
* Update api_products.class.php
* Update combinations.php
This commit is contained in:
parent
99f0888ed0
commit
b14d20bc4c
|
|
@ -490,7 +490,7 @@ class Categories extends DolibarrApi
|
|||
throw new RestException(400, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
$result = $object->fetch('', $object_ref);
|
||||
$result = $object->fetch(0, $object_ref);
|
||||
if ($result > 0) {
|
||||
$result = $this->category->add_type($object, $type);
|
||||
if ($result < 0) {
|
||||
|
|
@ -650,7 +650,7 @@ class Categories extends DolibarrApi
|
|||
throw new RestException(400, "this type is not recognized yet.");
|
||||
}
|
||||
|
||||
$result = $object->fetch('', (string) $object_ref);
|
||||
$result = $object->fetch(0, (string) $object_ref);
|
||||
if ($result > 0) {
|
||||
$result = $this->category->del_type($object, $type);
|
||||
if ($result < 0) {
|
||||
|
|
|
|||
|
|
@ -1759,7 +1759,7 @@ class Products extends DolibarrApi
|
|||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$result = $this->product->fetch('', $ref);
|
||||
$result = $this->product->fetch(0, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Product not found');
|
||||
}
|
||||
|
|
@ -1881,7 +1881,7 @@ class Products extends DolibarrApi
|
|||
}
|
||||
}
|
||||
|
||||
$result = $this->product->fetch('', trim($ref));
|
||||
$result = $this->product->fetch(0, trim($ref));
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Product not found');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ class ProductCombination
|
|||
|
||||
if (!empty($forced_refvar) && $forced_refvar != $product->ref) {
|
||||
$existingProduct = new Product($this->db);
|
||||
$result = $existingProduct->fetch('', $forced_refvar);
|
||||
$result = $existingProduct->fetch(0, $forced_refvar);
|
||||
if ($result > 0) {
|
||||
$newproduct = $existingProduct;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ if ($action === 'confirm_deletecombination') {
|
|||
//Check destination product
|
||||
$dest_product = GETPOST('dest_product');
|
||||
|
||||
if ($prodstatic->fetch('', $dest_product) > 0) {
|
||||
if ($prodstatic->fetch(0, $dest_product) > 0) {
|
||||
//To prevent from copying to the same product
|
||||
if ($prodstatic->ref != $object->ref) {
|
||||
if ($prodcomb->copyAll($user, $object->id, $prodstatic) > 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user