Merge pull request #8926 from fappels/develop_fix_setvaluefrom

FIX commonobject setValueFrom trigger
This commit is contained in:
Laurent Destailleur 2018-06-13 20:50:26 +02:00 committed by GitHub
commit 4b84b7ccf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -1457,7 +1457,16 @@ abstract class CommonObject
{
if ($trigkey)
{
$result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors
// call trigger with updated object values
if (empty($this->fields) && method_exists($this, 'fetch'))
{
$result = $this->fetch($id);
}
else
{
$result = $this->fetchCommon($id);
}
if ($result >= 0) $result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors
if ($result < 0) $error++;
}

View File

@ -167,7 +167,7 @@ if (empty($reshook))
if ($result >= 0)
{
$result = $object->setValueFrom('barcode', GETPOST('barcode'));
$result = $object->setValueFrom('barcode', GETPOST('barcode'), '', null, 'text', '', $user, 'PRODUCT_MODIFY');
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}