diff --git a/dev/examples/mail/source_email_ticket_2_answer_from_ticket.txt b/dev/examples/mail/source_email_ticket_2_a_answer_from_ticket.txt similarity index 100% rename from dev/examples/mail/source_email_ticket_2_answer_from_ticket.txt rename to dev/examples/mail/source_email_ticket_2_a_answer_from_ticket.txt diff --git a/dev/examples/mail/source_email_ticket_3_answer_from_mailer.txt b/dev/examples/mail/source_email_ticket_2_b_answer_from_mailer.txt similarity index 100% rename from dev/examples/mail/source_email_ticket_3_answer_from_mailer.txt rename to dev/examples/mail/source_email_ticket_2_b_answer_from_mailer.txt diff --git a/dev/examples/mail/source_email_ticket_4_answer_of_answer_from_mailer.txt b/dev/examples/mail/source_email_ticket_3_after_2_answer_of_answer_from_mailer.txt similarity index 99% rename from dev/examples/mail/source_email_ticket_4_answer_of_answer_from_mailer.txt rename to dev/examples/mail/source_email_ticket_3_after_2_answer_of_answer_from_mailer.txt index 314e9cda20f..69c22775b19 100644 --- a/dev/examples/mail/source_email_ticket_4_answer_of_answer_from_mailer.txt +++ b/dev/examples/mail/source_email_ticket_3_after_2_answer_of_answer_from_mailer.txt @@ -131,4 +131,4 @@ tter.com/eldy10 ps://www.twitter.com/eldy10" target=3D"_blank">https://www.twitter.com/eldy= 10 ---000000000000cd54be05ad51fe67-- \ No newline at end of file +--000000000000cd54be05ad51fe67-- diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 37202d6187c..4dee052f83f 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -542,7 +542,6 @@ return [ 'htdocs/core/class/fiscalyear.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/google.class.php' => ['PhanPluginUnknownPropertyType'], 'htdocs/core/class/hookmanager.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeInvalidDimOffset', 'PhanUndeclaredProperty'], - 'htdocs/core/class/html.form.class.php' => ['PhanTypeConversionFromArray', 'PhanTypeInvalidDimOffset', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredProperty', 'PhanPluginUnknownObjectMethodCall'], 'htdocs/core/class/html.formaccounting.class.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable'], 'htdocs/core/class/html.formadmin.class.php' => ['PhanPluginUnknownArrayMethodParamType'], 'htdocs/core/class/html.formbarcode.class.php' => ['PhanPluginUnknownArrayMethodParamType'], diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index f99b6c0aef4..68e52e148a7 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -7,6 +7,7 @@ * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021-2023 Frédéric France * Copyright (C) 2024 MDW + * Copyright (C) 2024 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -225,7 +226,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid' => isset($socid) ? $socid : null); +$parameters = array('socid' => isset($socid) ? $socid : null, 'arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index da17f3e3e9d..90130e78505 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -315,31 +315,37 @@ if ($mode == 'setup' && $user->admin) { print $langs->trans("IsTokenGenerated"); print ''; print ''; - if (is_object($tokenobj)) { - print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state)); + if ($keyforprovider != 'Login') { + if (is_object($tokenobj)) { + print $form->textwithpicto(yn(1), $langs->trans("HasAccessToken").' : '.dol_print_date($storage->date_modification, 'dayhour').' state='.dol_escape_htmltag($storage->state)); + } else { + print ''.$langs->trans("NoAccessToken").''; + } } else { - print ''.$langs->trans("NoAccessToken").''; + print ''.$langs->trans("TokenNotRequiredForOAuthLogin").''; } print ''; print ''; - // Links to delete/checks token - if (is_object($tokenobj)) { - //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? - if ($urltodelete) { - print ''.$langs->trans('DeleteAccess').'
'; - } else { - print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
'; + if ($keyforprovider != 'Login') { + // Links to delete/checks token + if (is_object($tokenobj)) { + //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ? + if ($urltodelete) { + print ''.$langs->trans('DeleteAccess').'
'; + } else { + print ''.$langs->trans('GoOnTokenProviderToDeleteToken').'
'; + } + } + // Request remote token + if ($urltorenew) { + print ''.$langs->trans('GetAccess').''; + print $form->textwithpicto('', $langs->trans('RequestAccess')); + print '
'; + } + // Check remote access + if ($urltocheckperms) { + print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; } - } - // Request remote token - if ($urltorenew) { - print ''.$langs->trans('GetAccess').''; - print $form->textwithpicto('', $langs->trans('RequestAccess')); - print '
'; - } - // Check remote access - if ($urltocheckperms) { - print '
'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': '.$urltocheckperms.''; } print ''; print ''; diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index a0ef3ee897c..cdd26c933c8 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -159,7 +159,7 @@ $head = webhookAdminPrepareHead(); print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "webhook"); // Setup page goes here -echo ''.$langs->trans("WebhookSetupPage").'

'; +echo ''.$langs->trans("WebhookSetupPage", $langs->transnoentitiesnoconv("Targets")).'

'; if ($action == 'edit') { @@ -339,10 +339,11 @@ if ($action == 'edit') { } } - +/* if (empty($setupnotempty)) { print '
'.$langs->trans("NothingToSetup"); } +*/ // Page end print dol_get_fiche_end(); diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 31e8dcf47c7..4dfbc3c7dcb 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -441,6 +441,52 @@ if (Luracast\Restler\Defaults::$returnResponse) { echo $result; } +if (getDolGlobalInt("API_ENABLE_COUNT_CALLS") && $api->r->responseCode == 200) { + $error = 0; + $db->begin(); + $userid = DolibarrApiAccess::$user->id; + + $sql = "SELECT up.value"; + $sql .= " FROM ".MAIN_DB_PREFIX."user_param as up"; + $sql .= " WHERE up.param = 'API_COUNT_CALL'"; + $sql .= " AND up.fk_user = ".((int) $userid); + $sql .= " AND up.entity = ".((int) $conf->entity); + + $result = $db->query($sql); + if ($result) { + $updateapi = false; + $nbrows = $db->num_rows($result); + if ($nbrows == 0) { + $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."user_param"; + $sql2 .= " (fk_user, entity, param, value)"; + $sql2 .= " VALUES (".((int) $userid).", ".((int) $conf->entity).", 'API_COUNT_CALL', 1)"; + } else { + $updateapi = true; + $sql2 = "UPDATE ".MAIN_DB_PREFIX."user_param as up"; + $sql2 .= " SET up.value = up.value + 1"; + $sql2 .= " WHERE up.param = 'API_COUNT_CALL'"; + $sql2 .= " AND up.fk_user = ".((int) $userid); + $sql2 .= " AND up.entity = ".((int) $conf->entity); + } + + $result2 = $db->query($sql2); + if (!$result2) { + $modeapicall = $updateapi ? 'updating' : 'inserting'; + dol_syslog('Error while '.$modeapicall. ' API_COUNT_CALL for user '.$userid, LOG_ERR); + $error++; + } + } else { + dol_syslog('Error on select API_COUNT_CALL for user '.$userid, LOG_ERR); + $error++; + } + + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } +} + // Call API termination method $apiMethodInfo = &$api->r->apiMethodInfo; $terminateCall = '_terminate_' . $apiMethodInfo->methodName . '_' . $api->r->responseFormat->getExtension(); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 015b352dbc3..91572a1bf44 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -13,6 +13,7 @@ * Copyright (C) 2019 Josep Lluís Amador * Copyright (C) 2020 Open-Dsi * Copyright (C) 2024 MDW + * Copyright (C) 2024 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -347,7 +348,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array(); +$parameters = array('arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index ba0653a55ed..4626c571e58 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -11,6 +11,7 @@ * Copyright (C) 2021 Alexandre Spangaro * Copyright (C) 2024 MDW * Copyright (C) 2024 Frédéric France + * Copyright (C) 2024 Benjamin Falière * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -223,7 +224,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } -$parameters = array('socid' => $socid); +$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f7e50f953b9..0269491a66d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5210,7 +5210,7 @@ class Form * @param string $title Title * @param string $question Question * @param string $action Action - * @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) + * @param array{text:string}|array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) * @param string $selectedchoice "" or "no" or "yes" * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int $height Force height of box @@ -5244,8 +5244,8 @@ class Form * @param array}>|string|null $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>'autofocus' or 'style=...')) * 'type' can be 'text', 'password', 'checkbox', 'radio', 'date', 'datetime', 'select', 'multiselect', 'morecss', * 'other', 'onecolumn' or 'hidden'... - * @param int|string $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 - * @param int|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx + * @param int<0,1>|''|'no'|'yes'|'1'|'0' $selectedchoice '' or 'no', or 'yes' or '1', 1, '0' or 0 + * @param int<0,2>|string $useajax 0=No, 1=Yes use Ajax to show the popup, 2=Yes and also submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $height Force height of box (0 = auto) * @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones. * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
section. @@ -5450,8 +5450,8 @@ class Form array_push($inputok, $input['name']); } } - // Add name of fields to propagate with the GET when submitting the form with button KO. - if (isset($input['inputko']) && $input['inputko'] == 1 && isset($input['name'])) { + // Add name of fields to propagate with the GET when submitting the form with button KO. @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset + if (array_key_exists('inputko', $input) && $input['inputko'] == 1 && isset($input['name'])) { array_push($inputko, $input['name']); } } @@ -5459,7 +5459,7 @@ class Form // Show JQuery confirm box. $formconfirm .= '