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

This commit is contained in:
Laurent Destailleur 2026-05-10 01:29:52 +02:00
commit 3a34fe6a76
249 changed files with 2531 additions and 1015 deletions

View file

@ -187,7 +187,7 @@ Translations
------------
The source language (en_US) is maintained in the repository.
All other translations are managed online at [Transifex](https://www.transifex.com/dolibarr-association/dolibarr/).
All other translations are managed online at [Transifex](https://explore.transifex.com/dolibarr-association/).
Translations done on transifex are available in the next major release.

View file

@ -25,7 +25,7 @@ The following changes may create regressions for some external modules, but were
* Login API are off by default (API must be used with the bearer token). Must set API_ENABLE_LOGIN_API to have them enabled.
* Renamed hidden var DEPOSIT_AS_CREDIT_AVAILABLE_EVEN_UNPAID into DEPOSIT_CAN_BE_CONVERTED_AS_AVAILABLE_CREDIT_EVEN_IF_NOT_YET_PAID
* The substitution variable __MYCOUNTRY_ID__ has been removed (duplicate of standard __MYCOMPANY_COUNTRY_ID__).
* Renamed hook "info_admin" into "messageOfTheDay".
***** ChangeLog for 23.0.3 compared to 23.0.2 *****

View file

@ -205,7 +205,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Argentina invoice numbering using A,B,C...
- Greece fetch customer vat details from AADE, all invoice types, MyData(external free module)
- ZATCA e-invoicing QR-Code
- Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- Compatible with [European directives](https://commission.europa.eu/topics/taxation_en) (2006/112/CE ... 2010/45/UE)
- Compatible with data privacy rules (Europe's GDPR, ...)
- ...
- Flexible PDF & ODT generation for invoices, proposals, orders...

View file

@ -66,7 +66,7 @@ Reports are processed around once a month.
ONLY vulnerabilities discovered, when the following setup on test platform is used, are "valid":
* The version to analyze must be the last version available in the "develop" branch. Also, reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated.
* Installation must be done properly for a production usage. This oncludes:
* Installation must be done properly for a production usage. This includes:
** creation of the install.lock in the last step of installation process.
** $dolibarr_main_prod must be set to 1 in conf.php
** $dolibarr_nocsrfcheck must be kept to the value 0 in conf.php (this is the default value)

View file

@ -151,7 +151,7 @@
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<!-- Disallow several spaces after comma -->
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
<!-- We want to allow this because we want to be able to align params on several similar functions on different lines -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
<severity>0</severity>
</rule>

View file

@ -9,8 +9,8 @@
*/
return [
// # Issue statistics:
// PhanUndeclaredProperty : 390+ occurrences
// PhanUndeclaredGlobalVariable : 50+ occurrences
// PhanUndeclaredProperty : 380+ occurrences
// PhanUndeclaredGlobalVariable : 45+ occurrences
// PhanTypeMismatchArgument : 35+ occurrences
// PhanTypeMismatchProperty : 20+ occurrences
// PhanTypeInvalidDimOffset : 10+ occurrences
@ -38,7 +38,6 @@ return [
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'],
'htdocs/compta/bank/class/account.class.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/line.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/compta/bank/various_payment/card.php' => ['PhanUndeclaredProperty'],
'htdocs/compta/bank/various_payment/document.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
'htdocs/compta/facture/class/facture-rec.class.php' => ['PhanUndeclaredProperty'],
@ -220,7 +219,6 @@ return [
'htdocs/variants/tpl/productattributevalueline_view.tpl.php' => ['PhanUndeclaredProperty'],
'htdocs/webhook/class/target.class.php' => ['PhanUndeclaredMethod'],
'htdocs/webhook/target_card.php' => ['PhanUndeclaredGlobalVariable'],
'htdocs/webportal/class/html.formlistwebportal.class.php' => ['PhanUndeclaredProperty'],
'htdocs/webservices/server_project.php' => ['PhanUndeclaredProperty'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.

View file

@ -231,9 +231,21 @@ if (empty($reshook)) {
} elseif ($action == 'enable' /* && $permissiontoadd */) {
if ($accounting->fetch($id)) {
$mode = GETPOSTINT('mode');
$result = $accounting->accountActivate($id, $mode);
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
// Block the activation of matching on a centralized account
if ($mode == 1 && !empty($accounting->centralized)) {
setEventMessages($langs->trans('CentralizedAccountCannotBeMatchable'), null, 'errors');
} else {
$result = $accounting->accountActivate($id, $mode);
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
// When activating centralized mode, force matchable to 0
if ($mode == 2 && $result >= 0) {
$result = $accounting->accountDeactivate($id, 1);
if ($result < 0) {
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}
}
}
$action = 'update';
@ -812,17 +824,24 @@ if ($resql) {
}
}
// Activated or not reconciliation on an accounting account
// Activated or not matching on an accounting account
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="center">';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&page='.$page.'&mode=1&token='.newToken().'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
if (!empty($obj->centralized)) {
// Centralized account: matching not possible, grayed out switch
print '<a style="cursor:not-allowed;" title="' . dol_escape_htmltag($langs->trans('CentralizedAccountCannotBeMatchable')) . '">';
print img_picto('', !empty($obj->reconcilable) ? 'switch_on' : 'switch_off', '', 0, 0, 1, '', 'opacitymedium');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&page='.$page.'&mode=1&token='.newToken().'">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?id=' . $obj->rowid . '&action=enable&page=' . $page . '&mode=1&token=' . newToken() . '">';
print img_picto($langs->trans('Disabled'), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?id=' . $obj->rowid . '&action=disable&page=' . $page . '&mode=1&token=' . newToken() . '">';
print img_picto($langs->trans('Activated'), 'switch_on');
print '</a>';
}
}
print '</td>';
if (!$i) {

View file

@ -245,7 +245,14 @@ if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting' && $massaction != 'preclonebookkeepingwriting' && $massaction != 'preassignaccountbookkeepingwriting' && $massaction != 'prereturnaccountbookkeepingwriting') {
if (!GETPOST('confirmmassaction', 'alpha') &&
!in_array($massaction, [
'pregeneralunmatchingmanual',
'predeletebookkeepingwriting',
'preclonebookkeepingwriting',
'preassignaccountbookkeepingwriting',
'prereturnaccountbookkeepingwriting'
])) {
$massaction = '';
}
@ -592,69 +599,27 @@ if (empty($reshook)) {
}
}
// mass actions on lettering
// mass actions on matching
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
if ($massaction == 'letteringauto' && $permissiontoadd) {
if ($massaction == 'generalmatchingmanual' && $permissiontoadd) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
if ($nb_lettering < 0) {
setEventMessages('', $lettering->errors, 'errors');
$error += 1;
$nb_lettering = max(0, abs($nb_lettering) - 2);
} elseif ($nb_lettering == 0) {
$nb_lettering = 0;
setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs');
}
if ($nb_lettering == 1) {
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
} elseif ($nb_lettering > 1) {
setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
}
if (!$error) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($massaction == 'letteringmanual' && $permissiontoadd) {
$lettering = new Lettering($db);
$result = $lettering->updateLettering($toselect);
$result = $lettering->updateGeneralMatching($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMachingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) {
} elseif ($action == 'generalunmatchingmanual' && $confirm == 'yes' && $permissiontodelete) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) {
setEventMessages('', $lettering->errors, 'errors');
$error += 1;
$nb_lettering = max(0, abs($nb_lettering) - 2);
} elseif ($nb_lettering == 0) {
$nb_lettering = 0;
setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs');
}
if ($nb_lettering == 1) {
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
} elseif ($nb_lettering > 1) {
setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
}
if (!$error) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->deleteLettering($toselect);
if ($nb_lettering < 0) {
$result = $lettering->deleteGeneralMatching($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnmatchingModified' : 'AccountancyOneUnmatchingModifiedSuccessfully'), [], 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
exit;
}
}
}
@ -680,6 +645,7 @@ $sql .= " t.label_operation,";
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.matching_general,";
$sql .= " t.montant as amount,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
@ -834,10 +800,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) {
// List of mass actions available
$arrayofmassactions = array();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
$arrayofmassactions['generalmatchingmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('GeneralMatchingManual');
$arrayofmassactions['pregeneralunmatchingmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('GeneralUnmatchingManual');
}
if ($user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['preclonebookkeepingwriting'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone");
@ -852,7 +816,16 @@ if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting', 'preclonebookkeepingwriting', 'preassignaccountbookkeepingwriting', 'prereturnaccountbookkeepingwriting'))) {
if (GETPOSTINT('nomassaction')
|| in_array($massaction,
array(
'pregeneralunmatchingmanual',
'predeletebookkeepingwriting',
'preclonebookkeepingwriting',
'preassignaccountbookkeepingwriting',
'prereturnaccountbookkeepingwriting'
)
)) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
@ -898,10 +871,8 @@ if (empty($reshook)) {
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
if ($massaction == 'preunletteringauto') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'preunletteringmanual') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
if ($massaction == 'pregeneralunmatchingmanual') {
print $form->formconfirm($_SERVER['PHP_SELF'], $langs->trans('ConfirmMassGeneralUnmatchingManual'), $langs->trans("ConfirmMassGeneralUnmatchingQuestion", count($toselect)), "generalunmatchingmanual", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'predeletebookkeepingwriting') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'preassignaccountbookkeepingwriting') {
@ -1232,6 +1203,7 @@ while ($i < min($num, $limit)) {
$line->amount = $obj->amount;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->matching_general = $obj->matching_general;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;
@ -1444,7 +1416,19 @@ while ($i < min($num, $limit)) {
// Matching code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="center">'.$line->lettering_code.'</td>';
$tooltipText = "";
$icon = "";
$badge = "";
if (!empty($line->matching_general)) {
$tooltipText .= $langs->trans('GeneralMatching');
$icon .= "fa-book";
$badge .= "badge-status4";
} elseif (empty($line->matching_general) && !empty($line->lettering_code)) {
$tooltipText .= $langs->trans('AuxiliaryMatching');
$icon .= "fa-user";
$badge .= "badge-status1";
}
print '<td class="center classfortooltip" title="'.$tooltipText.'"><span class="badge '.$badge.'"><i class="fas '.$icon.' fa-xs"></i> '.$line->lettering_code.'</span></td>';
if (!$i) {
$totalarray['nbfield']++;
}

View file

@ -600,7 +600,27 @@ if (empty($reshook)) {
// others mass actions
if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
if ($massaction == 'letteringauto' && $permissiontoadd) {
if ($massaction == 'generalmatchingmanual' && $permissiontoadd) {
$lettering = new Lettering($db);
$result = $lettering->updateGeneralMatching($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMachingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit;
}
} elseif ($action == 'generalunmatchingmanual' && $confirm == 'yes' && $permissiontodelete) {
$lettering = new Lettering($db);
$result = $lettering->deleteGeneralMatching($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnmatchingModified' : 'AccountancyOneUnmatchingModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit;
}
} elseif ($type == 'sub' && $massaction == 'letteringauto' && $permissiontoadd) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
if ($nb_lettering < 0) {
@ -609,39 +629,39 @@ if (empty($reshook)) {
$nb_lettering = max(0, abs($nb_lettering) - 2);
} elseif ($nb_lettering == 0) {
$nb_lettering = 0;
setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs');
setEventMessages($langs->trans('AccountancyNoMatchingModified'), array(), 'mesgs');
}
if ($nb_lettering == 1) {
setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans('AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs');
} elseif ($nb_lettering > 1) {
setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
setEventMessages($langs->trans('AccountancyMatchingModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
}
if (!$error) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($massaction == 'letteringmanual' && $permissiontoadd) {
} elseif ($type == 'sub' && $massaction == 'letteringmanual' && $permissiontoadd) {
$lettering = new Lettering($db);
$result = $lettering->updateLettering($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoLetteringModified' : 'AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMatchingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($type == 'sub' && $massaction == 'letteringpartial') {
} elseif ($type == 'sub' && $massaction == 'letteringpartial' && $permissiontoadd) {
$lettering = new Lettering($db);
$result = $lettering->updateLettering($toselect, 0, true);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoLetteringModified' : 'AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoMatchingModified' : 'AccountancyOneMatchingModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) {
} elseif ($type == 'sub' && $action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
if ($nb_lettering < 0) {
@ -650,25 +670,25 @@ if (empty($reshook)) {
$nb_lettering = max(0, abs($nb_lettering) - 2);
} elseif ($nb_lettering == 0) {
$nb_lettering = 0;
setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs');
setEventMessages($langs->trans('AccountancyNoUnmatchingModified'), array(), 'mesgs');
}
if ($nb_lettering == 1) {
setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans('AccountancyOneUnmatchingModifiedSuccessfully'), array(), 'mesgs');
} elseif ($nb_lettering > 1) {
setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
setEventMessages($langs->trans('AccountancyUnmatchingModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
}
if (!$error) {
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
} elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) {
} elseif ($type == 'sub' && $action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) {
$lettering = new Lettering($db);
$nb_lettering = $lettering->deleteLettering($toselect);
if ($result < 0) {
setEventMessages('', $lettering->errors, 'errors');
} else {
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnletteringModified' : 'AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
setEventMessages($langs->trans($result == 0 ? 'AccountancyNoUnmatchingModified' : 'AccountancyOneUnmatchingModifiedSuccessfully'), array(), 'mesgs');
header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
exit();
}
@ -846,13 +866,18 @@ print $formconfirm;
// List of mass actions available
$arrayofmassactions = array();
if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
if ($type == 'sub') {
$arrayofmassactions['letteringpartial'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringPartial');
// Auxiliary ledger matching only
$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
$arrayofmassactions['letteringpartial'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringPartial');
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
} else {
// General ledger matching only
$arrayofmassactions['generalmatchingmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('GeneralMatchingManual');
$arrayofmassactions['pregeneralunmatchingmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('GeneralUnmatchingManual');
}
$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
}
if ($user->hasRight('accounting', 'mouvements', 'creer')) {
$arrayofmassactions['preclonebookkeepingwriting'] = img_picto('', 'clone', 'class="pictofixedwidth"').$langs->trans("Clone");
@ -867,7 +892,7 @@ if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting', 'preclonebookkeepingwriting', 'preassignaccountbookkeepingwriting', 'prereturnaccountbookkeepingwriting'))) {
if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'pregeneralunmatchingmanual', 'predeletebookkeepingwriting', 'preclonebookkeepingwriting', 'preassignaccountbookkeepingwriting', 'prereturnaccountbookkeepingwriting'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
@ -927,6 +952,8 @@ if ($massaction == 'preunletteringauto') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'preunletteringmanual') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'pregeneralunmatchingmanual') {
print $form->formconfirm($_SERVER['PHP_SELF'], $langs->trans('ConfirmMassGeneralUnmatchingManual'), $langs->trans('ConfirmMassGeneralUnmatchingQuestion', count($toselect)), 'generalunmatchingmanual', null, '', 0, 200, 500, 1);
} elseif ($massaction == 'predeletebookkeepingwriting') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
} elseif ($massaction == 'preassignaccountbookkeepingwriting') {
@ -1534,10 +1561,24 @@ while ($i < min($num, $limit)) {
// Matching code
if (!empty($arrayfields['t.lettering_code']['checked'])) {
print '<td class="center">'.dol_escape_htmltag((string) $line->lettering_code).'</td>';
if (!$i) {
$totalarray['nbfield']++;
$tooltipText = "";
if (!empty($line->matching_general)) {
$tooltipText .= $langs->trans('GeneralMatching');
} elseif (empty($line->matching_general) && !empty($line->lettering_code)) {
$tooltipText .= $langs->trans('AuxiliaryMatching');
}
print '<td class="center classfortooltip" title="'.$tooltipText.'">';
if ($type == 'sub') {
// Auxiliary account matching
if (!empty($line->lettering_code)) {
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
print '<span class="badge badge-status1"><i class="fas fa-user fa-xs"></i> ' . dol_escape_htmltag((string) $line->lettering_code) . '</span>';
}
} elseif (!empty($line->matching_general) && !empty($line->lettering_code)) {
print '<span class="badge badge-status4"><i class="fas fa-book fa-xs"></i> ' . dol_escape_htmltag((string) $line->lettering_code) . '</span>';
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Amount debit

View file

@ -976,6 +976,7 @@ class BookKeeping extends CommonObject
$sql .= " t.sens,";
$sql .= " t.multicurrency_amount,";
$sql .= " t.multicurrency_code,";
$sql .= " t.matching_general,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
$sql .= " t.fk_user_author,";
@ -1104,6 +1105,7 @@ class BookKeeping extends CommonObject
$line->sens = $obj->sens;
$line->multicurrency_amount = $obj->multicurrency_amount;
$line->multicurrency_code = $obj->multicurrency_code;
$line->matching_general = (bool) $obj->matching_general;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $this->db->jdate($obj->date_lettering);
$line->fk_user_author = $obj->fk_user_author;
@ -3946,6 +3948,11 @@ class BookKeepingLine extends CommonObjectLine
*/
public $sens;
/**
* @var bool
*/
public $matching_general;
/**
* @var ?string
*/

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2013-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
@ -158,8 +158,8 @@ class Lettering extends BookKeeping
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='".$this->db->escape($obj->code_journal)."')";
$sql .= " WHERE payfacf.fk_paiementfourn = '".$this->db->escape($obj->url_id)."' ";
$sql .= " AND facf.entity = ".$conf->entity;
$sql .= " AND code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
$sql .= " AND facf.entity = " . (int) $conf->entity;
$sql .= " AND code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=" . (int) $conf->entity . ") ";
$sql .= " AND ( ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
@ -187,8 +187,8 @@ class Lettering extends BookKeeping
$sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier ';
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn facf ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (".$this->db->sanitize(implode(',', $ids_fact))."))";
$sql .= " WHERE bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=3 AND entity=".$conf->entity.") ";
$sql .= " AND facf.entity = ".$conf->entity;
$sql .= " WHERE bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=3 AND entity=". (int) $conf->entity.") ";
$sql .= " AND facf.entity = " . (int) $conf->entity;
$sql .= " AND ( ";
if ($object->code_compta_client != "") {
$sql .= " bk.subledger_account = '".$this->db->escape($object->code_compta_client)."' ";
@ -219,7 +219,7 @@ class Lettering extends BookKeeping
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."paiement as pay ON payfac.fk_paiement=pay.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='".$this->db->escape($obj->code_journal)."')";
$sql .= " WHERE payfac.fk_paiement = '".$this->db->escape($obj->url_id)."' ";
$sql .= " AND bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=".$conf->entity.") ";
$sql .= " AND bk.code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4 AND entity=". (int) $conf->entity.") ";
$sql .= " AND fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND ( ";
if ($object->code_compta_client != "") {
@ -247,7 +247,7 @@ class Lettering extends BookKeeping
$sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier ';
$sql .= " FROM ".MAIN_DB_PREFIX."facture fac ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (".$this->db->sanitize(implode(',', $ids_fact))."))";
$sql .= " WHERE code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=2 AND entity=".$conf->entity.") ";
$sql .= " WHERE code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=2 AND entity=". (int) $conf->entity.") ";
$sql .= " AND fac.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy
$sql .= " AND ( ";
if ($object->code_compta_client != "") {
@ -299,6 +299,8 @@ class Lettering extends BookKeeping
*/
public function updateLettering($ids = array(), $notrigger = 0, $partial = false)
{
global $langs;
$now = dol_now();
$error = 0;
$affected_rows = 0;
@ -309,9 +311,10 @@ class Lettering extends BookKeeping
$this->db->begin();
// Check partial / normal lettering case
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT ab.lettering_code, GROUP_CONCAT(DISTINCT ab.rowid SEPARATOR ',') AS bookkeeping_ids";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " GROUP BY ab.lettering_code";
$sql .= " ORDER BY ab.lettering_code DESC";
@ -331,7 +334,8 @@ class Lettering extends BookKeeping
} elseif (!$partial && preg_match('/^[a-z]+$/', $obj->lettering_code)) {
// Delete partial lettering code if set normal lettering
$sql2 = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
$sql2 .= " lettering_code = NULL";
$sql2 .= " matching_general = 0";
$sql2 .= ", lettering_code = NULL";
$sql2 .= ", date_lettering = NULL";
$sql2 .= " WHERE entity IN (" . getEntity('accountancy') . ")";
$sql2 .= " AND lettering_code = '" . $this->db->escape($obj->lettering_code) . "'";
@ -353,11 +357,13 @@ class Lettering extends BookKeeping
if (!$error && !empty($ids)) {
// Get next code
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT DISTINCT ab2.lettering_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping AS ab2 ON ab2.subledger_account = ab.subledger_account";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ")";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND ab2.lettering_code != ''";
$sql .= " AND ab2.matching_general = 0";
$sql .= " ORDER BY ab2.lettering_code DESC";
dol_syslog(__METHOD__ . " - Get next code", LOG_DEBUG);
@ -381,8 +387,12 @@ class Lettering extends BookKeeping
// Test amount integrity
if (!$error && !$partial) {
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
$sql .= " rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ") AND lettering_code IS NULL AND subledger_account != ''";
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND lettering_code IS NULL";
$sql .= " AND subledger_account != ''";
dol_syslog(__METHOD__ . " - Test amount integrity", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -402,10 +412,14 @@ class Lettering extends BookKeeping
// Update lettering code
if (!$error) {
$idlist = implode(',', array_map('intval', $ids));
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
$sql .= " lettering_code='" . $this->db->escape($letter) . "'";
$sql .= ", date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
$sql .= " WHERE rowid IN (" . $this->db->sanitize(implode(',', $ids)) . ") AND lettering_code IS NULL AND subledger_account != ''";
$sql .= ", matching_general = 0";
$sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND lettering_code IS NULL";
$sql .= " AND subledger_account != ''";
dol_syslog(__METHOD__ . " - Update lettering code", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -441,10 +455,12 @@ class Lettering extends BookKeeping
{
$error = 0;
$idlist = implode(',', array_map('intval', $ids));
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping SET";
$sql .= " lettering_code = NULL";
$sql .= " matching_general = 0";
$sql .= ", lettering_code = NULL";
$sql .= ", date_lettering = NULL";
$sql .= " WHERE rowid IN (".$this->db->sanitize(implode(',', $ids)).")";
$sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND subledger_account != ''";
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -498,6 +514,263 @@ class Lettering extends BookKeeping
}
}
/**
* Update the matching on general account
* @param int[] $ids ids array
* @return int
*/
public function updateGeneralMatching(array $ids = [])
{
global $conf, $langs;
$now = dol_now();
$error = 0;
$affected_rows = 0;
// Generate a string with n char 'A' (for manual/auto matching)
$letter = str_repeat('A', getDolGlobalInt('ACCOUNTING_LETTERING_NBLETTERS', 3));
// Check for unreconcilable accounts
$pcgId = getDolGlobalInt('CHARTOFACCOUNTS');
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT DISTINCT numero_compte";
$sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab";
$sql .= " LEFT JOIN (";
$sql .= " SELECT aa.rowid, aa.account_number";
$sql .= " FROM " . $this->db->prefix() . "accounting_account AS aa";
$sql .= " INNER JOIN " . $this->db->prefix() . "accounting_system AS asys ON asys.pcg_version = aa.fk_pcg_version";
$sql .= " WHERE asys.rowid = ".(int) $pcgId." AND aa.reconcilable";
$sql .= " ) AS reconciliable_accounts ON reconciliable_accounts.account_number = ab.numero_compte";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND reconciliable_accounts.rowid IS NULL";
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$this->errors[] = $langs->trans(
'ErrorAccountNotReconcilable',
$obj->numero_compte,
dol_buildpath('accountancy/admin/account.php', 1) . '?search_account=' . $obj->numero_compte,
$langs->transnoentitiesnoconv('Chartofaccounts')
);
return -1;
}
$this->db->free($resql);
} else {
$this->errors[] = 'Error' . $this->db->lasterror();
return -1;
}
// Get fiscal year & verify all selected rows belong to the same fiscal year
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT fy.rowid, fy.date_start, fy.date_end, COUNT(DISTINCT fy.rowid) AS nb_fiscalyears";
$sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab";
$sql .= " INNER JOIN " . $this->db->prefix() . "accounting_fiscalyear AS fy";
$sql .= " ON ab.doc_date BETWEEN fy.date_start AND fy.date_end";
$sql .= " AND fy.entity = " . (int) $conf->entity;
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " GROUP BY fy.rowid, fy.date_start, fy.date_end";
dol_syslog(__METHOD__ . " - Get fiscal year", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = 'Error ' . $this->db->lasterror();
return -1;
}
$fiscalYearRows = [];
while ($obj = $this->db->fetch_object($resql)) {
$fiscalYearRows[] = $obj;
}
$this->db->free($resql);
// No fiscal year found for any of the selected rows
if (empty($fiscalYearRows)) {
$this->errors[] = $langs->trans('ErrorFiscalYearNotFound');
return -1;
}
// Cross-fiscal-year matching is forbidden
if (count($fiscalYearRows) > 1) {
$periods = array_map(
/** @param object $row */
function ($row) {
return dol_print_date($this->db->jdate($row->date_start), 'day') . ' – ' . dol_print_date($this->db->jdate($row->date_end), 'day');
},
$fiscalYearRows
);
$this->errors[] = $langs->transnoentitiesnoconv('ErrorMatchingCrossFiscalYear', implode(', ', $periods));
return -1;
}
$fiscalYear = $fiscalYearRows[0];
$fiscalYearStart = $this->db->jdate($fiscalYear->date_start);
$fiscalYearEnd = $this->db->jdate($fiscalYear->date_end);
// Get next code
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT DISTINCT ab2.lettering_code";
$sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab";
$sql .= " LEFT JOIN " . $this->db->prefix() . "accounting_bookkeeping AS ab2 ON ab2.numero_compte = ab.numero_compte";
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND ab2.lettering_code != ''";
$sql .= " AND ab2.matching_general = 1";
$sql .= " AND ab2.doc_date BETWEEN '" . $this->db->idate($fiscalYearStart) . "' AND '" . $this->db->idate($fiscalYearEnd) . "'";
$sql .= " ORDER BY ab2.lettering_code DESC";
dol_syslog(__METHOD__ . " - Get next code", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
if (!empty($obj->lettering_code) && preg_match('/^[A-Z]+$/', $obj->lettering_code)) {
$letter = $obj->lettering_code;
$letter++;
break;
}
}
$this->db->free($resql);
} else {
$this->errors[] = 'Error' . $this->db->lasterror();
$error++;
}
// Test amount integrity
if (!$error) {
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred";
$sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping";
$sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND lettering_code IS NULL";
dol_syslog(__METHOD__ . " - Test amount integrity", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($obj = $this->db->fetch_object($resql)) {
if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
$this->errors[] = 'Total not exacts ' . round(abs($obj->deb), 2) . ' vs ' . round(abs($obj->cred), 2);
$error++;
}
}
$this->db->free($resql);
} else {
$this->errors[] = 'Erreur sql' . $this->db->lasterror();
$error++;
}
}
// Update matching code
if (!$error) {
$idlist = implode(',', array_map('intval', $ids));
$sql = "UPDATE " . $this->db->prefix() . "accounting_bookkeeping SET";
$sql .= " lettering_code='" . $this->db->escape($letter) . "'";
$sql .= ", date_lettering = '" . $this->db->idate($now) . "'";
$sql .= ", matching_general = 1";
$sql .= " WHERE rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND lettering_code IS NULL";
dol_syslog(__METHOD__ . " - Update gl lettering code", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = "Error " . $this->db->lasterror();
} else {
$affected_rows = $this->db->affected_rows($resql);
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::update " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
}
return -1 * $error;
} else {
$this->db->commit();
return $affected_rows;
}
}
/**
* Delete matching code on general account
* Deletes all lines sharing the same lettering_code+numero_compte in the same fiscal year
*
* @param int[] $ids ids array
* @return int Nb of affected rows or -1 if error
*/
public function deleteGeneralMatching(array $ids = [])
{
global $conf;
$error = 0;
// Step 1: collect all (lettering_code, numero_compte, fiscal year) from selected ids
$idlist = implode(',', array_map('intval', $ids));
$sql = "SELECT DISTINCT ab.lettering_code, ab.numero_compte, fy.date_start, fy.date_end";
$sql .= " FROM " . $this->db->prefix() . "accounting_bookkeeping AS ab";
$sql .= " INNER JOIN " . $this->db->prefix() . "accounting_fiscalyear AS fy";
$sql .= " ON ab.doc_date BETWEEN fy.date_start AND fy.date_end";
$sql .= " AND fy.entity = " . (int) $conf->entity;
$sql .= " WHERE ab.rowid IN (" . $this->db->sanitize($idlist) . ")";
$sql .= " AND ab.matching_general = 1";
$sql .= " AND ab.lettering_code IS NOT NULL AND ab.lettering_code != ''";
dol_syslog(__METHOD__ . " - Collect lettering groups to delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->errors[] = 'Error ' . $this->db->lasterror();
return -1;
}
$groups = [];
while ($obj = $this->db->fetch_object($resql)) {
$groups[] = [
'code' => $obj->lettering_code,
'compte' => $obj->numero_compte,
'date_start' => $obj->date_start,
'date_end' => $obj->date_end,
];
}
$this->db->free($resql);
if (empty($groups)) {
return 0; // Nothing to delete (lines not matched or already unmatched)
}
// Step 2: for each group, delete all lines sharing the same code+account+fiscal year
$affected = 0;
foreach ($groups as $group) {
$sql = "UPDATE " . $this->db->prefix() . "accounting_bookkeeping SET";
$sql .= " lettering_code = NULL";
$sql .= ", date_lettering = NULL";
$sql .= ", matching_general = 0";
$sql .= " WHERE numero_compte = '" . $this->db->escape($group['compte']) . "'";
$sql .= " AND lettering_code = '" . $this->db->escape($group['code']) . "'";
$sql .= " AND matching_general = 1";
$sql .= " AND doc_date BETWEEN '" . $this->db->escape($group['date_start']) . "' AND '" . $this->db->escape($group['date_end']) . "'";
dol_syslog(__METHOD__ . " - Delete gl matching group " . $group['code'] . "/" . $group['compte'], LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = 'Error ' . $this->db->lasterror();
break;
}
$affected += $this->db->affected_rows($resql);
}
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this) . "::deleteGeneralMatching " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
}
return -1 * $error;
}
return $affected;
}
/**
* Lettering bookkeeping lines
*

View file

@ -4,7 +4,7 @@
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -51,7 +51,6 @@ $langs->loadLangs(array("admin", "members"));
$action = GETPOST('action', 'aZ09');
// Hook to be used by external payment modules (ie Payzen, ...)
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('newpayment'));
if (!$user->admin) {

View file

@ -434,7 +434,7 @@ class Members extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$member->array_options[$index] = $this->_checkValForAPI($field, $val, $member);
$member->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $member);
}
continue;
}

View file

@ -166,7 +166,7 @@ class MembersTypes extends DolibarrApi
continue;
}
$membertype->$field = $value;
$membertype->$field = $this->_checkValForAPI($field, $value, $membertype);
}
if ($membertype->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error creating member type', array_merge(array($membertype->error), $membertype->errors));
@ -210,7 +210,7 @@ class MembersTypes extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$membertype->array_options[$index] = $this->_checkValForAPI($field, $val, $membertype);
$membertype->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $membertype);
}
continue;
}

View file

@ -244,7 +244,7 @@ class Subscriptions extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$subscription->array_options[$index] = $this->_checkValForAPI($field, $val, $subscription);
$subscription->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $subscription);
}
continue;
}

View file

@ -4,7 +4,7 @@
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021-2023 Waël Almoman <info@almoman.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
@ -46,13 +46,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Load translation files required by the page
$langs->loadLangs(array("companies", "members"));
$hookmanager = new HookManager($db);
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('membersindex'));
// Security check
$result = restrictedArea($user, 'adherent');

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -83,8 +83,6 @@ if ($cancel) {
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
$action = 'edit';
/*
* View

View file

@ -308,7 +308,7 @@ if ($action == 'install' && $allowonlineinstall) {
}
*/
// Check if module is in the remote malware list
// Check if module is in the remote malware blacklist (at URL DolibarrModules::URL_FOR_BLACKLISTED_MODULES)
if (!$error) {
if (GETPOST('checkforcompliance') == 'on') {
try {
@ -1557,7 +1557,7 @@ if ($mode == 'deploy') {
print $langs->trans("YouCanSubmitFile").'<br><br><br>';
print '<span class="opacitymedium"><input class="paddingright" type="checkbox" name="checkforcompliance" id="checkforcompliance"'.(getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES') ? ' disabled="disabled"' : 'checked="checked"').'>';
print '<label for="checkforcompliance">'.$form->textwithpicto($langs->trans("CheckIfModuleIsNotBlackListed"), $langs->trans("CheckIfModuleIsNotBlackListedHelp")).'</label>';
print '<label for="checkforcompliance">'.$form->textwithpicto($langs->trans("CheckIfModuleIsNotBlackListed"), $langs->trans("CheckIfModuleIsNotBlackListedHelp").'<br><br>'.DolibarrModules::URL_FOR_BLACKLISTED_MODULES).'</label>';
print '</span><br><br>';
$max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb

View file

@ -629,7 +629,7 @@ print '<br>';
// File extension locked in upload by default
print '<strong>'.$langs->trans("UploadExtensionRestriction").'</strong>: ';
print implode(', ', explode(',', getDolGlobalString('MAIN_FILE_EXTENSION_UPLOAD_RESTRICTION')));
print implode(', ', explode(',', getDolGlobalString('MAIN_FILE_EXTENSION_UPLOAD_RESTRICTION', implode(',', getExecutableContent()))));
print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Recommended").': '.implode(', ', getExecutableContent()).')</span>';
print '<br>';
print '<br>';

View file

@ -271,6 +271,13 @@ if (getDolGlobalString("AI_API_SERVICE")) {
include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php';
print $out;
print ' &nbsp; ';
if (getDolGlobalString("AI_DEBUG")) {
print ' <span class="small opacitymedium">'.$langs->trans("DebugOnInFile", 'dolibarr_ai.log').'</span>';
} else {
print ' <span class="small opacitymedium">'.$langs->trans("DebugOff", 'dolibarr_ai.log').'</span>';
}
print '<br><textarea id="'.$htmlname.'" placeholder="Click on picto to enter a prompt or enter a message and click picto to make text transformation..." class="quatrevingtpercent" rows="4"></textarea>'; // The div
print '<br><br>';
@ -285,8 +292,15 @@ if (getDolGlobalString("AI_API_SERVICE")) {
include DOL_DOCUMENT_ROOT.'/core/tpl/formlayoutai.tpl.php';
print $out;
print ' &nbsp; ';
if (getDolGlobalString("AI_DEBUG")) {
print ' <span class="small opacitymedium">'.$langs->trans("DebugOnInFile", 'dolibarr_ai.log').'</span>';
} else {
print ' <span class="small opacitymedium">'.$langs->trans("DebugOff", 'dolibarr_ai.log').'</span>';
}
print '<br>';
$doleditor = new DolEditor($htmlname, '', '', 100, 'dolibarr_details');
$doleditor = new DolEditor($htmlname, '', '', 150, 'dolibarr_details');
print $doleditor->Create(1);
print '</form>';

View file

@ -75,7 +75,9 @@ if (is_null($jsonData)) {
$ai = new Ai($db);
// Get parameters
$function = empty($jsonData['function']) ? 'textgeneration' : $jsonData['function']; // Default value. Can also be 'textgeneration', 'textgenerationemail', 'textgenerationwebpage', 'imagegeneration', 'videogeneration', ...
// Default value is 'textgeneration'.
// Can also be 'textgeneration', 'textgenerationemail', 'textgenerationwebpage', 'textrephraser', 'textspellchecker', 'imagegeneration', 'videogeneration', ...
$function = empty($jsonData['function']) ? 'textgeneration' : $jsonData['function'];
$format = empty($jsonData['format']) ? '' : $jsonData['format']; // Can be '' for text, 'html', ...

View file

@ -58,10 +58,10 @@ class Ai
const AI_DEFAULT_PROMPT_FOR_WEBPAGE = 'You are a website editor. Return all HTML content inside a section tag. Do not add explanation.';
const AI_DEFAULT_PROMPT_FOR_TEXT_TRANSLATION = 'You are a translator, answer with one and only one translation with no comment and explanation.';
const AI_DEFAULT_PROMPT_FOR_TEXT_SUMMARIZE = 'You are a writer, make the answer in the same language than the original text to summarize.';
const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, give only one answer with no comment and explanation and give the answer in the same language than the original text to rephrase. If there is carriage return or line feed in original message, keep them.';
const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are a proofreader, write your response in the same language as the original text in order to correct spelling and grammar errors. If there is carriage return or line feed in original message, keep them. Keep also any HTML or markdown formatting without adding one, just fix spelling and grammar errors. Answer with the corrected text and only the corrected text with no comment and explanation.';
const AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER = 'You are a writer, write your response in the same language as the original text to rephrase. Give only one answer with no comment and explanation. If there is carriage return or line feed in original message, keep them. Keep also any HTML or markdown formatting without adding one.';
const AI_DEFAULT_PROMPT_FOR_EXTRAFIELD_FILLER = 'Give only one answer with no comment and explanation, I want the text to be ready to copy and paste.';
const AI_DEFAULT_PROMPT_FOR_DOC_PARSING = 'You are an assistant to analyze documents. Return your answer with a JSON string and only a JSON string, do not add any other comment.';
const AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER = 'You are the proofreader, please write your response in the same language as the original text in order to correct spelling and grammar errors.';
/**
@ -138,7 +138,7 @@ class Ai
} elseif ($function == 'thread') {
$this->apiEndpoint = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_URL', $arrayofai[$this->apiService]['url']);
$this->apiEndpoint .= (preg_match('/\/$/', $this->apiEndpoint) ? '' : '/').'threads';
} else { // if $function == 'docparsing', ...
} else { // if $function == 'docparsing', 'text...', ...
$this->apiEndpoint = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_URL', $arrayofai[$this->apiService]['url']);
$this->apiEndpoint .= (preg_match('/\/$/', $this->apiEndpoint) ? '' : '/').'chat/completions';
}
@ -165,7 +165,7 @@ class Ai
} elseif ($function == 'docparsing') {
$model = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_MODEL_DOCPARSING', $arrayofai[$this->apiService][$function]['default']);
} else {
// else 'textgenerationemail', 'textgenerationwebpage', 'textgeneration', 'texttranslation', 'textsummarize'
// else 'textgenerationemail', 'textgenerationwebpage', 'textgeneration', 'texttranslation', 'textsummarize', 'textrephraser', 'textspellchecker', ...
$model = getDolGlobalString('AI_API_'.strtoupper($this->apiService).'_MODEL_TEXT', $arrayofai[$this->apiService]['textgeneration']['default']);
}
}
@ -232,6 +232,9 @@ class Ai
if (empty($prePrompt) && $function == 'textrephraser') {
$prePrompt = self::AI_DEFAULT_PROMPT_FOR_TEXT_REPHRASER;
}
if (empty($prePrompt) && $function == 'textspellchecker') {
$prePrompt = self::AI_DEFAULT_PROMPT_FOR_TEXT_SPELLCHECKER;
}
if (empty($prePrompt) && $function == 'docparsing') {
$prePrompt = self::AI_DEFAULT_PROMPT_FOR_DOC_PARSING;
}

View file

@ -109,34 +109,35 @@ class DolibarrApi
}
if ($object->fields[$field]['type'] == 'select') {
// Check values are in the list of possible 'options'
// TODO
return sanitizeVal($value, 'alphanohtml');
}
if ($object->fields[$field]['type'] == 'sellist' || $object->fields[$field]['type'] == 'checkbox') {
// TODO
return sanitizeVal($value, 'alphanohtml');
}
if ($object->fields[$field]['type'] == 'boolean' || $object->fields[$field]['type'] == 'radio') {
// TODO
return sanitizeVal($value, 'alphanohtml');
}
if ($object->fields[$field]['type'] == 'email') {
return sanitizeVal($value, 'email');
}
if ($object->fields[$field]['type'] == 'password') {
return sanitizeVal($value, 'none');
return sanitizeVal($value, 'password');
}
// Others will use 'alphanohtml'
}
// In case of a field with unknown type (legacy code), we use its name to have a chance to sanitize it
// In case of a field with unknown type (legacy code), we use other tricks to guess a more accurate type
// We try to use its name to have a chance to sanitize it
if (preg_match('/^fk_/i', $field)) {
// We accept only integer
return sanitizeVal($value, 'int');
}
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
return sanitizeVal($value, 'restricthtml');
} else {
return sanitizeVal($value, 'alphanohtml');
}
return sanitizeVal($value, 'alphanohtml');
} else { // Example when $field = 'extrafields' and $value = content of $object->array_options
$newarrayvalue = array();
foreach ($value as $tmpkey => $tmpvalue) {
@ -147,6 +148,66 @@ class DolibarrApi
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Check and convert a string depending on its type/name.
*
* @param string $field Field name
* @param string|string[] $value Value to check/clean
* @param Object $object Object
* @return string|array<string,mixed> Value cleaned
*/
protected function _checkValExtrafieldsForAPI($field, $value, $object)
{
global $extrafields;
// phpcs:enable
if (!is_array($value)) {
// Sanitize the value using its type declared into ->fields of $object
$typeOfExtraField = '';
if (!empty($extrafields->attributes) && !empty($extrafields->attributes[$object->table_element])
&& !empty($extrafields->attributes[$object->table_element]['type'])
&& !empty($extrafields->attributes[$object->table_element]['type'][$field])) {
$typeOfExtraField = $extrafields->attributes[$object->table_element]['type'][$field];
}
if ($typeOfExtraField) {
if (strpos($typeOfExtraField, 'int') || strpos($typeOfExtraField, 'double') || in_array($typeOfExtraField, array('real', 'price', 'stock'))) {
return sanitizeVal($value, 'int');
}
if ($object->array_options[$field]['type'] == 'html') {
return sanitizeVal($value, 'restricthtml');
}
if ($object->array_options[$field]['type'] == 'select') {
// TODO Check values are in the list of possible 'options'
return sanitizeVal($value, 'alphanohtml');
}
if ($typeOfExtraField == 'sellist' || $typeOfExtraField == 'checkbox') {
return sanitizeVal($value, 'alphanohtml');
}
if ($typeOfExtraField == 'boolean' || $typeOfExtraField == 'radio') {
return sanitizeVal($value, 'alphanohtml');
}
if ($typeOfExtraField == 'email') {
return sanitizeVal($value, 'email');
}
if ($typeOfExtraField == 'password') {
return sanitizeVal($value, 'password');
}
// Others will use 'alphanohtml'
}
return sanitizeVal($value, 'alphanohtml');
} else { // Example when $field = 'extrafields' and $value = content of $object->array_options
$newarrayvalue = array();
foreach ($value as $tmpkey => $tmpvalue) {
$newarrayvalue[$tmpkey] = $this->_checkValExtrafieldsForAPI($tmpkey, $tmpvalue, $object);
}
return $newarrayvalue;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/**
* Filter properties that will be returned on object

View file

@ -150,7 +150,7 @@ class DolibarrApiAccess implements iAuthenticate
}
} else {
if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && defined("DOLENTITY")) {
$sql = "SELECT u.login, u.datec, u.api_key as use_api, oat.tokenstring as api_key, oat.entity as token_entity, rowid as token_rowid,";
$sql = "SELECT u.login, u.datec, u.api_key as use_api, oat.tokenstring as api_key, oat.entity as token_entity, oat.rowid as token_rowid,";
$sql .= " oat.tms as date_modification,";
$sql .= " gu.entity";
$sql .= " FROM ".$this->db->prefix()."oauth_token AS oat";
@ -161,7 +161,7 @@ class DolibarrApiAccess implements iAuthenticate
$sql .= " AND gu.entity = oat.entity";
$sql .= " AND oat.service = 'dolibarr_rest_api'";
} else {
$sql = "SELECT u.login, u.datec, u.api_key as use_api, u.entity, oat.tokenstring as api_key, oat.entity as token_entity, rowid as token_rowid,";
$sql = "SELECT u.login, u.datec, u.api_key as use_api, u.entity, oat.tokenstring as api_key, oat.entity as token_entity, oat.rowid as token_rowid,";
$sql .= " oat.tms as date_modification";
$sql .= " FROM ".$this->db->prefix()."oauth_token AS oat";
$sql .= " JOIN ".$this->db->prefix()."user AS u ON u.rowid = oat.fk_user";

View file

@ -94,7 +94,6 @@ class ObjectLinks extends DolibarrApi
*/
private function _setObjectLinkField($field, $value)
{
$clean_field = $this->_checkValForAPI($field, $value, $this->objectlink);
/**
@ -106,9 +105,9 @@ class ObjectLinks extends DolibarrApi
);
if (in_array($field, $intFields)) {
$this->objectlink->$field = (int) $clean_field;
$this->objectlink->$field = (int) $clean_field; // Clean by _checkValForAPI previously
} else {
$this->objectlink->$field = (string) $clean_field;
$this->objectlink->$field = (string) $clean_field; // Clean by _checkValForAPI previously
}
}

View file

@ -748,7 +748,7 @@ class Asset extends CommonObject
}
$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht,";
$sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping";
$sql .= " " . $this->db->ifsql('EXISTS (SELECT fk_docdet FROM ' . MAIN_DB_PREFIX . 'accounting_bookkeeping as ab WHERE ab.doc_type = \'asset\' AND ab.fk_docdet = ad.rowid)', '1', '0') . " AS bookkeeping";
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
$sql .= " ORDER BY ad.depreciation_date ASC";

View file

@ -1,7 +1,7 @@
<?php
/**
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -86,7 +86,7 @@ if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire'))
$error = 'NOT FOUND';
} else {
$error = null;
$result['defaultWk']=$product->fk_default_workstation;
$result['defaultWk'] = $product->fk_default_workstation;
}
$result['error']=$error;

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,21 +25,20 @@
// Load Dolibarr environment
require '../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array('mrp', 'other'));
@ -84,7 +83,6 @@ if (!$sortorder) {
// Initialize a technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomagenda', 'globalcard')); // Note that conf->hooks_modules contains array

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2023 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
*
@ -30,6 +30,7 @@ require '../main.inc.php';
* The main.inc.php has been included so the following variable are now defined:
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Societe $mysoc
* @var Translate $langs
@ -63,7 +64,6 @@ $hideref = (GETPOSTINT('hideref') ? GETPOSTINT('hideref') : (getDolGlobalString(
// Initialize a technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -25,6 +25,14 @@
// Load Dolibarr environment
require '../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -32,14 +40,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array("mrp", "companies", "other", "mails"));
@ -75,7 +75,6 @@ if (!$sortfield) {
// Initialize a technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,20 +25,20 @@
// Load Dolibarr environment
require '../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array('mrp', 'other'));
@ -73,7 +73,6 @@ $pagenext = $page + 1;
// Initialize a technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = getMultidirOutput($object) . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -25,19 +25,19 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Societe $mysoc
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp", "other", "stocks"));
@ -45,17 +45,16 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOSTINT('id');
$lineid = GETPOSTINT('lineid');
$ref = GETPOST('ref', 'alpha');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
// Initialize a technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
// Initialize a technical objects for hooks
$hookmanager->initHooks(array('bomnetneeds')); // Note that conf->hooks_modules contains array

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -24,16 +24,17 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("mrp", "companies"));
@ -47,7 +48,6 @@ $backtopage = GETPOST('backtopage', 'alpha');
// Initialize a technical objects
$object = new BOM($db);
$extrafields = new ExtraFields($db);
// Initialize a technical objects for hooks
$hookmanager->initHooks(array('bomnote', 'globalcard')); // Note that conf->hooks_modules contains array

View file

@ -261,7 +261,7 @@ class Boms extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->bom->array_options[$index] = $this->_checkValForAPI($field, $val, $this->bom);
$this->bom->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->bom);
}
continue;
}

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2019-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software: you can redistribute it and/or modify
@ -30,10 +30,8 @@
*/
function bomAdminPrepareHead()
{
global $langs, $conf;
global $langs, $conf, $extrafields;
global $db;
$extrafields = new ExtraFields($db);
$extrafields->fetch_name_optionals_label('bom_bom');
$extrafields->fetch_name_optionals_label('bom_bomline');

View file

@ -252,7 +252,7 @@ class Categories extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->category->array_options[$index] = $this->_checkValForAPI($field, $val, $this->category);
$this->category->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->category);
}
continue;
}

View file

@ -1485,7 +1485,10 @@ if ($action == 'create') {
// Type of event
if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_RDV');
$default = getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT', 'AC_OTH');
if (empty($default)) {
$default = 'AC_OTH';
}
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
$selectedvalue = GETPOSTISSET("actioncode") ? GETPOST("actioncode", 'aZ09') : ($object->type_code ? $object->type_code : $default);
print $formactions->select_type_actions($selectedvalue, "actioncode", "systemauto", 0, -1, 0, 1); // TODO Replace 0 with -2 in onlyautoornot

View file

@ -316,7 +316,7 @@ class AgendaEvents extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->actioncomm->array_options[$index] = $this->_checkValForAPI($field, $val, $this->actioncomm);
$this->actioncomm->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->actioncomm);
}
continue;
}

View file

@ -7,7 +7,7 @@
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -31,6 +31,13 @@
// Load Dolibarr environment
require '../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -48,16 +55,8 @@ if (isModEnabled('intervention')) {
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
}
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('commercialindex'));
// Load translation files required by the page

View file

@ -466,7 +466,7 @@ class Mailings extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->mailing->array_options[$index] = $this->_checkValForAPI($field, $val, $this->mailing);
$this->mailing->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->mailing);
}
continue;
}

View file

@ -4,7 +4,7 @@
* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,9 +28,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -38,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
* @var Translate $langs
* @var User $user
*/
$hookmanager = new HookManager($db);
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('mailingindex'));

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -23,6 +23,14 @@
* \brief Tab of events on Proposal
*/
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
@ -30,13 +38,6 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array("propal", "other"));
@ -80,7 +81,6 @@ if (!$sortorder) {
// Initialize a technical objects
$object = new Propal($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/' . $user->id;
$hookmanager->initHooks(array('propalagenda', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
@ -96,6 +96,7 @@ $permissiontoread = $user->hasRight("propal", "lire");
$permissiontoadd = $user->hasRight("propal", "creer");
// Security check
$socid = '';
if (!empty($user->socid)) {
$socid = $user->socid;
}
@ -150,7 +151,11 @@ if ($object->id > 0) {
// Object card
// ------------------------------------------------------------
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$query = ['restore_lastsearch_values' => 1];
if (!empty($socid) && $socid > 0) {
$query += ['socid' => $socid];
}
$linkback = '<a href="' . dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php', $query) . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
@ -167,7 +172,7 @@ if ($object->id > 0) {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="' . dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true) . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project(dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id]), $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View file

@ -12,7 +12,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2023 Lenin Rivas <lenin.rivas777@gmail.com>
@ -182,14 +182,14 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
$backurlforlist = DOL_URL_ROOT . '/comm/propal/list.php';
$backurlforlist = dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php');
if (empty($backtopage) || ($cancel && empty($id))) {
if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
$backtopage = $backurlforlist;
} else {
$backtopage = DOL_URL_ROOT . '/comm/propal/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__');
$backtopage = dolBuildUrl(DOL_URL_ROOT . '/comm/propal/card.php', ['id' => ((!empty($id) && $id > 0) ? $id : '__ID__')]);
}
}
}
@ -286,7 +286,7 @@ if (empty($reshook)) {
// Cancel proposal
$result = $object->setCancel($user);
if ($result > 0) {
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
header('Location: ' . dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id]));
exit();
} else {
$langs->load("errors");
@ -296,7 +296,7 @@ if (empty($reshook)) {
// Delete proposal
$result = $object->delete($user);
if ($result > 0) {
header('Location: ' . DOL_URL_ROOT . '/comm/propal/list.php?restore_lastsearch_values=1');
header('Location: ' . dolBuildUrl(DOL_URL_ROOT . '/comm/propal/list.php', ['restore_lastsearch_values' => 1]));
exit();
} else {
$langs->load("errors");
@ -472,7 +472,7 @@ if (empty($reshook)) {
} elseif ($action == 'setdate_livraison' && $usercancreate) {
$result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOSTINT('date_livraisonmonth'), GETPOSTINT('date_livraisonday'), GETPOSTINT('date_livraisonyear')));
if ($result < 0) {
dol_print_error($db, $object->error);
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'setref_client' && $usercancreate) {
// Positionne ref client
@ -483,8 +483,14 @@ if (empty($reshook)) {
} elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $usercancreate) {
// Set incoterm
$result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'settags' && isModEnabled('category') && $usercancreate) { // Set tags
$result = $object->setCategories(GETPOST('categories', 'array'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'add' && $usercancreate) {
// Create proposal
$object->socid = $socid;
@ -1003,10 +1009,16 @@ if (empty($reshook)) {
}
} elseif ($action == 'addline' && GETPOST('updateallvatlinesblock', 'alpha') && GETPOST('vatforblocklines', 'alpha') !== '' && $usercancreate) {
$tx_tva = GETPOST('vatforblocklines') ? GETPOST('vatforblocklines') : 0;
$object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'tva', $tx_tva);
$result = $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'tva', $tx_tva);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'addline' && GETPOST('updatealldiscountlinesblock', 'alpha') && GETPOST('discountforblocklines', 'alpha') !== '' && $usercancreate) {
$discount = GETPOST('discountforblocklines') ? GETPOST('discountforblocklines') : 0;
$object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount);
$result = $object->updateSubtotalLineBlockLines($langs, $object->getRangOfLine($lineid), 'discount', $discount);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';

View file

@ -931,7 +931,7 @@ class Proposals extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->propal->array_options[$index] = $this->_checkValForAPI($field, $val, $this->propal);
$this->propal->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->propal);
}
continue;
}

View file

@ -13,7 +13,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2022 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
@ -3562,8 +3562,8 @@ class Propal extends CommonObject
$response->warning_delay = $delay_warning / 60 / 60 / 24;
$response->label = $label;
$response->labelShort = $labelShort;
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals';
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_option=late&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->url = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', ['search_status' => $status, 'mainmenu' => 'commercial', 'leftmenu' => 'propals']);
$response->url_late = dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', ['search_option' => 'late', 'mainmenu' => 'commercial', 'leftmenu' => 'propals', 'sortfield' => 'p.datep', 'sortorder' => 'asc']);
$response->img = img_object('', "propal");
// This assignment in condition is not a bug. It allows walking the results.
@ -3979,7 +3979,7 @@ class Propal extends CommonObject
if ($txttoshow) {
$result .= ' <span class="note inline-block">';
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($txttoshow).'">';
$result .= '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/comm/propal/note.php', ['id' => $this->id]).'" class="classfortooltip" title="'.dol_escape_htmltag($txttoshow).'">';
$result .= img_picto('', 'note');
$result .= '</a>';
$result .= '</span>';
@ -4025,12 +4025,10 @@ class Propal extends CommonObject
$outputlangs->loadLangs(array("propale", "products"));
if (!dol_strlen($modele)) {
$modele = 'azur';
$modele = getDolGlobalString('PROPALE_ADDON_PDF', 'cyan');
if ($this->model_pdf) {
$modele = $this->model_pdf;
} elseif (getDolGlobalString('PROPALE_ADDON_PDF')) {
$modele = getDolGlobalString('PROPALE_ADDON_PDF');
}
}

View file

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -30,6 +30,13 @@
// Load Dolibarr environment
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -39,13 +46,6 @@ if (isModEnabled('project')) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array('propal', 'compta', 'other', 'companies'));
@ -133,8 +133,11 @@ if ($object->id > 0) {
// Proposal card
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$query = ['restore_lastsearch_values' => 1];
if (!empty($socid) && $socid > 0) {
$query += ['socid' => $socid];
}
$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', $query).'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,10 +28,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -39,9 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager = new HookManager($db);
$hookmanager->initHooks(array('proposalindex'));
// Load translation files required by the page

View file

@ -15,7 +15,7 @@
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019-2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2021-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2021-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2022 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
@ -42,6 +42,14 @@
// Load Dolibarr environment
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var ExtraFields $extrafields
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
@ -58,13 +66,6 @@ if (isModEnabled('category')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
}
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
// Load translation files required by the page
$langs->loadLangs(array('companies', 'propal', 'compta', 'bills', 'orders', 'products', 'sendings', 'categories'));
@ -207,7 +208,6 @@ $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/mass
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
$object = new Propal($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Valentin Grimal <valentin.grimal@pichinov.com>
*
* This program is free software; you can redistribute it and/or modify
@ -27,12 +27,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -40,6 +34,11 @@ require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
// Load translation files required by the page
$langs->load("propal");

View file

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
@ -111,8 +111,11 @@ if ($object->id > 0) {
// Proposal card
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$query = ['restore_lastsearch_values' => 1];
if (!empty($socid) && $socid > 0) {
$query += ['socid' => $socid];
}
$linkback = '<a href="'.dolBuildUrl(DOL_URL_ROOT.'/comm/propal/list.php', $query).'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
@ -130,7 +133,7 @@ if ($object->id > 0) {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
}
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
$morehtmlref .= $form->form_project(dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id]), $object->socid, (string) $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
} else {
if (!empty($object->fk_project)) {
$proj = new Project($db);

View file

@ -869,7 +869,7 @@ class Orders extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->commande->array_options[$index] = $this->_checkValForAPI($field, $val, $this->commande);
$this->commande->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->commande);
}
continue;
}

View file

@ -357,7 +357,7 @@ class BankAccounts extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$account->array_options[$index] = $this->_checkValForAPI($field, $val, $account);
$account->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $account);
}
continue;
}

View file

@ -8,7 +8,7 @@
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2026 Nick Fragoulis
*
* This program is free software; you can redistribute it and/or modify
@ -33,15 +33,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -50,8 +41,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
* @var Translate $langs
* @var User $user
*/
$hookmanager = new HookManager($db);
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/paymentvat.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('specialexpensesindex'));

View file

@ -152,7 +152,7 @@ if ($resql) {
print_barre_liste($langs->trans("TripsAndExpenses"), $page, $_SERVER["PHP_SELF"], "&socid=$socid", $sortfield, $sortorder, '', $num);
$i = 0;
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder centpercent">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.rowid", "", "&socid=$socid", '', $sortfield, $sortorder);

View file

@ -491,6 +491,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'setretainedwarrantyconditions' && $usercancreate) {
/** @var Facture $object */
$object->fetch($id);
$object->retained_warranty_fk_cond_reglement = 0; // To clean property
$result = $object->setRetainedWarrantyPaymentTerms(GETPOSTINT('retained_warranty_fk_cond_reglement'));
@ -689,9 +690,11 @@ if (empty($reshook)) {
}
if (!$error) {
$newremaintopay = $object->getRemainToPay(0);
if ($newremaintopay == 0) {
$object->setPaid($user);
if ($object->status == Facture::STATUS_VALIDATED) {
$newremaintopay = $object->getRemainToPay(0);
if ($newremaintopay == 0) {
$object->setPaid($user);
}
}
}
}
@ -3775,8 +3778,8 @@ if ($action == 'create') {
$classname = ucfirst($subelement);
$objectsrc = new $classname($db);
'@phan-var-force Commande|Propal|Contrat|Expedition $objectsrc';
/** @var Commande|Propal|Contrat|Expedition $objectsrc */
'@phan-var-force Commande|Propal|Contrat|Expedition|Facture $objectsrc';
/** @var Commande|Propal|Contrat|Expedition|Facture $objectsrc */
$objectsrc->fetch($originid);
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) {
$objectsrc->fetch_lines();
@ -4539,10 +4542,9 @@ if ($action == 'create') {
$retained_warranty_fk_cond_reglement = GETPOSTINT('retained_warranty_fk_cond_reglement');
if (empty($retained_warranty_fk_cond_reglement)) {
$retained_warranty_fk_cond_reglement = getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID');
if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement;
} else {
$retained_warranty_fk_cond_reglement = getDolGlobalString('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID');
if ($objectsrc instanceOf Facture && !empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value
// Facture->retained_warranty_fk_cond_reglement (does not exist on Expedition)
$retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; // @phan-suppress-current-line PhanUndeclaredProperty
}
}
print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);

View file

@ -912,7 +912,7 @@ class Invoices extends DolibarrApi
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->invoice->array_options[$index] = $this->_checkValForAPI($field, $val, $this->invoice);
$this->invoice->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->invoice);
}
continue;
}

View file

@ -1363,6 +1363,9 @@ class Facture extends CommonInvoice
}
$object->lines[$i]->ref_ext = ''; // Do not clone ref_ext
// Do not clone accountancy ventilation: a cloned invoice must reappear in "to dispatch" list
$object->lines[$i]->fk_code_ventilation = 0;
}
// Create clone

View file

@ -363,7 +363,6 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
// Add hook to complete $arrayfield
$parameters = array('arrayfields' => &$arrayfields);
$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
// For POS context, we force some fields
if ($contextpage == 'poslist') {
@ -679,7 +678,7 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
$nbwithdrawrequestok = 0;
foreach ($listofbills as $aBill) {
// Note: The 2 following SQL requests are wrong but it works because we have one record into pfd for one record into pl and for into p for the same fk_facture_fourn.
// The table prelevement and prelevement_lignes and must be removed in future and merged into prelevement_demande
// The table prelevement and prelevement_lignes must be removed in future and merged into prelevement_demande
// Step 1: Move field fk_... of llx_prelevement into llx_prelevement_lignes
// Step 2: Move field fk_... + status into prelevement_demande.
$pending = 0;

View file

@ -722,7 +722,7 @@ if ($object->id > 0) {
// For which amount ?
// Note: The 2 following SQL requests are wrong but it works because we have one record into pfd for one record into pl and for into p for the same fk_facture_fourn.
// The table prelevement and prelevement_lignes and must be removed in future and merged into prelevement_demande
// The table prelevement and prelevement_lignes must be removed in future and merged into prelevement_demande
// Step 1: Move field fk_... of llx_prelevement into llx_prelevement_lignes
// Step 2: Move field fk_... + status into prelevement_demande.
$pending = 0;

View file

@ -486,8 +486,8 @@ if ($id > 0 || $ref) {
// Lines into withdraw request
if ($salaryBonPl) {
$sql = "SELECT pl.rowid, pl.statut, pl.amount, pl.fk_user,";
$sql .= " u.rowid as socid, u.login as name";
$sql = "SELECT pl.rowid, pl.statut as status, pl.amount,";
$sql .= " u.rowid as parentid, u.login as name";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= ", ".MAIN_DB_PREFIX."user as u";
@ -500,8 +500,8 @@ if ($id > 0 || $ref) {
}
$sql .= $db->order($sortfield, $sortorder);
} else {
$sql = "SELECT pl.rowid, pl.statut, pl.amount,";
$sql .= " s.rowid as socid, s.nom as name";
$sql = "SELECT pl.rowid, pl.statut as status, pl.amount,";
$sql .= " s.rowid as parentid, s.nom as name";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql .= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
@ -577,16 +577,16 @@ if ($id > 0 || $ref) {
// Status of line
print "<td>";
print '<a class="valignmiddle" href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'&type='.$object->type.'&token='.newToken().'">';
print $ligne->LibStatut($obj->statut, 2);
print $ligne->LibStatut($obj->status, 2);
print '<span class="paddingleft">'.$obj->rowid.'</span>';
print '</a></td>';
if (!$salaryBonPl) {
$thirdparty = new Societe($db);
$thirdparty->fetch($obj->socid);
$thirdparty->fetch($obj->parentid);
$name = $thirdparty->getNomUrl(1);
} else {
$userSalary = new User($db);
$userSalary->fetch($obj->fk_user);
$userSalary->fetch($obj->parentid);
$name = $userSalary->getNomUrl(-1);
}
print '<td class="tdoverflowmax150">';
@ -597,11 +597,11 @@ if ($id > 0 || $ref) {
print '<td class="right">';
if ($obj->statut == 3) {
if ($obj->status == 3) {
print '<span class="error">'.$langs->trans("StatusRefused").'</span>';
} else {
if ($object->statut == BonPrelevement::STATUS_CREDITED) {
if ($obj->statut == LignePrelevement::STATUS_CREDITED) {
if ($object->status == BonPrelevement::STATUS_CREDITED) {
if ($obj->status == LignePrelevement::STATUS_CREDITED) {
if ($user->hasRight('prelevement', 'bons', 'credit')) {
//print '<a class="butActionDelete" href="line.php?action=rejet&id='.$obj->rowid.'">'.$langs->trans("StandingOrderReject").'</a>';
print '<a href="line.php?action=rejet&type='.$object->type.'&id='.$obj->rowid.'&token='.newToken().'">'.$langs->trans("StandingOrderReject").'</a>';

View file

@ -350,16 +350,19 @@ class BonPrelevement extends CommonObject
* @param string $bic BIC used
* @param string $iban IBAN used
* @param string $rum RUM
* @param int $id_prelevement_demande ID of debit or credit request
* @return int >0 if OK, <0 if KO
*/
public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '', $bic = '', $iban = '', $rum = '')
public function addWithdrawDetail($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order', $sourcetype = '', $bic = '', $iban = '', $rum = '', $id_prelevement_demande = 0)
{
// phpcs:enable
$result = 0;
$line_id = 0;
// TODO Save the $id_prelevement_demande
// Add lines into prelevement_lignes for tracking. The ID of line inserted is returned into $line_id.
$result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype, $bic, $iban, $rum);
$result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype, $bic, $iban, $rum, $id_prelevement_demande);
if ($result == 0) {
@ -384,17 +387,17 @@ class BonPrelevement extends CommonObject
$result = 0;
} else {
$result = -1;
$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
dol_syslog(get_class($this) . "::AddFacture Error $result");
$this->errors[] = get_class($this) . "::addWithdrawDetail " . $this->db->lasterror;
dol_syslog(get_class($this) . "::addWithdrawDetail Error $result");
}
} else {
$result = -2;
$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
dol_syslog(get_class($this) . "::AddFacture Error $result");
$this->errors[] = get_class($this) . "::addWithdrawDetail linedid Empty";
dol_syslog(get_class($this) . "::addWithdrawDetail Error $result");
}
} else {
$result = -3;
dol_syslog(get_class($this) . "::AddFacture Error $result");
dol_syslog(get_class($this) . "::addWithdrawDetail Error $result");
}
return $result;
@ -415,16 +418,18 @@ class BonPrelevement extends CommonObject
* @param string $bic BIC used
* @param string $iban IBAN used
* @param string $rum RUM used
* @param int $id_prelevement_demande ID of debit or credit request
* @return int >0 if OK, <0 if KO
*/
public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '', $bic = '', $iban = '', $rum = '')
public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '', $bic = '', $iban = '', $rum = '', $id_prelevement_demande = 0)
{
$result = -1;
$concat = getDolGlobalInt('MAIN_MODULE_PRELEVEMENT_CONCAT'); // ??? what is this for. Seems not used.
if ($concat == 1) {
/*
* We aggregate the lines
/**
* @deprecated. This code can't work because code_... fields are empty. Not used. To remove.
* We aggregate the lines.
*/
$sql = "SELECT rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
@ -446,25 +451,27 @@ class BonPrelevement extends CommonObject
}
} else {
/*
* No aggregate, use 1 line per invoice/salary to pay
* No aggregate, use 1 line per request of invoice/salary to pay
*/
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
$sql .= "fk_prelevement_bons";
$sql .= ", fk_soc";
$sql .= ", client_nom";
$sql .= ", amount";
$sql .= ", bic";
$sql .= ", iban";
$sql .= ", rum";
//$sql .= ", bic"; // no more required, we have fk_prelevement_demande
//$sql .= ", iban"; // no more required, we have fk_prelevement_demande
//$sql .= ", rum"; // no more required, we have fk_prelevement_demande
$sql .= ", fk_prelevement_demande";
$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
$sql .= ", '" . $this->db->escape($client_nom) . "'";
$sql .= ", " . ((float) price2num($amount));
$sql .= ", '" . $this->db->escape($bic) . "'";
$sql .= ", '" . $this->db->escape($iban) . "'";
$sql .= ", '" . $this->db->escape($rum) . "'";
//$sql .= ", '" . $this->db->escape($bic) . "'"; // no more required, we have fk_prelevement_demande
//$sql .= ", '" . $this->db->escape(dolEncrypt($iban)) . "'"; // no more required, we have fk_prelevement_demande
//$sql .= ", '" . $this->db->escape($rum) . "'"; // no more required, we have fk_prelevement_demande
$sql .= ", " . ((int) $id_prelevement_demande);
$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
$sql .= ")";
if ($this->db->query($sql)) {
@ -1072,7 +1079,7 @@ class BonPrelevement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a BAN payment order:
* - Select waiting requests from prelevement_demande (or use $did if provided)
* - Select waiting requests from prelevement_demande (or use $dids if provided)
* - Check BAN values
* - Then create a direct debit order or a credit transfer order
* - Link the order with the prelevement_demande lines
@ -1085,12 +1092,12 @@ class BonPrelevement extends CommonObject
* @param int $executiondate Date to execute the transfer
* @param int $notrigger Disable triggers
* @param string $type 'direct-debit' or 'bank-transfer'
* @param array<int>|int $dids ID(s) of existing payment request(s).
* - If $dids is 0, we use all existing requests.
* - If $dids is an int > 0, we use the existing payment request.
* - If $dids is an array, the created BonsPrelevement will include these payment requests.
* @param array<int>|int $dids ID(s) of existing payment request(s).
* - If $dids is 0, we use all existing requests.
* - If $dids is an int > 0, we use the existing payment request.
* - If $dids is an array, the created BonsPrelevement will include these payment requests.
* @param int $fk_bank_account Bank account ID the receipt is generated for. Will use the ID into the setup of module Direct Debit or Credit Transfer if 0.
* @param string $sourcetype 'invoice' or 'salary'
* @param string $sourcetype Source is 'invoice' or 'supplier_invoice' or 'salary'
* @return int Return integer <0 if KO, No of invoice included into file if OK
*/
public function create($banque = '', $agence = '', $mode = 'real', $format = 'ALL', $executiondate = 0, $notrigger = 0, $type = 'direct-debit', $dids = 0, $fk_bank_account = 0, $sourcetype = 'invoice')
@ -1098,7 +1105,7 @@ class BonPrelevement extends CommonObject
// phpcs:enable
global $conf, $langs, $user;
dol_syslog(__METHOD__ . " Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format." type=".$type." dids=".$dids." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG);
dol_syslog(__METHOD__ . " mode=".$mode." format=".$format." type=".$type." dids=".$dids." fk_bank_account=".$fk_bank_account." sourcetype=".$sourcetype, LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
@ -1127,7 +1134,7 @@ class BonPrelevement extends CommonObject
$error = 0;
// Pre-store some values into variables to simplify following sql requests
if ($sourcetype != 'salary') {
$entities = $type != 'bank-transfer' ? getEntity('invoice', 1) : getEntity('supplier_invoice', 1); // Return alist of entities
$entities = $type != 'bank-transfer' ? getEntity('invoice', 1) : getEntity('supplier_invoice', 1); // Return a list of entities
$sqlTable = $type != 'bank-transfer' ? "facture" : "facture_fourn";
$socOrUser = 'fk_soc';
$societeOrUser = 'societe';
@ -1138,6 +1145,7 @@ class BonPrelevement extends CommonObject
$societeOrUser = 'user';
}
/*
$thirdpartyBANId = 0;
// Check if there is an iban associated to the bank transfer request or if we take the default
@ -1163,6 +1171,7 @@ class BonPrelevement extends CommonObject
$this->db->free($resql);
}
*/
$datetimeprev = dol_now('gmt');
// Choice of the date of the execution direct debit
@ -1176,8 +1185,8 @@ class BonPrelevement extends CommonObject
$this->invoice_in_error = array();
$this->thirdparty_in_error = array();
// Read invoices
$factures = array();
// Get all invoices to process into $factures
$factures = array(); // TODO Rename $factures... into $payment_requests...
$factures_prev = array();
$factures_prev_id = array();
@ -1196,17 +1205,13 @@ class BonPrelevement extends CommonObject
$sql .= ", f.ref";
$sql .= ", sr.bic, sr.iban_prefix, 'FRST' as frstrecur, sr.default_rib, '' as rum";
}
$sql .= ", pd.fk_societe_rib as soc_rib_id";
$sql .= ", pd.fk_societe_rib as soc_rib_id"; // Forced payment IBAN to use in priority
$sql .= " FROM " . $this->db->prefix() . $sqlTable . " as f"; // f is salary, facture or facture_fourn
$sql .= " LEFT JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
$sql .= " INNER JOIN " . $this->db->prefix() . "prelevement_demande as pd ON f.rowid = pd.fk_".$this->db->sanitize($sqlTable);
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser)." as s ON s.rowid = f.".$this->db->sanitize($socOrUser);
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser);
$sql .= " LEFT JOIN " . $this->db->prefix() . $this->db->sanitize($societeOrUser."_rib")." as sr ON s.rowid = sr.".$this->db->sanitize($socOrUser); // To get the default BAN of thirdparty
if ($sourcetype != 'salary') {
if (!empty($thirdpartyBANId)) {
$sql .= " AND sr.rowid = " . ((int) $thirdpartyBANId);
} else {
$sql .= " AND sr.default_rib = 1";
}
$sql .= " AND sr.default_rib = 1";
$sql .= " AND sr.type = 'ban'";
} else {
//$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
@ -1245,11 +1250,12 @@ class BonPrelevement extends CommonObject
/** @var array{0:int|string,1:int,2:int,3:string,4:string,5:string,6:string,7:float,8:string,9:string,10:string,11:string,12:string,13:string,14:string,15:int} $row */
// All fields:
// 0=rowid, 1=pfdrowid, 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key,
// 7=amount, 8=name, 9=ref, 10=bic, 11=iban, 12=frstrecur, 13=default_rib, 14=rum, 15=soc_rib_id
// 0=invoice or salary id, 1=pfdrowid (id of payment request), 2=$socOrUser, 3=code_banque, 4=code_guichet, 5=number, 6=key,
// 7=amount, 8=company name, 9=invoice ref,
// 10=default bic, 11=default iban (=the BAN to use if no soc_rib_id set), 12=default frstrecur, 13=default_rib, 14=default rum, 15=soc_rib_id (=the BAN to use in priority)
$factures[$i] = $row;
// Decode BAN
// Decode default BAN
$factures[$i][11] = dolDecrypt($factures[$i][11]);
if ($row[7] == 0) {
@ -1299,8 +1305,8 @@ class BonPrelevement extends CommonObject
}
// If a bank account was forced on llx_prelevement_demande (the direct debit or credit transfer request),
// we must use this oney,so we reload values from soc_rib_id
if (!empty($fac[14])) {
// we must use this one, so we reload values from soc_rib_id
if (!empty($fac[15])) {
$bankaccount = new CompanyBankAccount($this->db);
$bankaccount->fetch((int) $fac[15]);
if ($bankaccount->id > 0) {
@ -1476,12 +1482,13 @@ class BonPrelevement extends CommonObject
// Add lines for the direct debit or crdit transfer
if (count($factures_prev) > 0) {
foreach ($factures_prev as $fac) { // Add a link in database for each invoice ro salary
foreach ($factures_prev as $fac) { // Add a link in database for each invoice or salary
/*
* Add standing order. This add record into llx_prelevement_lignes and llx_prelevement
* The llx_prelevement_ligne will then be read to build the XML SEPA file.
*
* $fac[0] : invoice_id
* $fac[1] : ???
* $fac[0] : invoice or salary id
* $fac[1] : id of payment request (rowid in llx_prelevement_demande)
* $fac[2] : third party id
* $fac[3] : banque
* $fac[4] : guichet
@ -1497,7 +1504,7 @@ class BonPrelevement extends CommonObject
* $fac[14] : rum
* $fac[15] : soc_rib_id (id bank account preselected for direct debit or credit transfer)
*/
$ri = $this->AddFacture(
$ri = $this->addWithdrawDetail(
$fac[0],
$fac[2],
$fac[8],
@ -1510,7 +1517,8 @@ class BonPrelevement extends CommonObject
$sourcetype,
$fac[10],
$fac[11],
$fac[14]
$fac[14],
$fac[1]
);
if ($ri != 0) {
@ -1567,7 +1575,7 @@ class BonPrelevement extends CommonObject
if ($sourcetype == 'salary') {
$userid = $this->context['factures_prev'][0][2];
}
$result = $this->generate($format, $executiondate, $type, $fk_bank_account, $userid, (int) $thirdpartyBANId);
$result = $this->generate($format, $executiondate, $type, $fk_bank_account, $userid, 0);
if ($result < 0) {
//var_dump($this->error);
//var_dump($this->invoice_in_error);
@ -1882,7 +1890,7 @@ class BonPrelevement extends CommonObject
* @param string $type 'direct-debit' or 'bank-transfer'
* @param int $fk_bank_account Bank account ID the receipt is generated for. Will use the ID into the setup of module Direct Debit or Credit Transfer if 0.
* @param int $forsalary If the SEPA is to pay salaries
* @param int $thirdpartyBANId If defined, will use this ID to get the RIB. Otherwise, the first default BAN of thirdparty will be taken.
* @param int $thirdpartyBANId If defined, will use this ID to get the RIB. Otherwise, the BAN of request will be used. If not defined, the first default BAN of thirdparty will be taken.
* @return int >=0 if OK, <0 if KO
*/
public function generate(string $format = 'ALL', int $executiondate = 0, string $type = 'direct-debit', int $fk_bank_account = 0, int $forsalary = 0, int $thirdpartyBANId = 0)
@ -1940,8 +1948,10 @@ class BonPrelevement extends CommonObject
*/
$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,";
$sql .= " f.ref as reffac, p.fk_facture as idfac,";
//$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, ";
$sql .= " pl.client_nom as nom, pl.amount as somme, pl.fk_prelevement_demande,";
$sql .= " f.ref as reffac,";
$sql .= " p.fk_facture as idfac, p.rowid as pid,";
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
$sql .= " FROM";
$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
@ -1984,7 +1994,7 @@ class BonPrelevement extends CommonObject
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
$iban = dolDecrypt($obj->iban);
$fileDebiteurSection .= $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, $iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type);
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, '', '', '', $obj->somme, $obj->reffac, $obj->idfac, $iban, $obj->bic, $daterum, (string) $obj->drum, $obj->rum, $type);
$this->total += $obj->somme;
$i++;
@ -2068,8 +2078,10 @@ class BonPrelevement extends CommonObject
*/
if (!empty($forsalary)) {
$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 .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, ";
$sql .= " pl.client_nom as nom, pl.amount as somme, pl.fk_prelevement_demande,";
$sql .= " s.ref as reffac,";
$sql .= " 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";
$sql .= " FROM";
$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
@ -2085,8 +2097,10 @@ class BonPrelevement extends CommonObject
$sql .= " AND rib.fk_user = s.fk_user";
} 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,";
$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
//$sql .= " pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, ";
$sql .= " pl.client_nom as nom, pl.amount as somme, pl.fk_prelevement_demande,";
$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier,";
$sql .= " p.fk_facture_fourn as idfac,";
$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
$sql .= " FROM";
$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
@ -2110,6 +2124,8 @@ class BonPrelevement extends CommonObject
// Define $fileCrediteurSection. One section DrctDbtTxInf per invoice.
$nbtotalDrctDbtTxInf = -1;
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$resql = $this->db->query($sql);
if ($resql) {
$cachearraytotestduplicate = array();
@ -2117,22 +2133,55 @@ class BonPrelevement extends CommonObject
$num = $this->db->num_rows($resql);
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// Test to avoid duplicate default IBAN, to ask user to clean its data
if (!empty($cachearraytotestduplicate[$obj->idfac])) {
$this->error = $langs->trans('ErrorCompanyHasDuplicateDefaultBAN', $obj->socid);
$this->invoice_in_error[$obj->idfac] = $this->error;
$result = -2;
break;
}
$cachearraytotestduplicate[$obj->idfac] = $obj->rowid;
// Get the default value
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
$iban = dolDecrypt($obj->iban);
$bic = $obj->bic;
$drum = $obj->drum;
$rum = $obj->rum;
// But if a force bank account is defined, we use it instead
if (!empty($obj->fk_prelevement_demande)) {
$companybankaccountid = 0;
$sqltmp = "SELECT fk_societe_rib FROM ".MAIN_DB_PREFIX."prelevement_demande";
$sqltmp .= " WHERE rowid = ".((int) $obj->fk_prelevement_demande);
$resqltmp = $this->db->query($sqltmp);
$objtmp = $this->db->fetch_object($resqltmp);
if ($objtmp) {
$companybankaccountid = (int) $objtmp->fk_societe_rib;
}
$bankaccount = new CompanyBankAccount($this->db);
$bankaccount->fetch($companybankaccountid);
if ($bankaccount->id > 0) {
$daterum = $bankaccount->date_rum;
$iban = $bankaccount->iban;
$bic = $bankaccount->bic;
$drum = $bankaccount->id;
$rum = $bankaccount->rum;
}
}
$refobj = $obj->reffac;
if (empty($refobj) && !empty($forsalary)) { // 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, $refobj, $obj->idfac, $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->somme, $refobj, $obj->idfac, $iban, $bic, $daterum, (string) $drum, $rum, $type, $obj->fac_ref_supplier);
$this->total += $obj->somme;
$i++;

View file

@ -223,7 +223,8 @@ if ($id > 0 || $ref) {
if ($salaryBonPl) {
$sql = "SELECT pf.rowid, p.type,";
$sql .= " f.rowid as salaryid, f.ref as ref, f.amount,";
$sql .= " u.rowid as userid, u.firstname, u.lastname, pl.statut as status, pl.amount as amount_requested";
$sql .= " u.rowid as userid, u.firstname, u.lastname,";
$sql .= " pl.statut as status, pl.amount as amount_requested";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement_lignes as pl ON pl.fk_prelevement_bons = p.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."prelevement as pf ON pf.fk_prelevement_lignes = pl.rowid";
@ -242,7 +243,8 @@ if ($salaryBonPl) {
if ($object->type == 'bank-transfer') {
$sql .= " f.ref_supplier,";
}
$sql .= " s.rowid as socid, s.nom as name, pl.statut as status, pl.amount as amount_requested";
$sql .= " s.rowid as socid, s.nom as name,";
$sql .= " pl.statut as status, pl.amount as amount_requested";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p,";
$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql .= " ".MAIN_DB_PREFIX."prelevement as pf";

View file

@ -777,7 +777,7 @@ class Contracts extends DolibarrApi
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->contract->array_options[$index] = $this->_checkValForAPI($field, $val, $this->contract);
$this->contract->array_options[$index] = $this->_checkValExtrafieldsForAPI($index, $val, $this->contract);
}
continue;
}

View file

@ -0,0 +1,290 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/commande/class/contratstats.class.php
* \ingroup contracts
* \brief File of class to manage contract statistics
*/
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
/**
* Class to manage contract statistics
*/
class ContratStats extends Stats
{
/**
* @var string Name of table without prefix where object is stored
*/
public $table_element;
/**
* @var int ID
*/
public $socid;
/**
* @var int ID
*/
public $userid;
/**
* @var string To store the FROM part of the main table of the SQL request
*/
public $from;
/**
* @var string To store the FROM part of the lines table of the SQL request
*/
public $from_line;
/**
* @var string To store the field
*/
public $field;
/**
* @var string To store the field of the line table of the SQL request
*/
public $field_line;
/**
* @var string To store the FROM part of the categorie table of the SQL request
*/
public $categ_link;
/**
* @var string To store the WHERE part of the main table of the SQL request
*/
public $where = '';
/**
* @var string To store the join
*/
public $join;
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user.
* @param string $mode Option ('customer', 'supplier')
* @param int $userid Id user for filter (creation user)
* @param int $typentid Id typent of thirdpary for filter
* @param int $categid Id category of thirdpary for filter
*/
public function __construct($db, $socid, $mode, $userid = 0, $typentid = 0, $categid = 0)
{
global $user, $conf;
$this->db = $db;
$this->socid = ($socid > 0 ? $socid : 0);
$this->userid = $userid;
$this->cachefilesuffix = $mode;
$this->join = '';
$object = new Contrat($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as cd";
$this->field = 'total_ht';
$this->field_line = 'total_ht';
//$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
$this->categ_link = MAIN_DB_PREFIX.'categorie_societe';
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this->where .= ($this->where ? ' AND ' : '').'c.entity IN ('.getEntity('contract').')';
if ($this->socid) {
$this->where .= " AND c.fk_soc = ".((int) $this->socid);
}
if ($this->userid > 0) {
$this->where .= ' AND c.fk_user_author = '.((int) $this->userid);
}
if ($typentid) {
$this->join .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = c.fk_soc';
$this->where .= ' AND s.fk_typent = '.((int) $typentid);
}
if ($categid) {
$this->where .= ' AND EXISTS (SELECT rowid FROM '.$this->categ_link.' as cats WHERE cats.fk_soc = c.fk_soc AND cats.fk_categorie = '.((int) $categid).')';
}
}
/**
* Return contracts number by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array<int<0,11>,array{0:int<1,12>,1:int}> Array with number by month
*/
public function getNbByMonth($year, $format = 0)
{
global $user;
$sql = "SELECT date_format(c.date_contrat,'%m') as dm, COUNT(*) as nb";
$sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1);
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$res = $this->_getNbByMonth($year, $sql, $format);
return $res;
}
/**
* Return contracts number per year
*
* @return array<array{0:int,1:int}> Array of nb each year
*
*/
public function getNbByYear()
{
global $user;
$sql = "SELECT date_format(c.date_contrat,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->db->sanitize($this->field).")";
$sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1);
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByYear($sql);
}
/**
* Return the contracts amount by month for a year
*
* @param int $year Year to scan
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array<int<0,11>,array{0:int<1,12>,1:int|float}> Array with amount by month
*/
public function getAmountByMonth($year, $format = 0)
{
global $user;
$sql = "SELECT date_format(c.date_contrat,'%m') as dm, count(cd.".$this->db->sanitize($this->field).")";
$sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1);
$sql .= " INNER JOIN ".$this->db->sanitize($this->from_line, 0, 1, 1). " ON c.rowid = cd.fk_contrat";
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
$res = $this->_getAmountByMonth($year, $sql, $format);
return $res;
}
/**
* Return the contracts amount average by month for a year
*
* @param int $year year for stats
* @return array<int<0,11>,array{0:int<1,12>,1:int|float}> Array with number by month
*/
public function getAverageByMonth($year)
{
global $user;
$sql = "SELECT date_format(c.date_contrat,'%m') as dm, AVG(c.".$this->db->sanitize($this->field).")";
$sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1);
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql .= " AND ".$this->where;
$sql .= " GROUP BY dm";
$sql .= $this->db->order('dm', 'DESC');
return $this->_getAverageByMonth($year, $sql);
}
/**
* Return nb, total and average
*
* @return array<array{year:string,nb:int,nb_diff?:float,total?:float,avg?:float,weighted?:float,total_diff?:float,avg_diff?:float,avg_weighted?:float}> Array of values
*/
public function getAllByYear()
{
global $user;
$sql = "SELECT date_format(c.date_contrat,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->db->sanitize($this->field).") as total, AVG(".$this->db->sanitize($this->field).") as avg";
$sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1);
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " GROUP BY year";
$sql .= $this->db->order('year', 'DESC');
return $this->_getAllByYear($sql);
}
/**
* Return nb, amount of predefined product for year
*
* @param int $year Year to scan
* @param int $limit Limit
* @return array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of values
*/
public function getAllByProduct($year, $limit = 10)
{
global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql .= " FROM ".$this->db->sanitize($this->from, 0, 1, 1);
$sql .= " INNER JOIN ".$this->db->sanitize($this->from_line, 0, 1, 1)." ON c.rowid = tl.fk_commande";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
if (empty($user->socid) && !$user->hasRight('societe', 'client', 'voir')) {
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
$sql .= $this->join;
$sql .= " WHERE ".$this->where;
$sql .= " AND c.date_contrat BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
$sql .= " GROUP BY product.ref";
$sql .= $this->db->order('nb', 'DESC');
//$sql.= $this->db->plimit(20);
return $this->_getAllByProduct($sql, $limit);
}
}

View file

@ -0,0 +1,387 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020 Maxime DEMAREST <maxime@indelog.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
* Copyright (C) 2026 Alexandre Spangaro <alexandre@inovea-conseil.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/contrat/stats/index.php
* \ingroup contrat
* \brief Page with customers contract statistics
*/
// Load Dolibarr environment
require '../../main.inc.php';
/**
* @var Conf $conf
* @var DoliDB $db
* @var HookManager $hookmanager
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contratstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
$hookmanager->initHooks(array('contratstats', 'globalcard'));
$usercanreadcustumerstatistic = $user->hasRight('commande', 'lire');
$usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'lire');
if (getDolGlobalInt('MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS')) {
$usercanreadcustumerstatistic = $user->hasRight('commande', 'commande', 'export');
$usercanreadsupplierstatistic = $user->hasRight('fournisseur', 'commande', 'export');
}
if ($mode == 'customer' && !$usercanreadcustumerstatistic) {
accessforbidden();
}
if ($mode == 'supplier' && !$usercanreadsupplierstatistic) {
accessforbidden();
}
if ($mode == 'supplier') {
$object_status = GETPOST('object_status', 'array:int');
$object_status = implode(',', $object_status);
} else {
$object_status = GETPOST('object_status', 'intcomma');
}
$typent_id = GETPOSTINT('typent_id');
$categ_id = GETPOSTINT('categ_id');
$userid = GETPOSTINT('userid');
$socid = GETPOSTINT('socid');
// Security check
if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
}
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$nowyear = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$year = GETPOSTINT('year') > 0 ? GETPOSTINT('year') : $nowyear;
$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
$endyear = $year;
// Load translation files required by the page
$langs->loadLangs(array('contracts', 'companies', 'other', 'suppliers'));
/*
* View
*/
$form = new Form($db);
$formcompany = new FormCompany($db);
$formother = new FormOther($db);
$picto = 'contract';
$title = $langs->trans("ContractsStatistics");
$dir = $conf->contract->dir_temp;
llxHeader('', $title, '', '', 0, 0, '', '', '', 'mod-contract page-stats');
print load_fiche_titre($title, '', $picto);
dol_mkdir($dir);
$stats = new ContratStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
if ($object_status != '' && $object_status >= -1) {
$stats->where .= ' AND c.statut IN ('.$db->sanitize($object_status).')';
}
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
$fileurlnb = '';
if (!$user->hasRight('societe', 'client', 'voir')) {
$filenamenb = $dir.'/contractsnbinyear-'.$user->id.'-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsnbinyear-'.$user->id.'-'.$year.'.png';
} else {
$filenamenb = $dir.'/contractsnbinyear-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsnbinyear-'.$year.'.png';
}
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
if (!$mesg) {
$px1->SetData($data);
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
}
$px1->SetLegend($legend);
$px1->SetMaxValue($px1->GetCeilMaxValue());
$px1->SetMinValue(min(0, $px1->GetFloorMinValue()));
$px1->SetWidth($WIDTH);
$px1->SetHeight($HEIGHT);
$px1->SetYLabel($langs->trans("NbOfContracts"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
$px1->mode = 'depth';
$px1->SetTitle($langs->trans("NumberOfContractsByMonth"));
$px1->draw($filenamenb, $fileurlnb);
}
// Build graphic amount of object
$data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
//var_dump($data);
// $data = array(array('Lib',val1,val2,val3),...)
$fileurlamount = '';
if (!$user->hasRight('societe', 'client', 'voir')) {
$filenameamount = $dir.'/contractsamountinyear-'.$user->id.'-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsamountinyear-'.$user->id.'-'.$year.'.png';
} else {
$filenameamount = $dir.'/contractsamountinyear-'.$year.'.png';
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=contractstats&file=contractsamountinyear-'.$year.'.png';
}
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
if (!$mesg) {
$px2->SetData($data);
$i = $startyear;
$legend = array();
while ($i <= $endyear) {
$legend[] = $i;
$i++;
}
$px2->SetLegend($legend);
$px2->SetMaxValue($px2->GetCeilMaxValue());
$px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
$px2->SetWidth($WIDTH);
$px2->SetHeight($HEIGHT);
$px2->SetYLabel($langs->trans("AmountOfServices"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
$px2->mode = 'depth';
$px2->SetTitle($langs->trans("AmountOfServicesByMonthHT"));
$px2->draw($filenameamount, $fileurlamount);
}
// Show array
$data = $stats->getAllByYear();
$arrayyears = array();
foreach ($data as $val) {
if (!empty($val['year'])) {
$arrayyears[$val['year']] = $val['year'];
}
}
if (!count($arrayyears)) {
$arrayyears[$nowyear] = $nowyear;
}
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/contrat/stats/index.php?mode='.$mode;
$head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear';
$h++;
$type = 'contract_stats';
complete_head_from_modules($conf, $langs, null, $head, $h, $type);
print dol_get_fiche_head($head, 'byyear', '', -1);
print '<div class="fichecenter"><div class="fichethirdleft">';
// Show filter box
print '<form name="stats" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
print '<tr><td class="left">'.$langs->trans("ThirdParty").'</td><td class="left">';
$filter = '';
if ($mode == 'customer') {
$filter = '(s.client:IN:1,2,3)';
}
if ($mode == 'supplier') {
$filter = '(s.fournisseur:=:1)';
}
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company($socid, 'socid', $filter, 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// ThirdParty Type
print '<tr><td>'.$langs->trans("ThirdPartyType").'</td><td>';
$sortparam_typent = (!getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
print $form->selectarray("typent_id", $formcompany->typent_array(0), $typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam_typent, '', 1);
if ($user->admin) {
print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
print '</td></tr>';
// Category
$cat_type = 0;
$cat_label = '';
if ($mode == 'customer') {
$cat_type = Categorie::TYPE_CUSTOMER;
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer"));
}
if ($mode == 'supplier') {
$cat_type = Categorie::TYPE_SUPPLIER;
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
}
print '<tr><td>'.$cat_label.'</td><td>';
print img_picto('', 'category', 'class="pictofixedwidth"');
print $formother->select_categories($cat_type, $categ_id, 'categ_id', 0, 1, 'widthcentpercentminusx maxwidth300');
print '</td></tr>';
// User
print '<tr><td>'.$langs->trans("CreatedBy").'</td><td>';
print img_picto('', 'user', 'class="pictofixedwidth"');
print $form->select_dolusers($userid, 'userid', 1, null, 0, '', '', '0', 0, 0, '', 0, '', 'widthcentpercentminusx maxwidth300');
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td>';
$liststatus = array(
Contrat::STATUS_DRAFT => $langs->trans("ContractStatusDraft"),
Contrat::STATUS_VALIDATED => $langs->trans("ContractStatusValidated"),
Contrat::STATUS_CLOSED => $langs->trans("ContractStatusClosed"),
);
print $form->selectarray('object_status', $liststatus, GETPOST('object_status', 'intcomma'), -4);
print '</td></tr>';
// Year
print '<tr><td class="left">'.$langs->trans("Year").'</td><td class="left">';
if (!in_array($year, $arrayyears)) {
$arrayyears[$year] = $year;
}
if (!in_array($nowyear, $arrayyears)) {
$arrayyears[$nowyear] = $nowyear;
}
arsort($arrayyears);
print img_picto('', 'calendar', 'class="pictofixedwidth"');
print $form->selectarray('year', $arrayyears, $year, 0, 0, 0, '', 0, 0, 0, '', 'width75');
print '</td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" class="button small" name="submit" value="'.$langs->trans("Refresh").'"></td></tr>';
print '</table>';
print '</form>';
print '<br><br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre" height="24">';
print '<td class="center">'.$langs->trans("Year").'</td>';
print '<td class="right">'.$langs->trans("NbOfContracts").'</td>';
print '<td class="right">%</td>';
print '<td class="right">'.$langs->trans("AmountTotal").'</td>';
print '<td class="right">%</td>';
print '<td class="right">'.$langs->trans("AmountAverage").'</td>';
print '<td class="right">%</td>';
print '</tr>';
$oldyear = 0;
foreach ($data as $val) {
$year = $val['year'];
while (!empty($year) && $oldyear > (int) $year + 1) { // If we have empty year
$oldyear--;
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'&amp;mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$oldyear.'</a></td>';
print '<td class="right">0</td>';
print '<td class="right"></td>';
print '<td class="right">0</td>';
print '<td class="right"></td>';
print '<td class="right">0</td>';
print '<td class="right"></td>';
print '</tr>';
}
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&amp;mode='.$mode.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right opacitylow" style="'.((!isset($val['nb_diff']) || $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['nb_diff']) ? round($val['nb_diff']) : "0").'%</td>';
print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
print '<td class="right opacitylow" style="'.((!isset($val['total_diff']) || $val['total_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['total_diff']) ? round($val['total_diff']) : "0").'%</td>';
print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';
print '<td class="right opacitylow" style="'.((!isset($val['avg_diff']) || $val['avg_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.(isset($val['avg_diff']) ? round($val['avg_diff']) : "0").'%</td>';
print '</tr>';
$oldyear = $year;
}
print '</table>';
print '</div>';
print '</div><div class="fichetwothirdright">';
// Show graphs
print '<table class="border centpercent"><tr class="pair nohover"><td align="center">';
if ($mesg) {
print $mesg;
} else {
print $px1->show();
print "<br>\n";
print $px2->show();
}
print '</td></tr></table>';
print '</div></div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
// End of page
llxFooter();
$db->close();

View file

@ -247,7 +247,8 @@ if ($action == 'add') {
array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist),
GETPOST("ai_prompt"),
(GETPOST('emptyonclone', 'alpha') ? 1 : 0),
(GETPOST('showintooltip', 'int') ? 1 : 0)
(GETPOST('showintooltip', 'int') ? 1 : 0),
GETPOSTINT('personal_data')
);
if ($result > 0) {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
@ -434,7 +435,8 @@ if ($action == 'update') {
array('css' => $css, 'cssview' => $cssview, 'csslist' => $csslist),
GETPOST("ai_prompt"),
(GETPOST('emptyonclone', 'alpha') ? 1 : 0),
(GETPOST('showintooltip', 'int') ? 1 : 0)
(GETPOST('showintooltip', 'int') ? 1 : 0),
GETPOSTINT('personal_data')
);
if ($result > 0) {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
@ -155,11 +155,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$sendtosocid = $thirdparty->id;
}
} elseif ($object->element == 'member' || $object->element == 'user') {
'@phan-var-force Adherent|User $object';
$thirdparty = $object;
if ($object->socid > 0) {
$sendtosocid = $object->socid;
}
} elseif ($object->element == 'expensereport') {
'@phan-var-force ExpenseReport $object';
$tmpuser = new User($db);
$tmpuser->fetch($object->fk_user_author);
$thirdparty = $tmpuser;
@ -167,11 +169,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
$sendtosocid = $object->socid;
}
} elseif ($object->element == 'societe') {
'@phan-var-force Societe $object';
$thirdparty = $object;
if (is_object($thirdparty) && $thirdparty->id > 0) {
$sendtosocid = $thirdparty->id;
}
} elseif ($object->element == 'contact') {
'@phan-var-force Contact $object';
$contact = $object;
if ($contact->id > 0) {
$contact->fetch_thirdparty();

View file

@ -202,6 +202,11 @@ abstract class CommonInvoice extends CommonObject
*/
public $situation_cycle_ref;
/**
* @var int Populated by setRetainedWarrantyPaymentTerms()
*/
public $retained_warranty_fk_cond_reglement;
/**
* ! Closing after partial payment: CLOSECODE_DISCOUNTVAT, CLOSECODE_BADDEBT, CLOSECODE_BANKCHARGE, CLOSECODE_OTHER
* ! Closing when no payment: CLOSECODE_ABANDONED, CLOSECODE_REPLACED
@ -577,6 +582,37 @@ abstract class CommonInvoice extends CommonObject
return $listofopendirectdebitorcredittransfer;
}
/**
* Change the retained warranty payments terms
*
* @param int $id Id of new payment terms
* @return int >0 if OK, <0 if KO
*/
public function setRetainedWarrantyPaymentTerms($id)
{
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')');
if ($this->status >= 0 || $this->element == 'societe') {
$fieldname = 'retained_warranty_fk_cond_reglement';
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
$sql .= " SET ".$this->db->sanitize($fieldname)." = ".((int) $id);
$sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->retained_warranty_fk_cond_reglement = $id;
return 1;
} else {
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
} else {
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible');
$this->error = 'Status of the object is incompatible '.$this->status;
return -2;
}
}
/**
* Return list of payments
*

View file

@ -915,11 +915,6 @@ abstract class CommonObject
public $deposit_percent;
/**
* @var int Populated by setRetainedWarrantyPaymentTerms()
*/
public $retained_warranty_fk_cond_reglement;
/**
* @var int Populated by setWarehouse()
*/
@ -3268,37 +3263,6 @@ abstract class CommonObject
}
}
/**
* Change the retained warranty payments terms
*
* @param int $id Id of new payment terms
* @return int >0 if OK, <0 if KO
*/
public function setRetainedWarrantyPaymentTerms($id)
{
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')');
if ($this->status >= 0 || $this->element == 'societe') {
$fieldname = 'retained_warranty_fk_cond_reglement';
$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
$sql .= " SET ".$this->db->sanitize($fieldname)." = ".((int) $id);
$sql .= ' WHERE rowid='.((int) $this->id);
if ($this->db->query($sql)) {
$this->retained_warranty_fk_cond_reglement = $id;
return 1;
} else {
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Error '.$sql.' - '.$this->db->error());
$this->error = $this->db->error();
return -1;
}
} else {
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible');
$this->error = 'Status of the object is incompatible '.$this->status;
return -2;
}
}
/**
* Define delivery address
* @deprecated
@ -9664,6 +9628,8 @@ abstract class CommonObject
}
} elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('int'))) {
$value = (!empty($this->array_options["options_".$key]) || (isset($this->array_options["options_".$key]) && $this->array_options["options_".$key] === '0')) ? $this->array_options["options_".$key] : '';
} elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('varchar', 'char'))) {
$value = (isset($this->array_options["options_".$key]) && $this->array_options["options_".$key] !== '') ? $this->array_options["options_".$key] : '';
} else {
$value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object.
}

View file

@ -129,6 +129,22 @@ trait CommonPeople
return dol_string_nohtmltag(dol_trunc($ret, $maxlen));
}
/**
* Return full name (civility+' '+name+' '+lastname) or anonymous string
*
* @param Translate $langs Language object for translation of civility (used only if option is 1)
* @param int<0,1> $option 0=No option, 1=Add civility
* @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
* @param int $maxlen Maximum length
* @return string String with full name
*/
public function getAnonymisableFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
{
if (getDolGlobalInt('MAIN_ANONYMIZE_USER_FULLNAME') == 1) {
return '***';
}
return $this->getFullName($langs, $option, $nameorder, $maxlen);
}
/**
* Return civility label of object

View file

@ -1358,7 +1358,7 @@ class Conf extends stdClass
// Value 1 makes CSRF check for all POST parameters only
// Value 2 makes also CSRF check for GET requests with action = a sensitive requests like action=del, action=remove...
// Value 3 makes also CSRF check for all GET requests with a param action or massaction (except some non sensitive values)
$this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 3;
$this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = (defined('MAIN_SECURITY_CSRF_WITH_TOKEN') ? constant('MAIN_SECURITY_CSRF_WITH_TOKEN') : 3);
// Note: Set MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL=1 to have a renewal of token at each page call instead of each session (not recommended)
}

View file

@ -396,7 +396,12 @@ class DolEditor
$out .= ' entity_encoding: "raw",'."\n";
$out .= ' protect: [/<\?[\s\S]*?\?>/g],'."\n"; // protect PHP tags like CKEditor did
$out .= ' paste_data_images: true,'."\n";
$out .= ' content_style: \'p { margin: 8px 0 8px 0; line-height: 1.4em; } .mce-content-body { margin: 10px; } \',';
$fontlist = 'arial,tahoma,verdana,helvetica';
if (getDolGlobalString('THEME_FONT_FAMILY')) {
$fontlist = getDolGlobalString('THEME_FONT_FAMILY').', '.$fontlist;
}
$out .= ' content_style: \'p { margin: 6px 0 6px 0; line-height: 1.4em; } .mce-content-body { font-size: 0.94em; margin: 10px; font-family: '.$fontlist.' } \',';
$out .= ' toolbar_mode: "sliding",'."\n";
$out .= ' browser_spellcheck: '.(getDolGlobalString('CKEDITOR_NATIVE_SPELLCHECKER') ? 'true' : 'false').','."\n";
$out .= ' language: (tinyLang && tinyLang.indexOf("en") === 0) ? "en" : tinyLang,'."\n";

View file

@ -47,7 +47,7 @@ class ExtraFields
public $db;
/**
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed>,list:array<string,int|string>,pos:array<string,int>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,cssview:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>,alwayseditable:array<string,int<0,1>>,emptyonclone:array<string,int<0,1>>,loaded?:int,count:int,aiprompt:array<string,string>}> New array to store extrafields definition Note: count set as present to avoid static analysis notices
* @var array<string,array{label:array<string,string>,type:array<string,string>,size:array<string,string>,default:array<string,string>,computed:array<string,string>,unique:array<string,int>,required:array<string,int>,param:array<string,mixed>,perms:array<string,mixed>,list:array<string,int|string>,pos:array<string,int>,totalizable:array<string,int>,help:array<string,string>,printable:array<string,int>,enabled:array<string,int>,langfile:array<string,string>,css:array<string,string>,csslist:array<string,string>,cssview:array<string,string>,hidden:array<string,int>,mandatoryfieldsofotherentities:array<string,string>,alwayseditable:array<string,int<0,1>>,personal_data:array<string,int<0,1>>,emptyonclone:array<string,int<0,1>>,loaded?:int,count:int,aiprompt:array<string,string>}> New array to store extrafields definition Note: count set as present to avoid static analysis notices
*/
public $attributes = array();
@ -164,9 +164,11 @@ class ExtraFields
* @param string $aiprompt Ai prompt value
* @param int<0,1> $emptyonclone Is attribute to be emptied after object clone
* @param int<0,1> $showintooltip Is attribute to be show on tooltip
* @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD)
*
* @return int Return integer <=0 if KO, >0 if OK
*/
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0)
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0)
{
if (empty($attrname)) {
return -1;
@ -202,7 +204,7 @@ class ExtraFields
$err1 = $this->errno;
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') {
// Add declaration of field into table
$result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip);
$result2 = $this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip, $personal_data);
$err2 = $this->errno;
if ($result2 > 0
|| ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')
@ -243,9 +245,11 @@ class ExtraFields
* @param int<0,1> $printable Is extrafield displayed on PDF
* @param array<string,mixed> $moreparams More parameters. Example: array('css'=>, 'csslist'=>Css on list, 'cssview'=>...)
* @param int<0,1> $emptyonclone Is attribute to be emptied after object clone
* @param int<0,1> $showintooltip Show in tooltip
* @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD)
* @return int Return integer <=0 if KO, >0 if OK
*/
public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $emptyonclone = 0)
public function updateExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $emptyonclone = 0, $showintooltip = 0, $personal_data = 0)
{
if (empty($attrname)) {
return -1;
@ -271,13 +275,13 @@ class ExtraFields
// Create field into database except for separator type which is not stored in database
if ($type != 'separate') {
dol_syslog(get_class($this).'::thisupdate', LOG_DEBUG);
$result = $this->update($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone);
$result = $this->update($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone, $showintooltip, $personal_data);
}
$err1 = $this->errno;
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') {
// Add declaration of field into table
dol_syslog(get_class($this).'::thislabel', LOG_DEBUG);
$result2 = $this->update_label($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone);
$result2 = $this->update_label($attrname, $label, $type, $size, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, '', $emptyonclone, $showintooltip, $personal_data);
$err2 = $this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) {
$this->error = '';
@ -432,10 +436,11 @@ class ExtraFields
* @param string $aiprompt Ai prompt value
* @param int<0,1> $emptyonclone Is attribute to be emptied after object clone
* @param int<0,1> $showintooltip Is attribute to be show on tooltip
* @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD)
* @return int Return integer <=0 if KO, >0 if OK
* @throws Exception
*/
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = '', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0)
private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = '', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0)
{
// phpcs:enable
global $conf, $user;
@ -466,6 +471,9 @@ class ExtraFields
if (empty($alwayseditable)) {
$alwayseditable = 0;
}
if (empty($personal_data)) {
$personal_data = 0;
}
if (empty($emptyonclone)) {
$emptyonclone = 0;
}
@ -526,7 +534,8 @@ class ExtraFields
$sql .= " cssview,";
$sql .= " aiprompt,";
$sql .= " emptyonclone,";
$sql .= " showintooltip";
$sql .= " showintooltip,";
$sql .= " personal_data";
$sql .= " )";
$sql .= " VALUES('".$this->db->escape($attrname)."',";
$sql .= " '".$this->db->escape($label)."',";
@ -556,7 +565,8 @@ class ExtraFields
$sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null").",";
$sql .= " '".$this->db->escape($aiprompt)."',";
$sql .= " ".((int) $emptyonclone).' ,';
$sql .= " ".((int) $showintooltip);
$sql .= " ".((int) $showintooltip).' ,';
$sql .= " ".((int) $personal_data);
$sql .= ')';
if ($this->db->query($sql)) {
@ -704,10 +714,11 @@ class ExtraFields
* @param string $aiprompt Ai prompt value
* @param int<0,1> $emptyonclone Is attribute to be emptied after object clone
* @param int<0,1> $showintooltip Is attribute to be show on tooltip
* @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD)
* @return int >0 if OK, <=0 if KO
* @throws Exception
*/
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0)
public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0)
{
global $action, $hookmanager;
@ -789,7 +800,7 @@ class ExtraFields
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('extrafieldsdao'));
$parameters = array('field_desc' => &$field_desc, 'table' => $table, 'attr_name' => $attrname, 'label' => $label, 'type' => $type, 'length' => $length, 'unique' => $unique, 'required' => $required, 'pos' => $pos, 'param' => $param, 'alwayseditable' => $alwayseditable, 'emptyonclone' => $emptyonclone, 'perms' => $perms, 'list' => $list, 'help' => $help, 'default' => $default, 'computed' => $computed, 'entity' => $entity, 'langfile' => $langfile, 'enabled' => $enabled, 'totalizable' => $totalizable, 'printable' => $printable, 'showintooltip' => $showintooltip);
$parameters = array('field_desc' => &$field_desc, 'table' => $table, 'attr_name' => $attrname, 'label' => $label, 'type' => $type, 'length' => $length, 'unique' => $unique, 'required' => $required, 'pos' => $pos, 'param' => $param, 'alwayseditable' => $alwayseditable, 'emptyonclone' => $emptyonclone, 'perms' => $perms, 'list' => $list, 'help' => $help, 'default' => $default, 'computed' => $computed, 'entity' => $entity, 'langfile' => $langfile, 'enabled' => $enabled, 'totalizable' => $totalizable, 'printable' => $printable, 'showintooltip' => $showintooltip, 'personal_data' => $personal_data);
$reshook = $hookmanager->executeHooks('updateExtrafields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
@ -805,7 +816,7 @@ class ExtraFields
if ($result > 0 || $type == 'separate') {
if ($label) {
dol_syslog(get_class($this).'::update_label', LOG_DEBUG);
$result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip);
$result = $this->update_label($attrname, $label, $type, $length, $elementtype, $unique, $required, $pos, $param, $alwayseditable, $perms, $list, $help, $default, $computed, $entity, $langfile, $enabled, $totalizable, $printable, $moreparams, $aiprompt, $emptyonclone, $showintooltip, $personal_data);
}
if ($result > 0) {
$sql = '';
@ -865,14 +876,15 @@ class ExtraFields
* @param string $aiprompt Ai prompt value
* @param int<0,1> $emptyonclone Is attribute to be emptied after object clone
* @param int<0,1> $showintooltip Is attribute to be show on tooltip
* @param int<0,1> $personal_data Is attribute a personal data (RGPD,nLPD/LGPD)
* @return int Return integer <=0 if KO, >0 if OK
* @throws Exception
*/
private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0)
private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array(), $aiprompt = "", $emptyonclone = 0, $showintooltip = 0, $personal_data = 0)
{
// phpcs:enable
global $conf, $user;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable.", ".$printable.", ".$aiprompt.", ".$showintooltip);
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled.", ".$totalizable.", ".$printable.", ".$aiprompt.", ".$showintooltip.", ".$personal_data);
// Clean parameters
if ($elementtype == 'thirdparty') {
@ -900,6 +912,9 @@ class ExtraFields
if (empty($alwayseditable)) {
$alwayseditable = 0;
}
if (empty($personal_data)) {
$personal_data = 0;
}
if (empty($emptyonclone)) {
$emptyonclone = 0;
}
@ -976,7 +991,8 @@ class ExtraFields
$sql .= " cssview,";
$sql .= " aiprompt,";
$sql .= " showintooltip,";
$sql .= " emptyonclone";
$sql .= " emptyonclone,";
$sql .= " personal_data";
$sql .= ") VALUES (";
$sql .= "'".$this->db->escape($attrname)."',";
$sql .= " ".($entity === '' ? $conf->entity : $entity).",";
@ -1006,7 +1022,8 @@ class ExtraFields
$sql .= " ".($cssview ? "'".$this->db->escape($cssview)."'" : "null").",";
$sql .= " '".$this->db->escape($aiprompt)."',";
$sql .= " ".((int) $showintooltip)." ,";
$sql .= " ".((int) $emptyonclone);
$sql .= " ".((int) $emptyonclone)." ,";
$sql .= " ".((int) $personal_data);
$sql .= ")";
$resql2 = $this->db->query($sql);
@ -1061,8 +1078,8 @@ class ExtraFields
$array_name_label = array();
// We should not have several time this request. If we have, there is some optimization to do by calling a simple $extrafields->fetch_optionals() in top of code and not into subcode
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, emptyonclone, perms, langs, list, printable, showintooltip, totalizable, fielddefault, fieldcomputed, entity, enabled, help, aiprompt,";
$sql .= " css, cssview, csslist";
$sql = "SELECT rowid, name, label, type, size, elementtype, fieldunique, fieldrequired, param, pos, alwayseditable, emptyonclone, perms, langs, list, printable, showintooltip, totalizable, fielddefault, fieldcomputed, entity, enabled, help, aiprompt";
$sql .= " , css, cssview, csslist, personal_data";
$sql .= " FROM ".$this->db->prefix()."extrafields";
//$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later
if ($elementtype && $elementtype != 'all') {
@ -1119,6 +1136,7 @@ class ExtraFields
$this->attributes[$tab->elementtype]['css'][$tab->name] = $tab->css;
$this->attributes[$tab->elementtype]['cssview'][$tab->name] = $tab->cssview;
$this->attributes[$tab->elementtype]['csslist'][$tab->name] = $tab->csslist;
$this->attributes[$tab->elementtype]['personal_data'][$tab->name] = $tab->personal_data;
$this->attributes[$tab->elementtype]['loaded'] = 1;
$count++;
@ -2832,6 +2850,9 @@ class ExtraFields
$out = '<'.$tagtype.' id="trextrafieldseparator'.$key.(!empty($object->id) ? '_'.$object->id : '').'" class="trextrafieldseparator trextrafieldseparator'.$key.(!empty($object->id) ? '_'.$object->id : '').'">';
$out .= '<'.$tagtype_dyn.' '.(!empty($colspan) ? 'colspan="' . $colspan . '"' : '').'>';
if ($mode == 'create' || $mode == 'edit') {
$out .= '<br>';
}
// Some js code will be injected here to manage the collapsing of extrafields
// Output the picto
$out .= '<span class="'.($extrafield_collapse_display_value ? 'cursorpointer ' : '').($extrafield_collapse_display_value == 0 ? 'fas fa-square opacitymedium' : 'far fa-'.(($expand_display ? 'minus' : 'plus').'-square')).'"></span>';

View file

@ -2473,7 +2473,7 @@ class Form
/**
* Return select list of users
*
* @param string|int|User $userselected User id or user object of user preselected. If 0 or < -2, we use id of current user. If -1 or '', keep unselected (if empty is allowed)
* @param string|int|User|array<int,int> $userselected User id or User object of user preselected or Array of user selected. If 0 or < -4, we use id of current user. If -1 or '', keep unselected (if empty is allowed)
* @param string $htmlname Field name in form
* @param int<0,1>|string $show_empty 0=list with no empty value, 1=add also an empty value into list
* @param int[]|null $exclude Array list of users id to exclude
@ -2503,20 +2503,26 @@ class Form
// Convert $selected into an int (in case it is an object)
if (is_object($userselected)) {
$selected = (int) $userselected->id;
} else {
} elseif (is_numeric($userselected)) {
$selected = (int) $userselected;
} elseif (is_array($userselected)) {
$selected = $userselected;
} else {
$selected = -1;
}
// If no preselected user defined, we take current user
if (($selected < -4 || empty($selected)) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) {
if ((is_numeric($selected) && ((int) $selected < -4 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) {
$selected = $user->id;
}
// Convert selected int into an array
if ($selected === '') {
$selected = array();
} elseif (!is_array($selected)) {
$selected = array($selected);
if (!is_array($selected)) {
if ($selected === -1 || $selected === '') {
$selected = array();
} else {
$selected = array($selected);
}
}
// Exclude some users in $excludeUsers string
@ -2597,7 +2603,9 @@ class Form
}
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
$sql .= " AND (u.statut <> 0";
$sql .= " OR rowid IN (".$this->db->sanitize(implode(',', $selected)).")"; // We must always keep the selected users to avoid to loose it/them when updating
if (!empty($selected)) {
$sql .= " OR rowid IN (".$this->db->sanitize(implode(',', $selected)).")"; // We must always keep the selected users to avoid to loose it/them when updating
}
$sql .= ")";
}
if (getDolGlobalString('USER_HIDE_NONEMPLOYEE_IN_COMBOBOX')) {

View file

@ -127,7 +127,7 @@ class FormAI extends Form
}
if (empty($onlyenhancements) || in_array($onlyenhancements, array('texttranslation'))) {
$out .= ($out ? '<br>' : '');
$out .= ($out ? '<div style="height: 10px;"></div>' : '');
$out .= '<div id="ai_translation'.$htmlContent.'" class="ai_translation'.$htmlContent.' paddingtop paddingbottom ai_feature">';
$out .= img_picto('', 'language', 'class="pictofixedwidth paddingrightonly"');
$out .= $formadmin->select_language("", "ai_translation".$htmlContent."_select", 0, array(), $langs->trans("TranslateByAI").'...', 0, 0, 'minwidth250 ai_translation'.$htmlContent.'_select');
@ -136,7 +136,7 @@ class FormAI extends Form
if (empty($onlyenhancements) || in_array($onlyenhancements, array('textsummarize'))) {
$summarizearray = getListForAISummarize();
$out .= ($out ? '<br>' : '');
$out .= ($out ? '<div style="height: 10px;"></div>' : '');
$out .= '<div id="ai_summarize'.$htmlContent.'" class="ai_summarize'.$htmlContent.' paddingtop paddingbottom ai_feature">';
$out .= img_picto('', 'edit', 'class="pictofixedwidth paddingrightonly"');
$out .= $form->selectarray("ai_summarize".$htmlContent."_select", $summarizearray, 0, $langs->trans("SummarizeByAI").'...', 0, 0, '', 1, 0, 0, '', 'minwidth250 ai_summarize'.$htmlContent.'_select');
@ -145,7 +145,7 @@ class FormAI extends Form
if (empty($onlyenhancements) || in_array($onlyenhancements, array('textrephrase'))) {
$stylearray = getListForAIRephraseStyle();
$out .= ($out ? '<br>' : '');
$out .= ($out ? '<div style="height: 10px;"></div>' : '');
$out .= '<div id="ai_rephraser'.$htmlContent.'" class="ai_rephraser'.$htmlContent.' paddingtop paddingbottom ai_feature">';
$out .= img_picto('', 'edit', 'class="pictofixedwidth paddingrightonly"');
$out .= $form->selectarray("ai_rephraser".$htmlContent."_select", $stylearray, 0, $langs->trans("RephraserByAI").'...', 0, 0, '', 1, 0, 0, '', 'minwidth250 ai_rephraser'.$htmlContent.'_select');
@ -207,14 +207,14 @@ class FormAI extends Form
});
$('#ai_summarize".$htmlContent."_select').on('change', function() {
console.log('We change #ai_summarize".$htmlContent."_select with lang '+$(this).val());
console.log('We change #ai_summarize".$htmlContent."_select with length '+$(this).val());
if ($(this).val() != null && $(this).val() != '' && $(this).val() != '-1') {
prepareCallAIGenerator($(this));
}
});
$('#ai_rephraser".$htmlContent."_select').on('change', function() {
console.log('We change #ai_summarize".$htmlContent."_select with lang '+$(this).val());
console.log('We change #ai_summarize".$htmlContent."_select with mode '+$(this).val());
if ($(this).val() != null && $(this).val() != '' && $(this).val() != '-1') {
prepareCallAIGenerator($(this));
}
@ -238,10 +238,11 @@ class FormAI extends Form
instructions = '';
htmlname = '".dol_escape_js($htmlContent)."';
format = '".dol_escape_js($format)."';
functionai = $(element).data('functionai'); /* element is the html element we have manipulated in the ai tool */
functionai = $(element).data('functionai'); /* element is the html element we have manipulated in the ai tool */
style = $('#ai_rephraser'+htmlname+'_select').val();
texttomodify = '';
console.log('htmlname='+htmlname+' functionai='+functionai);
console.log('htmlname='+htmlname+' functionai='+functionai+' style='+style);
if ($('#'+htmlname).is('div')) {
texttomodify = $('#'+htmlname).html(); /* for div */
} else {
@ -289,8 +290,12 @@ class FormAI extends Form
}
instructions = 'Summarize the following text '+ (unit == 'percent' ? 'by ' : 'in') + width + ' ' + unit + ': ' + texttomodify;
} else if (functionai == 'textrephraser') {
style = $('#ai_rephraser'+htmlname+'_select').val();
instructions = 'Rephrase the following text in a '+style+' style: ' + texttomodify;
if (style == 'spellchecker') {
instructions = 'Fix spelling and grammar errors in the following text : ' + texttomodify;
functionai = 'textspellchecker';
} else {
instructions = 'Rephrase the following text in a '+style+' style: ' + texttomodify;
}
} else if (functionai == 'textgenerationextrafield'){
instructions = $(element).val();
} else {

View file

@ -1403,7 +1403,7 @@ class FormFile
// Show title of list of existing files
$morehtmlright = '';
if (!empty($moreoptions['showhideaddbutton']) && $conf->use_javascript_ajax) {
$tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery("input[type=\'file\']").click(); } void(0);';
$tmpurlforbutton = 'javascript:console.log("open add file form");jQuery(".divattachnewfile").toggle(); if (!jQuery(".divattachnewfile").is(":hidden")) { jQuery(".divattachnewfile input[type=\'file\']").first().click();} void(0);'; // scope file picker click to the just-shown form to avoid triggering native file dialog twice when other input[type=file] exist on the page
$morehtmlright .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $tmpurlforbutton, '', $permtoeditline);
}

View file

@ -82,7 +82,6 @@ function print_actions_filter(
$formactions = new FormActions($db);
// Filters
//print '<form name="listactionsfilter" class="listactionsfilter" action="' . $_SERVER["PHP_SELF"] . '" method="get">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="year" value="'.((int) $year).'">';
print '<input type="hidden" name="month" value="'.((int) $month).'">';

View file

@ -50,7 +50,7 @@ function fichinter_prepare_head($object)
if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = dolBuildUrl(DOL_URL_ROOT.'/fichinter/contact.php', ['id' => $object->id]);
$head[$h][1] = $langs->trans('InterventionContact');
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) {
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
}

View file

@ -2306,8 +2306,8 @@ function dolSlugify($stringtoslugify)
* Returns text escaped for inclusion into javascript code
*
* @param int|string $stringtoescape String to escape
* @param int<0,3> $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \
* @param int $noescapebackslashn 0=Escape also \n. 1=Do not escape \n.
* @param int<0,3> $mode 0=Escape also ' and " into ', 1=Escape ' but not " for usage into 'string', 2=Escape " but not ' for usage into "string", 3=Escape ' and " with \ .
* @param int<0,1> $noescapebackslashn 0=Escape also \n. 1=Do not escape \n.
* @return string Escaped string. Both ' and " are escaped into ' if they are escaped.
*/
function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0)
@ -15569,8 +15569,7 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '', $us
//var_dump($element_prop);
//var_dump($element_prop['module'].' '.$ismodenabled);
if (is_array($element_prop) && (empty($element_prop['module']) || $ismodenabled)) {
if (
$useCache === 1
if ($useCache === 1 && $element_id > 0
&& !empty($conf->cache['fetchObjectByElement'][$element_type])
&& !empty($conf->cache['fetchObjectByElement'][$element_type][$element_id])
&& is_object($conf->cache['fetchObjectByElement'][$element_type][$element_id])

View file

@ -5,7 +5,7 @@
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2017 ATM-CONSULTING <contact@atm-consulting.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -526,7 +526,7 @@ function getNumberInvoicesPieChart($mode)
$dolgraph->setLegend($legend);
$dolgraph->SetDataColor(array_values($colorseries));
$dolgraph->SetDataColor($colorseries);
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('bars', 'bars', 'bars', 'bars', 'bars', 'bars'));

View file

@ -15,7 +15,7 @@
* Copyright (C) 2020 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
* Copyright (C) 2023-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -339,7 +339,7 @@ function pdf_getHeightForLogo($logo, $url = false)
* @return int Height
* @see getStringHeight()
*/
function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
function pdfGetHeightForHtmlContent($pdf, $htmlcontent)
{
// store current object
$pdf->startTransaction();
@ -375,8 +375,8 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
}
}
}
// restore previous object
$pdf = $pdf->rollbackTransaction();
// restore previous object state
$pdf->rollbackTransaction(true);
return $height;
}
@ -744,7 +744,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
* @param float $page_height Height of page
* @return void
*/
function pdf_pagehead(&$pdf, $outputlangs, $page_height)
function pdf_pagehead($pdf, $outputlangs, $page_height)
{
global $conf;
@ -782,7 +782,7 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height)
* @param float $posy Pos y
* @return void
*/
function pdfWriteAdditionnalTitle(&$pdf, $outputlangs, $page_height, $object, &$w, &$posx, &$posy)
function pdfWriteAdditionnalTitle($pdf, $outputlangs, $page_height, $object, &$w, &$posx, &$posy)
{
// Transaction/Signature ID + Duplicate or Temporary info
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
@ -807,7 +807,7 @@ function pdfWriteAdditionnalTitle(&$pdf, $outputlangs, $page_height, $object, &$
* @param float $tab2_hl Tab2_hl
* @return void
*/
function pdfWriteVATArray(&$docgenerator, &$index, &$pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl)
function pdfWriteVATArray($docgenerator, &$index, $pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl)
{
global $mysoc;
@ -1047,7 +1047,7 @@ function pdfWriteVATArray(&$docgenerator, &$index, &$pdf, $outputlangs, $outputl
* @param float $resteapayer_origin Remain to pay
* @return void
*/
function pdfWriteAlreadyPaid(&$docgenerator, &$index, &$pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl, $deja_regle, $creditnoteamount, $depositsamount, $resteapayer, $resteapayer_origin)
function pdfWriteAlreadyPaid($docgenerator, &$index, $pdf, $outputlangs, $outputlangsbis, $object, $col1x, $col2x, $largcol2, $tab2_top, $tab2_hl, $deja_regle, $creditnoteamount, $depositsamount, $resteapayer, $resteapayer_origin)
{
global $mysoc;
@ -1152,7 +1152,7 @@ function pdf_getSubstitutionArray($outputlangs, $exclude = null, $object = null,
* @param string $text Text to show
* @return void
*/
function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
function pdf_watermark($pdf, $outputlangs, $h, $w, $unit, $text)
{
// Print Draft Watermark
if ($unit == 'pt') {
@ -1216,7 +1216,7 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text)
* @param CommonDocGenerator $pdftemplate PDF template
* @return int 0 if nothing done, 1 if a mention was printed
*/
function pdfCertifMention(&$pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
function pdfCertifMention($pdf, $outputlangs, $seller, $default_font_size, &$posy, $pdftemplate)
{
include_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php';
@ -1236,7 +1236,7 @@ function pdfCertifMention(&$pdf, $outputlangs, $seller, $default_font_size, &$po
* @param int $default_font_size Default font size
* @return float The Y PDF position
*/
function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
function pdf_bank($pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $default_font_size = 10)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
@ -1418,7 +1418,7 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0,
* @param string $watermark Watermark text to print on page
* @return int Return height of bottom margin including footer text
*/
function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark = '')
function pdf_pagefoot($pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_basse, $marge_gauche, $page_hauteur, $object, $showdetails = 0, $hidefreetext = 0, $page_largeur = 0, $watermark = '')
{
global $conf, $hookmanager;
@ -1805,7 +1805,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
* @param float $default_font_size Font size
* @return float The Y PDF position
*/
function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
function pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, $w, $h, $align, $default_font_size)
{
$linkedobjects = pdf_getLinkedObjects($object, $outputlangs); // May update $object->note_public
@ -1843,7 +1843,7 @@ function pdf_writeLinkedObjects(&$pdf, $object, $outputlangs, $posx, $posy, $w,
* @param 'L'|'C'|'R'|'J' $align text alignment ('L', 'C', 'R', 'J' (default))
* @return string
*/
function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align = 'J')
function pdf_writelinedesc($pdf, $object, $i, $outputlangs, $w, $h, $posx, $posy, $hideref = 0, $hidedesc = 0, $issupplierline = 0, $align = 'J')
{
global $hookmanager;
@ -2981,7 +2981,7 @@ function canDisplayLinkedObjectInPDF($object, $elementobject)
* @param Translate $outputlangs Object lang for output
* @return array<string,array<string,null|int|float|string>> Linked objects
*/
function pdf_getLinkedObjects(&$object, $outputlangs)
function pdf_getLinkedObjects($object, $outputlangs)
{
global $db, $hookmanager;

View file

@ -1383,7 +1383,7 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
print $taskstatic->getNomUrl(1, 'withproject', 'time');
// Label task
print '<br>';
print '<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
print '<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
for ($k = 0; $k < $level; $k++) {
print "</div>";
}
@ -1707,7 +1707,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
print $taskstatic->getNomUrl(1, 'withproject', 'time');
// Label task
print '<br>';
print '<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
print '<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
for ($k = 0; $k < $level; $k++) {
print "</div>";
}
@ -2104,7 +2104,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
}
// Ref
print '<td class="tdoverflowmax300">';
print '<td>';
print '<!-- Task id = '.$lines[$i]->id.' (projectlinesperweek) -->';
for ($k = 0; $k < $level; $k++) {
print '<div class="marginleftonly">';
@ -2112,7 +2112,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
print $taskstatic->getNomUrl(1, 'withproject', 'time');
// Label task
print '<br>';
print '<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
print '<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
for ($k = 0; $k < $level; $k++) {
print "</div>";
}
@ -2434,7 +2434,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &
print $taskstatic->getNomUrl(1, 'withproject', 'time');
// Label task
print '<br>';
print '<div class="opacitymedium tdoverflowmax500" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
print '<div class="opacitymedium tdoverflowmax400 small" title="'.dol_escape_htmltag($taskstatic->label).'">'.dol_escape_htmltag($taskstatic->label).'</div>';
for ($k = 0; $k < $level; $k++) {
print "</div>";
}
@ -2963,13 +2963,14 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
if (getDolGlobalString('PROJECT_LIMIT_YEAR_RANGE')) {
//Add the year filter input
print '<form method="get" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<table width="100%">';
print '<form method="GET" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'">';
print '<table class="centpercent">';
print '<tr>';
print '<td>'.$langs->trans("Year").'</td>';
print '<td class="right"><input type="text" size="4" class="flat" name="project_year_filter" value="'.((int) $project_year_filter).'"/>';
print "</tr>\n";
print '</table></form>';
print '</table>';
print '</form>';
}
}

View file

@ -200,6 +200,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract") && $leftmenu=="contracts"', __HANDLER__, 'left', 1405__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=4', 'MenuRunningServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract") && $leftmenu=="contracts"', __HANDLER__, 'left', 1406__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=4%26filter=expired', 'MenuExpiredServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract") && $leftmenu=="contracts"', __HANDLER__, 'left', 1407__+MAX_llx_menu__, 'commercial', '', 1403__+MAX_llx_menu__, '/contrat/services_list.php?mainmenu=commercial&amp;leftmenu=contracts&amp;search_status=5', 'MenuClosedServices', 2, 'contracts', '$user->rights->contrat->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("contract")', __HANDLER__, 'left', 1409__+MAX_llx_menu__, 'commercial', '', 1400__+MAX_llx_menu__, '/contrat/stats/index.php?mainmenu=commercial&amp;leftmenu=contracts', 'Statistics', 1, 'contracts', '(getDolGlobalString("MAIN_NEED_EXPORT_PERMISSION_TO_READ_STATISTICS") ? $user->hasRight("contrat", "export") : $user->hasRight("contrat", "lire"))', '', 2, 4, __ENTITY__);
-- Commercial - Interventions
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("intervention")', __HANDLER__, 'left', 1500__+MAX_llx_menu__, 'commercial', 'ficheinter', 5__+MAX_llx_menu__, '/fichinter/list.php?mainmenu=commercial&amp;leftmenu=ficheinter', 'Interventions', 0, 'interventions', '$user->rights->ficheinter->lire', '', 2, 8, __ENTITY__);

View file

@ -1509,6 +1509,7 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left
$newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=4%26filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire'));
$newmenu->add("/contrat/services_list.php?leftmenu=contracts&amp;search_status=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire'));
}
$newmenu->add("/contrat/stats/index.php", $langs->trans("Statistics"), 1, $user->hasRight('contrat', 'lire'));
}
// Interventions

View file

@ -8,7 +8,7 @@
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -139,7 +139,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/
public $rights_class;
const URL_FOR_BLACKLISTED_MODULES = 'https://ping.dolibarr.org/modules-blacklist.txt';
const URL_FOR_BLACKLISTED_MODULES = 'https://www.dolibarr.org/modules-blacklist.php';
const KEY_ID = 0;
const KEY_LABEL = 1;
@ -298,7 +298,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
*/
public $export_help_array;
/**
* @var array<array<array{rule:string,file:string,classfile:string,class:string,method:string,method_params:string[]}>>|array<array<string,string>>
* @var array<array<array{rule:string,file?:string,classfile:string,class:string,method:string,method_params:string[]}>>|array<array<string,string>>
*
* Other example:
* modBanque: [<int>]=array('-b.amount'=>'NULLIFNEG', 'b.amount'=>'NULLIFNEG')
@ -2770,11 +2770,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$arrayoflines = preg_split("/[\n,]/", $result['content']);
foreach ($arrayoflines as $line) {
$tmpfieldsofline = explode(';', $line);
$modulekey = strtolower($tmpfieldsofline[0]);
$conf->cache['noncompliantmodules'][$modulekey]['name'] = $tmpfieldsofline[0];
$conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? $tmpfieldsofline[1] : '');
$conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? $tmpfieldsofline[2] : '');
$conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty($tmpfieldsofline[3]) ? 'WarningModuleAffiliatedToAReportedCompany' : $tmpfieldsofline[3]);
$modulekey = strtolower(trim($tmpfieldsofline[0]));
if (empty($modulekey)) {
continue;
}
$conf->cache['noncompliantmodules'][$modulekey]['name'] = trim($tmpfieldsofline[0]);
$conf->cache['noncompliantmodules'][$modulekey]['id'] = (isset($tmpfieldsofline[1]) ? trim($tmpfieldsofline[1]) : '');
$conf->cache['noncompliantmodules'][$modulekey]['signature'] = (isset($tmpfieldsofline[2]) ? trim($tmpfieldsofline[2]) : '');
$conf->cache['noncompliantmodules'][$modulekey]['message'] = $langs->trans(empty(isset($tmpfieldsofline[3]) ? trim($tmpfieldsofline[3]) : '') ? 'WarningModuleAffiliatedToAReportedCompany' : trim($tmpfieldsofline[3]));
if (!empty($tmpfieldsofline[4])) {
$message2 = $langs->trans("WarningModuleAffiliatedToAPiratPlatform", '{s}');
$listofillegalurl = '';

View file

@ -240,7 +240,7 @@ class pdf_balance extends ModelePdfAccountancy
$pdf->SetSubject($outputlangs->transnoentities("AccountancyBalance"));
}
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("AccountancyBalance"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -230,7 +230,7 @@ class pdf_bookkeeping extends ModelePdfAccountancy
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("AccountancyBookkeeping"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("AccountancyBookkeeping"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -239,7 +239,7 @@ class pdf_ledger extends ModelePdfAccountancy
$pdf->SetSubject($outputlangs->transnoentities("AccountancyLedger"));
}
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("AccountancyLedger"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -241,7 +241,7 @@ class pdf_standard_actions
$pdf->SetTitle($outputlangs->convToOutputCharset($this->title));
$pdf->SetSubject($outputlangs->convToOutputCharset($this->subject));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeywords($outputlangs->convToOutputCharset($this->title." ".$this->subject));
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
@ -345,7 +345,7 @@ class pdf_standard_actions
if ($obj->fk_project > 0) {
$projectstatic->fetch($obj->fk_project);
if ($projectstatic->ref) {
$text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode($projectstatic->ref);
$text .= ($status ? ' - ' : '').$outputlangs->transnoentitiesnoconv("Project").": ".dol_htmlentitiesbr_decode((string) $projectstatic->ref);
}
}

View file

@ -253,7 +253,7 @@ class pdf_standard_asset extends ModelePDFAsset
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("PdfTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfTitle")." ".$outputlangs->convToOutputCharset((string) $object->thirdparty->name));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -180,7 +180,7 @@ class pdf_ban extends ModeleBankAccountDoc
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("BAN"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("BAN"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -212,7 +212,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("SepaMandate"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("SepaMandate"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -181,7 +181,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->SetTitle($outputlangs->transnoentities("CheckReceipt")." ".$number);
$pdf->SetSubject($outputlangs->transnoentities("CheckReceipt"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->transnoentities("CheckReceipt")." ".$number);
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -289,7 +289,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -337,7 +337,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("PdfOrderTitle"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("PdfOrderTitle")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -252,7 +252,7 @@ class pdf_strato extends ModelePDFContract
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Contract"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Contract")." ".$outputlangs->convToOutputCharset($object->thirdparty->name));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -274,7 +274,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -250,7 +250,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -288,7 +288,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Shipment"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

View file

@ -240,7 +240,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Shipment"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getAnonymisableFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Shipment"));
if (getDolGlobalString('MAIN_DISABLE_PDF_COMPRESSION')) {
$pdf->SetCompression(false);

Some files were not shown because too many files have changed in this diff Show more