diff --git a/ChangeLog b/ChangeLog index ae51d0966b1..0291eeb3a21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -221,6 +221,9 @@ Fix: [ bug #2570 ] [Contacts] Page should not process if ID is invalid Fix: [ bug #3268 ] SQL error when accessing thirdparty log page without a socid parameter Fix: [ bug #3180 ] formObjectOptions hook when editing thirdparty card does not print result Fix: [ bug #1791 ] Margin menu not available if any Finance module is not enabled +Fix: [ bug #3310 ] OrderLine::fetch, FactureLigne::fetch and PropaleLigne::fetch do not return anything +Fix: [ bug #3206 ] PropaleLigne, OrderLine and FactureLigne given to triggers through update function does not contain all the information +Fix: [ bug #3313 ] Error enabling module with PostgreSQL database ***** ChangeLog for 3.5.6 compared to 3.5.5 ***** Fix: Avoid missing class error for fetch_thirdparty method #1973 diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index dbdf5a976ac..483b6ec8258 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -535,13 +535,14 @@ class Propal extends CommonObject $price = $pu - $remise; } - // Update line - $this->line=new PropaleLigne($this->db); + //Fetch current line from the database and then clone the object and set it in $oldline property + $line = new PropaleLigne($this->db); + $line->fetch($rowid); - // Stock previous line records - $staticline=new PropaleLigne($this->db); - $staticline->fetch($rowid); - $this->line->oldline = $staticline; + $staticline = clone $line; + + $line->oldline = $staticline; + $this->line = $line; // Reorder if fk_parent_line change if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) @@ -2862,10 +2863,12 @@ class PropaleLigne extends CommonObject $this->date_end = $this->db->jdate($objp->date_end); $this->db->free($result); + + return 1; } else { - dol_print_error($this->db); + return -1; } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cac43ced746..95441e5f257 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2403,13 +2403,14 @@ class Commande extends CommonOrder $price = ($pu - $remise); } - // Update line - $this->line=new OrderLine($this->db); + //Fetch current line from the database and then clone the object and set it in $oldline property + $line = new OrderLine($this->db); + $line->fetch($rowid); - // Stock previous line records - $staticline=new OrderLine($this->db); - $staticline->fetch($rowid); - $this->line->oldline = $staticline; + $staticline = clone $line; + + $line->oldline = $staticline; + $this->line = $line; // Reorder if fk_parent_line change if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) @@ -3218,10 +3219,12 @@ class OrderLine extends CommonOrderLine $this->date_end = $this->db->jdate($objp->date_end); $this->db->free($result); + + return 1; } else { - dol_print_error($this->db); + return -1; } } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 6d1e417f4ea..cecb76703dd 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1133,7 +1133,6 @@ class AccountLine extends CommonObject } else { - dol_print_error($this->db); return -1; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 63cdcaeb865..f5a7c27ecd1 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2173,13 +2173,24 @@ class Facture extends CommonInvoice $pu_tva = $tabprice[4]; $pu_ttc = $tabprice[5]; - // Update line into database - $this->line=new FactureLigne($this->db); + // Old properties: $price, $remise (deprecated) + $price = $pu; + $remise = 0; + if ($remise_percent > 0) + { + $remise = round(($pu * $remise_percent / 100),2); + $price = ($pu - $remise); + } + $price = price2num($price); - // Stock previous line records - $staticline=new FactureLigne($this->db); - $staticline->fetch($rowid); - $this->line->oldline = $staticline; + //Fetch current line from the database and then clone the object and set it in $oldline property + $line = new FactureLigne($this->db); + $line->fetch($rowid); + + $staticline = clone $line; + + $line->oldline = $staticline; + $this->line = $line; // Reorder if fk_parent_line change if (! empty($fk_parent_line) && ! empty($staticline->fk_parent_line) && $fk_parent_line != $staticline->fk_parent_line) @@ -3436,10 +3447,12 @@ class FactureLigne extends CommonInvoiceLine $this->product_desc = $objp->product_desc; $this->db->free($result); + + return 1; } else { - dol_print_error($this->db); + return -1; } } @@ -3497,7 +3510,7 @@ class FactureLigne extends CommonInvoiceLine return -1; } } - + // POS or by external module, take lowest buying price if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 8b636fd247f..3504c99e1d1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1013,7 +1013,6 @@ abstract class DolibarrModules $this->db->begin(); - //var_dump($this->menu); exit; foreach ($this->menu as $key => $value) { $menu = new Menubase($this->db); @@ -1022,11 +1021,9 @@ abstract class DolibarrModules if (! $this->menu[$key]['fk_menu']) { $menu->fk_menu=0; - //print 'aaa'.$this->menu[$key]['fk_menu']; } else { - //print 'xxx'.$this->menu[$key]['fk_menu'];exit; $foundparent=0; $fk_parent=$this->menu[$key]['fk_menu']; if (preg_match('/^r=/',$fk_parent)) // old deprecated method