diff --git a/ChangeLog b/ChangeLog index 30084927aaa..4d3b8252107 100644 --- a/ChangeLog +++ b/ChangeLog @@ -246,6 +246,12 @@ Dolibarr better: warehouse module and your Point Of Sale module setup if you use one. - Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it. +***** ChangeLog for 3.6.5 compared to 3.6.4 ***** +- Fix: [ bug #1776 ] Undefined $deliverycompany variable in pdf_build_address +- Fix: [ bug #1794 ] Error when cloning Proposal gives error in a malformed page + +***** ChangeLog for 3.6.4 compared to 3.6.3 ***** +- Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask ***** ChangeLog for 3.6.3 compared to 3.6.2 ***** - Fix: ref_ext was not saved when recording a customer order from web service diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 865358c6438..08106bc2151 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -115,7 +115,7 @@ if (empty($reshook)) // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { - if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + if (! GETPOST('socid', 3)) { setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); } @@ -127,7 +127,7 @@ if (empty($reshook)) header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); exit(); } else { - setEventMessage($object->error, 'errors'); + if (count($object->errors) > 0) setEventMessage($object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index c5c432610ee..372ac5d5a61 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -974,44 +974,42 @@ class Propal extends CommonObject foreach($this->lines as $line) $line->fetch_optionals($line->rowid); - // Load source object - $objFrom = dol_clone($this); + // Load dest object + $clonedObj = clone $this; $objsoc=new Societe($this->db); // Change socid if needed - if (! empty($socid) && $socid != $this->socid) + if (! empty($socid) && $socid != $clonedObj->socid) { if ($objsoc->fetch($socid) > 0) { - $this->socid = $objsoc->id; - $this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); - $this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); - - $project = new Project($db); - - if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) { - if($project->socid <= 0) $this->fk_project = $objFrom->fk_project; - else $this->fk_project = ''; + $clonedObj->socid = $objsoc->id; + $clonedObj->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); + $clonedObj->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); + $clonedObj->fk_delivery_address = ''; + + $project = new Project($db); + if ($this->fk_project > 0 && $project->fetch($this->fk_project)) { + if ($project->socid <= 0) $clonedObj->fk_project = $this->fk_project; + else $clonedObj->fk_project = ''; } else { - $this->fk_project = ''; + $clonedObj->fk_project = ''; } - - $this->fk_delivery_address = ''; } // reset ref_client - $this->ref_client = ''; + $clonedObj->ref_client = ''; // TODO Change product price if multi-prices } else { - $objsoc->fetch($this->socid); + $objsoc->fetch($clonedObj->socid); } - $this->id=0; - $this->statut=0; + $clonedObj->id=0; + $clonedObj->statut=0; if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php")) { @@ -1020,32 +1018,32 @@ class Propal extends CommonObject } // Clear fields - $this->user_author = $user->id; - $this->user_valid = ''; - $this->date = $now; - $this->datep = $now; // deprecated - $this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600); - if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = ''; + $clonedObj->user_author = $user->id; + $clonedObj->user_valid = ''; + $clonedObj->date = $now; + $clonedObj->datep = $now; // deprecated + $clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600); + if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = ''; // Set ref require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php'; $obj = $conf->global->PROPALE_ADDON; $modPropale = new $obj; - $this->ref = $modPropale->getNextValue($objsoc,$this); + $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj); // Create clone - $result=$this->create($user); + $result=$clonedObj->create($user); if ($result < 0) $error++; else { // copy internal contacts - if ($this->copy_linked_contact($objFrom, 'internal') < 0) + if ($clonedObj->copy_linked_contact($this, 'internal') < 0) $error++; // copy external contacts if same company - elseif ($objFrom->socid == $this->socid) + elseif ($this->socid == $clonedObj->socid) { - if ($this->copy_linked_contact($objFrom, 'external') < 0) + if ($clonedObj->copy_linked_contact($this, 'external') < 0) $error++; } } @@ -1055,9 +1053,9 @@ class Propal extends CommonObject // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters=array('objFrom'=>$objFrom); + $parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj); $action=''; - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } @@ -1073,7 +1071,7 @@ class Propal extends CommonObject if (! $error) { $this->db->commit(); - return $this->id; + return $clonedObj->id; } else { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index b80b06b6aaa..dfb031afae9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -304,7 +304,6 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target if ($mode == 'source' && ! is_object($sourcecompany)) return -1; if ($mode == 'target' && ! is_object($targetcompany)) return -1; - if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1; if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO: Deprecated if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 4af7772f290..cd1c9a4883b 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -299,7 +299,7 @@ if ($result) if (empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; - if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC"); + if (isset($objp->price_base_type) && $objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC"); else print price($objp->price).' '.$langs->trans("HT"); print ''; } diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 0d74a85425b..bb428f715d3 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -135,14 +135,14 @@ class Entrepot extends CommonObject */ function update($id, $user) { - $this->libelle=$this->db->escape(trim($this->libelle)); - $this->description=$this->db->escape(trim($this->description)); + $this->libelle=trim($this->libelle); + $this->description=trim($this->description); - $this->lieu=$this->db->escape(trim($this->lieu)); + $this->lieu=trim($this->lieu); - $this->address=$this->db->escape(trim($this->address)); - $this->zip=$this->zip?trim($this->zip):trim($this->zip); - $this->town=$this->town?trim($this->town):trim($this->town); + $this->address=trim($this->address); + $this->zip=trim($this->zip); + $this->town=trim($this->town); $this->country_id=($this->country_id > 0 ? $this->country_id : $this->country_id); $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";