mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix warnings
This commit is contained in:
parent
e0494b8e1d
commit
0cbedd4ff0
|
|
@ -634,7 +634,7 @@ class Propal extends CommonObject
|
|||
*/
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = array(), $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0, $noupdateafterinsertline = 0)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
global $mysoc, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
|
||||
|
||||
|
|
@ -659,7 +659,7 @@ class Propal extends CommonObject
|
|||
}
|
||||
|
||||
$remise_percent = price2num($remise_percent);
|
||||
$qty = (float) price2num($qty);
|
||||
$qty = (float) price2num($qty, 'MS');
|
||||
$pu_ht = price2num($pu_ht);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$pu_ttc = price2num($pu_ttc);
|
||||
|
|
@ -710,14 +710,14 @@ class Propal extends CommonObject
|
|||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch($fk_product);
|
||||
if ($qty < $product->packaging) {
|
||||
$qty = $product->packaging;
|
||||
$tmpproduct = new Product($this->db);
|
||||
$result = $tmpproduct->fetch($fk_product);
|
||||
if (abs($qty) < $tmpproduct->packaging) {
|
||||
$qty = (float) $tmpproduct->packaging;
|
||||
} else {
|
||||
if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) {
|
||||
$coeff = intval((float) $qty / $product->packaging) + 1;
|
||||
$qty = (float) $product->packaging * $coeff;
|
||||
if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) {
|
||||
$coeff = intval(abs($qty) / $tmpproduct->packaging) + 1;
|
||||
$qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS');
|
||||
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -373,10 +373,8 @@ class PropaleLigne extends CommonObjectLine
|
|||
$sql .= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,';
|
||||
$sql .= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc,';
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,';
|
||||
$sql .= ' p.packaging,';
|
||||
$sql .= ' pd.date_start, pd.date_end, pd.product_type';
|
||||
if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$sql .= ', p.packaging';
|
||||
}
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propaldet as pd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid';
|
||||
$sql .= ' WHERE pd.rowid = '.((int) $rowid);
|
||||
|
|
@ -425,9 +423,7 @@ class PropaleLigne extends CommonObjectLine
|
|||
$this->product_desc = $objp->product_desc;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$this->packaging = $objp->packaging;
|
||||
}
|
||||
$this->packaging = $objp->packaging;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
|
|
|
|||
|
|
@ -1635,14 +1635,14 @@ class Commande extends CommonOrder
|
|||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch($fk_product);
|
||||
if ($qty < $product->packaging) {
|
||||
$qty = $product->packaging;
|
||||
$tmpproduct = new Product($this->db);
|
||||
$result = $tmpproduct->fetch($fk_product);
|
||||
if (abs($qty) < $tmpproduct->packaging) {
|
||||
$qty = (float) $tmpproduct->packaging;
|
||||
} else {
|
||||
if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) {
|
||||
$coeff = intval((float) $qty / $product->packaging) + 1;
|
||||
$qty = (float) $product->packaging * $coeff;
|
||||
if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) {
|
||||
$coeff = intval(abs($qty) / $tmpproduct->packaging) + 1;
|
||||
$qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS');
|
||||
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
|
@ -2130,7 +2130,7 @@ class Commande extends CommonOrder
|
|||
$sql .= ' l.fk_unit,';
|
||||
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch, p.barcode as product_barcode,';
|
||||
$sql .= ' p.weight, p.weight_units, p.volume, p.volume_units';
|
||||
$sql .= ' p.weight, p.weight_units, p.volume, p.volume_units, p.packaging';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as l';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)';
|
||||
$sql .= ' WHERE l.fk_commande = '.((int) $this->id);
|
||||
|
|
@ -2205,10 +2205,7 @@ class Commande extends CommonOrder
|
|||
$line->weight_units = $objp->weight_units;
|
||||
$line->volume = $objp->volume;
|
||||
$line->volume_units = $objp->volume_units;
|
||||
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$line->packaging = $objp->packaging;
|
||||
}
|
||||
$line->packaging = $objp->packaging;
|
||||
|
||||
$line->date_start = $this->db->jdate($objp->date_start);
|
||||
$line->date_end = $this->db->jdate($objp->date_end);
|
||||
|
|
|
|||
|
|
@ -174,10 +174,8 @@ class OrderLine extends CommonOrderLine
|
|||
$sql .= ' cd.fk_unit,';
|
||||
$sql .= ' cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc,';
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc, p.tobatch as product_tobatch,';
|
||||
$sql .= ' p.packaging,';
|
||||
$sql .= ' cd.date_start, cd.date_end, cd.vat_src_code';
|
||||
if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$sql .= ', p.packaging';
|
||||
}
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as cd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
$sql .= ' WHERE cd.rowid = '.((int) $rowid);
|
||||
|
|
@ -231,10 +229,7 @@ class OrderLine extends CommonOrderLine
|
|||
$this->product_desc = $objp->product_desc;
|
||||
$this->product_tobatch = $objp->product_tobatch;
|
||||
$this->fk_unit = $objp->fk_unit;
|
||||
|
||||
if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$this->packaging = $objp->packaging;
|
||||
}
|
||||
$this->packaging = $objp->packaging;
|
||||
|
||||
$this->date_start = $this->db->jdate($objp->date_start);
|
||||
$this->date_end = $this->db->jdate($objp->date_end);
|
||||
|
|
|
|||
|
|
@ -4000,14 +4000,14 @@ class Facture extends CommonInvoice
|
|||
$localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
|
||||
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$product = new Product($this->db);
|
||||
$result = $product->fetch($fk_product);
|
||||
if ($qty < $product->packaging) {
|
||||
$qty = $product->packaging;
|
||||
$tmpproduct = new Product($this->db);
|
||||
$result = $tmpproduct->fetch($fk_product);
|
||||
if (abs($qty) < $tmpproduct->packaging) {
|
||||
$qty = (float) $tmpproduct->packaging;
|
||||
} else {
|
||||
if (!empty($product->packaging) && (fmod((float) $qty, $product->packaging) > 0.000001)) {
|
||||
$coeff = intval((float) $qty / $product->packaging) + 1;
|
||||
$qty = (float) $product->packaging * $coeff;
|
||||
if (!empty($tmpproduct->packaging) && $qty > $tmpproduct->packaging) {
|
||||
$coeff = intval(abs($qty) / $tmpproduct->packaging) + 1;
|
||||
$qty = price2num((float) $tmpproduct->packaging * $coeff, 'MS');
|
||||
setEventMessages($langs->trans('QtyRecalculatedWithPackaging'), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,10 +215,8 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$sql .= ' fd.multicurrency_total_ht,';
|
||||
$sql .= ' fd.multicurrency_total_tva,';
|
||||
$sql .= ' fd.multicurrency_total_ttc,';
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc';
|
||||
if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$sql .= ', p.packaging';
|
||||
}
|
||||
$sql .= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,';
|
||||
$sql .= ' p.packaging';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
|
||||
$sql .= ' WHERE fd.rowid = '.((int) $rowid);
|
||||
|
|
@ -285,9 +283,7 @@ class FactureLigne extends CommonInvoiceLine
|
|||
$this->multicurrency_total_tva = $objp->multicurrency_total_tva;
|
||||
$this->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
|
||||
|
||||
if (getDolGlobalInt('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$this->packaging = $objp->packaging;
|
||||
}
|
||||
$this->packaging = $objp->packaging;
|
||||
|
||||
$this->fetch_optionals();
|
||||
|
||||
|
|
|
|||
|
|
@ -1596,8 +1596,8 @@ class Product extends CommonObject
|
|||
$sql .= ", fk_price_expression = ".($this->fk_price_expression != 0 ? (int) $this->fk_price_expression : 'NULL');
|
||||
$sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : 'NULL');
|
||||
$sql .= ", mandatory_period = ".($this->mandatory_period);
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') && !empty($this->packaging)) {
|
||||
$sql .= ", packaging = " . (float) $this->packaging;
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$sql .= ", packaging = ".(float) $this->packaging;
|
||||
}
|
||||
// stock field is not here because it is a denormalized value from product_stock.
|
||||
$sql .= " WHERE rowid = ".((int) $id);
|
||||
|
|
@ -2893,15 +2893,12 @@ class Product extends CommonObject
|
|||
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly as tva_npr, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
|
||||
$sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,";
|
||||
$sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.last_main_doc,";
|
||||
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,";
|
||||
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period, p.packaging,";
|
||||
if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
} else {
|
||||
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
|
||||
}
|
||||
if (getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING')) {
|
||||
$sql .= " p.packaging,";
|
||||
}
|
||||
|
||||
// For MultiCompany
|
||||
// PMP per entity & Stocks Sharings stock_reel includes only stocks shared with this entity
|
||||
|
|
@ -2959,7 +2956,7 @@ class Product extends CommonObject
|
|||
$sql .= " p.price_min, p.price_min_ttc, p.price_base_type, p.cost_price, p.default_vat_code, p.tva_tx, p.recuperableonly, p.localtax1_tx, p.localtax2_tx, p.localtax1_type, p.localtax2_type, p.tosell,";
|
||||
$sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,";
|
||||
$sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,";
|
||||
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,";
|
||||
$sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period, p.packaging,";
|
||||
if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) {
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
} else {
|
||||
|
|
@ -2971,8 +2968,8 @@ class Product extends CommonObject
|
|||
$sql .= " p.pmp,";
|
||||
}
|
||||
$sql .= " p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.sell_or_eat_by_mandatory, p.batch_mask, p.fk_unit,";
|
||||
$sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf";
|
||||
$sql .= " ,p.price_label";
|
||||
$sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf,";
|
||||
$sql .= " p.price_label";
|
||||
if (!$separatedStock) {
|
||||
$sql .= ", p.stock";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,12 +279,12 @@ if (empty($reshook)) {
|
|||
$error = 0;
|
||||
$pricestoupdate = array();
|
||||
|
||||
$psq = GETPOST('psqflag');
|
||||
$psq = empty($newpsq) ? 0 : $newpsq;
|
||||
$psq = GETPOSTINT('psqflag');
|
||||
|
||||
$maxpricesupplier = $object->min_recommended_price();
|
||||
|
||||
// Packaging
|
||||
$packaging = getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') ? GETPOST('packaging') : null;
|
||||
$packaging = getDolGlobalString('PRODUCT_USE_CUSTOMER_PACKAGING') ? price2num(GETPOST('packaging', 'alpha'), 'MS') : null;
|
||||
|
||||
if (isModEnabled('dynamicprices')) {
|
||||
$object->fk_price_expression = empty($eid) ? 0 : $eid; //0 discards expression
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user