From b69d2800ef035d46e8fef6fe0067ffc0e72a6fe9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 2 Mar 2018 18:59:30 +0100 Subject: [PATCH 1/5] Fix: check if file name already exists --- htdocs/core/actions_linkedfiles.inc.php | 26 ++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 2ef3191154d..4e9e0063dc3 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -202,18 +202,26 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha')) $srcpath = $upload_dir.'/'.$filenamefrom; $destpath = $upload_dir.'/'.$filenameto; - $result = dol_move($srcpath, $destpath); - if ($result) + if (!file_exists($destpath)) { - if ($object->id) + $result = dol_move($srcpath, $destpath); + if ($result) { - $object->addThumbs($destpath); + if ($object->id) + { + $object->addThumbs($destpath); + } + + // TODO Add revert function of addThumbs to remove for old name + //$object->delThumbs($srcpath); + + setEventMessages($langs->trans("FileRenamed"), null); + } + else + { + $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. + setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); } - - // TODO Add revert function of addThumbs to remove for old name - //$object->delThumbs($srcpath); - - setEventMessages($langs->trans("FileRenamed"), null); } else { From 0c529770278aca05eea9b1f966f1c2c141ddcce2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 3 Mar 2018 08:37:44 +0100 Subject: [PATCH 2/5] Fix: avoid Warning: A non-numeric value encountered --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 621a229121c..dc00360acfd 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -384,6 +384,7 @@ class SupplierProposal extends CommonObject if (empty($info_bits)) $info_bits=0; if (empty($rang)) $rang=0; if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0; + if (empty($pu_ht)) $pu_ht=0; $remise_percent=price2num($remise_percent); $qty=price2num($qty); From c0664474e41c390b31e3de8e10445438c0b3fd98 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Mar 2018 06:32:55 +0100 Subject: [PATCH 3/5] Fix : Missing language file --- htdocs/admin/taxes.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index bbf2435436e..a4aa1afbd8c 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; $langs->load('admin'); +$langs->load("products"); if (!$user->admin) accessforbidden(); From 1a7c09b7d5e6dc76c17d7f1ef88385afd68eedfd Mon Sep 17 00:00:00 2001 From: fappels Date: Sun, 4 Mar 2018 12:35:32 +0100 Subject: [PATCH 4/5] Fix 0 is also a valid Qty Fix error handling --- htdocs/expedition/class/expedition.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 85408c7e14a..90a7abb291e 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -398,7 +398,7 @@ class Expedition extends CommonObject if (($lineId = $expeditionline->insert()) < 0) { - $this->error[]=$expeditionline->error; + $this->errors[]=$expeditionline->error; } return $lineId; } @@ -2386,9 +2386,9 @@ class ExpeditionLigne extends CommonObjectLine $error=0; // Check parameters - if (empty($this->fk_expedition) || empty($this->fk_origin_line) || empty($this->qty)) + if (empty($this->fk_expedition) || empty($this->fk_origin_line) || ! is_numeric($this->qty)) { - $this->errors[] = 'ErrorMandatoryParametersNotProvided'; + $this->error = 'ErrorMandatoryParametersNotProvided'; return -1; } // Clean parameters @@ -2418,6 +2418,7 @@ class ExpeditionLigne extends CommonObjectLine $result=$this->insertExtraFields(); if ($result < 0) { + $this->errors[]=$this->error; $error++; } } From 81e193b725b8df2b930bbd76792bdf3bc76cb620 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Mar 2018 20:46:54 +0100 Subject: [PATCH 5/5] Update expedition.class.php --- htdocs/expedition/class/expedition.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 90a7abb291e..b403f0f87dd 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -2418,7 +2418,6 @@ class ExpeditionLigne extends CommonObjectLine $result=$this->insertExtraFields(); if ($result < 0) { - $this->errors[]=$this->error; $error++; } } @@ -2429,7 +2428,6 @@ class ExpeditionLigne extends CommonObjectLine $result=$this->call_trigger('LINESHIPPING_INSERT',$user); if ($result < 0) { - $this->errors[]=$this->error; $error++; } // End call triggers @@ -2445,6 +2443,7 @@ class ExpeditionLigne extends CommonObjectLine dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } + $this->db->rollback(); return -1*$error; }