diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
index fb05f408e57..8adc5051bc2 100644
--- a/.github/workflows/pre-commit.yml
+++ b/.github/workflows/pre-commit.yml
@@ -10,6 +10,10 @@ on:
type: string
workflow_dispatch:
+concurrency:
+ group: pre-commit-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref
+ }}
+ cancel-in-progress: true
env:
gh_event: ${{ inputs.gh_event || github.event_name }}
jobs:
@@ -47,12 +51,14 @@ jobs:
cache: pip
python-version: "3.11"
- run: python -m pip install pre-commit
+
# Restore previous cache of precommit
- uses: actions/cache/restore@v4
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- # Run all the precommit tools (defined into pre-commit-config.yaml).
+
+ # Run all the precommit tools (defined in pre-commit-config.yaml).
# We can force exclusion of some of them here.
- name: Run pre-commit hooks
env:
@@ -112,6 +118,7 @@ jobs:
set -o pipefail
ln -sf ~/.cache .cache # Absolute path in .pre-commit-config.yaml
pre-commit run --hook-stage manual -a php-cs-with-cache | tee -a ${RAW_LOG}
+ pre-commit run --hook-stage manual -a sqlfluff-lint | tee -a ${RAW_LOG}
ls -l ~/.cache/pre-commit/
- name: Convert Raw Log to Annotations
@@ -135,4 +142,3 @@ jobs:
path: |
${{ env.RAW_LOG }}
${{ env.CS_XML }}
- retention-days: 2
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 814f144508c..cf9d37d2cc3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -43,6 +43,7 @@ repos:
- id: end-of-file-fixer
# Check that there are no completely merged file conflicts
- id: check-merge-conflict
+ stages: [pre-commit, pre-rebase, pre-commit, pre-merge-commit]
# Check that files with shebangs have the executable bit set (in git)
- id: check-executables-have-shebangs
# Check that shell files are executables
@@ -231,3 +232,26 @@ repos:
hooks:
- id: shellcheck
args: [-W, "100"]
+
+ - repo: https://github.com/sqlfluff/sqlfluff
+ rev: 3.0.4
+ hooks:
+ - id: sqlfluff-lint
+ stages: [pre-commit, manual] # manual needed for ci
+ exclude: (?x)^
+ (htdocs/includes/.*
+ |htdocs/install/doctemplates/websites/.*_template
+ |htdocs/core/menus/init_menu_auguria\.sql
+ |htdocs/install/doctemplates/websites/website_template-.*\.sql
+ |(htdocs/install/mysql/data/(llx_20_c_departements\.sql
+ |llx_accounting_account_.*\.sql)
+ |(htdocs/install/mysql/migration/3\.[256]\.0-.*\.sql)
+ )
+ |htdocs/install/mysql/migration/(1[0-5]|[456789])\.0\.0-.*\.sql
+ |htdocs/install/mysql/migration/3\.([0134789])\.0-.*\.sql
+ |htdocs/install/mysql/migration/repair\.sql
+ |htdocs/install/mysql/tables/llx_bookcal_availabilities-bookcal\.sql
+ |htdocs/install/mysql/tables/llx_categorie(_(account|actioncomm|contact|fournisseur|knowledgemanagement-knowledgemanagement|member|product|project|societe|ticket-ticket|user|warehouse|website_page-website)?\.key\.sql)
+ |htdocs/install/mysql/tables/llx_rights_def\.key\.sql
+ |htdocs/install/pgsql/functions/functions(-(don|loan|mailing|opensurvey|partnership|recruitment|website))?\.sql
+ )$
diff --git a/README.md b/README.md
index 52b74a1fcdf..8d661158efb 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activities (contacts, suppliers, invoices, orders, stocks, agenda…).
-It's an Open-Source Software suite (written in PHP with optional JavaScript enhancements) designed for small, medium or large companies, foundations and freelancers.
+It's an Open-Source Software suite (written in PHP with JavaScript enhancements) designed for small, medium or large companies, foundations and freelancers.
You can freely use, study, modify or distribute it according to its license.
@@ -187,7 +187,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- APIs (REST, SOAP)
- Code that is easy to understand, maintain and develop (PHP with no heavy framework; trigger and hook architecture)
- Support a lot of country-specific features:
- - Spanish Tax RE and ISPF
+ - Spanish Tax RE and IRPF
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
- Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp
diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt
index 992f00540a5..3af98b46915 100644
--- a/dev/tools/phan/baseline.txt
+++ b/dev/tools/phan/baseline.txt
@@ -10,21 +10,21 @@
return [
// # Issue statistics:
// PhanPluginUnknownPropertyType : 2250+ occurrences
- // PhanTypePossiblyInvalidDimOffset : 1560+ occurrences
+ // PhanTypePossiblyInvalidDimOffset : 1550+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 1450+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 1400+ occurrences
- // PhanPluginUnknownObjectMethodCall : 1050+ occurrences
- // PhanUndeclaredProperty : 940+ occurrences
+ // PhanPluginUnknownObjectMethodCall : 1040+ occurrences
+ // PhanUndeclaredProperty : 840+ occurrences
// PhanPluginUnknownArrayMethodParamType : 780+ occurrences
// PhanUndeclaredGlobalVariable : 730+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 620+ occurrences
// PhanPossiblyUndeclaredVariable : 420+ occurrences
- // PhanTypeArraySuspiciousNullable : 360+ occurrences
+ // PhanTypeArraySuspiciousNullable : 340+ occurrences
// PhanTypeMismatchProperty : 300+ occurrences
// PhanPluginDuplicateExpressionAssignmentOperation : 280+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 230+ occurrences
// PhanTypeObjectUnsetDeclaredProperty : 230+ occurrences
- // PhanPluginUnknownArrayFunctionParamType : 190+ occurrences
+ // PhanPluginUnknownArrayFunctionParamType : 180+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 180+ occurrences
// PhanTypeInvalidDimOffset : 170+ occurrences
// PhanTypeExpectedObjectPropAccess : 150+ occurrences
@@ -53,10 +53,10 @@ return [
// PhanInvalidFQSENInClasslike : 4 occurrences
// PhanParamTooMany : 4 occurrences
// PhanTypeConversionFromArray : 3 occurrences
+ // PhanNoopStringLiteral : 2 occurrences
// PhanTypeComparisonToArray : 2 occurrences
// PhanAccessMethodProtected : 1 occurrence
// PhanAccessPropertyStaticAsNonStatic : 1 occurrence
- // PhanNoopStringLiteral : 1 occurrence
// PhanPluginWhitespaceTrailing : 1 occurrence
// PhanTypeArraySuspiciousNull : 1 occurrence
// PhanTypeMismatchReturn : 1 occurrence
@@ -172,7 +172,7 @@ return [
'htdocs/admin/supplier_order.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod'],
'htdocs/admin/supplier_payment.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredMethod'],
'htdocs/admin/supplier_proposal.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
- 'htdocs/admin/syslog.php' => ['PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredMethod'],
+ 'htdocs/admin/syslog.php' => ['PhanTypeMismatchArgumentNullableInternal'],
'htdocs/admin/system/constall.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/admin/system/database-tables.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/admin/system/dbtable.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeArraySuspiciousNullable'],
@@ -613,7 +613,6 @@ return [
'htdocs/core/lib/fiscalyear.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/fourn.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/ftp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
- 'htdocs/core/lib/functions.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanTypeArraySuspiciousNullable', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypePossiblyInvalidDimOffset', 'PhanUndeclaredMethod', 'PhanUndeclaredProperty'],
'htdocs/core/lib/functions2.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypePossiblyInvalidDimOffset'],
'htdocs/core/lib/functions_ch.lib.php' => ['PhanTypeMismatchDimFetch'],
'htdocs/core/lib/functionsnumtoword.lib.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidLeftOperandOfNumericOp'],
diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst
index 46c73e56d95..fbe32ef779a 100644
--- a/dev/translation/ignore_translation_keys.lst
+++ b/dev/translation/ignore_translation_keys.lst
@@ -102,7 +102,6 @@ Adherent
AdherentNotLinkedToThirdParty
AdvTgtUse
Agents
-AllEntities
AllFilesDidAlreadyExist
AlreadyInV7
AmountOfOrders
@@ -311,7 +310,6 @@ Empty
End
EnterAnIP
EnterNameOfDictionnaryToDeleteDesc
-EntityNameNotDefined
Entries
ErrSCAAuthentication
Error sql
diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php
index a5365331a6b..0352cd5c713 100644
--- a/htdocs/accountancy/admin/index.php
+++ b/htdocs/accountancy/admin/index.php
@@ -51,7 +51,7 @@ $nbletter = GETPOSTINT('ACCOUNTING_LETTERING_NBLETTERS');
$list = array(
'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT',
-// 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated.
+// 'ACCOUNTING_LIMIT_LIST_VENTILATION' // there is already a global parameter to define the nb of records in lists, we must use it in priority. Having one parameter for nb of record for each page is deprecated.
// 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
// 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
);
@@ -68,7 +68,7 @@ $error = 0;
* Actions
*/
-if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
+if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_ER_DATE_RECORD', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
$constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOSTINT('value');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
@@ -345,6 +345,19 @@ if (getDolGlobalString('BANK_DISABLE_DIRECT_INPUT')) {
}
print '';
+print '
';
+print ''.$langs->trans("ACCOUNTANCY_ER_DATE_RECORD").' ';
+if (getDolGlobalInt('ACCOUNTANCY_ER_DATE_RECORD')) {
+ print '';
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ print ' ';
+} else {
+ print '';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+}
+print ' ';
+
print '';
print ''.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
print ' - '.$langs->trans("NotRecommended").' ';
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index fd3262620c1..a8aac1df719 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -110,7 +110,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
-$sql = "SELECT er.rowid, er.ref, er.date_debut as de,";
+$sql = "SELECT er.rowid, er.ref, er.date_debut as de, er.date_fin as df,";
$sql .= " erd.rowid as erdid, erd.comments, erd.total_ht, erd.total_tva, erd.total_localtax1, erd.total_localtax2, erd.tva_tx, erd.total_ttc, erd.fk_code_ventilation, erd.vat_src_code, ";
$sql .= " u.rowid as uid, u.firstname, u.lastname, u.accountancy_code as user_accountancy_account,";
$sql .= " f.accountancy_code, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
@@ -183,7 +183,11 @@ if ($result) {
$def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : '')] = (vatrate($obj->tva_tx).($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''));
}
- $taber[$obj->rowid]["date"] = $db->jdate($obj->de);
+ if (getDolGlobalInt('ACCOUNTANCY_ER_DATE_RECORD')) {
+ $taber[$obj->rowid]["date"] = $db->jdate($obj->df);
+ } else {
+ $taber[$obj->rowid]["date"] = $db->jdate($obj->de);
+ }
$taber[$obj->rowid]["ref"] = $obj->ref;
$taber[$obj->rowid]["comments"] = $obj->comments;
$taber[$obj->rowid]["fk_expensereportdet"] = $obj->erdid;
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index cef180ab96b..88115b59295 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -308,19 +308,19 @@ if ($action == 'edit') {
}
}
function change_smtp_auth_method() {
- console.log(jQuery("#radio_pw").prop("checked"));
+ console.log("Call smtp auth method");
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_oauth_service").show();
jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
} else if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
jQuery(".smtp_oauth_service").show();
- jQuery(".smtp_pw").hide();
} else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
- jQuery(".smtp_oauth_service").hide();
jQuery(".smtp_pw").hide();
- } else {
jQuery(".smtp_oauth_service").hide();
+ } else {
jQuery(".smtp_pw").show();
+ jQuery(".smtp_oauth_service").hide();
}
}
initfields();
@@ -329,7 +329,7 @@ if ($action == 'edit') {
initfields();
change_smtp_auth_method();
});
- jQuery("#radio_pw, #radio_oauth").change(function() {
+ jQuery("#radio_pw, #radio_plain, #radio_oauth").change(function() {
change_smtp_auth_method();
});
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
@@ -450,7 +450,10 @@ if ($action == 'edit') {
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
// Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
print ' ';
- print ''.$langs->trans("UsePassword").' ';
+ print ''.$langs->trans("UseAUTHLOGIN").' ';
+ print ' ';
+ print ' ';
+ print ''.$langs->trans("UseAUTHPLAIN").' ';
print ' ';
print ' ';
print ''.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).' ';
@@ -698,7 +701,14 @@ if ($action == 'edit') {
// AUTH method
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
- $text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
+ $text = '';
+ if ($authtype === "LOGIN") {
+ $text = $langs->trans("UseAUTHLOGIN");
+ } elseif ($authtype === "PLAIN") {
+ $text = $langs->trans("UseAUTHPLAIN");
+ } elseif ($authtype === "XOAUTH2") {
+ $text = $langs->trans("UseOauth");
+ }
print ' '.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").' '.$text.' ';
}
diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php
index 059a99a7a1b..5419731f0dc 100644
--- a/htdocs/admin/mails_emailing.php
+++ b/htdocs/admin/mails_emailing.php
@@ -192,6 +192,7 @@ if ($action == 'edit') {
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\')
{
+ console.log("I choose php mail mode");
jQuery(".drag").hide();
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").prop("disabled", true);
@@ -221,6 +222,7 @@ if ($action == 'edit') {
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\')
{
+ console.log("I choose smtps mail mode");
jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING').');
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
@@ -232,14 +234,15 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
- jQuery("#smtp_port_mess").hide();
+ jQuery("#smtp_port_mess").hide();
jQuery("#smtp_server_mess").hide();
- jQuery(".smtp_method").show();
+ jQuery(".smtp_method").show();
jQuery(".smtp_auth_method").show();
}
if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
{
- jQuery(".drag").show();
+ console.log("I choose swiftmailer mail mode");
+ jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_EMAILING').');
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING').');
@@ -252,35 +255,37 @@ if ($action == 'edit') {
jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
- jQuery(".smtp_method").show();
- jQuery(".smtp_auth_method").show();
+ jQuery(".smtp_method").show();
+ jQuery(".smtp_auth_method").show();
}
}
- function change_smtp_auth_method() {
- console.log(jQuery("#radio_pw").prop("checked"));
- if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_oauth_service").show();
- jQuery(".smtp_pw").hide();
- } else if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_oauth_service").show();
- jQuery(".smtp_pw").hide();
- } else if(jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\' || jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\'){
- jQuery(".smtp_oauth_service").hide();
- jQuery(".smtp_pw").hide();
- } else {
- jQuery(".smtp_oauth_service").hide();
- jQuery(".smtp_pw").show();
- }
- }
+ function change_smtp_auth_method() {
+ console.log("Call smtp auth method");
+ if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
+ } else if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
+ } else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").hide();
+ } else {
+ jQuery(".smtp_pw").show();
+ jQuery(".smtp_oauth_service").hide();
+ }
+ }
+
+ change_smtp_auth_method();
initfields();
- change_smtp_auth_method();
- jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
+
+ jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
+ change_smtp_auth_method();
initfields();
- change_smtp_auth_method();
- });
- jQuery("#radio_pw, #radio_oauth").change(function() {
- change_smtp_auth_method();
- });
+ });
+ jQuery("#radio_pw, #radio_plain, #radio_oauth").change(function() {
+ change_smtp_auth_method();
+ });
jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").change(function() {
if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
@@ -401,8 +406,11 @@ if ($action == 'edit') {
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
// Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
print ' ';
- print ''.$langs->trans("UsePassword").' ';
- print ' ';
+ print ''.$langs->trans("UseAUTHLOGIN").' ';
+ print ' ';
+ print ' ';
+ print ''.$langs->trans("UseAUTHPLAIN").' ';
+ print ' ';
print ' ';
print ''.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).' ';
} else {
@@ -552,7 +560,14 @@ if ($action == 'edit') {
// AUTH method
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) {
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
- $text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
+ $text = '';
+ if ($authtype === "LOGIN") {
+ $text = $langs->trans("UseAUTHLOGIN");
+ } elseif ($authtype === "PLAIN") {
+ $text = $langs->trans("UseAUTHPLAIN");
+ } elseif ($authtype === "XOAUTH2") {
+ $text = $langs->trans("UseOauth");
+ }
print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").' '.$text.' ';
}
diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php
index dd9f63c3ef6..ddc149c8a45 100644
--- a/htdocs/admin/mails_ticket.php
+++ b/htdocs/admin/mails_ticket.php
@@ -93,6 +93,7 @@ if ($action == 'update' && !$cancel) {
}
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_TLS_TICKET"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_TICKET"), 'chaine', 0, '', $conf->entity);
+ dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET"), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@@ -190,6 +191,7 @@ if ($action == 'edit') {
if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\')
{
+ console.log("I choose php mail mode");
jQuery(".drag").hide();
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").prop("disabled", true);
@@ -217,6 +219,7 @@ if ($action == 'edit') {
}
if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\')
{
+ console.log("I choose smtps mail mode");
jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
@@ -233,6 +236,7 @@ if ($action == 'edit') {
}
if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\')
{
+ console.log("I choose swiftmailer mail mode");
jQuery(".drag").show();
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
@@ -248,33 +252,33 @@ if ($action == 'edit') {
jQuery(".smtp_auth_method").show();
}
}
- function change_smtp_auth_method() {
- console.log(jQuery("#radio_pw").prop("checked"));
- if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_oauth_service").show();
- jQuery(".smtp_pw").hide();
- } else if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
- jQuery(".smtp_oauth_service").show();
- jQuery(".smtp_pw").hide();
- } else if(jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\' || jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'default\'){
- jQuery(".smtp_oauth_service").hide();
- jQuery(".smtp_pw").hide();
- } else {
- jQuery(".smtp_oauth_service").hide();
- jQuery(".smtp_pw").show();
- }
- }
+ function change_smtp_auth_method() {
+ console.log("Call smtp auth method");
+ if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
+ } else if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").show();
+ } else if(jQuery("#MAIN_MAIL_SENDMODE").val()==\'mail\'){
+ jQuery(".smtp_pw").hide();
+ jQuery(".smtp_oauth_service").hide();
+ } else {
+ jQuery(".smtp_pw").show();
+ jQuery(".smtp_oauth_service").hide();
+ }
+ }
+
initfields();
- change_smtp_auth_method();
+ change_smtp_auth_method();
jQuery("#MAIN_MAIL_SENDMODE_TICKET").change(function() {
initfields();
- change_smtp_auth_method();
-
+ change_smtp_auth_method();
});
- jQuery("#radio_pw, #radio_oauth").change(function() {
- change_smtp_auth_method();
- });
+ jQuery("#radio_pw, #radio_plain, #radio_oauth").change(function() {
+ change_smtp_auth_method();
+ });
jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val() == 1)
jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
@@ -391,8 +395,11 @@ if ($action == 'edit') {
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
// Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
print ' ';
- print ''.$langs->trans("UsePassword").' ';
- print ' ';
+ print ''.$langs->trans("UseAUTHLOGIN").' ';
+ print ' ';
+ print ' ';
+ print ''.$langs->trans("UseAUTHPLAIN").' ';
+ print ' ';
print ' ';
print ''.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).' ';
} else {
@@ -480,6 +487,19 @@ if ($action == 'edit') {
}
print '';
+ // SMTP_ALLOW_SELF_SIGNED_TICKET
+ print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' ';
+ if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
+ if (function_exists('openssl_open')) {
+ print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET : 0), 1);
+ } else {
+ print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
+ }
+ } else {
+ print yn(0).' ('.$langs->trans("NotSupported").')';
+ }
+ print ' ';
+
print '';
print dol_get_fiche_end();
@@ -528,7 +548,14 @@ if ($action == 'edit') {
// AUTH method
if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
- $text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
+ $text = '';
+ if ($authtype === "LOGIN") {
+ $text = $langs->trans("UseAUTHLOGIN");
+ } elseif ($authtype === "PLAIN") {
+ $text = $langs->trans("UseAUTHPLAIN");
+ } elseif ($authtype === "XOAUTH2") {
+ $text = $langs->trans("UseOauth");
+ }
print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").' '.$text.' ';
}
@@ -539,7 +566,7 @@ if ($action == 'edit') {
// SMTPS PW
if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") {
- print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").' '.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW_TICKET).' ';
+ print ''.$langs->trans("MAIN_MAIL_SMTPS_PW").' '.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).' ';
}
// SMTPS oauth service
@@ -584,6 +611,23 @@ if ($action == 'edit') {
}
print '';
}
+
+ // SMTP_ALLOW_SELF_SIGNED_EMAILING
+ if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
+ // Nothing
+ } else {
+ print ''.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").' ';
+ if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
+ if (function_exists('openssl_open')) {
+ print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET'));
+ } else {
+ print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
+ }
+ } else {
+ print ''.yn(0).' ('.$langs->trans("NotSupported").') ';
+ }
+ print ' ';
+ }
}
print '';
diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php
index d68b7c054ef..5a4fd73faab 100644
--- a/htdocs/admin/workflow.php
+++ b/htdocs/admin/workflow.php
@@ -119,6 +119,14 @@ $workflowcodes = array(
'warning' => ''
), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
+ 'WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER' => array(
+ 'family' => 'classify_order',
+ 'position' => 43,
+ 'enabled' => (isModEnabled('invoice') && isModEnabled('order')),
+ 'picto' => 'order',
+ 'warning' => ''
+ ), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
+
// Automatic classification supplier proposal
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL' => array(
'family' => 'classify_supplier_proposal',
@@ -196,12 +204,14 @@ $workflowcodes = array(
'family' => 'link_ticket',
'position' => 500,
'enabled' => (isModEnabled('ticket') && isModEnabled('contract')),
- 'picto' => 'ticket'
+ 'picto' => 'ticket',
+ 'reloadpage' => 1 // So next option can be shown
),
+ // This one depends on previous one WORKFLOW_TICKET_LINK_CONTRACT
'WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS' => array(
'family' => 'link_ticket',
'position' => 501,
- 'enabled' => (isModEnabled('ticket') && isModEnabled('contract')),
+ 'enabled' => (isModEnabled('ticket') && isModEnabled('contract') && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT')),
'picto' => 'ticket'
),
);
@@ -323,7 +333,11 @@ foreach ($workflowcodes as $key => $params) {
print '';
if (!empty($conf->use_javascript_ajax)) {
- print ajax_constantonoff($key);
+ if (!empty($params['reloadpage'])) {
+ print ajax_constantonoff($key, array(), null, 0, 0, 1);
+ } else {
+ print ajax_constantonoff($key);
+ }
} else {
if (getDolGlobalString($key)) {
print '';
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index a952b9565d7..2586f80790d 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -482,7 +482,7 @@ if ($object->id > 0) {
print $langs->trans("CustomerAbsoluteDiscountShort");
print ' ';
if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
- print 'id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).' ';
+ print 'id).'&action=create_remise&token='.newToken().'">'.img_edit($langs->trans("Modify")).' ';
}
print ' ';
print '';
diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php
index 12888f2f24e..4f6fae9823a 100644
--- a/htdocs/comm/remx.php
+++ b/htdocs/comm/remx.php
@@ -378,7 +378,7 @@ if ($socid > 0) {
// VAT
print ''.$langs->trans("VAT").' ';
print '';
- print $form->load_tva('tva_tx', GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : 0, $mysoc, $object, 0, 0, '', 0, 1);
+ print $form->load_tva('tva_tx', (GETPOSTISSET('tva_tx') ? GETPOST('tva_tx', 'alpha') : getDolGlobalString('MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS', 0)), $mysoc, $object, 0, 0, '', 0, 1);
print ' ';
print ''.$langs->trans("NoteReason").' ';
print ' ';
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index 0d364c64625..198a0e3d646 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -4,6 +4,7 @@
* Copyright (C) 2015 Raphaël Doursenaud
* Copyright (C) 2018 Frédéric France
* Copyright (C) 2022 Alexandre Spangaro
+ * Copyright (C) 2024 Charlene Benke
*
* 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
@@ -21,7 +22,7 @@
/**
* \file htdocs/compta/stats/cabyprodserv.php
- * \brief Page reporting TO by Products & Services
+ * \brief Page reporting Turnover billed by Products & Services
*/
// Load Dolibarr environment
@@ -64,8 +65,9 @@ if (!$sortfield) {
}
// Category
-$selected_cat = GETPOSTINT('search_categ');
-$selected_soc = GETPOSTINT('search_soc');
+$selected_cat = GETPOST('search_categ', 'intcomma');
+$selected_catsoc = GETPOST('search_categ_soc', 'intcomma');
+$selected_soc = GETPOST('search_soc', 'intcomma');
$subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') {
$subcat = true;
@@ -73,7 +75,7 @@ if (GETPOST('subcat', 'alpha') === 'yes') {
$categorie = new Categorie($db);
// product/service
-$selected_type = GETPOSTINT('search_type');
+$selected_type = GETPOST('search_type', 'intcomma');
if ($selected_type == '') {
$selected_type = -1;
}
@@ -196,6 +198,9 @@ $tableparams = array();
if (!empty($selected_cat)) {
$tableparams['search_categ'] = $selected_cat;
}
+if (!empty($selected_catsoc)) {
+ $tableparams['search_categ_soc'] = $selected_catsoc;
+}
if (!empty($selected_soc)) {
$tableparams['search_soc'] = $selected_soc;
}
@@ -211,7 +216,7 @@ $tableparams = array_merge($commonparams, $tableparams);
$paramslink = "";
foreach ($allparams as $key => $value) {
- $paramslink .= '&'.$key.'='.$value;
+ $paramslink .= '&'.urlencode($key).'='.urlencode($value);
}
@@ -277,7 +282,6 @@ if (isModEnabled('accounting') && $modecompta != 'BOOKKEEPING') {
}
-
$name = array();
// SQL request
@@ -286,7 +290,7 @@ $catotal_ht = 0;
$qtytotal = 0;
if ($modecompta == 'CREANCES-DETTES') {
- $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
+ $sql = "SELECT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,";
$sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,";
$sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty";
@@ -295,14 +299,8 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
- if ($selected_soc > 0) {
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)";
- }
$sql .= ",".MAIN_DB_PREFIX."facturedet as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid";
- if ($selected_cat === -2) { // Without any category
- $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
- }
$parameters = array();
$hookmanager->executeHooks('printFieldListFrom', $parameters);
@@ -322,32 +320,78 @@ if ($modecompta == 'CREANCES-DETTES') {
if ($selected_type >= 0) {
$sql .= " AND l.product_type = ".((int) $selected_type);
}
- if ($selected_cat === -2) { // Without any category
- $sql .= " AND cp.fk_product is null";
- } elseif ($selected_cat > 0) { // Into a specific category
- if ($subcat) {
- $TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1);
- $listofcatsql = "";
- foreach ($TListOfCats as $key => $cat) {
- if ($key !== 0) {
- $listofcatsql .= ",";
+ // Search for tag/category ($searchCategoryProductList is an array of ID)
+ $searchCategoryProductOperator = -1;
+ $searchCategoryProductList = array($selected_cat);
+ if ($subcat) {
+ $TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1);
+ $searchCategoryProductList = array();
+ foreach ($TListOfCats as $key => $cat) {
+ $searchCategoryProductList[] = $cat['rowid'];
+ }
+ }
+ if (!empty($searchCategoryProductList)) {
+ $searchCategoryProductSqlList = array();
+ $listofcategoryid = '';
+ foreach ($searchCategoryProductList as $searchCategoryProduct) {
+ if (intval($searchCategoryProduct) == -2) {
+ $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE l.fk_product = ck.fk_product)";
+ } elseif (intval($searchCategoryProduct) > 0) {
+ if ($searchCategoryProductOperator == 0) {
+ $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE l.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
+ } else {
+ $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
}
- $listofcatsql .= $cat['rowid'];
}
}
-
- $sql .= " AND (p.rowid IN ";
- $sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE ";
- if ($subcat) {
- $sql .= "cp.fk_categorie IN (".$db->sanitize($listofcatsql).")";
- } else {
- $sql .= "cp.fk_categorie = ".((int) $selected_cat);
+ if ($listofcategoryid) {
+ $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck WHERE l.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
+ }
+ if ($searchCategoryProductOperator == 1) {
+ if (!empty($searchCategoryProductSqlList)) {
+ $sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
+ }
+ } else {
+ if (!empty($searchCategoryProductSqlList)) {
+ $sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
+ }
}
- $sql .= "))";
}
+
+ // Search for tag/category ($searchCategorySocieteList is an array of ID)
+ $searchCategorySocieteOperator = -1;
+ $searchCategorySocieteList = array($selected_catsoc);
+ if (!empty($searchCategorySocieteList)) {
+ $searchCategorySocieteSqlList = array();
+ $listofcategoryid = '';
+ foreach ($searchCategorySocieteList as $searchCategorySociete) {
+ if (intval($searchCategorySociete) == -2) {
+ $searchCategorySocieteSqlList[] = "NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE f.fk_soc = cs.fk_soc)";
+ } elseif (intval($searchCategorySociete) > 0) {
+ if ($searchCategorySocieteOperator == 0) {
+ $searchCategorySocieteSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE f.fk_soc = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategorySociete).")";
+ } else {
+ $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySociete);
+ }
+ }
+ }
+ if ($listofcategoryid) {
+ $searchCategorySocieteSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE f.fk_soc = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
+ }
+ if ($searchCategorySocieteOperator == 1) {
+ if (!empty($searchCategorySocieteSqlList)) {
+ $sql .= " AND (".implode(' OR ', $searchCategorySocieteSqlList).")";
+ }
+ } else {
+ if (!empty($searchCategorySocieteSqlList)) {
+ $sql .= " AND (".implode(' AND ', $searchCategorySocieteSqlList).")";
+ }
+ }
+ }
+
if ($selected_soc > 0) {
- $sql .= " AND soc.rowid=".((int) $selected_soc);
+ $sql .= " AND f.fk_soc = ".((int) $selected_soc);
}
$sql .= " AND f.entity IN (".getEntity('invoice').")";
@@ -360,6 +404,7 @@ if ($modecompta == 'CREANCES-DETTES') {
dol_syslog("cabyprodserv", LOG_DEBUG);
$result = $db->query($sql);
+
$amount_ht = array();
$amount = array();
$qty = array();
@@ -368,6 +413,7 @@ if ($modecompta == 'CREANCES-DETTES') {
$i = 0;
while ($i < $num) {
$obj = $db->fetch_object($result);
+
$amount_ht[$obj->rowid] = $obj->amount;
$amount[$obj->rowid] = $obj->amount_ttc;
$qty[$obj->rowid] = $obj->qty;
@@ -399,24 +445,25 @@ if ($modecompta == 'CREANCES-DETTES') {
// Category filter
print '';
print '';
- print img_picto('', 'category', 'class="paddingrightonly"');
+ print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', 0, $langs->trans("Category"));
print ' ';
- print $langs->trans("SubCats").'? ';
- print ' ';
+ print ''.$langs->trans("SubCats").'? ';
// type filter (produit/service)
- print ' ';
- print $langs->trans("Type").': ';
- $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', 1, 1, 1);
+ $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', $langs->trans("Type"), 1, 1);
//select thirdparty
- print '';
- print img_picto('', 'company', 'class="paddingrightonly"');
- print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
+ print ' ';
+ print img_picto('', 'category', 'class="pictofixedwidth"');
+ print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_catsoc, 'search_categ_soc', 0, $langs->trans("CustomersProspectsCategoriesShort"));
+ print ' ';
+ print img_picto('', 'company', 'class="pictofixedwidth"');
+ print $form->select_company($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
print ' ';
print '';
@@ -554,6 +601,8 @@ if ($modecompta == 'CREANCES-DETTES') {
print ' ';
$db->free($result);
+ } else {
+ print ''.$langs->trans("NoRecordFound").' ';
}
print "";
print '';
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index bbe653114a4..4d7da8fe848 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -584,7 +584,7 @@ class CMailFile
$smtps->setBCC($this->addr_bcc);
$smtps->setErrorsTo($this->errors_to);
$smtps->setDeliveryReceipt($this->deliveryreceipt);
- if (!empty($conf->global->$keyforsslseflsigned)) {
+ if (getDolGlobalString($keyforsslseflsigned)) {
$smtps->setOptions(array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true)));
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index a93623dda8a..397436e7496 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3763,7 +3763,7 @@ abstract class CommonObject
* @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object (used to analyze lines to check corrupted data).
* @return int Return integer <0 if KO, >0 if OK
*/
- public function update_price($exclspec = 0, $roundingadjust = 'none', $nodatabaseupdate = 0, $seller = null)
+ public function update_price($exclspec = 0, $roundingadjust = 'auto', $nodatabaseupdate = 0, $seller = null)
{
// phpcs:enable
global $conf, $hookmanager, $action;
@@ -3777,6 +3777,8 @@ abstract class CommonObject
} // reshook = 0 => execute normal code
// Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield)
+ $isElementForSupplier = false;
+ $roundTotalConstName = 'MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND'; // const for customer by default
$MODULE = "";
if ($this->element == 'propal') {
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL";
@@ -3785,12 +3787,18 @@ abstract class CommonObject
} elseif ($this->element == 'facture' || $this->element == 'invoice') {
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE";
} elseif ($this->element == 'facture_fourn' || $this->element == 'supplier_invoice' || $this->element == 'invoice_supplier' || $this->element == 'invoice_supplier_rec') {
+ $isElementForSupplier = true;
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_INVOICE";
} elseif ($this->element == 'order_supplier' || $this->element == 'supplier_order') {
+ $isElementForSupplier = true;
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_ORDER";
} elseif ($this->element == 'supplier_proposal') {
+ $isElementForSupplier = true;
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL";
}
+ if ($isElementForSupplier === true) {
+ $roundTotalConstName = 'MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND_SUPPLIER'; // const for supplier
+ }
if (!empty($MODULE)) {
if (getDolGlobalString($MODULE)) {
@@ -3806,8 +3814,8 @@ abstract class CommonObject
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
$forcedroundingmode = $roundingadjust;
- if ($forcedroundingmode == 'auto' && isset($conf->global->MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND)) {
- $forcedroundingmode = getDolGlobalString('MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND');
+ if ($forcedroundingmode == 'auto' && isset($conf->global->{$roundTotalConstName})) {
+ $forcedroundingmode = getDolGlobalString($roundTotalConstName);
} elseif ($forcedroundingmode == 'auto') {
$forcedroundingmode = '0';
}
@@ -3898,7 +3906,7 @@ abstract class CommonObject
}
$obj->total_tva = $tmpcal[1];
$obj->total_ttc = $tmpcal[2];
- } elseif ($diff_when_using_price_ht && $roundingadjust == '0') {
+ } elseif ($diff_when_using_price_ht) {
// After calculation from HT, total is consistent but we have found a difference between VAT part in calculation and into database and
// we ask to force the use of rounding on line (like done on calculation) so we force update of line
$sqlfix = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldtva." = ".price2num((float) $tmpcal[1]).", total_ttc = ".price2num((float) $tmpcal[2])." WHERE rowid = ".((int) $obj->rowid);
@@ -9141,26 +9149,26 @@ abstract class CommonObject
/**
* Show photos of an object (nbmax maximum), into several columns
*
- * @param string $modulepart 'product', 'ticket', ...
- * @param string $sdir Directory to scan (full absolute path)
- * @param int $size 0=original size, 1='small' use thumbnail if possible
- * @param int $nbmax Nombre maximum de photos (0=pas de max)
- * @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
- * @param int $showfilename 1=Show filename
- * @param int $showaction 1=Show icon with action links (resize, delete)
- * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
- * @param int $maxWidth Max width of original image when size='small'
- * @param int $nolink Do not add a href link to view enlarged imaged into a new tab
- * @param int|string $overwritetitle Do not add title tag on image
- * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
- * @param string $cache A string if we want to use a cached version of image
- * @param string $addphotorefcss Add CSS to img of photos
- * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
+ * @param string $modulepart 'product', 'ticket', ...
+ * @param string $sdir Directory to scan (full absolute path)
+ * @param int<0,1>|''|'small' $size 0 or ''=original size, 1 or 'small'=use thumbnail if possible
+ * @param int $nbmax Nombre maximum de photos (0=pas de max)
+ * @param int $nbbyrow Number of image per line or -1 to use div separator or 0 to use no separator. Used only if size=1 or 'small'.
+ * @param int $showfilename 1=Show filename
+ * @param int $showaction 1=Show icon with action links (resize, delete)
+ * @param int $maxHeight Max height of original image when size='small' (so we can use original even if small requested). If 0, always use 'small' thumb image.
+ * @param int $maxWidth Max width of original image when size='small'
+ * @param int $nolink Do not add a href link to view enlarged imaged into a new tab
+ * @param int|string $overwritetitle Do not add title tag on image
+ * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
+ * @param string $cache A string if we want to use a cached version of image
+ * @param string $addphotorefcss Add CSS to img of photos
+ * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/
public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $overwritetitle = 0, $usesharelink = 0, $cache = '', $addphotorefcss = 'photoref')
{
// phpcs:enable
- global $conf, $user, $langs;
+ global $user, $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 33de02e5f6d..7c96c34a295 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1148,11 +1148,11 @@ class Form
* Return list of types of lines (product or service)
* Example: 0=product, 1=service, 9=other (for external module)
*
- * @param string $selected Preselected type
- * @param string $htmlname Name of field in html form
- * @param int<0,1> $showempty Add an empty field
- * @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
- * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
+ * @param string $selected Preselected type
+ * @param string $htmlname Name of field in html form
+ * @param int<0,1>|string $showempty Add an empty field
+ * @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
+ * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service')
* @return void
*/
public function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0)
@@ -1172,7 +1172,13 @@ class Form
if ($selected == -1) {
print ' selected';
}
- print '> ';
+ print '>';
+ if (is_numeric($showempty)) {
+ print ' ';
+ } else {
+ print $showempty;
+ }
+ print '';
}
print ' $showcode Show code in list
* @return array|string HTML string with
+ * @see select_company()
*/
public function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false, $excludeids = array(), $showcode = 0)
{
@@ -1510,11 +1517,6 @@ class Form
dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
- if (!$forcecombo) {
- include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
- $out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT"));
- }
-
// Construct $out and $outarray
$out .= '' . "\n";
@@ -1614,6 +1616,10 @@ class Form
}
}
$out .= ' ' . "\n";
+ if (!$forcecombo) {
+ include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
+ $out .= ajax_combobox($htmlname, $events, getDolGlobalString("COMPANY_USE_SEARCH_TO_SELECT"));
+ }
} else {
dol_print_error($this->db);
}
@@ -1993,23 +1999,23 @@ class Form
/**
* Return select list of users
*
- * @param string|int|User $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1 or '', keep unselected (if empty is allowed)
- * @param string $htmlname Field name in form
+ * @param string|int|User $selected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1 or '', keep unselected (if empty is allowed)
+ * @param string $htmlname Field name in form
* @param int<0,1>|string $show_empty 0=list with no empty value, 1=add also an empty value into list
- * @param int[]|null $exclude Array list of users id to exclude
- * @param int $disabled If select list must be disabled
- * @param int[]|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
- * @param array|string $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
- * @param string $force_entity '0' or list of Ids of environment to force separated by a coma
- * @param int $maxlength Maximum length of string into list (0=no limit)
- * @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
- * @param string $morefilter Add more filters into sql request (Example: 'employee = 1'). This value must not come from user input.
- * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
- * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
- * @param string $morecss More css
- * @param int<0,1> $notdisabled Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
- * @param int<0,2> $outputmode 0=HTML select string, 1=Array
- * @param bool $multiple add [] in the name of element and add 'multiple' attribute
+ * @param int[]|null $exclude Array list of users id to exclude
+ * @param int $disabled If select list must be disabled
+ * @param int[]|string $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
+ * @param array|string $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
+ * @param string $force_entity '0' or list of Ids of environment to force, separated by a coma, or 'default' = do no extend to all entities allowed to superadmin.
+ * @param int $maxlength Maximum length of string into list (0=no limit)
+ * @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
+ * @param string $morefilter Add more filters into sql request (Example: 'employee = 1'). This value must not come from user input.
+ * @param integer $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
+ * @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
+ * @param string $morecss More css
+ * @param int<0,1> $notdisabled Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
+ * @param int<0,2> $outputmode 0=HTML select string, 1=Array
+ * @param bool $multiple add [] in the name of element and add 'multiple' attribute
* @param int<0,1> $forcecombo Force the component to be a simple combo box without ajax
* @return string|array HTML select string
* @see select_dolgroups()
@@ -2053,14 +2059,21 @@ class Form
$outarray = array();
$outarray2 = array();
+ // Do we want to show the label of entity into the combo list ?
+ $showlabelofentity = isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && !empty($user->admin) && empty($user->entity);
+ $userissuperadminentityone = isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && empty($user->entity);
+
// Forge request to select users
$sql = "SELECT DISTINCT u.rowid, u.lastname as lastname, u.firstname, u.statut as status, u.login, u.admin, u.entity, u.photo";
- if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
+ if ($showlabelofentity) {
$sql .= ", e.label";
}
$sql .= " FROM " . $this->db->prefix() . "user as u";
- if (isModEnabled('multicompany') && $conf->entity == 1 && $user->admin && !$user->entity) {
+ if ($showlabelofentity) {
$sql .= " LEFT JOIN " . $this->db->prefix() . "entity as e ON e.rowid = u.entity";
+ }
+ // Condition here should be the same than into societe->getSalesRepresentatives().
+ if ($userissuperadminentityone && $force_entity != 'default') {
if (!empty($force_entity)) {
$sql .= " WHERE u.entity IN (0, " . $this->db->sanitize($force_entity) . ")";
} else {
@@ -2073,6 +2086,7 @@ class Form
$sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
}
}
+
if (!empty($user->socid)) {
$sql .= " AND u.fk_soc = " . ((int) $user->socid);
}
@@ -2182,14 +2196,14 @@ class Form
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' (') . $langs->trans('Disabled');
}
}
- if (isModEnabled('multicompany') && !getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && !empty($user->admin) && empty($user->entity)) {
+ if ($showlabelofentity) {
if (empty($obj->entity)) {
$moreinfo .= ($moreinfo ? ' - ' : ' (') . $langs->trans("AllEntities");
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' (') . $langs->trans("AllEntities");
} else {
if ($obj->entity != $conf->entity) {
$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
- $moreinfohtml .= ($moreinfohtml ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
+ $moreinfohtml .= ($moreinfohtml ? ' - ' : ' (').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
}
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 56b9de40b22..fe6a624eabb 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -765,6 +765,7 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null
global $object;
'@phan-var-force CommonObject $object'; // Suppose it's a CommonObject for analysis, but other objects have the $fields field as well
if (is_object($object) && isset($object->fields[$paramname]['default'])) {
+ // @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
$out = $object->fields[$paramname]['default'];
}
}
@@ -1416,6 +1417,7 @@ function dol_get_object_properties($obj, $properties = [])
* @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method keeping only scalar and array properties (recommended)
* @return T Clone object
* @see https://php.net/manual/language.oop5.cloning.php
+ * @phan-suppress PhanTypeExpectedObjectPropAccess
*/
function dol_clone($object, $native = 0)
{
@@ -2711,9 +2713,9 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
} else {
$width = 14;
$cssclass = 'photorefcenter';
- $picto = $object->picto;
+ $picto = $object->picto; // @phan-suppress-current-line PhanUndeclaredProperty
$prefix = 'object_';
- if ($object->element == 'project' && !$object->public) {
+ if ($object->element == 'project' && !$object->public) { // @phan-suppress-current-line PhanUndeclaredProperty
$picto = 'project'; // instead of projectpub
}
if (strpos($picto, 'fontawesome_') !== false) {
@@ -2773,6 +2775,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlstatus .= $object->getLibStatut(4);
}
} elseif ($object->element == 'facturerec') {
+ '@phan-var-force FactureRec $object';
if ($object->frequency == 0) {
$morehtmlstatus .= $object->getLibStatut(2);
} else {
@@ -2808,6 +2811,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
// Add alias for thirdparty
if (!empty($object->name_alias)) {
+ '@phan-var-force Societe $object';
$morehtmlref .= ''.dol_escape_htmltag($object->name_alias).'
';
}
@@ -3616,7 +3620,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
/**
* Get array of social network dictionary
*
- * @return array Array of Social Networks Dictionary
+ * @return array Array of Social Networks Dictionary
*/
function getArrayOfSocialNetworks()
{
@@ -3646,7 +3650,6 @@ function getArrayOfSocialNetworks()
}
dol_setcache($cachekey, $socialnetworks); // If setting cache fails, this is not a problem, so we do not test result.
}
-
return $socialnetworks;
}
@@ -3657,7 +3660,7 @@ function getArrayOfSocialNetworks()
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
* @param string $type 'skype','facebook',...
- * @param array $dictsocialnetworks List of socialnetworks availables
+ * @param array $dictsocialnetworks List of socialnetworks available
* @return string HTML Link
*/
function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetworks = array())
@@ -3744,7 +3747,7 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
* @param string $profID Value of profID to format
* @param string $profIDtype Type of profID to format ('1', '2', '3', '4', '5', '6' or 'VAT')
* @param string $countrycode Country code to use for formatting
- * @param int $addcpButton Add button to copy to clipboard (1 => show only on hoover ; 2 => always display )
+ * @param int<0,2> $addcpButton Add button to copy to clipboard (1 => show only on hoover ; 2 => always display )
* @return string Formatted profID
*/
function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton = 1)
@@ -6608,7 +6611,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round
if (($forceunitoutput == 'no' && $dimension < 1 / 10000 && $unit < 90) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) {
$dimension *= 1000000;
- $unit = $unit - 6;
+ $unit -= 6;
} elseif (($forceunitoutput == 'no' && $dimension < 1 / 10 && $unit < 90) || (is_numeric($forceunitoutput) && $forceunitoutput == -3)) {
$dimension *= 1000;
$unit -= 3;
@@ -6835,11 +6838,11 @@ function get_localtax_by_third($local)
* Get tax (VAT) main information from Id.
* You can also call getLocalTaxesFromRate() after to get only localtax fields.
*
- * @param int|string $vatrate VAT ID or Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
- * @param Societe $buyer Company object
- * @param Societe $seller Company object
- * @param int $firstparamisid 1 if first param is id into table (use this if you can)
- * @return array array('rowid'=> , 'code'=> ...)
+ * @param int|string $vatrate VAT ID or Rate. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
+ * @param Societe $buyer Company object
+ * @param Societe $seller Company object
+ * @param int<0,1> $firstparamisid 1 if first param is id into table (use this if you can)
+ * @return array{}|array{rowid:int,code:string,rate:float,localtax1:float,localtax1_type:string,localtax2:float,localtax2_type:string,npr:float,accountancy_code_sell:string,accountacy_code_buy:string} array('rowid'=> , 'code'=> ...)
* @see getLocalTaxesFromRate()
*/
function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid = 1)
@@ -6879,16 +6882,16 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid
$obj = $db->fetch_object($resql);
if ($obj) {
return array(
- 'rowid' => $obj->rowid,
- 'code' => $obj->code,
- 'rate' => $obj->rate,
- 'localtax1' => $obj->localtax1,
- 'localtax1_type' => $obj->localtax1_type,
- 'localtax2' => $obj->localtax2,
- 'localtax2_type' => $obj->localtax2_type,
- 'npr' => $obj->npr,
- 'accountancy_code_sell' => $obj->accountancy_code_sell,
- 'accountancy_code_buy' => $obj->accountancy_code_buy
+ 'rowid' => $obj->rowid,
+ 'code' => $obj->code,
+ 'rate' => $obj->rate,
+ 'localtax1' => $obj->localtax1,
+ 'localtax1_type' => $obj->localtax1_type,
+ 'localtax2' => $obj->localtax2,
+ 'localtax2_type' => $obj->localtax2_type,
+ 'npr' => $obj->npr,
+ 'accountancy_code_sell' => $obj->accountancy_code_sell,
+ 'accountancy_code_buy' => $obj->accountancy_code_buy
);
} else {
return array();
@@ -7645,7 +7648,7 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
* @param int $removeclassattribute 1=Remove the class attribute from tags
* @param int $cleanalsojavascript Remove also occurrence of 'javascript:'.
* @param int $allowiframe Allow iframe tags.
- * @param array $allowed_tags List of allowed tags to replace the default list
+ * @param string[] $allowed_tags List of allowed tags to replace the default list
* @param int $allowlink Allow "link" tags.
* @return string String cleaned
*
@@ -7714,11 +7717,12 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
* Note: Complementary to dol_string_onlythesehtmltags().
* This method is used for example by dol_htmlwithnojs() when option MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES is set to 1.
*
- * @param string $stringtoclean String to clean
- * @param array $allowed_attributes Array of tags not allowed
+ * @param string $stringtoclean String to clean
+ * @param string[] $allowed_attributes Array of tags not allowed
* @return string String cleaned
*
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_onlythesehtmltags() dol_string_neverthesehtmltags()
+ * @phan-suppress PhanUndeclaredProperty
*/
function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes = null)
{
@@ -7752,7 +7756,7 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
//var_dump($attrs->item($ii));
if (!empty($attrs->item($ii)->name)) {
if (! in_array($attrs->item($ii)->name, $allowed_attributes)) {
- // Delete attribute if not into allowed_attributes
+ // Delete attribute if not into allowed_attributes @phan-suppress-next-line PhanUndeclaredMethod
$els->item($i)->removeAttribute($attrs->item($ii)->name);
} elseif (in_array($attrs->item($ii)->name, array('style'))) {
// If attribute is 'style'
@@ -8406,6 +8410,7 @@ function dol_concatdesc($text1, $text2, $forxml = false, $invert = false)
* @param string[]|null $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
* @return array Array of substitutions
* @see setSubstitFromObject()
+ * @phan-suppress PhanTypeArraySuspiciousNullable,PhanTypePossiblyInvalidDimOffset,PhanUndeclaredProperty
*/
function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $object = null, $include = null)
{
@@ -8575,10 +8580,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__SHIPPINGMETHOD__'] = 'Shipping method';
}
if (isModEnabled("reception") && (!is_object($object) || $object->element == 'reception')) {
- $substitutionarray['__RECEPTIONTRACKNUM__'] = 'Shippin tracking number of shipment';
+ $substitutionarray['__RECEPTIONTRACKNUM__'] = 'Shipping tracking number of shipment';
$substitutionarray['__RECEPTIONTRACKNUMURL__'] = 'Shipping tracking url';
}
} else {
+ '@phan-var-force Adherent|Delivery $object';
$substitutionarray['__ID__'] = $object->id;
$substitutionarray['__REF__'] = $object->ref;
$substitutionarray['__NEWREF__'] = $object->newref;
@@ -8608,6 +8614,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__EXPIRATION_DATE__'] = (isset($object->fin_validite) ? dol_print_date($object->fin_validite, 'daytext') : '');
if (is_object($object) && ($object->element == 'adherent' || $object->element == 'member') && $object->id > 0) {
+ '@phan-var-force Adherent $object';
$birthday = (empty($object->birth) ? '' : dol_print_date($object->birth, 'day'));
$substitutionarray['__MEMBER_ID__'] = (isset($object->id) ? $object->id : '');
@@ -8643,6 +8650,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
if (is_object($object) && $object->element == 'societe') {
+ '@phan-var-force Societe $object';
$substitutionarray['__THIRDPARTY_ID__'] = (is_object($object) ? $object->id : '');
$substitutionarray['__THIRDPARTY_NAME__'] = (is_object($object) ? $object->name : '');
$substitutionarray['__THIRDPARTY_NAME_ALIAS__'] = (is_object($object) ? $object->name_alias : '');
@@ -8691,17 +8699,20 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
if (is_object($object) && $object->element == 'recruitmentcandidature') {
+ '@phan-var-force RecruitmentCandidature $object';
$substitutionarray['__CANDIDATE_FULLNAME__'] = $object->getFullName($outputlangs);
$substitutionarray['__CANDIDATE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : '';
$substitutionarray['__CANDIDATE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : '';
}
if (is_object($object) && $object->element == 'conferenceorboothattendee') {
+ '@phan-var-force ConferenceOrBoothAttendee $object';
$substitutionarray['__ATTENDEE_FULLNAME__'] = $object->getFullName($outputlangs);
$substitutionarray['__ATTENDEE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : '';
$substitutionarray['__ATTENDEE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : '';
}
if (is_object($object) && $object->element == 'project') {
+ '@phan-var-force Project $object';
$substitutionarray['__PROJECT_ID__'] = $object->id;
$substitutionarray['__PROJECT_REF__'] = $object->ref;
$substitutionarray['__PROJECT_NAME__'] = $object->title;
@@ -8734,19 +8745,23 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
if (is_object($object) && $object->element == 'facture') {
+ '@phan-var-force Facture $object';
$substitutionarray['__INVOICE_SITUATION_NUMBER__'] = isset($object->situation_counter) ? $object->situation_counter : '';
}
if (is_object($object) && $object->element == 'shipping') {
+ '@phan-var-force Expedition $object';
$substitutionarray['__SHIPPINGTRACKNUM__'] = $object->tracking_number;
$substitutionarray['__SHIPPINGTRACKNUMURL__'] = $object->tracking_url;
$substitutionarray['__SHIPPINGMETHOD__'] = $object->shipping_method;
}
if (is_object($object) && $object->element == 'reception') {
+ '@phan-var-force Reception $object';
$substitutionarray['__RECEPTIONTRACKNUM__'] = $object->tracking_number;
$substitutionarray['__RECEPTIONTRACKNUMURL__'] = $object->tracking_url;
}
if (is_object($object) && $object->element == 'contrat' && $object->id > 0 && is_array($object->lines)) {
+ '@phan-var-force Contrat $object';
$dateplannedstart = '';
$datenextexpiration = '';
foreach ($object->lines as $line) {
@@ -8764,6 +8779,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
// add substitution variables for ticket
if (is_object($object) && $object->element == 'ticket') {
+ '@phan-var-force Ticket $object';
$substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
$substitutionarray['__TICKET_SUBJECT__'] = $object->subject;
$substitutionarray['__TICKET_TYPE__'] = $object->type_code;
@@ -8887,38 +8903,47 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
if (is_object($object) && $object->element == 'propal') {
+ '@phan-var-force Propal $object';
$substitutionarray['__URL_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/comm/propal/card.php?id=".$object->id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'proposal', $object->ref, 1, $object);
}
if (is_object($object) && $object->element == 'commande') {
+ '@phan-var-force Commande $object';
$substitutionarray['__URL_ORDER__'] = DOL_MAIN_URL_ROOT."/commande/card.php?id=".$object->id;
}
if (is_object($object) && $object->element == 'facture') {
+ '@phan-var-force Facture $object';
$substitutionarray['__URL_INVOICE__'] = DOL_MAIN_URL_ROOT."/compta/facture/card.php?id=".$object->id;
}
if (is_object($object) && $object->element == 'contrat') {
+ '@phan-var-force Contrat $object';
$substitutionarray['__URL_CONTRACT__'] = DOL_MAIN_URL_ROOT."/contrat/card.php?id=".$object->id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_URL__'] = getOnlineSignatureUrl(0, 'contract', $object->ref, 1, $object);
}
if (is_object($object) && $object->element == 'fichinter') {
+ '@phan-var-force Fichinter $object';
$substitutionarray['__URL_FICHINTER__'] = DOL_MAIN_URL_ROOT."/fichinter/card.php?id=".$object->id;
require_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
$substitutionarray['__ONLINE_SIGN_FICHINTER_URL__'] = getOnlineSignatureUrl(0, 'fichinter', $object->ref, 1, $object);
}
if (is_object($object) && $object->element == 'supplier_proposal') {
+ '@phan-var-force SupplierProposal $object';
$substitutionarray['__URL_SUPPLIER_PROPOSAL__'] = DOL_MAIN_URL_ROOT."/supplier_proposal/card.php?id=".$object->id;
}
if (is_object($object) && $object->element == 'invoice_supplier') {
+ '@phan-var-force FactureFournisseur $object';
$substitutionarray['__URL_SUPPLIER_INVOICE__'] = DOL_MAIN_URL_ROOT."/fourn/facture/card.php?id=".$object->id;
}
if (is_object($object) && $object->element == 'shipping') {
+ '@phan-var-force Expedition $object';
$substitutionarray['__URL_SHIPMENT__'] = DOL_MAIN_URL_ROOT."/expedition/card.php?id=".$object->id;
}
}
if (is_object($object) && $object->element == 'action') {
+ '@phan-var-force ActionComm $object';
$substitutionarray['__EVENT_LABEL__'] = $object->label;
$substitutionarray['__EVENT_TYPE__'] = $outputlangs->trans("Action".$object->type_code);
$substitutionarray['__EVENT_DATE__'] = dol_print_date($object->datep, 'day', 'auto', $outputlangs);
@@ -8927,6 +8952,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
}
}
if ((empty($exclude) || !in_array('objectamount', $exclude)) && (empty($include) || in_array('objectamount', $include))) {
+ '@phan-var-force Facture|FactureRec $object';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php';
$substitutionarray['__DATE_YMD__'] = is_object($object) ? (isset($object->date) ? dol_print_date($object->date, 'day', 0, $outputlangs) : null) : '';
@@ -9215,10 +9241,13 @@ function make_substitutions($text, $substitutionarray, $outputlangs = null, $con
if (method_exists($class, $method)) {
if (!isset($memory_object_list[$class]['list'][$id])) {
$tmpobj = new $class($db);
+ // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$valuetouseforsubstitution = $tmpobj->$method($id, $key_to_substitute);
$memory_object_list[$class]['list'][$id] = $tmpobj;
} else {
+ // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
$tmpobj = $memory_object_list[$class]['list'][$id];
+ // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$valuetouseforsubstitution = $tmpobj->$method($id, $key_to_substitute, true);
}
@@ -9656,7 +9685,7 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o
*
* @param string $mesgstring Error message
* @param string[] $mesgarray Error messages array
- * @param int $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
+ * @param int<0,1> $keepembedded Set to 1 in error message must be kept embedded into its html place (this disable jnotify)
* @return void
*
* @see dol_print_error()
@@ -9674,11 +9703,11 @@ function dol_htmloutput_errors($mesgstring = '', $mesgarray = array(), $keepembe
* @param array $array Array to sort (array of array('key1'=>val1,'key2'=>val2,'key3'...) or array of objects)
* @param string $index Key in array to use for sorting criteria
* @param string $order Sort order ('asc' or 'desc')
- * @param int $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort)
+ * @param int<0,1> $natsort If values are strings (I said value not type): 0=Use alphabetical order, 1=use "natural" sort (natsort)
* If values are numeric (I said value not type): 0=Use numeric order (even if type is string) so use a "natural" sort, 1=use "natural" sort too (same than 0), -1=Force alphabetical order
- * @param int $case_sensitive 1=sort is case sensitive, 0=not case sensitive
- * @param int $keepindex If 0 and index key of array to sort is a numeric, then index will be rewritten. If 1 or index key is not numeric, key for index is kept after sorting.
- * @return array Return the sorted array (the source array is not modified !)
+ * @param int<0,1> $case_sensitive 1=sort is case sensitive, 0=not case sensitive
+ * @param int<0,1> $keepindex If 0 and index key of array to sort is a numeric, then index will be rewritten. If 1 or index key is not numeric, key for index is kept after sorting.
+ * @return array Return the sorted array (the source array is not modified !)
*/
function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sensitive = 0, $keepindex = 0)
{
@@ -9693,6 +9722,7 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
if (is_object($array[$key])) {
$temp[$key] = empty($array[$key]->$index) ? 0 : $array[$key]->$index;
} else {
+ // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
$temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index];
}
if ($natsort == -1) {
@@ -9897,7 +9927,7 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
*
* @param string $var Variable
* @param string $regextext Text that must be a valid regex string
- * @param int $matchrule 1=Test if start with, 0=Test if equal
+ * @param int<0,1> $matchrule 1=Test if start with, 0=Test if equal
* @return boolean|string True or False, text if bad usage.
*/
function isStringVarMatching($var, $regextext, $matchrule = 1)
@@ -9945,12 +9975,12 @@ function verifCond($strToEvaluate, $onlysimplestring = '1')
* Replace eval function to add more security.
* This function is called by verifCond() or trans() and transnoentitiesnoconv().
*
- * @param string $s String to evaluate
- * @param int $returnvalue 0=No return (deprecated, used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
- * @param int $hideerrors 1=Hide errors
- * @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
- * '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
- * '2' (used for example for the compute property of extrafields)=Accept also '[]'
+ * @param string $s String to evaluate
+ * @param int<0,1> $returnvalue 0=No return (deprecated, used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
+ * @param int<0,1> $hideerrors 1=Hide errors
+ * @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
+ * '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
+ * '2' (used for example for the compute property of extrafields)=Accept also '[]'
* @return void|string Nothing or return result of eval (even if type can be int, it is safer to assume string and find all potential typing issues as abs(dol_eval(...)).
* @see verifCond()
* @phan-suppress PhanPluginUnsafeEval
@@ -10147,9 +10177,9 @@ function dol_validElement($element)
/**
* Return img flag of country for a language code or country code.
*
- * @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR')
- * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"')
- * @param int $notitlealt No title alt
+ * @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR')
+ * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"')
+ * @param int<0,1> $notitlealt No title alt
* @return string HTML img string with flag.
*/
function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0)
@@ -10201,7 +10231,7 @@ function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0)
* Return null if not found.
*
* @param string $countrycode Country code like 'US', 'FR', 'CA', 'ES', 'IN', 'MX', ...
- * @return string|null Value of locale like 'en_US', 'fr_FR', ... or null if not found
+ * @return ?string Value of locale like 'en_US', 'fr_FR', ... or null if not found
*/
function getLanguageCodeFromCountryCode($countrycode)
{
@@ -10421,7 +10451,7 @@ function getLanguageCodeFromCountryCode($countrycode)
}
}
} else {
- dol_syslog("Warning Exention php-intl is not available", LOG_WARNING);
+ dol_syslog("Warning Extension php-intl is not available", LOG_WARNING);
}
return null;
@@ -10522,6 +10552,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type,
$obj = new $classtoload($db);
$function = $labeltemp[3];
if ($obj && $function && method_exists($obj, $function)) {
+ // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
$nbrec = $obj->$function($object->id, $obj);
if (!empty($nbrec)) {
$label .= ''.$nbrec.' ';
@@ -10798,10 +10829,13 @@ function printCommonFooter($zone = 'private')
// Add DebugBar data
if ($user->hasRight('debugbar', 'read') && $debugbar instanceof DebugBar\DebugBar) {
- $debugbar['time']->stopMeasure('pageaftermaster');
+ if (isset($debugbar['time'])) {
+ // @phan-suppress-next-line PhanPluginUnknownObjectMethodCall
+ $debugbar['time']->stopMeasure('pageaftermaster');
+ }
print ''."\n";
- $renderer = $debugbar->getRenderer();
- print $debugbar->getRenderer()->render();
+ $renderer = $debugbar->getJavascriptRenderer();
+ print $renderer->render();
} elseif (count($conf->logbuffer)) { // If there is some logs in buffer to show
print "\n";
print "';
if (!$user->socid && $user->hasRight('ticket', 'write') && isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php
index cc7e302db74..a9c988b4386 100644
--- a/htdocs/ticket/class/actions_ticket.class.php
+++ b/htdocs/ticket/class/actions_ticket.class.php
@@ -186,7 +186,7 @@ class ActionsTicket extends CommonHookActions
*/
public function viewTicketOriginalMessage($user, $action, $object)
{
- global $conf, $langs;
+ global $langs;
print ''."\n";
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
@@ -199,7 +199,7 @@ class ActionsTicket extends CommonHookActions
// Initial message
print ''; // You can use div-table-responsive-no-min if you don't need reserved height for your table
- print '
';
+ print '';
print '';
print $langs->trans("InitialMessage");
print ' ';
@@ -234,8 +234,8 @@ class ActionsTicket extends CommonHookActions
}
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print '
';
}
print ' ';
diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php
index 500501eb61c..1ab07905b0b 100644
--- a/htdocs/website/samples/wrapper.php
+++ b/htdocs/website/samples/wrapper.php
@@ -155,7 +155,8 @@ if ($rss) {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang($l);
$outputlangs->loadLangs(array("main", "other"));
- $title = $desc = $outputlangs->transnoentities('LatestBlogPosts');
+ $title = $outputlangs->transnoentities('LatestBlogPosts').' - '.$website->virtualhost;
+ $desc = $title.($l ? ' ('.$l.')' : '');
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
diff --git a/pyproject.toml b/pyproject.toml
index 39d126bd778..56802ccf580 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -49,3 +49,22 @@ line_length = 80
# YAMLFIX_quote_keys_and_basic_values = false
# uote_representation = false
# preserve_quotes = false
+
+[tool.sqlfluff.core]
+# Documentation: https://docs.sqlfluff.com/en/stable/configuration.html#default-configuration
+# (Note: the examples given are for a .ini file and need slight adaptions for pyproject.toml
+
+ignore_comment_lines = true
+sql_file_exts = ".sql"
+encoding = "utf-8"
+processes = -1
+#verbose = 1
+#exclude_rules = "LT01,CP01,RF04"
+# RF04 | Keywords should not be used as identifiers. (rowid, login, position, ...)
+exclude_rules = "LT01,LT02,LT05,LT12,LT13,CP01,CP02,CP04,CP05,RF04"
+dialect = "mysql"
+# Default byte limit is 20000, must set limit - some files are too big.
+large_file_skip_byte_limit = 100000
+
+[tool.sqlfluff.indentation]
+indent_unit = "tab"