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

This commit is contained in:
Laurent Destailleur 2024-09-26 23:17:00 +02:00
commit fc6a5354e3
27 changed files with 385 additions and 129 deletions

View File

@ -10,14 +10,14 @@
return [
// # Issue statistics:
// PhanPluginUnknownPropertyType : 1490+ occurrences
// PhanUndeclaredProperty : 840+ occurrences
// PhanUndeclaredProperty : 830+ occurrences
// PhanTypeMismatchArgumentProbablyReal : 740+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 730+ occurrences
// PhanPossiblyUndeclaredGlobalVariable : 720+ occurrences
// PhanUndeclaredGlobalVariable : 440+ occurrences
// PhanPluginUnknownArrayMethodReturnType : 430+ occurrences
// PhanPluginUnknownArrayMethodParamType : 360+ occurrences
// PhanPossiblyUndeclaredVariable : 330+ occurrences
// PhanPluginUnknownObjectMethodCall : 230+ occurrences
// PhanPossiblyUndeclaredVariable : 320+ occurrences
// PhanPluginUnknownObjectMethodCall : 200+ occurrences
// PhanTypeMismatchProperty : 200+ occurrences
// PhanPluginUnknownArrayFunctionReturnType : 160+ occurrences
// PhanPluginUnknownArrayFunctionParamType : 150+ occurrences
@ -27,22 +27,22 @@ return [
// PhanPluginEmptyStatementIf : 55+ occurrences
// PhanRedefineFunction : 50+ occurrences
// PhanTypeSuspiciousNonTraversableForeach : 50+ occurrences
// PhanTypeMismatchDimFetch : 40+ occurrences
// PhanTypeMismatchDimFetch : 35+ occurrences
// PhanTypeExpectedObjectPropAccess : 25+ occurrences
// PhanPossiblyNullTypeMismatchProperty : 15+ occurrences
// PhanTypeComparisonFromArray : 15+ occurrences
// PhanUndeclaredConstant : 15+ occurrences
// PhanEmptyForeach : 10+ occurrences
// PhanPluginConstantVariableNull : 10+ occurrences
// PhanPluginDuplicateExpressionBinaryOp : 10+ occurrences
// PhanPluginSuspiciousParamPosition : 10+ occurrences
// PhanUndeclaredMethod : 9 occurrences
// PhanPluginBothLiteralsBinaryOp : 8 occurrences
// PhanPluginDuplicateArrayKey : 8 occurrences
// PhanPluginDuplicateExpressionBinaryOp : 7 occurrences
// PhanTypeMismatchDimFetchNullable : 7 occurrences
// PhanTypeExpectedObjectPropAccessButGotNull : 6 occurrences
// PhanParamTooMany : 3 occurrences
// PhanInvalidFQSENInClasslike : 2 occurrences
// PhanParamTooMany : 2 occurrences
// PhanAccessMethodProtected : 1 occurrence
// PhanEmptyFQSENInClasslike : 1 occurrence
@ -60,7 +60,7 @@ return [
'htdocs/api/class/api_status.class.php' => ['PhanPluginUnknownArrayMethodReturnType'],
'htdocs/asset/admin/setup.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/card.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/asset/class/asset.class.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/asset/class/assetaccountancycodes.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/asset/class/assetdepreciationoptions.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/asset/class/assetmodel.class.php' => ['PhanUndeclaredProperty'],
@ -120,7 +120,7 @@ return [
'htdocs/comm/mailing/class/html.formadvtargetemailing.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/comm/mailing/class/mailing.class.php' => ['PhanPluginUnknownArrayPropertyType'],
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
'htdocs/comm/propal/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredProperty'],
'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'],
'htdocs/comm/propal/class/api_proposals.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/comm/propal/class/propal.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
'htdocs/comm/propal/class/propalestats.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType'],
@ -151,7 +151,7 @@ return [
'htdocs/compta/bank/various_payment/document.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/info.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/compta/cashcontrol/cashcontrol_card.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/compta/cashcontrol/class/cashcontrol.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/compta/charges/index.php' => ['PhanTypeMismatchArgumentNullableInternal'],
'htdocs/compta/clients.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
@ -237,7 +237,7 @@ return [
'htdocs/contact/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contact/perso.php' => ['PhanTypeMismatchProperty'],
'htdocs/contrat/agenda.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/card.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/contrat/card.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/contrat/class/api_contracts.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType'],
'htdocs/contrat/messaging.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/contrat/services_list.php' => ['PhanEmptyForeach', 'PhanTypeMismatchArgumentProbablyReal'],
@ -247,10 +247,10 @@ return [
'htdocs/core/actions_comments.inc.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_extrafields.inc.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/actions_lineupdown.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_linkedfiles.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
'htdocs/core/actions_massactions.inc.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_printing.inc.php' => ['PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_sendmails.inc.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/core/actions_setmoduleoptions.inc.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/ajax/ajaxdirpreview.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/core/ajax/ajaxdirtree.php' => ['PhanPluginUnknownArrayFunctionParamType', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanUndeclaredGlobalVariable'],
@ -289,7 +289,7 @@ return [
'htdocs/core/class/commondocgenerator.class.php' => ['PhanPluginUnknownArrayPropertyType', 'PhanPluginUnknownPropertyType', 'PhanTypeSuspiciousNonTraversableForeach', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonhookactions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/commoninvoice.class.php' => ['PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownPropertyType', 'PhanPossiblyUndeclaredVariable'],
'htdocs/core/class/commonobject.class.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanTypeComparisonFromArray', 'PhanTypeMismatchDimFetch', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonobject.class.php' => ['PhanParamTooMany', 'PhanUndeclaredProperty'],
'htdocs/core/class/commonobjectline.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/commonorder.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/commonpeople.class.php' => ['PhanUndeclaredProperty'],
@ -300,7 +300,6 @@ return [
'htdocs/core/class/ctypent.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/ctyperesource.class.php' => ['PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/core/class/cunits.class.php' => ['PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/defaultvalues.class.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/core/class/diasporahandler.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanPluginUnknownArrayPropertyType'],
'htdocs/core/class/discount.class.php' => ['PhanPluginUnknownPropertyType'],
'htdocs/core/class/doleditor.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
@ -372,7 +371,7 @@ return [
'htdocs/core/lib/expedition.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/expensereport.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/fichinter.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall'],
'htdocs/core/lib/files.lib.php' => ['PhanPluginDuplicateExpressionBinaryOp', 'PhanPluginUnknownArrayFunctionParamType', 'PhanPluginUnknownArrayFunctionReturnType', 'PhanPluginUnknownObjectMethodCall', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal', 'PhanUndeclaredProperty'],
'htdocs/core/lib/files.lib.php' => ['PhanUndeclaredProperty'],
'htdocs/core/lib/fourn.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/core/lib/ftp.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType', 'PhanPossiblyUndeclaredVariable', 'PhanTypeMismatchArgumentNullableInternal'],
'htdocs/core/lib/functions.lib.php' => ['PhanPluginDuplicateArrayKey'],
@ -632,7 +631,6 @@ return [
'htdocs/expensereport/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/externalsite/frames.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/fichinter/card-rec.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/fichinter/card.php' => ['PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/fichinter/class/api_interventions.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownArrayMethodReturnType', 'PhanUndeclaredProperty'],
'htdocs/fichinter/class/fichinter.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownObjectMethodCall'],
'htdocs/fichinter/class/fichinterrec.class.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
@ -788,11 +786,11 @@ return [
'htdocs/product/dynamic_price/class/price_parser.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType'],
'htdocs/product/index.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/product/inventory/card.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredProperty'],
'htdocs/product/inventory/class/inventory.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanPluginUnknownPropertyType', 'PhanUndeclaredProperty'],
'htdocs/product/inventory/inventory.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/inventory/lib/inventory.lib.php' => ['PhanPluginUnknownArrayFunctionReturnType'],
'htdocs/product/inventory/list.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/product/list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanPossiblyUndeclaredGlobalVariable'],
'htdocs/product/price.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
'htdocs/product/stats/card.php' => ['PhanTypeComparisonFromArray'],
@ -881,7 +879,7 @@ return [
'htdocs/public/stripe/ipn.php' => ['PhanPluginEmptyStatementIf', 'PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchProperty', 'PhanUndeclaredGlobalVariable'],
'htdocs/public/test/test_arrays.php' => ['PhanPluginUndeclaredVariableIsset'],
'htdocs/public/test/test_forms.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'],
'htdocs/public/ticket/create_ticket.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchDimFetchNullable', 'PhanTypeMismatchProperty'],
'htdocs/public/ticket/list.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/public/ticket/view.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/public/webportal/index.php' => ['PhanPluginUnknownObjectMethodCall', 'PhanUndeclaredGlobalVariable'],
@ -1011,7 +1009,7 @@ return [
'htdocs/user/param_ihm.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/user/passwordforgotten.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'htdocs/variants/ajax/get_attribute_values.php' => ['PhanTypeComparisonFromArray'],
'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType', 'PhanTypeMismatchArgumentProbablyReal'],
'htdocs/variants/class/ProductAttribute.class.php' => ['PhanPluginUnknownArrayMethodParamType'],
'htdocs/variants/class/ProductCombination.class.php' => ['PhanPluginSuspiciousParamPosition'],
'htdocs/variants/combinations.php' => ['PhanPossiblyUndeclaredGlobalVariable', 'PhanTypeMismatchProperty'],
'htdocs/variants/tpl/productattributevalueline_edit.tpl.php' => ['PhanUndeclaredProperty'],

View File

@ -54,6 +54,24 @@ if (!isModEnabled('socialnetworks')) {
accessforbidden('Module Social Networks is not enabled');
}
// List of oauth services
$oauthservices = array();
foreach ($conf->global as $key => $val) {
if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
$key = preg_replace('/^OAUTH_/', '', $key);
$key = preg_replace('/_ID$/', '', $key);
if (preg_match('/^.*-/', $key)) {
$name = preg_replace('/^.*-/', '', $key);
} else {
$name = $langs->trans("NoName");
}
$provider = preg_replace('/-.*$/', '', $key);
$provider = ucfirst(strtolower($provider));
$oauthservices[$key] = $name." (".$provider.")";
}
}
/*
* Actions
@ -68,6 +86,9 @@ if ($action == 'add') {
$socialNetworkName = GETPOST('socialnetwork_name', 'alpha');
$socialNetworkUrl = GETPOST('socialnetwork_url', 'alpha');
if (GETPOSTISSET("OAUTH_SERVICE_SOCIAL_NETWORK")) {
dolibarr_set_const($db, "OAUTH_SERVICE_SOCIAL_NETWORK", GETPOST("OAUTH_SERVICE_SOCIAL_NETWORK", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
}
// other params if exist
$paramNames = GETPOST('param_name', 'array');
@ -272,8 +293,48 @@ print '<td>'.$langs->trans('SocialNetworkUrl').'</td>';
print '<td><input type="text" class="flat minwidth300" name="socialnetwork_url"></td>';
print '<td>https://mastodon.social/api/v1/accounts/id_user</td>';
print '</tr>';
$vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING';
print '<tr class="oddeven"><td>';
// Methods oauth
print '<td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td>';
print '<td>';
print '<input type="radio" id="radio_oauth" name="'.$vartosmtpstype.'" value="XOAUTH2"'.(getDolGlobalString($vartosmtpstype) == 'XOAUTH2' ? ' checked' : '').(isModEnabled('oauth') ? '' : ' disabled').'>';
print '<label for="radio_oauth">'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
if (!isModEnabled('oauth')) {
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword=oauth">'.$langs->trans("EnableModuleX", "OAuth").'</a>';
} else {
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/admin/oauth.php">'.$langs->trans("SetupModuleX", " OAuth").'</a>';
}
print '</td>';
print '</tr>';
print '<tr class="oddeven" id="oauth_service_div" style="display: none;">';
print '<td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td>';
print '<td>';
$oauthservicesStringKeys = [];
foreach ($oauthservices as $key => $value) {
$key = (string) $key;
$oauthservicesStringKeys[$key] = $value;
}
/** @phan-var-force array<string, array{label:string, data-html:string, disable?:int, css?:string}> $oauthservices */
if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
print $form->selectarray('OAUTH_SERVICE_SOCIAL_NETWORK', $oauthservicesStringKeys, (string) $conf->global->OAUTH_SERVICE_SOCIAL_NETWORK);
} else {
$selectedKey = (string) getDolGlobalString('OAUTH_SERVICE_SOCIAL_NETWORK');
$text = isset($oauthservicesStringKeys[$selectedKey]) ? $oauthservicesStringKeys[$selectedKey]['label'] : '';
if (empty($text)) {
$text = $langs->trans("Undefined");
}
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" name="OAUTH_SERVICE_SOCIAL_NETWORK" value="'.$selectedKey.'">';
}
print '</td>';
print '</tr>';
print '<tr class="oddeven" id="add_param_row"><td>';
print $form->textwithpicto($langs->trans("Others"), $langs->trans("AddMoreParams"));
print '</td><td><button type="button" id="addParamButton">'.img_picto($langs->trans("AddMoreParams"), 'add', 'pictofixedwidth').'</button></td>';
print '<td>Token : ****<br>Cookie : ****</td>';
@ -294,14 +355,38 @@ print '</div>';
print $form->buttonsSaveCancel("Add", '');
print '<input type="hidden" name="action" value="add">';
print '<script type="text/javascript">
document.getElementById("addParamButton").addEventListener("click", function() {
var container = document.getElementById("additionalParams");
var index = container.children.length;
var div = document.createElement("div");
div.className = "pair-group";
div.innerHTML = "<input type=\'text\' class=\'flat minwidth300\' name=\'param_name[]\' placeholder=\''.$langs->trans("ParamName").'\' class=\'flat\' /> <input type=\'text\' class=\'flat minwidth300\' name=\'param_value[]\' placeholder=\''.$langs->trans("ParamValue").'\' class=\'flat\' />";
container.appendChild(div);
});
$(document).ready(function() {
function toggleOAuthServiceDisplay() {
if ($("#radio_oauth").is(":checked")) {
$("#oauth_service_div").show(); // Afficher le sélecteur OAuth
} else {
$("#oauth_service_div").hide(); // Cacher le sélecteur OAuth
}
}
function toggleAddParamRow() {
if ($("#radio_oauth").is(":checked")) {
$("#add_param_row").hide(); // Cacher toute la ligne
} else {
$("#add_param_row").show(); // Afficher toute la ligne
}
}
toggleOAuthServiceDisplay();
toggleAddParamRow();
$("input[name=\"'.$vartosmtpstype.'\"]").change(function() {
toggleOAuthServiceDisplay();
toggleAddParamRow();
});
$("#addParamButton").click(function() {
var container = $("#additionalParams");
var index = container.children().length;
var newParam = $("<div class=\'pair-group\'><input type=\'text\' class=\'flat minwidth300\' name=\'param_name[]\' placeholder=\''.$langs->trans("ParamName").'\' class=\'flat\' /> <input type=\'text\' class=\'flat minwidth300\' name=\'param_value[]\' placeholder=\''.$langs->trans("ParamValue").'\' class=\'flat\' /></div>");
container.append(newParam);
});
});
</script>';
print '</form>';

View File

@ -250,7 +250,7 @@ if ($transvalue) {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if (isset($optioncss) && $optioncss != '') {
if ($optioncss != '') {
print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
}
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -1227,7 +1227,29 @@ if ($action == 'create') {
console.log("setdatefields");
setdatefields();
});
var old_startdate = null;
$("#ap").focus(function() {
old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val());
});
$("#ap").next(".ui-datepicker-trigger").click(function() {
old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val());
});
$("#ap").change(function() {
setTimeout(function() {
if ($("#p2").val() !== "") {
var new_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val());
var old_enddate = new Date($("#p2year").val(), $("#p2month").val() - 1, $("#p2day").val());
if (new_startdate > old_enddate) {
var timeDiff = old_enddate - old_startdate;
var new_enddate = new Date(new_startdate.getTime() + timeDiff);
$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
$("#p2day").val(new_enddate.getDate());
$("#p2month").val(new_enddate.getMonth() + 1);
$("#p2year").val(new_enddate.getFullYear());
}
}
}, 0);
});
$("#actioncode").change(function() {
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
else $("#dateend").removeClass("fieldrequired");
@ -1819,6 +1841,29 @@ if ($id > 0) {
$("#fullday").change(function() {
setdatefields();
});
var old_startdate = null;
$("#ap").focus(function() {
old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val());
});
$("#ap").next(".ui-datepicker-trigger").click(function() {
old_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val());
});
$("#ap").change(function() {
setTimeout(function() {
if ($("#p2").val() !== "") {
var new_startdate = new Date($("#apyear").val(), $("#apmonth").val() - 1, $("#apday").val());
var old_enddate = new Date($("#p2year").val(), $("#p2month").val() - 1, $("#p2day").val());
if (new_startdate > old_enddate) {
var timeDiff = old_enddate - old_startdate;
var new_enddate = new Date(new_startdate.getTime() + timeDiff);
$("#p2").val(formatDate(new_enddate, "' . $langs->trans('FormatDateShortJavaInput') . '"));
$("#p2day").val(new_enddate.getDate());
$("#p2month").val(new_enddate.getMonth() + 1);
$("#p2year").val(new_enddate.getFullYear());
}
}
}, 0);
});
$("#actioncode").change(function() {
if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
else $("#dateend").removeClass("fieldrequired");

View File

@ -547,7 +547,7 @@ if (empty($reshook)) {
$element = $subelement = 'contrat';
}
if ($element == 'inter') {
$element = $subelement = 'ficheinter';
$element = $subelement = 'fichinter';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
@ -568,6 +568,7 @@ if (empty($reshook)) {
$classname = ucfirst($subelement);
$srcobject = new $classname($db);
'@phan-var-force Commande|Propal|Contrat|Fichinter|Expedition $srcobject'; // Can be other class, but CommonObject is too generic
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
$result = $srcobject->fetch($object->origin_id);
@ -1885,6 +1886,7 @@ if ($action == 'create') {
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
'@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc'; // Can be other class, but CommonObject is too generic
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
$objectsrc->fetch_lines();
@ -2002,7 +2004,7 @@ if ($action == 'create') {
} else {
print '<td class="valuefieldcreate">';
$filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer information
if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) {
print '<script>
@ -2335,7 +2337,7 @@ if ($action == 'create') {
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid'), 'socid', $filter, '', 0, 0, null, 0, 'maxwidth300')),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOSTINT('socid'), 'socid', $filter, '', 0, 0, array(), 0, 'maxwidth300')),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0),
array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0),
);
@ -2370,6 +2372,7 @@ if ($action == 'create') {
if (array_key_exists('facture', $object->linkedObjects)) {
foreach ($object->linkedObjects['facture'] as $invoice) {
'@phan-var-force Facture $invoice';
if ($invoice->type == Facture::TYPE_DEPOSIT) {
$eligibleForDepositGeneration = false;
break;
@ -2383,6 +2386,7 @@ if ($action == 'create') {
if (array_key_exists('facture', $order->linkedObjects)) {
foreach ($order->linkedObjects['facture'] as $invoice) {
'@phan-var-force Facture $invoice';
if ($invoice->type == Facture::TYPE_DEPOSIT) {
$eligibleForDepositGeneration = false;
break 2;
@ -2631,8 +2635,8 @@ if ($action == 'create') {
print '<tr><td class="titlefieldmax45">'.$langs->trans('Discounts').'</td><td>';
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);
$absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount);
$absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote);
$absolute_discount = price2num($absolute_discount, 'MT');
$absolute_creditnote = price2num($absolute_creditnote, 'MT');
@ -3223,7 +3227,7 @@ if ($action == 'create') {
print $formfile->showdocuments('propal', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
$linktoelem = $form->showLinkToObjectBlock($object, array(), array('propal'));
$compatibleImportElementsList = false;
if ($user->hasRight('propal', 'creer') && $object->statut == Propal::STATUS_DRAFT) {

View File

@ -42,12 +42,34 @@ class PropaleStats extends Stats
*/
public $table_element;
/**
* @var int ID
*/
public $socid;
/**
* @var int ID
*/
public $userid;
/**
* @var string sql from
*/
public $from;
/**
* @var string sql fields
*/
public $field;
/**
* @var string sql where
*/
public $where;
/**
* @var string sql join
*/
public $join;

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -40,15 +41,49 @@ class CommandeStats extends Stats
*/
public $table_element;
/**
* @var int ID
*/
public $socid;
/**
* @var int ID
*/
public $userid;
/**
* @var string To store the FROM part of the main table of the SQL request
*/
public $from;
/**
* @var string To store the FROM part of the lines table of the SQL request
*/
public $from_line;
/**
* @var string To store the field
*/
public $field;
/**
* @var string To store the field of the line table of the SQL request
*/
public $field_line;
/**
* @var string To store the FROM part of the categorie table of the SQL request
*/
public $categ_link;
/**
* @var string To store the WHERE part of the main table of the SQL request
*/
public $where = '';
/**
* @var string To store the join
*/
public $join;

View File

@ -1526,7 +1526,7 @@ if (empty($reshook)) {
$element = $subelement = 'contrat';
}
if ($element == 'inter') {
$element = $subelement = 'ficheinter';
$element = $subelement = 'fichinter';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';
@ -1991,7 +1991,8 @@ if (empty($reshook)) {
$line->fk_prev_id = $line->id;
$line->fetch_optionals();
if (getDolGlobalInt('INVOICE_USE_SITUATION') == 2) {
$line->situation_percent = $line->get_allprev_progress($object->id);; // get good progress including credit note
$line->situation_percent = $line->get_allprev_progress($object->id);
; // get good progress including credit note
} else {
$line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note
}
@ -2128,7 +2129,7 @@ if (empty($reshook)) {
$remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0);
$remise_percent = str_replace('*', '', $remise_percent);
foreach ($object->lines as $line) {
$tvatx= $line->tva_tx;
$tvatx = $line->tva_tx;
if (!empty($line->vat_src_code)) {
$tvatx .= ' ('.$line->vat_src_code.')';
}

View File

@ -125,6 +125,7 @@ class Contact extends CommonObject
'fk_user_creat' => array('type' => 'integer', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => 3, 'position' => 310),
'fk_user_modif' => array('type' => 'integer', 'label' => 'UserModif', 'enabled' => 1, 'visible' => 3, 'position' => 315),
'statut' => array('type' => 'tinyint(4)', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 500),
'ip' => array('type' => 'varchar(250)', 'label' => 'Ip', 'enabled' => '1', 'position' => 700, 'notnull' => 0, 'visible' => '0', 'comment' => 'ip used to create record (for public submission page)'),
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -1, 'position' => 1000),
);
@ -321,6 +322,10 @@ class Contact extends CommonObject
*/
public $user_login;
/**
* @var string IP address
*/
public $ip;
// END MODULEBUILDER PROPERTIES
@ -495,6 +500,7 @@ class Contact extends CommonObject
$sql .= ", entity";
$sql .= ", ref_ext";
$sql .= ", import_key";
$sql .= ", ip";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($now)."',";
if ($this->socid > 0) {
@ -512,7 +518,8 @@ class Contact extends CommonObject
$sql .= " ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null").",";
$sql .= " ".((int) $this->entity).",";
$sql .= "'".$this->db->escape($this->ref_ext)."',";
$sql .= " ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
$sql .= " ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").",";
$sql .= " ".(!empty($this->ip) ? "'".$this->db->escape($this->ip)."'" : "null");
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -77,6 +77,9 @@ $hideref = (GETPOSTINT('hideref') ? GETPOSTINT('hideref') : (getDolGlobalString(
$datecontrat = '';
$moreparam = '';
$note_public = '';
$note_private = '';
$usehm = (getDolGlobalString('MAIN_USE_HOURMIN_IN_DATE_RANGE') ? $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE : 0);
// Security check
@ -318,6 +321,7 @@ if (empty($reshook)) {
$classname = ucfirst($subelement);
$srcobject = new $classname($db);
'@phan-var-force Commande|Propal|Facture $srcobject'; // Can be other class, but CommonObject is too Generic
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines");
$result = $srcobject->fetch($object->origin_id);
@ -519,6 +523,8 @@ if (empty($reshook)) {
$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
$price_base_type = '';
$price_min = '';
// Ecrase $tva_tx par celui du produit. TODO Remove this once vat selection is open
// Get and check minimum price
if ($idprod > 0) {
@ -737,7 +743,9 @@ if (empty($reshook)) {
}
$objectline->fetch_optionals();
$objectline->oldcopy = dol_clone($objectline, 2);
$objectline->oldcopy = dol_clone($objectline, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
} else {
$objectline = null;
}
$db->begin();
@ -1117,8 +1125,10 @@ if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php') {
$module = substr($module, 0, dol_strlen($module) - 4);
}
$result = dol_include_once('/core/modules/contract/'.$module.'.php');
$modCodeContract = null;
if ($result > 0) {
$modCodeContract = new $module();
'@phan-var-force ModelNumRefContracts $modCodeContract';
}
// Create
@ -1160,6 +1170,7 @@ if ($action == 'create') {
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
'@phan-var-force Commande|Propal|Facture $objectsrc';
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
$objectsrc->fetch_lines();
@ -1182,8 +1193,8 @@ if ($action == 'create') {
}
} else {
$projectid = GETPOSTINT('projectid');
$note_private = GETPOST("note_private");
$note_public = GETPOST("note_public");
$note_private = GETPOST("note_private", "alpha");
$note_public = GETPOST("note_public", "alpha");
}
$object->date_contrat = dol_now();
@ -1228,7 +1239,7 @@ if ($action == 'create') {
} else {
print '<td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
@ -1444,7 +1455,7 @@ if ($action == 'create') {
$morehtmlref .= $object->ref;
} else {
$morehtmlref .= $form->editfieldkey("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 3);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 2);
$morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->hasRight('contrat', 'creer'), 'string', '', null, 2);
}
$morehtmlref .= '<div class="refidno">';
@ -1672,7 +1683,7 @@ if ($action == 'create') {
$description = ''; // Already added into main visible desc
}
print $form->textwithtooltip($text, $description, 3, '', '', $cursorline, 3, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
print $form->textwithtooltip($text, $description, 3, 0, 0, $cursorline, 3, (!empty($line->fk_parent_line) ? img_picto('', 'rightarrow') : ''));
print '</td>';
} else {

View File

@ -2750,6 +2750,8 @@ abstract class CommonObject
case 'propal':
/** @var Propal $this */
/** @var PropaleLigne $line */
'@phan-var-force Propal $this';
'@phan-var-force PropaleLigne $line';
$this->updateline(
$line->id,
$line->subprice,
@ -2778,6 +2780,8 @@ abstract class CommonObject
case 'commande':
/** @var Commande $this */
/** @var OrderLine $line */
'@phan-var-force Commande $this';
'@phan-var-force OrderLine $line';
$this->updateline(
$line->id,
($line->description ? $line->description : $line->desc),
@ -2806,6 +2810,8 @@ abstract class CommonObject
case 'facture':
/** @var Facture $this */
/** @var FactureLigne $line */
'@phan-var-force Facture $this';
'@phan-var-force FactureLigne $line';
$this->updateline(
$line->id,
($line->description ? $line->description : $line->desc),
@ -2835,6 +2841,8 @@ abstract class CommonObject
case 'supplier_proposal':
/** @var SupplierProposal $this */
/** @var SupplierProposalLine $line */
'@phan-var-force SupplierProposal $this';
'@phan-var-force SupplierProposalLine $line';
$this->updateline(
$line->id,
$line->subprice,
@ -2861,6 +2869,8 @@ abstract class CommonObject
case 'order_supplier':
/** @var CommandeFournisseur $this */
/** @var CommandeFournisseurLigne $line */
'@phan-var-force CommandeFournisseur $this';
'@phan-var-force CommandeFournisseurLigne $line';
$this->updateline(
$line->id,
($line->description ? $line->description : $line->desc),
@ -2885,6 +2895,8 @@ abstract class CommonObject
case 'invoice_supplier':
/** @var FactureFournisseur $this */
/** @var SupplierInvoiceLine $line */
'@phan-var-force FactureFournisseur $this';
'@phan-var-force SupplierInvoiceLIne $line';
$this->updateline(
$line->id,
($line->description ? $line->description : $line->desc),
@ -4028,8 +4040,9 @@ abstract class CommonObject
$this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0;
// Situations totals
if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { // @phan-suppress-current-line PhanUndeclaredProperty
'@phan-var-force Facture $this';
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded
if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line
if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) {
$prev_sits = $this->get_prev_sits();
@ -4353,6 +4366,7 @@ abstract class CommonObject
if (class_exists($className)) {
foreach ($objectids as $i => $objectid) { // $i is rowid into llx_element_element
$object = new $className($this->db);
'@phan-var-force CommonObject $object';
$ret = $object->fetch($objectid);
if ($ret >= 0) {
$this->linkedObjects[$objecttype][$i] = $object;
@ -4459,13 +4473,13 @@ abstract class CommonObject
/**
* Delete all links between an object $this
*
* @param int $sourceid Object source id
* @param ?int $sourceid Object source id
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param ?int $targetid Object target id
* @param string $targettype Object target type
* @param int $rowid Row id of line to delete. If defined, other parameters are not used.
* @param User $f_user User that create
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @param ?User $f_user User that create
* @param int<0,1> $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if OK, <0 if KO
* @see add_object_linked(), updateObjectLinked(), fetchObjectLinked()
*/
@ -4631,7 +4645,7 @@ abstract class CommonObject
* Set status of an object.
*
* @param int $status Status to set
* @param int $elementId Id of element to force (use this->id by default if null)
* @param ?int $elementId Id of element to force (use this->id by default if null)
* @param string $elementType Type of element to force (use this->table_element by default)
* @param string $trigkey Trigger key to use for trigger. Use '' means automatic but it is not recommended and is deprecated.
* @param string $fieldstatus Name of status field in this->table_element
@ -5269,7 +5283,7 @@ abstract class CommonObject
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param int $selected ID line selected
* @param Extrafields $extrafields Object of extrafields
* @param ?Extrafields $extrafields Object of extrafields
* @param string $defaulttpldir Directory where to find the template (deprecated)
* @return void
*/
@ -5519,6 +5533,7 @@ abstract class CommonObject
}
if (!empty($line->desc)) {
'@phan-var-force OrderLine|FactureLigne|ContratLigne|FactureFournisseurLigneRec|SupplierInvoiceLine|SupplierProposalLine $line';
if ($line->desc == '(CREDIT_NOTE)') { // TODO Not sure this is used for source object
$discount = new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
@ -5854,6 +5869,8 @@ abstract class CommonObject
if ($obj instanceof ModelePDFMember) {
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, 'tmp_cards');
} else {
// TODO: Try to set type above again
'@phan-var-force ModeleBarCode|ModeleDon|ModeleExports|ModeleImports|ModelePDFAsset|ModelePDFContract|ModelePDFDeliveryOrder|ModelePDFEvaluation|ModelePDFFactures|ModelePDFFicheinter|ModelePDFMo|ModelePDFMovement|ModelePDFProduct|ModelePDFProjects|ModelePDFPropales|ModelePDFRecruitmentJobPosition|ModelePDFStock|ModelePDFStockTransfer|ModelePDFSupplierProposal|ModelePDFSuppliersInvoices|ModelePDFSuppliersOrders|ModelePDFSuppliersPayments|ModelePDFTask|ModelePDFTicket|ModelePDFUser|ModelePDFUserGroup|ModelePdfExpedition|ModelePdfReception|ModeleThirdPartyDoc $obj';
$resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams);
}
// After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index.
@ -6357,8 +6374,8 @@ abstract class CommonObject
if (empty($rowid)) {
$rowid = $this->id;
}
if (empty($rowid) && isset($this->rowid)) {
$rowid = $this->rowid; // deprecated
if (empty($rowid) && isset($this->rowid)) { // @phan-suppress-current-line PhanUndeclaredProperty
$rowid = $this->rowid; // deprecated @phan-suppress-current-line PhanUndeclaredProperty
}
// To avoid SQL errors. Probably not the better solution though
@ -6704,6 +6721,7 @@ abstract class CommonObject
$new_array_options[$key] = '';
} elseif ($value) {
$object = new $InfoFieldList[0]($this->db);
'@phan-var-force CommonObject $object';
if (is_numeric($value)) {
$res = $object->fetch($value); // Common case
} else {
@ -6884,7 +6902,7 @@ abstract class CommonObject
if (is_array($value) || (!is_numeric($value) && $value != '')) {
$this->errors[] = $langs->trans("ExtraLanguageHasWrongValue", $attributeLabel);
return -1;
} elseif ($value == '') {
} elseif ($value == '') { // @phan-suppress-current-line PhanTypeComparisonFromArray
$new_array_languages[$key] = null;
}
break;
@ -8060,7 +8078,7 @@ abstract class CommonObject
$isDependList = 1;
}
$data[$obj->rowid] = $labeltoshow;
$data[(int) $obj->rowid] = $labeltoshow;
}
$i++;
@ -8073,7 +8091,7 @@ abstract class CommonObject
}
} else {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%');
}
}
@ -8590,13 +8608,16 @@ abstract class CommonObject
if ($classname && class_exists($classname)) {
$object = new $classname($this->db);
'@phan-var-force CommonObject $object';
if ($object->element === 'product') { // Special case for product because default valut of fetch are wrong
'@phan-var-force Product $object';
$result = $object->fetch($value, '', '', '', 0, 1, 1);
} else {
$result = $object->fetch($value);
}
if ($result > 0) {
if ($object->element === 'product') {
'@phan-var-force Product $object';
$get_name_url_param_arr = array($getnomurlparam, $getnomurlparam2, 0, -1, 0, '', 0);
if (isset($val['get_name_url_params'])) {
$get_name_url_params = explode(':', $val['get_name_url_params']);
@ -10266,7 +10287,7 @@ abstract class CommonObject
* Load object in memory from the database. This does not load line. This is done by parent fetch() that call fetchCommon
*
* @param int $id Id object
* @param string $ref Ref
* @param ?string $ref Ref
* @param string $morewhere More SQL filters (' AND ...')
* @param int<0,1> $noextrafields 0=Default to load extrafields, 1=No extrafields
* @return int<-4,1> Return integer <0 if KO, 0 if not found, >0 if OK

View File

@ -930,6 +930,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
// Recursive function to copy all subdirectories and contents:
if (is_dir($ossrcfile)) {
$dir_handle = opendir($ossrcfile);
$tmpresult = 0; // Initialised before loop to keep old behavior, may be needed inside loop
while ($file = readdir($dir_handle)) {
if ($file != "." && $file != ".." && !is_link($ossrcfile."/".$file)) {
if (is_dir($ossrcfile."/".$file)) {
@ -998,13 +999,13 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep
* - Database indexes for files are updated.
* - Test on virus is done only if param testvirus is provided and an antivirus was set.
*
* @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory)
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
* @param string $newmask Mask in octal string for new file ('0' by default means $conf->global->MAIN_UMASK)
* @param int $overwriteifexists Overwrite file if exists (1 by default)
* @param int $testvirus Do an antivirus test. Move is canceled if a virus is found.
* @param int $indexdatabase Index new file into database.
* @param array $moreinfo Array with more information to set in index table
* @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory)
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
* @param string $newmask Mask in octal string for new file ('0' by default means $conf->global->MAIN_UMASK)
* @param int<0,1> $overwriteifexists Overwrite file if exists (1 by default)
* @param int<0,1> $testvirus Do an antivirus test. Move is canceled if a virus is found.
* @param int<0,1> $indexdatabase Index new file into database.
* @param array<string,mixed> $moreinfo Array with more information to set in index table
* @return boolean True if OK, false if KO
* @see dol_move_uploaded_file()
*/
@ -1795,9 +1796,12 @@ function dol_meta_create($object)
dol_mkdir($dir);
}
$meta = '';
if (is_dir($dir)) {
if (is_countable($object->lines) && count($object->lines) > 0) {
$nblines = count($object->lines);
} else {
$nblines = 0;
}
$client = $object->thirdparty->name." ".$object->thirdparty->address." ".$object->thirdparty->zip." ".$object->thirdparty->town;
$meta = "REFERENCE=\"".$object->ref."\"
@ -1867,15 +1871,15 @@ function dol_init_file_process($pathtoscan = '', $trackid = '')
* All information used are in db, conf, langs, user and _FILES.
* Note: This function can be used only into a HTML page context.
*
* @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename)
* @param int $allowoverwrite 1=Allow overwrite existing file
* @param int $updatesessionordb 1=Do no edit _SESSION variable but update database index. 0=Update _SESSION and not database index. -1=Do not update SESSION neither db.
* @param string $varfiles _FILES var name
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param string $link Link to add (to add a link instead of a file)
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
* @param int $generatethumbs 1=Generate also thumbs for uploaded image files
* @param Object $object Object used to set 'src_object_*' fields
* @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename)
* @param int<0,1> $allowoverwrite 1=Allow overwrite existing file
* @param int<-1,1> $updatesessionordb 1=Do no edit _SESSION variable but update database index. 0=Update _SESSION and not database index. -1=Do not update SESSION neither db.
* @param string $varfiles _FILES var name
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
* @param ?string $link Link to add (to add a link instead of a file)
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
* @param int<0,1> $generatethumbs 1=Generate also thumbs for uploaded image files
* @param ?Object $object Object used to set 'src_object_*' fields
* @return int Return integer <=0 if KO, >0 if OK
* @see dol_remove_file_process()
*/
@ -2351,6 +2355,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
dol_syslog("dol_compress_file mode=".$mode." inputfile=".$inputfile." outputfile=".$outputfile);
$data = implode("", file(dol_osencode($inputfile)));
$compressdata = null;
if ($mode == 'gz' && function_exists('gzencode')) {
$foundhandler = 1;
$compressdata = gzencode($data, 9);
@ -2385,6 +2390,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
new RecursiveDirectoryIterator($rootPath, FilesystemIterator::UNIX_PATHS),
RecursiveIteratorIterator::LEAVES_ONLY
);
'@phan-var-force SplFileInfo[] $files';
foreach ($files as $name => $file) {
// Skip directories (they would be added automatically)
@ -2437,7 +2443,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
}
}
if ($foundhandler) {
if ($foundhandler && is_string($compressdata)) {
$fp = fopen($outputfile, "w");
fwrite($fp, $compressdata);
fclose($fp);
@ -2466,7 +2472,7 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
*
* @param string $inputfile File to uncompress
* @param string $outputdir Target dir name
* @return array array('error'=>'Error code') or array() if no error
* @return array{error?:string} array('error'=>'Error code') or array() if no error
* @see dol_compress_file(), dol_compress_dir()
*/
function dol_uncompress($inputfile, $outputdir)
@ -2657,6 +2663,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
new RecursiveDirectoryIterator($inputdir, FilesystemIterator::UNIX_PATHS),
RecursiveIteratorIterator::LEAVES_ONLY
);
'@phan-var-force SplFileInfo[] $files';
//var_dump($inputdir);
foreach ($files as $name => $file) {
@ -2909,19 +2916,19 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = 1;
}
$original_file = $conf->contract->multidir_output[$entity].'/'.$original_file;
} elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) {
} elseif (($modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) {
// Wrapping pour les apercu supplier proposal
if ($fuser->hasRight('supplier_proposal', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->supplier_proposal->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) {
} elseif (($modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) {
// Wrapping pour les apercu supplier order
if ($fuser->hasRight('fournisseur', 'commande', $lire)) {
$accessallowed = 1;
}
$original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file;
} elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) {
} elseif (($modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) {
// Wrapping pour les apercu supplier invoice
if ($fuser->hasRight('fournisseur', $lire)) {
$accessallowed = 1;
@ -3246,7 +3253,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} elseif ($modulepart == 'payment') {
// Wrapping pour les rapport de paiements
// Wrapping pour les rapport de paiements
if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
@ -3584,12 +3591,12 @@ function dirbasename($pathfile)
* Function to get list of updated or modified files.
* $file_list is used as global variable
*
* @param array $file_list Array for response
* @param array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list Array for response
* @param SimpleXMLElement $dir SimpleXMLElement of files to test
* @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
* @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
* @param array $checksumconcat Array of checksum
* @return array Array of filenames
* @param string $path Path of files relative to $pathref. We start with ''. Used by recursive calls.
* @param string $pathref Path ref (DOL_DOCUMENT_ROOT)
* @param string[] $checksumconcat Array of checksum
* @return array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list Array of filenames
*/
function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathref = '', &$checksumconcat = array())
{

View File

@ -894,11 +894,11 @@ function array2table($data, $tableMarkup = 1, $tableoptions = '', $troptions = '
* @param string $field Field containing already used values of counter
* @param string $where To add a filter on selection (for example to filter on invoice types)
* @param Societe|'' $objsoc The company that own the object we need a counter for
* @param string $date Date to use for the {y},{m},{d} tags.
* @param int|'' $date Date to use for the {y},{m},{d} tags. is timestamp or '' to use dol_now()
* @param string $mode 'next' for next value or 'last' for last value
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
* @param User $objuser Object user we need data from.
* @param int $forceentity Entity id to force
* @param string $forceentity Entity id to force, can be '0' or '1' or '1,2' etc
* @return string New value (numeric) or error message
*/
function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $date = '', $mode = 'next', $bentityon = true, $objuser = null, $forceentity = null)

View File

@ -1290,7 +1290,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_') {
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, '', 1);
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, 0, 1);
if ($result <= 0) {
$error++;
}
@ -1315,7 +1315,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_') {
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, '', 1);
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, 0, 1);
if ($result <= 0) {
$error++;
}
@ -1340,7 +1340,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 9) == 'functions') {
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, '', 1);
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, 0, 1);
if ($result <= 0) {
$error++;
}
@ -1365,7 +1365,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'data') {
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, '', 1);
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, 0, 1);
if ($result <= 0) {
$error++;
}
@ -1390,7 +1390,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
}
if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 6) == 'update') {
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, '', 1);
$result = run_sql($dir.$file, !getDolGlobalString('MAIN_DISPLAY_SQL_INSTALL_LOG') ? 1 : 0, 0, 1);
if ($result <= 0) {
$error++;
}

View File

@ -152,7 +152,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
$fuser->fetch($object->fk_user_author);
}
$numFinal = get_next_value($db, $mask, 'expensereport', 'ref', '', null, (string) $date, 'next', true, $fuser);
$numFinal = get_next_value($db, $mask, 'expensereport', 'ref', '', null, $date, 'next', true, $fuser);
return $numFinal;
}

View File

@ -4,6 +4,7 @@
* Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com>
* Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com>
* 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
* it under the terms of the GNU General Public License as published by
@ -317,7 +318,7 @@ if ($action == 'presend') {
$element = $subelement = 'contrat';
}
if ($element == 'inter') {
$element = $subelement = 'ficheinter';
$element = $subelement = 'fichinter';
}
if ($element == 'shipping') {
$element = $subelement = 'expedition';

View File

@ -60,8 +60,11 @@ $disablemove = 1;
if (in_array($modulepart, array('product', 'produit', 'societe', 'user', 'ticket', 'holiday', 'expensereport'))) {
$disablemove = 0;
}
$parameters = array();
$reshook = $hookmanager->executeHooks('isLinkedDocumentObjectNotMovable', $parameters, $object);
if ($reshook) {
$disablemove = $hookmanager->resArray['disablemove'];
}
/*
* Confirm form to delete a file

View File

@ -868,6 +868,8 @@ if (empty($reshook)) {
$form = new Form($db);
$formfile = new FormFile($db);
$formcontract = null;
$formproject = null;
if (isModEnabled('contract')) {
$formcontract = new FormContract($db);
}
@ -1015,7 +1017,7 @@ if ($action == 'create') {
}
// Contract
if (isModEnabled('contract')) {
if (isModEnabled('contract') && is_object($formcontract)) {
$langs->load("contracts");
print '<tr><td>'.$langs->trans("Contract").'</td><td>';
$numcontrat = $formcontract->select_contract($soc->id, GETPOSTINT('contratid'), 'contratid', 0, 1, 1);
@ -1726,6 +1728,7 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook)) {
$params = array();
if ($user->socid == 0) {
if ($action != 'editdescription' && ($action != 'presend')) {
// Validate
@ -1775,15 +1778,18 @@ if ($action == 'create') {
print '</div>';
}
$arrayofcreatebutton = array();
// Proposal
if (isModEnabled("service") && isModEnabled("propal") && $object->statut > Fichinter::STATUS_DRAFT) {
$langs->load("propal");
if ($object->statut < Fichinter::STATUS_BILLED) {
if ($user->hasRight('propal', 'creer')) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddProp").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddProp").'</a></div>';
}
$arrayofcreatebutton[] = array(
'url' => '/comm/propal/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
'label' => $langs->trans('AddProp'),
'lang' => 'propal',
'perm' => $user->hasRight('propal', 'creer'),
'enabled' => true,
);
}
}
@ -1791,11 +1797,13 @@ if ($action == 'create') {
if (isModEnabled('invoice') && $object->statut > Fichinter::STATUS_DRAFT) {
$langs->load("bills");
if ($object->statut < Fichinter::STATUS_BILLED) {
if ($user->hasRight('facture', 'creer')) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("AddBill").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("AddBill").'</a></div>';
}
$arrayofcreatebutton[] = array(
'url' => '/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid,
'label' => $langs->trans('AddBill'),
'lang' => 'bills',
'perm' => $user->hasRight('facture', 'creer'),
'enabled' => true,
);
}
if (getDolGlobalString('FICHINTER_CLASSIFY_BILLED')) { // Option deprecated. In a future, billed must be managed with a dedicated field to 0 or 1
@ -1807,6 +1815,10 @@ if ($action == 'create') {
}
}
if (count($arrayofcreatebutton)) {
print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayofcreatebutton, '', true, $params);
}
// Sign
if ($object->statut > Fichinter::STATUS_DRAFT) {
if ($object->signed_status != Fichinter::$SIGNED_STATUSES['STATUS_SIGNED_ALL']) {

View File

@ -129,4 +129,5 @@ ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2
ALTER TABLE llx_product_attribute_combination2val ADD INDEX idx_product_att_com2v_prod_attr_val (fk_prod_attr_val);
ALTER TABLE llx_societe ADD COLUMN ip varchar(250);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN ip varchar(250);
ALTER TABLE llx_recruitment_recruitmentcandidature ADD COLUMN ip varchar(250);
ALTER TABLE llx_socpeople ADD COLUMN ip varchar(250);

View File

@ -67,5 +67,6 @@ create table llx_socpeople
default_lang varchar(6),
canvas varchar(32), -- type of canvas if used (null by default)
import_key varchar(14),
statut tinyint DEFAULT 1 NOT NULL
statut tinyint DEFAULT 1 NOT NULL,
ip varchar(250) --ip used to create record (for public submission page)
)ENGINE=innodb;

View File

@ -239,7 +239,7 @@ if ($ok && GETPOST('standard', 'alpha')) {
$name = substr($file, 0, dol_strlen($file) - 4);
// Run sql script
$ok = run_sql($dir.$file, 0, '', 1);
$ok = run_sql($dir.$file, 0, 0, 1);
}
}

View File

@ -3,7 +3,8 @@
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* 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
@ -358,7 +359,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
print '<tr><td class="nowrap">'.$langs->trans("ChoosedMigrateScript").'</td><td class="right">'.$file.'</td></tr>'."\n";
// Run sql script
$ok = run_sql($dir.$file, 0, '', 1, '', 'default', 32768, 0, 0, 2, 0, $db->database_name);
$ok = run_sql($dir.$file, 0, 0, 1, '', 'default', 32768, 0, 0, 2, 0, $db->database_name);
$listoffileprocessed[$dir.$file] = $dir.$file;
@ -394,7 +395,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
print '<tr><td class="nowrap">'.$langs->trans("ChoosedMigrateScript").' (external modules)</td><td class="right">'.$modulefileshort.'</td></tr>'."\n";
// Run sql script
$okmodule = run_sql($modulefilelong, 0, '', 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not.
$okmodule = run_sql($modulefilelong, 0, 0, 1); // Note: Result of migration of external module should not decide if we continue migration of Dolibarr or not.
$listoffileprocessed[$modulefilelong] = $modulefilelong;
}
}

View File

@ -4363,7 +4363,7 @@ function migrate_reload_menu($db, $langs, $conf)
$dir = DOL_DOCUMENT_ROOT."/core/menus/";
$file = 'init_menu_'.$key.'.sql';
if (file_exists($dir.$file)) {
$result = run_sql($dir.$file, 1, '', 1, $key);
$result = run_sql($dir.$file, 1, 0, 1, $key);
}
print '</td></tr>';

View File

@ -235,7 +235,10 @@ class FormProduct
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return full path to current warehouse in $tab (recursive function)
*
* Set Hidden conf MAIN_WAREHOUSE_LIST_DISPLAY_MODE at 0 || 1 || 2 to unlock display
* 0 : Default behavior, display parents of warehouse
* 1 : Display only current warehouse label only
* 2 : Display last parent warehouse label
* @param array $tab warehouse data in $this->cache_warehouses line
* @param string $final_label full label with all parents, separated by ' >> ' (completed on each call)
* @return string full label with all parents, separated by ' >> '
@ -247,11 +250,14 @@ class FormProduct
$final_label = $tab['label'];
}
if (empty($tab['parent_id'])) {
if (empty($tab['parent_id']) || getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') === 1) {
return $final_label;
} else {
if (!empty($this->cache_warehouses[$tab['parent_id']])) {
$final_label = $this->cache_warehouses[$tab['parent_id']]['label'].' >> '.$final_label;
if (getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') !== 2 || (getDolGlobalInt('MAIN_WAREHOUSE_LIST_DISPLAY_MODE') === 2 && empty($this->cache_warehouses[$tab['parent_id']]['parent_id']))) {
$final_label = $this->cache_warehouses[$tab['parent_id']]['label'] . ' >> ' . $final_label;
}
return $this->get_parent_path($this->cache_warehouses[$tab['parent_id']], $final_label);
}
}

View File

@ -1436,7 +1436,7 @@ class ProductAttribute extends CommonObject
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param int $selected Object line selected
* @param Extrafields $extrafields Object of extrafields
* @param ?Extrafields $extrafields Object of extrafields
* @param string $defaulttpldir Directory where to find the template (deprecated)
* @return void
*/

View File

@ -1318,7 +1318,7 @@ class Website extends CommonObject
}
// Load sql record
$runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1, 0, 0, 1); // The maxrowid of table is searched into this function two
$runsql = run_sql($sqlfile, 1, 0, 0, '', 'none', 0, 1, 0, 0, 1); // The maxrowid of table is searched into this function two
if ($runsql <= 0) {
$this->errors[] = 'Failed to load sql file '.$sqlfile.' (ret='.((int) $runsql).')';
$error++;

View File

@ -58,7 +58,6 @@ parameters:
- '#(?:Else branch is unreachable because (?:(?:previous|ternary operator) condition)) is always true#'
- '#(?:(?:Elsei|I)f condition|Left side of (?:&&|\|\|)|Negated boolean expression|R(?:esult of (?:&&|\|\|)|ight side of (?:&&|\|\|))|Ternary operator condition) is always true#'
- '#is_object\(\) with mixed will always evaluate to false#'
- '#(?:is_resource\(\) with XMLParser will always) evaluate to false#'
- '#Empty array passed to foreach#'
- '#in empty\(\) always exists and is (not|always) falsy#'
- '#in empty\(\) is not falsy#'
@ -75,14 +74,12 @@ parameters:
- '# SMTPs::(getFrom|getErrorsTo|getReplyTo)\(\) expects bool, string given.#'
- '# (dolibarr_set_const|yn|getLocalTaxesFromRate) expects int\|string#'
- '#::(options)\(\) expects int\|string#'
- '# (print_barre_liste|getCurrentPeriodOfFiscalYear|dol_substr|get_next_value) expects int\|null#'
- '# (print_barre_liste|getCurrentPeriodOfFiscalYear|dol_substr) expects int\|null#'
- '#(?:colorAdjustBrightness|imap_(?:(?:fetch)?body|fetchstructure)) expects int, string#'
- '# (Setup|Asset|Proposals|Orders|Invoices|FactureRec|BonPrelevement|Products|Thirdparties)::_fetch\S*\(\) expects int, string#'
- '#(sendTicketMessageByEmail|addItemsFact|update_price|recur|addDepreciationLine|addline|generate|buildRumNumber|update|update_label|getSelectConditionsPaiements|select_state|listBoxes|addLineRec|literalBarcodeType)\(\) expects int, string#'
- '#run_sql expects int, string#'
- '#on array{url: mixed} in empty\(\) does not exist.#'
- '#EvalMath::trigger\(\) expects string, int given#'
- '#get_next_value expects string, int given#'
- '# Diff::generatePartialDiff\(\) expects array#'
- '# EmailCollector::getpart\(\) expects string#'
- '#expects int, float#'
@ -95,8 +92,6 @@ parameters:
- '#(?:(?:EvalMath::trigger|F(?:acture(?:(?:Fournisseur)?Rec::addline)|ichinterRec::addLineRec)|SMTPs::socket_send_str)\(\)|dolMd2Html|setEventMessages) expects string\|null#'
- '# (envoi_mail|sendEmailTo) expects string, \(float\|int\) given.#'
- '#::printStdColumnContent\(\) expects string, float(\|(int|array)(\<.*\>)?)* given.#'
- '~(?:Parameter #3 \$morecss of function) img_warning expects string, \(float\|int\)~'
- '~(?:Parameter #2 \$moreatt of function) img_warning expects string, float~'
- '#::HTML2OpenIDServer\(\) expects string, array given.#'
- '#create_line\(\) expects string, float given.#'
- '# dol_stringtotime expects string, DateTime given.#'