Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into 7.0

This commit is contained in:
Laurent Destailleur 2018-03-06 09:07:03 +01:00
commit 6d13e58a23
4 changed files with 23 additions and 13 deletions

View File

@ -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'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->load('admin'); $langs->load('admin');
$langs->load("products");
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();

View File

@ -202,18 +202,26 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave','alpha'))
$srcpath = $upload_dir.'/'.$filenamefrom; $srcpath = $upload_dir.'/'.$filenamefrom;
$destpath = $upload_dir.'/'.$filenameto; $destpath = $upload_dir.'/'.$filenameto;
$result = dol_move($srcpath, $destpath); if (!file_exists($destpath))
if ($result)
{ {
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 else
{ {

View File

@ -398,7 +398,7 @@ class Expedition extends CommonObject
if (($lineId = $expeditionline->insert()) < 0) if (($lineId = $expeditionline->insert()) < 0)
{ {
$this->error[]=$expeditionline->error; $this->errors[]=$expeditionline->error;
} }
return $lineId; return $lineId;
} }
@ -2386,9 +2386,9 @@ class ExpeditionLigne extends CommonObjectLine
$error=0; $error=0;
// Check parameters // 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; return -1;
} }
// Clean parameters // Clean parameters
@ -2428,7 +2428,6 @@ class ExpeditionLigne extends CommonObjectLine
$result=$this->call_trigger('LINESHIPPING_INSERT',$user); $result=$this->call_trigger('LINESHIPPING_INSERT',$user);
if ($result < 0) if ($result < 0)
{ {
$this->errors[]=$this->error;
$error++; $error++;
} }
// End call triggers // End call triggers
@ -2444,6 +2443,7 @@ class ExpeditionLigne extends CommonObjectLine
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg); $this->error.=($this->error?', '.$errmsg:$errmsg);
} }
$this->db->rollback(); $this->db->rollback();
return -1*$error; return -1*$error;
} }

View File

@ -384,6 +384,7 @@ class SupplierProposal extends CommonObject
if (empty($info_bits)) $info_bits=0; if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0; if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=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); $remise_percent=price2num($remise_percent);
$qty=price2num($qty); $qty=price2num($qty);