Clean code
This commit is contained in:
parent
3df0d5dc22
commit
2668c07e5a
@ -136,7 +136,7 @@ class MouvementStock extends CommonObject
|
|||||||
* 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer),
|
* 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer),
|
||||||
* 2=output (stock decrease), 3=input (stock increase)
|
* 2=output (stock decrease), 3=input (stock increase)
|
||||||
* Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2.
|
* Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2.
|
||||||
* @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.
|
* @param int $price Unit price HT of product, used to calculate average weighted price (AWP or PMP in french). If 0, average weighted price is not changed.
|
||||||
* @param string $label Label of stock movement
|
* @param string $label Label of stock movement
|
||||||
* @param string $inventorycode Inventory code
|
* @param string $inventorycode Inventory code
|
||||||
* @param string $datem Force date of movement
|
* @param string $datem Force date of movement
|
||||||
@ -159,6 +159,7 @@ class MouvementStock extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch);
|
dol_syslog(get_class($this)."::_create start userid=$user->id, fk_product=$fk_product, warehouse_id=$entrepot_id, qty=$qty, type=$type, price=$price, label=$label, inventorycode=$inventorycode, datem=".$datem.", eatby=".$eatby.", sellby=".$sellby.", batch=".$batch.", skip_batch=".$skip_batch);
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
$price = price2num($price, 'MU'); // Clean value for the casse we receive a float zero value, to have it a real zero value.
|
||||||
if (empty($price)) $price = 0;
|
if (empty($price)) $price = 0;
|
||||||
$now = (!empty($datem) ? $datem : dol_now());
|
$now = (!empty($datem) ? $datem : dol_now());
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ class MouvementStock extends CommonObject
|
|||||||
$this->warehouse_id = $entrepot_id;
|
$this->warehouse_id = $entrepot_id;
|
||||||
$this->qty = $qty;
|
$this->qty = $qty;
|
||||||
$this->type = $type;
|
$this->type = $type;
|
||||||
$this->price = $price;
|
$this->price = price2num($price);
|
||||||
$this->label = $label;
|
$this->label = $label;
|
||||||
$this->inventorycode = $inventorycode;
|
$this->inventorycode = $inventorycode;
|
||||||
$this->datem = $now;
|
$this->datem = $now;
|
||||||
@ -471,7 +472,7 @@ class MouvementStock extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate new PMP.
|
// Calculate new AWP (PMP)
|
||||||
$newpmp = 0;
|
$newpmp = 0;
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -742,11 +742,11 @@ class Stripe extends CommonObject
|
|||||||
$cvc = $obj->cvn; // cvn in database, cvc for stripe
|
$cvc = $obj->cvn; // cvn in database, cvc for stripe
|
||||||
$cardholdername = $obj->proprio;
|
$cardholdername = $obj->proprio;
|
||||||
|
|
||||||
$remoteip = getUserRemoteIP();
|
$ipaddress = getUserRemoteIP();
|
||||||
|
|
||||||
$dataforcard = array(
|
$dataforcard = array(
|
||||||
"source" => array('object'=>'card', 'exp_month'=>$exp_date_month, 'exp_year'=>$exp_date_year, 'number'=>$number, 'cvc'=>$cvc, 'name'=>$cardholdername),
|
"source" => array('object'=>'card', 'exp_month'=>$exp_date_month, 'exp_year'=>$exp_date_year, 'number'=>$number, 'cvc'=>$cvc, 'name'=>$cardholdername),
|
||||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$remoteip)
|
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress)
|
||||||
);
|
);
|
||||||
|
|
||||||
//$a = \Stripe\Stripe::getApiKey();
|
//$a = \Stripe\Stripe::getApiKey();
|
||||||
@ -891,7 +891,7 @@ class Stripe extends CommonObject
|
|||||||
$description = "INV=".$ref.".CUS=".$societe->id.".PM=stripe";
|
$description = "INV=".$ref.".CUS=".$societe->id.".PM=stripe";
|
||||||
}
|
}
|
||||||
|
|
||||||
$remoteip = getUserRemoteIP();
|
$ipaddress = getUserRemoteIP();
|
||||||
|
|
||||||
$metadata = array(
|
$metadata = array(
|
||||||
"dol_id" => "".$item."",
|
"dol_id" => "".$item."",
|
||||||
@ -900,7 +900,7 @@ class Stripe extends CommonObject
|
|||||||
'dol_thirdparty_name' => $societe->name,
|
'dol_thirdparty_name' => $societe->name,
|
||||||
'dol_version'=>DOL_VERSION,
|
'dol_version'=>DOL_VERSION,
|
||||||
'dol_entity'=>$conf->entity,
|
'dol_entity'=>$conf->entity,
|
||||||
'ipaddress'=>$remoteip
|
'ipaddress'=>$ipaddress
|
||||||
);
|
);
|
||||||
$return = new Stripe($this->db);
|
$return = new Stripe($this->db);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user