diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 5700400db5d..9554a79c858 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016-2017 Alexandre Spangaro + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -743,9 +744,9 @@ class AccountancyCategory // extends CommonObject * Get all accounting account of a group. * You must choose between first parameter (personalized group) or the second (free criteria filter) * - * @param int $cat_id Id if personalized accounting group/category - * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts - * @return array|int Array of accounting accounts or -1 if error + * @param int $cat_id Id if personalized accounting group/category + * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts + * @return array|int Array of accounting accounts or -1 if error */ public function getCptsCat($cat_id, $predefinedgroupwhere='') { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0e09e5570e9..be65b2ec5ab 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -694,6 +694,9 @@ if (empty($reshook)) $amount_ht[$line->tva_tx] += $line->total_ht; $amount_tva[$line->tva_tx] += $line->total_tva; $amount_ttc[$line->tva_tx] += $line->total_ttc; + $multicurrency_amount_ht[$line->tva_tx] += $line->multicurrency_total_ht; + $multicurrency_amount_tva[$line->tva_tx] += $line->multicurrency_total_tva; + $multicurrency_amount_ttc[$line->tva_tx] += $line->multicurrency_total_ttc; $i ++; } } @@ -749,6 +752,9 @@ if (empty($reshook)) $discount->amount_ht = abs($amount_ht[$tva_tx]); $discount->amount_tva = abs($amount_tva[$tva_tx]); $discount->amount_ttc = abs($amount_ttc[$tva_tx]); + $discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]); + $discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]); + $discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]); $discount->tva_tx = abs($tva_tx); $result = $discount->create($user); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 5432dfdab5a..315325c2474 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1709,9 +1709,9 @@ class Facture extends CommonInvoice $facligne->total_ttc = -$remise->amount_ttc; $facligne->multicurrency_subprice = -$remise->multicurrency_subprice; - $facligne->multicurrency_total_ht = -$remise->multicurrency_total_ht; - $facligne->multicurrency_total_tva = -$remise->multicurrency_total_tva; - $facligne->multicurrency_total_ttc = -$remise->multicurrency_total_ttc; + $facligne->multicurrency_total_ht = -$remise->multicurrency_amount_ht; + $facligne->multicurrency_total_tva = -$remise->multicurrency_amount_tva; + $facligne->multicurrency_total_ttc = -$remise->multicurrency_amount_ttc; $lineid=$facligne->insert(); if ($lineid > 0) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 4126fc44826..b59b03d536f 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1097,6 +1097,18 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == continue; } + if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id; + $res = $db->query($sql); + + if (!$res) + { + setEventMessage('ErrorRecordParentingNotModified', 'errors'); + $error++; + } + } + if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); else $result = $objecttmp->delete($user); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 30a5350a29c..d4102873dae 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4727,6 +4727,7 @@ abstract class CommonObject $resql=$this->db->query($sql); if ($resql) { + $this->array_options = array(); $numrows=$this->db->num_rows($resql); if ($numrows) { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 5cb7d3e6882..ec8cdd47dcb 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -108,7 +108,7 @@ class DiscountAbsolute $this->amount_tva = $obj->amount_tva; $this->amount_ttc = $obj->amount_ttc; - $this->multicurrency_amount_ht = $obj->multicurrency_amount_ht; + $this->multicurrency_amount_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht; $this->multicurrency_amount_tva = $obj->multicurrency_amount_tva; $this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc; @@ -170,10 +170,12 @@ class DiscountAbsolute $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; $sql.= " (entity, datec, fk_soc, discount_type, fk_user, description,"; $sql.= " amount_ht, amount_tva, amount_ttc, tva_tx,"; + $sql.= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,"; $sql.= " fk_facture_source, fk_invoice_supplier_source"; $sql.= ")"; $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type)?0:intval($this->discount_type)).", ".$user->id.", '".$this->db->escape($this->description)."',"; $sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; + $sql.= " ".$this->multicurrency_amount_ht.", ".$this->multicurrency_amount_tva.", ".$this->multicurrency_amount_ttc.", "; $sql.= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'":"null").","; $sql.= " ".($this->fk_invoice_supplier_source ? "'".$this->db->escape($this->fk_invoice_supplier_source)."'":"null"); $sql.= ")"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index abb069d6fce..3ec1f226993 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -13,6 +13,7 @@ * Copyright (C) 2014 Cédric GROSS * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -6970,11 +6971,12 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode= // No need to make a return $head. Var is modified as a reference if (! empty($hookmanager)) { - $parameters=array('object' => $object, 'mode' => $mode, 'head'=>$head); - $reshook=$hookmanager->executeHooks('completeTabsHead',$parameters); + $parameters=array('object' => $object, 'mode' => $mode, 'head' => $head); + $reshook=$hookmanager->executeHooks('completeTabsHead', $parameters); if ($reshook > 0) { $head = $hookmanager->resArray; + $h = count($head); } } } diff --git a/htdocs/core/lib/import.lib.php b/htdocs/core/lib/import.lib.php index 89847d69c11..ea700c38845 100644 --- a/htdocs/core/lib/import.lib.php +++ b/htdocs/core/lib/import.lib.php @@ -1,8 +1,9 @@ - * Copyright (C) 2007 Rodolphe Quiedeville - * Copyright (C) 2010 Regis Houssin - * Copyright (C) 2010 Juanjo Menent +/* Copyright (C) 2006-2009 Laurent Destailleur + * Copyright (C) 2007 Rodolphe Quiedeville + * Copyright (C) 2010 Regis Houssin + * Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +21,9 @@ */ /** - * \file htdocs/core/lib/order.lib.php - * \brief Ensemble de fonctions de base pour le module commande - * \ingroup commande - */ + * \file htdocs/core/lib/import.lib.php + * \brief Ensemble de fonctions de base pour le module import + * \ingroup import /** * Function to return list of tabs for import pages diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 98d9035112f..9e07976f072 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -1,6 +1,7 @@ + * Copyright (C) 2013 Marcos García + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -162,7 +163,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo else $out.='&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); } } - if ($type == 'order') + elseif ($type == 'order') { $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=order&ref='.($mode?'':''); if ($mode == 1) $out.='order_ref'; @@ -180,7 +181,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo } } } - if ($type == 'invoice') + elseif ($type == 'invoice') { $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=invoice&ref='.($mode?'':''); if ($mode == 1) $out.='invoice_ref'; @@ -198,7 +199,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo } } } - if ($type == 'contractline') + elseif ($type == 'contractline') { $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=contractline&ref='.($mode?'':''); if ($mode == 1) $out.='contractline_ref'; @@ -216,7 +217,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo } } } - if ($type == 'member' || $type == 'membersubscription') + elseif ($type == 'member' || $type == 'membersubscription') { $out=DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode?'':''); if ($mode == 1) $out.='member_ref'; @@ -315,14 +316,14 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $ $parammessageform='ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix; if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); - else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); + elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM); // Add other message if VAT exists if ($object->total_vat != 0 || $object->total_tva != 0) { $parammessageform='ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; if (! empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform); - else if (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); + elseif (! empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT); } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0f2ef6b2b8c..c30376622a4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria - * Copyright (C) 2016-2017 Ferran Marcet + * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2017 Gustavo Novaro * * This program is free software; you can redistribute it and/or modify @@ -1061,7 +1061,7 @@ class Product extends CommonObject $sql.= " WHERE fk_product_stock IN ("; $sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock'; $sql.= " WHERE fk_product = ".$id.")"; - dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $result = $this->db->query($sql); if (! $result) { @@ -1080,7 +1080,7 @@ class Product extends CommonObject { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$table; $sql.= " WHERE fk_product = ".$id; - dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $result = $this->db->query($sql); if (! $result) { @@ -1111,12 +1111,25 @@ class Product extends CommonObject } } + // Delete from product_association + if (!$error){ + $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_association"; + $sql.= " WHERE fk_product_pere = ".$id." OR fk_product_fils = ".$id; + + $result = $this->db->query($sql); + if (! $result) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + // Delete product if (! $error) { $sqlz = "DELETE FROM ".MAIN_DB_PREFIX."product"; $sqlz.= " WHERE rowid = ".$id; - dol_syslog(get_class($this).'::delete', LOG_DEBUG); + $resultz = $this->db->query($sqlz); if ( ! $resultz ) { diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 099fec49da8..6403878d853 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -54,6 +54,7 @@ $fourn_id = GETPOST("fourn_id",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); +if (empty($page) || $page < 0) $page = 0; if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; @@ -92,11 +93,15 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $sref=""; $snom=""; $sall=""; + $tosell=""; + $tobuy=""; $search_sale=""; $search_categ=""; $type=""; $catid=''; $toolowstock=''; + $fourn_id=''; + $sbarcode=''; } @@ -188,6 +193,20 @@ if ($resql) } $texte.=' ('.$langs->trans("Stocks").')'; + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.="&sall=".$sall; + if ($tosell) $param.="&tosell=".$tosell; + if ($tobuy) $param.="&tobuy=".$tobuy; + if ($type) $param.="&type=".$type; + if ($fourn_id) $param.="&fourn_id=".$fourn_id; + if ($snom) $param.="&snom=".$snom; + if ($sref) $param.="&sref=".$sref; + if ($search_sale) $param.="&search_sale=".$search_sale; + if ($search_categ) $param.="&search_categ=".$search_categ; + if ($toolowstock) $param.="&toolowstock=".$toolowstock; + if ($sbarcode) $param.="&sbarcode=".$sbarcode; + if ($catid) $param.="&catid=".$catid; llxHeader("", $texte, $helpurl); @@ -198,14 +217,7 @@ if ($resql) print ''; print ''; - if ($sref || $snom || $sall || GETPOST('search')) - { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); - } - else - { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"").(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); - } + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); if (! empty($catid)) { diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index b4d14ef1231..3a58924108d 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -58,6 +58,7 @@ $fourn_id = GETPOST("fourn_id",'int'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); +if (empty($page) || $page < 0) $page = 0; if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; @@ -89,6 +90,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $sref=""; $snom=""; $sall=""; + $tosell=""; + $tobuy=""; $search_sale=""; $search_categ=""; $type=""; @@ -96,6 +99,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $toolowstock=''; $search_batch=''; $search_warehouse=''; + $fourn_id=''; + $sbarcode=''; } @@ -199,6 +204,24 @@ if ($resql) } $texte.=' ('.$langs->trans("StocksByLotSerial").')'; + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($sall) $param.="&sall=".$sall; + if ($tosell) $param.="&tosell=".$tosell; + if ($tobuy) $param.="&tobuy=".$tobuy; + if ($type) $param.="&type=".$type; + if ($fourn_id) $param.="&fourn_id=".$fourn_id; + if ($snom) $param.="&snom=".$snom; + if ($sref) $param.="&sref=".$sref; + if ($search_batch) $param.="&search_batch=".$search_batch; + if ($sbarcode) $param.="&sbarcode=".$sbarcode; + if ($search_warehouse) $param.="&search_warehouse=".$search_warehouse; + if ($catid) $param.="&catid=".$catid; + if ($toolowstock) $param.="&toolowstock=".$toolowstock; + if ($search_sale) $param.="&search_sale=".$search_sale; + if ($search_categ) $param.="&search_categ=".$search_categ; + /*if ($eatby) $param.="&eatby=".$eatby; + if ($sellby) $param.="&sellby=".$sellby;*/ llxHeader("",$title,$helpurl,$texte); @@ -209,14 +232,8 @@ if ($resql) print ''; print ''; - if ($sref || $snom || $sall || GETPOST('search')) - { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); - } - else - { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); - } + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); + if (! empty($catid)) { @@ -250,17 +267,6 @@ if ($resql) } - $param=''; - if ($tosell) $param.="&tosell=".$tosell; - if ($tobuy) $param.="&tobuy=".$tobuy; - if ($type) $param.="&type=".$type; - if ($fourn_id) $param.="&fourn_id=".$fourn_id; - if ($snom) $param.="&snom=".$snom; - if ($sref) $param.="&sref=".$sref; - if ($search_batch) $param.="&search_batch=".$search_batch; - /*if ($eatby) $param.="&eatby=".$eatby; - if ($sellby) $param.="&sellby=".$sellby;*/ - print '
'; print ''; @@ -342,6 +348,7 @@ if ($resql) $product_static->label = $objp->label; $product_static->type=$objp->fk_product_type; $product_static->entity=$objp->entity; + $product_static->status_batch=$objp->tobatch; $product_lot_static->batch=$objp->batch; $product_lot_static->product_id=$objp->rowid; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 727e98bc0dc..479c5a0c15c 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -38,6 +38,7 @@ $id = GETPOST('id','int'); $action = GETPOST('action','alpha'); $backtopage = GETPOST('backtopage','alpha'); $myparam = GETPOST('myparam','alpha'); +$toselect = GETPOST('toselect', 'array'); $search_entity=GETPOST('search_entity','int'); @@ -143,7 +144,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_import_key=''; $search_date_creation=''; $search_date_update=''; - $toselect=''; + $toselect=array(); $search_array_options=array(); } @@ -207,7 +208,8 @@ $sql.= " t.fk_user_modif,"; $sql.= " t.import_key,"; $sql.= " p.fk_product_type as product_type,"; $sql.= " p.ref as product_ref,"; -$sql.= " p.label as product_label"; +$sql.= " p.label as product_label,"; +$sql.= " p.tobatch"; // Add fields for extrafields foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; // Add fields from hooks @@ -426,6 +428,7 @@ if ($resql) $productstatic->type=$obj->product_type; $productstatic->ref=$obj->product_ref; $productstatic->label=$obj->product_label; + $productstatic->status_batch = $obj->tobatch; print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 056d99d089b..3f611e5525e 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -605,6 +605,10 @@ foreach ($listofreferent as $key => $value) { if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total } + if ($key == 'propal') + { + if ($element->statut == Propal::STATUS_NOTSIGNED) $qualifiedfortotal=false; // Refused proposal must not be included in total + } if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 40dbf956d24..4ec328e5007 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1758,10 +1758,13 @@ class Societe extends CommonObject $discount = new DiscountAbsolute($this->db); $discount->fk_soc=$this->id; + $discount->discount_type=$discount_type; - $discount->amount_ht=price2num($remise,'MT'); - $discount->amount_tva=price2num($remise*$tva_tx/100,'MT'); - $discount->amount_ttc=price2num($discount->amount_ht+$discount->amount_tva,'MT'); + + $discount->amount_ht=$discount->multicurrency_amount_ht=price2num($remise,'MT'); + $discount->amount_tva=$discount->multicurrency_amount_tva=price2num($remise*$tva_tx/100,'MT'); + $discount->amount_ttc=$discount->multicurrency_amount_ttc=price2num($discount->amount_ht+$discount->amount_tva,'MT'); + $discount->tva_tx=price2num($tva_tx,'MT'); $discount->description=$desc;
'.$productstatic->getNomUrl(1).'