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

This commit is contained in:
Laurent Destailleur 2023-12-11 15:38:25 +01:00
commit 73ac9b3f5f
54 changed files with 675 additions and 280 deletions

View file

@ -82,18 +82,17 @@ Scope is the web application (backoffice) and the APIs.
## Examples of vulnerabilities that are Non-qualified for reporting.
* "Self" XSS
* SSL/TLS best practices
* Denial of Service attacks
* Clickjacking/UI redressing
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device
* Presence of autocomplete attribute on web forms
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
* Logout and other instances of low-severity Cross-Site Request Forgery
* Missing security-related HTTP headers which do not lead directly to a vulnerability
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
* Reports on features flagged as "experimental" or "development"
* Software version or private IP disclosure when logged-in user is admin
* Reports on features on modules flagged as "deprecated", "experimental" or "development" if the module needs to be enabled for that (this is not the case on production).
* Software or libraries versions or private IP disclosure when logged-in user is admin
* Stack traces or path disclosure when logged-in user is admin
* Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities".
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the fail2ban recommended fail2ban rules were not installed.
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the recommended fail2ban rules were not installed.
* SSL/TLS best practices
* Denial of Service attacks
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device

View file

@ -0,0 +1,124 @@
{
"id": "evt_123456789",
"object": "event",
"api_version": "2023-10-16",
"created": 1702053463,
"data": {
"object": {
"id": "pi_123456789",
"object": "payment_intent",
"amount": 60,
"amount_capturable": 0,
"amount_details": {
"tip": {
}
},
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_123456789_secret_123456789",
"confirmation_method": "automatic",
"created": 1702053448,
"currency": "eur",
"customer": "cus_123456789",
"description": "Stripe payment from makeStripeSepaRequest: DID=31262-INV=123-CUS=123 did=123 ref=FA2312-123",
"invoice": null,
"last_payment_error": {
"code": "",
"decline_code": "generic_decline",
"message": "The transaction can't be processed because your customer's account information is missing or incorrect. Collect a new mandate and ask your customer to provide their name and address exactly as it appears on their bank account. After this, you can attempt the transaction again.",
"payment_method": {
"id": "pm_123456789",
"object": "payment_method",
"billing_details": {
"address": {
"city": null,
"country": "FR",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "email@example.com",
"name": "Test example",
"phone": null
},
"created": 1692688898,
"customer": "cus_123456789",
"livemode": false,
"metadata": {
"dol_version": "19.0.0-dev",
"dol_thirdparty_id": "123",
"ipaddress": "1.2.3.4",
"dol_id": "123",
"dol_type": "companypaymentmode",
"dol_entity": "1"
},
"sepa_debit": {
"bank_code": "123",
"branch_code": "",
"country": "AT",
"fingerprint": "123456789",
"generated_from": {
"charge": null,
"setup_attempt": null
},
"last4": "3202"
},
"type": "sepa_debit"
},
"type": "card_error"
},
"latest_charge": "py_123456789",
"livemode": false,
"metadata": {
"dol_version": "19.0.0-beta",
"dol_thirdparty_id": "123",
"ipaddress": "1.2.3.4",
"dol_id": "123",
"dol_type": "facture",
"dol_entity": "1"
},
"next_action": null,
"on_behalf_of": null,
"payment_method": null,
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
},
"sepa_debit": {
}
},
"payment_method_types": [
"card",
"sepa_debit"
],
"processing": null,
"receipt_email": null,
"review": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"statement_descriptor": "DID=123-",
"statement_descriptor_suffix": "DID=123-",
"status": "requires_payment_method",
"transfer_data": null,
"transfer_group": null
}
},
"livemode": false,
"pending_webhooks": 1,
"request": {
"id": null,
"idempotency_key": null
},
"type": "payment_intent.payment_failed"
}

View file

@ -263,6 +263,7 @@ if (isset($current_fiscal_period)) {
'label' => $langs->trans('DateEnd'),
'value' => $current_fiscal_period['date_end']
);
$formconfirm = $form->formconfirm(
$_SERVER["PHP_SELF"] . '?fiscal_period_id=' . $current_fiscal_period['id'],
$langs->trans('AccountancyClosureAccountingReversal'),

View file

@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$action = GETPOST('action', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'admincompany'; // To manage different context of search
$page_y = GETPOSTINT('page_y');
// Load translation files required by the page
$langs->loadLangs(array('admin', 'companies', 'bills'));
@ -137,7 +138,8 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
dol_mkdir($dirforimage);
}
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
if ($result > 0) {
if (is_numeric($result) && $result > 0) {
$constant = "MAIN_INFO_SOCIETE_LOGO";
if ($varforimage == 'logo_squarred') {
$constant = "MAIN_INFO_SOCIETE_LOGO_SQUARRED";
@ -267,7 +269,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
}
if ($action != 'updateedit' && !$error) {
header("Location: ".$_SERVER["PHP_SELF"]);
header("Location: ".$_SERVER["PHP_SELF"].($page_y ? '?page_y='.$page_y : ''));
exit;
}
}
@ -426,6 +428,7 @@ if (!empty($conf->use_javascript_ajax)) {
print '<form enctype="multipart/form-data" method="POST" action="'.$_SERVER["PHP_SELF"].'" name="form_index">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="page_y" value="">';
print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th></th></tr>'."\n";
@ -499,7 +502,7 @@ if (isModEnabled('barcode')) {
print '<tr class="oddeven"><td>';
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
print '<span class="fa fa-barcode pictofixedwidth"></span>';
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_GENCODE') ? $conf->global->MAIN_INFO_SOCIETE_GENCODE : ''))).'"></td></tr>';
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_GENCOD', '')).'"></td></tr>';
print '</td></tr>';
}
@ -518,6 +521,9 @@ if ($maxmin > 0) {
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo" id="logo" accept="image/*">';
print '</div>';
if (!empty($mysoc->logo_small)) {
print '<div class="inline-block valignmiddle marginrightonly">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
print '</div>';
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
print '<div class="inline-block valignmiddle">';
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
@ -531,9 +537,6 @@ if (!empty($mysoc->logo_small)) {
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
print '</div>';
} elseif (!empty($mysoc->logo)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
print '<div class="inline-block valignmiddle">';
@ -542,7 +545,7 @@ if (!empty($mysoc->logo_small)) {
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
print '</div>';
}
}
@ -560,6 +563,9 @@ if ($maxmin > 0) {
print '<input type="file" class="flat minwidth100 maxwidthinputfileonsmartphone" name="logo_squarred" id="logo_squarred" accept="image/*">';
print '</div>';
if (!empty($mysoc->logo_squarred_small)) {
print '<div class="inline-block valignmiddle marginrightonly">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a>';
print '</div>';
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
print '<div class="inline-block valignmiddle marginrightonly">';
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
@ -573,7 +579,6 @@ if (!empty($mysoc->logo_squarred_small)) {
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
print '</div>';
}
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} elseif (!empty($mysoc->logo_squarred)) {
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
print '<div class="inline-block valignmiddle">';
@ -582,7 +587,7 @@ if (!empty($mysoc->logo_squarred_small)) {
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
} else {
print '<div class="inline-block valignmiddle">';
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
print '</div>';
}
}
@ -596,8 +601,9 @@ print '</td></tr>';
print '</table>';
print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
print '<br>';
print '<br><br>';
// IDs of the company (country-specific)
@ -765,6 +771,9 @@ print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs-
print $formother->select_month(getDolGlobalString('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
print "</table>";
print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
print '<br>';
@ -947,7 +956,7 @@ if ($mysoc->country_code == 'GR') {
print "</table>";
}
print $form->buttonsSaveCancel("Save", '');
print $form->buttonsSaveCancel("Save", '', array(), false, 'reposition');
print '</form>';

View file

@ -776,7 +776,7 @@ if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_SUPPORTS_SERVICES');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, $conf->global->STOCK_SUPPORTS_SERVICES);
print $form->selectarray("STOCK_SUPPORTS_SERVICES", $arrval, getDolGlobalString('STOCK_SUPPORTS_SERVICES'));
}
print "</td>\n";
print "</tr>\n";

View file

@ -186,16 +186,20 @@ if (isModEnabled('multicompany') && $user->entity) {
// Output mode
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print load_fiche_titre($langs->trans("SyslogOutput"), '', '');
// Mode
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Value").'</td>';
print '<td class="right" colspan="2"><input type="submit" class="button" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '<td class="center width150"><input type="submit" class="button small" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
foreach ($syslogModules as $moduleName) {
@ -209,9 +213,9 @@ foreach ($syslogModules as $moduleName) {
print '<tr class="oddeven">';
print '<td width="140">';
print '<input class="oddeven" type="checkbox" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
print $module->getName();
print '<td class="nowraponall" width="140">';
print '<input class="oddeven" type="checkbox" id="syslog_handler_'.$moduleName.'" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
print '<label for="syslog_handler_'.$moduleName.'">'.$module->getName().'</label>';
if ($moduleName == 'mod_syslog_syslog') {
if (!$module->isActive()) {
$langs->load("errors");
@ -235,22 +239,23 @@ foreach ($syslogModules as $moduleName) {
$value = (isset($option['default']) ? $option['default'] : '');
}
print $option['name'].': <input type="text" class="flat" name="'.$option['constant'].'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
print '<span class="hideonsmartphone opacitymedium">'.$option['name'].': </span><input type="text" class="flat'.(empty($option['css']) ? '' : ' '.$option['css']).'" name="'.dol_escape_htmltag($option['constant']).'" value="'.$value.'"'.(isset($option['attr']) ? ' '.$option['attr'] : '').'>';
if (!empty($option['example'])) {
print '<br>'.$langs->trans("Example").': '.$option['example'];
print '<br>'.$langs->trans("Example").': '.dol_escape_htmltag($option['example']);
}
if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/', $value)) {
$filelogparam = ' (<a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
$filelogparam = ' &nbsp; &nbsp; <a href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='.basename($value).'">';
$filelogparam .= $langs->trans('Download');
$filelogparam .= ' '.basename($value).'</a>)';
$filelogparam .= img_picto($langs->trans('Download').' '.basename($value), 'download', 'class="paddingleft"');
$filelogparam .= '</a>';
print $filelogparam;
}
}
}
print '</td>';
print '<td class="left">';
print '<td class="center">';
if ($module->getInfo()) {
print $form->textwithpicto('', $module->getInfo(), 1, 'help');
}
@ -262,42 +267,54 @@ foreach ($syslogModules as $moduleName) {
}
print "</table>\n";
print "</div>\n";
print "</form>\n";
print '<br>'."\n\n";
print load_fiche_titre($langs->trans("SyslogLevel"), '', '');
// Level
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print load_fiche_titre($langs->trans("SyslogLevel"), '', '');
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setlevel">';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td>';
print '<td class="right"><input type="submit" class="button" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
print '<td class="center width150"><input type="submit" class="button small" '.$optionmc.' value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogLevel").'</td>';
print '<td colspan="2"><select class="flat" name="level" '.$optionmc.'>';
print '<tr class="oddeven"><td>'.$langs->trans("SyslogLevel").'</td>';
print '<td colspan="2"><select class="flat minwidth400" id="level" name="level" '.$optionmc.'>';
print '<option value="'.LOG_EMERG.'" '.($conf->global->SYSLOG_LEVEL == LOG_EMERG ? 'SELECTED' : '').'>LOG_EMERG ('.LOG_EMERG.')</option>';
print '<option value="'.LOG_ALERT.'" '.($conf->global->SYSLOG_LEVEL == LOG_ALERT ? 'SELECTED' : '').'>LOG_ALERT ('.LOG_ALERT.')</option>';
print '<option value="'.LOG_CRIT.'" '.($conf->global->SYSLOG_LEVEL == LOG_CRIT ? 'SELECTED' : '').'>LOG_CRIT ('.LOG_CRIT.')</option>';
print '<option value="'.LOG_ERR.'" '.($conf->global->SYSLOG_LEVEL == LOG_ERR ? 'SELECTED' : '').'>LOG_ERR ('.LOG_ERR.')</option>';
print '<option value="'.LOG_WARNING.'" '.($conf->global->SYSLOG_LEVEL == LOG_WARNING ? 'SELECTED' : '').'>LOG_WARNING ('.LOG_WARNING.')</option>';
print '<option value="'.LOG_NOTICE.'" '.($conf->global->SYSLOG_LEVEL == LOG_NOTICE ? 'SELECTED' : '').'>LOG_NOTICE ('.LOG_NOTICE.')</option>';
print '<option value="'.LOG_WARNING.'" '.($conf->global->SYSLOG_LEVEL == LOG_WARNING ? 'SELECTED' : '').'">LOG_WARNING ('.LOG_WARNING.')</option>';
print '<option value="'.LOG_NOTICE.'" '.($conf->global->SYSLOG_LEVEL == LOG_NOTICE ? 'SELECTED' : '').' data-html="'.dol_escape_htmltag('LOG_NOTICE ('.LOG_NOTICE.') - <span class="opacitymedium">'.$langs->trans("RecommendedForProduction").'</span>').'">LOG_NOTICE ('.LOG_NOTICE.')</option>';
print '<option value="'.LOG_INFO.'" '.($conf->global->SYSLOG_LEVEL == LOG_INFO ? 'SELECTED' : '').'>LOG_INFO ('.LOG_INFO.')</option>';
print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL >= LOG_DEBUG ? 'SELECTED' : '').'>LOG_DEBUG ('.LOG_DEBUG.')</option>';
print '<option value="'.LOG_DEBUG.'" '.($conf->global->SYSLOG_LEVEL >= LOG_DEBUG ? 'SELECTED' : '').' data-html="'.dol_escape_htmltag('LOG_DEBUG ('.LOG_DEBUG.') - <span class="opacitymedium">'.$langs->trans("RecommendedForDebug").'</span>').'">LOG_DEBUG ('.LOG_DEBUG.')</option>';
print '</select>';
print ajax_combobox("level");
print '</td></tr>';
if (!empty($conf->loghandlers['mod_syslog_file']) && isModEnabled('cron')) {
print '<tr class="oddeven"><td width="140">'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
print '<td colspan="2"><input type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.getDolGlobalString('SYSLOG_FILE_SAVES').'" />';
print ' (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("SyslogFileNumberOfSaves").'</td>';
print '<td colspan="2"><input class="width50" type="number" name="file_saves" placeholder="14" min="0" step="1" value="'.getDolGlobalString('SYSLOG_FILE_SAVES').'" />';
print ' &nbsp; (<a href="'.dol_buildpath('/cron/list.php', 1).'?search_label=CompressSyslogs&status=-1">'.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').'</a>)</td></tr>';
}
print '</table>';
print "</div>\n";
print "</form>\n";
// End of page

View file

@ -713,7 +713,9 @@ print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.(getDol
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - does not work on HTML5 with some old libxml libs)</span><br>";
print '<br>';
print '<strong>MAIN_DISALLOW_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>";
// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1, disallow url links except if on /medias
// MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2, disallow all external urls link
print '<strong>MAIN_DISALLOW_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1=only local links allowed or 2=no links at all)</span>')."<br>";
print '<br>';
print '<strong>MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS</strong> = '.getDolGlobalString('MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";

View file

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016-2023 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018-2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -322,6 +322,8 @@ if (empty($reshook)) {
}
$uploaddir = $conf->commande->multidir_output[$conf->entity];
$triggersendname = 'ORDER_SENTBYMAIL';
$year="";
$month="";
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
if ($massaction == 'confirm_createbills') { // Create bills from orders.

View file

@ -1079,7 +1079,7 @@ if ($resql) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) : ''); // This also change content of $arrayfields
// When action is 'reconcile', we force to have the column num_releve always enabled (otherwise we can't make reconciliation).
if ($action == 'reconcile') {
$arrayfields['b.num_releve']['checked'] = 1;
@ -1088,12 +1088,16 @@ if ($resql) {
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
// Fields title search
// --------------------------------------------------------------------
print '<tr class="liste_titre_filter">';
// Actions and select
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre valignmiddle center">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
$searchpicto = $form->showFilterButtons('left');
print $searchpicto;
//$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
//print $searchpicto;
print '</td>';
}
if (!empty($arrayfields['b.rowid']['checked'])) {
@ -1171,77 +1175,105 @@ if ($resql) {
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_fk_bordereau" value="'.dol_escape_htmltag($search_fk_bordereau).'" size="3"></td>';
}
// Action edit/delete and select
print '<td class="nowraponall" align="center"></td>';
// Actions and select
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre valignmiddle center">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
//$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
//print $searchpicto;
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print "</tr>\n";
$totalarray = array();
$totalarray['nbfield'] = 0;
// Fields title
print '<tr class="liste_titre">';
// Actions and select
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.rowid']['checked'])) {
print_liste_field_titre($arrayfields['b.rowid']['label'], $_SERVER['PHP_SELF'], 'b.rowid', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.label']['checked'])) {
print_liste_field_titre($arrayfields['b.label']['label'], $_SERVER['PHP_SELF'], 'b.label', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.dateo']['checked'])) {
print_liste_field_titre($arrayfields['b.dateo']['label'], $_SERVER['PHP_SELF'], 'b.dateo', '', $param, '', $sortfield, $sortorder, "center ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.datev']['checked'])) {
print_liste_field_titre($arrayfields['b.datev']['label'], $_SERVER['PHP_SELF'], 'b.datev,b.dateo,b.rowid', '', $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['type']['checked'])) {
print_liste_field_titre($arrayfields['type']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center ');
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.num_chq']['checked'])) {
print_liste_field_titre($arrayfields['b.num_chq']['label'], $_SERVER['PHP_SELF'], 'b.num_chq', '', $param, '', $sortfield, $sortorder, "center ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['bu.label']['checked'])) {
print_liste_field_titre($arrayfields['bu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['ba.ref']['checked'])) {
print_liste_field_titre($arrayfields['ba.ref']['label'], $_SERVER['PHP_SELF'], 'ba.ref', '', $param, '', $sortfield, $sortorder);
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.debit']['checked'])) {
print_liste_field_titre($arrayfields['b.debit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.credit']['checked'])) {
print_liste_field_titre($arrayfields['b.credit']['label'], $_SERVER['PHP_SELF'], 'b.amount', '', $param, '', $sortfield, $sortorder, "right ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['balancebefore']['checked'])) {
print_liste_field_titre($arrayfields['balancebefore']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['balance']['checked'])) {
print_liste_field_titre($arrayfields['balance']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, "right ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.num_releve']['checked'])) {
print_liste_field_titre($arrayfields['b.num_releve']['label'], $_SERVER['PHP_SELF'], 'b.num_releve', '', $param, '', $sortfield, $sortorder, "center ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.conciliated']['checked'])) {
print_liste_field_titre($arrayfields['b.conciliated']['label'], $_SERVER['PHP_SELF'], 'b.rappro', '', $param, '', $sortfield, $sortorder, "center ");
$totalarray['nbfield']++;
}
if (!empty($arrayfields['b.fk_bordereau']['checked'])) {
print_liste_field_titre($arrayfields['b.fk_bordereau']['label'], $_SERVER['PHP_SELF'], 'b.fk_bordereau', '', $param, '', $sortfield, $sortorder, "center ");
$totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Action edit/delete and select
print '<td class="nowraponall" align="center"></td>';
$totalarray['nbfield']++;
// Actions and select
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
//print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ');
$totalarray['nbfield']++;
}
print "</tr>\n";
@ -1251,10 +1283,15 @@ if ($resql) {
$posconciliatecol = 0;
$cachebankaccount = array();
// Loop on each record
$sign = 1;
while ($i < min($num, $limit)) {
// Loop on each record
$i = 0;
$savnbfield = $totalarray['nbfield'];
$totalarray = array();
$totalarray['nbfield'] = 0;
$imaxinloop = ($limit ? min($num, $limit) : $num);
while ($i < $imaxinloop) {
$objp = $db->fetch_object($resql);
$links = $bankaccountstatic->get_url($objp->rowid);
@ -1364,13 +1401,17 @@ if ($resql) {
</script>';
print '</td>';
}
// conciliate
print '<td colspan="'.($tmpnbfieldafterbalance).'">';
print '&nbsp;';
print '</td>';
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td></td>';
}
print '</tr>';
}
}
@ -1411,6 +1452,7 @@ if ($resql) {
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td>';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($obj->rowid, $arrayofselected)) {
@ -1814,9 +1856,14 @@ if ($resql) {
print '</a>';
}
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td>';
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0;
if (in_array($objp->rowid, $arrayofselected)) {
@ -1872,7 +1919,7 @@ if ($resql) {
$colspan++;
}
}
print '<tr><td colspan="'.($colspan + 1).'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
print '<tr><td colspan="'.($colspan + 1).'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>";

View file

@ -566,4 +566,37 @@ class BankAccounts extends DolibarrApi
}
return $result;
}
/**
* Get the list of links for a line of the account.
*
* @param int $id ID of account
* @param int $line_id ID of account line
* @return array Array of links
*
* @throws RestException
*
* @url GET {id}/lines/{line_id}/links
*
*/
public function getLinks($id, $line_id)
{
$list = array();
if (!DolibarrApiAccess::$user->rights->banque->lire) {
throw new RestException(401);
}
$account = new Account($this->db);
$result = $account->fetch($id);
if (!$result) {
throw new RestException(404, 'account not found');
}
$links = $account->get_url($line_id); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
foreach ($links as &$link) {
unset($link[0], $link[1], $link[2], $link[3]); // Remove the numeric keys
}
return $links;
}
}

View file

@ -92,21 +92,23 @@ $totaltoshow = 0;
if (isModEnabled('supplier_invoice')) {
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransfer").'</td>';
print '<td class="right">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer">';
$amounttoshow = $bprev->SommeAPrelever('bank-transfer');
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer" title="'.price($amounttoshow).'">';
print $bprev->nbOfInvoiceToPay('bank-transfer');
print '</a>';
print '</td></tr>';
$totaltoshow += $bprev->SommeAPrelever('bank-transfer');
$totaltoshow += $amounttoshow;
}
if (isModEnabled('salaries')) {
print '<tr class="oddeven"><td>'.$langs->trans("NbOfInvoiceToPayByBankTransferForSalaries").'</td>';
print '<td class="right">';
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer&sourcetype=salary">';
$amounttoshow = $bprev->SommeAPrelever('bank-transfer', 'salary');
print '<a class="badge badge-info" href="'.DOL_URL_ROOT.'/compta/prelevement/demandes.php?status=0&type=bank-transfer&sourcetype=salary" title="'.price($amounttoshow).'">';
print $bprev->nbOfInvoiceToPay('bank-transfer', 'salary');
print '</a>';
print '</td></tr>';
$totaltoshow += $bprev->SommeAPrelever('bank-transfer', 'salary');
$totaltoshow += $amounttoshow;
}
print '<tr class="oddeven"><td>'.$langs->trans("Total").'</td>';
@ -116,18 +118,15 @@ print '</span></td></tr></table></div><br>';
/*
* Invoices waiting for withdraw
* Invoices waiting for credit transfer
*/
if (isModEnabled('supplier_invoice')) {
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type, f.datef, f.date_lim_reglement,";
$sql .= " pfd.date_demande, pfd.amount,";
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
$sql .= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
$sql .= " WHERE s.rowid = f.fk_soc";
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
$sql .= " AND f.total_ttc > 0";
@ -137,17 +136,10 @@ if (isModEnabled('supplier_invoice')) {
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if ($socid) {
$sql .= " AND f.fk_soc = ".((int) $socid);
}
$sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd";
$sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0";
$sqlForSalary .= " AND s.entity IN (".getEntity('salary').")";
$resql = $db->query($sql);
if ($resql) {
@ -219,6 +211,10 @@ if (isModEnabled('supplier_invoice')) {
}
if (isModEnabled('salaries')) {
$sqlForSalary = "SELECT * FROM ".MAIN_DB_PREFIX."salary as s, ".MAIN_DB_PREFIX."prelevement_demande as pd";
$sqlForSalary .= " WHERE s.rowid = pd.fk_salary AND s.paye = 0 AND pd.traite = 0";
$sqlForSalary .= " AND s.entity IN (".getEntity('salary').")";
$resql2 = $db->query($sqlForSalary);
if ($resql2) {
$numRow = $db->num_rows($resql2);

View file

@ -186,8 +186,6 @@ class BonPrelevement extends CommonObject
*/
public function __construct($db)
{
global $conf, $langs;
$this->db = $db;
$this->filename = '';
@ -478,7 +476,7 @@ class BonPrelevement extends CommonObject
$sql .= " SET fk_user_credit = ".$user->id;
$sql .= ", statut = ".self::STATUS_CREDITED;
$sql .= ", date_credit = '".$this->db->idate($date)."'";
$sql .= " WHERE rowid=".((int) $this->id);
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= " AND entity = ".((int) $conf->entity);
$sql .= " AND statut = ".self::STATUS_TRANSFERED;
@ -499,6 +497,10 @@ class BonPrelevement extends CommonObject
$amountsperthirdparty = array();
$facs = $this->getListInvoices(1);
if ($this->error) {
$error++;
}
//var_dump($facs);exit;
// Loop on each invoice. $facs=array(0=>id, 1=>amount requested)
$num = count($facs);
@ -596,9 +598,7 @@ class BonPrelevement extends CommonObject
$error++;
}
/*
* End of procedure
*/
// End of procedure
if ($error == 0) {
$this->date_credit = $date;
$this->statut = self::STATUS_CREDITED;
@ -676,7 +676,7 @@ class BonPrelevement extends CommonObject
* Get invoice list
*
* @param int $amounts If you want to get the amount of the order for each invoice
* @return array Id of invoices
* @return array Array(Id of invoices, Amount to pay)
*/
private function getListInvoices($amounts = 0)
{
@ -684,6 +684,8 @@ class BonPrelevement extends CommonObject
$arr = array();
dol_syslog(get_class($this)."::getListInvoices");
/*
* Returns all invoices presented within same order
*/
@ -696,18 +698,18 @@ class BonPrelevement extends CommonObject
if ($amounts) {
$sql .= ", SUM(pl.amount)";
}
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement as p";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND p.rowid = ".((int) $this->id);
$sql .= " AND p.entity = ".((int) $conf->entity);
$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
$sql .= " AND pb.rowid = ".((int) $this->id);
$sql .= " AND pb.entity = ".((int) $conf->entity);
if ($amounts) {
if ($this->type == 'bank-transfer') {
$sql .= " GROUP BY fk_facture_fourn";
$sql .= " GROUP BY p.fk_facture_fourn";
} else {
$sql .= " GROUP BY fk_facture";
$sql .= " GROUP BY p.fk_facture";
}
}
@ -732,7 +734,7 @@ class BonPrelevement extends CommonObject
}
$this->db->free($resql);
} else {
dol_syslog(get_class($this)."::getListInvoices Erreur");
$this->error = $this->db->lasterror();
}
return $arr;
@ -749,8 +751,6 @@ class BonPrelevement extends CommonObject
public function SommeAPrelever($mode = 'direct-debit', $type = '')
{
// phpcs:enable
global $conf;
$sql = "SELECT sum(pd.amount) as nb";
if ($type !== 'salary') {
if ($mode != 'bank-transfer') {
@ -1165,7 +1165,7 @@ class BonPrelevement extends CommonObject
if (!$error) {
$ref = substr($year, -2).$month;
// Get next free nuber for the ref of bon
// Get next free nunber for the ref of bon prelevement
$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
@ -1230,6 +1230,8 @@ class BonPrelevement extends CommonObject
}
if (!$error) {
dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
// Add lines for the bon
if (count($factures_prev) > 0) {
foreach ($factures_prev as $fac) { // Add a link in database for each invoice ro salary
@ -1799,7 +1801,7 @@ class BonPrelevement extends CommonObject
* Section Creditor (sepa Crediteurs bloc lines)
*/
if (!empty($user_dest)) {
$sql = "SELECT u.rowid as userId, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,";
$sql = "SELECT u.rowid as userId, u.address, u.zip, u.town, c.code as country_code, CONCAT(u.firstname,' ',u.lastname) as nom,";
$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql .= " s.ref as reffac, p.fk_salary as idfac,";
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
@ -1807,15 +1809,14 @@ class BonPrelevement extends CommonObject
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."salary as s,";
$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
$sql .= " ".MAIN_DB_PREFIX."user as u,";
$sql .= " ".MAIN_DB_PREFIX."user as u";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
$sql .= " AND p.fk_salary = s.rowid";
$sql .= " AND s.fk_user = u.rowid";
$sql .= " AND rib.fk_user = s.fk_user";
$sql .= " AND rib.fk_country = c.rowid";
} else {
$sql = "SELECT soc.rowid as socid, soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
@ -1825,14 +1826,13 @@ class BonPrelevement extends CommonObject
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
$sql .= " ".MAIN_DB_PREFIX."societe as soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
$sql .= " AND p.fk_facture_fourn = f.rowid";
$sql .= " AND f.fk_soc = soc.rowid";
$sql .= " AND soc.fk_pays = c.rowid";
$sql .= " AND rib.fk_soc = f.fk_soc";
$sql .= " AND rib.default_rib = 1";
$sql .= " AND rib.type = 'ban'";
@ -1854,8 +1854,12 @@ class BonPrelevement extends CommonObject
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
$refobj = $obj->reffac;
if (empty($refobj) && !empty($user_dest)) { // If ref of salary not defined, we force a value
$refobj = "SAL".$obj->idfac;
}
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->reffac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
$this->total = $this->total + $obj->somme;
$i++;
@ -2071,6 +2075,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, "\n");
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write recipient (thirdparty concerned by request)
@ -2302,6 +2307,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, "\n");
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Write sender of request (me).
@ -2623,8 +2629,6 @@ class BonPrelevement extends CommonObject
public function load_board($user, $mode)
{
// phpcs:enable
global $conf, $langs;
if ($user->socid) {
return -1; // protection pour eviter appel par utilisateur externe
}

View file

@ -97,27 +97,28 @@ class RejetPrelevement
}
/**
* Create
* Create a reject
*
* @param User $user User object
* @param int $id Id
* @param string $motif Motif
* @param int $date_rejet Date rejet
* @param int $date_rejet Date reject
* @param int $bonid Bon id
* @param int $facturation Facturation
* @return void
* @param int $facturation 1=Bill the reject
* @return int Return >=0 if OK, <0 if KO
*/
public function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0)
{
global $langs, $conf;
global $langs;
$error = 0;
$this->id = $id;
$this->bon_id = $bonid;
$now = dol_now();
dol_syslog("RejetPrelevement::Create id $id");
$bankaccount = ($this->type == 'bank-transfer' ? $conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT : $conf->global->PRELEVEMENT_ID_BANKACCOUNT);
dol_syslog("RejetPrelevement::Create id ".$id);
$bankaccount = ($this->type == 'bank-transfer' ? getDolGlobalString('PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT') : getDolGlobalString('PRELEVEMENT_ID_BANKACCOUNT'));
$facs = $this->getListInvoices(1);
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
@ -172,30 +173,34 @@ class RejetPrelevement
$fac->fetch($facs[$i][0]);
// Make a negative payment
//$pai = new Paiement($this->db);
$amountrejected = $facs[$i][1];
// Make a negative payment
// Amount must be an array (id of invoice -> amount)
$pai->amounts = array();
/*
* We replace the comma with a point otherwise some
* PHP installs sends only the part integer negative
*/
//var_dump($this->type);exit;
$pai->amounts[$facs[$i][0]] = price2num($amountrejected * -1); // The payment must be negative because it is a refund
$pai->amounts[$facs[$i][0]] = price2num($facs[$i][1] * ($this->type == 'bank-transfer' ? 1 : -1));
$pai->datepaye = $date_rejet;
$pai->paiementid = 3; // type of payment: withdrawal
$pai->num_paiement = $fac->ref;
$pai->num_payment = $fac->ref;
$pai->num_paiement = $langs->trans('Rejection').' '.$fac->ref;
$pai->num_payment = $langs->trans('Rejection').' '.$fac->ref;
$pai->id_prelevement = $this->bon_id;
$pai->num_prelevement = $lipre->bon_ref;
if ($pai->create($this->user) < 0) {
// we call with no_commit
$error++;
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
} else {
$result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
// We record entry into bank
$mode = 'payment';
if ($this->type == 'bank-transfer') {
$mode = 'payment_supplier';
}
$result = $pai->addPaymentToBank($user, $mode, '(InvoiceRefused)', $bankaccount, '', '');
if ($result < 0) {
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
$error++;
@ -220,9 +225,13 @@ class RejetPrelevement
if ($error == 0) {
dol_syslog("RejetPrelevement::Create Commit");
$this->db->commit();
return 1;
} else {
dol_syslog("RejetPrelevement::Create Rollback");
$this->db->rollback();
return -1;
}
}

View file

@ -96,6 +96,7 @@ llxHeader('', $langs->trans("WithdrawalsReceipts"));
if ($id > 0 || $ref) {
if ($object->fetch($id, $ref) >= 0) {
$head = prelevement_prepare_head($object);
print dol_get_fiche_head($head, 'invoices', $langs->trans("WithdrawalsReceipts"), -1, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type != 'bank-transfer' ? '' : '&type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
@ -293,8 +294,9 @@ if ($resql) {
print '<input type="hidden" name="id" value="'.$id.'">';
$massactionbutton = '';
$title = ($salaryBonPl ? $langs->trans("Salaries") : ($object->type == 'bank-transfer' ? $langs->trans("SupplierInvoices") : $langs->trans("Invoices")));
print_barre_liste(($salaryBonPl ? $langs->trans("Salaries") : $langs->trans("Invoices")), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print"\n<!-- debut table -->\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
@ -308,7 +310,6 @@ if ($resql) {
print_liste_field_titre(($salaryBonPl ? "AmountSalary" : "AmountInvoice"), $_SERVER["PHP_SELF"], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("AmountRequested", $_SERVER["PHP_SELF"], "pl.amount", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('');
print "</tr>\n";
$totalinvoices = 0;
@ -340,7 +341,6 @@ if ($resql) {
print '<tr class="oddeven">';
print '<td class="nowraponall">';
print($salaryBonPl ? $salarytmp->getNomUrl(1) : $invoicetmp->getNomUrl(1));
print "</td>\n";
@ -376,8 +376,6 @@ if ($resql) {
}
print "</td>";
print "<td></td>";
print "</tr>\n";
$totalinvoices += $obj->total_ttc;
@ -403,7 +401,6 @@ if ($resql) {
print price($totalamount_requested);
print "</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
}

View file

@ -85,7 +85,7 @@ $error = 0;
if ($action == 'confirm_rejet' && $permissiontoadd) {
if (GETPOST("confirm") == 'yes') {
if (GETPOST('remonth', 'int')) {
$daterej = mktime(2, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$daterej = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
}
if (empty($daterej)) {
@ -108,10 +108,12 @@ if ($action == 'confirm_rejet' && $permissiontoadd) {
if ($lipre->fetch($id) == 0) {
$rej = new RejetPrelevement($db, $user, $type);
$rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int'));
$result = $rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int'));
header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type));
exit;
if ($result > 0) {
header("Location: line.php?id=".urlencode($id).'&type='.urlencode($type));
exit;
}
}
} else {
$action = "rejet";
@ -202,30 +204,35 @@ if ($id) {
dol_print_error($db);
}
// Form to record a reject
if ($action == 'rejet' && $user->hasRight('prelevement', 'bons', 'credit')) {
$soc = new Societe($db);
$soc->fetch($lipre->socid);
$rej = new RejetPrelevement($db, $user, $type);
print '<form name="confirm_rejet" method="post" action="line.php?id='.$id.'">';
print '<form name="confirm_rejet" method="post" action="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="confirm_rejet">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("WithdrawalRefused").'</td></tr>';
print '<td>'.$langs->trans("WithdrawalRefused").'</td>';
print '<td></td>';
print '</tr>';
//Select yes/no
print '<tr><td class="valid">'.$langs->trans("WithdrawalRefusedConfirm").' '.$soc->name.' ?</td>';
print '<td colspan="2" class="valid">';
print '<td class="valid">';
print $form->selectyesno("confirm", 1, 0);
print '</td></tr>';
//Date
print '<tr><td class="fieldrequired valid">'.$langs->trans("RefusedData").'</td>';
print '<td colspan="2" class="valid">';
print '<td class="valid">';
print $form->selectDate('', '', '', '', '', "confirm_rejet");
print '</td></tr>';
@ -236,11 +243,15 @@ if ($id) {
print '</td></tr>';
//Facturer
print '<tr><td class="valid">'.$langs->trans("RefusedInvoicing").'</td>';
print '<td class="valid" colspan="2">';
print $form->selectarray("facturer", $rej->labelsofinvoicing, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '');
print '<tr><td class="fieldrequired valid">';
print $form->textwithpicto($langs->trans("RefusedInvoicing"), $langs->trans("DirectDebitRefusedInvoicingDesc"));
print '</td>';
print '<td class="valid">';
print $form->selectarray("facturer", $rej->labelsofinvoicing, GETPOSTISSET('facturer') ? GETPOST('facturer', 'int') : '', 0);
print '</td></tr>';
print '</table><br>';
print '</table>';
print '</div>';
//Confirm Button
print '<div class="center"><input type="submit" class="button button-save" value='.$langs->trans("Confirm").'></div>';
@ -274,6 +285,9 @@ if ($id) {
$sql = "SELECT pf.rowid";
$sql .= " ,f.rowid as facid, f.ref as ref, f.total_ttc, f.paye, f.fk_statut";
$sql .= " , s.rowid as socid, s.nom as name";
$sqlfields = $sql; // $sql fields to remove for count total
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= " , ".MAIN_DB_PREFIX."prelevement as pf";
@ -296,6 +310,30 @@ if ($id) {
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
}
// Count total nb of records
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
$resql = $db->query($sqlforcount);
if ($resql) {
$objforcount = $db->fetch_object($resql);
$nbtotalofrecords = $objforcount->nbtotalofrecords;
} else {
dol_print_error($db);
}
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
}
$db->free($resql);
}
$result = $db->query($sql);
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($conf->liste_limit + 1, $offset);
@ -306,8 +344,12 @@ if ($id) {
$i = 0;
$urladd = "&id=".urlencode($id);
$title = $langs->trans("Bills");
if ($type == 'bank-transfer') {
$title = $langs->trans("SupplierInvoices");
}
print_barre_liste($langs->trans("Bills"), $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, 0, '');
print_barre_liste($title, $page, "factures.php", $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellpadding="4">';

View file

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'withdrawals', 'companies'));
@ -83,14 +85,16 @@ if ($sortfield == "") {
$rej = new RejetPrelevement($db, $user, $type);
$line = new LignePrelevement($db);
$thirdpartystatic = new Societe($db);
$userstatic = new User($db);
$hookmanager->initHooks(array('withdrawalsreceiptsrejectedlist'));
// List of invoices
$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId";
$sql .= " , s.rowid as socid, s.nom as name, p.datec";
$sql = "SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
$sql .= " s.rowid as socid, s.nom as name, p.datec";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@ -98,19 +102,20 @@ $sql .= " , ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND pl.fk_soc = s.rowid";
$sql .= " AND p.entity = ".$conf->entity;
$sql .= " AND p.entity = ".((int) $conf->entity);
if ($type == 'bank-transfer') {
$sql .= " AND p.type = 'bank-transfer'";
} else {
$sql .= " AND p.type = 'debit-order'";
}
if ($socid) {
if ($socid > 0) {
$sql .= " AND s.rowid = ".((int) $socid);
}
// Add list for salaries
if ($type == 'bank-transfer') {
$sql .= " UNION";
$sql .= " SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId";
$sql .= " ,u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
$sql .= " SELECT pl.rowid, pr.motif, p.ref, pl.statut, p.rowid as bonId,";
$sql .= " u.rowid as socid, CONCAT(u.firstname,' ', u.lastname) as name, p.datec";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_rejet as pr";
$sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";
@ -118,7 +123,7 @@ if ($type == 'bank-transfer') {
$sql .= " WHERE pr.fk_prelevement_lignes = pl.rowid";
$sql .= " AND pl.fk_prelevement_bons = p.rowid";
$sql .= " AND pl.fk_user = u.rowid";
$sql .= " AND p.entity = ".$conf->entity;
$sql .= " AND p.entity = ".((int) $conf->entity);
$sql .= " AND p.type = 'bank-transfer'";
if ($socid) {
$sql .= " AND s.rowid = ".((int) $socid);
@ -129,10 +134,10 @@ if ($type == 'bank-transfer') {
}
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
$param = '';
@ -147,7 +152,9 @@ if ($result) {
$bon = new BonPrelevement($db);
if ($num) {
while ($i < min($num, $limit)) {
$i = 0;
$maxlim = min($num, $limit);
while ($i < $maxlim) {
$obj = $db->fetch_object($result);
$bon->fetch($obj->bonId);
@ -157,10 +164,14 @@ if ($result) {
print $line->LibStatut($obj->statut, 2).'&nbsp;';
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6)."</a></td>";
if ($bon->checkIfSalaryBonPrelevement()) {
print '<td><a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$obj->socid.'">'.$obj->nom."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$obj->socid.'">'.$obj->name."</a></td>\n";
} else {
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$obj->nom."</a></td>\n";
$thirdpartystatic->id = $obj->socid;
$thirdpartystatic->name = $obj->name;
print '<td class="tdoverlowmax200"><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">'.$thirdpartystatic->getNomUrl(1)."</a></td>\n";
}
print '<td>'.$rej->motifs[$obj->motif].'</td>';

View file

@ -769,7 +769,6 @@ if (empty($reshook)) {
$remise_percent = price2num(GETPOST('elremise_percent'), '', 2);
if ($remise_percent > 0) {
$remise = round(($price_ht * $remise_percent / 100), 2);
$price_ht = ($price_ht - $remise);
}
$objectline->fk_product = GETPOST('idprod', 'int');

View file

@ -3413,7 +3413,7 @@ class ContratLigne extends CommonObjectLine
*/
public function update($user, $notrigger = 0)
{
global $conf, $langs, $mysoc;
global $mysoc;
$error = 0;
@ -3615,10 +3615,10 @@ class ContratLigne extends CommonObjectLine
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Mise a jour en base des champs total_xxx de ligne
* Used by migration process
* Update in database the fields total_xxx of lines
* Used by migration process
*
* @return int Return integer <0 if KO, >0 if OK
* @return int Return integer <0 if KO, >0 if OK
*/
public function update_total()
{
@ -3656,7 +3656,7 @@ class ContratLigne extends CommonObjectLine
*/
public function insert($notrigger = 0)
{
global $conf, $user;
global $user;
$error = 0;
@ -3753,8 +3753,6 @@ class ContratLigne extends CommonObjectLine
public function active_line($user, $date, $date_end = '', $comment = '')
{
// phpcs:enable
global $langs, $conf;
$error = 0;
$this->db->begin();
@ -3813,9 +3811,6 @@ class ContratLigne extends CommonObjectLine
public function close_line($user, $date_end_real, $comment = '', $notrigger = 0)
{
// phpcs:enable
global $langs, $conf;
// Update object
$this->date_cloture = $date_end_real;
$this->date_end_real = $date_end_real;
$this->user_closing_id = $user->id;

View file

@ -751,7 +751,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$listofobjectid[$toselectid] = $toselectid;
$thirdpartyid = $objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid;
$thirdpartyid = !empty($objecttmp->fk_soc) ? $objecttmp->fk_soc : $objecttmp->socid;
$listofobjectthirdparties[$thirdpartyid] = $thirdpartyid;
$listofobjectref[$toselectid] = $objecttmp->ref;
}

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2019-2022 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2019-2023 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
@ -16,9 +16,10 @@
*/
/**
* \file htdocs/core/ajax/pingresult.php
* \brief Page called after a ping was done in js to the official dolibarr ping service.
* This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping.
* \file htdocs/core/ajax/pingresult.php
* \brief Page called after a ping was done in js to the official dolibarr ping service.
* This ajax URL is called with parameter 'firstpingok' or 'firstpingko' depending on the result of the ping.
* You can use &forceping=1 in parameters to force the ping if the ping was already sent.
*/
if (!defined('NOTOKENRENEWAL')) {

View file

@ -854,6 +854,7 @@ abstract class CommonObject
// Add extrafields
if (!empty($extrafields->attributes[$this->table_element]['label'])) {
$datas['opendivextra'] = '<div class="centpercent wordbreak divtooltipextra">';
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
continue;
@ -894,6 +895,7 @@ abstract class CommonObject
$count++;
}
}
$datas['closedivextra'] = '</div>';
}
$hookmanager->initHooks(array($this->element . 'dao'));

View file

@ -171,7 +171,7 @@ class DolEditor
if (!getDolGlobalString('FCKEDITOR_ENABLE_PDF')) {
$pluginstodisable .= ',exportpdf';
}
if (getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS')) {
if (getDolGlobalInt('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') == 2) {
$this->uselocalbrowser = 0; // Can't use browser to navigate into files. Only links with "<img src=data:..." are allowed.
}
$scaytautostartup = '';

View file

@ -10769,7 +10769,7 @@ class Form
* @param string $dol_openinpopup If the button are shown in a context of a page shown inside a popup, we put here the string name of popup.
* @return string Html code with the buttons
*/
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = 0, $morecss = '', $dol_openinpopup = '')
public function buttonsSaveCancel($save_label = 'Save', $cancel_label = 'Cancel', $morebuttons = array(), $withoutdiv = false, $morecss = '', $dol_openinpopup = '')
{
global $langs;

View file

@ -296,7 +296,9 @@ class FormActions
print '</td>';
// Label
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($actioncomm->label).'">'.$actioncomm->getNomUrl(0).'</td>';
print '<td class="tdoverflowmax200">';
print $actioncomm->getNomUrl(0);
print '</td>';
// Date
print '<td class="center nowraponall">'.dol_print_date($actioncomm->datep, 'dayhour', 'tzuserrel');

View file

@ -81,7 +81,7 @@ if ("Notification" in window) {
if (Notification.permission !== "granted") {
console.log("Ask Notification.permission");
Notification.requestPermission(function(result) {
console.log("result for requestPermission is "+result);
console.log("result for Notification.requestPermission is "+result);
});
}

View file

@ -7586,7 +7586,7 @@ function dol_nl2br($stringtoencode, $nl2brmode = 0, $forxml = false)
}
/**
* Sanitize a HTML to remove js and dangerous content.
* Sanitize a HTML to remove js, dangerous content and external link.
* This function is used by dolPrintHTML... function for example.
*
* @param string $stringtoencode String to encode
@ -7707,11 +7707,30 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
if ($nblinks > getDolGlobalInt("MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT", 1000)) {
$out = 'ErrorTooManyLinksIntoHTMLString';
}
//
if (getDolGlobalString('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') || $check == 'restricthtmlnolink') {
if (getDolGlobalInt('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') == 2 || $check == 'restricthtmlnolink') {
if ($nblinks > 0) {
$out = 'ErrorHTMLLinksNotAllowed';
}
} elseif (getDolGlobalInt('MAIN_DISALLOW_URL_INTO_DESCRIPTIONS') == 1) {
$nblinks = 0;
// Loop on each url in src= and url(
$pattern = '/src=["\']?(http[^"\']+)|url\(["\']?(http[^\)]+)/';
$matches = array();
if (preg_match_all($pattern, $out, $matches)) {
// URLs are into $matches[1]
$urls = $matches[1];
// Affiche les URLs
foreach ($urls as $url) {
$nblinks++;
echo "Found url = ".$url . "\n";
}
if ($nblinks > 0) {
$out = 'ErrorHTMLExternalLinksNotAllowed';
}
}
}
return $out;

View file

@ -33,9 +33,11 @@
*/
function prelevement_prepare_head(BonPrelevement $object)
{
global $langs, $conf, $user;
global $langs, $conf;
$salary = $object->checkIfSalaryBonPrelevement();
$langs->load("withdrawals");
$langs->loadLangs(array("bills", "withdrawals"));
$h = 0;
$head = array();
@ -50,8 +52,16 @@ function prelevement_prepare_head(BonPrelevement $object)
$head[$h][2] = 'prelevement';
$h++;
$titleoftab = $langs->trans("Bills");
if ($object->type == 'bank-transfer') {
$titleoftab = $langs->trans("SupplierBills");
}
if ($salary > 0) {
$titleoftab = $langs->trans("Salaries");
}
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$object->id;
$head[$h][1] = ($salary <= 0 ? $langs->trans("Bills") : $langs->trans("Salaries"));
$head[$h][1] = $titleoftab;
$head[$h][2] = 'invoices';
$h++;

View file

@ -227,14 +227,13 @@ function dolDecrypt($chain, $key = '')
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt (used only if hashing algorightm is something else than 'password_hash').
*
* @param string $chain String to hash
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4': for OpenLdap, '5':sha256, '6':password_hash). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4': for OpenLdap, '5':sha256, '6':password_hash).
* Use 'md5' if hash is not needed for security purpose. For security need, prefer 'auto'.
* @return string Hash of string
* @see getRandomPassword(), dol_verifyHash()
*/
function dol_hash($chain, $type = '0')
{
global $conf;
// No need to add salt for password_hash
if (($type == '0' || $type == 'auto') && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') == 'password_hash' && function_exists('password_hash')) {
return password_hash($chain, PASSWORD_DEFAULT);
@ -249,7 +248,7 @@ function dol_hash($chain, $type = '0')
return sha1($chain);
} elseif ($type == '2' || $type == 'sha1md5') {
return sha1(md5($chain));
} elseif ($type == '3' || $type == 'md5') {
} elseif ($type == '3' || $type == 'md5') { // For hashing with no need of security
return md5($chain);
} elseif ($type == '4' || $type == 'openldap') {
return dolGetLdapPasswordHash($chain, getDolGlobalString('LDAP_PASSWORD_HASH_TYPE', 'md5'));
@ -281,8 +280,6 @@ function dol_hash($chain, $type = '0')
*/
function dol_verifyHash($chain, $hash, $type = '0')
{
global $conf;
if ($type == '0' && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') && getDolGlobalString('MAIN_SECURITY_HASH_ALGO') == 'password_hash' && function_exists('password_verify')) {
if (! empty($hash[0]) && $hash[0] == '$') {
return password_verify($chain, $hash);
@ -365,7 +362,7 @@ function dolGetLdapPasswordHash($password, $type = 'md5')
*/
function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0, $mode = 0)
{
global $db, $conf;
global $conf;
global $hookmanager;
// Define $objectid
@ -389,7 +386,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$parentfortableentity = '';
// Fix syntax of $features param
// Fix syntax of $features param to support non standard module names.
$originalfeatures = $features;
if ($features == 'agenda') {
$tableandshare = 'actioncomm&societe';

View file

@ -77,7 +77,7 @@ class ExportExcel2007 extends ModeleExports
*/
public function __construct($db)
{
global $conf, $langs;
global $langs;
$this->db = $db;
$this->id = 'excel2007'; // Same value then xxx in file name export_xxx.modules.php
@ -119,6 +119,18 @@ class ExportExcel2007 extends ModeleExports
return $this->label;
}
/**
* getDriverLabel
*
* @return string Return driver label
*/
public function getDriverLabelBis()
{
global $langs;
$langs->load("errors");
return $langs->trans("NumberOfLinesLimited");
}
/**
* getDriverDesc
*

View file

@ -84,6 +84,8 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
*/
public function listOfAvailableExportFormat($db, $maxfilenamelength = 0)
{
global $langs;
dol_syslog(get_class($this)."::listOfAvailableExportFormat");
$dir = DOL_DOCUMENT_ROOT."/core/modules/export/";
@ -113,6 +115,11 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
$this->picto[$module->id] = $module->picto;
// Driver properties
$this->driverlabel[$module->id] = $module->getDriverLabel().(empty($module->disabled) ? '' : ' __(Disabled)__'); // '__(Disabled)__' is a key
if (method_exists($module, 'getDriverLabelBis')) {
if ($module->getDriverLabelBis()) {
$this->driverlabel[$module->id] .= ' <span class="opacitymedium">('.$module->getDriverLabelBis().')</span>';
}
}
$this->driverdesc[$module->id] = $module->getDriverDesc();
$this->driverversion[$module->id] = $module->getDriverVersion();
// If use an external lib

View file

@ -69,7 +69,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
'name' => $langs->trans('SyslogFilename'),
'constant' => 'SYSLOG_FILE',
'default' => 'DOL_DATA_ROOT/dolibarr.log',
'attr' => 'size="60"'
'css' => 'minwidth300 maxwidth500'
)
);
}

View file

@ -14,15 +14,19 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) {
$i++;
if (!empty($totalarray['pos'][$i])) {
// if $totalarray['type'] not present we consider it as number
if (empty($totalarray['type'][$i])) {
$totalarray['type'][$i] = 'real';
}
switch ($totalarray['type'][$i]) {
case 'duration':
print '<td class="right">';
print(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0);
print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0);
print '</td>';
break;
case 'string':
case 'string': // This type is no more used. type is now varchar(x)
print '<td class="left">';
print(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : '');
print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : '');
print '</td>';
break;
case 'stock':

View file

@ -738,6 +738,9 @@ class Cronjob extends CommonObject
if (empty($this->email_alert)) {
$this->email_alert = '';
}
if (empty($this->datenextrun)) {
$this->datenextrun = dol_now();
}
// Check parameters
// Put here code to add a control on parameters values

View file

@ -1074,7 +1074,7 @@ if ($step == 4 && $datatoexport) {
}
if ($step == 5 && $datatoexport) {
if (count($array_selected) < 1) { // This occurs when going back to page after sessecion expired
if (count($array_selected) < 1) { // This occurs when going back to page after session expired
// Switch to step 2
header("Location: ".DOL_URL_ROOT.'/exports/export.php?step=2&datatoexport='.$datatoexport);
exit;

View file

@ -1106,7 +1106,6 @@ class FactureFournisseurRec extends CommonInvoice
$txlocaltax1 = empty($txlocaltax1) ? 0 : price2num($txlocaltax1);
$txlocaltax2 = empty($txlocaltax2) ? 0 : price2num($txlocaltax2);
$this->multicurrency_subprice = empty($this->multicurrency_subprice) ? 0 : $this->multicurrency_subprice;
$this->multicurrency_total_ht = empty($this->multicurrency_total_ht) ? 0 : $this->multicurrency_total_ht;
$this->multicurrency_total_tva = empty($this->multicurrency_total_tva) ? 0 : $this->multicurrency_total_tva;
$this->multicurrency_total_ttc = empty($this->multicurrency_total_ttc) ? 0 : $this->multicurrency_total_ttc;
@ -1196,6 +1195,7 @@ class FactureFournisseurRec extends CommonInvoice
return -1;
}
}
return 0;
}

View file

@ -254,7 +254,7 @@ class FactureFournisseur extends CommonInvoice
public $fk_facture_source;
public $fac_rec;
public $fk_fac_rec_source;
public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),

View file

@ -1022,6 +1022,9 @@ IMG;
$matches = array();
preg_match($searchreg, $this->contentXml, $matches);
$this->contentXml = preg_replace($searchreg, "", $this->contentXml);
return $matches[1];
if ($matches) {
return $matches[1];
}
return "";
}
}
}

View file

@ -584,7 +584,7 @@ dolibarr_install_syslog("- step2: end");
$conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);
$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno"'.((getDolGlobalString('MAIN_FIRST_PING_OK_ID') == 'disabled') ? '' : ' value="checked" checked="true"').'> ';
$out .= '<label for="dolibarrpingno">'.$langs->trans("MakeAnonymousPing").'</label>';

View file

@ -343,7 +343,7 @@ AccountingJournalType3=Purchases
AccountingJournalType4=Bank
AccountingJournalType5=Expense reports
AccountingJournalType8=Inventory
AccountingJournalType9=Has-new
AccountingJournalType9=Retained earnings
GenerationOfAccountingEntries=Generation of accounting entries
ErrorAccountingJournalIsAlreadyUse=This journal is already use
AccountingAccountForSalesTaxAreDefinedInto=Note: Accounting account for Sales tax are defined into menu <b>%s</b> - <b>%s</b>
@ -450,12 +450,12 @@ AccountancyClosureStep1=Step 1 : Validate and lock movements
AccountancyClosureStep2=Step 2 : Close fiscal period
AccountancyClosureStep3=Step 3 : Extract entries (Optional)
AccountancyClosureClose=Close fiscal period
AccountancyClosureAccountingReversal=Extract entries
AccountancyClosureAccountingReversal=Extract and record "Retained earnings" entries
AccountancyClosureStep3NewFiscalPeriod=Next fiscal period
AccountancyClosureGenerateClosureBookkeepingRecords=Generate "has-new" entry on the next fiscal period
AccountancyClosureSeparateAuxiliaryAccounts=When generating the "has-new" entry, detail the sub-ledger accounts
AccountancyClosureGenerateClosureBookkeepingRecords=Generate "Retained earnings" entries on the next fiscal period
AccountancyClosureSeparateAuxiliaryAccounts=When generating the "Retained earnings" entries, detail the sub-ledger accounts
AccountancyClosureCloseSuccessfully=Fiscal period has been closed successfully
AccountancyClosureInsertAccountingReversalSuccessfully=Bookkeeping records has been inserted successfully
AccountancyClosureInsertAccountingReversalSuccessfully=Bookkeeping entries for "Retained earnings" has been inserted successfully
## Confirm box
ConfirmMassUnletteringAuto=Bulk auto unreconcile confirmation
@ -464,7 +464,7 @@ ConfirmMassUnletteringQuestion=Are you sure you want to unreconcile the %s selec
ConfirmMassDeleteBookkeepingWriting=Bulk Delete confirmation
ConfirmMassDeleteBookkeepingWritingQuestion=This will delete the transaction from the accounting (all line entries related to the same transaction will be deleted). Are you sure you want to delete the %s selected entries?
AccountancyClosureConfirmClose=Are you sure you want to close the current fiscal period ? <span class="warning">You understand that closing the fiscal period is an irreversible action and will permanently block any modification or deletion of entries over this period</span>.
AccountancyClosureConfirmAccountingReversal=Are you sure you want to accounting reversal ?
AccountancyClosureConfirmAccountingReversal=Are you sure you want to record entries for the "Retained earnings" ?
## Error
SomeMandatoryStepsOfSetupWereNotDone=Some mandatory steps of setup was not done, please complete them

View file

@ -2433,4 +2433,6 @@ ConfirmDeleteExtrafield=Do you confirm deletion of the field %s ? All data saved
ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices)
ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (invoice lines)
ParametersForTestEnvironment=Parameters for test environment
TryToKeepOnly=Try to keep only %s
TryToKeepOnly=Try to keep only %s
RecommendedForProduction=Recommended for Production
RecommendedForDebug=Recommended for Debug

View file

@ -185,7 +185,7 @@ SuppliersDraftInvoices=Vendor draft invoices
Unpaid=Unpaid
ErrorNoPaymentDefined=Error No payment defined
ConfirmDeleteBill=Are you sure you want to delete this invoice?
ConfirmValidateBill=Are you sure you want to validate this invoice with reference <b>%s</b>?
ConfirmValidateBill=Are you sure you want to validate this invoice with the reference <b>%s</b>?
ConfirmUnvalidateBill=Are you sure you want to change invoice <b>%s</b> to draft status?
ConfirmClassifyPaidBill=Are you sure you want to change invoice <b>%s</b> to status paid?
ConfirmCancelBill=Are you sure you want to cancel invoice <b>%s</b>?
@ -250,12 +250,13 @@ RemainderToTake=Remaining amount to take
RemainderToTakeMulticurrency=Remaining amount to take, original currency
RemainderToPayBack=Remaining amount to refund
RemainderToPayBackMulticurrency=Remaining amount to refund, original currency
NegativeIfExcessReceived=negative if excess received
NegativeIfExcessRefunded=negative if excess refunded
NegativeIfExcessPaid=negative if excess paid
Rest=Pending
AmountExpected=Amount claimed
ExcessReceived=Excess received
ExcessReceivedMulticurrency=Excess received, original currency
NegativeIfExcessReceived=negative if excess received
ExcessPaid=Excess paid
ExcessPaidMulticurrency=Excess paid, original currency
EscompteOffered=Discount offered (payment before term)

View file

@ -145,3 +145,4 @@ SelectImportFieldsSource = Choose the source file fields you want to import and
MandatoryTargetFieldsNotMapped=Some mandatory target fields are not mapped
AllTargetMandatoryFieldsAreMapped=All target fields that need a mandatory value are mapped
ResultOfSimulationNoError=Result of simulation: No error
NumberOfLinesLimited=Number of lines limited

View file

@ -45,7 +45,7 @@ Eval=Evaluation
Evals=Evaluations
NewEval=New evaluation
ValidateEvaluation=Validate evaluation
ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with reference <b>%s</b>?
ConfirmValidateEvaluation=Are you sure you want to validate this evaluation with the reference <b>%s</b>?
EvaluationCard=Evaluation card
RequiredRank=Required rank for the job profile
RequiredRankShort=Required rank

View file

@ -360,7 +360,7 @@ ProductAttributes=Variant attributes for products
ProductAttributeName=Variant attribute %s
ProductAttribute=Variant attribute
ProductAttributeDeleteDialog=Are you sure you want to delete this attribute? All values will be deleted
ProductAttributeValueDeleteDialog=Are you sure you want to delete the value "%s" with reference "%s" of this attribute?
ProductAttributeValueDeleteDialog=Are you sure you want to delete the value "%s" with the reference "%s" of this attribute?
ProductCombinationDeleteDialog=Are you sure want to delete the variant of the product "<strong>%s</strong>"?
ProductCombinationAlreadyUsed=There was an error while deleting the variant. Please check it is not being used in any object
ProductCombinations=Variants

View file

@ -34,7 +34,7 @@ StatusReceptionProcessedShort=Processed
ReceptionSheet=Reception sheet
ValidateReception=Validate reception
ConfirmDeleteReception=Are you sure you want to delete this reception?
ConfirmValidateReception=Are you sure you want to validate this reception with reference <b>%s</b>?
ConfirmValidateReception=Are you sure you want to validate this reception with the reference <b>%s</b>?
ConfirmCancelReception=Are you sure you want to cancel this reception?
StatsOnReceptionsOnlyValidated=Statistics conducted on validated only receptions. Date used is date of validation of reception (planned delivery date is not always known).
SendReceptionByEMail=Send reception by email

View file

@ -39,7 +39,7 @@ StatusSendingValidatedShort=Validated
StatusSendingProcessedShort=Processed
SendingSheet=Shipment sheet
ConfirmDeleteSending=Are you sure you want to delete this shipment?
ConfirmValidateSending=Are you sure you want to validate this shipment with reference <b>%s</b>?
ConfirmValidateSending=Are you sure you want to validate this shipment with the reference <b>%s</b>?
ConfirmCancelSending=Are you sure you want to cancel this shipment?
DocumentModelMerou=Merou A5 model
WarningNoQtyLeftToSend=Warning, no products waiting to be shipped.

View file

@ -282,7 +282,7 @@ ModuleStockTransferName=Advanced Stock Transfer
ModuleStockTransferDesc=Advanced management of Stock Transfer, with generation of transfer sheet
StockTransferNew=New stock transfer
StockTransferList=Stock transfers list
ConfirmValidateStockTransfer=Are you sure you want to validate this stocks transfer with reference <STRONG>%s</STRONG> ?
ConfirmValidateStockTransfer=Are you sure you want to validate this stocks transfer with the reference <b>%s</b> ?
ConfirmDestock=Decrease of stocks with transfer %s
ConfirmDestockCancel=Cancel decrease of stocks with transfer %s
DestockAllProduct=Decrease of stocks

View file

@ -66,8 +66,9 @@ WithdrawalRefusedConfirm=Are you sure you want to enter a withdrawal rejection f
RefusedData=Date of rejection
RefusedReason=Reason for rejection
RefusedInvoicing=Billing the rejection
NoInvoiceRefused=Do not charge the rejection
InvoiceRefused=Invoice refused (Charge the rejection to customer)
NoInvoiceRefused=Do not charge the customer for the refusal
InvoiceRefused=Charge the customer for the refusal
DirectDebitRefusedInvoicingDesc=Set a flag to say this refusal must be charged to the customer
StatusDebitCredit=Status debit/credit
StatusWaiting=Waiting
StatusTrans=Sent

View file

@ -3665,7 +3665,7 @@ if (!function_exists("llxFooter")) {
$forceping = GETPOST('forceping', 'alpha');
if (($_SERVER["PHP_SELF"] == DOL_URL_ROOT.'/index.php') || $forceping) {
//print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id); // Do not use dol_hash(), must not change if salt changes.
$hash_unique_id = dol_hash('dolibarr'.$conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
if (!getDolGlobalString('MAIN_FIRST_PING_OK_DATE')
|| (!empty($conf->file->instance_unique_id) && ($hash_unique_id != $conf->global->MAIN_FIRST_PING_OK_ID) && ($conf->global->MAIN_FIRST_PING_OK_ID != 'disabled'))
@ -3695,14 +3695,14 @@ if (!function_exists("llxFooter")) {
?>
<script>
jQuery(document).ready(function (tmp) {
console.log("Try Ping with hash_unique_id is md5('dolibarr'+instance_unique_id)");
console.log("Try Ping with hash_unique_id is dol_hash('dolibarr'+instance_unique_id, 'sha256')");
$.ajax({
method: "POST",
url: "<?php echo $url_for_ping ?>",
timeout: 500, // timeout milliseconds
cache: false,
data: {
hash_algo: 'md5',
hash_algo: 'dol_hash-sha256',
hash_unique_id: '<?php echo dol_escape_js($hash_unique_id); ?>',
action: 'dolibarrping',
version: '<?php echo (float) DOL_VERSION; ?>',
@ -3722,7 +3722,7 @@ if (!function_exists("llxFooter")) {
url: '<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>',
timeout: 500, // timeout milliseconds
cache: false,
data: { hash_algo: 'md5', hash_unique_id: '<?php echo dol_escape_js($hash_unique_id); ?>', action: 'firstpingok', token: '<?php echo currentToken(); ?>' }, // for update
data: { hash_algo: 'dol_hash-sha256', hash_unique_id: '<?php echo dol_escape_js($hash_unique_id); ?>', action: 'firstpingok', token: '<?php echo currentToken(); ?>' }, // for update
});
},
error: function (data,status,xhr) { // error callback function
@ -3732,7 +3732,7 @@ if (!function_exists("llxFooter")) {
url: '<?php echo DOL_URL_ROOT.'/core/ajax/pingresult.php'; ?>',
timeout: 500, // timeout milliseconds
cache: false,
data: { hash_algo: 'md5', hash_unique_id: '<?php echo dol_escape_js($hash_unique_id); ?>', action: 'firstpingko', token: '<?php echo currentToken(); ?>' },
data: { hash_algo: 'dol_hash-sha256', hash_unique_id: '<?php echo dol_escape_js($hash_unique_id); ?>', action: 'firstpingko', token: '<?php echo currentToken(); ?>' },
});
}
});

View file

@ -169,7 +169,7 @@ if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
top_httphead();
dol_syslog("***** Stripe IPN was called with event->type = ".$event->type);
dol_syslog("***** Stripe IPN was called with event->type=".$event->type." service=".$service);
if ($event->type == 'payout.created') {
@ -321,7 +321,7 @@ if ($event->type == 'payout.created') {
global $stripearrayofkeysbyenv;
$error = 0;
$object = $event->data->object;
$TRANSACTIONID = $object->id;
$TRANSACTIONID = $object->id; // Example pi_123456789...
$ipaddress = $object->metadata->ipaddress;
$now = dol_now();
$currencyCodeType = strtoupper($object->currency);
@ -338,7 +338,6 @@ if ($event->type == 'payout.created') {
$sql = "SELECT pi.rowid, pi.fk_facture, pi.fk_prelevement_bons, pi.amount, pi.type, pi.traite";
$sql .= " FROM llx_prelevement_demande as pi";
$sql .= " WHERE pi.ext_payment_id = '".$db->escape($TRANSACTIONID)."'";
//$sql .= " AND pi.type = 'ban' AND pi.traite = '1'";
$sql .= " AND pi.ext_payment_site = '".$db->escape($service)."'";
$result = $db->query($sql);
@ -374,9 +373,9 @@ if ($event->type == 'payout.created') {
}
}
} else {
dol_syslog("Payment intent not found into database, so ignored.");
print "Payment intent not found into database, so ignored.";
dol_syslog("Payment intent ".$TRANSACTIONID." not found into database, so ignored.");
http_response_code(200);
print "Payment intent ".$TRANSACTIONID." not found into database, so ignored.";
return 1;
}
} else {
@ -524,7 +523,7 @@ if ($event->type == 'payout.created') {
if ($db->num_rows($result)) {
$obj = $db->fetch_object($result);
$idbon = $obj->idbon;
dol_syslog('* Set prelevement to credite');
dol_syslog('* Prelevement must be set to credited');
} else {
dol_syslog('* Prelevement not found or already credited');
}
@ -577,7 +576,7 @@ if ($event->type == 'payout.created') {
dol_syslog("The payment mode of this payment is ".$paymentTypeId." in Stripe and ".$paymentTypeIdInDolibarr." in Dolibarr. This case is not managed by the IPN");
}
} else {
dol_syslog("Nothing to do in database");
dol_syslog("Nothing to do in database because we don't know paymentTypeIdInDolibarr");
}
} elseif ($event->type == 'payment_intent.payment_failed') {
dol_syslog("A try to make a payment has failed");
@ -588,64 +587,88 @@ if ($event->type == 'payout.created') {
$paymentmethodstripeid = $object->payment_method;
$customer_id = $object->customer;
$chargesdataarray = $object->charges->data;
$chargesdataarray = array();
$objpayid = '';
$objpaydesc = '';
$objinvoiceid = 0;
$objerrcode = '';
$objerrmessage = '';
$objpaymentmodetype = '';
if (!empty($object->charges)) { // Old format
$chargesdataarray = $object->charges->data;
foreach ($chargesdataarray as $chargesdata) {
$objpayid = $chargesdata->id;
$objpaydesc = $chargesdata->description;
$objinvoiceid = 0;
if ($chargesdata->metadata->dol_type == 'facture') {
$objinvoiceid = $chargesdata->metadata->dol_id;
}
$objerrcode = $chargesdata->outcome->reason;
$objerrmessage = $chargesdata->outcome->seller_message;
foreach ($chargesdataarray as $chargesdata) {
$objpayid = $chargesdata->id;
$objpaydesc = $chargesdata->description;
$objinvoiceid = 0;
if ($chargesdata->metadata->dol_type == 'facture') {
$objinvoiceid = $chargesdata->metadata->dol_id;
$objpaymentmodetype = $chargesdata->payment_method_details->type;
break;
}
$objerrcode = $chargesdata->outcome->reason;
$objerrmessage = $chargesdata->outcome->seller_message;
}
if (!empty($object->last_payment_error)) { // New format 2023-10-16
// $object is probably an object of type Stripe\PaymentIntent
$objpayid = $object->latest_charge;
$objpaydesc = $object->description;
$objinvoiceid = 0;
if ($object->metadata->dol_type == 'facture') {
$objinvoiceid = $object->metadata->dol_id;
}
$objerrcode = empty($object->last_payment_error->code) ? $object->last_payment_error->decline_code : $object->last_payment_error->code;
$objerrmessage = $object->last_payment_error->message;
$objpaymentmodetype = $chargesdata->payment_method_details->type;
$objpaymentmodetype = $object->last_payment_error->payment_method->type;
}
// If this is a differed payment for SEPA, add a line into agenda events
if ($objpaymentmodetype == 'sepa_debit') {
$db->begin();
dol_syslog("objpayid=".$objpayid." objpaymentmodetype=".$objpaymentmodetype." objerrcode=".$objerrcode);
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($db);
// If this is a differed payment for SEPA, add a line into agenda events
if ($objpaymentmodetype == 'sepa_debit') {
$db->begin();
if ($objinvoiceid > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$invoice->fetch($objinvoiceid);
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($db);
$actioncomm->userownerid = 0;
$actioncomm->percentage = -1;
if ($objinvoiceid > 0) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$invoice = new Facture($db);
$invoice->fetch($objinvoiceid);
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_IPN';
$actioncomm->userownerid = 0;
$actioncomm->percentage = -1;
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_IPN';
$actioncomm->socid = $invoice->socid;
$actioncomm->fk_project = $invoice->fk_project;
$actioncomm->fk_element = $invoice->id;
$actioncomm->elementtype = 'invoice';
$actioncomm->ip = getUserRemoteIP();
}
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->note_private = 'Error returned on payment id '.$objpayid.' after SEPA payment request '.$objpaydesc.'<br>Error code is: '.$objerrcode.'<br>Error message is: '.$objerrmessage;
$actioncomm->label = 'Payment error (SEPA Stripe)';
$actioncomm->socid = $invoice->socid;
$actioncomm->fk_project = $invoice->fk_project;
$actioncomm->fk_element = $invoice->id;
$actioncomm->elementtype = 'invoice';
$actioncomm->ip = getUserRemoteIP();
}
$result = $actioncomm->create($user);
if ($result <= 0) {
dol_syslog($actioncomm->error, LOG_ERR);
$error++;
}
$actioncomm->note_private = 'Error returned on payment id '.$objpayid.' after SEPA payment request '.$objpaydesc.'<br>Error code is: '.$objerrcode.'<br>Error message is: '.$objerrmessage;
$actioncomm->label = 'Payment error (SEPA Stripe)';
if (! $error) {
$db->commit();
} else {
$db->rollback();
http_response_code(500);
return -1;
}
$result = $actioncomm->create($user);
if ($result <= 0) {
dol_syslog($actioncomm->error, LOG_ERR);
$error++;
}
if (! $error) {
$db->commit();
} else {
$db->rollback();
http_response_code(500);
return -1;
}
}
} elseif ($event->type == 'checkout.session.completed') { // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on).
@ -732,12 +755,11 @@ if ($event->type == 'payout.created') {
$db->query($sql);
$db->commit();
} elseif ($event->type == 'charge.succeeded') {
// TODO: create fees
// TODO: Redirect to paymentok.php
// Deprecated. TODO: create fees and redirect to paymentok.php
} elseif ($event->type == 'charge.failed') {
// TODO: Redirect to paymentko.php
// Deprecated. TODO: Redirect to paymentko.php
} elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated == true)) {
// This event is deprecated.
// Deprecated.
}
// End of page. Default return HTTP code will be 200

View file

@ -243,7 +243,7 @@ $checkedprofid6 = 0;
$checkprospectlevel = (in_array($contextpage, array('prospectlist')) ? 1 : 0);
$checkstcomm = (in_array($contextpage, array('prospectlist')) ? 1 : 0);
$arrayfields = array(
's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')), 'enabled'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID'))),
's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>-1, 'enabled'=>1),
's.nom'=>array('label'=>"ThirdPartyName", 'position'=>2, 'checked'=>1),
's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1),
's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))),

View file

@ -4487,7 +4487,7 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright) .oddeven.tagtr:nt
.noborder > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre),
.noborder .oddeven.tagtr:nth-child(even):not(:last-of-type) .tagtd:not(.liste_titre)
{
border-bottom: 1px solid #eaeaea;
border-bottom: 1px solid #f0f0f0;
}
.noborder:not(.editmode) > tbody > tr:nth-child(odd):not(.liste_titre):not(.nooddeven), .liste > tbody > tr:nth-child(odd):not(.liste_titre):not(.nooddeven),
@ -4502,7 +4502,7 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright) .oddeven.tagtr:nt
.noborder > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre),
.noborder .oddeven.tagtr:nth-child(odd):not(:last-child) .tagtd:not(.liste_titre)
{
border-bottom: 1px solid #eaeaea;
border-bottom: 1px solid #f0f0f0;
}
ul.noborder li:nth-child(even):not(.liste_titre) {

View file

@ -2831,7 +2831,7 @@ class User extends CommonObject
}
// Info Login
$datas['opendiv'] = '<div class="centpercent">';
$datas['opendiv'] = '<div class="centpercent divtooltip">';
$datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("User").'</u> '.$this->getLibStatut(4);
$datas['name'] = '<br><b>'.$langs->trans('Name').':</b> '.dol_string_nohtmltag($this->getFullName($langs, ''));
if (!empty($this->login)) {

View file

@ -382,6 +382,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 0;
$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 0;
$conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 0;
$conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 0;
$_COOKIE["id"]=111;
$_POST["param0"]='A real string with <a href="rrr" title="aa&quot;bb">aaa</a> and " and \' and &amp; inside content';
@ -721,25 +722,45 @@ class SecurityTest extends PHPUnit\Framework\TestCase
$conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT = 3;
$_POST["pagecontentwithlinks"]='<img src="aaa"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>';
$_POST["pagecontentwithlinks"]='<img src="aaa"><img src="bbb"><img src="/ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('ErrorTooManyLinksIntoHTMLString', $result, 'Test on limit on GETPOST fails');
// Test that img src="data:..." is excluded from the count of external links
$conf->global->MAIN_SECURITY_MAX_IMG_IN_HTML_CONTENT = 3;
$_POST["pagecontentwithlinks"]='<img src="data:abc"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>';
$_POST["pagecontentwithlinks"]='<img src="data:abc"><img src="bbb"><img src="/ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('<img src="data:abc"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>', $result, 'Test on limit on GETPOST fails');
$this->assertEquals('<img src="data:abc"><img src="bbb"><img src="/ccc"><span style="background: url(/ddd)"></span>', $result, 'Test on limit on GETPOST fails');
$conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2;
// Test that no links is allowed
$conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1;
$_POST["pagecontentwithlinks"]='<img src="data:abc"><img src="bbb"><img src="ccc"><span style="background: url(/ddd)"></span>';
$_POST["pagecontentwithlinks"]='<img src="data:abc"><img src="bbb"><img src="/ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('ErrorHTMLLinksNotAllowed', $result, 'Test on limit on GETPOST fails');
$this->assertEquals('ErrorHTMLLinksNotAllowed', $result, 'Test on limit on MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 2 (no links allowed)');
$conf->global->MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1;
// Test that links on wrapper or local url are allowed
$_POST["pagecontentwithnowrapperlinks"]='<img src="data:abc"><img src="bbb"><img src="/ccc"><span style="background: url(/ddd)"></span>';
$result=GETPOST("pagecontentwithnowrapperlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('<img src="data:abc"><img src="bbb"><img src="/ccc"><span style="background: url(/ddd)"></span>', $result, 'Test on MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1 (links on data or relative links ar allowed)');
// Test that links not on wrapper and not data are disallowed
$_POST["pagecontentwithnowrapperlinks"]='<img src="https://aaa">';
$result=GETPOST("pagecontentwithnowrapperlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('ErrorHTMLExternalLinksNotAllowed', $result, 'Test on MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1 (no links to http allowed)');
// Test that links not on wrapper and not data are disallowed
$_POST["pagecontentwithnowrapperlinks"]='<span style="background: url(http://ddd)"></span>';
$result=GETPOST("pagecontentwithnowrapperlinks", 'restricthtml');
print __METHOD__." result=".$result."\n";
$this->assertEquals('ErrorHTMLExternalLinksNotAllowed', $result, 'Test on MAIN_DISALLOW_URL_INTO_DESCRIPTIONS = 1 (no links to http allowed)');
return $result;
}