diff --git a/dev/examples/zapier/README.md b/dev/examples/zapier/README.md index ff101919284..453a5224993 100644 --- a/dev/examples/zapier/README.md +++ b/dev/examples/zapier/README.md @@ -3,9 +3,9 @@ ## ENABLE MODULE ZAPIER ON DOLIBARR -This should also enable the module API (required for authentication by Zapier service). +This should also enable the module API (required for authentication by Zapier service and to execute action in Dolibarr by Zapier). -Create the Dolibarr login that will be used by Zapier to call APIs. +Create the Dolibarr login that will be used by Zapier to call APIs. Give the login the permissions on the action you plan to automate. ## CREATE A ZAPIER DEVELOPPER ACCOUNT diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 76d6a1f1bd1..49483224a8a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7538,9 +7538,12 @@ abstract class CommonObject if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity; else { // $this->{$field} may be null, '', 0, '0', 123, '123' - if ($this->{$field} != '' || !empty($info['notnull'])) { - if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 - if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 + if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) { + if ($this->isInt($info)) { + $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 + } elseif ($this->isFloat($info)) { + $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 + } } else $queryarray[$field] = null; } } else {