diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 34d4120db24..b45bcc6040d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3754,7 +3754,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring', 'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice', 'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda', - 'uncheck', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', + 'uncheck', 'user-cog', 'user-injured', 'user-md', 'vat', 'website', 'workstation', 'webhook', 'conferenceorbooth', 'eventorganization' ))) { $fakey = $pictowithouttext; @@ -3805,7 +3805,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'title_agenda'=>'calendar-alt', 'uncheck'=>'times', 'uparrow'=>'share', 'vat'=>'money-check-alt', 'vcard'=>'address-card', 'jabber'=>'comment-o', - 'website'=>'globe-americas', 'workstation'=>'pallet', + 'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye', 'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram' ); if ($pictowithouttext == 'off') { diff --git a/htdocs/core/modules/modWebhook.class.php b/htdocs/core/modules/modWebhook.class.php index 92fdfca6d28..fbcb5f81003 100644 --- a/htdocs/core/modules/modWebhook.class.php +++ b/htdocs/core/modules/modWebhook.class.php @@ -469,8 +469,8 @@ class modWebhook extends DolibarrModules { global $conf, $langs; - //$result = $this->_load_tables('/install/mysql/tables/', 'webhook'); - $result = $this->_load_tables('/webhook/sql/'); + $result = $this->_load_tables('/install/mysql/tables/', 'webhook'); + //$result = $this->_load_tables('/webhook/sql/'); if ($result < 0) { return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') } diff --git a/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php index d5d95c59ef3..335024554fc 100644 --- a/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_99_modWebhook_WebhookTriggers.class.php @@ -93,6 +93,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers if (empty($conf->webhook) || empty($conf->webhook->enabled)) { return 0; // If module is not enabled, we do nothing } + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; // Or you can execute some code here $nbPosts = 0; @@ -104,10 +105,11 @@ class InterfaceWebhookTriggers extends DolibarrTriggers if (is_array($actionarray) && in_array($action, $actionarray)) { $jsonstr = '{"triggercode":'.json_encode($action).',"object":'.json_encode($object).'}'; $response = getURLContent($tmpobject->url, 'POST', $jsonstr); - if (empty($response['curl_error_no'])) { + if (empty($response['curl_error_no']) && $response['http_code'] >= 200 && $response['http_code'] < 300) { $nbPosts ++; } else { $errors ++; + dol_syslog("Failed to get url with httpcode=".(!empty($response['http_code']) ? $response['http_code'] : "")." curl_error_no=".(!empty($response['curl_error_no']) ? $response['curl_error_no'] : ""), LOG_DEBUG); } } }