From e80f29c271f6e75f8771447c12e37526222092c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 16 Sep 2015 12:46:50 +0200 Subject: [PATCH 1/9] Fix: [ bug 1794 ] - Error when cloning Proposal gives error in a malformed page --- htdocs/comm/propal.php | 10 ++--- htdocs/comm/propal/class/propal.class.php | 54 +++++++++++------------ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 99119414971..aefef2af68e 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -112,20 +112,20 @@ if (empty($reshook)) { // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes') { - if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { - setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); - } else { +// if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) { +// setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors'); +// } else { if ($object->id > 0) { $result = $object->createFromClone($socid); if ($result > 0) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result); exit(); } else { - setEventMessage($object->error, 'errors'); + if (count($object->errors) > 0) setEventMessage($object->errors, 'errors'); $action = ''; } } - } +// } } // Delete proposal diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 483b6ec8258..ba361ea6aa5 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -956,35 +956,35 @@ 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); - $this->fk_project = ''; - $this->fk_delivery_address = ''; + $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_project = ''; + $clonedObj->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")) { @@ -993,32 +993,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++; } } @@ -1028,16 +1028,16 @@ class Propal extends CommonObject // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters=array('objFrom'=>$objFrom); + $parameters=array('objFrom'=>$this); $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++; } // Appel des triggers include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PROPAL_CLONE',$this,$user,$langs,$conf); + $result=$interface->run_triggers('PROPAL_CLONE',$clonedObj,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } @@ -1048,7 +1048,7 @@ class Propal extends CommonObject if (! $error) { $this->db->commit(); - return $this->id; + return $clonedObj->id; } else { From 3818bff86af9a9d0b98114e5fc6a88b926844f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Wed, 16 Sep 2015 12:49:05 +0200 Subject: [PATCH 2/9] Fix: [ bug 1776 ] Undefined $deliverycompany variable in pdf_build_address --- htdocs/core/lib/pdf.lib.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 8b0091a6f6d..054cc633cf3 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -301,7 +301,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); From 2d35124c71b683ad8a2ebc015792564b28b7e7ef Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Wed, 23 Sep 2015 11:11:19 +0200 Subject: [PATCH 3/9] FIX no need to remove file into mail form, the temp dir will be deleted after any sending --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index bcc6c165472..a4e26f116ef 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1115,7 +1115,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio * @param int $donotdeletefile 1=Do not delete physically file * @return void */ -function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0) +function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1) { global $db,$user,$conf,$langs,$_FILES; From 3f8e9bd1810450d05974d770fdf64d8707139273 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 10 Oct 2015 19:24:31 +0200 Subject: [PATCH 4/9] Remove warning --- htdocs/product/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index a8502498e41..2803c2d06ad 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 ''; } From 9f1fa7e212be3a879e8604b7140469b6f973ed60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 11 Oct 2015 12:32:02 +0200 Subject: [PATCH 5/9] Missing changelog --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index f83979aa8e0..51ae09529f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.6.5 compared to 3.6.4 ***** +- 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 From fd9f51df88927d9a41c62d50fc6a04d2d6fa515a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 11 Oct 2015 12:39:42 +0200 Subject: [PATCH 6/9] Missing changelog --- ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog b/ChangeLog index f83979aa8e0..3bc56c5de5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 3.6.5 compared to 3.6.4 ***** +- Fix: [ bug #1776 ] Undefined $deliverycompany variable in pdf_build_address + ***** ChangeLog for 3.6.4 compared to 3.6.3 ***** - Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask From 87fad70f4a7c6989983d6a519517b95a2f0c5725 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 11 Oct 2015 20:42:49 +0200 Subject: [PATCH 7/9] Revert "FIX no need to remove file into mail form" --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a4e26f116ef..bcc6c165472 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1115,7 +1115,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio * @param int $donotdeletefile 1=Do not delete physically file * @return void */ -function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=1) +function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=0) { global $db,$user,$conf,$langs,$_FILES; From 0251728e286a99f5f013f878c9872dde0fbcabf7 Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Mon, 12 Oct 2015 17:36:24 +0200 Subject: [PATCH 8/9] FIX double db escape add too quote --- htdocs/product/stock/class/entrepot.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index b65c01f6840..2b1b368ef8c 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 "; From 727db565765037705c50905c400d45ef17f77e3f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 14 Oct 2015 08:27:56 +0200 Subject: [PATCH 9/9] FIX : #3724 Bug: Blank page after cloning proposal with changed client --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index dbd03788293..c5c432610ee 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -961,7 +961,7 @@ class Propal extends CommonObject { global $db, $user,$langs,$conf,$hookmanager; - dol_include_once('/projet/class.project.class.php'); + dol_include_once('/projet/class/project.class.php'); $this->context['createfromclone']='createfromclone';