Fix warnings

This commit is contained in:
Laurent Destailleur 2020-12-17 17:04:42 +01:00
parent 9cd211a79b
commit eed14bd9af
4 changed files with 13 additions and 9 deletions

View File

@ -1621,7 +1621,8 @@ class CommandeFournisseur extends CommonOrder
// We use 'none' instead of $ref_supplier, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
$result = $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
$result = $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', (isset($this->fk_soc) ? $this->fk_soc : $this->socid)); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$ref_supplier/$this->fk_soc
// If supplier order created from customer order, we take best supplier price
// If $pu (defined previously from pu_ht or pu_ttc) is not defined at all, we also take the best supplier price
if ($result > 0 && ($origin == 'commande' || $pu === ''))

View File

@ -282,6 +282,7 @@ class ProductFournisseur extends Product
// Multicurrency
$multicurrency_buyprice = null;
$multicurrency_unitBuyPrice = null;
$fk_multicurrency = null;
if (!empty($conf->multicurrency->enabled)) {
if (empty($multicurrency_tx)) $multicurrency_tx = 1;
if (empty($multicurrency_buyprice)) $multicurrency_buyprice = 0;

View File

@ -90,6 +90,7 @@ class Stripe extends CommonObject
{
global $conf;
$key = '';
if ($entity < 0) $entity = $conf->entity;
$sql = "SELECT tokenstring";
@ -103,7 +104,8 @@ class Stripe extends CommonObject
}
$sql .= " AND fk_user IS NULL AND fk_adherent IS NULL";
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
dol_syslog(get_class($this)."::getStripeAccount", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {

View File

@ -411,30 +411,30 @@ class AdherentTest extends PHPUnit\Framework\TestCase
$thirdparty = new Societe($db);
$thirdparty->initAsSpecimen();
$result = $thirdparty->create($user);
print __METHOD__." id=".$localobject->id." third party id=".$thirdparty->id." result=".$result."\n";
$this->assertTrue($result > 0);
print __METHOD__." third party id=".$thirdparty->id." result=".$result."\n";
$this->assertTrue($result > 0, 'Test to create a thirdparty specimen to use it to set as thirdparty of a member');
//Set Third Party ID
$result = $localobject->setThirdPartyId($thirdparty->id);
$this->assertEquals($result, 1);
$this->assertEquals($result, 1, 'Set thirdparty');
print __METHOD__." id=".$localobject->id." result=".$result."\n";
//Adherent is updated with new data
$localobject->fetch($localobject->id);
$this->assertEquals($localobject->fk_soc, $thirdparty->id);
$this->assertEquals($localobject->fk_soc, $thirdparty->id, 'Fetch member');
print __METHOD__." id=".$localobject->id." result=".$result."\n";
//We remove the third party association
$result = $localobject->setThirdPartyId(0);
$this->assertEquals($result, 1);
$this->assertEquals($result, 1, 'Removed the link with thirdparty');
//And check if it has been updated
$localobject->fetch($localobject->id);
$this->assertNull($localobject->fk_soc);
$this->assertNull($localobject->fk_soc, 'Check field is null');
//Now we remove the third party
$result = $thirdparty->delete($thirdparty->id, $user);
$this->assertEquals($result, 1);
$this->assertEquals($result, 1, 'Delete thirdparty');
return $localobject;
}