Merge branch 'rdb' of github.com:altairisfr/dolibarr into rdb

This commit is contained in:
Christophe Battarel 2024-01-23 18:06:24 +01:00
commit 2e2b45ef96
321 changed files with 6428 additions and 3792 deletions

View file

@ -37,7 +37,7 @@ jobs:
tools: phpstan, cs2pr
extensions: calendar, json, imagick, gd, zip, mbstring, intl, opcache, imap, mysql, pgsql, sqlite3, ldap, xml, mcrypt
# ???
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 14.x
registry-url: 'https://registry.npmjs.org'

View file

@ -21,7 +21,7 @@ jobs:
run: |-
[ -r requirements.txt ] || [ -r pyproject.toml ] || touch requirements.txt
# Install python and pre-commit tool
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
cache: pip
python-version: '3.11'
@ -62,7 +62,7 @@ jobs:
}}
# Upload result log files of precommit into the Artifact shared store
- name: Provide log as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: precommit-logs

View file

@ -15,7 +15,6 @@ repos:
- id: trailing-whitespace
exclude_types: [markdown]
- id: end-of-file-fixer
types: [yaml]
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
@ -49,8 +48,10 @@ repos:
hooks:
- id: php-cbf
files: \.(php)$
args: [-p]
args: [--standard=dev/setup/codesniffer/ruleset.xml -p]
- id: php-cs
files: \.(php)$
args: [--standard=dev/setup/codesniffer/ruleset.xml -p]
- id: php-lint
# Prettier (format code, only for non common files)
@ -75,7 +76,7 @@ repos:
- css
- yaml
# Check format of yam files
# Check format of yaml files
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
hooks:

View file

@ -42,7 +42,7 @@ PrestaShop-WS-Lib 94feb5f OSL-3.0 No
PSR/Logs 1.0 MIT License Yes Library for logs (used by DebugBar)
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 4.0.2 BSD Yes DAV support
Sabre 4.6.0 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar)
Stripe 10.7.0 MIT Licence Yes Library for Stripe module

View file

@ -3,6 +3,26 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 19.0.0 compared to 18.0.0 *****
For users:
----------
NEW: Compatibility with PHP 8.3
...
For developers or integrators:
------------------------------
...
WARNING:
--------
The following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* More class properties (with old name in french) are now deprecated in favor of the property name in english.
* Some API HTTP return code were moved from 401 to 403 to better follow REST specification.
***** ChangeLog for 19.0.0 compared to 18.0.0 *****
For users:

View file

@ -48,12 +48,16 @@ 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 or in the last stable "vX.Y" released version. Reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated.
* The version to analyze must be the last version available in the "develop" branch. Reports on vulnerabilities already fixed (so already reported) in the develop branch will not be validated.
* $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)
* $dolibarr_main_force_https must be set to something else than 0.
* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3 in the backoffice menu Home - Setup - Other (this protection should be set to 3 soon by default). CSRF attacks are accepted but
double check that you have set MAIN_SECURITY_CSRF_WITH_TOKEN to value 3.
* Some constant must be set in the backoffice menu Home - Setup - Other
- MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 3
- MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1
- MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1
- MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES = 1
CSRF attacks and HTML injections are accepted but double check this setup that is experimental setup that already fix a lot of case and soon enabled by default.
* ONLY security reports on modules provided by default and with the "stable" status are valid (troubles in "experimental", "development" or external modules are not valid vulnerabilities).
* The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer).
* The web server setup must be done so that only the documents directory is in write mode. The root directory called htdocs must be read-only.
@ -87,12 +91,10 @@ Scope is the web application (backoffice) and the APIs.
* Logout and other instances of low-severity Cross-Site Request Forgery
* Reports from automated web vulnerability scanners (Acunetix, Vega, etc.) that have not been validated
* Reports on features on modules flagged as "deprecated", "experimental" or "development" if the module needs to be enabled for that (this is not the case on production).
* Software or libraries versions or private IP disclosure when logged-in user is admin
* Stack traces or path disclosure when logged-in user is admin
* Software or libraries versions, private IP disclosure, Stack traces or path disclosure when logged-in user is admin.
* Any vulnerabilities due to a configuration different than the one defined in chapter "Scope for qualified vulnerabilities".
* Vulnerabilities affecting outdated browsers or platforms, or vulnerabilities inside browsers themself.
* Brute force attacks on login page, password forgotten page or any public pages (/public/*) are not qualified if the recommended fail2ban rules were not installed.
* SSL/TLS best practices
* Denial of Service attacks
* Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC)
* Physical or social engineering attempts or issues that require physical access to a victim’s computer/device

View file

@ -1,19 +1,40 @@
--- HOW TO USE COMPOSER
* Switch to the minimal version of PHP
update-alternatives --config php
* To list packages
composer show -i
cd htdocs/includes/diroflib
composer install
composer show -i
* To test upgrade of a lib with composer:
* To upgrade a lib with composer using the composer.json of the library only:
Remove entry in composer.lock
Edit composer.json to change version to "x.y.z"
composer -v update --root-reqs --no-dev --no-autoloader --dry-run ccampbell/chromephp
* To upgrade a lib with composer:
cd htdocs/includes/diroflib
rm composer.lock
Edit composer.json to change version to "x.y.z"
composer -v update --root-reqs --no-dev --ignore-platform-reqs
composer -v update --root-reqs --no-dev --ignore-platform-reqs [--no-autoloader] [--dry-run] ccampbell/chromephp
* To upgrade a lib with composer using the composer.json of Dolibarr:
Remove entry in composer.lock
cd /
mv composer.json.disabled composer.json
rm composer.lock
Edit composer.json to change version to "x.y.z"
composer -v update --root-reqs --no-dev --no-autoloader ccampbell/chromephp
composer -v update --root-reqs --no-dev --ignore-platform-reqs
composer -v update --root-reqs --no-dev --ignore-platform-reqs [--no-autoloader] [--dry-run] ccampbell/chromephp

View file

@ -33,16 +33,9 @@
"tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^3.7.1",
"stripe/stripe-php" : "10.7.0",
"maximebf/debugbar" : "1.18.2",
"symfony/var-dumper" : ">=3.2"
"maximebf/debugbar" : "1.18.2"
},
"require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0",
"php-parallel-lint/php-console-highlighter" : "^0",
"phpunit/phpunit" : "^4",
"squizlabs/php_codesniffer" : "^2",
"phpunit/phpunit-selenium" : "^2",
"rector/rector" : "^0.16.0"
},
"suggest" : {
"ext-mysqlnd" : "To use with MySQL or MariaDB",
@ -50,7 +43,7 @@
"ext-pgsql" : "To use with PostgreSQL",
"ext-gd" : "Image manipulation (Required but maybe built-in PHP)",
"ext-imagick" : "Generation of thumbs from PDF",
"ext-mcrypt" : "(Required but maybe built-in PHP)",
"ext-intl" : "Intl",
"ext-openssl" : "Secure connections (Emails, SOAP\u2026)",
"ext-mbstring" : "Handle non UTF-8 characters",
"ext-soap" : "Native SOAP",

10
dev/setup/README.md Normal file
View file

@ -0,0 +1,10 @@
# Setting up for Dolibarr development
Check out the
[online documentation](https://wiki.dolibarr.org/index.php?title=Environment_and_development_tools)
for recommendations (to be updated).
If anything, install `pre-commit` - it will help run the tools to format and
make some basic verifications on your submission before committing and pushing
to github for a PR. See [a quick start guide](./pre-commit/README.md) in this
Dolibarr repository.

View file

@ -0,0 +1,85 @@
## 'pre-commit' ("replaces" precommit)
### Introduction
[`pre-commit`](https://pre-commit.org) is a framework for managing and
maintaining multi-language pre-commit hooks.
"pre-commit hooks" integrate with `git` and are run when you perform a
`git commit` for instance.
Historically there was `precommit` for Dolibarr which you can find in this
directory. That script runs `phplint`, `phpcs` and `phpcbf` upon commit.
`pre-commit` is not specific to Dolibarr and is deployed on many projects -
mostly Python projects, but it is applicable to most (or *all*) code and
documentation development.
You can find documentation at https://pre-commit.com/ .
Now you can use `pre-commit` which uses the configuration found at the root of
the project: `pre-commit-config.yaml`.
### How to
1. Install `pre-commit`.\
If you do not have python installed, install
[python](https://www.python.org) first.\
If you do not have
[`pip`](https://pypi.org/project/pip), install that as well.\\
Then you can install pre-commit: `python -m pip install pre-commit`.
1. In you local git clone of the project, run `pre-commit install`. That will
add the hooks.
### Tips
After installing `pre-commit` onto your local git clone, pre-commit will run
on every commit.
When it finds some issue, the git commit will be aborted, so you can fix it,
or verify it.
The tools run by `pre-commit` may modify your code: format PHP code
(`phpcbf`), fix line endings, end of files, etc.
They may also alert about potential issues: syntax errors, spelling errors,
code quality, an execute bit that was (not) set in the git repository, etc.
One way to use it is this:
```bash
cd PROJECT_DIR
pre-commit install # Only needed once
# Repeat until success.
git commit -a -m "My message"
# `pre-commit` is run and reports
# Check the results, make fixes, and re-commit (=repeat above line).
```
In some cases you may want to commit despite the changes.\
You can just add
`--no-verify` to your git command:
```bash
git commit -a -m "My message" --no-verify
```
If you want to skip certain checks for whatever reason, you can set the SKIP
environment variable:
```bash
SKIP=no-commit-to-branch git commit -a -m "My message"
or
export SKIP=no-commit-to-branch # In your .bashrc or session.
```
There is much more you can do with pre-commit, check out its
[documentation](https://pre-commit.com).
Now your commit is less likely to fail in the Continuous Intagration (CI) run
on github.\
CI also runs pre-commit to help maintain code quality.

View file

@ -11,10 +11,22 @@
# ```shell
# echo > dev/tools/codespell/codespell-lines-ignore.txt
# ```
# and then execute this script
# and then execute this script.
#
# author: https://github.com/mdeweerd
#
# :warning:
#
# This script only works properly if codespell is install for your CLI.
# As the configuration is in pyproject.toml, you also need tomli.
#
# ```shell
# python -m pip install codespell tomli
# # or
# pip install codespell tomli
# ```
codespell_ignore_file=dev/tools/codespell/codespell-lines-ignore.txt
if [ -z "${0##*.sh}" ] ; then
# Suppose running from inside script

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -226,7 +226,9 @@ if (empty($reshook)) {
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans("ListAccounts"));
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $langs->trans("ListAccounts"), $help_url);
if ($action == 'delete') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$id, $langs->trans('DeleteAccount'), $langs->trans('ConfirmDeleteAccount'), 'confirm_delete', '', 0, 1);

View file

@ -8,7 +8,7 @@
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2011-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
@ -401,7 +401,9 @@ if ($action == 'disable_favorite') {
$form = new Form($db);
$formadmin = new FormAdmin($db);
llxHeader();
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $langs->trans("Pcg_version"), $help_url);
$titre = $langs->trans($tablib[$id]);
$linkback = '';

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@ -215,7 +215,7 @@ $accountsystem->fetch(getDolGlobalInt('CHARTOFACCOUNTS'));
$title = $langs->trans('AccountAccounting')." - ".$langs->trans('Card');
$help_url = 'EN:Category:Accounting';
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -113,7 +113,10 @@ if ($action == 'delete') {
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader('', $langs->trans('AccountingCategory'));
$title= $langs->trans('AccountingCategory');
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$titlepicto = 'setup';

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2024 Alexandre Spangaro <aspangaro@easya.solutions>
*
* 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
@ -414,7 +414,9 @@ if ($action == 'disable_favorite') {
$form = new Form($db);
$formadmin = new FormAdmin($db);
llxHeader('', $langs->trans('DictionaryAccountancyCategory'));
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $langs->trans('DictionaryAccountancyCategory'), $help_url);
$titre = $langs->trans($tablib[$id]);
$linkback = '';

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2019-2024 Alexandre Spangaro <aspangaro@easya.solutions>
*
* 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
@ -101,7 +101,11 @@ if ($action == 'update') {
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader();
$title = $langs->trans('Closure');
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);
$linkback = '';
print load_fiche_titre($langs->trans('MenuClosureAccounts'), $linkback, 'title_accountancy');

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -198,7 +198,9 @@ if ($action == 'setACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT') {
$form = new Form($db);
$formaccounting = new FormAccounting($db);
llxHeader();
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $langs->trans('MenuDefaultAccounts'), $help_url);
$linkback = '';
print load_fiche_titre($langs->trans('MenuDefaultAccounts'), $linkback, 'title_accountancy');

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -134,9 +134,9 @@ if ($action == 'update') {
$form = new Form($db);
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
$title = $langs->trans('ExportOptions');
llxHeader('', $title);
llxHeader('', $title, $help_url);
$linkback = '';
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
/* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
*
* 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
@ -87,7 +87,7 @@ $fiscalyearstatic = new Fiscalyear($db);
$title = $langs->trans('AccountingPeriods');
$help_url = "EN:Module_Double_Entry_Accounting";
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
/* Copyright (C) 2014-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@netlogic.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
@ -109,7 +109,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
$object->date_start = $date_start;
$object->date_end = $date_end;
$object->label = GETPOST('label', 'alpha');
$object->status = GETPOST('status', 'int');
$object->status = GETPOSTINT('status');
$object->datec = dol_now();
if (empty($object->date_start) && empty($object->date_end)) {
@ -152,7 +152,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") {
$object->date_start = GETPOST("fiscalyear") ? $date_start : '';
$object->date_end = GETPOST("fiscalyearend") ? $date_end : '';
$object->label = GETPOST('label', 'alpha');
$object->status = GETPOST('status', 'int');
$object->status = GETPOSTINT('status');
$result = $object->update($user);
@ -181,7 +181,7 @@ if ($action == 'create') {
$title = $langs->trans("NewFiscalYear");
}
$help_url = "EN:Module_Double_Entry_Accounting";
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2014-2024 Alexandre Spangaro <aspangaro@easya.solutions>
*
* 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
@ -45,7 +45,7 @@ $id = GETPOST('id', 'int');
$title = $langs->trans("Fiscalyear")." - ".$langs->trans("Info");
$help_url = "EN:Module_Double_Entry_Accounting";
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);

View file

@ -1,13 +1,13 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@destailleur.fr>
* Copyright (C) 2021 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -275,8 +275,8 @@ if ($action == 'setenablevatreversecharge') {
$form = new Form($db);
$title = $langs->trans('ConfigAccountingExpert');
llxHeader('', $title);
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);
$linkback = '';

View file

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2017-2024 Alexandre Spangaro <aspangaro@easya.solutions>
*
* 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
@ -351,7 +351,9 @@ if ($action == $acts[1]) {
$form = new Form($db);
$formadmin = new FormAdmin($db);
llxHeader();
$title = $langs->trans('AccountingJournals');
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $title, $help_url);
$titre = $langs->trans("DictionarySetup");
$linkback = '';
@ -367,7 +369,6 @@ print load_fiche_titre($titre, $linkback, $titlepicto);
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
//var_dump($elementList);
/*
* Show a dictionary

View file

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.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
@ -296,14 +296,14 @@ $aacompta_prodsell_export = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT
$title = $langs->trans("ProductsBinding");
$helpurl = '';
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
$paramsCat = '';
foreach ($searchCategoryProductList as $searchCategoryProduct) {
$paramsCat .= "&search_category_product_list[]=".urlencode($searchCategoryProduct);
}
llxHeader('', $title, $helpurl, '', 0, 0, array(), array(), $paramsCat, '');
llxHeader('', $title, $help_url, '', 0, 0, array(), array(), $paramsCat, '');
$pcgverid = getDolGlobalString('CHARTOFACCOUNTS');
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -126,7 +126,7 @@ $form = new Form($db);
// Page Header
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title, $help_url);

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -248,7 +248,9 @@ if ($type == 'sub') {
$title_page = $langs->trans("AccountBalance");
}
llxHeader('', $title_page);
$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double';
llxHeader('', $title_page, $help_url);
if ($action != 'export_csv') {

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
*
@ -334,8 +334,8 @@ $form = new Form($db);
$formaccounting = new FormAccounting($db);
$title = $langs->trans("CreateMvts");
llxHeader('', $title);
$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double';
llxHeader('', $title, $help_url);
// Confirmation to delete the command
if ($action == 'delete') {
@ -663,7 +663,7 @@ if ($action == 'create') {
if (!empty($object->linesmvt[0])) {
$tmpline = $object->linesmvt[0];
if (!empty($tmpline->numero_compte)) {
$line = new BookKeepingLine();
$line = new BookKeepingLine($db);
$object->linesmvt[] = $line;
}
}

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
@ -708,8 +708,9 @@ $arrayofselected = is_array($toselect) ? $toselect : array();
// Output page
// --------------------------------------------------------------------
$help_url ='EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilit&eacute;_en_Partie_Double#Exports';
llxHeader('', $title_page);
llxHeader('', $title_page, $help_url);
$formconfirm = '';
@ -1086,7 +1087,7 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print "</tr>\n";
$line = new BookKeepingLine();
$line = new BookKeepingLine($db);
// Loop on record
// --------------------------------------------------------------------

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
@ -711,8 +711,8 @@ $arrayofselected = is_array($toselect) ? $toselect : array();
// Output page
// --------------------------------------------------------------------
llxHeader('', $title_page);
$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double';
llxHeader('', $title_page, $help_url);
$formconfirm = '';
@ -1037,7 +1037,7 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print "</tr>\n";
$line = new BookKeepingLine();
$line = new BookKeepingLine($db);
// Loop on record
// --------------------------------------------------------------------

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -559,8 +559,8 @@ if ($type == 'sub') {
$title_page .= $langs->trans("Bookkeeping");
}
$title_page .= ')';
llxHeader('', $title_page);
$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double';
llxHeader('', $title_page, $help_url);
// List
$nbtotalofrecords = '';

View file

@ -26,6 +26,7 @@
// Class
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
@ -986,7 +987,7 @@ class BookKeeping extends CommonObject
$i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$line = new BookKeepingLine($this->db);
$line->id = $obj->rowid;
@ -1140,7 +1141,7 @@ class BookKeeping extends CommonObject
$i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$line = new BookKeepingLine($this->db);
$line->id = $obj->rowid;
@ -1275,7 +1276,7 @@ class BookKeeping extends CommonObject
$i = 0;
while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine();
$line = new BookKeepingLine($this->db);
$line->numero_compte = $obj->numero_compte;
//$line->label_compte = $obj->label_compte;
@ -1881,7 +1882,7 @@ class BookKeeping extends CommonObject
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result)) {
$line = new BookKeepingLine();
$line = new BookKeepingLine($this->db);
$line->id = $obj->rowid;
@ -1951,7 +1952,7 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object($resql)) {
$line = new BookKeepingLine();
$line = new BookKeepingLine($this->db);
$line->id = $obj->rowid;
@ -2976,7 +2977,7 @@ class BookKeeping extends CommonObject
/**
* Class BookKeepingLine
*/
class BookKeepingLine
class BookKeepingLine extends CommonObjectLine
{
/**
* @var int ID

View file

@ -161,7 +161,7 @@ $formaccounting = new FormAccounting($db);
$title = $langs->trans('Closure');
$help_url ='EN:Module_Double_Entry_Accounting';
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Cl.C3.B4ture_annuelle';
llxHeader('', $title, $help_url);

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
*
* 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
@ -84,8 +84,9 @@ if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
/*
* View
*/
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader("", $langs->trans('FicheVentilation'));
llxHeader("", $langs->trans('FicheVentilation'), $help_url);
if ($cancel == $langs->trans("Cancel")) {
$action = '';

View file

@ -299,8 +299,9 @@ if ($action == 'validatehistory') {
/*
* View
*/
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("CustomersVentilation"));
llxHeader('', $langs->trans("CustomersVentilation"), $help_url);
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';

View file

@ -175,7 +175,9 @@ if (GETPOST('sortfield') == 'f.datef, f.ref, fd.rowid') {
$form = new Form($db);
$formother = new FormOther($db);
llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("CustomersVentilation").' - '.$langs->trans("Dispatched"), $help_url);
print '<script type="text/javascript">
$(function () {

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -230,7 +230,9 @@ if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$form = new Form($db);
$formother = new FormOther($db);
llxHeader('', $langs->trans("Ventilation"));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("CustomersVentilation"), $help_url);
if (empty($chartaccountcode)) {
print $langs->trans("ErrorChartOfAccountSystemNotSelected");

View file

@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -88,7 +88,9 @@ if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
/*
* View
*/
llxHeader("", $langs->trans('FicheVentilation'));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader("", $langs->trans('FicheVentilation'), $help_url);
if ($cancel == $langs->trans("Cancel")) {
$action = '';

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -177,8 +177,9 @@ if ($action == 'validatehistory') {
/*
* View
*/
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
llxHeader('', $langs->trans("ExpenseReportsVentilation"), $help_url);
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -165,7 +165,9 @@ if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
$form = new Form($db);
$formother = new FormOther($db);
llxHeader('', $langs->trans("ExpenseReportsVentilation").' - '.$langs->trans("Dispatched"));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("ExpenseReportsVentilation").' - '.$langs->trans("Dispatched"), $help_url);
print '<script type="text/javascript">
$(function () {

View file

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
@ -221,7 +221,9 @@ if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
$form = new Form($db);
$formother = new FormOther($db);
llxHeader('', $langs->trans("ExpenseReportsVentilation"));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("ExpenseReportsVentilation"), $help_url);
if (empty($chartaccountcode)) {
print $langs->trans("ErrorChartOfAccountSystemNotSelected");

View file

@ -73,7 +73,7 @@ if (GETPOST('addbox')) {
* View
*/
$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
llxHeader('', $langs->trans("AccountancyArea"), $help_url);

View file

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -88,7 +88,9 @@ if ($action == 'ventil' && $user->hasRight('accounting', 'bind', 'write')) {
/*
* View
*/
llxHeader("", $langs->trans('FicheVentilation'));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader("", $langs->trans('FicheVentilation'), $help_url);
if ($cancel == $langs->trans("Cancel")) {
$action = '';

View file

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -297,8 +297,9 @@ if ($action == 'validatehistory') {
/*
* View
*/
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("SuppliersVentilation"));
llxHeader('', $langs->trans("SuppliersVentilation"), $help_url);
$textprevyear = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current - 1).'">'.img_previous().'</a>';
$textnextyear = '&nbsp;<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_current + 1).'">'.img_next().'</a>';

View file

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -180,7 +180,9 @@ if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$form = new Form($db);
$formother = new FormOther($db);
llxHeader('', $langs->trans("SuppliersVentilation").' - '.$langs->trans("Dispatched"));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("SuppliersVentilation").' - '.$langs->trans("Dispatched"), $help_url);
print '<script type="text/javascript">
$(function () {

View file

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2021 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
*
@ -232,7 +232,9 @@ if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$form = new Form($db);
$formother = new FormOther($db);
llxHeader('', $langs->trans("SuppliersVentilation"));
$help_url ='EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double#Liaisons_comptables';
llxHeader('', $langs->trans("SuppliersVentilation"), $help_url);
if (empty($chartaccountcode)) {
print $langs->trans("ErrorChartOfAccountSystemNotSelected");

View file

@ -307,8 +307,8 @@ if (empty($reshook)) {
$object->address = trim(GETPOST("address", 'alphanohtml'));
$object->zip = trim(GETPOST("zipcode", 'alphanohtml'));
$object->town = trim(GETPOST("town", 'alphanohtml'));
$object->state_id = GETPOST("state_id", 'int');
$object->country_id = GETPOST("country_id", 'int');
$object->state_id = GETPOSTINT("state_id");
$object->country_id = GETPOSTINT("country_id");
$object->phone = trim(GETPOST("phone", 'alpha'));
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
@ -323,7 +323,7 @@ if (empty($reshook)) {
}
$object->birth = $birthdate;
$object->default_lang = GETPOST('default_lang', 'alpha');
$object->typeid = GETPOST("typeid", 'int');
$object->typeid = GETPOSTINT("typeid");
//$object->note = trim(GETPOST("comment", "restricthtml"));
$object->morphy = GETPOST("morphy", 'alpha');
@ -334,9 +334,9 @@ if (empty($reshook)) {
}
// Get status and public property
$object->statut = GETPOST("statut", 'alpha');
$object->status = GETPOST("statut", 'alpha');
$object->public = GETPOST("public", 'alpha');
$object->statut = GETPOSTINT("statut");
$object->status = GETPOSTINT("statut");
$object->public = GETPOSTINT("public");
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
@ -1118,7 +1118,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Birth Date
print "<tr><td>".$langs->trans("DateOfBirth")."</td><td>\n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print img_picto('', 'object_calendar', 'class="pictofixedwidth"').$form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print "</td></tr>\n";
// Public profil
@ -1364,13 +1364,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Birth Date
print "<tr><td>".$langs->trans("DateOfBirth")."</td><td>\n";
print $form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print img_picto('', 'object_calendar', 'class="pictofixedwidth"').$form->selectDate(($object->birth ? $object->birth : -1), 'birth', '', '', 1, 'formsoc');
print "</td></tr>\n";
// Default language
if (getDolGlobalInt('MAIN_MULTILANGS')) {
print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).'</td><td colspan="3">'."\n";
print img_picto('', 'language').$formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1);
print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1);
print '</td>';
print '</tr>';
}

View file

@ -7,7 +7,7 @@
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2024 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
@ -1121,7 +1121,7 @@ class Adherent extends CommonObject
* @param int $isencrypted 0 ou 1 if the password needs to be encrypted in the DB (default: 0)
* @param int $notrigger 1=Does not raise the triggers
* @param int $nosyncuser Do not synchronize linked user
* @return string If OK return clear password, 0 if no change, < 0 if error
* @return string|int Clear password if change ok, 0 if no change, <0 if error
*/
public function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0)
{
@ -2461,15 +2461,13 @@ class Adherent extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators this->nb in state board
*
* @return int Return integer <0 if KO, >0 if OK
*/
public function load_state_board()
public function loadStateBoard()
{
// phpcs:enable
global $conf;
$this->nb = array();

View file

@ -218,8 +218,6 @@ class Members extends DolibarrApi
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $category = 0, $sqlfilters = '', $properties = '')
{
global $db, $conf;
$obj_ret = array();
if (!DolibarrApiAccess::$user->hasRight('adherent', 'lire')) {

View file

@ -80,6 +80,10 @@ $socid = GETPOST('socid', 'int');
$search_filter = GETPOST("search_filter", 'alpha');
$search_status = GETPOST("search_status", 'intcomma'); // statut
$search_datec_start = dol_mktime(0, 0, 0, GETPOST('search_datec_start_month', 'int'), GETPOST('search_datec_start_day', 'int'), GETPOST('search_datec_start_year', 'int'));
$search_datec_end = dol_mktime(23, 59, 59, GETPOST('search_datec_end_month', 'int'), GETPOST('search_datec_end_day', 'int'), GETPOST('search_datec_end_year', 'int'));
$search_datem_start = dol_mktime(0, 0, 0, GETPOST('search_datem_start_month', 'int'), GETPOST('search_datem_start_day', 'int'), GETPOST('search_datem_start_year', 'int'));
$search_datem_end = dol_mktime(23, 59, 59, GETPOST('search_datem_end_month', 'int'), GETPOST('search_datem_end_day', 'int'), GETPOST('search_datem_end_year', 'int'));
$filter = GETPOST("filter", 'alpha');
if ($filter) {
@ -258,6 +262,10 @@ if (empty($reshook)) {
$catid = "";
$search_all = "";
$toselect = array();
$search_datec_start = '';
$search_datec_end = '';
$search_datem_start = '';
$search_datem_end = '';
$search_array_options = array();
}
@ -513,6 +521,18 @@ if ($search_country) {
if ($search_import_key) {
$sql .= natural_search("d.import_key", $search_import_key);
}
if ($search_datec_start) {
$sql .= " AND d.datec >= '".$db->idate($search_datec_start)."'";
}
if ($search_datec_end) {
$sql .= " AND d.datec <= '".$db->idate($search_datec_end)."'";
}
if ($search_datem_start) {
$sql .= " AND d.tms >= '".$db->idate($search_datem_start)."'";
}
if ($search_datem_end) {
$sql .= " AND d.tms <= '".$db->idate($search_datem_end)."'";
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -659,6 +679,12 @@ if ($search_import_key != '') {
if ($search_type > 0) {
$param .= "&search_type=".urlencode($search_type);
}
if ($search_datec_start) {
$param .= '&search_datec_start_day='.dol_print_date($search_datec_start, '%d').'&search_datec_start_month='.dol_print_date($search_datec_start, '%m').'&search_datec_start_year='.dol_print_date($search_datec_start, '%Y');
}
if ($search_datem_end) {
$param .= '&search_datem_end_day='.dol_print_date($search_datem_end, '%d').'&search_datem_end_month='.dol_print_date($search_datem_end, '%m').'&search_datem_end_year='.dol_print_date($search_datem_end, '%Y');
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -914,6 +940,12 @@ print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['d.datec']['checked'])) {
print '<td class="liste_titre">';
print '<div class="nowrapfordate">';
print $form->selectDate($search_datec_start ? $search_datec_start : -1, 'search_datec_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrapfordate">';
print $form->selectDate($search_datec_end ? $search_datec_end : -1, 'search_datec_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}
@ -926,6 +958,12 @@ if (!empty($arrayfields['d.birth']['checked'])) {
// Date modification
if (!empty($arrayfields['d.tms']['checked'])) {
print '<td class="liste_titre">';
print '<div class="nowrapfordate">';
print $form->selectDate($search_datem_start ? $search_datem_start : -1, 'search_datem_start_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrapfordate">';
print $form->selectDate($search_datem_end ? $search_datem_end : -1, 'search_datem_end_', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}

View file

@ -93,12 +93,12 @@ if (empty($conf->use_javascript_ajax)) {
} else {
print '<td width="60" class="right">';
$arrval = array(
'0'=>$langs->trans("No"),
'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
$langs->trans("No"),
$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
);
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalInt('RESOURCE_USE_SEARCH_TO_SELECT'));
print '</td>';
print '<td class="right">';
print '<input type="submit" class="button small" name="RESOURCE_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';

14
htdocs/ai/README.md Normal file
View file

@ -0,0 +1,14 @@
# AI FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
## Features
Provides an api key for chatchpt for use it in other modules
### Main code
GPLv3 or (at your option) any later version. See file COPYING for more information.
### Documentation
All texts and readmes are licensed under GFDL.

239
htdocs/ai/admin/setup.php Normal file
View file

@ -0,0 +1,239 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2022 Alice Adminson <aadminson@example.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 ai/admin/setup.php
* \ingroup ai
* \brief Ai setup page.
*/
// Load Dolibarr environment
require '../../main.inc.php';
global $langs, $user;
// Libraries
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once '../lib/ai.lib.php';
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'myobject';
$error = 0;
$setupnotempty = 0;
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
$useFormSetup = 1;
if (!class_exists('FormSetup')) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
}
$formSetup = new FormSetup($db);
// Setup conf AI_PUBLIC_INTERFACE_TOPIC
$item = $formSetup->newItem('AI_KEY_API_CHATGPT');
$item->defaultFieldValue = '';
// Save API Key
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$apiKey = GETPOST('api_key', 'alpha');
// Validate and clean $apiKey here
dolibarr_set_const($db, 'MAIN_AI_CHATGPT_API_KEY', $apiKey, 'chaine', 0, '', $conf->entity);
}
// Retrieve existing API Key
$apiKey = dolibarr_get_const($db, 'MAIN_AI_CHATGPT_API_KEY');
$setupnotempty =+ count($formSetup->items);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
/*
* Actions
*/
// For retrocompatibility Dolibarr < 15.0
if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
$formSetup->saveConfFromPost();
}
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask') {
$maskconst = GETPOST('maskconst', 'aZ09');
$maskvalue = GETPOST('maskvalue', 'alpha');
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
$tmpobjectkey = GETPOST('object');
$tmpobject = new $tmpobjectkey($db);
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/ai/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
}
if ($filefound) {
require_once $file;
$module = new $classname($db);
if ($module->write_file($tmpobject, $langs) > 0) {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bookcal-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
return;
} else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
} else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
} elseif ($action == 'setmod') {
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey)."_ADDON";
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
}
} elseif ($action == 'set') {
// Activate a model
$ret = addDocumentModel($value, $type, $label, $scandir);
} elseif ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
}
} elseif ($action == 'setdoc') {
// Set or unset default model
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->$constforval = $value;
}
// We disable/enable the document template (into llx_document_model table)
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
} elseif ($action == 'unsetdoc') {
$tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) {
$constforval = 'Ai_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
dolibarr_del_const($db, $constforval, $conf->entity);
}
}
/*
* View
*/
$form = new Form($db);
$help_url = '';
$page_name = "AiSetup";
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = aiAdminPrepareHead();
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "fa-microchip");
// Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("AiSetupPage").'</span><br><br>';
if ($action == 'edit') {
print $formSetup->generateOutput(true);
print '<br>';
} elseif (!empty($formSetup->items)) {
print $formSetup->generateOutput();
print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
print '</div>';
} else {
print '<br>'.$langs->trans("NothingToSetup");
}
if (empty($setupnotempty)) {
print '<br>'.$langs->trans("NothingToSetup");
}
// Page end
print dol_get_fiche_end();
llxFooter();
$db->close();

View file

@ -0,0 +1,90 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.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
* 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/>.
* or see https://www.gnu.org/
*/
/**
* Class for AI
*/
class Ai
{
/**
* @var DoliDB $db Database object
*/
protected $db;
/**
* @var string $apiEndpoint
*/
private $apiEndpoint;
/**
* @var string $apiKey
*/
private $apiKey;
/**
* Constructor
*
* @param string $apiEndpoint Endpoint of api
* @param boolean $apiKey key of api
*/
public function __construct($apiEndpoint, $apiKey)
{
$this->apiEndpoint = $apiEndpoint;
$this->apiKey = $apiKey;
}
/**
* Generate response of instructions
* @param string $instructions instruction for generate content
* @return mixed $response
*/
public function generateContent($instructions)
{
try {
$ch = curl_init($this->apiEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['prompt' => $instructions]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $this->apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
if (curl_errno($ch)) {
throw new Exception('cURL error: ' . curl_error($ch));
}
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($statusCode != 200) {
throw new Exception('API request failed with status code ' . $statusCode);
}
return $response;
} catch (Exception $e) {
error_log($e->getMessage());
return null;
} finally {
curl_close($ch);
}
}
}

63
htdocs/ai/lib/ai.lib.php Normal file
View file

@ -0,0 +1,63 @@
<?php
/* Copyright (C) 2022 Alice Adminson <aadminson@example.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 ai/lib/ai.lib.php
* \ingroup ai
* \brief Library files with common functions for Ai
*/
/**
* Prepare admin pages header
*
* @return array
*/
function aiAdminPrepareHead()
{
global $langs, $conf;
$langs->load("agenda");
$h = 0;
$head = array();
$head[$h][0] = dol_buildpath("/ai/admin/setup.php", 1);
$head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings';
$h++;
/*
$head[$h][0] = dol_buildpath("/ai/admin/myobject_extrafields.php", 1);
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'myobject_extrafields';
$h++;
*/
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(
// 'entity:+tabname:Title:@ai:/ai/mypage.php?id=__ID__'
//); // to add new tab
//$this->tabs = array(
// 'entity:-tabname:Title:@ai:/ai/mypage.php?id=__ID__'
//); // to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'ai@ai');
complete_head_from_modules($conf, $langs, null, $head, $h, 'ai@ai', 'remove');
return $head;
}

View file

@ -0,0 +1,70 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.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
* 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/>.
* or see https://www.gnu.org/
*/
/**
* \file htdocs/ai/lib/generate_content.lib.php
* \brief Library of ai script
*/
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', '1'); // Disables token renewal
}
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
if (!defined('NOREQUIREHTML')) {
define('NOREQUIREHTML', '1');
}
if (!defined('NOREQUIREAJAX')) {
define('NOREQUIREAJAX', '1');
}
if (!defined('NOREQUIRESOC')) {
define('NOREQUIRESOC', '1');
}
require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/ai/class/ai.class.php';
//get data from AJAX
$rawData = file_get_contents('php://input');
$jsonData = json_decode($rawData, true);
if (is_null($jsonData)) {
dol_print_error('data with format JSON valide.');
}
$token = GETPOST('token');
if ($token !== currentToken()) { // Remplacez 'newToken' par le nom de votre variable de session contenant le token
dol_print_error('CSRF token validation failed.');
exit;
}
$chatGPT = new Ai('API_ENDPOINT', 'API_KEY');
$instructions = dol_string_nohtmltag($jsonData['instructions'], 1, 'UTF-8');
$generatedContent = $chatGPT->generateContent($instructions);
if ($generatedContent) {
print $generatedContent;
} else {
dol_print_error('error!!');
}

View file

@ -63,7 +63,9 @@ class Setup extends DolibarrApi
*
* @return array [List of ordering methods]
*
* @throws RestException 400
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 401 Access denied
* @throws RestException 503 Error retrieving list of ordering methods
*/
public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -81,7 +83,7 @@ class Setup extends DolibarrApi
$errormessage = '';
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
if ($errormessage) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
}
}
@ -106,7 +108,7 @@ class Setup extends DolibarrApi
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(400, $this->db->lasterror());
throw new RestException(503, $this->db->lasterror());
}
return $list;
@ -125,7 +127,9 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/ordering_origins
*
* @throws RestException 400
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 401 Access denied
* @throws RestException 503 Error retrieving list of ordering origins
*/
public function getOrderingOrigins($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -168,7 +172,7 @@ class Setup extends DolibarrApi
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(400, $this->db->lasterror());
throw new RestException(503, $this->db->lasterror());
}
return $list;
@ -188,7 +192,9 @@ class Setup extends DolibarrApi
*
* @return array [List of payment types]
*
* @throws RestException 400
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 401 Access denied
* @throws RestException 503 Error retrieving list of payment types
*/
public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -232,7 +238,7 @@ class Setup extends DolibarrApi
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(400, $this->db->lasterror());
throw new RestException(503, $this->db->lasterror());
}
return $list;
@ -253,7 +259,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/regions
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error retrieving list of regions
*/
public function getListOfRegions($sortfield = "code_region", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '')
{
@ -316,7 +323,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/regions/{id}
*
* @throws RestException
* @throws RestException 404 Region not found
* @throws RestException 503 Error retrieving region
*/
public function getRegionByID($id)
{
@ -331,7 +339,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/regions/byCode/{code}
*
* @throws RestException
* @throws RestException 404 Region not found
* @throws RestException 503 Error when retrieving region
*/
public function getRegionByCode($code)
{
@ -357,7 +366,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/states
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error retrieving list of states
*/
public function getListOfStates($sortfield = "code_departement", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '')
{
@ -422,7 +432,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/states/{id}
*
* @throws RestException
* @throws RestException 404 State not found
* @throws RestException 503 Error retrieving state
*/
public function getStateByID($id)
{
@ -437,7 +448,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/states/byCode/{code}
*
* @throws RestException
* @throws RestException 404 State not found
* @throws RestException 503 Error retrieving state
*/
public function getStateByCode($code)
{
@ -463,7 +475,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/countries
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error retrieving list of countries
*/
public function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '')
{
@ -527,7 +540,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/countries/{id}
*
* @throws RestException
* @throws RestException 404 Country not found
* @throws RestException 503 Error retrieving country
*/
public function getCountryByID($id, $lang = '')
{
@ -543,7 +557,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/countries/byCode/{code}
*
* @throws RestException
* @throws RestException 404 Country not found
* @throws RestException 503 Error retrieving country
*/
public function getCountryByCode($code, $lang = '')
{
@ -559,7 +574,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/countries/byISO/{iso}
*
* @throws RestException
* @throws RestException 404 Country not found
* @throws RestException 503 Error retrieving country
*/
public function getCountryByISO($iso, $lang = '')
{
@ -654,7 +670,9 @@ class Setup extends DolibarrApi
*
* @return array [List of availability]
*
* @throws RestException 400
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 401 Access denied
* @throws RestException 503 Error when retrieving list of availabilities
*/
public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -697,7 +715,7 @@ class Setup extends DolibarrApi
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(400, $this->db->lasterror());
throw new RestException(503, $this->db->lasterror());
}
return $list;
@ -766,7 +784,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/event_types
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of events types
*/
public function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '')
{
@ -832,7 +851,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/expensereport_types
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of expense report types
*/
public function getListOfExpenseReportsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
{
@ -897,7 +917,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/contact_types
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of contacts types
*/
public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $lang = '', $sqlfilters = '')
{
@ -965,7 +986,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/civilities
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of civilities
*/
public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $lang = '', $sqlfilters = '')
{
@ -1029,7 +1051,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/currencies
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of currencies
*/
public function getListOfCurrencies($multicurrency = 0, $sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -1098,7 +1121,8 @@ class Setup extends DolibarrApi
*
* @url GET extrafields
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of extra fields
*/
public function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '')
{
@ -1175,7 +1199,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/towns
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of towns
*/
public function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '')
{
@ -1240,7 +1265,8 @@ class Setup extends DolibarrApi
*
* @return array List of payment terms
*
* @throws RestException 400
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of payments terms
*/
public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -1284,7 +1310,7 @@ class Setup extends DolibarrApi
$list[] = $this->db->fetch_object($result);
}
} else {
throw new RestException(400, $this->db->lasterror());
throw new RestException(503, $this->db->lasterror());
}
return $list;
@ -1303,7 +1329,8 @@ class Setup extends DolibarrApi
*
* @return array List of shipping methods
*
* @throws RestException 400
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of shipping modes
*/
public function getShippingModes($limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
{
@ -1345,7 +1372,7 @@ class Setup extends DolibarrApi
$list[] = $method;
}
} else {
throw new RestException(400, $this->db->lasterror());
throw new RestException(503, $this->db->lasterror());
}
return $list;
@ -1364,7 +1391,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/units
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of measuring units
*/
public function getListOfMeasuringUnits($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -1423,7 +1451,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/legal_form
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of legal form
*/
public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $active = 1, $sqlfilters = '')
{
@ -1484,7 +1513,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/staff
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of staff
*/
public function getListOfStaff($sortfield = "id", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -1542,7 +1572,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/socialnetworks
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of social networks
*/
public function getListOfsocialNetworks($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{
@ -1608,7 +1639,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/ticket_categories
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of tickets categories
*/
public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
{
@ -1670,7 +1702,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/ticket_severities
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of tickets severities
*/
public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
{
@ -1732,7 +1765,8 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/ticket_types
*
* @throws RestException
* @throws RestException 400 Bad value for sqlfilters
* @throws RestException 503 Error when retrieving list of tickets types
*/
public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
{
@ -1795,7 +1829,7 @@ class Setup extends DolibarrApi
*
* @url GET dictionary/incoterms
*
* @throws RestException
* @throws RestException 503 Error when retrieving list of incoterms types
*/
public function getListOfIncoterms($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
{
@ -1905,7 +1939,7 @@ class Setup extends DolibarrApi
*
* @url GET /establishments
*
* @throws RestException
* @throws RestException 503 Error when retrieving list of establishments
*/
public function getEstablishments()
{
@ -1943,7 +1977,8 @@ class Setup extends DolibarrApi
*
* @url GET establishments/{id}
*
* @throws RestException
* @throws RestException 404 Establishment not found
* @throws RestException 503 Error when retrieving establishment
*/
public function getEtablishmentByID($id)
{
@ -1969,8 +2004,8 @@ class Setup extends DolibarrApi
*
* @url GET conf/{constantname}
*
* @throws RestException 400 Error Bad or unknown value for constantname
* @throws RestException 403 Forbidden
* @throws RestException 404 Error Bad or unknown value for constantname
*/
public function getConf($constantname)
{
@ -1982,7 +2017,7 @@ class Setup extends DolibarrApi
}
if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) {
throw new RestException(404, 'Error Bad or unknown value for constantname');
throw new RestException(400, 'Error Bad or unknown value for constantname');
}
if (isASecretKey($constantname)) {
throw new RestException(403, 'Forbidden. This parameter can not be read with APIs');
@ -2002,7 +2037,6 @@ class Setup extends DolibarrApi
* @throws RestException 403 Forbidden
* @throws RestException 404 Signature file not found
* @throws RestException 500 Technical error
* @throws RestException 503 Forbidden
*/
public function getCheckIntegrity($target)
{

View file

@ -411,19 +411,19 @@ Luracast\Restler\Defaults::$returnResponse = $usecompression;
// Call API (we suppose we found it).
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
$result = $api->r->handle();
$responsedata = $api->r->handle();
if (Luracast\Restler\Defaults::$returnResponse) {
// We try to compress the data received data
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress') && defined('BROTLI_TEXT')) {
header('Content-Encoding: br');
$result = brotli_compress($result, 11, constant('BROTLI_TEXT'));
$result = brotli_compress($responsedata, 11, constant('BROTLI_TEXT'));
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
header('Content-Encoding: bz');
$result = bzcompress($result, 9);
$result = bzcompress($responsedata, 9);
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
header('Content-Encoding: gzip');
$result = gzencode($result, 9);
$result = gzencode($responsedata, 9);
} else {
header('Content-Encoding: text/html');
print "No compression method found. Try to disable compression by adding API_DISABLE_COMPRESSION=1";
@ -434,4 +434,20 @@ if (Luracast\Restler\Defaults::$returnResponse) {
echo $result;
}
// Call API termination method
$apiMethodInfo = &$api->r->apiMethodInfo;
$terminateCall = '_terminate_' . $apiMethodInfo->methodName . '_' . $api->r->responseFormat->getExtension();
if (method_exists($apiMethodInfo->className, $terminateCall)) {
// Now flush output buffers so that response data is sent to the client even if we still have action to do in a termination method.
ob_end_flush();
// If you're using PHP-FPM, this function will allow you to send the response and then continue processing
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}
// Call a termination method. Warning: This method can do I/O, sync but must not make output.
call_user_func(array(Luracast\Restler\Scope::get($apiMethodInfo->className), $terminateCall), $responsedata);
}
//session_destroy();

View file

@ -61,7 +61,9 @@ class Boms extends DolibarrApi
* @return Object Object with cleaned properties
*
* @url GET {id}
* @throws RestException
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
*/
public function get($id)
{
@ -95,7 +97,9 @@ class Boms extends DolibarrApi
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
* @return array Array of order objects
*
* @throws RestException
* @throws RestException 400 Bad sqlfilters
* @throws RestException 401 Access denied
* @throws RestException 503 Error retrieving list of boms
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
{
@ -176,6 +180,9 @@ class Boms extends DolibarrApi
*
* @param array $request_data Request datas
* @return int ID of bom
*
* @throws RestException 401 Access denied
* @throws RestException 500 Error retrieving list of boms
*/
public function post($request_data = null)
{
@ -210,6 +217,10 @@ class Boms extends DolibarrApi
* @param array $request_data Datas
*
* @return int
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error updating bom
*/
public function put($id, $request_data = null)
{
@ -253,6 +264,10 @@ class Boms extends DolibarrApi
*
* @param int $id BOM ID
* @return array
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error deleting bom
*/
public function delete($id)
{
@ -288,6 +303,9 @@ class Boms extends DolibarrApi
* @url GET {id}/lines
*
* @return array
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
*/
public function getLines($id)
{
@ -320,6 +338,10 @@ class Boms extends DolibarrApi
* @url POST {id}/lines
*
* @return int
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error adding bom line
*/
public function postLine($id, $request_data = null)
{
@ -353,7 +375,7 @@ class Boms extends DolibarrApi
if ($updateRes > 0) {
return $updateRes;
} else {
throw new RestException(400, $this->bom->error);
throw new RestException(500, $this->bom->error);
}
}
@ -367,6 +389,9 @@ class Boms extends DolibarrApi
* @url PUT {id}/lines/{lineid}
*
* @return object|bool
*
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
*/
public function putLine($id, $lineid, $request_data = null)
{
@ -415,9 +440,9 @@ class Boms extends DolibarrApi
*
* @return int
*
* @throws RestException 401
* @throws RestException 404
* @throws RestException 500
* @throws RestException 401 Access denied
* @throws RestException 404 BOM not found
* @throws RestException 500 Error deleting bom line
*/
public function deleteLine($id, $lineid)
{
@ -450,7 +475,7 @@ class Boms extends DolibarrApi
if ($updateRes > 0) {
return $this->get($id);
} else {
throw new RestException(405, $this->bom->error);
throw new RestException(500, $this->bom->error);
}
}

View file

@ -22,62 +22,14 @@
* \brief Tab of events on Calendar
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--;
$j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require '../main.inc.php';
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';
dol_include_once('/bookcal/class/calendar.class.php');
dol_include_once('/bookcal/lib/bookcal_calendar.lib.php');
require_once DOL_DOCUMENT_ROOT.'/bookcal/class/calendar.class.php';
require_once DOL_DOCUMENT_ROOT.'/bookcal/lib/bookcal_calendar.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("bookcal@bookcal", "other"));

View file

@ -220,6 +220,11 @@ class Categorie extends CommonObject
*/
public $color;
/**
* @var int Position
*/
public $position;
/**
* @var int Visible
*/
@ -352,7 +357,7 @@ class Categorie extends CommonObject
$type = $this->MAP_ID[$type];
}
$sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type, ref_ext";
$sql = "SELECT rowid, fk_parent, entity, label, description, color, position, fk_soc, visible, type, ref_ext";
$sql .= ", date_creation, tms, fk_user_creat, fk_user_modif";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie";
if ($id) {
@ -378,6 +383,7 @@ class Categorie extends CommonObject
$this->label = $res['label'];
$this->description = $res['description'];
$this->color = $res['color'];
$this->position = $res['position'];
$this->socid = (int) $res['fk_soc'];
$this->visible = (int) $res['visible'];
$this->type = (int) $res['type'];
@ -440,6 +446,7 @@ class Categorie extends CommonObject
$this->label = trim($this->label);
$this->description = trim($this->description);
$this->color = trim($this->color);
$this->position = trim($this->position);
$this->import_key = trim($this->import_key);
$this->ref_ext = trim($this->ref_ext);
if (empty($this->visible)) {
@ -461,6 +468,7 @@ class Categorie extends CommonObject
$sql .= " label,";
$sql .= " description,";
$sql .= " color,";
$sql .= " position,";
if (getDolGlobalString('CATEGORY_ASSIGNED_TO_A_CUSTOMER')) {
$sql .= "fk_soc,";
}
@ -476,6 +484,7 @@ class Categorie extends CommonObject
$sql .= "'".$this->db->escape($this->label)."', ";
$sql .= "'".$this->db->escape($this->description)."', ";
$sql .= "'".$this->db->escape($this->color)."', ";
$sql .= (int) $this->position.",";
if (getDolGlobalString('CATEGORY_ASSIGNED_TO_A_CUSTOMER')) {
$sql .= ($this->socid > 0 ? $this->socid : 'null').", ";
}
@ -566,6 +575,7 @@ class Categorie extends CommonObject
$sql .= " description = '".$this->db->escape($this->description)."',";
$sql .= " ref_ext = '".$this->db->escape($this->ref_ext)."',";
$sql .= " color = '".$this->db->escape($this->color)."'";
$sql .= ", position = ".(int) $this->position;
if (getDolGlobalString('CATEGORY_ASSIGNED_TO_A_CUSTOMER')) {
$sql .= ", fk_soc = ".($this->socid > 0 ? $this->socid : 'null');
}
@ -1028,6 +1038,7 @@ class Categorie extends CommonObject
$categories[$i]['label'] = $category_static->label;
$categories[$i]['description'] = $category_static->description;
$categories[$i]['color'] = $category_static->color;
$categories[$i]['position'] = $category_static->position;
$categories[$i]['socid'] = $category_static->socid;
$categories[$i]['ref_ext'] = $category_static->ref_ext;
$categories[$i]['visible'] = $category_static->visible;
@ -1163,7 +1174,7 @@ class Categorie extends CommonObject
$current_lang = $langs->getDefaultLang();
// Init $this->cats array
$sql = "SELECT DISTINCT c.rowid, c.label, c.ref_ext, c.description, c.color, c.fk_parent, c.visible"; // Distinct reduce pb with old tables with duplicates
$sql = "SELECT DISTINCT c.rowid, c.label, c.ref_ext, c.description, c.color, c.position, c.fk_parent, c.visible"; // Distinct reduce pb with old tables with duplicates
if (getDolGlobalInt('MAIN_MULTILANGS')) {
$sql .= ", t.label as label_trans, t.description as description_trans";
}
@ -1185,6 +1196,7 @@ class Categorie extends CommonObject
$this->cats[$obj->rowid]['label'] = !empty($obj->label_trans) ? $obj->label_trans : $obj->label;
$this->cats[$obj->rowid]['description'] = !empty($obj->description_trans) ? $obj->description_trans : $obj->description;
$this->cats[$obj->rowid]['color'] = $obj->color;
$this->cats[$obj->rowid]['position'] = $obj->position;
$this->cats[$obj->rowid]['visible'] = $obj->visible;
$this->cats[$obj->rowid]['ref_ext'] = $obj->ref_ext;
$this->cats[$obj->rowid]['picto'] = 'category';

View file

@ -45,6 +45,7 @@ $socid = (int) GETPOST('socid', 'int');
$label = (string) GETPOST('label', 'alphanohtml');
$description = (string) GETPOST('description', 'restricthtml');
$color = preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml'));
$position = (int) GETPOST('position', 'int');
$visible = (int) GETPOST('visible', 'int');
$parent = (int) GETPOST('parent', 'int');
@ -80,7 +81,7 @@ $error = 0;
/*
* Actions
*/
$parameters = array('id' => $id, 'ref' => $ref, 'cancel'=> $cancel, 'backtopage' => $backtopage, 'socid' => $socid, 'label' => $label, 'description' => $description, 'color' => $color, 'visible' => $visible, 'parent' => $parent);
$parameters = array('id' => $id, 'ref' => $ref, 'cancel'=> $cancel, 'backtopage' => $backtopage, 'socid' => $socid, 'label' => $label, 'description' => $description, 'color' => $color, 'position' => $position, 'visible' => $visible, 'parent' => $parent);
// Note that $action and $object may be modified by some hooks
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) {
@ -105,6 +106,7 @@ if (empty($reshook)) {
$object->label = $label;
$object->description = dol_htmlcleanlastbr($description);
$object->color = $color;
$object->position = $position;
$object->socid = ($socid > 0 ? $socid : 0);
$object->visible = $visible;
$object->fk_parent = $parent != -1 ? $parent : 0;
@ -186,6 +188,12 @@ print '<td>';
print $formother->selectColor($object->color, 'color');
print '</td></tr>';
// Position
print '<tr><td>';
print $langs->trans("Position").'</td>';
print '<td><input type="text" size="25" id="position" name ="position" value="'.$object->position.'" />';
print '</tr>';
// Parent category
print '<tr><td>'.$langs->trans("In").'</td><td>';
print img_picto('', 'category', 'class="pictofixedwidth"');

View file

@ -301,6 +301,12 @@ print $langs->trans("Color").'</td><td>';
print $formother->showColor($object->color);
print '</td></tr>';
// Position
print '<tr><td class="titlefield notopnoleft">';
print $langs->trans("Position").'</td><td>';
print $object->position;
print '</td></tr>';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';

View file

@ -349,41 +349,41 @@ if ($search_title != '') {
if ($search_note != '') {
$param .= '&search_note='.urlencode($search_note);
}
if (GETPOST('datestartday_dtstart', 'int')) {
$param .= '&datestartday_dtstart='.GETPOST('datestartday_dtstart', 'int');
if (GETPOST('datestart_dtstartday', 'int')) {
$param .= '&datestart_dtstartday='.GETPOST('datestart_dtstartday', 'int');
}
if (GETPOST('datestartmonth_dtstart', 'int')) {
$param .= '&datestartmonth_dtstart='.GETPOST('datestartmonth_dtstart', 'int');
if (GETPOST('datestart_dtstartmonth', 'int')) {
$param .= '&datestart_dtstartmonth='.GETPOST('datestart_dtstartmonth', 'int');
}
if (GETPOST('datestartyear_dtstart', 'int')) {
$param .= '&datestartyear_dtstart='.GETPOST('datestartyear_dtstart', 'int');
if (GETPOST('datestart_dtstartyear', 'int')) {
$param .= '&datestart_dtstartyear='.GETPOST('datestart_dtstartyear', 'int');
}
if (GETPOST('datestartday_dtend', 'int')) {
$param .= '&datestartday_dtend='.GETPOST('datestartday_dtend', 'int');
if (GETPOST('datestart_dtendday', 'int')) {
$param .= '&datestart_dtendday='.GETPOST('datestart_dtendday', 'int');
}
if (GETPOST('datestartmonth_dtend', 'int')) {
$param .= '&datestartmonth_dtend='.GETPOST('datestartmonth_dtend', 'int');
if (GETPOST('datestart_dtendmonth', 'int')) {
$param .= '&datestart_dtendmonth='.GETPOST('datestart_dtendmonth', 'int');
}
if (GETPOST('datestartyear_dtend', 'int')) {
$param .= '&datestartyear_dtend='.GETPOST('datestartyear_dtend', 'int');
if (GETPOST('datestart_dtendyear', 'int')) {
$param .= '&datestart_dtendyear='.GETPOST('datestart_dtendyear', 'int');
}
if (GETPOST('dateendday_dtstart', 'int')) {
$param .= '&dateendday_dtstart='.GETPOST('dateendday_dtstart', 'int');
if (GETPOST('dateend_dtstartday', 'int')) {
$param .= '&dateend_dtstartday='.GETPOST('dateend_dtstartday', 'int');
}
if (GETPOST('dateendmonth_dtstart', 'int')) {
$param .= '&dateendmonth_dtstart='.GETPOST('dateendmonth_dtstart', 'int');
if (GETPOST('dateend_dtstartmonth', 'int')) {
$param .= '&dateend_dtstartmonth='.GETPOST('dateend_dtstartmonth', 'int');
}
if (GETPOST('dateendyear_dtstart', 'int')) {
$param .= '&dateendyear_dtstart='.GETPOST('dateendyear_dtstart', 'int');
if (GETPOST('dateend_dtstartyear', 'int')) {
$param .= '&dateend_dtstartyear='.GETPOST('dateend_dtstartyear', 'int');
}
if (GETPOST('dateendday_dtend', 'int')) {
$param .= '&dateendday_dtend='.GETPOST('dateendday_dtend', 'int');
if (GETPOST('dateend_dtendday', 'int')) {
$param .= '&dateend_dtendday='.GETPOST('dateend_dtendday', 'int');
}
if (GETPOST('dateendmonth_dtend', 'int')) {
$param .= '&dateendmonth_dtend='.GETPOST('dateendmonth_dtend', 'int');
if (GETPOST('dateend_dtendmonth', 'int')) {
$param .= '&dateend_dtendmonth='.GETPOST('dateend_dtendmonth', 'int');
}
if (GETPOST('dateendyear_dtend', 'int')) {
$param .= '&dateendyear_dtend='.GETPOST('dateendyear_dtend', 'int');
if (GETPOST('dateend_dtendyear', 'int')) {
$param .= '&dateend_dtendyear='.GETPOST('dateend_dtendyear', 'int');
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);

View file

@ -169,6 +169,12 @@ class FormAdvTargetEmailing extends Form
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX')) {
$sql_usr .= " AND u2.statut <> 0";
}
if (!empty($conf->global->USER_HIDE_NONEMPLOYEE_IN_COMBOBOX)) {
$sql_usr .= " AND u2.employee<>0 ";
}
if (!empty($conf->global->USER_HIDE_EXTERNAL_IN_COMBOBOX)) {
$sql_usr .= " AND u2.fk_soc IS NULL ";
}
$sql_usr .= " ORDER BY name ASC";
// print $sql_usr;exit;

View file

@ -3685,15 +3685,13 @@ class Propal extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the indicators this->nb for the state board
*
* @return int Return integer <0 if ko, >0 if ok
*/
public function load_state_board()
public function loadStateBoard()
{
// phpcs:enable
global $user;
$this->nb = array();

View file

@ -4062,15 +4062,13 @@ class Commande extends CommonOrder
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the indicators this->nb for the state board
*
* @return int Return integer <0 if KO, >0 if OK
*/
public function load_state_board()
public function loadStateBoard()
{
// phpcs:enable
global $user;
$this->nb = array();

View file

@ -1346,16 +1346,14 @@ class Account extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the indicators this->nb for the state board
*
* @param int $filteraccountid To get info for a particular account id
* @return int Return integer <0 if KO, >0 if OK
*/
public function load_state_board($filteraccountid = 0)
public function loadStateBoard($filteraccountid = 0)
{
// phpcs:enable
global $user;
if ($user->socid) {

View file

@ -57,8 +57,8 @@ $toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
// Security check
$id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int'));
$lineid = GETPOST('lineid', 'int');
$id = (GETPOSTINT('facid') ? GETPOSTINT('facid') : GETPOSTINT('id'));
$lineid = GETPOSTINT('lineid');
$ref = GETPOST('ref', 'alpha');
if ($user->socid) {
$socid = $user->socid;
@ -67,13 +67,13 @@ $objecttype = 'facture_rec';
if ($action == "create" || $action == "add") {
$objecttype = '';
}
$projectid = GETPOST('projectid', 'int');
$projectid = GETPOSTINT('projectid');
$year_date_when = GETPOST('year_date_when');
$month_date_when = GETPOST('month_date_when');
$selectedLines = GETPOST('toselect', 'array');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -181,16 +181,16 @@ if (empty($reshook)) {
$error++;
}
$frequency = GETPOST('frequency', 'int');
$reyear = GETPOST('reyear', 'int');
$remonth = GETPOST('remonth', 'int');
$reday = GETPOST('reday', 'int');
$rehour = GETPOST('rehour', 'int');
$remin = GETPOST('remin', 'int');
$nb_gen_max = GETPOST('nb_gen_max', 'int');
$frequency = GETPOSTINT('frequency');
$reyear = GETPOSTINT('reyear');
$remonth = GETPOSTINT('remonth');
$reday = GETPOSTINT('reday');
$rehour = GETPOSTINT('rehour');
$remin = GETPOSTINT('remin');
$nb_gen_max = GETPOSTINT('nb_gen_max');
//if (empty($nb_gen_max)) $nb_gen_max =0;
if (GETPOST('frequency', 'int')) {
if (GETPOSTINT('frequency')) {
if (empty($reyear) || empty($remonth) || empty($reday)) {
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
$action = "create";
@ -204,21 +204,21 @@ if (empty($reshook)) {
}
if (!$error) {
$object->subtype = GETPOST('subtype');
$object->subtype = GETPOSTINT('subtype');
$object->title = GETPOST('title', 'alphanohtml');
$object->note_private = GETPOST('note_private', 'restricthtml');
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->model_pdf = GETPOST('modelpdf', 'alphanohtml');
$object->usenewprice = GETPOST('usenewprice', 'alphanohtml');
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->cond_reglement_id = GETPOST('cond_reglement_id', 'int');
$object->mode_reglement_id = GETPOSTINT('mode_reglement_id');
$object->cond_reglement_id = GETPOSTINT('cond_reglement_id');
$object->frequency = $frequency;
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
$object->nb_gen_max = $nb_gen_max;
$object->auto_validate = GETPOST('auto_validate', 'int');
$object->generate_pdf = GETPOST('generate_pdf', 'int');
$object->auto_validate = GETPOSTINT('auto_validate');
$object->generate_pdf = GETPOSTINT('generate_pdf');
$object->fk_project = $projectid;
$date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
@ -230,9 +230,9 @@ if (empty($reshook)) {
}
// Get first contract linked to invoice used to generate template (facid is id of source invoice)
if (GETPOST('facid', 'int') > 0) {
if (GETPOSTINT('facid') > 0) {
$srcObject = new Facture($db);
$srcObject->fetch(GETPOST('facid', 'int'));
$srcObject->fetch(GETPOSTINT('facid'));
$srcObject->fetchObjectLinked();
@ -248,7 +248,7 @@ if (empty($reshook)) {
$db->begin();
$oldinvoice = new Facture($db);
$oldinvoice->fetch(GETPOST('facid', 'int'));
$oldinvoice->fetch(GETPOSTINT('facid'));
$onlylines = GETPOST('toselect', 'array');
@ -292,15 +292,15 @@ if (empty($reshook)) {
if ($action == 'setconditions' && $user->hasRight('facture', 'creer')) {
// Set condition
$object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("PaymentTerm"));
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'));
} elseif ($action == 'setmode' && $user->hasRight('facture', 'creer')) {
// Set mode
$object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("PaymentMode"));
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
$result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id'));
} elseif ($action == 'classin' && $user->hasRight('facture', 'creer')) {
// Set project
$object->context['actionmsg'] = $langs->trans("FieldXModified", $langs->transnoentitiesnoconv("Project"));
$object->setProject(GETPOST('projectid', 'int'));
$object->setProject(GETPOSTINT('projectid'));
} elseif ($action == 'setref' && $user->hasRight('facture', 'creer')) {
// Set bank account
$object->context['actionmsg'] = $langs->trans("FieldXModifiedFromYToZ", $langs->transnoentitiesnoconv("Title"), $object->title, $ref);

View file

@ -5152,15 +5152,13 @@ class Facture extends CommonInvoice
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @return int Return integer <0 if KO, >0 if OK
*/
public function load_state_board()
public function loadStateBoard()
{
// phpcs:enable
global $conf, $user;
$this->nb = array();
@ -5810,9 +5808,9 @@ class Facture extends CommonInvoice
$joinFileName = [];
$joinFileMime = [];
if ($arraymessage->joinfiles == 1 && !empty($tmpinvoice->last_main_doc)) {
$joinFile[] = DOL_DATA_ROOT.$tmpinvoice->last_main_doc;
$joinFile[] = DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc;
$joinFileName[] = basename($tmpinvoice->last_main_doc);
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.$tmpinvoice->last_main_doc);
$joinFileMime[] = dol_mimetype(DOL_DATA_ROOT.'/'.$tmpinvoice->last_main_doc);
}
// Mail Creation

View file

@ -524,16 +524,14 @@ class RemiseCheque extends CommonObject
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators this->nb for the state board
*
* @param string $type Type of payment mode deposit ('CHQ', 'TRA', ...)
* @return int Return integer <0 if ko, >0 if ok
*/
public function load_state_board($type = 'CHQ')
public function loadStateBoard($type = 'CHQ')
{
// phpcs:enable
global $user;
if ($user->socid) {

View file

@ -215,12 +215,12 @@ if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta1" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta1"> '.$langs->trans("CalcModeDebt");
$calcmode .= '<input type="radio" name="modecompta" id="modecompta1" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta1"> '.$langs->trans("CalcModePayment");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
$calcmode .= '<br><input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
$calcmode .= '<br><input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeDebt");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}

View file

@ -189,12 +189,12 @@ if (isModEnabled('accounting')) {
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta1" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta1"> '.$langs->trans("CalcModeDebt");
$calcmode .= '<input type="radio" name="modecompta" id="modecompta1" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta1"> '.$langs->trans("CalcModePayment");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
$calcmode .= '</label>';
$calcmode .= '<br><input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
$calcmode .= '<br><input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeDebt");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}

View file

@ -215,7 +215,7 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("AnnualByAccountInputOutputMode");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.(GETPOST("month") > 0 ? '&month='.GETPOST("month") : '').'&modecompta=CREANCES-DETTES">', '</a>').')';
if (isModEnabled('accounting')) {
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'&modecompta=BOOKKEEPING">', '</a>').')';

View file

@ -265,7 +265,7 @@ if ($modecompta == "CREANCES-DETTES") {
$builddate = dol_now();
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description .= $langs->trans("RulesCAIn");

View file

@ -250,7 +250,7 @@ if ($modecompta == "CREANCES-DETTES") {
$builddate = dol_now();
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description = $langs->trans("RulesCAIn");

View file

@ -205,7 +205,7 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description = $langs->trans("RulesCAIn");
$description .= $langs->trans("DepositsAreIncluded");

View file

@ -239,7 +239,7 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description = $langs->trans("RulesCAIn");
$description .= $langs->trans("DepositsAreIncluded");

View file

@ -188,7 +188,7 @@ if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEINGCOLLECTED")
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPINGCOLLECTED"'.($modecompta == 'BOOKKEEPINGCOLLECTED' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}*/
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModePayment");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}

View file

@ -180,7 +180,7 @@ if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED")
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPINGCOLLECTED"'.($modecompta == 'BOOKKEEPINGCOLLECTED' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}*/
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="RECETTES-DEPENSES"'.($modecompta == 'RECETTES-DEPENSES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModePayment");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}
@ -190,7 +190,7 @@ if ($modecompta == "RECETTES-DEPENSES" || $modecompta == "BOOKKEEPINGCOLLECTED")
$calcmode .= '<input type="radio" name="modecompta" id="modecompta3" value="BOOKKEEPING"'.($modecompta == 'BOOKKEEPING' ? ' checked="checked"' : '').'><label for="modecompta3"> '.$langs->trans("CalcModeBookkeeping").'</label>';
$calcmode .= '<br>';
}
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModeEngagement");
$calcmode .= '<input type="radio" name="modecompta" id="modecompta2" value="CREANCES-DETTES"'.($modecompta == 'CREANCES-DETTES' ? ' checked="checked"' : '').'><label for="modecompta2"> '.$langs->trans("CalcModePayment");
if (isModEnabled('accounting')) {
$calcmode .= ' <span class="opacitymedium hideonsmartphone">('.$langs->trans("CalcModeNoBookKeeping").')</span>';
}

View file

@ -234,7 +234,7 @@ if ($modecompta == "CREANCES-DETTES") {
$builddate = dol_now();
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByProductsAndServices");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description = $langs->trans("RulesPurchaseTurnoverIn");

View file

@ -212,7 +212,7 @@ if ($modecompta == "CREANCES-DETTES") {
//$exportlink=$langs->trans("NotYetAvailable");
} elseif ($modecompta == "RECETTES-DEPENSES") {
$name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties");
$calcmode = $langs->trans("CalcModeEngagement");
$calcmode = $langs->trans("CalcModePayment");
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$description = $langs->trans("RulesPurchaseTurnoverIn");
//$exportlink=$langs->trans("NotYetAvailable");

View file

@ -397,15 +397,13 @@ class Contact extends CommonObject
}*/
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load indicators into this->nb for board
*
* @return int Return integer <0 if KO, >0 if OK
*/
public function load_state_board()
public function loadStateBoard()
{
// phpcs:enable
global $user, $hookmanager;
$this->nb = array();

View file

@ -2374,15 +2374,13 @@ class Contrat extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load the indicators this->nb for state board
*
* @return int Return integer <0 si ko, >0 si ok
*/
public function load_state_board()
public function loadStateBoard()
{
// phpcs:enable
global $conf, $user;
$this->nb = array();

View file

@ -47,6 +47,8 @@ if ($action == 'update' && is_array($arrayofparameters) && !empty($user->admin))
} else {
$val_const = GETPOST($key, 'int');
}
} else if ($val['type'] == 'html') {
$val_const = GETPOST($key, 'restricthtml');
} else {
$val_const = GETPOST($key, 'alpha');
}

View file

@ -70,7 +70,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$roworder = GETPOST('roworder', 'alpha', 3);
$table_element_line = GETPOST('table_element_line', 'aZ09', 3);
$fk_element = GETPOST('fk_element', 'aZ09', 3);
$element_id = GETPOST('element_id', 'int', 3);
$element_id = GETPOSTINT('element_id', 3);
dol_syslog("AjaxRow roworder=".$roworder." table_element_line=".$table_element_line." fk_element=".$fk_element." element_id=".$element_id, LOG_DEBUG);

View file

@ -2,7 +2,7 @@
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015-2021 Frederic France <frederic.france@netlogic.fr>
* Copyright (C) 2015-2024 Frederic France <frederic.france@netlogic.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
@ -253,7 +253,13 @@ class box_dolibarr_state_board extends ModeleBoxes
include_once $includes[$val]; // Loading a class cost around 1Mb
$board = new $class($this->db);
$board->load_state_board();
if (method_exists($board, 'load_state_board')) {
$board->load_state_board();
} elseif (method_exists($board, 'loadStateBoard')) {
$board->loadStateBoard();
} else {
$board = -1;
}
$boardloaded[$class] = $board;
} else {
$board = $boardloaded[$classkeyforcache];

View file

@ -1182,7 +1182,7 @@ abstract class CommonInvoice extends CommonObject
$this->fetch_thirdparty();
dol_syslog("--- Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG);
dol_syslog("makeStripeSepaRequest Process payment request amount=".$amount." thirdparty_id=" . $this->thirdparty->id . ", thirdparty_name=" . $this->thirdparty->name . " ban id=" . $bac->id, LOG_DEBUG);
//$alreadypayed = $this->getSommePaiement();
//$amount_credit_notes_included = $this->getSumCreditNotesUsed();
@ -1201,7 +1201,7 @@ abstract class CommonInvoice extends CommonObject
if (!($fk_bank_account > 0)) {
$error++;
$errorforinvoice++;
dol_syslog("Error no bank account defined for Stripe payments", LOG_ERR);
dol_syslog("makeStripeSepaRequest Error no bank account defined for Stripe payments", LOG_ERR);
$this->errors[] = "Error bank account for Stripe payments not defined into Stripe module";
}
@ -1217,7 +1217,7 @@ abstract class CommonInvoice extends CommonObject
if ($nbinvoices <= 0) {
$error++;
$errorforinvoice++;
dol_syslog("Error on BonPrelevement creation", LOG_ERR);
dol_syslog("makeStripeSepaRequest Error on BonPrelevement creation", LOG_ERR);
$this->errors[] = "Error on BonPrelevement creation";
}
/*
@ -1237,7 +1237,7 @@ abstract class CommonInvoice extends CommonObject
} else {
$error++;
$errorforinvoice++;
dol_syslog("Error Line already part of a bank payment order", LOG_ERR);
dol_syslog("makeStripeSepaRequest Error Line already part of a bank payment order", LOG_ERR);
$this->errors[] = "The line is already included into a bank payment order. Delete the bank payment order first.";
}
}
@ -1253,7 +1253,7 @@ abstract class CommonInvoice extends CommonObject
}
//var_dump($companypaymentmode);
dol_syslog("We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG);
dol_syslog("makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG);
$thirdparty = new Societe($this->db);
$resultthirdparty = $thirdparty->fetch($this->socid);
@ -1614,7 +1614,7 @@ abstract class CommonInvoice extends CommonObject
}
} else {
$this->error = "Status of invoice does not allow this";
dol_syslog(get_class($this)."::makeStripeSepaRequest ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id");
dol_syslog(get_class($this)."::makeStripeSepaRequest ".$this->error." ".$this->status." ,".$this->paye.", ".$this->mode_reglement_id, LOG_WARNING);
return -3;
}
}

View file

@ -12,7 +12,7 @@
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2023 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2021 Grégory Blémand <gregory.blemand@atm-consulting.fr>
@ -587,28 +587,28 @@ abstract class CommonObject
// Dates
/**
* @var integer|string date_creation
* @var integer|string|null date_creation
*/
public $date_creation;
/**
* @var integer|string $date_validation;
* @var integer|string|null $date_validation;
*/
public $date_validation; // Date validation
/**
* @var integer|string $date_modification;
* @var integer|string|null $date_modification;
*/
public $date_modification; // Date last change (tms field)
/**
* @var integer|string $date_modification;
* @var integer|string|null $date_modification;
* @deprecated Use date_modification
*/
public $date_update;
/**
* @var integer|string $date_cloture;
* @var integer|string|null $date_cloture;
*/
public $date_cloture; // Date closing (tms field)
@ -8876,7 +8876,7 @@ abstract class CommonObject
/**
* Returns the rights used for this class
*
* @return stdClass Object of permission for the module
* @return int|stdClass Object of permission for the module
*/
public function getRights()
{

View file

@ -1120,9 +1120,10 @@ class ExtraFields
} else {
$checked = ' value="1" ';
}
$out = '<input type="checkbox" class="flat valignmiddle'.($morecss ? ' '.$morecss : '').' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';
$out = '<input type="hidden" name="'.$keyprefix.$key.$keysuffix.'_boolean" value="1">'; // A hidden field ending with "_boolean" that is always set to 1.
$out .= '<input type="checkbox" class="flat valignmiddle'.($morecss ? ' '.$morecss : '').' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam ? $moreparam : '').'>';
} else {
$out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
$out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1);
}
} elseif ($type == 'price') {
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
@ -2352,7 +2353,9 @@ class ExtraFields
$value_key = GETPOST($keysuffix."options_".$key.$keyprefix);
}
} elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) {
if (!GETPOST($keysuffix."options_".$key.$keyprefix)) {
// We test on a hidden field named "..._multiselect" that is always set to 1 if param is in form so
// when nothing is provided we can make a difference between noparam in the form and param was set to nothing.
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix.'_multiselect')) {
continue; // Value was not provided, we should not set it.
}
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
@ -2360,7 +2363,7 @@ class ExtraFields
$value_arr = (array) $value_arr;
$value_key = implode(',', $value_arr);
} elseif (in_array($key_type, array('price', 'double', 'int'))) {
if (!GETPOST($keysuffix."options_".$key.$keyprefix)) {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
continue; // Value was not provided, we should not set it.
}
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
@ -2370,14 +2373,16 @@ class ExtraFields
$value_key = $value_arr;
}
} elseif (in_array($key_type, array('boolean'))) {
if (!GETPOST($keysuffix."options_".$key.$keyprefix)) {
// We test on a hidden field named "..._boolean" that is always set to 1 if param is in form so
// when nothing is provided we can make a difference between noparam in the form and param was set to nothing.
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix."_boolean")) {
$value_key = '';
} else {
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key = $value_arr;
}
} elseif (in_array($key_type, array('html'))) {
if (!GETPOST($keysuffix."options_".$key.$keyprefix)) {
if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) {
continue; // Value was not provided, we should not set it.
}
$value_key = dol_htmlcleanlastbr(GETPOST($keysuffix."options_".$key.$keyprefix, 'restricthtml'));

View file

@ -2081,6 +2081,12 @@ class Form
if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX') || $notdisabled) {
$sql .= " AND u.statut <> 0";
}
if (!empty($conf->global->USER_HIDE_NONEMPLOYEE_IN_COMBOBOX) || $notdisabled) {
$sql .= " AND u.employee <> 0";
}
if (!empty($conf->global->USER_HIDE_EXTERNAL_IN_COMBOBOX) || $notdisabled) {
$sql .= " AND u.fk_soc IS NULL";
}
if (!empty($morefilter)) {
$sql .= " " . $morefilter;
}
@ -2425,7 +2431,7 @@ class Form
$events = array();
$out .= img_picto('', 'resource', 'class="pictofixedwidth"');
$out .= $formresources->select_resource_list('', $htmlname, '', 1, 1, 0, $events, '', 2, null);
$out .= $formresources->select_resource_list(0, $htmlname, '', 1, 1, 0, $events, '', 2, null);
//$out .= $this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
$out .= ' <input type="submit" disabled class="button valignmiddle smallpaddingimp reposition" id="' . $action . 'assignedtoresource" name="' . $action . 'assignedtoresource" value="' . dol_escape_htmltag($langs->trans("Add")) . '">';
$out .= '<br>';
@ -2439,29 +2445,29 @@ class Form
/**
* Return list of products for customer in Ajax if Ajax activated or go to select_produits_list
*
* @param int $selected Preselected products
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param int $status Sell status -1=Return all products, 0=Products not on sell, 1=Products on sell
* @param int $finished 2=all, 1=finished, 0=raw material
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
* @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used
* 'warehouseopen' = count products from open warehouses,
* 'warehouseclosed' = count products from closed warehouses,
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param int $nooutput No print, return the output into a string
* @param int $status_purchase Purchase status -1=Return all products, 0=Products not on purchase, 1=Products on purchase
* @return void|string
* @param int $selected Preselected products
* @param string $htmlname Name of HTML select field (must be unique in page).
* @param int|string $filtertype Filter on product type (''=nofilter, 0=product, 1=service)
* @param int $limit Limit on number of returned lines
* @param int $price_level Level of price to show
* @param int $status Sell status: -1=No filter on sell status, 0=Products not on sell, 1=Products on sell
* @param int $finished 2=all, 1=finished, 0=raw material
* @param string $selected_input_value Value of preselected input text (for use with ajax)
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
* @param array $ajaxoptions Options for ajax_autocompleter
* @param int $socid Thirdparty Id (to get also price dedicated to this customer)
* @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
* @param int $forcecombo Force to use combo box
* @param string $morecss Add more css on select
* @param int $hidepriceinlabel 1=Hide prices in label
* @param string $warehouseStatus Warehouse status filter to count the quantity in stock. Following comma separated filter options can be used
* 'warehouseopen' = count products from open warehouses,
* 'warehouseclosed' = count products from closed warehouses,
* 'warehouseinternal' = count products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @param string $nooutput No print, return the output into a string
* @param int $status_purchase Purchase status: -1=No filter on purchase status, 0=Products not on purchase, 1=Products on purchase
* @return void|string
*/
public function select_produits($selected = 0, $htmlname = 'productid', $filtertype = '', $limit = 0, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = null, $nooutput = 0, $status_purchase = -1)
{
@ -2858,12 +2864,10 @@ class Form
if ($finished == 0) {
$sql .= " AND p.finished = " . ((int) $finished);
} elseif ($finished == 1) {
$sql .= " AND p.finished = " . ((int) $finished);
if ($status >= 0) {
$sql .= " AND p.tosell = " . ((int) $status);
}
} elseif ($status >= 0) {
$sql .= " AND p.tosell = " . ((int) $status);
$sql .= " AND p.finished = ".((int) $finished);
}
if ($status >= 0) {
$sql .= " AND p.tosell = ".((int) $status);
}
if ($status_purchase >= 0) {
$sql .= " AND p.tobuy = " . ((int) $status_purchase);
@ -6522,14 +6526,31 @@ class Form
}
if (getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC')) { // If option to have vat for end customer for services is on
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
if (!isInEEC($societe_vendeuse) && (!is_object($societe_acheteuse) || (isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()))) {
// If SERVICE_ARE_ECOMMERCE_200238EC=1 combo list vat rate of purchaser and seller countries
// If SERVICE_ARE_ECOMMERCE_200238EC=2 combo list only the vat rate of the purchaser country
$selectVatComboMode = getDolGlobalString('SERVICE_ARE_ECOMMERCE_200238EC');
if (isInEEC($societe_vendeuse) && isInEEC($societe_acheteuse) && !$societe_acheteuse->isACompany()) {
// We also add the buyer country code
if (is_numeric($type)) {
if ($type == 1) { // We know product is a service
$code_country .= ",'" . $societe_acheteuse->country_code . "'";
switch ($selectVatComboMode) {
case '1':
$code_country .= ",'" . $societe_acheteuse->country_code . "'";
break;
case '2':
$code_country = "'" . $societe_acheteuse->country_code . "'";
break;
}
}
} elseif (!$idprod) { // We don't know type of product
$code_country .= ",'" . $societe_acheteuse->country_code . "'";
switch ($selectVatComboMode) {
case '1':
$code_country .= ",'" . $societe_acheteuse->country_code . "'";
break;
case '2':
$code_country = "'" . $societe_acheteuse->country_code . "'";
break;
}
} else {
$prodstatic = new Product($this->db);
$prodstatic->fetch($idprod);
@ -6542,6 +6563,7 @@ class Form
// Now we load the list of VAT
$this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error
// Keep only the VAT qualified for $type_vat
$arrayofvatrates = array();
foreach ($this->cache_vatrates as $cachevalue) {
@ -8508,10 +8530,6 @@ class Form
$out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss);
}
return $out;
}
@ -8774,10 +8792,16 @@ class Form
}
$useenhancedmultiselect = 0;
if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) {
$useenhancedmultiselect = 1;
if (!empty($conf->use_javascript_ajax) && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) {
if ($addjscombo) {
$useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0.
}
}
// We need a hidden field because when using the multiselect, if we unselect all, there is no
// variable submitted at all, so no way to make a difference between variable not submitted and variable
// submitted to nothing.
$out .= '<input type="hidden" name="'.$htmlname.'_multiselect" value="1">';
// Output select component
$out .= '<select id="' . $htmlname . '" class="multiselect' . ($useenhancedmultiselect ? ' multiselectononeline' : '') . ($morecss ? ' ' . $morecss : '') . '" multiple name="' . $htmlname . '[]"' . ($moreattrib ? ' ' . $moreattrib : '') . ($width ? ' style="width: ' . (preg_match('/%/', $width) ? $width : $width . 'px') . '"' : '') . '>' . "\n";
if (is_array($array) && !empty($array)) {
@ -9050,11 +9074,11 @@ class Form
/**
* Show linked object block.
*
* @param CommonObject $object Object we want to show links to
* @param string $morehtmlright More html to show on right of title
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
* @param string $title Title
* @return int Return integer <0 if KO, >=0 if OK
* @param CommonObject $object Object we want to show links to
* @param string $morehtmlright More html to show on right of title
* @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action
* @param string $title Title
* @return int Return integer <0 if KO, >=0 if OK
*/
public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = array(), $title = 'RelatedObjects')
{

View file

@ -755,7 +755,7 @@ class FormMail extends Form
if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
$out .= '<tr><td>';
$out .= $langs->trans("MailToCCUsers");
$out .= '</td><td>';
$out .= '</td>';
// multiselect array convert html entities into options tags, even if we don't want this, so we encode them a second time
$tmparray = $this->withtoccuser;
@ -887,6 +887,11 @@ class FormMail extends Form
$out .= "</td></tr>\n";
}
//input prompt AI
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (isModEnabled('ai')) {
$out .= $this->getHtmlForInstruction();
}
// Message
if (!empty($this->withbody)) {
$defaultmessage = GETPOST('message', 'restricthtml');
@ -1195,12 +1200,14 @@ class FormMail extends Form
/**
* get html For WithCCC
* This information is show when MAIN_EMAIL_USECCC is set.
*
* @return string html
*/
public function getHtmlForWithCcc()
{
global $conf, $langs, $form;
global $langs, $form;
$out = '<tr><td>';
$out .= $form->textwithpicto($langs->trans("MailCCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
$out .= '</td><td>';
@ -1256,9 +1263,15 @@ class FormMail extends Form
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO') && !empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') {
$showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO');
}
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') && !empty($this->param['models']) && $this->param['models'] == 'project') {
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') && !empty($this->param['models']) && $this->param['models'] == 'project') { // don't know why there is not '_send' at end of this models name.
$showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO');
}
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SHIPMENT_TO') && !empty($this->param['models']) && $this->param['models'] == 'shipping_send') {
$showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_SHIPMENT_TO');
}
if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_RECEPTION_TO') && !empty($this->param['models']) && $this->param['models'] == 'reception_send') {
$showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_RECEPTION_TO');
}
if ($showinfobcc) {
$out .= ' + '.$showinfobcc;
}
@ -1273,7 +1286,8 @@ class FormMail extends Form
*/
public function getHtmlForWithErrorsTo()
{
global $conf, $langs;
global $langs;
//if (! $this->errorstomail) $this->errorstomail=$this->frommail;
$errorstomail = getDolGlobalString('MAIN_MAIL_ERRORS_TO', (!empty($this->errorstomail) ? $this->errorstomail : ''));
if ($this->witherrorstoreadonly) {
@ -1296,7 +1310,8 @@ class FormMail extends Form
*/
public function getHtmlForDeliveryreceipt()
{
global $conf, $langs;
global $langs;
$out = '<tr><td><label for="deliveryreceipt">'.$langs->trans("DeliveryReceipt").'</label></td><td>';
if (!empty($this->withdeliveryreceiptreadonly)) {
@ -1334,7 +1349,7 @@ class FormMail extends Form
*/
public function getHtmlForTopic($arraydefaultmessage, $helpforsubstitution)
{
global $conf, $langs, $form;
global $langs, $form;
$defaulttopic = GETPOST('subject', 'restricthtml');
@ -1363,6 +1378,57 @@ class FormMail extends Form
return $out;
}
/**
* get Html For instruction of message
* @return string Text for instructions
*/
public function getHtmlForInstruction()
{
global $langs, $form;
$baseUrl = dol_buildpath('/', 1);
$out = '<tr>';
$out .= '<td>';
$out .= $form->textwithpicto($langs->trans('helpWithAi'), $langs->trans("YouCanMakeSomeInstructionForEmail"));
$out .= '</td>';
$out .= '<td>';
$out .= '<input type="hidden" id="csrf_token" name="token" value="'.newToken().'">';
$out .= '<input type="text" class="quatrevingtpercent" id="ai_instructions" name="instruction" placeholder="message with AI"/>';
$out .= '<button id="generate_button" type="button" class="button smallpaddingimp">'.$langs->trans('Generate').'</button>';
$out .= "</td></tr>\n";
$out .= "<script type='text/javascript'>
$(document).ready(function() {
$('#generate_button').click(function() {
var instructions = $('#ai_instructions').val();
var token = $('#csrf_token').val();
$.ajax({
url: '".$baseUrl."ai/lib/generate_content.lib.php',
method: 'POST',
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({
'token': token,
'instructions': instructions,
}),
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error('error ajax', status, error);
}
});
});
});
</script>
";
return $out;
}
/**
* Return templates of email with type = $type_template or type = 'all'.
* This search into table c_email_templates. Used by the get_form function.

View file

@ -522,6 +522,15 @@ class FormOther
if (!empty($user->socid)) {
$sql_usr .= " AND u.fk_soc = ".((int) $user->socid);
}
if (!empty($conf->global->USER_HIDE_NONEMPLOYEE_IN_COMBOBOX)) {
$sql_usr .= " AND u.employee <> 0";
}
if (!empty($conf->global->USER_HIDE_EXTERNAL_IN_COMBOBOX)) {
$sql_usr .= " AND u.fk_soc IS NULL";
}
if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) {
$sql_usr .= " AND u.statut <> 0";
}
//Add hook to filter on user (for example on usergroup define in custom modules)
if (!empty($reshook)) {

View file

@ -887,6 +887,11 @@ class FormSetupItem
$selected = (empty($this->fieldValue) ? '' : $this->fieldValue);
$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
}
} elseif ($this->type == 'selectBankAccount') {
if (isModEnabled("bank")) {
$selected = (empty($this->fieldValue) ? '' : $this->fieldValue);
$out.= $this->form->select_comptes($selected, $this->confKey, 0, '', 0, '', 0, '', 1);
}
} else {
$out.= $this->generateInputFieldText();
}
@ -1175,6 +1180,16 @@ class FormSetupItem
} elseif ($resprod < 0) {
$this->setErrors($product->errors);
}
} elseif ($this->type == 'selectBankAccount') {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$bankaccount = new Account($this->db);
$resbank = $bankaccount->fetch($this->fieldValue);
if ($resbank > 0) {
$out.= $bankaccount->label;
} elseif ($resbank < 0) {
$this->setErrors($bankaccount->errors);
}
} else {
$out.= $this->fieldValue;
}
@ -1427,4 +1442,15 @@ class FormSetupItem
$this->type = 'selectUser';
return $this;
}
/**
* Set type of input as a simple title. No data to store
*
* @return self
*/
public function setAsSelectBankAccount()
{
$this->type = 'selectBankAccount';
return $this;
}
}

View file

@ -937,7 +937,7 @@ class FormTicket
$arraycodenotparent[] = "";
$stringtoprint = '<span class="supportemailfield bold">'.$langs->trans("GroupOfTicket").'</span> ';
$stringtoprint .= '<select id ="'.$htmlname.'" class="minwidth500" child_id="0">';
$stringtoprint .= '<select id="'.$htmlname.'" class="minwidth500" child_id="0">';
$stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ";
@ -997,7 +997,7 @@ class FormTicket
$levelid = 1; // The first combobox
while ($levelid <= $use_multilevel) { // Loop to take the child of the combo
$tabscript = array();
$stringtoprint .= '<select id ="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">';
$stringtoprint .= '<select id="'.$htmlname.'_child_'.$levelid.'" class="maxwidth500 minwidth400 groupticketchild" child_id="'.$levelid.'">';
$stringtoprint .= '<option value="">&nbsp;</option>';
$sql = "SELECT ctc.rowid, ctc.code, ctc.label, ctc.fk_parent, ctc.public, ctcjoin.code as codefather";

View file

@ -3,6 +3,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2021 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2021 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.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
@ -44,12 +45,12 @@ class Ldap
public $errors = array();
/**
* Tableau des serveurs (IP addresses ou nom d'hotes)
* @var array Servers (IP addresses or hostnames)
*/
public $server = array();
/**
* Current connected server
* @var string Current connected server
*/
public $connectedServer;
@ -59,51 +60,62 @@ class Ldap
public $serverPort;
/**
* Base DN (e.g. "dc=foo,dc=com")
* @var string Base DN (e.g. "dc=foo,dc=com")
*/
public $dn;
/**
* type de serveur, actuellement OpenLdap et Active Directory
* @var string Server type: OpenLDAP or Active Directory
*/
public $serverType;
/**
* Version du protocole ldap
* @var string LDAP protocol version
*/
public $ldapProtocolVersion;
/**
* Server DN
* @var string Server DN
*/
public $domain;
/**
* @var string Server FQDN
*/
public $domainFQDN;
/**
* @var int bind
* @var bool LDAP bind
*/
public $bind;
/**
* User administrateur Ldap
* @var string LDAP administrator user
* Active Directory does not allow anonymous connections
*/
public $searchUser;
/**
* Administraot Password
* @var string LDAP administrator password
* Active Directory does not allow anonymous connections
*/
public $searchPassword;
/**
* Users DN
* @var string Users DN
*/
public $people;
/**
* Groups DN
* @var string Groups DN
*/
public $groups;
/**
* @var string|null Error code provided by the LDAP server
* @var int|null Error code provided by the LDAP server
*/
public $ldapErrorCode;
/**
* @var string|null Error text message
*/
@ -113,10 +125,12 @@ class Ldap
* @var string
*/
public $filter;
/**
* @var string
*/
public $filtergroup;
/**
* @var string
*/
@ -168,56 +182,91 @@ class Ldap
public $badpwdtime;
/**
* @var string ladpUserDN
* @var string LDAP user DN
*/
public $ldapUserDN;
//Fetch user
/**
* @var string Fetched username
*/
public $name;
/**
* @var string Fetched user first name
*/
public $firstname;
/**
* @var string Fetched user login
*/
public $login;
/**
* @var string Fetched user phone number
*/
public $phone;
/**
* @var string Fetched user fax number
*/
public $fax;
/**
* @var string Fetched user email
*/
public $mail;
/**
* @var string Fetched user mobile number
*/
public $mobile;
/**
* @var array UserAccountControl Flags
*/
public $uacf;
/**
* @var int Password last set time
*/
public $pwdlastset;
public $ldapcharset = 'UTF-8'; // LDAP should be UTF-8 encoded
/**
* @var string LDAP charset.
* LDAP should be UTF-8 encoded
*/
public $ldapcharset = 'UTF-8';
/**
* The internal LDAP connection handle
* @var bool|resource The internal LDAP connection handle
*/
public $connection;
/**
* Result of any connections etc.
* @var bool|resource Result of any connections or search.
*/
public $result;
/**
* No Ldap synchronization
* @var int No LDAP synchronization
*/
const SYNCHRO_NONE = 0;
/**
* Dolibarr to Ldap synchronization
* @var int Dolibarr to LDAP synchronization
*/
const SYNCHRO_DOLIBARR_TO_LDAP = 1;
/**
* Ldap to Dolibarr synchronization
* @var int LDAP to Dolibarr synchronization
*/
const SYNCHRO_LDAP_TO_DOLIBARR = 2;
/**
* Constructor
*/
public function __construct()
{
global $conf;
// Server
if (getDolGlobalString('LDAP_SERVER_HOST')) {
@ -260,17 +309,16 @@ class Ldap
* Use this->server, this->serverPort, this->ldapProtocolVersion, this->serverType, this->searchUser, this->searchPassword
* After return, this->connection and $this->bind are defined
*
* @return int Return integer <0 if KO, 1 if bind anonymous, 2 if bind auth
* @return int if KO: <0 || if bind anonymous: 1 || if bind auth: 2
*/
public function connect_bind()
{
// phpcs:enable
global $conf;
global $dolibarr_main_auth_ldap_debug;
$connected = 0;
$this->bind = 0;
$this->error = 0;
$this->bind = false;
$this->error = '';
$this->connectedServer = '';
$ldapdebug = ((empty($dolibarr_main_auth_ldap_debug) || $dolibarr_main_auth_ldap_debug == "false") ? false : true);
@ -290,7 +338,7 @@ class Ldap
if (!function_exists("ldap_connect")) {
$this->error = 'LDAPFunctionsNotAvailableOnPHP';
dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING);
$return = -1;
return -1;
}
if (empty($this->error)) {
@ -303,9 +351,9 @@ class Ldap
continue;
}
if ($this->serverPing($host, $this->serverPort) === true) {
if ($this->serverPing($host, $this->serverPort)) {
if ($ldapdebug) {
dol_syslog(get_class($this)."::connect_bind serverPing true, we try ldap_connect to ".$host);
dol_syslog(get_class($this)."::connect_bind serverPing true, we try ldap_connect to ".$host, LOG_DEBUG);
}
$this->connection = ldap_connect($host, $this->serverPort);
} else {
@ -313,10 +361,13 @@ class Ldap
// With host = ldaps://server, the serverPing to ssl://server sometimes fails, even if the ldap_connect succeed, so
// we test this case and continue in such a case even if serverPing fails.
if ($ldapdebug) {
dol_syslog(get_class($this)."::connect_bind serverPing false, we try ldap_connect to ".$host);
dol_syslog(get_class($this)."::connect_bind serverPing false, we try ldap_connect to ".$host, LOG_DEBUG);
}
$this->connection = ldap_connect($host, $this->serverPort);
} else {
if ($ldapdebug) {
dol_syslog(get_class($this)."::connect_bind serverPing false, no ldap_connect ".$host, LOG_DEBUG);
}
continue;
}
}
@ -344,8 +395,7 @@ class Ldap
// Execute the ldap_set_option here (after connect and before bind)
$this->setVersion();
ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true.
$this->setSizeLimit();
if ($this->serverType == "activedirectory") {
$result = $this->setReferrals();
@ -396,15 +446,13 @@ class Ldap
}
if ($connected) {
$return = $connected;
dol_syslog(get_class($this)."::connect_bind return=".$return, LOG_DEBUG);
dol_syslog(get_class($this)."::connect_bind ".$connected, LOG_DEBUG);
return $connected;
} else {
$this->error = 'Failed to connect to LDAP'.($this->error ? ': '.$this->error : '');
$return = -1;
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING);
return -1;
}
return $return;
}
/**
@ -481,50 +529,57 @@ class Ldap
/**
* Verification de la version du serveur ldap.
* Verify LDAP server version
*
* @return string version
* @return int version
*/
public function getVersion()
{
$version = 0;
$version = @ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
@ldap_get_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $version);
return $version;
}
/**
* Change ldap protocol version to use.
* Set LDAP protocol version.
* LDAP_OPT_PROTOCOL_VERSION is a constant equal to 3
*
* @return boolean version
* @return boolean if set LDAP option OK: true, if KO: false
*/
public function setVersion()
{
// LDAP_OPT_PROTOCOL_VERSION est une constante qui vaut 17
$ldapsetversion = ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
return $ldapsetversion;
return ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, $this->ldapProtocolVersion);
}
/**
* changement du referrals.
* Set LDAP size limit.
*
* @return boolean referrals
* @return boolean if set LDAP option OK: true, if KO: false
*/
public function setSizeLimit()
{
return ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0);
}
/**
* Set LDAP referrals.
* LDAP_OPT_REFERRALS is a constant equal to ?
*
* @return boolean if set LDAP option OK: true, if KO: false
*/
public function setReferrals()
{
// LDAP_OPT_REFERRALS est une constante qui vaut ?
$ldapreferrals = ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
return $ldapreferrals;
return ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 0);
}
/**
* Add a LDAP entry
* Ldap object connect and bind must have been done
* Add an LDAP entry
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @param User $user Object user that create
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function add($dn, $info, $user)
{
@ -566,13 +621,13 @@ class Ldap
}
/**
* Modify a LDAP entry
* Ldap object connect and bind must have been done
* Modify an LDAP entry
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @param User $user Object user that modify
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function modify($dn, $info, $user)
{
@ -622,15 +677,15 @@ class Ldap
}
/**
* Rename a LDAP entry
* Ldap object connect and bind must have been done
* Rename an LDAP entry
* LDAP object connect and bind must have been done
*
* @param string $dn Old DN entry key (uid=qqq,ou=xxx,dc=aaa,dc=bbb) (before update)
* @param string $newrdn New RDN entry key (uid=qqq)
* @param string $newparent New parent (ou=xxx,dc=aaa,dc=bbb)
* @param User $user Object user that modify
* @param bool $deleteoldrdn If true the old RDN value(s) is removed, else the old RDN value(s) is retained as non-distinguished values of the entry.
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
{
@ -665,8 +720,8 @@ class Ldap
}
/**
* Modify a LDAP entry (to use if dn != olddn)
* Ldap object connect and bind must have been done
* Modify an LDAP entry (to use if dn != olddn)
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
@ -674,7 +729,7 @@ class Ldap
* @param string $olddn Old DN entry key (before update)
* @param string $newrdn New RDN entry key (uid=qqq) (for ldap_rename)
* @param string $newparent New parent (ou=xxx,dc=aaa,dc=bbb) (for ldap_rename)
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function update($dn, $info, $user, $olddn, $newrdn = '', $newparent = '')
{
@ -720,11 +775,11 @@ class Ldap
/**
* Delete a LDAP entry
* Ldap object connect and bind must have been done
* Delete an LDAP entry
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function delete($dn)
{
@ -753,7 +808,7 @@ class Ldap
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Build a LDAP message
* Build an LDAP message
*
* @param string $dn DN entry key
* @param array $info Attributes array
@ -790,29 +845,32 @@ class Ldap
}
/**
* Dump a LDAP message to ldapinput.in file
* Dump an LDAP message to ldapinput.in file
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function dump($dn, $info)
{
global $conf;
$ldapDirTemp = $conf->ldap->dir_temp;
// Create content
$content = $this->dump_content($dn, $info);
//Create file
$result = dol_mkdir($conf->ldap->dir_temp);
$outputfile = $conf->ldap->dir_temp.'/ldapinput.in';
$fp = fopen($outputfile, "w");
if ($fp) {
fputs($fp, $content);
fclose($fp);
dolChmod($outputfile);
return 1;
//Create directory & file
$result = dol_mkdir($ldapDirTemp);
if ($result != 0) {
$outputfile = $ldapDirTemp.'/ldapinput.in';
$fp = fopen($outputfile, "w");
if ($fp) {
fputs($fp, $content);
fclose($fp);
dolChmod($outputfile);
return 1;
} else {
return -1;
}
} else {
return -1;
}
@ -821,10 +879,10 @@ class Ldap
/**
* Ping a server before ldap_connect for avoid waiting
*
* @param string $host Server host or address
* @param int $port Server port (default 389)
* @param int $timeout Timeout in second (default 1s)
* @return boolean true or false
* @param string $host Server host or address
* @param int $port Server port (default 389)
* @param int $timeout Timeout in second (default 1s)
* @return boolean true or false
*/
public function serverPing($host, $port = 389, $timeout = 1)
{
@ -865,13 +923,13 @@ class Ldap
// Attribute methods -----------------------------------------------------
/**
* Add a LDAP attribute in entry
* Ldap object connect and bind must have been done
* Add an LDAP attribute in entry
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @param User $user Object user that create
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function addAttribute($dn, $info, $user)
{
@ -911,13 +969,13 @@ class Ldap
}
/**
* Update a LDAP attribute in entry
* Ldap object connect and bind must have been done
* Update an LDAP attribute in entry
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @param User $user Object user that create
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function updateAttribute($dn, $info, $user)
{
@ -957,13 +1015,13 @@ class Ldap
}
/**
* Delete a LDAP attribute in entry
* Ldap object connect and bind must have been done
* Delete an LDAP attribute in entry
* LDAP object connect and bind must have been done
*
* @param string $dn DN entry key
* @param array $info Attributes array
* @param User $user Object user that create
* @return int Return integer <0 if KO, >0 if OK
* @return int if KO: <0 || if OK: >0
*/
public function deleteAttribute($dn, $info, $user)
{
@ -1007,7 +1065,7 @@ class Ldap
*
* @param string $dn DN entry key
* @param string $filter Filter
* @return int|array Return integer <0 or false if KO, array if OK
* @return int|array if KO: <=0 || if OK: array
*/
public function getAttribute($dn, $filter)
{
@ -1046,9 +1104,9 @@ class Ldap
/**
* Returns an array containing values for an attribute and for first record matching filterrecord
*
* @param string $filterrecord Record
* @param string $attribute Attributes
* @return array|boolean
* @param string $filterrecord Record
* @param string $attribute Attributes
* @return array|boolean
*/
public function getAttributeValues($filterrecord, $attribute)
{
@ -1082,16 +1140,16 @@ class Ldap
}
/**
* Returns an array containing a details or list of LDAP record(s).
* ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
* Returns an array containing a details or list of LDAP record(s).
* ldapsearch -LLLx -hlocalhost -Dcn=admin,dc=parinux,dc=org -w password -b "ou=adherents,ou=people,dc=parinux,dc=org" userPassword
*
* @param string $search Value of field to search, '*' for all. Not used if $activefilter is set.
* @param string $userDn DN (Ex: ou=adherents,ou=people,dc=parinux,dc=org)
* @param string $useridentifier Name of key field (Ex: uid).
* @param array $attributeArray Array of fields required. Note this array must also contains field $useridentifier (Ex: sn,userPassword)
* @param array $attributeArray Array of fields required. Note this array must also contain field $useridentifier (Ex: sn,userPassword)
* @param int $activefilter '1' or 'user'=use field this->filter as filter instead of parameter $search, 'group'=use field this->filtergroup as filter, 'member'=use field this->filtermember as filter
* @param array $attributeAsArray Array of fields wanted as an array not a string
* @return array|int Array of [id_record][ldap_field]=value
* @return array|int if KO: <0 || if OK: array of [id_record][ldap_field]=value
*/
public function getRecords($search, $userDn, $useridentifier, $attributeArray, $activefilter = 0, $attributeAsArray = array())
{
@ -1179,7 +1237,7 @@ class Ldap
}
/**
* Converts a little-endian hex-number to one, that 'hexdec' can convert
* Converts a little-endian hex-number to one, that 'hexdec' can convert
* Required by Active Directory
*
* @param string $hex Hex value
@ -1196,11 +1254,11 @@ class Ldap
/**
* Recupere le SID de l'utilisateur
* Gets LDAP user SID.
* Required by Active Directory
*
* @param string $ldapUser Login de l'utilisateur
* @return string Sid
* @param string $ldapUser User login
* @return int|string if SID OK: SID string, if KO: -1
*/
public function getObjectSid($ldapUser)
{
@ -1241,13 +1299,13 @@ class Ldap
return $SIDText;
} else {
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
return '?';
return -1;
}
}
/**
* Returns the textual SID
* Indispensable pour Active Directory
* Required by Active Directory
*
* @param string $binsid Binary SID
* @return string Textual SID
@ -1267,15 +1325,17 @@ class Ldap
/**
* Fonction de recherche avec filtre
* this->connection doit etre defini donc la methode bind ou bindauth doit avoir deja ete appelee
* Ne pas utiliser pour recherche d'une liste donnee de proprietes
* car conflict majuscule-minuscule. A n'utiliser que pour les pages
* 'Fiche LDAP' qui affiche champ lisibles par default.
* Search method with filter
* this->connection must be defined. The bind or bindauth methods must already have been called.
* Do not use for search of a given properties list because of upper-lower case conflict.
* Only use for pages.
* 'Fiche LDAP' shows readable fields by default.
* @see bind
* @see bindauth
*
* @param string $checkDn DN de recherche (Ex: ou=users,cn=my-domain,cn=com)
* @param string $filter Search filter (ex: (sn=nom_personne) )
* @return array|int Array with answers (key lowercased - value)
* @param string $checkDn Search DN (Ex: ou=users,cn=my-domain,cn=com)
* @param string $filter Search filter (ex: (sn=name_person) )
* @return array|int Array with answers (lowercase key - value)
*/
public function search($checkDn, $filter)
{
@ -1303,12 +1363,12 @@ class Ldap
/**
* Load all attribute of a LDAP user
* Load all attributes of an LDAP user
*
* @param User|string $user Not used.
* @param string $filter Filter for search. Must start with &.
* Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
* @return int >0 if OK, <0 if KO
* @param User|string $user Not used.
* @param string $filter Filter for search. Must start with &.
* Examples: &(objectClass=inetOrgPerson) &(objectClass=user)(objectCategory=person) &(isMemberOf=cn=Sales,ou=Groups,dc=opencsi,dc=com)
* @return int if KO: <0 || if OK: > 0
*/
public function fetch($user, $filter)
{
@ -1363,14 +1423,14 @@ class Ldap
$this->uacf = $this->parseUACF($this->convToOutputCharset($result[0]["useraccountcontrol"][0], $this->ldapcharset));
if (isset($result[0]["pwdlastset"][0])) { // If expiration on password exists
$this->pwdlastset = ($result[0]["pwdlastset"][0] != 0) ? $this->convert_time($this->convToOutputCharset($result[0]["pwdlastset"][0], $this->ldapcharset)) : 0;
$this->pwdlastset = ($result[0]["pwdlastset"][0] != 0) ? $this->convertTime($this->convToOutputCharset($result[0]["pwdlastset"][0], $this->ldapcharset)) : 0;
} else {
$this->pwdlastset = -1;
}
if (!$this->name && !$this->login) {
$this->pwdlastset = -1;
}
$this->badpwdtime = $this->convert_time($this->convToOutputCharset($result[0]["badpasswordtime"][0], $this->ldapcharset));
$this->badpwdtime = $this->convertTime($this->convToOutputCharset($result[0]["badpasswordtime"][0], $this->ldapcharset));
// FQDN domain
$domain = str_replace('dc=', '', $this->domain);
@ -1390,7 +1450,7 @@ class Ldap
// helper methods
/**
* Returns the correct user identifier to use, based on the ldap server type
* Returns the correct user identifier to use, based on the LDAP server type
*
* @return string Login
*/
@ -1404,7 +1464,7 @@ class Ldap
}
/**
* UserAccountControl Flgs to more human understandable form...
* UserAccountControl Flags to more human understandable form...
*
* @param string $uacf UACF
* @return array
@ -1482,16 +1542,14 @@ class Ldap
return $retval;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Convertit le temps ActiveDirectory en Unix timestamp
* Converts ActiveDirectory time to Unix timestamp
*
* @param string $value AD time to convert
* @return integer Unix timestamp
*/
public function convert_time($value)
public function convertTime($value)
{
// phpcs:enable
$dateLargeInt = $value; // nano secondes depuis 1601 !!!!
$secsAfterADEpoch = $dateLargeInt / (10000000); // secondes depuis le 1 jan 1601
$ADToUnixConvertor = ((1970 - 1601) * 365.242190) * 86400; // UNIX start date - AD start date * jours * secondes
@ -1503,9 +1561,9 @@ class Ldap
/**
* Convert a string into output/memory charset
*
* @param string $str String to convert
* @param string $str String to convert
* @param string $pagecodefrom Page code of src string
* @return string Converted string
* @return string Converted string
*/
private function convToOutputCharset($str, $pagecodefrom = 'UTF-8')
{
@ -1522,9 +1580,9 @@ class Ldap
/**
* Convert a string from output/memory charset
*
* @param string $str String to convert
* @param string $str String to convert
* @param string $pagecodeto Page code for result string
* @return string Converted string
* @return string Converted string
*/
public function convFromOutputCharset($str, $pagecodeto = 'UTF-8')
{
@ -1547,7 +1605,6 @@ class Ldap
*/
public function getNextGroupGid($keygroup = 'LDAP_KEY_GROUPS')
{
global $conf;
if (empty($keygroup)) {
$keygroup = 'LDAP_KEY_GROUPS';

View file

@ -1270,7 +1270,11 @@ class mysqliDoli extends mysqli
public function __construct($host, $user, $pass, $name, $port = 0, $socket = "")
{
$flags = 0;
parent::init();
if (PHP_VERSION_ID >= 80100) {
parent::__construct();
} else {
parent::init();
}
if (strpos($host, 'ssl://') === 0) {
$host = substr($host, 6);
parent::options(MYSQLI_OPT_SSL_VERIFY_SERVER_CERT, false);

View file

@ -1339,17 +1339,17 @@ jQuery(document).ready(function() {
});
<?php
if (!getDolGlobalString('MAIN_DISABLE_SELECT2_FOCUS_PROTECTION') && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) {
?>
/*
* Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection"
* Hacky fix for a bug in select2 with jQuery 3.6.4's new nested-focus "protection"
* This fix needs to click a second time when clicking into a combo with ajax (see Test4d and Test5a in test_forms.php
* see: https://github.com/select2/select2/issues/5993
* see: https://github.com/jquery/jquery/issues/4382
*
* TODO: Recheck with the select2 GH issue and remove once this is fixed on their side
*/
<?php
if (!getDolGlobalString('MAIN_DISABLE_SELECT2_FOCUS_PROTECTION') && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) {
?>
$(document).on('select2:open', (e) => {
console.log("Execute the focus (click on combo or use space when on component");
const target = $(e.target);

View file

@ -2360,7 +2360,7 @@ function addEventTypeSQL(&$sql, $actioncode, $sqlANDOR = "AND")
* @param string $sql $sql modified
* @param string $donetodo donetodo
* @param string $now now
* @param string $filters array
* @param array $filters array
* @return string sql request
*/
function addOtherFilterSQL(&$sql, $donetodo, $now, $filters)

View file

@ -370,6 +370,7 @@ function convertDurationtoHour($duration_value, $duration_unit)
* @param mixed $gm False or 0 or 'tzserver' = Input date fields are date info in the server TZ. True or 1 or 'gmt' = Input are date info in GMT TZ.
* Note: In database, dates are always for the server TZ.
* @return string $sqldate String with SQL filter
* @see forgeSQLFromUniversalSearchCriteria()
*/
function dolSqlDateFilter($datefield, $day_date, $month_date, $year_date, $excludefirstand = 0, $gm = false)
{
@ -586,7 +587,7 @@ function dol_get_next_week($day, $week, $month, $year)
* True or 1 or 'gmt' to compare with GMT date.
* Example: dol_get_first_day(1970,1,false) will return -3600 with TZ+1, a dol_print_date on it will return 1970-01-01 00:00:00
* Example: dol_get_first_day(1970,1,true) will return 0 whatever is TZ, a dol_print_date on it will return 1970-01-01 00:00:00
* @return int Date for first day, '' if error
* @return int|string Date as a timestamp, '' if error
*/
function dol_get_first_day($year, $month = 1, $gm = false)
{
@ -605,7 +606,7 @@ function dol_get_first_day($year, $month = 1, $gm = false)
* @param int $month Month
* @param mixed $gm False or 0 or 'tzserver' = Return date to compare with server TZ,
* True or 1 or 'gmt' to compare with GMT date.
* @return int Date for first day, '' if error
* @return int|string Date as a timestamp, '' if error
*/
function dol_get_last_day($year, $month = 12, $gm = false)
{
@ -1186,5 +1187,5 @@ function getWeekNumber($day, $month, $year)
{
$date = new DateTime($year.'-'.$month.'-'.$day);
$week = $date->format("W");
return $week;
return (int) $week;
}

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