fix error management
This commit is contained in:
parent
86b4c97287
commit
2b84dc39de
@ -3754,7 +3754,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring',
|
'recent', 'reception', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'recurring',
|
||||||
'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
|
'shapes', 'square', 'stop-circle', 'supplier', 'supplier_proposal', 'supplier_order', 'supplier_invoice',
|
||||||
'timespent', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda',
|
'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'
|
'conferenceorbooth', 'eventorganization'
|
||||||
))) {
|
))) {
|
||||||
$fakey = $pictowithouttext;
|
$fakey = $pictowithouttext;
|
||||||
@ -3805,7 +3805,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
|||||||
'title_agenda'=>'calendar-alt',
|
'title_agenda'=>'calendar-alt',
|
||||||
'uncheck'=>'times', 'uparrow'=>'share', 'vat'=>'money-check-alt', 'vcard'=>'address-card',
|
'uncheck'=>'times', 'uparrow'=>'share', 'vat'=>'money-check-alt', 'vcard'=>'address-card',
|
||||||
'jabber'=>'comment-o',
|
'jabber'=>'comment-o',
|
||||||
'website'=>'globe-americas', 'workstation'=>'pallet',
|
'website'=>'globe-americas', 'workstation'=>'pallet', 'webhook'=>'bullseye',
|
||||||
'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram'
|
'conferenceorbooth'=>'chalkboard-teacher', 'eventorganization'=>'project-diagram'
|
||||||
);
|
);
|
||||||
if ($pictowithouttext == 'off') {
|
if ($pictowithouttext == 'off') {
|
||||||
|
|||||||
@ -469,8 +469,8 @@ class modWebhook extends DolibarrModules
|
|||||||
{
|
{
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
|
|
||||||
//$result = $this->_load_tables('/install/mysql/tables/', 'webhook');
|
$result = $this->_load_tables('/install/mysql/tables/', 'webhook');
|
||||||
$result = $this->_load_tables('/webhook/sql/');
|
//$result = $this->_load_tables('/webhook/sql/');
|
||||||
if ($result < 0) {
|
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')
|
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')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,6 +93,7 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
|
|||||||
if (empty($conf->webhook) || empty($conf->webhook->enabled)) {
|
if (empty($conf->webhook) || empty($conf->webhook->enabled)) {
|
||||||
return 0; // If module is not enabled, we do nothing
|
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
|
// Or you can execute some code here
|
||||||
$nbPosts = 0;
|
$nbPosts = 0;
|
||||||
@ -104,10 +105,11 @@ class InterfaceWebhookTriggers extends DolibarrTriggers
|
|||||||
if (is_array($actionarray) && in_array($action, $actionarray)) {
|
if (is_array($actionarray) && in_array($action, $actionarray)) {
|
||||||
$jsonstr = '{"triggercode":'.json_encode($action).',"object":'.json_encode($object).'}';
|
$jsonstr = '{"triggercode":'.json_encode($action).',"object":'.json_encode($object).'}';
|
||||||
$response = getURLContent($tmpobject->url, 'POST', $jsonstr);
|
$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 ++;
|
$nbPosts ++;
|
||||||
} else {
|
} else {
|
||||||
$errors ++;
|
$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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user