Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2024-04-16 22:49:36 +02:00
commit cf7452c745
69 changed files with 762 additions and 451 deletions

View file

@ -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

View file

@ -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
)$

View file

@ -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

View file

@ -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'],

View file

@ -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

View file

@ -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 '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTANCY_ER_DATE_RECORD").'</td>';
if (getDolGlobalInt('ACCOUNTANCY_ER_DATE_RECORD')) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_ER_DATE_RECORD&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_ER_DATE_RECORD&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';

View file

@ -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;

View file

@ -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 '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
print '<label for="radio_pw" >'.$langs->trans("UseAUTHLOGIN").'</label>';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="radio" id="radio_plain" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="PLAIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'PLAIN') == 'PLAIN' ? ' checked' : '').'> ';
print '<label for="radio_plain" >'.$langs->trans("UseAUTHPLAIN").'</label>';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE') == 'XOAUTH2' ? ' checked' : '').'> ';
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
@ -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 '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
}

View file

@ -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 '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<label for="radio_pw" >'.$langs->trans("UseAUTHLOGIN").'</label>';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="radio" id="radio_plain" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="PLAIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'PLAIN') == 'PLAIN' ? ' checked' : '').'> ';
print '<label for="radio_plain" >'.$langs->trans("UseAUTHPLAIN").'</label>';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'XOAUTH2' ? ' checked' : '').'> ';
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
} 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 '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
}

View file

@ -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 '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<label for="radio_pw" >'.$langs->trans("UseAUTHLOGIN").'</label>';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="radio" id="radio_plain" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="PLAIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'PLAIN') == 'PLAIN' ? ' checked' : '').'> ';
print '<label for="radio_plain" >'.$langs->trans("UseAUTHPLAIN").'</label>';
print '&nbsp; &nbsp; &nbsp;';
print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') == 'XOAUTH2' ? ' checked' : '').'> ';
print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
} else {
@ -480,6 +487,19 @@ if ($action == 'edit') {
}
print '</td></tr>';
// SMTP_ALLOW_SELF_SIGNED_TICKET
print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
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 '</td></tr>';
print '</table>';
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 '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
}
@ -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 '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', $conf->global->MAIN_MAIL_SMTPS_PW_TICKET).'</td></tr>';
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).'</td></tr>';
}
// SMTPS oauth service
@ -584,6 +611,23 @@ if ($action == 'edit') {
}
print '</td></tr>';
}
// SMTP_ALLOW_SELF_SIGNED_EMAILING
if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
// Nothing
} else {
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
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 '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
}
print '</td></tr>';
}
}
print '</table>';

View file

@ -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 '<td class="right">';
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 '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=del'.$key.'&token='.newToken().'">';

View file

@ -482,7 +482,7 @@ if ($object->id > 0) {
print $langs->trans("CustomerAbsoluteDiscountShort");
print '<td><td class="right">';
if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create_remise&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
}
print '</td></tr></table>';
print '</td>';

View file

@ -378,7 +378,7 @@ if ($socid > 0) {
// VAT
print '<tr><td>'.$langs->trans("VAT").'</td>';
print '<td>';
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 '</td></tr>';
print '<tr><td class="fieldrequired" >'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" class="quatrevingtpercent" name="desc" value="'.GETPOST('desc', 'alphanohtml').'"></td></tr>';

View file

@ -4,6 +4,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2024 Charlene Benke <charlene@patas-monkey.com>
*
* 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 '<tr class="liste_titre">';
print '<td>';
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 '<input type="checkbox" name="subcat" value="yes"';
print '<input type="checkbox" class="marginleft" id="subcat" name="subcat" value="yes"';
if ($subcat) {
print ' checked';
}
print '>';
print '<label for="subcat" class="marginrightonly">'.$langs->trans("SubCats").'?</label>';
// 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 '</br>';
print img_picto('', 'company', 'class="paddingrightonly"');
print $form->select_thirdparty_list($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
print '<br>';
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_catsoc, 'search_categ_soc', 0, $langs->trans("CustomersProspectsCategoriesShort"));
print '<br>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company($selected_soc, 'search_soc', '', $langs->trans("ThirdParty"));
print '</td>';
print '<td colspan="5" class="right">';
@ -554,6 +601,8 @@ if ($modecompta == 'CREANCES-DETTES') {
print '</tr>';
$db->free($result);
} else {
print '<tr><td colspan="6"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";
print '</div>';

View file

@ -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)));
}

View file

@ -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';

View file

@ -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 '>&nbsp;</option>';
print '>';
if (is_numeric($showempty)) {
print '&nbsp;';
} else {
print $showempty;
}
print '</option>';
}
print '<option value="0"';
@ -1396,6 +1402,7 @@ class Form
* @param string[] $excludeids Exclude IDs from the select combo
* @param int<0,1> $showcode Show code in list
* @return array<int,array{key:int,value:string,label:string,labelhtml:string}>|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 .= '<select id="' . $htmlname . '" class="flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($moreparam ? ' ' . $moreparam : '') . ' name="' . $htmlname . ($multiple ? '[]' : '') . '" ' . ($multiple ? 'multiple' : '') . '>' . "\n";
@ -1614,6 +1616,10 @@ class Form
}
}
$out .= '</select>' . "\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<int,string|array{id:int,label:string,labelhtml:string,color:string,picto:string}> 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 ? ' - ' : ' <span class="opacitymedium">(') . $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 ? ' - ' : ' <span class="opacitymedium">(') . $langs->trans("AllEntities");
} else {
if ($obj->entity != $conf->entity) {
$moreinfo .= ($moreinfo ? ' - ' : ' (') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(') . ($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
$moreinfohtml .= ($moreinfohtml ? ' - ' : ' <span class="opacitymedium">(').($obj->label ? $obj->label : $langs->trans("EntityNameNotDefined"));
}
}
}

View file

@ -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 .= '<div class="refidno opacitymedium">'.dol_escape_htmltag($object->name_alias).'</div>';
}
@ -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<string,array{rowid:int,label:string,url:string,icon:string,active:int}> 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<string,array{rowid:int,label:string,url:string,icon:string,active:int}> $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<string,string> 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<string|int,mixed> $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<string|int,mixed> 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 .= '<span class="badge marginleftonlyshort">'.$nbrec.'</span>';
@ -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 '<!-- Output debugbar data -->'."\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 "<!-- Start of log output\n";
@ -10817,12 +10851,12 @@ function printCommonFooter($zone = 'private')
/**
* Split a string with 2 keys into key array.
* For example: "A=1;B=2;C=2" is exploded into array('A'=>1,'B'=>2,'C'=>3)
* For example: "A=1;B=2;C=2" is exploded into array('A'=>'1','B'=>'2','C'=>'3')
*
* @param string|null $string String to explode
* @param ?string $string String to explode
* @param string $delimiter Delimiter between each couple of data. Example: ';' or '[\n;]+' or '(\n\r|\r|\n|;)'
* @param string $kv Delimiter between key and value
* @return array Array of data exploded
* @return array<string,string> Array of data exploded
*/
function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
{
@ -11079,7 +11113,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
/**
* Return string with full Url. The file qualified is the one defined by relative path in $object->last_main_doc
*
* @param Object $object Object
* @param CommonObject $object Object
* @return string Url string
*/
function showDirectDownloadLink($object)
@ -11155,9 +11189,9 @@ function getImageFileNameForSize($file, $extName, $extImgTarget = '')
*
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $relativepath Relative path of docs.
* @param int $alldata Return array with all components (1 is recommended, then use a simple a href link with the class, target and mime attribute added. 'documentpreview' css class is handled by jquery code into main.inc.php)
* @param int<0,1> $alldata Return array with all components (1 is recommended, then use a simple a href link with the class, target and mime attribute added. 'documentpreview' css class is handled by jquery code into main.inc.php)
* @param string $param More param on http links
* @return string|array Output string with href link or array with all components of link
* @return string|array{}|array{target:string,css:string,url:string,mime:string} Output string with href link or array with all components of link
*/
function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param = '')
{
@ -11223,7 +11257,7 @@ function ajax_autoselect($htmlname, $addlink = '', $textonlink = 'Link')
* Return if a file is qualified for preview
*
* @param string $file Filename we looking for information
* @return int 1 If allowed, 0 otherwise
* @return int<0,1> 1 If allowed, 0 otherwise
* @see dol_mimetype(), image_format_supported() from images.lib.php
*/
function dolIsAllowedForPreview($file)
@ -11255,7 +11289,7 @@ function dolIsAllowedForPreview($file)
*
* @param string $file Filename we looking for MIME type
* @param string $default Default mime type if extension not found in known list
* @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa
* @param int<0,4> $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa
* @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive)
* @see dolIsAllowedForPreview(), image_format_supported() from images.lib.php
*/
@ -11618,7 +11652,7 @@ function getDictionaryValue($tablename, $field, $id, $checkentity = false, $rowi
* Return true if the color is light
*
* @param string $stringcolor String with hex (FFFFFF) or comma RGB ('255,255,255')
* @return int -1 : Error with argument passed |0 : color is dark | 1 : color is light
* @return int<-1,1> -1 : Error with argument passed |0 : color is dark | 1 : color is light
*/
function colorIsLight($stringcolor)
{
@ -11650,10 +11684,10 @@ function colorIsLight($stringcolor)
/**
* Function to test if an entry is enabled or not
*
* @param string $type_user 0=We test for internal user, 1=We test for external user
* @param array $menuentry Array for feature entry to test
* @param array $listofmodulesforexternal Array with list of modules allowed to external users
* @return int 0=Hide, 1=Show, 2=Show gray
* @param int<0,1> $type_user 0=We test for internal user, 1=We test for external user
* @param array{enabled:int<0,1>,module:string,perms:string} $menuentry Array for feature entry to test
* @param string[] $listofmodulesforexternal Array with list of modules allowed to external users
* @return int<0,2> 0=Hide, 1=Show, 2=Show gray
*/
function isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal)
{
@ -11692,9 +11726,9 @@ function isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal
/**
* Round to next multiple.
*
* @param double $n Number to round up
* @param integer $x Multiple. For example 60 to round up to nearest exact minute for a date with seconds.
* @return integer Value rounded.
* @param float $n Number to round up
* @param int $x Multiple. For example 60 to round up to nearest exact minute for a date with seconds.
* @return int Value rounded.
*/
function roundUpToNextMultiple($n, $x = 5)
{
@ -11708,9 +11742,9 @@ function roundUpToNextMultiple($n, $x = 5)
* @param string $label label of badge no html : use in alt attribute for accessibility
* @param string $html optional : label of badge with html
* @param string $type type of badge : Primary Secondary Success Danger Warning Info Light Dark status0 status1 status2 status3 status4 status5 status6 status7 status8 status9
* @param string $mode default '' , 'pill', 'dot'
* @param ''|'pill'|'dot' $mode Default '' , 'pill', 'dot'
* @param string $url the url for link
* @param array $params various params for future : recommended rather than adding more function arguments. array('attr'=>array('title'=>'abc'))
* @param array<string,mixed> $params Various params for future : recommended rather than adding more function arguments. array('attr'=>array('title'=>'abc'))
* @return string Html badge
*/
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
@ -11768,14 +11802,14 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
/**
* Output the badge of a status.
*
* @param string $statusLabel Label of badge no html : use in alt attribute for accessibility
* @param string $statusLabelShort Short label of badge no html
* @param string $html Optional : label of badge with html
* @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name
* @param int $displayMode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @param string $url The url for link
* @param array $params Various params. Example: array('tooltip'=>'no|...', 'badgeParams'=>...)
* @return string Html status string
* @param string $statusLabel Label of badge no html : use in alt attribute for accessibility
* @param string $statusLabelShort Short label of badge no html
* @param string $html Optional : label of badge with html
* @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name
* @param int<0,6> $displayMode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
* @param string $url The url for link
* @param array<string,mixed> $params Various params. Example: array('tooltip'=>'no|...', 'badgeParams'=>...)
* @return string Html status string
*/
function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array())
{
@ -11878,7 +11912,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
* @param string $id Attribute id of action button. Example 'action-delete'. This can be used for full ajax confirm if this code is reused into the ->formconfirm() method.
* @param int|boolean $userRight User action right
* // phpcs:disable
* @param array $params = [ // Various params for future : recommended rather than adding more function arguments
* @param array<string,mixed> $params = [ // Various params for future : recommended rather than adding more function arguments
* 'attr' => [ // to add or override button attributes
* 'xxxxx' => '', // your xxxxx attribute you want
* 'class' => 'reposition', // to add more css class to the button class attribute
@ -12099,8 +12133,8 @@ function getFieldErrorIcon($fieldValidationErrorMsg)
* @param string $iconClass class for icon element (Example: 'fa fa-file')
* @param string $url the url for link
* @param string $id attribute id of button
* @param int $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use param $helpText as tooltip help
* @param array $params various params for future : recommended rather than adding more function arguments
* @param int<-2,2> $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use param $helpText as tooltip help
* @param array<string,mixed> $params various params for future : recommended rather than adding more function arguments
* @return string html button
*/
function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $url = '', $id = '', $status = 1, $params = array())
@ -12538,9 +12572,9 @@ function getElementProperties($elementType)
* @param int $element_id Element id (Use this or element_id but not both)
* @param string $element_type Element type ('module' or 'myobject@mymodule' or 'mymodule_myobject')
* @param string $element_ref Element ref (Use this or element_id but not both)
* @param int $useCache if you want to store object in cache or get it from cache 0 => no use cache , 1 use cache, 2 force reload cache
* @param int<0,2> $useCache if you want to store object in cache or get it from cache 0 => no use cache , 1 use cache, 2 force reload cache
* @param int $maxCacheByType number of object in cache for this element type
* @return int|object object || 0 || <0 if error
* @return int<-1,0>|object object || 0 || <0 if error
* @see getElementProperties()
*/
function fetchObjectByElement($element_id, $element_type, $element_ref = '', $useCache = 0, $maxCacheByType = 10)
@ -12815,8 +12849,8 @@ function addSummaryTableLine($tableColumnCount, $num, $nbofloop = 0, $total = 0,
* Return a file on output using a low memory. It can return very large files with no need of memory.
* WARNING: This close output buffers.
*
* @param string $fullpath_original_file_osencoded Full path of file to return.
* @param int $method -1 automatic, 0=readfile, 1=fread, 2=stream_copy_to_stream
* @param string $fullpath_original_file_osencoded Full path of file to return.
* @param int<-1,2> $method -1 automatic, 0=readfile, 1=fread, 2=stream_copy_to_stream
* @return void
*/
function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
@ -12860,10 +12894,10 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
* Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
* Code that handle the click is inside core/js/lib_foot.js.php.
*
* @param string $valuetocopy The value to print
* @param int $showonlyonhover Show the copy-paste button only on hover
* @param string $texttoshow Replace the value to show with this text. Use 'none' to show no text (only the copy-paste picto)
* @return string The string to print for the button
* @param string $valuetocopy The value to print
* @param int<0,1> $showonlyonhover Show the copy-paste button only on hover
* @param string $texttoshow Replace the value to show with this text. Use 'none' to show no text (only the copy-paste picto)
* @return string The string to print for the button
*/
function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '')
{
@ -12913,9 +12947,9 @@ function jsonOrUnserialize($stringtodecode)
* ccc must not contains ( or )
* Example: '((client:=:1) OR ((client:>=:2) AND (client:<=:3))) AND (client:!=:8) AND (nom:like:'a%')'
* @param string $errorstr Error message string
* @param int $noand 1=Do not add the AND before the condition string.
* @param int $nopar 1=Do not add the parenthesis around the final condition string.
* @param int $noerror 1=If search criteria is not valid, does not return an error string but invalidate the SQL
* @param int<0,1> $noand 1=Do not add the AND before the condition string.
* @param int<0,1> $nopar 1=Do not add the parenthesis around the final condition string.
* @param int<0,1> $noerror 1=If search criteria is not valid, does not return an error string but invalidate the SQL
* @return string Return forged SQL string
* @see dolSqlDateFilter()
* @see natural_search()
@ -14079,15 +14113,15 @@ function buildParamDate($prefix, $timestamp = null, $hourTime = '', $gm = 'auto'
* The function also supports executing additional hooks for customized handling of error pages.
*
* @param string $message Custom error message to display. If empty, a default "Record Not Found" message is shown.
* @param int $printheader Determines if the page header should be printed (1 = yes, 0 = no).
* @param int $printfooter Determines if the page footer should be printed (1 = yes, 0 = no).
* @param int $showonlymessage If set to 1, only the error message is displayed without any additional information or hooks.
* @param int<0,1> $printheader Determines if the page header should be printed (1 = yes, 0 = no).
* @param int<0,1> $printfooter Determines if the page footer should be printed (1 = yes, 0 = no).
* @param int<0,1> $showonlymessage If set to 1, only the error message is displayed without any additional information or hooks.
* @param mixed $params Optional parameters to pass to hooks for further processing or customization.
* @global object $conf Dolibarr configuration object (global)
* @global object $db Database connection object (global)
* @global object $user Current user object (global)
* @global Conf $conf Dolibarr configuration object (global)
* @global DoliDB $db Database connection object (global)
* @global User $user Current user object (global)
* @global Translate $langs Language translation object, initialized within the function if not already.
* @global object $hookmanager Hook manager object, initialized within the function if not already for executing hooks.
* @global HookManager $hookmanager Hook manager object, initialized within the function if not already for executing hooks.
* @global string $action Current action, can be modified by hooks.
* @global object $object Current object, can be modified by hooks.
* @return void This function terminates script execution after outputting the error page.

View file

@ -89,13 +89,14 @@ class modWorkflow extends DolibarrModules
2 => array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING', 0, 'current', 0),
3 => array('WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED', 0, 'current', 0),
4 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0),
5 => array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0),
6 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0),
7 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0),
8 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
5 => array('WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER', 0, 'current', 0),
6 => array('WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL', 0, 'current', 0),
7 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION', 0, 'current', 0),
8 => array('WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 'chaine', '1', 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED', 0, 'current', 0),
9 => array('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 'chaine', '1', 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER', 0, 'current', 0),
10 => array('WORKFLOW_TICKET_LINK_CONTRACT', 'chaine', '0', 'Automatically link a ticket to available contracts', 0, 'current', 0),
11 => array('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS', 'chaine', '0', 'Search among parent companies contracts when automatically linking a ticket to available contracts', 0, 'current', 0),
12 => array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0)
12 => array('WORKFLOW_TICKET_CREATE_INTERVENTION', 'chaine', '0', 'WORKFLOW_TICKET_CREATE_INTERVENTION', 0, 'current', 0),
);
// Boxes

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
/*
* This program is free software; you can redistribute it and/or modify
@ -22,12 +23,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandlerInterface.php';
/**
* Parent class for log handlers
*/
class LogHandler
abstract class LogHandler implements LogHandlerInterface
{
/**
* @var string Code for the handler
*/
public $code;
protected $ident = 0;
/**
* @var string[] Array of errors messages
* @var string[] Array of error messages
*/
public $errors = [];

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
/*
* This program is free software; you can redistribute it and/or modify
@ -79,10 +80,11 @@ interface LogHandlerInterface
public function isActive();
/**
* Output log content
* Export the message
*
* @param array $content Content to log
* @return void
* @param array $content Array containing the info about the message
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @return void
*/
public function export($content);
public function export($content, $suffixinfilename = '');
}

View file

@ -8,7 +8,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to a file
*/
class mod_syslog_file extends LogHandler implements LogHandlerInterface
class mod_syslog_file extends LogHandler
{
public $code = 'file';
public $lastTime = 0;

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
@ -7,7 +8,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
/**
* Class to manage logging to syslog
*/
class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
class mod_syslog_syslog extends LogHandler
{
public $code = 'syslog';
@ -104,10 +105,11 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface
/**
* Export the message
*
* @param array $content Array containing the info about the message
* @return void
* @param array $content Array containing the info about the message
* @param string $suffixinfilename When output is a file, append this suffix into default log filename.
* @return void
*/
public function export($content)
public function export($content, $suffixinfilename = '')
{
global $conf;

View file

@ -231,6 +231,36 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
}
// First classify billed the order to allow the proposal classify process
if (isModEnabled('order') && isModEnabled('workflow') && getDolGlobalString('WORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER')) {
$object->fetchObjectLinked('', 'commande', $object->id, $object->element);
if (count($object->linkedObjects['commande']) == 1) { // If the invoice has only 1 source order
$orderLinked = reset($object->linkedObjects['commande']);
$orderLinked->fetchObjectLinked($orderLinked->id, '', $orderLinked->element);
if (count($orderLinked->linkedObjects['facture']) >= 1) {
$totalHTInvoices = 0;
$areAllInvoicesValidated = true;
foreach ($orderLinked->linkedObjects['facture'] as $key => $invoice) {
if ($invoice->statut == Facture::STATUS_VALIDATED || $object->id == $invoice->id) {
$totalHTInvoices += (float) $invoice->total_ht;
} else {
$areAllInvoicesValidated = false;
break;
}
}
if ($areAllInvoicesValidated) {
$isSameTotal = (price2num($totalHTInvoices, 'MT') == price2num($orderLinked->total_ht, 'MT'));
dol_syslog("Amount of linked invoices = ".$totalHTInvoices.", of order = ".$orderLinked->total_ht.", isSameTotal = ".(string) $isSameTotal, LOG_DEBUG);
if ($isSameTotal) {
$ret = $orderLinked->classifyBilled($user);
if ($ret < 0) {
return $ret;
}
}
}
}
}
}
return $ret;
}
@ -515,8 +545,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($action == 'TICKET_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Auto link contract
if (!empty($conf->contract->enabled) && isModEnabled('ticket') && isModEnabled('intervention') && !empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT') && getDolGlobalString('TICKET_PRODUCT_CATEGORY') && !empty($object->fk_soc)) {
// Auto link ticket to contract
if (isModEnabled('contract') && isModEnabled('ticket') && isModEnabled('workflow') && getDolGlobalString('WORKFLOW_TICKET_LINK_CONTRACT') && getDolGlobalString('TICKET_PRODUCT_CATEGORY') && !empty($object->fk_soc)) {
$societe = new Societe($this->db);
$company_ids = (!getDolGlobalString('WORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS')) ? [$object->fk_soc] : $societe->getParentsForCompany($object->fk_soc, [$object->fk_soc]);
@ -524,7 +554,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
$number_contracts_found = 0;
foreach ($company_ids as $company_id) {
$contrat->socid = $company_id;
$list = $contrat->getListOfContracts($option = 'all', $status = [Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED], $product_categories = [$conf->global->TICKET_PRODUCT_CATEGORY], $line_status = [ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN]);
$list = $contrat->getListOfContracts('all', array(Contrat::STATUS_DRAFT, Contrat::STATUS_VALIDATED), array(getDolGlobalString('TICKET_PRODUCT_CATEGORY')), array(ContratLigne::STATUS_INITIAL, ContratLigne::STATUS_OPEN));
if (!is_array($list) || empty($list)) {
continue;
}
@ -539,13 +569,13 @@ class InterfaceWorkflowManager extends DolibarrTriggers
}
if ($number_contracts_found > 1 && !defined('NOLOGIN')) {
setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings');
setEventMessages($langs->trans('TicketManyContractsLinked'), null, 'warnings');
}
break;
}
if ($number_contracts_found == 0) {
if (empty(NOLOGIN)) {
setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs');
setEventMessages($langs->trans('TicketNoContractFoundToLink'), null, 'mesgs');
}
}
}

View file

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* 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
@ -69,11 +70,16 @@ class DolibarrDebugBar extends DebugBar
/**
* Returns a JavascriptRenderer for this instance
*
* @param string $baseUrl Base url
* @param string $basePath Base path
* @return \DebugBar\JavascriptRenderer String content
*/
public function getRenderer()
public function getJavascriptRenderer($baseUrl = null, $basePath = null)
{
$renderer = parent::getJavascriptRenderer(DOL_URL_ROOT.'/includes/maximebf/debugbar/src/DebugBar/Resources');
if ($baseUrl === null) {
$baseUrl = DOL_URL_ROOT.'/includes/maximebf/debugbar/src/DebugBar/Resources';
}
$renderer = parent::getJavascriptRenderer($baseUrl, $basePath);
$renderer->disableVendor('jquery'); // We already have jquery loaded globally by the main.inc.php
$renderer->disableVendor('fontawesome'); // We already have fontawesome loaded globally by the main.inc.php
$renderer->disableVendor('highlightjs'); // We don't need this
@ -81,4 +87,15 @@ class DolibarrDebugBar extends DebugBar
return $renderer;
}
/**
* Returns a JavascriptRenderer for this instance
*
* @return \DebugBar\JavascriptRenderer String content
* @deprecated Use getJavascriptRenderer
*/
public function getRenderer()
{
return $this->getJavascriptRenderer();
}
}

View file

@ -1238,10 +1238,10 @@ if ($step == 4 && $datatoimport) {
} elseif ($modetoautofillmapping == 'session' && !empty($_SESSION['dol_array_match_file_to_database_select'])) {
$tmpselectioninsession = dolExplodeIntoArray($_SESSION['dol_array_match_file_to_database_select'], ',', '=');
//var_dump($code);
if (!empty($tmpselectioninsession[($i + 1)]) && $tmpselectioninsession[($i + 1)] == $tmpcode) {
if (!empty($tmpselectioninsession[(string) ($i + 1)]) && $tmpselectioninsession[(string) ($i + 1)] == $tmpcode) {
$selectforline .= ' selected';
}
$selectforline .= ' data-debug="'.$tmpcode.'-'.$code.'-'.$j.'-'.(!empty($tmpselectioninsession[($i + 1)]) ? $tmpselectioninsession[($i + 1)] : "").'"';
$selectforline .= ' data-debug="'.$tmpcode.'-'.$code.'-'.$j.'-'.(!empty($tmpselectioninsession[(string) ($i + 1)]) ? $tmpselectioninsession[(string) ($i + 1)] : "").'"';
}
$selectforline .= ' data-html="'.dol_escape_htmltag($labelhtml).'"';
$selectforline .= '>';

View file

@ -25,4 +25,3 @@ ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product);
ALTER TABLE llx_bom_bom ADD UNIQUE INDEX uk_bom_bom_ref(ref, entity);
--ALTER TABLE llx_bom_bom ADD CONSTRAINT llx_bom_bom_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bom_myotherobject(rowid);

View file

@ -19,24 +19,24 @@ CREATE TABLE llx_bom_bom(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1 NOT NULL,
ref varchar(128) NOT NULL,
bomtype integer DEFAULT 0, -- 0 for a BOM to manufacture, 1 for a BOM to dismantle
label varchar(255),
fk_product integer,
description text,
note_public text,
note_private text,
bomtype integer DEFAULT 0, -- 0 for a BOM to manufacture, 1 for a BOM to dismantle
label varchar(255),
fk_product integer,
description text,
note_public text,
note_private text,
fk_warehouse integer,
qty double(24,8),
efficiency double(24,8) DEFAULT 1,
duration double(24,8) DEFAULT NULL,
date_creation datetime NOT NULL,
date_valid datetime,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_user_valid integer,
fk_user_modif integer,
fk_user_valid integer,
import_key varchar(14),
model_pdf varchar(255),
status integer NOT NULL
model_pdf varchar(255),
status integer NOT NULL
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View file

@ -20,4 +20,3 @@ create table llx_bom_bom_extrafields
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View file

@ -23,4 +23,3 @@ ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom);
--ALTER TABLE llx_bom_bomline ADD UNIQUE INDEX uk_bom_bomline_fieldxy(fieldx, fieldy);
ALTER TABLE llx_bom_bomline ADD CONSTRAINT llx_bom_bomline_fk_bom FOREIGN KEY (fk_bom) REFERENCES llx_bom_bom(rowid);

View file

@ -15,16 +15,16 @@
CREATE TABLE llx_bom_bomline(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_bom integer NOT NULL,
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_bom integer NOT NULL,
fk_product integer NOT NULL,
fk_bom_child integer NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
description text,
import_key varchar(14),
qty double(24,8) NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
description text,
import_key varchar(14),
qty double(24,8) NOT NULL,
qty_frozen smallint DEFAULT 0,
disable_stock_change smallint DEFAULT 0,
disable_stock_change smallint DEFAULT 0,
efficiency double(24,8) NOT NULL DEFAULT 1,
fk_unit integer NULL,
position integer NOT NULL DEFAULT 0,

View file

@ -20,4 +20,3 @@ create table llx_bom_bomline_extrafields
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View file

@ -23,5 +23,5 @@ CREATE TABLE llx_c_productbatch_qcstatus
entity integer NOT NULL DEFAULT 1,
code varchar(16) NOT NULL,
label varchar(128) NOT NULL,
active integer DEFAULT 1 NOT NULL
active integer DEFAULT 1 NOT NULL
)ENGINE=innodb;

View file

@ -15,8 +15,9 @@
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
--
-- Table with the custom category tree for the category of a ticket
--
-- Table with the custom group tree for the group of a ticket.
-- This is for classification. It is different of the tag/category table.
--
create table llx_c_ticket_category
(

View file

@ -1,8 +1,8 @@
-- ============================================================================
-- Copyright (C) 2005 Brice Davoleau <e1davole@iu-vannes.fr>
-- Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
-- Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
-- Copyright (C) 2017-2024 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- 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
@ -26,23 +26,15 @@ create table llx_categorie
fk_parent integer DEFAULT 0 NOT NULL,
label varchar(180) NOT NULL, -- category ref/name
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
type integer DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member)
type integer DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member, ...). See array $MAP_ID into categorie.class.php for possible values.
description text, -- description of the category
color varchar(8), -- color
position integer DEFAULT 0, -- position
fk_soc integer DEFAULT NULL, -- not used by default. Used when option CATEGORY_ASSIGNED_TO_A_CUSTOMER is set.
visible tinyint DEFAULT 1 NOT NULL, -- determine if the products are visible or not
date_creation datetime, -- date creation
date_creation datetime, -- date creation
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date
fk_user_creat integer, -- user making creation
fk_user_modif integer, -- user making last change
import_key varchar(14) -- Import key
)ENGINE=innodb;
--
-- List of codes for the field type
--
-- 0 : product
-- 1 : supplier
-- 2 : customer
--

View file

@ -30,4 +30,3 @@ ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project);
--ALTER TABLE llx_mrp_mo ADD UNIQUE INDEX uk_mrp_mo_fieldxy(fieldx, fieldy);
--ALTER TABLE llx_mrp_mo ADD CONSTRAINT llx_mrp_mo_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mrp_myotherobject(rowid);

View file

@ -16,29 +16,29 @@
CREATE TABLE llx_mrp_mo(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1 NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
mrptype integer DEFAULT 0, -- 0 for a manufacture MO, 1 for a dismantle MO
label varchar(255),
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer DEFAULT 1 NOT NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
mrptype integer DEFAULT 0, -- 0 for a manufacture MO, 1 for a dismantle MO
label varchar(255),
qty real NOT NULL,
fk_warehouse integer,
fk_soc integer,
note_public text,
note_private text,
date_creation datetime NOT NULL,
fk_soc integer,
note_public text,
note_private text,
date_creation datetime NOT NULL,
date_valid datetime NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
fk_user_valid integer,
import_key varchar(14),
model_pdf varchar(255),
status integer NOT NULL,
fk_product integer NOT NULL,
date_start_planned datetime,
date_end_planned datetime,
fk_bom integer,
status integer NOT NULL,
fk_product integer NOT NULL,
date_start_planned datetime,
date_end_planned datetime,
fk_bom integer,
fk_project integer,
last_main_doc varchar(255),
fk_parent_line integer

View file

@ -20,4 +20,3 @@ create table llx_mrp_mo_extrafields
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;

View file

@ -18,4 +18,3 @@ ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_product FOREIGN
ALTER TABLE llx_mrp_production ADD CONSTRAINT fk_mrp_production_stock_movement FOREIGN KEY (fk_stock_movement) REFERENCES llx_stock_mouvement (rowid);
ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo);

View file

@ -15,12 +15,12 @@
CREATE TABLE llx_mrp_production(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
fk_mo integer NOT NULL,
origin_id integer,
origin_type varchar(10), -- 'bom' bom production line or 'free' free production line added after Mo creation from bom
position integer NOT NULL DEFAULT 0,
fk_product integer NOT NULL,
fk_product integer NOT NULL,
fk_warehouse integer,
qty real NOT NULL DEFAULT 1,
qty_frozen smallint DEFAULT 0,
@ -29,12 +29,11 @@ CREATE TABLE llx_mrp_production(
role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation)
fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
fk_stock_movement integer, -- id of stock movement when movements are validated
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
date_creation datetime NOT NULL,
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer NOT NULL,
fk_user_modif integer,
import_key varchar(14),
fk_default_workstation integer DEFAULT NULL,
fk_unit integer DEFAULT NULL
) ENGINE=innodb;

View file

@ -19,4 +19,4 @@ create table llx_mrp_production_extrafields
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_object integer NOT NULL,
import_key varchar(14) -- import key
) ENGINE=innodb;
) ENGINE=innodb;

View file

@ -0,0 +1,2 @@
[sqlfluff]
dialect = postgres

View file

@ -0,0 +1,2 @@
[sqlfluff]
dialect = sqlite

View file

@ -169,6 +169,7 @@ ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts (If you set
ACCOUNTING_LENGTH_AACCOUNT=Length of the third-party accounting accounts (If you set value to 6 here, the account '401' will appear like '401000' on screen)
ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zeros at the end of an accounting account. Needed by some countries (like Switzerland). If set to off (default), you can set the following two parameters to ask the application to add virtual zeros.
BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account
ACCOUNTANCY_ER_DATE_RECORD=Use the end date of the period of an expense report as the date for the transfer to accounting, instead of the date of the expense
ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL=Enable draft export on journal
ACCOUNTANCY_COMBO_FOR_AUX=Enable combo list for subsidiary account (may be slow if you have a lot of third parties, break ability to search on a part of value)
ACCOUNTING_DATE_START_BINDING=Disable binding & transfer in accountancy when date is below this date (the transactions before this date will be excluded by default)

View file

@ -305,11 +305,11 @@ MAIN_MAIL_FORCE_SENDTO=Send all emails to (instead of real recipients, for test
MAIN_MAIL_ENABLED_USER_DEST_SELECT=Suggest emails of employees (if defined) into the list of predefined recipient when writing a new email
MAIN_MAIL_NO_WITH_TO_SELECTED=Do not select a default recipient even if there is only 1 possible choice
MAIN_MAIL_SENDMODE=Sending method
MAIN_MAIL_SMTPS_ID=SMTP ID (if sending server requires authentication)
MAIN_MAIL_SMTPS_PW=SMTP Password (if sending server requires authentication)
MAIN_MAIL_SMTPS_ID=SMTP username or ID (if sending server requires authentication)
MAIN_MAIL_SMTPS_PW=SMTP password or token (if sending server requires authentication)
MAIN_MAIL_EMAIL_TLS=Use TLS (SSL) encryption
MAIN_MAIL_EMAIL_STARTTLS=Use TLS (STARTTLS) encryption
MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED=Authorize self-signed certificates
MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED=Allow connection to mail servers using self-signed certificates
MAIN_MAIL_EMAIL_DKIM_ENABLED=Use DKIM to generate email signature
MAIN_MAIL_EMAIL_DKIM_DOMAIN=Email Domain for use with dkim
MAIN_MAIL_EMAIL_DKIM_SELECTOR=Name of dkim selector
@ -2374,6 +2374,8 @@ DontForgetCreateTokenOauthMod=A token with the right permissions must have been
AuthenticationMethod=Authentication method
MAIN_MAIL_SMTPS_AUTH_TYPE=Authentication method
UsePassword=Use a password
UseAUTHLOGIN=Use a password (AUTH LOGIN)
UseAUTHPLAIN=Use a password (AUTH PLAIN)
UseOauth=Use a OAUTH token
Images=Images
MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form

View file

@ -1284,3 +1284,5 @@ ShowSearchFields=Do a search
MyUserCard=My user file
PublicFile=Public file
FillPageWithALayout=Fill page with a layout
EntityNameNotDefined=No entity name
AllEntities=All entities

View file

@ -9,29 +9,30 @@ descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a sales order is closed (the new invoice will have same amount as the order)
descWORKFLOW_TICKET_CREATE_INTERVENTION=On ticket creation, automatically create an intervention.
# Autoclassify customer proposal or order
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposals as billed when a sales order is set to billed (and if the amount of the order is the same as the total amount of the signed linked proposals)
descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classify linked source proposals as billed when a customer invoice is validated (and if the amount of the invoice is the same as the total amount of the signed linked proposals)
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source sales order as billed when a customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked sales orders). If you have 1 invoice validated for n orders, this may set all orders to billed too.
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source sales orders as billed when a customer invoice is set to paid (and if the amount of the invoice is the same as the total amount of the linked sales orders). If you have 1 invoice set billed for n orders, this may set all orders to billed too.
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classify linked source sales orders as shipped when a shipment is validated (and if the quantity shipped by all shipments is the same as in the order to update)
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=Classify linked source sales order as shipped when a shipment is closed (and if the quantity shipped by all shipments is the same as in the order to update)
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=When a sales order is set to billed, classify linked source proposals as billed (and if the amount of the order is the same as the total amount of the signed linked proposals)
descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=When a customer invoice is validated, classify linked source proposals as billed (and if the amount of the invoice is the same as the total amount of the signed linked proposals)
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=When a customer invoice is set to paid, classify linked source sales orders as billed (and if the amount of the invoice is the same as the total amount of the linked sales orders). If you generate 1 invoice for n orders, this may set all orders to billed too.
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=When a customer invoice is validated, classify all the linked source sales orders as billed (and if the amount of the invoice is the same as the total amount of the linked source sales orders). If you generate 1 common invoice for n orders, this may set all source orders to billed.
descWORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER=When a customer invoice is validated, classify the linked sales order (if there is only one) as billed, if the total amount of the linked sale order is equal to the total amount of all invoices issued from it. If you generate n invoices for 1 order, this allow to set the order to billed as soon as all invoices are validated.
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=When a shipment is validated, classify linked source sales orders as shipped (and if the quantity shipped by all shipments is the same as in the order to update)
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=When a shipment is closed, classify linked source sales order as shipped (and if the quantity shipped by all shipments is the same as in the order to update)
# Autoclassify purchase proposal
descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=Classify linked source vendor proposal as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked proposals)
descWORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL=When a vendor invoice is validated, classify linked source vendor proposal as billed (and if the amount of the invoice is the same as the total amount of the linked proposals)
# Autoclassify purchase order
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=Classify linked source purchase order as billed when vendor invoice is validated (and if the amount of the invoice is the same as the total amount of the linked orders)
descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION=Classify linked source purchase order as received when a reception is validated (and if the quantity received by all receptions is the same as in the purchase order to update)
descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED=Classify linked source purchase order as received when a reception is closed (and if the quantity received by all rceptions is the same as in the purchase order to update)
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER=When a vendor invoice is validated, classify linked source purchase order as billed (and if the amount of the invoice is the same as the total amount of the linked orders)
descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION=When a reception is validated, classify linked source purchase order as received (and if the quantity received by all receptions is the same as in the purchase order to update)
descWORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED=When a reception is closed, classify linked source purchase orders as received (and if the quantity received by all receptions issued from the purchase order is the same as in the purchase order to update)
# Autoclassify shipment
descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=Classify linked source shipment as closed when a customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked shipments)
descWORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE=Classify linked source shipment as billed when a customer invoice is validated (and if the amount of the invoice is the same as the total amount of the linked shipments)
descWORKFLOW_SHIPPING_CLASSIFY_CLOSED_INVOICE=When a customer invoice is validated, classify the linked source shipment as closed (and if the amount of the invoice is the same as the total amount of the linked shipments)
descWORKFLOW_SHIPPING_CLASSIFY_BILLED_INVOICE=When a customer invoice is validated, classify the linked source shipment as billed (and if the amount of the invoice is the same as the total amount of the linked shipments)
# Autoclassify receptions
descWORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE=Classify linked source receptions as billed when a purchase invoice is validated (and if the amount of the invoice is the same as the total amount of the linked receptions)
descWORKFLOW_RECEPTION_CLASSIFY_BILLED_INVOICE=Classify linked source receptions as billed when a purchase invoice is validated (and if the amount of the invoice is the same as the total amount of the linked receptions)
descWORKFLOW_RECEPTION_CLASSIFY_CLOSED_INVOICE=When a purchase invoice is validated, classify linked source receptions as closed (and if the amount of the invoice is the same as the total amount of the linked receptions)
descWORKFLOW_RECEPTION_CLASSIFY_BILLED_INVOICE=When a purchase invoice is validated, classify linked source receptions as billed (and if the amount of the invoice is the same as the total amount of the linked receptions)
# Automatically link ticket to contract
descWORKFLOW_TICKET_LINK_CONTRACT=When creating a ticket, link all available contracts of matching third parties
descWORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS=When linking contracts, search among those of parents companies
descWORKFLOW_TICKET_LINK_CONTRACT=When a ticket is created, link it with available contracts, matching the same third party than the ticket
descWORKFLOW_TICKET_USE_PARENT_COMPANY_CONTRACTS=When linking automatically a ticket with contracts, search contracts among those of the parents companies
# Autoclose intervention
descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the ticket when a ticket is closed
descWORKFLOW_TICKET_CLOSE_INTERVENTION=Close all interventions linked to the ticket when a ticket is closed
AutomaticCreation=Automatic creation
AutomaticClassification=Automatic classification
AutomaticClosing=Automatic closing

View file

@ -9,10 +9,13 @@ descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Créer une facture client automatiqueme
descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Créer automatiquement une facture client à la cloture d'un commande (la facture sera du même montant que la commande)
descWORKFLOW_TICKET_CREATE_INTERVENTION=Crée une intervention automatiquement à la création d'un ticket
# Autoclassify customer proposal or order
descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classer la/les proposition(s) commerciale(s) source(s) facturée(s) au classement facturé de la commande (et si le montant de la commande est le même que le total des propositions liées)
descWORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL=Classer la/les proposition(s) commerciale(s) source facturée(s) à la validation d'une facture client (et si le montant de la facture est le même que la somme des propositions liées)
descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) source(s) liées à facturée(s) quand une facture client est validée (et si le montant de la facture est le même que le montant total des commandes liées). Si vous avez une facture validée pour n commandes, cela peut également classer toutes les commandes sur Facturée.
descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) source(s) à Facturée quand une facture client est passée à Payé (et si le montant de la facture est identique à la somme des commandes sources). Si vous avez une facture définie facturée pour n commandes, cela peut aussi classer toutes les commandes sur Facturée.
descWORKFLOW_SUM_INVOICES_AMOUNT_CLASSIFY_BILLED_ORDER=Classer la/les commande(s) client(s) à Facturée si la somme du montant des factures liées est égale au montant total de la commande
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING=Classer les commandes client source liées comme expédiées lorsqu'une expédition est validée (et si la quantité expédiée par toutes les expéditions est la même que dans le commande à mettre à jour)
descWORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING_CLOSED=Classer la commande client source liée à expédiée lorsqu'une expédition est fermée (et si la quantité expédiée par toutes les expéditions est la même que dans la commande à mettre à jour)
# Autoclassify purchase proposal

View file

@ -443,7 +443,7 @@ if (isModEnabled('debugbar') && !GETPOST('dol_use_jmobile') && empty($_SESSION['
global $debugbar;
include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php';
$debugbar = new DolibarrDebugBar();
$renderer = $debugbar->getRenderer();
$renderer = $debugbar->getJavascriptRenderer();
if (!getDolGlobalString('MAIN_HTML_HEADER')) {
$conf->global->MAIN_HTML_HEADER = '';
}
@ -2654,7 +2654,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
//if ($conf->theme != 'md') {
$btnUser .= '
$btnUser .= '
jQuery("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
console.log("Click on #topmenu-login-dropdown .dropdown-toggle");
event.preventDefault();

View file

@ -1329,6 +1329,7 @@ class Product extends CommonObject
if (getDolGlobalInt('MAIN_MULTILANGS')) {
if ($this->setMultiLangs($user) < 0) {
$this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql;
$this->db->rollback();
return -2;
}
}

View file

@ -24,6 +24,7 @@
* \brief File of class to manage predefined price products or services by customer
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
/**
* File of class to manage predefined price products or services by customer
@ -470,7 +471,7 @@ class ProductCustomerPrice extends CommonObject
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) {
$line = new PriceByCustomerLine();
$line = new PriceByCustomerLine($this->db);
$line->id = $obj->rowid;
@ -581,7 +582,7 @@ class ProductCustomerPrice extends CommonObject
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) {
$line = new PriceByCustomerLine();
$line = new PriceByCustomerLine($this->db);
$line->id = $obj->rowid;
@ -1070,7 +1071,7 @@ class ProductCustomerPrice extends CommonObject
/**
* File of class to manage predefined price products or services by customer lines
*/
class PriceByCustomerLine
class PriceByCustomerLine extends CommonObjectLine
{
/**
* @var int ID
@ -1083,7 +1084,6 @@ class PriceByCustomerLine
public $entity;
public $datec = '';
public $tms = '';
/**
* @var int ID

View file

@ -444,7 +444,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}*/
if ($permissiontoadd) {
if ($object->status == $object::STATUS_CANCELED) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes">'.$langs->trans("Re-Open").'</a>'."\n";
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken().'">'.$langs->trans("Re-Open").'</a>'."\n";
}
}

View file

@ -2518,10 +2518,10 @@ class Societe extends CommonObject
* Return array of sales representatives
*
* @param User $user Object user (not used)
* @param int $mode 0=Array with properties, 1=Array of id.
* @param int $mode 0=Array with properties, 1=Array of IDs.
* @param string $sortfield List of sort fields, separated by comma. Example: 't1.fielda,t2.fieldb'
* @param string $sortorder Sort order, separated by comma. Example: 'ASC,DESC';
* @return array|int Array of sales representatives of third party or <0 if KO
* @return array|int Array of sales representatives of the current third party or <0 if KO
*/
public function getSalesRepresentatives(User $user, $mode = 0, $sortfield = null, $sortorder = null)
{
@ -2529,16 +2529,14 @@ class Societe extends CommonObject
$reparray = array();
$sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo, u.gender";
$sql = "SELECT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut as status, u.entity, u.photo, u.gender";
$sql .= ", u.office_fax, u.user_mobile, u.personal_mobile";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u";
// Condition here should be the same than into select_dolusers()
if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) {
$sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql .= " WHERE ((ug.fk_user = sc.fk_user";
$sql .= " AND ug.entity = ".$conf->entity.")";
$sql .= " OR u.admin = 1)";
$sql .= " WHERE u.rowid IN (SELECT ug.fk_user FROM ".$this->db->prefix()."usergroup_user as ug WHERE ug.entity IN (".getEntity('usergroup')."))";
} else {
$sql .= " WHERE entity in (0, ".$conf->entity.")";
$sql .= " WHERE entity IN (0, ".$this->db->sanitize($conf->entity).")";
}
$sql .= " AND u.rowid = sc.fk_user AND sc.fk_soc = ".((int) $this->id);

View file

@ -41,7 +41,8 @@ if ($action == 'editsalesrepresentatives') {
print '<input type="hidden" name="action" value="set_salesrepresentatives" />';
print '<input type="hidden" name="token" value="'.newToken().'" />';
print '<input type="hidden" name="socid" value="'.$object->id.'" />';
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1);
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 'default', 0, 0, '', 0, '', '', 0, 1);
$arrayselected = GETPOST('commercial', 'array');
if (empty($arrayselected)) {
$arrayselected = $object->getSalesRepresentatives($user, 1);
@ -51,6 +52,7 @@ if ($action == 'editsalesrepresentatives') {
print '</form>';
} else {
$listsalesrepresentatives = $object->getSalesRepresentatives($user);
$nbofsalesrepresentative = count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 0 && is_array($listsalesrepresentatives)) {
$userstatic = new User($db);

View file

@ -1201,64 +1201,21 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<input type="hidden" name="trackid" value="'.$trackid.'">';
// Categories
if (isModEnabled('category')) {
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
print '<tr>';
print '<td class="valignmiddle titlefield">';
print '<table class="nobordernopadding centpercent"><tr><td class="titlefield">';
print $langs->trans("Categories");
if ($action != 'categories' && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=categories&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
}
print '</table>';
print '</td>';
if ($user->hasRight('ticket', 'write') && $action == 'categories') {
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
if (is_array($cate_arbo)) {
// Categories
print '<td colspan="3">';
print '<form action="'.$url_page_current.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<input type="hidden" name="action" value="set_categories">';
$category = new Categorie($db);
$cats = $category->containing($object->id, 'ticket');
$arrayselected = array();
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print '<input type="submit" class="button button-edit small" value="'.$langs->trans('Save').'">';
print '</form>';
print "</td>";
}
} else {
print '<td colspan="3">';
print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
print "</td></tr>";
}
print '</table>';
}
print '<div class="underbanner clearboth"></div>';
// View Original message
$actionobject->viewTicketOriginalMessage($user, $action, $object);
// Classification of ticket
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder tableforfield centpercent margintable">';
print '<table class="border tableforfield centpercent margintable">';
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans('TicketProperties');
print '</td>';
print '<td>';
if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
print '<input type="submit" class="button smallpaddingimp" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} else {
// Button to edit Properties
if (isset($object->status) && ($object->status < $object::STATUS_NEED_MORE_INFO || getDolGlobalString('TICKET_ALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED')) && $user->hasRight('ticket', 'write')) {
@ -1320,6 +1277,51 @@ if ($action == 'create' || $action == 'presend') {
print '</form>';
// Tags/Categories
if (isModEnabled('category')) {
print '<table class="border centpercent tableforfield">';
print '<tr>';
print '<td class="valignmiddle titlefield">';
print '<table class="nobordernopadding centpercent"><tr><td class="titlefield">';
print $langs->trans("Categories");
if ($action != 'categories' && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=categories&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
}
print '</table>';
print '</td>';
if ($user->hasRight('ticket', 'write') && $action == 'categories') {
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
if (is_array($cate_arbo)) {
// Categories
print '<td colspan="3">';
print '<form action="'.$url_page_current.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
print '<input type="hidden" name="action" value="set_categories">';
$category = new Categorie($db);
$cats = $category->containing($object->id, 'ticket');
$arrayselected = array();
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'maxwidth500 widthcentpercentminusx', 0, 0);
print '<input type="submit" class="button button-edit smallpaddingimp" value="'.$langs->trans('Save').'">';
print '</form>';
print "</td>";
}
} else {
print '<td colspan="3">';
print $form->showCategories($object->id, Categorie::TYPE_TICKET, 1);
print "</td></tr>";
}
print '</table>';
}
// Display navbar with links to change ticket status
print '<!-- navbar with status -->';
if (!$user->socid && $user->hasRight('ticket', 'write') && isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {

View file

@ -186,7 +186,7 @@ class ActionsTicket extends CommonHookActions
*/
public function viewTicketOriginalMessage($user, $action, $object)
{
global $conf, $langs;
global $langs;
print '<!-- initial message of ticket -->'."\n";
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
@ -199,7 +199,7 @@ class ActionsTicket extends CommonHookActions
// Initial message
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent margintable margintable">';
print '<table class="border centpercent margintable margintable">';
print '<tr class="liste_titre trforfield"><td class="nowrap titlefield">';
print $langs->trans("InitialMessage");
print '</td><td>';
@ -234,8 +234,8 @@ class ActionsTicket extends CommonHookActions
}
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
print '<div class="center">';
print ' <input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print ' <input type="submit" class="button button-edit small" value="'.$langs->trans('Modify').'">';
print ' <input type="submit" class="button button-cancel small" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
}
print '</td>';

View file

@ -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

View file

@ -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"