Merge branch 'develop' into new-api-rest-tokens
This commit is contained in:
commit
ea9dbec6cf
254 changed files with 15895 additions and 6916 deletions
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
|
|
@ -153,7 +153,7 @@ Long description (Can span across multiple lines).
|
|||
Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
|
||||
a process to follow to optimize the chance to have PRs merged efficiently...
|
||||
|
||||
* A PR must be atomic. It means it must contains the lower possible changes for 1 need (1 bug fix or 1 new feature) without breaking usability of code. If a PR can be split into several PRs, it often means your PR is not atomic.
|
||||
* A PR must be atomic. It means it must contains the lower possible changes for 1 need (1 bug fix or 1 new feature) without breaking usability of code. If a PR can be split into several PRs, it often means your PR is not atomic. For PR on maintenance versions, the modified code must be as low as possible and only the absolutely necessary changes are allowed (You must have the number of lines modified as low as possible to have the visible bug fixed (no refactoring, no perf, no quality, no renaming must be joined). This allow to reduce to the maximum the number of future conflicts (so the number of regressions) when merging fixes into higher version to reduce the time of any future impact analysis.
|
||||
|
||||
* Your Pull Request (PR) must pass the Continuous Integration checks and code quality checks.
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ before_install:
|
|||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo apt install unzip apache2 php7.1 php7.1-cli php7.1-curl php7.1-mysql php7.1-pgsql php7.1-gd php7.1-imap php7.1-intl php7.1-ldap php7.1-xml php7.1-mbstring php7.1-xml php7.1-zip libapache2-mod-php7.1
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '8.1' ]; then
|
||||
sudo apt install unzip apache2 php8.1 php8.1-cli php8.1-curl php8.1-mysql php8.1-pgsql php8.1-gd php8.1-imap php8.1-intl php8.1-ldap php8.1-xml php8.1-mbstring php8.1-xml php8.1-zip libapache2-mod-php8.1
|
||||
fi
|
||||
|
|
@ -125,6 +128,9 @@ before_install:
|
|||
|
||||
install:
|
||||
- |
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.0' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php7.0
|
||||
fi
|
||||
if [ "$TRAVIS_PHP_VERSION" = '7.1' ]; then
|
||||
sudo update-alternatives --set php /usr/bin/php7.1
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -158,7 +158,8 @@ The following changes may create regressions for some external modules, but were
|
|||
* The signature of API get for intervention has been modified to match other get api on other objects.
|
||||
* The directory /build has been moved into /dev/build.
|
||||
* The API to create a website account /idthirdparty/accounts/site is now POST (instead of PUT) and to update is PUT (instead of PATCH).
|
||||
|
||||
* Debug v22 - Invert option TICKET_DO_NOT_INCLUDE_LINK_TO_CUSTOMER (that add link to backoffice interface link when it should remain private)
|
||||
into TICKET_INCLUDE_LINK_TO_PUBLIC_INTERFACE_IN_MESSAGE. It also avoid often emails marked as SPAM due to suspicious link.
|
||||
|
||||
***** ChangeLog for 21.0.1 compared to 21.0.0 *****
|
||||
|
||||
|
|
@ -2274,7 +2275,7 @@ Following changes may create regressions for some external modules, but were nec
|
|||
|
||||
|
||||
***** ChangeLog for 17.0.4 compared to 17.0.3 *****
|
||||
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming
|
||||
FIX: $this->newref already exists and could have been modified by a trigger but we still use a local variable for the filesystem-based renaming
|
||||
FIX: 16.0 only, backport fix for SQL error on global search product
|
||||
FIX: 17.0: deprecated field should only be a fallback
|
||||
FIX: 17.0 PHP8: supplier invoice class:
|
||||
|
|
|
|||
|
|
@ -262,10 +262,12 @@ See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) fil
|
|||
|
||||
Follow Dolibarr project on:
|
||||
|
||||
- [Mastodon](https://pouet.chapril.org/@dolibarr)
|
||||
- [Facebook](https://www.facebook.com/dolibarr)
|
||||
- [X](https://x.com/dolibarr)
|
||||
- [LinkedIn](https://www.linkedin.com/company/association-dolibarr)
|
||||
- [Mastodon](https://pouet.chapril.org/@dolibarr)
|
||||
- [BlueSky](https://bsky.app/profile/dolibarr.org)
|
||||
- [Threads](https://www.threads.net/@dolibarr)
|
||||
- [X](https://x.com/dolibarr)
|
||||
- [Facebook](https://www.facebook.com/dolibarr)
|
||||
- [Reddit](https://www.reddit.com/r/Dolibarr_ERP_CRM/)
|
||||
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
||||
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ The build of .exe files need to have some windows executable files already insta
|
|||
If you have technical knowledge in web administration and plan to share your server instance (Apache, Mysql or PHP) with other projects than Dolibarr or want to use Dolibarr other components (PostgreSQL), you should not use this assistant and make a manual installation of Dolibarr on your existing server by downloading the standard package (.tgz or .zip file).
|
||||
|
||||
|
||||
!!! See file ../makepack-howto.txt
|
||||
!!! See file ../../makepack-howto.md
|
||||
|
|
|
|||
|
|
@ -151,8 +151,20 @@ if (empty($fp)) {
|
|||
exit(6);
|
||||
}
|
||||
|
||||
$gitcommit = 'seetag';
|
||||
$branchname = preg_replace('/^(\d+\.\d+)\..*$/', '\1', $release); // Keep only x.y into x.y.z
|
||||
$fileforgit = dirname(dirname(dirname(__FILE__))).'/.git/refs/heads/'.$branchname;
|
||||
print "Try to get last commit ID from file ".$fileforgit."\n";
|
||||
$fileforgitcontent = file_get_contents($fileforgit);
|
||||
if (empty($fileforgitcontent)) {
|
||||
print "Failed to get the last commit ID. Are you on the branch for the release (branch name '.$branchname.') ?\n";
|
||||
}
|
||||
$gitcommit = trim($fileforgitcontent);
|
||||
|
||||
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
|
||||
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n");
|
||||
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'" gitcommit="'.$gitcommit.'">'."\n");
|
||||
|
||||
$needtoclose = 0;
|
||||
|
||||
foreach ($includeconstants as $countrycode => $tmp) {
|
||||
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
|
||||
|
|
@ -161,7 +173,7 @@ foreach ($includeconstants as $countrycode => $tmp) {
|
|||
$checksumconcat[] = $valueforchecksum;
|
||||
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
|
||||
}
|
||||
fputs($fp, '</dolibarr_constants>'."\n");
|
||||
fputs($fp, '</dolibarr_constants>'."\n\n");
|
||||
}
|
||||
|
||||
fputs($fp, '<dolibarr_htdocs_dir includecustom="'.$includecustom.'">'."\n");
|
||||
|
|
@ -172,7 +184,6 @@ $regextoexclude = '('.($includecustom ? '' : 'custom|').'documents|conf|install|
|
|||
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
|
||||
|
|
@ -180,6 +191,7 @@ foreach ($files as $filetmp) {
|
|||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
|
|
@ -193,6 +205,7 @@ foreach ($files as $filetmp) {
|
|||
}
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
|
||||
|
||||
|
|
@ -200,7 +213,7 @@ asort($checksumconcat); // Sort list of checksum
|
|||
|
||||
fputs($fp, '<dolibarr_htdocs_dir_checksum>'."\n");
|
||||
fputs($fp, md5(join(',', $checksumconcat))."\n");
|
||||
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n");
|
||||
fputs($fp, '</dolibarr_htdocs_dir_checksum>'."\n\n");
|
||||
|
||||
|
||||
// Add the checksum for the part in scripts
|
||||
|
|
@ -213,7 +226,6 @@ $regextoinclude = '\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
|
|||
$regextoexclude = '(custom|documents|conf|install)$'; // Exclude dirs
|
||||
$files = dol_dir_list(dirname(__FILE__).'/../../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
|
|
@ -221,6 +233,7 @@ foreach ($files as $filetmp) {
|
|||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
|
|
@ -234,13 +247,14 @@ foreach ($files as $filetmp) {
|
|||
}
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, '</dolibarr_script_dir>'."\n");
|
||||
|
||||
asort($checksumconcat); // Sort list of checksum
|
||||
fputs($fp, '<dolibarr_script_dir_checksum>'."\n");
|
||||
fputs($fp, md5(join(',', $checksumconcat))."\n");
|
||||
fputs($fp, '</dolibarr_script_dir_checksum>'."\n");
|
||||
fputs($fp, '</dolibarr_script_dir_checksum>'."\n\n");
|
||||
|
||||
|
||||
// Add the checksum for the files into the scope of the unalterable system (record, read, export)
|
||||
|
|
@ -253,7 +267,6 @@ $regextoinclude = '(\.php|\.sql)$';
|
|||
$regextoexclude = ''; // Exclude dirs
|
||||
$files = dol_dir_list(dirname(__FILE__).'/../../htdocs/blockedlog', 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$dir = '';
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
|
|
@ -261,6 +274,7 @@ foreach ($files as $filetmp) {
|
|||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
|
|
@ -274,12 +288,12 @@ foreach ($files as $filetmp) {
|
|||
}
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
// Add the SQL file
|
||||
$regextoinclude = 'llx_blockedlog.*(\.php|\.sql)$';
|
||||
$regextoexclude = ''; // Exclude dirs
|
||||
$files = dol_dir_list(dirname(__FILE__).'/../../htdocs/install/mysql/tables', 'files', 0, $regextoinclude, $regextoexclude, 'fullname');
|
||||
$needtoclose = 0;
|
||||
foreach ($files as $filetmp) {
|
||||
$file = $filetmp['fullname'];
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
|
|
@ -287,6 +301,7 @@ foreach ($files as $filetmp) {
|
|||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
|
|
@ -297,21 +312,19 @@ foreach ($files as $filetmp) {
|
|||
$checksumconcat[] = $md5;
|
||||
fputs($fp, ' <md5file name="'.basename($file).'" size="'.filesize($file).'">'.$md5.'</md5file>'."\n");
|
||||
}
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
}
|
||||
}
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
// Add the trigger file
|
||||
$file = dirname(__FILE__).'/../../htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php';
|
||||
$needtoclose = 0;
|
||||
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
|
||||
$newdir = str_replace(dirname(__FILE__).'/../../htdocs', '', dirname($file));
|
||||
if ($newdir != $dir) {
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
|
||||
$dir = $newdir;
|
||||
|
|
@ -324,13 +337,14 @@ if (filetype($file) == "file") {
|
|||
}
|
||||
if ($needtoclose) {
|
||||
fputs($fp, ' </dir>'."\n");
|
||||
$needtoclose = 0;
|
||||
}
|
||||
fputs($fp, '</dolibarr_unalterable_files>'."\n");
|
||||
|
||||
asort($checksumconcat); // Sort list of checksum
|
||||
fputs($fp, '<dolibarr_unalterable_files_checksum>'."\n");
|
||||
fputs($fp, md5(join(',', $checksumconcat))."\n");
|
||||
fputs($fp, '</dolibarr_unalterable_files_checksum>'."\n");
|
||||
fputs($fp, '</dolibarr_unalterable_files_checksum>'."\n\n");
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1051,7 +1051,7 @@ if ($nboftargetok) {
|
|||
$ret=`cp -fr "$SOURCE/dev/build/debian/apache" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
|
||||
$ret=`cp -f "$SOURCE/dev/build/debian/apache/.htaccess" "$BUILDROOT/$PROJECT.tmp/debian/apache"`;
|
||||
$ret=`cp -fr "$SOURCE/dev/build/debian/lighttpd" "$BUILDROOT/$PROJECT.tmp/debian/lighttpd"`;
|
||||
# Add files also required to dev/build binary package
|
||||
# Add files also required to build binary package
|
||||
$ret=`cp -f "$SOURCE/dev/build/debian/dolibarr.config" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/dev/build/debian/dolibarr.postinst" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
$ret=`cp -f "$SOURCE/dev/build/debian/dolibarr.postrm" "$BUILDROOT/$PROJECT.tmp/debian"`;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ This documentation describe steps to build a BETA or RELEASE versions of Dolibar
|
|||
There is a chapter for BETA version and a chapter for a RELEASE version.
|
||||
|
||||
|
||||
## Prerequisites on Linux
|
||||
## Prerequisites
|
||||
|
||||
### On Linux
|
||||
|
||||
Prerequisites to build the tgz, debian and rpm packages:
|
||||
|
||||
|
|
@ -35,7 +37,7 @@ See file dev/build/exe/doliwamp.iss to know the doliwamp version currently setup
|
|||
The .exe file will be build into directory build.
|
||||
|
||||
|
||||
## Prerequisites on Windows
|
||||
### On Windows
|
||||
|
||||
Prerequisites to build autoexe DoliWamp package from Windows:
|
||||
|
||||
|
|
@ -60,7 +62,7 @@ Prerequisites to build autoexe DoliWamp package from Windows:
|
|||
|
||||
## Actions to do a BETA
|
||||
|
||||
This files describe steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step.
|
||||
This section describes steps made by Dolibarr packaging team to make a beta version of Dolibarr, step by step.
|
||||
|
||||
- Check all files are committed.
|
||||
- Update version/info in ChangeLog, for this you can:
|
||||
|
|
@ -103,6 +105,8 @@ git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //
|
|||
|
||||
## Actions to do a RELEASE
|
||||
|
||||
### On Linux
|
||||
|
||||
This files describe steps made by Dolibarr packaging team to make a complete release of Dolibarr, step by step.
|
||||
We suppose the branch x.y has already been created during the beta (see previous step) and we want to release a version x.y.z (with z >= 0)
|
||||
|
||||
|
|
@ -152,3 +156,10 @@ git log x.y.(z-1).. | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u
|
|||
- Run makepack-dolibarr.pl again with option 99 to publish files on sourceforge. This will also add the official tag x.y.z.
|
||||
|
||||
- Post a news message in dolibarr.org web site by cloning a past news + relay the news url on social networks
|
||||
|
||||
|
||||
### On Windows
|
||||
|
||||
Windows must be used to build the DoliWamp package. And only when the build of packages on Linux has been generated.
|
||||
|
||||
Once prerequisites are solved, just run the script *makepack-dolibarr.pl* with option to build the .EXE. You should get the Dolibarr.exe DoliWamp package.
|
||||
|
|
|
|||
|
|
@ -1849,7 +1849,7 @@ parameters:
|
|||
path: ../../../htdocs/ai/admin/setup.php
|
||||
|
||||
-
|
||||
message: '#^Call to function is_object\(\) with ActionComm\|Adherent\|Commande\|CommandeFournisseur\|Contact\|Contrat\|ExpenseReport\|Facture\|FactureFournisseur\|Fichinter\|Mo\|Product\|Project\|Propal\|Task will always evaluate to true\.$#'
|
||||
message: '#^Call to function is_object\(\) with ActionComm\|Adherent\|Commande\|CommandeFournisseur\|Contact\|Contrat\|Expedition\|ExpenseReport\|Facture\|FactureFournisseur\|Fichinter\|Mo\|Product\|Project\|Propal\|Task will always evaluate to true\.$#'
|
||||
identifier: function.alreadyNarrowedType
|
||||
count: 2
|
||||
path: ../../../htdocs/api/class/api_documents.class.php
|
||||
|
|
@ -6582,12 +6582,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/core/actions_massactions.inc.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$search_status might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../../htdocs/core/actions_massactions.inc.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$triggername in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
|
|
@ -6846,12 +6840,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/core/boxes/box_clients.php
|
||||
|
||||
-
|
||||
message: '#^Comparison operation "\<" between 0 and 0 is always false\.$#'
|
||||
identifier: smaller.alwaysFalse
|
||||
count: 1
|
||||
path: ../../../htdocs/core/boxes/box_commandes.php
|
||||
|
||||
-
|
||||
message: '#^Constructor of class box_commandes has an unused parameter \$param\.$#'
|
||||
identifier: constructor.unusedParameter
|
||||
|
|
@ -9060,12 +9048,6 @@ parameters:
|
|||
count: 2
|
||||
path: ../../../htdocs/core/customreports.php
|
||||
|
||||
-
|
||||
message: '#^If condition is always true\.$#'
|
||||
identifier: if.alwaysTrue
|
||||
count: 1
|
||||
path: ../../../htdocs/core/customreports.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$page might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -11808,36 +11790,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../../htdocs/core/tpl/objectline_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$buyer might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 6
|
||||
path: ../../../htdocs/core/tpl/objectline_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$conf might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 4
|
||||
path: ../../../htdocs/core/tpl/objectline_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$seller might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 4
|
||||
path: ../../../htdocs/core/tpl/objectline_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$usehm might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 4
|
||||
path: ../../../htdocs/core/tpl/objectline_create.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$conf might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 3
|
||||
path: ../../../htdocs/core/tpl/objectline_edit.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$i might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
@ -21741,7 +21693,7 @@ parameters:
|
|||
-
|
||||
message: '#^Ternary operator condition is always true\.$#'
|
||||
identifier: ternary.alwaysTrue
|
||||
count: 3
|
||||
count: 2
|
||||
path: ../../../htdocs/societe/card.php
|
||||
|
||||
-
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -225,6 +225,8 @@ export list="
|
|||
--ignore-table=$base.llx_agefodd_stagiaire_extrafields
|
||||
--ignore-table=$base.llx_agefodd_stagiaire_type
|
||||
--ignore-table=$base.llx_agefodd_training_admlevel
|
||||
--ignore-table=$base.llx_alumni_survey
|
||||
--ignore-table=$base.llx_alumni_survey_extrafields
|
||||
--ignore-table=$base.llx_askpricesupplier
|
||||
--ignore-table=$base.llx_askpricesupplier_extrafields
|
||||
--ignore-table=$base.llx_askpricesupplierdet
|
||||
|
|
@ -333,6 +335,7 @@ export list="
|
|||
--ignore-table=$base.llx_sellyoursaas_blacklistip
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistmail
|
||||
--ignore-table=$base.llx_sellyoursaas_blacklistto
|
||||
--ignore-table=$base.llx_sellyoursaas_clean_dbnotinlist
|
||||
--ignore-table=$base.llx_sellyoursaas_deploymentserver
|
||||
--ignore-table=$base.llx_sellyoursaas_stats
|
||||
--ignore-table=$base.llx_sellyoursaas_whitelistip
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ return [
|
|||
// # Issue statistics:
|
||||
// PhanUndeclaredProperty : 440+ occurrences
|
||||
// PhanTypeMismatchProperty : 100+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 90+ occurrences
|
||||
// PhanTypeMismatchArgument : 85+ occurrences
|
||||
// PhanUndeclaredGlobalVariable : 75+ occurrences
|
||||
// PhanTypeMismatchArgumentNullable : 30+ occurrences
|
||||
// PhanTypeExpectedObjectPropAccess : 20+ occurrences
|
||||
// PhanTypeInvalidDimOffset : 20+ occurrences
|
||||
|
|
@ -23,10 +23,10 @@ return [
|
|||
// PhanPossiblyUndeclaredGlobalVariable : 6 occurrences
|
||||
// PhanTypeArraySuspiciousNull : 6 occurrences
|
||||
// PhanTypeComparisonFromArray : 6 occurrences
|
||||
// PhanPluginUndeclaredVariableIsset : 5 occurrences
|
||||
// PhanParamTooMany : 4 occurrences
|
||||
// PhanPluginDuplicateArrayKey : 4 occurrences
|
||||
// PhanPluginDuplicateExpressionBinaryOp : 4 occurrences
|
||||
// PhanPluginUndeclaredVariableIsset : 4 occurrences
|
||||
// PhanTypeMismatchDimAssignment : 2 occurrences
|
||||
// PhanTypeMismatchReturn : 2 occurrences
|
||||
// PhanTypeSuspiciousStringExpression : 2 occurrences
|
||||
|
|
@ -60,12 +60,10 @@ return [
|
|||
'htdocs/comm/card.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/comm/mailing/index.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/mailing/targetemailing.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/propal/card.php' => ['PhanTypeMismatchProperty'],
|
||||
'htdocs/comm/propal/list.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/comm/propal/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/commande/class/api_orders.class.php' => ['PhanTypeMismatchArgument'],
|
||||
'htdocs/commande/class/commande.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/commande/customer.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/commande/list.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/commande/list_det.php' => ['PhanTypeInvalidDimOffset'],
|
||||
'htdocs/commande/tpl/linkedobjectblock.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
@ -254,7 +252,6 @@ return [
|
|||
'htdocs/product/reassort.php' => ['PhanTypeExpectedObjectPropAccessButGotNull'],
|
||||
'htdocs/product/stock/info.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/list.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/movement_card.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/movement_list.php' => ['PhanPluginUndeclaredVariableIsset', 'PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/productlot_card.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/stats/commande_fournisseur.php' => ['PhanUndeclaredProperty'],
|
||||
|
|
@ -263,7 +260,6 @@ return [
|
|||
'htdocs/product/stock/stats/reception.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/stocktransfer/class/stocktransferline.class.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/tpl/stockcorrection.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/product/stock/tpl/stocktransfer.tpl.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/projet/admin/project.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/projet/card.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/projet/tasks.php' => ['PhanTypeMismatchArgument'],
|
||||
|
|
@ -272,7 +268,7 @@ return [
|
|||
'htdocs/public/eventorganization/subscriptionok.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/members/new.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/payment/newpayment.php' => ['PhanUndeclaredProperty'],
|
||||
'htdocs/public/payment/paymentok.php' => ['PhanTypeMismatchArgumentProbablyReal', 'PhanUndeclaredGlobalVariable'],
|
||||
'htdocs/public/payment/paymentok.php' => ['PhanTypeMismatchArgumentProbablyReal'],
|
||||
'htdocs/public/project/suggestbooth.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/public/project/suggestconference.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'],
|
||||
'htdocs/public/project/viewandvote.php' => ['PhanUndeclaredGlobalVariable'],
|
||||
|
|
|
|||
|
|
@ -433,7 +433,7 @@ print '<br>';
|
|||
|
||||
// Case of the parameter ACCOUNTING_MODE
|
||||
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updatemode">';
|
||||
|
|
@ -446,7 +446,7 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
|||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_1" name="accounting_mode" value="CREANCES-DETTES"'.($accounting_mode != 'RECETTES-DEPENSES' ? ' checked' : '').'><label for="accounting_mode_1"> '.$langs->trans('OptionModeVirtual').'</label> ('.$langs->trans('Default').')</td>';
|
||||
print '<td><span class="opacitymedium">'.nl2br($langs->trans('ACCOUNTING_USE_NON_TREASURY_Desc')).'</span>';
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_2" name="accounting_mode" value="RECETTES-DEPENSES"'.($accounting_mode != 'CREANCES-DETTES' ? ' checked' : '').'><label for="accounting_mode_2"> '.$langs->trans('OptionModeTrue').'</label></td>';
|
||||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_2" name="accounting_mode" value="RECETTES-DEPENSES"'.($accounting_mode == 'RECETTES-DEPENSES' ? ' checked' : '').'><label for="accounting_mode_2"> '.$langs->trans('OptionModeTrue').'</label></td>';
|
||||
print '<td><span class="opacitymedium">'.nl2br($langs->trans('ACCOUNTING_USE_TREASURY_Desc'))."</span>";
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,15 @@ if ($action != 'export') {
|
|||
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
|
||||
|
||||
if (empty($reshook)) {
|
||||
$newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' (' . getDolGlobalString('ACCOUNTING_EXPORT_FORMAT').')" />';
|
||||
if ($type == 'sub') {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
} else {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ExportToCsv'), '', 'fa fa-file-csv paddingleft', $_SERVER['PHP_SELF'], 'exportcsvbutton', 1, array('morecss' => 'marginleftonly'));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
|
|
@ -360,14 +368,6 @@ if ($action != 'export') {
|
|||
});
|
||||
</script>';
|
||||
|
||||
if ($type == 'sub') {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
} else {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
|
||||
}
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ExportToPdf'), '', 'fa fa-file-pdf paddingleft', $_SERVER['PHP_SELF'], 'exportpdfbutton', 1, array('morecss' => 'marginleftonly'));
|
||||
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
|
|
|
|||
|
|
@ -3178,7 +3178,7 @@ class BookKeeping extends CommonObject
|
|||
$error++;
|
||||
}
|
||||
$objtmp = $this->db->fetch_object($result);
|
||||
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
|
||||
$bookkeeping->subledger_label = $objtmp->subledger_label ?? null; // latest subledger label used
|
||||
} else {
|
||||
$bookkeeping->subledger_account = null;
|
||||
$bookkeeping->subledger_label = null;
|
||||
|
|
|
|||
|
|
@ -196,6 +196,21 @@ if ($only_rappro == 2) {
|
|||
$sql .= " ORDER BY b.datev";
|
||||
//print $sql;
|
||||
|
||||
// Preload payment account codes by payment type from c_paiement
|
||||
$accountancy_code_by_payment = array();
|
||||
$sql2 = "SELECT code, accountancy_code";
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||
$sql2 .= " WHERE entity IN (".getEntity('c_paiement').")";
|
||||
$sql2 .= " AND active = 1";
|
||||
$resql = $db->query($sql2);
|
||||
if ($resql) {
|
||||
while ($objp = $db->fetch_object($resql)) {
|
||||
if (!empty($objp->code) && !empty($objp->accountancy_code)) {
|
||||
$accountancy_code_by_payment[$objp->code] = $objp->accountancy_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$object = new Account($db);
|
||||
$paymentstatic = new Paiement($db);
|
||||
$paymentsupplierstatic = new PaiementFourn($db);
|
||||
|
|
@ -295,6 +310,11 @@ if ($result) {
|
|||
// Set accountancy code for bank
|
||||
$compta_bank = $obj->account_number;
|
||||
|
||||
// Determining the bank account by payment method
|
||||
if (!empty($obj->fk_type) && !empty($accountancy_code_by_payment[$obj->fk_type])) {
|
||||
$compta_bank = $accountancy_code_by_payment[$obj->fk_type];
|
||||
}
|
||||
|
||||
// Set accountancy code for thirdparty (example: '411CU...' or '411' if no subledger account defined on customer)
|
||||
$compta_soc = 'NotDefined';
|
||||
$accountancy_code_general = 'NotDefined';
|
||||
|
|
@ -362,6 +382,32 @@ if ($result) {
|
|||
$amounttouse = $obj->amount_main_currency;
|
||||
}
|
||||
|
||||
// in case option FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS is on, payment could be for more than one third-partie
|
||||
// so we have to find which part of the payment is affected to each third-parties
|
||||
// (because in this case $obj-amount = the total of the paiement and not the paiement for each third-parties)
|
||||
if (getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') && ($lineisapurchase == 1 || $lineisasale == 1) ) {
|
||||
if ($lineisapurchase == 1) {
|
||||
$sqlamount = "SELECT SUM(pf.amount) as amount";
|
||||
$sqlamount .= " FROM ".MAIN_DB_PREFIX."paiementfounr_facturefourn AS pf";
|
||||
$sqlamount .= " INNER JOIN ".MAIN_DB_PREFIX."paiementfourn AS p ON pf.fk_paiementfourn = p.rowid";
|
||||
$sqlamount .= " RIGHT JOIN ".MAIN_DB_PREFIX."facture AS f ON pf.fk_facturefourn = f.rowid";
|
||||
$sqlamount .= " WHERE p.fk_bank = ".((int) $obj->rowid);
|
||||
$sqlamount .= " AND f.fk_soc = ".((int) $obj->socid);
|
||||
} else {
|
||||
$sqlamount = "SELECT SUM(pf.amount) as amount";
|
||||
$sqlamount .= " FROM ".MAIN_DB_PREFIX."paiement_facture AS pf";
|
||||
$sqlamount .= " INNER JOIN ".MAIN_DB_PREFIX."paiement AS p ON pf.fk_paiement = p.rowid";
|
||||
$sqlamount .= " RIGHT JOIN ".MAIN_DB_PREFIX."facture AS f ON pf.fk_facture = f.rowid";
|
||||
$sqlamount .= " WHERE p.fk_bank = ".((int) $obj->rowid);
|
||||
$sqlamount .= " AND f.fk_soc = ".((int) $obj->socid);
|
||||
}
|
||||
$resultamount = $db->query($sqlamount);
|
||||
if ($resultamount) {
|
||||
$objamount = $db->fetch_object($resultamount);
|
||||
if (!empty($objamount->amount)) $amounttouse = $objamount->amount;
|
||||
}
|
||||
}
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
// Test if entry is for a social contribution, salary or expense report.
|
||||
|
|
@ -427,10 +473,17 @@ if ($result) {
|
|||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||
if ($compta_soc) {
|
||||
if (empty($tabtp[$obj->rowid][$compta_soc])) {
|
||||
$tabtp[$obj->rowid][$compta_soc] = $amounttouse;
|
||||
} else {
|
||||
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||
// because we are in 2 loop (loop on the line from the sql queries and loop on $links)
|
||||
// and in case of option FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS is on,
|
||||
// we will pass here n times for each payment line
|
||||
// so we have to add $amoutouse only if the line $links[$key] correspond to the payment line we are in used ( socid correspondinf at the payment line $links)
|
||||
// if FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS is off we add $amounttouse
|
||||
if (!getDolGlobalString('FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS') || $obj->socid == $links[$key]['url_id']){
|
||||
if (empty($tabtp[$obj->rowid][$compta_soc])) {
|
||||
$tabtp[$obj->rowid][$compta_soc] = $amounttouse;
|
||||
} else {
|
||||
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'user') {
|
||||
|
|
@ -626,7 +679,7 @@ if ($result) {
|
|||
}
|
||||
|
||||
// If no links were found to know the amount on thirdparty, we try to guess it.
|
||||
// This may happens on bank entries without the links lines to 'company'.
|
||||
// This may happen on bank entries without the links lines to 'company'.
|
||||
if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) { // If we don't find 'company' link because it is an old 'withdraw' record
|
||||
foreach ($links as $key => $val) {
|
||||
if ($links[$key]['type'] == 'payment') {
|
||||
|
|
|
|||
|
|
@ -1402,7 +1402,7 @@ if (empty($action) || $action == 'view') {
|
|||
print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
}
|
||||
|
||||
print '<div class="tabsAction tabsActionNoBottom">';
|
||||
print '<br><div class="tabsAction tabsActionNoBottom centerimp">';
|
||||
|
||||
if (getDolGlobalString('ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL')) {
|
||||
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
|
||||
|
|
@ -1441,7 +1441,6 @@ if (empty($action) || $action == 'view') {
|
|||
print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td></td>";
|
||||
print "<td>".$langs->trans("Date")."</td>";
|
||||
print "<td>".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").')</td>';
|
||||
print "<td>".$langs->trans("AccountAccounting")."</td>";
|
||||
|
|
|
|||
|
|
@ -2638,12 +2638,12 @@ class Adherent extends CommonObject
|
|||
$labelShort = '';
|
||||
|
||||
if ($mode == 'expired') {
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$warning_delay = getWarningDelay('member', 'subscription') / 60 / 60 / 24;
|
||||
$label = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_VALIDATED.'&filter=outofdate';
|
||||
} elseif ($mode == 'shift') {
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$warning_delay = getWarningDelay('member', 'subscription') / 60 / 60 / 24;
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_DRAFT;
|
||||
$label = $langs->trans("MembersListToValid");
|
||||
$labelShort = $langs->trans("ToValidate");
|
||||
|
|
@ -3075,7 +3075,7 @@ class Adherent extends CommonObject
|
|||
|
||||
$now = dol_now();
|
||||
|
||||
return $this->datefin < ($now - $conf->adherent->subscription->warning_delay);
|
||||
return $this->datefin < ($now - getWarningDelay('member', 'subscription'));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1292,14 +1292,14 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
// Technical ID
|
||||
if (!empty($arrayfields['d.rowid']['checked'])) {
|
||||
print '<td class="center" data-key="id">'.$obj->rowid.'</td>';
|
||||
print '<td class="center" data-key="id">'.dolPrintHTML($obj->rowid).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Ref
|
||||
if (!empty($arrayfields['d.ref']['checked'])) {
|
||||
print "<td>";
|
||||
print '<td class="tdoverflowmax150">';
|
||||
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
|
|
@ -1309,7 +1309,7 @@ while ($i < $imaxinloop) {
|
|||
// Title/Civility
|
||||
if (!empty($arrayfields['d.civility']['checked'])) {
|
||||
print "<td>";
|
||||
print dol_escape_htmltag($obj->civility);
|
||||
print dolPrintHTML($obj->civility);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1348,13 +1348,13 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
// Company
|
||||
if (!empty($arrayfields['d.company']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag((string) $companyname).'">';
|
||||
print '<td class="tdoverflowmax125" title="'.dolPrintHTMLForAttribute((string) $companyname).'">';
|
||||
print $companynametoshow;
|
||||
print "</td>\n";
|
||||
}
|
||||
// Login
|
||||
if (!empty($arrayfields['d.login']['checked'])) {
|
||||
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->login).'">'.$obj->login."</td>\n";
|
||||
print '<td class="tdoverflowmax125" title="'.dolPrintHTMLForAttribute($obj->login).'">'.dolPrintHTML($obj->login)."</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
|
@ -1382,7 +1382,7 @@ while ($i < $imaxinloop) {
|
|||
// Address
|
||||
if (!empty($arrayfields['d.address']['checked'])) {
|
||||
print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->address).'">';
|
||||
print dol_escape_htmltag($obj->address);
|
||||
print dolPrintHTML($obj->address);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1391,7 +1391,7 @@ while ($i < $imaxinloop) {
|
|||
// Zip
|
||||
if (!empty($arrayfields['d.zip']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print dol_escape_htmltag($obj->zip);
|
||||
print dolPrintHTML($obj->zip);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1400,7 +1400,7 @@ while ($i < $imaxinloop) {
|
|||
// Town
|
||||
if (!empty($arrayfields['d.town']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
print dol_escape_htmltag($obj->town);
|
||||
print dolPrintHTML($obj->town);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1409,7 +1409,7 @@ while ($i < $imaxinloop) {
|
|||
// State / County / Departement
|
||||
if (!empty($arrayfields['state.nom']['checked'])) {
|
||||
print "<td>";
|
||||
print dol_escape_htmltag($obj->state_name);
|
||||
print dolPrintHTML($obj->state_name);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1418,8 +1418,8 @@ while ($i < $imaxinloop) {
|
|||
// Country
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) {
|
||||
$tmparray = getCountry($obj->country, 'all');
|
||||
print '<td class="center tdoverflowmax100" title="'.dol_escape_htmltag($tmparray['label']).'">';
|
||||
print dol_escape_htmltag($tmparray['label']);
|
||||
print '<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($tmparray['label']).'">';
|
||||
print dolPrintHTML($tmparray['label']);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -1468,7 +1468,7 @@ while ($i < $imaxinloop) {
|
|||
if ($datefin) {
|
||||
$s .= dol_print_date($datefin, 'day');
|
||||
if ($memberstatic->hasDelay()) {
|
||||
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).' '.$langs->trans("days").')';
|
||||
$textlate = ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil(getWarningDelay('member', 'subscription') / 60 / 60 / 24) >= 0 ? '+' : '').ceil(getWarningDelay('member', 'subscription') / 60 / 60 / 24).' '.$langs->trans("days").')';
|
||||
$s .= " ".img_warning($langs->trans("SubscriptionLate").$textlate);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1523,8 +1523,8 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
// Import key
|
||||
if (!empty($arrayfields['d.import_key']['checked'])) {
|
||||
print '<td class="tdoverflowmax100 center" title="'.dol_escape_htmltag($obj->import_key).'">';
|
||||
print dol_escape_htmltag($obj->import_key);
|
||||
print '<td class="tdoverflowmax100 center" title="'.dolPrintHTMLForAttribute($obj->import_key).'">';
|
||||
print dolPrintHTML($obj->import_key);
|
||||
print "</td>\n";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ foreach ($dirbarcode as $reldir) {
|
|||
|
||||
// Select barcode numbering module
|
||||
if (isModEnabled('product')) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', 'product');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
|
@ -264,12 +264,16 @@ if (isModEnabled('product')) {
|
|||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print dolButtonToOpenUrlInDialogPopup('barcodeinitproduct', $langs->trans("MassBarcodeInit"), $langs->trans("GoOnThisPageToInitBarCode").' '.img_picto('', 'url'), '/barcode/codeinit.php', '', 'small');
|
||||
print '<br><br><br>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Select barcode numbering module
|
||||
if (isModEnabled('societe')) {
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("ThirdParty").")", '', '');
|
||||
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("ThirdParty").")", '', 'company');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
|
@ -308,7 +312,7 @@ if (isModEnabled('societe')) {
|
|||
print '</td>';
|
||||
print '<td class="nowrap">'.$modBarCode->getExample($langs)."</td>\n";
|
||||
|
||||
if (getDolGlobalString('BARCODE_THIRDPARTY_ADDON_NUM') && $conf->global->BARCODE_THIRDPARTY_ADDON_NUM == "$file") {
|
||||
if (getDolGlobalString('BARCODE_THIRDPARTY_ADDON_NUM') && getDolGlobalString('BARCODE_THIRDPARTY_ADDON_NUM') == "$file") {
|
||||
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodethirdpartyoff&token='.newToken().'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
|
|
@ -328,14 +332,17 @@ if (isModEnabled('societe')) {
|
|||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print dolButtonToOpenUrlInDialogPopup('barcodeinitthirdparty', $langs->trans("MassBarcodeInit"), $langs->trans("GoOnThisPageToInitBarCode").' '.img_picto('', 'url'), '/barcode/codeinit.php', '', 'small');
|
||||
print '<br><br><br>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
/*
|
||||
* CHOIX ENCODAGE
|
||||
* CHOOSE ENCODING
|
||||
*/
|
||||
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("BarcodeEncodeModule"), '', '');
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
|
|
@ -472,7 +479,7 @@ if (!isset($_SERVER['WINDIR'])) {
|
|||
// Module products
|
||||
if (isModEnabled('product')) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td>'.img_picto('', 'product', 'class="pictofixedwidth"').$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
print $formbarcode->selectBarcodeType(getDolGlobalInt('PRODUIT_DEFAULT_BARCODE_TYPE'), "PRODUIT_DEFAULT_BARCODE_TYPE", 1);
|
||||
print '</td>';
|
||||
|
|
@ -483,7 +490,7 @@ if (isModEnabled('product')) {
|
|||
// Module thirdparty
|
||||
if (isModEnabled('societe')) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td>'.img_picto('', 'company', 'class="pictofixedwidth"').$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
print $formbarcode->selectBarcodeType(getDolGlobalInt('GENBARCODE_BARCODETYPE_THIRDPARTY'), "GENBARCODE_BARCODETYPE_THIRDPARTY", 1);
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ $quality = $tmparraysize['quality'];
|
|||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
$hookmanager->initHooks(array('admincompany', 'globaladmin'));
|
||||
|
||||
$object = new Societe($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -451,11 +453,11 @@ print '<input type="hidden" name="action" value="update">';
|
|||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th></th></tr>'."\n";
|
||||
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak" colspan="2">'.$langs->trans("CompanyInfo").'</th></tr>'."\n";
|
||||
|
||||
// Company name
|
||||
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="name" id="name" maxlength="'.$mysoc->fields['nom']['length'].'" class="minwidth250" value="'.dol_escape_htmltag((GETPOSTISSET('name') ? GETPOST('name', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_NOM')))).'"'.(!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
|
||||
print '<input name="name" id="name" maxlength="'.$mysoc->fields['nom']['length'].'" class="minwidth250" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('name') ? GETPOST('name', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_NOM'))).'"'.(getDolGlobalString('MAIN_INFO_SOCIETE_NOM') ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||
|
||||
// Main currency
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
|
||||
|
|
@ -472,14 +474,14 @@ print '</td></tr>'."\n";
|
|||
|
||||
// Address
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'))).'</textarea></td></tr>'."\n";
|
||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.(GETPOSTISSET('MAIN_INFO_SOCIETE_ADDRESS') ? GETPOST('MAIN_INFO_SOCIETE_ADDRESS', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS')).'</textarea></td></tr>'."\n";
|
||||
|
||||
// Zip
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_ZIP')))).'"></td></tr>'."\n";
|
||||
print '<input class="width100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('MAIN_INFO_SOCIETE_ZIP') ? GETPOST('MAIN_INFO_SOCIETE_ZIP', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_ZIP'))).'"></td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_TOWN')))).'"></td></tr>'."\n";
|
||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth200" id="MAIN_INFO_SOCIETE_TOWN" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('MAIN_INFO_SOCIETE_TOWN') ? GETPOST('MAIN_INFO_SOCIETE_TOWN', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_TOWN'))).'"></td></tr>'."\n";
|
||||
|
||||
// State
|
||||
print '<tr class="oddeven"><td class="wordbreak"><label for="state_id">'.$langs->trans("State").'</label></td><td>';
|
||||
|
|
@ -495,31 +497,31 @@ print '</td></tr>'."\n";
|
|||
// Phone
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||
print img_picto('', 'object_phoning', '', 0, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="maxwidth150 widthcentpercentminusx" name="phone" id="phone" value="'.dol_escape_htmltag((GETPOSTISSET('phone') ? GETPOST('phone', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_TEL')))).'"></td></tr>';
|
||||
print '<input class="maxwidth150 widthcentpercentminusx" name="phone" id="phone" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('phone') ? GETPOST('phone', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_TEL'))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Phone mobile
|
||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("PhoneMobile").'</label></td><td>';
|
||||
print img_picto('', 'object_phoning_mobile', '', 0, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="maxwidth150 widthcentpercentminusx" name="phone_mobile" id="phone_mobile" value="'.dol_escape_htmltag((GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MOBILE')))).'"></td></tr>';
|
||||
print '<input class="maxwidth150 widthcentpercentminusx" name="phone_mobile" id="phone_mobile" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_MOBILE'))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Fax
|
||||
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
||||
print img_picto('', 'object_phoning_fax', '', 0, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="maxwidth150" name="fax" id="fax" value="'.dol_escape_htmltag((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_FAX')))).'"></td></tr>';
|
||||
print '<input class="maxwidth150" name="fax" id="fax" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('fax') ? GETPOST('fax', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_FAX'))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Email
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print img_picto('', 'object_email', '', 0, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="'.dol_escape_htmltag((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') ? $conf->global->MAIN_INFO_SOCIETE_MAIL : ''))).'"></td></tr>';
|
||||
print '<input class="minwidth300 maxwidth500 widthcentpercentminusx" name="mail" id="email" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('mail') ? GETPOST('mail', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
print '<tr class="oddeven"><td><label for="web">'.$langs->trans("Web").'</label></td><td>';
|
||||
print img_picto('', 'globe', '', 0, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" value="'.dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_WEB') ? $conf->global->MAIN_INFO_SOCIETE_WEB : ''))).'"></td></tr>';
|
||||
print '<input class="maxwidth300 widthcentpercentminusx" name="web" id="web" value="'.dol_escape_htmltag((GETPOSTISSET('web') ? GETPOST('web', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_WEB'))).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Barcode
|
||||
|
|
@ -527,7 +529,7 @@ if (isModEnabled('barcode')) {
|
|||
print '<tr class="oddeven"><td>';
|
||||
print '<label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
|
||||
print '<span class="fa fa-barcode pictofixedwidth"></span>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dol_escape_htmltag(GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_GENCOD', '')).'"></td></tr>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150 widthcentpercentminusx maxwidth300" value="'.dolPrintHTMLForAttribute(GETPOSTISSET('barcode') ? GETPOST('barcode', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_GENCOD')).'"></td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -563,7 +565,7 @@ print '</td></tr>';
|
|||
|
||||
// Note
|
||||
print '<tr class="oddeven"><td class="tdtop"><label for="note">'.$langs->trans("Note").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_NOTE') ? $conf->global->MAIN_INFO_SOCIETE_NOTE : '')).'</textarea></td></tr>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="note" id="note" rows="'.ROWS_5.'">'.(GETPOSTISSET('note') ? GETPOST('note', 'restricthtml') : getDolGlobalString('MAIN_INFO_SOCIETE_NOTE')).'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
|
@ -576,23 +578,23 @@ print '<br><br>';
|
|||
// IDs of the company (country-specific)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td></td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak" colspan="2">'.$langs->trans("CompanyIds").'</td></tr>';
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
// Managing Director(s)
|
||||
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET('MAIN_INFO_SOCIETE_MANAGERS') ? GETPOST('MAIN_INFO_SOCIETE_MANAGERS', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS') ? $conf->global->MAIN_INFO_SOCIETE_MANAGERS : ''))).'"></td></tr>';
|
||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="directors" class="minwidth300" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('MAIN_INFO_SOCIETE_MANAGERS') ? GETPOST('MAIN_INFO_SOCIETE_MANAGERS', 'alphanohtml') : getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS'))).'"></td></tr>';
|
||||
|
||||
// GDPR contact
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
|
||||
print '</td><td>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth300" value="'.dol_escape_htmltag((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'alphanohtml') : (getDolGlobalString('MAIN_INFO_GDPR') ? $conf->global->MAIN_INFO_GDPR : ''))).'"></td></tr>';
|
||||
print '<input name="MAIN_INFO_GDPR" id="infodirector" class="minwidth300" value="'.dolPrintHTMLForAttribute((GETPOSTISSET("MAIN_INFO_GDPR") ? GETPOST("MAIN_INFO_GDPR", 'alphanohtml') : getDolGlobalString('MAIN_INFO_GDPR'))).'"></td></tr>';
|
||||
|
||||
// Capital
|
||||
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||
print '<input name="capital" id="capital" class="maxwidth100" value="'.dol_escape_htmltag((GETPOSTISSET('capital') ? GETPOST('capital', 'alphanohtml') : (getDolGlobalString('MAIN_INFO_CAPITAL') ? $conf->global->MAIN_INFO_CAPITAL : ''))).'"></td></tr>';
|
||||
print '<input name="capital" id="capital" class="maxwidth100" value="'.dolPrintHTMLForAttribute((GETPOSTISSET('capital') ? GETPOST('capital', 'alphanohtml') : getDolGlobalString('MAIN_INFO_CAPITAL'))).'"></td></tr>';
|
||||
|
||||
// Juridical Status
|
||||
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
|
||||
|
|
@ -605,19 +607,19 @@ print '</td></tr>';
|
|||
|
||||
// Object of the company
|
||||
print '<tr class="oddeven"><td><label for="socialobject">'.$langs->trans("CompanyObject").'</label></td><td>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_3.'">'.(getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT')).'</textarea></td></tr>';
|
||||
print '<textarea class="flat quatrevingtpercent" name="socialobject" id="socialobject" rows="'.ROWS_3.'">'.getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT').'</textarea></td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Tax ID Intra-community VAT number
|
||||
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
|
||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_TVAINTRA')).'">';
|
||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_TVAINTRA')).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// ProfId1
|
||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="siren" id="profid1" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIREN')).'">';
|
||||
print '<input name="siren" id="profid1" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_SIREN')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -628,7 +630,7 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="siret" id="profid2" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_SIRET')).'">';
|
||||
print '<input name="siret" id="profid2" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_SIRET')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -639,7 +641,7 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="ape" id="profid3" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_APE')).'">';
|
||||
print '<input name="ape" id="profid3" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_APE')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -650,7 +652,7 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="rcs" id="profid4" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_RCS')).'">';
|
||||
print '<input name="rcs" id="profid4" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_RCS')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -661,7 +663,7 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID5')).'">';
|
||||
print '<input name="MAIN_INFO_PROFID5" id="profid5" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_PROFID5')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -672,7 +674,7 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID6')).'">';
|
||||
print '<input name="MAIN_INFO_PROFID6" id="profid6" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_PROFID6')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -683,7 +685,7 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId7", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid7">'.$langs->transcountry("ProfId7", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="MAIN_INFO_PROFID7" id="profid7" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID7')).'">';
|
||||
print '<input name="MAIN_INFO_PROFID7" id="profid7" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_PROFID7')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -694,7 +696,7 @@ if ($langs->transcountry("ProfId7", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId8", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid8">'.$langs->transcountry("ProfId8", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="MAIN_INFO_PROFID8" id="profid8" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID8')).'">';
|
||||
print '<input name="MAIN_INFO_PROFID8" id="profid8" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_PROFID8')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -705,7 +707,7 @@ if ($langs->transcountry("ProfId8", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId9", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid9">'.$langs->transcountry("ProfId9", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="MAIN_INFO_PROFID9" id="profid9" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID9')).'">';
|
||||
print '<input name="MAIN_INFO_PROFID9" id="profid9" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_PROFID9')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -716,7 +718,7 @@ if ($langs->transcountry("ProfId9", $mysoc->country_code) != '-') {
|
|||
if ($langs->transcountry("ProfId10", $mysoc->country_code) != '-') {
|
||||
print '<tr class="oddeven"><td><label for="profid10">'.$langs->transcountry("ProfId10", $mysoc->country_code).'</label></td><td>';
|
||||
if (!empty($mysoc->country_code)) {
|
||||
print '<input name="MAIN_INFO_PROFID10" id="profid10" class="minwidth200" value="'.dol_escape_htmltag(getDolGlobalString('MAIN_INFO_PROFID10')).'">';
|
||||
print '<input name="MAIN_INFO_PROFID10" id="profid10" class="minwidth200" value="'.dolPrintHTMLForAttribute(getDolGlobalString('MAIN_INFO_PROFID10')).'">';
|
||||
} else {
|
||||
print $countrynotdefined;
|
||||
}
|
||||
|
|
@ -735,7 +737,7 @@ print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</
|
|||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
|
||||
print $formother->select_month(getDolGlobalInt('SOCIETE_FISCAL_MONTH_START') ? $conf->global->SOCIETE_FISCAL_MONTH_START : '', 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
|
||||
print $formother->select_month(getDolGlobalString('SOCIETE_FISCAL_MONTH_START'), 'SOCIETE_FISCAL_MONTH_START', 0, 1, 'maxwidth100').'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ if ($action == 'update') {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -158,11 +159,11 @@ print '<table class="noborder centpercent">';
|
|||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="2">'.$langs->trans('OptionMode').'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_1" name="accounting_mode" value="RECETTES-DEPENSES"'.($accounting_mode != 'CREANCES-DETTES' ? ' checked' : '').'><label for="accounting_mode_1"> '.$langs->trans('OptionModeTrue').'</label></td>';
|
||||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_2" name="accounting_mode" value="CREANCES-DETTES"'.($accounting_mode != 'RECETTES-DEPENSES' ? ' checked' : '').'><label for="accounting_mode_2"> '.$langs->trans('OptionModeVirtual').'</label></td>';
|
||||
print '<td class="opacitymedium">'.nl2br($langs->trans('OptionModeVirtualDesc'))."</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_1" name="accounting_mode" value="RECETTES-DEPENSES"'.($accounting_mode == 'RECETTES-DEPENSES' ? ' checked' : '').'><label for="accounting_mode_1"> '.$langs->trans('OptionModeTrue').'</label></td>';
|
||||
print '<td class="opacitymedium">'.nl2br($langs->trans('OptionModeTrueDesc'));
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="nowraponall"><input type="radio" id="accounting_mode_2" name="accounting_mode" value="CREANCES-DETTES"'.($accounting_mode == 'CREANCES-DETTES' ? ' checked' : '').'><label for="accounting_mode_2"> '.$langs->trans('OptionModeVirtual').'</label></td>';
|
||||
print '<td class="opacitymedium">'.nl2br($langs->trans('OptionModeVirtualDesc'))."</td></tr>\n";
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -273,12 +273,12 @@ $tabsql[DICT_COUNTRY] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.f
|
|||
$tabsql[DICT_CIVILITY] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
|
||||
$tabsql[DICT_ACTIONCOMM] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
|
||||
$tabsql[DICT_CHARGESOCIALES] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1";
|
||||
$tabsql[DICT_TYPENT] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
|
||||
$tabsql[DICT_TYPENT] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.module, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid";
|
||||
$tabsql[DICT_CURRENCIES] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
|
||||
$tabsql[DICT_TVA] = "SELECT t.rowid, t.entity, t.code, t.type_vat, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.fk_department_buyer as department_buyer_id, db.nom as department_buyer, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy, t.use_default FROM ".MAIN_DB_PREFIX."c_tva as t INNER JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_pays = c.rowid LEFT JOIN ".MAIN_DB_PREFIX."c_departements as db ON t.fk_department_buyer = db.rowid WHERE t.entity IN (".getEntity($tabname[DICT_TVA]).")";
|
||||
$tabsql[DICT_TYPE_CONTACT] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
|
||||
$tabsql[DICT_PAYMENT_TERM] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAYMENT_TERM]).")";
|
||||
$tabsql[DICT_PAIEMENT] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAIEMENT]).")";
|
||||
$tabsql[DICT_PAIEMENT] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.accountancy_code, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[DICT_PAIEMENT]).")";
|
||||
$tabsql[DICT_ECOTAXE] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[DICT_PAPER_FORMAT] = "SELECT t.rowid as rowid, t.code, t.label as libelle, t.width, t.height, t.unit, t.active FROM ".MAIN_DB_PREFIX."c_paper_format as t";
|
||||
$tabsql[DICT_PROSPECTLEVEL] = "SELECT t.code, t.label as libelle, t.sortorder, t.active FROM ".MAIN_DB_PREFIX."c_prospectlevel as t";
|
||||
|
|
@ -367,12 +367,12 @@ $tabfield[DICT_COUNTRY] = "code,label";
|
|||
$tabfield[DICT_CIVILITY] = "code,label";
|
||||
$tabfield[DICT_ACTIONCOMM] = "code,libelle,type,color,position";
|
||||
$tabfield[DICT_CHARGESOCIALES] = "code,libelle,country,accountancy_code";
|
||||
$tabfield[DICT_TYPENT] = "code,libelle,country_id,country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : '');
|
||||
$tabfield[DICT_TYPENT] = "code,libelle,module,country_id,country".(getDolGlobalString('SOCIETE_SORT_ON_TYPEENT') ? ',position' : '');
|
||||
$tabfield[DICT_CURRENCIES] = "code,label,unicode";
|
||||
$tabfield[DICT_TVA] = "country_id,country,department_buyer_id,department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,use_default,note";
|
||||
$tabfield[DICT_TYPE_CONTACT] = "element,source,code,libelle,position";
|
||||
$tabfield[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfield[DICT_PAIEMENT] = "code,libelle,type";
|
||||
$tabfield[DICT_PAIEMENT] = "code,libelle,type,accountancy_code";
|
||||
$tabfield[DICT_ECOTAXE] = "code,label,price,organization,country";
|
||||
$tabfield[DICT_PAPER_FORMAT] = "code,libelle,width,height,unit";
|
||||
$tabfield[DICT_PROSPECTLEVEL] = "code,libelle,sortorder";
|
||||
|
|
@ -419,7 +419,7 @@ $tabfieldvalue[DICT_CURRENCIES] = "code,label,unicode";
|
|||
$tabfieldvalue[DICT_TVA] = "country,department_buyer_id,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,use_default,note";
|
||||
$tabfieldvalue[DICT_TYPE_CONTACT] = "element,source,code,libelle,position";
|
||||
$tabfieldvalue[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder";
|
||||
$tabfieldvalue[DICT_PAIEMENT] = "code,libelle,type";
|
||||
$tabfieldvalue[DICT_PAIEMENT] = "code,libelle,type,accountancy_code";
|
||||
$tabfieldvalue[DICT_ECOTAXE] = "code,label,price,organization,country";
|
||||
$tabfieldvalue[DICT_PAPER_FORMAT] = "code,libelle,width,height,unit";
|
||||
$tabfieldvalue[DICT_PROSPECTLEVEL] = "code,libelle,sortorder";
|
||||
|
|
@ -466,7 +466,7 @@ $tabfieldinsert[DICT_CURRENCIES] = "code_iso,label,unicode";
|
|||
$tabfieldinsert[DICT_TVA] = "fk_pays,fk_department_buyer,code,type_vat,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,use_default,note,entity";
|
||||
$tabfieldinsert[DICT_TYPE_CONTACT] = "element,source,code,libelle,position";
|
||||
$tabfieldinsert[DICT_PAYMENT_TERM] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfieldinsert[DICT_PAIEMENT] = "code,libelle,type,entity";
|
||||
$tabfieldinsert[DICT_PAIEMENT] = "code,libelle,type,accountancy_code,entity";
|
||||
$tabfieldinsert[DICT_ECOTAXE] = "code,label,price,organization,fk_pays";
|
||||
$tabfieldinsert[DICT_PAPER_FORMAT] = "code,label,width,height,unit";
|
||||
$tabfieldinsert[DICT_PROSPECTLEVEL] = "code,label,sortorder";
|
||||
|
|
@ -2317,7 +2317,7 @@ if ($id > 0) {
|
|||
$canbedisabled = 0;
|
||||
}
|
||||
}
|
||||
if ($id == DICT_TYPE_CONTAINER && in_array($obj->code, array('banner', 'blogpost', 'menu', 'page', 'other', 'service', 'library'))) {
|
||||
if ($id == DICT_TYPE_CONTAINER && $obj->module == 'system') {
|
||||
$iserasable = 0;
|
||||
$canbedisabled = 0;
|
||||
if (in_array($obj->code, array('banner'))) {
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'em
|
|||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ');
|
||||
$groupby = GETPOST('mode', 'aZ09');
|
||||
|
||||
$id = GETPOSTINT('id');
|
||||
|
||||
|
|
@ -103,7 +104,7 @@ if ($user->socid > 0) { // Protection if external user
|
|||
//$result = restrictedArea($user, 'emailcollector', $id, '');
|
||||
|
||||
// Initialize array of search criteria
|
||||
$search_all = GETPOST('search_all', 'alphanohtml');
|
||||
$search_all = trim(GETPOST('search_all', 'alphanohtml'));
|
||||
$search = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (GETPOST('search_'.$key, 'alpha') !== '') {
|
||||
|
|
@ -169,7 +170,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
|||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$parameters = array('arrayfields' => &$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
|
@ -188,6 +189,7 @@ if (empty($reshook)) {
|
|||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$search_all = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
|
@ -200,6 +202,8 @@ if (empty($reshook)) {
|
|||
$objectclass = 'EmailCollector';
|
||||
$objectlabel = 'EmailCollector';
|
||||
$uploaddir = $conf->emailcollector->dir_output;
|
||||
|
||||
global $error;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
|
||||
|
|
@ -221,19 +225,22 @@ $morecss = array();
|
|||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
$sql = 'SELECT ';
|
||||
$sql .= $object->getFieldList('t');
|
||||
$sql = "SELECT";
|
||||
$sql .= " ".$object->getFieldList('t');
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : "");
|
||||
}
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
|
|
@ -279,15 +286,25 @@ if ($search_all) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
$sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
|
||||
$sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$resql = $db->query($sqlforcount);
|
||||
if ($resql) {
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
|
@ -309,7 +326,7 @@ if (!$resql) {
|
|||
$num = $db->num_rows($resql);
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
|
||||
if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/emailcollector/emailcollector_card.php?id='.$id);
|
||||
|
|
@ -341,14 +358,23 @@ print dol_get_fiche_head($head, 'common', '', -1);
|
|||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
$param = '';
|
||||
if (!empty($mode)) {
|
||||
$param .= '&mode='.urlencode($mode);
|
||||
}
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
||||
$param .= '&contextpage='.urlencode($contextpage);
|
||||
}
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.((int) $limit);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($groupby != '') {
|
||||
$param .= '&groupby='.urlencode($groupby);
|
||||
}
|
||||
foreach ($search as $key => $val) {
|
||||
if (is_array($search[$key]) && count($search[$key])) {
|
||||
if (is_array($search[$key])) {
|
||||
foreach ($search[$key] as $skey) {
|
||||
if ($skey != '') {
|
||||
$param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||
|
|
@ -425,19 +451,20 @@ if (!empty($moreforfilter)) {
|
|||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
|
||||
$htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields with user setup
|
||||
$selectedfields = (($mode != 'kanban' && $mode != 'kanbangroupby') ? $htmlofselectarray : '');
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
print '<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
// Fields title search
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
print '<td class="liste_titre center maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
|
@ -450,7 +477,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
|
|
@ -481,11 +508,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
|||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields' => $arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
print '<td class="liste_titre center maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
|
@ -498,8 +525,10 @@ $totalarray['nbfield'] = 0;
|
|||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
|
|
@ -509,12 +538,12 @@ foreach ($object->fields as $key => $val) {
|
|||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
$cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
|
@ -522,11 +551,12 @@ foreach ($object->fields as $key => $val) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, 'totalarray' => &$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
$totalarray['nbfield']++;
|
||||
print '</tr>'."\n";
|
||||
|
|
@ -547,6 +577,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar
|
|||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
|
|
@ -558,7 +589,7 @@ while ($i < $imaxinloop) {
|
|||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
if ($mode == 'kanban') {
|
||||
if ($mode == 'kanban' || $mode == 'kanbangroupby') {
|
||||
if ($i == 0) {
|
||||
print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
|
|
@ -577,7 +608,7 @@ while ($i < $imaxinloop) {
|
|||
print '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
// Show here line of result
|
||||
// Show line of result
|
||||
$j = 0;
|
||||
print '<tr data-rowid="'.$object->id.'" class="oddeven">';
|
||||
// Action column
|
||||
|
|
@ -591,7 +622,11 @@ while ($i < $imaxinloop) {
|
|||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Fields
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
|
|
@ -601,32 +636,34 @@ while ($i < $imaxinloop) {
|
|||
}
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
|
||||
} elseif ($key == 'ref') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowraponall';
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.((preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) ? ' classfortooltip' : '').'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key) && !in_array($key, array('ref'))) {
|
||||
print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'status') {
|
||||
print $object->getLibStatut(5);
|
||||
} elseif ($key == 'lastresult') {
|
||||
print '<div class="twolinesmax">';
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
print '</div>';
|
||||
} elseif ($key == 'rowid') {
|
||||
print $object->showOutputField($val, $key, (string) $object->id, '');
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
if ($val['type'] == 'html' || $key == 'lastresult') {
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">';
|
||||
}
|
||||
print $object->showOutputField($val, $key, (string) $object->$key, '');
|
||||
if ($val['type'] == 'html' || $key == 'lastresult') {
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
|
@ -650,7 +687,7 @@ while ($i < $imaxinloop) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields' => $arrayfields, 'object' => $object, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
|
|
@ -663,9 +700,9 @@ while ($i < $imaxinloop) {
|
|||
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
|
@ -693,7 +730,7 @@ if ($num == 0) {
|
|||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields' => $arrayfields, 'sql' => $sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
|
|
|
|||
|
|
@ -458,7 +458,6 @@ if ($action == 'set' && $user->admin) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
|
@ -1341,8 +1340,11 @@ if ($mode == 'marketplace') {
|
|||
</div>
|
||||
<div class="divsearchfield">
|
||||
<input name="buttonsubmit" class="button buttongen reposition" value="<?php echo $langs->trans('Search') ?>" type="submit">
|
||||
<a class="buttonreset reposition" href="<?php echo $_SERVER["PHP_SELF"].'?mode=marketplace'; ?>"><?php echo $langs->trans('Reset') ?></a>
|
||||
|
||||
<?php
|
||||
if ($search_keyword !== '') {
|
||||
print '<a class="buttonreset reposition" href="'.$_SERVER["PHP_SELF"].'?mode=marketplace">'.$langs->trans('Reset').'</a>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/openid_connect.lib.php';
|
|||
* @var User $user
|
||||
*/
|
||||
|
||||
$langs->loadLangs(["admin", "openidconnect"]);
|
||||
$langs->loadLangs(array("users", "admin", "other"));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
|
|
@ -126,14 +126,17 @@ if ($action != '') {
|
|||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
|
||||
llxHeader('', $langs->trans("Miscellaneous"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-security_other');
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("OpenIDconnectSetup"), $linkback, 'title_setup');
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup');
|
||||
|
||||
$head = openid_connect_prepare_head();
|
||||
print '<span class="opacitymedium">'.$langs->trans("OpenIDDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans("Parameters"), -1, 'action');
|
||||
$head = security_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'openid', '', -1);
|
||||
|
||||
print $langs->trans("SeeWikiDocForHelpInSetupOpenIDCOnnect");
|
||||
print ' - ';
|
||||
|
|
|
|||
|
|
@ -460,8 +460,8 @@ class ExternalModules
|
|||
|
||||
// Set and check version
|
||||
$version = '';
|
||||
if ($this->version_compare($product["dolibarr_min"], $dolibarrversiontouse) <= 0) {
|
||||
if (!empty($product["dolibarr_max"]) && $product["dolibarr_max"] != 'auto' && $product["dolibarr_max"] != 'unknown' && $this->version_compare($product["dolibarr_max"], $dolibarrversiontouse) >= 0) {
|
||||
if ($this->versionCompare($product["dolibarr_min"], $dolibarrversiontouse) <= 0) {
|
||||
if (!empty($product["dolibarr_max"]) && $product["dolibarr_max"] != 'auto' && $product["dolibarr_max"] != 'unknown' && $this->versionCompare($product["dolibarr_max"], $dolibarrversiontouse) >= 0) {
|
||||
//compatible
|
||||
$version = '<span class="compatible">'.$langs->trans(
|
||||
'CompatibleUpTo',
|
||||
|
|
@ -508,7 +508,7 @@ class ExternalModules
|
|||
$html .= $newapp.$images; // No dol_escape_htmltag, it is already escape html
|
||||
$html .= '</div></td>';
|
||||
$html .= '<td class="margeCote"><h2 class="appTitle">';
|
||||
$html .= dol_escape_htmltag(dol_string_nohtmltag($product["label"]));
|
||||
$html .= dolPrintHTML(dol_string_nohtmltag($product["label"]));
|
||||
$html .= '<br><small>';
|
||||
$html .= $version; // No dol_escape_htmltag, it is already escape html
|
||||
$html .= '</small></h2>';
|
||||
|
|
@ -518,11 +518,11 @@ class ExternalModules
|
|||
} else {
|
||||
$html .= '<span class="opacitymedium">'.dol_print_date(dol_stringtotime($product['tms']), 'day').'</span>';
|
||||
}
|
||||
$html .= ' - '.$langs->trans('Ref').' '.dol_escape_htmltag($product["ref"]);
|
||||
$html .= ' - '.$langs->trans('Ref').' '.dolPrintHTML($product["ref"]);
|
||||
//$html .= ' - '.dol_escape_htmltag($langs->trans('Id')).': '.((int) $product["id"]);
|
||||
$html .= '</small><br>';
|
||||
$html .= '<small>'.$langs->trans('Source').': '.$product["source"].'</small><br>';
|
||||
$html .= '<br>'.dol_escape_htmltag(dol_string_nohtmltag($product["description"]));
|
||||
$html .= '<br>'.dolPrintHTML(dol_string_nohtmltag($product["description"]));
|
||||
$html .= '</td>';
|
||||
// do not load if display none
|
||||
$html .= '<td class="margeCote center amount">';
|
||||
|
|
@ -568,7 +568,6 @@ class ExternalModules
|
|||
};
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* version compare
|
||||
*
|
||||
|
|
@ -576,9 +575,12 @@ class ExternalModules
|
|||
* @param string $v2 version 2
|
||||
* @return int result of compare
|
||||
*/
|
||||
public function version_compare($v1, $v2)
|
||||
public function versionCompare($v1, $v2)
|
||||
{
|
||||
// phpcs:enable
|
||||
// Clean v1 and v2
|
||||
$v1 = str_replace(array('v', 'V'), '', $v1);
|
||||
$v2 = str_replace(array('v', 'V'), '', $v2);
|
||||
|
||||
$v1 = explode('.', $v1);
|
||||
$v2 = explode('.', $v2);
|
||||
$ret = 0;
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ print '<br>';
|
|||
print img_picto('', 'folder', 'class="pictofixedwidth"');
|
||||
print '<strong>'.$langs->trans("HTTPCacheStaticResources").' - '.$langs->trans("CacheByClient").'</strong><br>';
|
||||
print '<div class="divsection">';
|
||||
print '<div id="httpcachebybrowser">'.img_picto('', 'question.png', 'class="pictofixedwidth"').' '.$langs->trans("TestNotPossibleWithCurrentBrowsers").'</div>';
|
||||
print '<div id="httpcachebybrowser"><span class="opacitymedium">'.img_picto('', 'question.png', 'class="pictofixedwidth"').' '.$langs->trans("TestNotPossibleWithCurrentBrowsers").'</span></div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
|
@ -704,7 +704,8 @@ if (getDolGlobalInt('MAIN_ACTIVATE_FILECACHE')) {
|
|||
print img_picto('', 'minus', 'class="pictofixedwidth"');
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("EnableFileCache").' ('.$langs->trans("Widgets").')', $langs->trans("Option").' MAIN_ACTIVATE_FILECACHE');
|
||||
print ': '.yn(getDolGlobalInt('MAIN_ACTIVATE_FILECACHE'));
|
||||
print ': ';
|
||||
print yn(getDolGlobalInt('MAIN_ACTIVATE_FILECACHE'));
|
||||
print '<br>';
|
||||
|
||||
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
||||
|
|
@ -712,7 +713,8 @@ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
|
|||
} else {
|
||||
print img_picto('', 'minus', 'class="pictofixedwidth"');
|
||||
}
|
||||
print 'MAIN_ENABLE_AJAX_TOOLTIP : ';
|
||||
print $form->textwithpicto($langs->trans('MAIN_ENABLE_AJAX_TOOLTIP'), $langs->trans("Option").' MAIN_ENABLE_AJAX_TOOLTIP');
|
||||
print ': ';
|
||||
print yn(getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP'));
|
||||
print '<br>';
|
||||
|
||||
|
|
@ -722,7 +724,8 @@ if (getDolGlobalInt('MAIN_CACHE_COUNT')) {
|
|||
} else {
|
||||
print img_picto('', 'minus', 'class="pictofixedwidth"');
|
||||
}
|
||||
print 'MAIN_CACHE_COUNT : ';
|
||||
print $form->textwithpicto($langs->trans('MAIN_CACHE_COUNT'), $langs->trans("Option").' MAIN_CACHE_COUNT');
|
||||
print ': ';
|
||||
print yn(getDolGlobalInt('MAIN_CACHE_COUNT'));
|
||||
//.' '.img_picto('', 'warning.png');
|
||||
print '<br>';
|
||||
|
|
@ -741,7 +744,8 @@ if (getDolGlobalInt('MAIN_DO_FETCH_IN_ONE_SQL_REQUEST')) {
|
|||
} else {
|
||||
print img_picto('', 'minus', 'class="pictofixedwidth"');
|
||||
}
|
||||
print 'MAIN_DO_FETCH_IN_ONE_SQL_REQUEST = '.getDolGlobalString('MAIN_DO_FETCH_IN_ONE_SQL_REQUEST', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print $form->textwithpicto($langs->trans('MAIN_DO_FETCH_IN_ONE_SQL_REQUEST'), $langs->trans("Option").' MAIN_DO_FETCH_IN_ONE_SQL_REQUEST');
|
||||
print ' = '.getDolGlobalString('MAIN_DO_FETCH_IN_ONE_SQL_REQUEST', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
//print ' ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
|
||||
print '<br>';
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ if ($action == 'updateMask') {
|
|||
include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
|
||||
|
||||
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
|
||||
$notification_email_description = "Sender of ticket replies sent from Dolibarr";
|
||||
$notification_email_description = "Email of user allowed to send ticket replies from Dolibarr";
|
||||
if (!empty($notification_email)) {
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, $notification_email_description, $conf->entity);
|
||||
} else { // If an empty e-mail address is providen, use the global "FROM" since an empty field will cause other issues
|
||||
|
|
@ -208,6 +208,17 @@ if ($action == 'updateMask') {
|
|||
$error++;
|
||||
}
|
||||
|
||||
$notification_email_replyto = GETPOST('TICKET_NOTIFICATION_EMAIL_REPLYTO', 'alpha');
|
||||
$notification_email_replyto_description = "Email that must appears as the sender of ticket replies sent from Dolibarr";
|
||||
if (!empty($notification_email)) {
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_REPLYTO', $notification_email_replyto, 'chaine', 0, $notification_email_replyto_description, $conf->entity);
|
||||
} else {
|
||||
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_REPLYTO', getDolGlobalString('MAIN_MAIL_EMAIL_FROM'), 'chaine', 0, $notification_email_replyto_description, $conf->entity);
|
||||
}
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
// altairis : differentiate notification email FROM and TO
|
||||
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
|
||||
$notification_email_to_description = "Notified e-mail for ticket replies sent from Dolibarr";
|
||||
|
|
@ -645,7 +656,7 @@ if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) {
|
|||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// Email to send notifications
|
||||
// Email of sender allowed to send technical notifications
|
||||
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_FROM" class="block">'.$langs->trans("TicketEmailNotificationFrom").'</label></td>';
|
||||
print '<td class="left">';
|
||||
print img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
|
|
@ -655,6 +666,16 @@ print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationFro
|
|||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Email that must appears as the sender of email notifications
|
||||
print '<tr class="oddeven"><td><label for="TICKET_NOTIFICATION_EMAIL_REPLYTO" class="block">'.$langs->trans("TicketEmailNotificationReplyTo").'</label></td>';
|
||||
print '<td class="left">';
|
||||
print img_picto('', 'email', 'class="pictofixedwidth"');
|
||||
print '<input type="text" class="minwidth200" id="TICKET_NOTIFICATION_EMAIL_REPLYTO" name="TICKET_NOTIFICATION_EMAIL_REPLYTO" value="' . getDolGlobalString('TICKET_NOTIFICATION_EMAIL_REPLYTO').'"></td>';
|
||||
print '<td class="center">';
|
||||
print $formcategory->textwithpicto('', $langs->trans("TicketEmailNotificationReplyToHelp"), 1, 'help');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td class="titlefieldmiddle"><label for="TICKET_SEND_INTERNAL_CC" class="block">';
|
||||
print $form->textwithpicto($langs->trans("TicketSendToInternalCC"), $langs->trans("TicketSendToInternalCCHelp")).'</label></td>';
|
||||
print '<td>';
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ $search_user = GETPOST("search_user", "alpha");
|
|||
$search_desc = GETPOST("search_desc", "alpha");
|
||||
$search_ua = GETPOST("search_ua", "restricthtml");
|
||||
$search_prefix_session = GETPOST("search_prefix_session", "restricthtml");
|
||||
$search_entity = ($user->entity > 0 ? $user->entity : GETPOSTINT('search_entity'));
|
||||
$search_entity = ($user->entity > 0 ? $user->entity : GETPOSTINT('search_entity')); // TODO Replace with $search_entity = GETPOSTINT('search_entity') when the filter is available on screen for this page
|
||||
|
||||
$now = dol_now();
|
||||
$nowarray = dol_getdate($now);
|
||||
|
|
|
|||
|
|
@ -650,8 +650,8 @@ if ($mode == 'searchkey') {
|
|||
}
|
||||
print '<span title="'.dolPrintHTMLForAttribute($titleforvalue).'" class="classfortooltip">';
|
||||
print dolPrintHTML($val);
|
||||
if (substr_count($langsenfileonly->tab_translate[$key], '%s') > 4) {
|
||||
print '<br><div class="warning">Error, more than 4 %s in the source</div>';
|
||||
if (substr_count($langsenfileonly->tab_translate[$key], '%s') > 5) {
|
||||
print '<br><div class="warning">Error, more than 5 %s in the source</div>';
|
||||
}
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class Ai
|
|||
}
|
||||
}
|
||||
|
||||
dol_syslog("Call API for apiKey=".substr($this->apiKey, 0, 3).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model);
|
||||
dol_syslog("Call API for apiKey=".substr($this->apiKey, 0, 5).'***********, apiEndpoint='.$this->apiEndpoint.", model=".$model);
|
||||
|
||||
try {
|
||||
if (empty($this->apiEndpoint)) {
|
||||
|
|
@ -256,7 +256,7 @@ class Ai
|
|||
throw new Exception('API request failed. No http received');
|
||||
}
|
||||
if (!empty($response['http_code']) && $response['http_code'] != 200) {
|
||||
if ($response['http_code'] == 400 && !empty($response['content'])) {
|
||||
if (in_array($response['http_code'], array(400, 401, 403, 429)) && !empty($response['content'])) {
|
||||
$tmp = json_decode($response['content'], true);
|
||||
if (!empty($tmp['message'])) {
|
||||
return array(
|
||||
|
|
|
|||
|
|
@ -823,6 +823,9 @@ class Documents extends DolibarrApi
|
|||
} elseif ($modulepart == 'ficheinter' || $modulepart == 'intervention') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
$object = new Fichinter($this->db);
|
||||
} elseif ($modulepart == 'shipment' || $modulepart == 'expedition') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
$object = new Expedition($this->db);
|
||||
} elseif ($modulepart == 'adherent' || $modulepart == 'member') {
|
||||
$modulepart = 'adherent';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
|
|
|
|||
|
|
@ -2260,6 +2260,71 @@ class Setup extends DolibarrApi
|
|||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of thirdparties types.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param int $active Type is active or not {@min 0} {@max 1}
|
||||
* @param string $lang Code of the language the label of the type must be translated to
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of thirdparties types
|
||||
* @phan-return array<Object|false>
|
||||
* @phpstan-return array<Object|false>
|
||||
*
|
||||
* @url GET dictionary/thirdparty_types
|
||||
*
|
||||
* @throws RestException 400 Bad value for sqlfilters
|
||||
* @throws RestException 503 Error when retrieving list of thirdparties types
|
||||
*/
|
||||
public function getThirdpartiesTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT id, code, libelle as label, fk_country, module, position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_typent as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$type = $this->db->fetch_object($result);
|
||||
$this->translateLabel($type, $lang, '', array('companies'));
|
||||
$list[] = $type;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of thirdparty types : '.$this->db->lasterror());
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of incoterms.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -294,19 +294,16 @@ if ($action == 'initbarcodeproducts' && $user->hasRight('produit', 'lire')) {
|
|||
|
||||
llxHeader('', $langs->trans("MassBarcodeInit"), '', '', 0, 0, '', '', '', 'mod-barcode page-codeinit');
|
||||
|
||||
print load_fiche_titre($langs->trans("MassBarcodeInit"), '', 'title_setup.png');
|
||||
print '<br>';
|
||||
if (!GETPOST('dol_openinpopup', 'aZ')) {
|
||||
print load_fiche_titre($langs->trans("MassBarcodeInit"), '', 'title_setup.png');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("MassBarcodeInitDesc").'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
//print img_picto('','puce').' '.$langs->trans("PrintsheetForOneBarCode").'<br>';
|
||||
//print '<br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
// Example 1 : Adding jquery code
|
||||
print '<script type="text/javascript">
|
||||
function confirm_erase() {
|
||||
|
|
@ -315,77 +312,13 @@ function confirm_erase() {
|
|||
</script>';
|
||||
|
||||
|
||||
// For thirdparty
|
||||
if (isModEnabled('societe')) {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodethirdparties">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$nbthirdpartyno = $nbthirdpartytotal = 0;
|
||||
|
||||
print '<div class="divsection">';
|
||||
|
||||
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
|
||||
|
||||
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbthirdpartyno = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE entity IN (".getEntity('societe').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbthirdpartytotal = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbthirdpartyno, $nbthirdpartytotal, $langs->transnoentitiesnoconv("ThirdParties"))."\n";
|
||||
|
||||
$disabledthirdparty = $disabledthirdparty1 = 0;
|
||||
$titleno = '';
|
||||
|
||||
if (is_object($modBarCodeThirdparty)) {
|
||||
print '<br>'.$langs->trans("BarCodeNumberManager").": ";
|
||||
$objthirdparty = new Societe($db);
|
||||
print '<b>'.(isset($modBarCodeThirdparty->name) ? $modBarCodeThirdparty->name : $modBarCodeThirdparty->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeThirdparty->getNextValue($objthirdparty).'</b><br>';
|
||||
$disabledthirdparty = 0;
|
||||
print '<br>';
|
||||
} else {
|
||||
$disabledthirdparty = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<div class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<br><a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
if (empty($nbthirdpartyno)) {
|
||||
$disabledthirdparty1 = 1;
|
||||
}
|
||||
|
||||
$moretagsthirdparty1 = (($disabledthirdparty || $disabledthirdparty1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" value="'.$langs->trans("InitEmptyBarCode", $nbthirdpartyno).'"'.$moretagsthirdparty1.'>';
|
||||
$moretagsthirdparty2 = (($nbthirdpartyno == $nbthirdpartytotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallthirdpartybarcode" id="eraseallthirdpartybarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsthirdparty2.' onClick="return confirm_erase();">';
|
||||
print '<br><br>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
// For products
|
||||
if (isModEnabled('product') || isModEnabled('service')) {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodeproducts">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="dol_openinpopup" value="'.GETPOST('dol_openinpopup', 'aZ').'">';
|
||||
|
||||
$nbproductno = $nbproducttotal = 0;
|
||||
|
||||
|
|
@ -459,6 +392,74 @@ if (isModEnabled('product') || isModEnabled('service')) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
// For thirdparty
|
||||
if (isModEnabled('societe')) {
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="initbarcodethirdparties">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="dol_openinpopup" value="'.GETPOST('dol_openinpopup', 'aZ').'">';
|
||||
|
||||
$nbthirdpartyno = $nbthirdpartytotal = 0;
|
||||
|
||||
print '<div class="divsection">';
|
||||
|
||||
print load_fiche_titre($langs->trans("BarcodeInitForThirdparties"), '', 'company');
|
||||
|
||||
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbthirdpartyno = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$sql = "SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE entity IN (".getEntity('societe').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nbthirdpartytotal = $obj->nb;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print $langs->trans("CurrentlyNWithoutBarCode", $nbthirdpartyno, $nbthirdpartytotal, $langs->transnoentitiesnoconv("ThirdParties"))."\n";
|
||||
|
||||
$disabledthirdparty = $disabledthirdparty1 = 0;
|
||||
$titleno = '';
|
||||
|
||||
if (is_object($modBarCodeThirdparty)) {
|
||||
print '<br>'.$langs->trans("BarCodeNumberManager").": ";
|
||||
$objthirdparty = new Societe($db);
|
||||
print '<b>'.(isset($modBarCodeThirdparty->name) ? $modBarCodeThirdparty->name : $modBarCodeThirdparty->nom).'</b> - '.$langs->trans("NextValue").': <b>'.$modBarCodeThirdparty->getNextValue($objthirdparty).'</b><br>';
|
||||
$disabledthirdparty = 0;
|
||||
print '<br>';
|
||||
} else {
|
||||
$disabledthirdparty = 1;
|
||||
$titleno = $langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<div class="warning">'.$langs->trans("NoBarcodeNumberingTemplateDefined");
|
||||
print '<br><a href="'.DOL_URL_ROOT.'/admin/barcode.php">'.$langs->trans("ToGenerateCodeDefineAutomaticRuleFirst").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
if (empty($nbthirdpartyno)) {
|
||||
$disabledthirdparty1 = 1;
|
||||
}
|
||||
|
||||
$moretagsthirdparty1 = (($disabledthirdparty || $disabledthirdparty1) ? ' disabled title="'.dol_escape_htmltag($titleno).'"' : '');
|
||||
print '<input class="button button-add" type="submit" id="submitformbarcodethirdpartygen" value="'.$langs->trans("InitEmptyBarCode", $nbthirdpartyno).'"'.$moretagsthirdparty1.'>';
|
||||
$moretagsthirdparty2 = (($nbthirdpartyno == $nbthirdpartytotal) ? ' disabled' : '');
|
||||
print ' ';
|
||||
print '<input type="submit" class="button butActionDelete" name="eraseallthirdpartybarcode" id="eraseallthirdpartybarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretagsthirdparty2.' onClick="return confirm_erase();">';
|
||||
print '<br><br>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
print '<div class="divsection">';
|
||||
|
||||
print load_fiche_titre($langs->trans("BarCodePrintsheet"), '', 'generic');
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('mrp', 'other'));
|
||||
|
||||
// Get Parameters
|
||||
$id = GETPOSTINT('id');
|
||||
// Get parameters
|
||||
$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
$show_files = GETPOSTINT('show_files'); // Show files area generated by bulk actions ?
|
||||
|
|
@ -55,6 +54,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
|||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ'); // mode view (kanban or common)
|
||||
|
||||
$id = GETPOSTINT('id');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
|
|
@ -104,8 +104,8 @@ foreach ($object->fields as $key => $val) {
|
|||
}
|
||||
}
|
||||
|
||||
$fieldstosearchall = array();
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!empty($val['searchall'])) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
|
|
@ -139,7 +139,6 @@ $permissiontodelete = $user->hasRight('bom', 'delete');
|
|||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
// Protection if external user
|
||||
accessforbidden();
|
||||
}
|
||||
$result = restrictedArea($user, 'bom');
|
||||
|
|
@ -172,11 +171,15 @@ if (empty($reshook)) {
|
|||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
if ($key == 'status') {
|
||||
$search[$key] = -1;
|
||||
}
|
||||
if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
$search[$key.'_dtstart'] = '';
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$search_all = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
|
@ -188,8 +191,6 @@ if (empty($reshook)) {
|
|||
// Mass actions
|
||||
$objectclass = 'BOM';
|
||||
$objectlabel = 'BillOfMaterials';
|
||||
$permissiontoread = $user->hasRight('bom', 'read');
|
||||
$permissiontodelete = $user->hasRight('bom', 'delete');
|
||||
$uploaddir = $conf->bom->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
|
|
@ -373,7 +374,7 @@ $sql .= $hookmanager->resPrint;
|
|||
/* If a group by is required
|
||||
$sql.= " GROUP BY ";
|
||||
foreach($object->fields as $key => $val) {
|
||||
$sql .= "t.".$db->escape($key).", ";
|
||||
$sql .= "t.".$db->sanitize($key).", ";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
|
|
@ -551,7 +552,7 @@ $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arra
|
|||
$selectedfields = ($mode != 'kanban' ? $htmlofselectarray : '');
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
|
||||
|
|
@ -740,6 +741,7 @@ while ($i < $imaxinloop) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Fields
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
|
|
@ -761,7 +763,7 @@ while ($i < $imaxinloop) {
|
|||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : '');
|
||||
if (preg_match('/tdoverflow/', $cssforfield) && !in_array($val['type'], array('ip', 'url')) && !is_numeric($object->$key)) {
|
||||
print ' title="'.dol_escape_htmltag((string) $object->$key).'"';
|
||||
print ' title="'.dolPrintHTMLForAttribute((string) $object->$key).'"';
|
||||
}
|
||||
print '>';
|
||||
if ($key == 'status') {
|
||||
|
|
@ -769,7 +771,13 @@ while ($i < $imaxinloop) {
|
|||
} elseif ($key == 'rowid') {
|
||||
print $object->showOutputField($val, $key, (string) $object->id, '');
|
||||
} else {
|
||||
print $object->showOutputField($val, $key, $object->$key, '');
|
||||
if ($val['type'] == 'html') {
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">';
|
||||
}
|
||||
print $object->showOutputField($val, $key, (string) $object->$key, '');
|
||||
if ($val['type'] == 'html') {
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
|
|
|
|||
|
|
@ -483,7 +483,10 @@ if ($mode == 'hierarchy') {
|
|||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$param).$param, '', $permissiontoadd);
|
||||
|
||||
$morehtmlrightbeforebutton = '<a class="small paddingright marginrightonly" href="'.DOL_URL_ROOT.'/categories/index.php">'.$langs->trans("BackToCategoryTypes").'</a> ';
|
||||
$morehtmlrightbeforebutton = '';
|
||||
if (!GETPOST('dol_openinpopup', 'aZ')) {
|
||||
$morehtmlrightbeforebutton = '<a class="small paddingright marginrightonly" href="'.DOL_URL_ROOT.'/categories/index.php">'.$langs->trans("BackToCategoryTypes").'</a> ';
|
||||
}
|
||||
|
||||
print_barre_liste($title, 0, $_SERVER["PHP_SELF"], $param, '', '', '', 0, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', 0, 0, 0, 1, $morehtmlrightbeforebutton);
|
||||
|
||||
|
|
@ -610,7 +613,10 @@ if ($mode == 'hierarchy') {
|
|||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$param).$param, '', $permissiontoadd);
|
||||
|
||||
$morehtmlrightbeforebutton = '<a class="small paddingright marginrightonly" href="'.DOL_URL_ROOT.'/categories/index.php">'.$langs->trans("BackToCategoryTypes").'</a> ';
|
||||
$morehtmlrightbeforebutton = '';
|
||||
if (!GETPOST('dol_openinpopup', 'aZ')) {
|
||||
$morehtmlrightbeforebutton = '<a class="small paddingright marginrightonly" href="'.DOL_URL_ROOT.'/categories/index.php">'.$langs->trans("BackToCategoryTypes").'</a> ';
|
||||
}
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1, $morehtmlrightbeforebutton);
|
||||
|
||||
|
|
|
|||
|
|
@ -1744,7 +1744,7 @@ if ($action == 'create') {
|
|||
print '$(document).ready(function () {
|
||||
$("#projectid").change(function () {
|
||||
var url = "'.DOL_URL_ROOT.'/projet/ajax/projects.php?mode=gettasks&socid="+$("#search_socid").val()+"&projectid="+$("#projectid").val();
|
||||
console.log("Call url to get new list of tasks: "+url);
|
||||
console.log("Call url to get the new list of tasks: "+url);
|
||||
$.get(url, function(data) {
|
||||
console.log(data);
|
||||
if (data) $("#taskid").html(data).select2();
|
||||
|
|
@ -1765,7 +1765,15 @@ if ($action == 'create') {
|
|||
|
||||
$tid = GETPOSTISSET("projecttaskid") ? GETPOSTINT("projecttaskid") : (GETPOSTISSET("taskid") ? GETPOSTINT("taskid") : '');
|
||||
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', (string) $projectsListId);
|
||||
if (empty($projectsListId)) {
|
||||
print '<select class="valignmiddle flat maxwidth500 widthcentpercentminusxx minwidth150imp" id="taskid" name="taskid">';
|
||||
print '<option class="opacitymedium"> </option>';
|
||||
print '<option class="opacitymedium" disabled data-html="'.dolPrintHTMLForAttribute($langs->trans("SelectAProjectFirst")).'">'.$langs->trans("SelectAProjectFirst").'</option>';
|
||||
print '</select>';
|
||||
print ajax_combobox('taskid');
|
||||
} else {
|
||||
print $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 32, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', (string) $projectsListId, 'all', null, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
|
@ -2318,7 +2326,7 @@ if ($id > 0 && $action != 'create') {
|
|||
})';
|
||||
print '</script>'."\n";
|
||||
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $object->fk_element, 'fk_element', 24, 0, '', 1, 0, 0, 'maxwidth500', (string) $object->fk_project);
|
||||
print $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $object->fk_element, 'fk_element', 24, 0, '', 1, 0, 0, 'maxwidth500', (string) $object->fk_project, 'all', null, 1);
|
||||
print '<input type="hidden" name="elementtype" value="'.$object->elementtype.'">';
|
||||
|
||||
print '</td>';
|
||||
|
|
@ -2349,7 +2357,7 @@ if ($id > 0 && $action != 'create') {
|
|||
$tid = GETPOSTINT("taskid");
|
||||
}
|
||||
|
||||
$formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', (string) $projectsListId);
|
||||
print $formproject->selectTasks((!empty($societe->id) ? $societe->id : -1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500 widthcentpercentminusxx', (string) $projectsListId, 'all', null, 1);
|
||||
|
||||
print '</td>';
|
||||
} else {
|
||||
|
|
@ -2632,7 +2640,7 @@ if ($id > 0 && $action != 'create') {
|
|||
}
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td title="'.dol_print_date($object->datep, 'dayhoursec', 'tzuserrel').'">';
|
||||
// Test a date before the 27 march and one after
|
||||
//print dol_print_date($object->datep, 'dayhour', 'gmt');
|
||||
//print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
|
|
@ -2650,7 +2658,7 @@ if ($id > 0 && $action != 'create') {
|
|||
print '</tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td title="'.dol_print_date($object->datef, 'dayhoursec', 'tzuserrel').'">';
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuserrel');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -326,6 +326,11 @@ class ActionComm extends CommonObject
|
|||
*/
|
||||
public $email_from;
|
||||
|
||||
/**
|
||||
* @var string Email reply to
|
||||
*/
|
||||
public $email_reply_to;
|
||||
|
||||
/**
|
||||
* @var string Email sender
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,6 +52,13 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|||
$MAXAGENDA = getDolGlobalString('AGENDA_EXT_NB', 5);
|
||||
$DELAYFORCACHE = 300; // 300 seconds
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
if (empty($mode) && preg_match('/show_/', $action)) {
|
||||
$mode = $action; // For backward compatibility
|
||||
}
|
||||
|
||||
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
|
||||
|
||||
$check_holiday = GETPOSTINT('check_holiday');
|
||||
|
|
@ -68,13 +75,15 @@ if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) {
|
|||
|
||||
$newparam = '';
|
||||
|
||||
// Pagination parameters
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
|
||||
if (empty($page) || $page == -1) {
|
||||
if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
||||
// If $page is not defined, or '' or -1 or if we click on clear filters
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
|
|
@ -103,12 +112,6 @@ if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { //
|
|||
$filtert = (string) $user->id;
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
if (empty($mode) && preg_match('/show_/', $action)) {
|
||||
$mode = $action; // For backward compatibility
|
||||
}
|
||||
$resourceid = GETPOSTINT("search_resourceid");
|
||||
$year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y");
|
||||
$month = GETPOSTINT("month") ? GETPOSTINT("month") : date("m");
|
||||
|
|
@ -118,7 +121,6 @@ $pid = GETPOSTISSET("search_projectid") ? GETPOSTINT("search_projectid", 3) : GE
|
|||
$status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09'); // status may be 0, 50, 100, 'todo', 'na' or -1
|
||||
$type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'aZ09') : GETPOST("type", 'aZ09');
|
||||
$maxprint = GETPOSTISSET("maxprint") ? GETPOSTINT("maxprint") : getDolGlobalInt('AGENDA_MAX_EVENTS_DAY_VIEW', 3);
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$dateselect = dol_mktime(0, 0, 0, GETPOSTINT('dateselectmonth'), GETPOSTINT('dateselectday'), GETPOSTINT('dateselectyear'));
|
||||
if ($dateselect > 0) {
|
||||
|
|
@ -191,7 +193,7 @@ if (GETPOST("viewlist", 'alpha') || $mode == 'show_list') {
|
|||
if ($key == 'token') {
|
||||
continue;
|
||||
}
|
||||
$param .= '&'.$key.'='.urlencode($val);
|
||||
$param .= '&'.urlencode($key).'='.urlencode($val);
|
||||
}
|
||||
}
|
||||
if (!preg_match('/action=/', $param)) {
|
||||
|
|
@ -209,7 +211,7 @@ if (GETPOST("viewperuser", 'alpha') || $mode == 'show_peruser') {
|
|||
if ($key == 'token') {
|
||||
continue;
|
||||
}
|
||||
$param .= '&'.$key.'='.urlencode($val);
|
||||
$param .= '&'.urlencode($key).'='.urlencode($val);
|
||||
}
|
||||
}
|
||||
//print $param;
|
||||
|
|
@ -755,29 +757,41 @@ $sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,';
|
|||
$sql .= ' a.fk_element, a.elementtype,';
|
||||
$sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto';
|
||||
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sqlfields = $sql; // $sql fields to remove for count total
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as ca, ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($filtert > 0) {
|
||||
$sql .= " AND ar.fk_element = ".((int) $filtert);
|
||||
if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) {
|
||||
// TODO Replace with a AND EXISTS
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
|
||||
if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') {
|
||||
$sql .= " AND (ar.fk_element IN (".$db->sanitize($filtert).") OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert)."))"; // The OR is for backward compatibility
|
||||
} elseif ($filtert == '-3') {
|
||||
$sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
|
||||
}
|
||||
}
|
||||
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
}
|
||||
$sql .= ' WHERE a.fk_action = ca.id';
|
||||
$sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // bookcal is a "virtual view" of agenda
|
||||
|
||||
// Add table from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " WHERE a.fk_action = ca.id";
|
||||
$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda
|
||||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
|
|
@ -794,14 +808,27 @@ if (!empty($actioncode)) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if ($actioncode == 'AC_NON_AUTO') {
|
||||
if ($actioncode === 'AC_NON_AUTO') {
|
||||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
} elseif ($actioncode === 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} elseif (/* !empty($actioncode) && */ $actioncode !== '-1') {
|
||||
} else {
|
||||
if (is_array($actioncode)) {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
|
||||
} else {
|
||||
// Remove all -1 values
|
||||
$actioncode = array_filter(
|
||||
$actioncode,
|
||||
/**
|
||||
* @param string $value
|
||||
* @return bool
|
||||
*/
|
||||
function ($value) {
|
||||
return ((string) $value !== '-1');
|
||||
}
|
||||
);
|
||||
if (count($actioncode)) {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
|
||||
}
|
||||
} elseif ($actioncode !== '-1') {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", explode(',', $actioncode))."'", 1).")";
|
||||
}
|
||||
}
|
||||
|
|
@ -827,7 +854,7 @@ if ($search_sale && $search_sale != '-1') {
|
|||
}
|
||||
}
|
||||
// Search on socid
|
||||
if ($socid) {
|
||||
if ($socid > 0) {
|
||||
$sql .= " AND a.fk_soc = ".((int) $socid);
|
||||
}
|
||||
//var_dump($day.' '.$month.' '.$year);
|
||||
|
|
@ -876,17 +903,6 @@ if ($status == 'done' || $status == '100') {
|
|||
if ($status == 'todo') {
|
||||
$sql .= " AND (a.percent >= 0 AND a.percent < 100)";
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= " AND (";
|
||||
if ($filtert > 0) {
|
||||
$sql .= "ar.fk_element = ".((int) $filtert);
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
// Search in categories, -1 is all and -2 is no categories
|
||||
if ($search_categ_cus != -1) {
|
||||
|
|
@ -2237,7 +2253,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||
$listofusertoshow .= $cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valignmiddle inline-block');
|
||||
}
|
||||
|
||||
if ($event->type_code != 'BIRTHDAY') {
|
||||
if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') {
|
||||
print $titletoshow;
|
||||
print $listofusertoshow.' ';
|
||||
}
|
||||
|
|
@ -2297,7 +2313,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||
// It's holiday calendar
|
||||
$tmpholiday->fetch($event->id);
|
||||
|
||||
//print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
|
||||
print $tmpholiday->getNomUrl(1, -1, 0, 'valignmiddle inline-block');
|
||||
|
||||
$tmpid = $tmpholiday->fk_user;
|
||||
if (empty($cacheusers[$tmpid])) {
|
||||
|
|
@ -2343,7 +2359,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?mode='.$mode.'&maxprint=0&month='.((int) $monthshown).'&year='.((int) $year);
|
||||
print($status ? '&status='.$status : '').($filter ? '&filter='.urlencode($filter) : '');
|
||||
print($filtert ? '&search_filtert='.urlencode((string) $filtert) : '');
|
||||
print($usergroup ? '&search_usergroup='.urlencode($usergroup) : '');
|
||||
print($usergroup ? '&search_usergroup='.urlencode((string) $usergroup) : '');
|
||||
print($actioncode != '' ? '&search_actioncode='.urlencode($actioncode) : '');
|
||||
print '">'.img_picto("all", "1downarrow_selected.png").' ...';
|
||||
print ' +'.(count($eventarray[$daykey]) - $maxprint);
|
||||
|
|
|
|||
|
|
@ -58,14 +58,13 @@ $cancel = GETPOST('cancel', 'alpha');
|
|||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'actioncommlist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
|
||||
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
if (empty($mode) && preg_match('/show_/', $action)) {
|
||||
$mode = $action; // For backward compatibility
|
||||
}
|
||||
|
||||
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
|
||||
|
||||
$resourceid = GETPOSTINT("search_resourceid") ? GETPOSTINT("search_resourceid") : GETPOSTINT("resourceid");
|
||||
$pid = GETPOSTINT("search_projectid", 3) ? GETPOSTINT("search_projectid", 3) : GETPOSTINT("projectid", 3);
|
||||
$search_status = (GETPOST("search_status", 'aZ09') != '') ? GETPOST("search_status", 'aZ09') : GETPOST("status", 'aZ09');
|
||||
|
|
@ -120,7 +119,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
// If not choice done on calendar owner, we filter on user.
|
||||
if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) {
|
||||
$filtert = $user->id;
|
||||
$filtert = (string) $user->id;
|
||||
}
|
||||
|
||||
// Pagination parameters
|
||||
|
|
@ -163,7 +162,7 @@ if (!$user->hasRight('agenda', 'allactions', 'read')) {
|
|||
$canedit = 0;
|
||||
}
|
||||
if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
$filtert = $user->id;
|
||||
$filtert = (string) $user->id;
|
||||
}
|
||||
|
||||
$arrayfields = array(
|
||||
|
|
@ -206,7 +205,7 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday")) {
|
|||
$param = '';
|
||||
if (is_array($_POST)) {
|
||||
foreach ($_POST as $key => $val) {
|
||||
$param .= '&'.$key.'='.urlencode($val);
|
||||
$param .= '&'.urlencode($key).'='.urlencode($val);
|
||||
}
|
||||
}
|
||||
//print $param;
|
||||
|
|
@ -332,10 +331,10 @@ if ($search_status != '') {
|
|||
$param .= "&search_status=".urlencode($search_status);
|
||||
}
|
||||
if ($filter) {
|
||||
$param .= "&search_filter=".urlencode($filter);
|
||||
$param .= "&search_filter=".urlencode((string) $filter);
|
||||
}
|
||||
if ($filtert) {
|
||||
$param .= "&search_filtert=".urlencode($filtert);
|
||||
$param .= "&search_filtert=".urlencode((string) $filtert);
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$param .= "&search_usergroup=".urlencode((string) ($usergroup));
|
||||
|
|
@ -463,11 +462,17 @@ if ($resourceid > 0) {
|
|||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_resources as r ON r.element_type = 'action' AND r.element_id = a.id";
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) {
|
||||
// TODO Replace with a AND EXISTS
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
|
||||
if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') {
|
||||
$sql .= " AND (ar.fk_element IN (".$db->sanitize($filtert).") OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert)."))"; // The OR is for backward compatibility
|
||||
} elseif ($filtert == '-3') {
|
||||
$sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
|
||||
}
|
||||
}
|
||||
|
||||
// Add table from hooks
|
||||
|
|
@ -475,7 +480,7 @@ $parameters = array();
|
|||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda
|
||||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
|
|
@ -546,18 +551,18 @@ if ($type) {
|
|||
$sql .= " AND c.id = ".((int) $type);
|
||||
}
|
||||
if ($search_status == '0') {
|
||||
// To do (not started)
|
||||
$sql .= " AND a.percent = 0";
|
||||
}
|
||||
if ($search_status == 'na') {
|
||||
// Not applicable
|
||||
$sql .= " AND a.percent = -1";
|
||||
} // Not applicable
|
||||
if ($search_status == '50') {
|
||||
$sql .= " AND (a.percent > 0 AND a.percent < 100)";
|
||||
} // Running already started
|
||||
if ($search_status == '100') {
|
||||
$sql .= " AND a.percent = 100";
|
||||
}
|
||||
if ($search_status == 'done') {
|
||||
if ($search_status == '50') {
|
||||
// Running already started
|
||||
$sql .= " AND (a.percent > 0 AND a.percent < 100)";
|
||||
}
|
||||
if ($search_status == 'done' || $search_status == '100') {
|
||||
$sql .= " AND (a.percent = 100)";
|
||||
}
|
||||
if ($search_status == 'todo') {
|
||||
|
|
@ -572,17 +577,6 @@ if ($search_title) {
|
|||
if ($search_note) {
|
||||
$sql .= natural_search('a.note', $search_note);
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= " AND (";
|
||||
if ($filtert > 0) {
|
||||
$sql .= "(ar.fk_element = ".((int) $filtert)." OR (ar.fk_element IS NULL AND a.fk_user_action = ".((int) $filtert)."))"; // The OR is for backward compatibility
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case)
|
||||
if ($dateselect > 0) {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ $action = GETPOST('action', 'aZ09');
|
|||
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
|
||||
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOSTINT("search_filtert", 3) ? GETPOSTINT("search_filtert", 3) : GETPOSTINT("filtert", 3);
|
||||
$filtert = GETPOST("search_filtert", "intcomma", 3) ? GETPOST("search_filtert", "intcomma", 3) : GETPOST("filtert", "intcomma", 3);
|
||||
$usergroup = GETPOSTINT("search_usergroup", 3) ? GETPOSTINT("search_usergroup", 3) : GETPOSTINT("usergroup", 3);
|
||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||
|
||||
|
|
@ -95,8 +95,7 @@ if ($socid < 0) {
|
|||
$socid = '';
|
||||
}
|
||||
|
||||
// Permissions
|
||||
$canedit = 1;
|
||||
$canedit = 1; // can read events of others
|
||||
if (!$user->hasRight('agenda', 'myactions', 'read')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
|
@ -104,7 +103,7 @@ if (!$user->hasRight('agenda', 'allactions', 'read')) {
|
|||
$canedit = 0;
|
||||
}
|
||||
if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { // If no permission to see all, we show only affected to me
|
||||
$filtert = $user->id;
|
||||
$filtert = (string) $user->id;
|
||||
}
|
||||
|
||||
$mode = 'show_pertype';
|
||||
|
|
@ -137,11 +136,11 @@ if ($dateselect > 0) {
|
|||
}
|
||||
|
||||
// working hours
|
||||
$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS;
|
||||
$tmp = getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18');
|
||||
$tmp = str_replace(' ', '', $tmp); // FIX 7533
|
||||
$tmparray = explode('-', $tmp);
|
||||
$begin_h = GETPOSTINT('begin_h') != '' ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||
$end_h = GETPOSTINT('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||
$begin_h = GETPOSTISSET('begin_h') ? GETPOSTINT('begin_h') : ($tmparray[0] != '' ? $tmparray[0] : 9);
|
||||
$end_h = GETPOSTISSET('end_h') ? GETPOSTINT('end_h') : ($tmparray[1] != '' ? $tmparray[1] : 18);
|
||||
if ($begin_h < 0 || $begin_h > 23) {
|
||||
$begin_h = 9;
|
||||
}
|
||||
|
|
@ -196,7 +195,7 @@ $langs->loadLangs(array('users', 'agenda', 'other', 'commercial'));
|
|||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
$hookmanager->initHooks(array('agenda'));
|
||||
|
||||
$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
|
||||
$result = restrictedArea($user, 'agenda', 0, 'actioncomm&societe', 'myactions');
|
||||
if ($user->socid && $socid) {
|
||||
$result = restrictedArea($user, 'societe', $socid);
|
||||
}
|
||||
|
|
@ -283,10 +282,12 @@ if ($status == 'todo') {
|
|||
}
|
||||
|
||||
$param = '';
|
||||
if ($actioncode || GETPOSTISSET('search_actioncode')) {
|
||||
if (($actioncode && $actioncode !== '-1') || GETPOSTISSET('search_actioncode')) {
|
||||
if (is_array($actioncode)) {
|
||||
foreach ($actioncode as $str_action) {
|
||||
$param .= "&search_actioncode[]=".urlencode($str_action);
|
||||
if ($str_action != '-1') {
|
||||
$param .= "&search_actioncode[]=".urlencode($str_action);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$param .= "&search_actioncode=".urlencode($actioncode);
|
||||
|
|
@ -299,7 +300,7 @@ if ($status || GETPOSTISSET('status') || GETPOSTISSET('search_status')) {
|
|||
$param .= "&search_status=".urlencode($status);
|
||||
}
|
||||
if ($filter) {
|
||||
$param .= "&search_filter=".urlencode($filter);
|
||||
$param .= "&search_filter=".urlencode((string) $filter);
|
||||
}
|
||||
if ($filtert) {
|
||||
$param .= "&search_filtert=".urlencode((string) $filtert);
|
||||
|
|
@ -310,7 +311,7 @@ if ($usergroup > 0) {
|
|||
if ($socid > 0) {
|
||||
$param .= "&search_socid=".urlencode((string) ($socid));
|
||||
}
|
||||
if ($showbirthday) {
|
||||
if ($showbirthday) { // Always false @phpstan-suppress-current-line
|
||||
$param .= "&search_showbirthday=1";
|
||||
}
|
||||
if ($pid) {
|
||||
|
|
@ -323,16 +324,16 @@ if ($mode != 'show_pertype') {
|
|||
$param .= '&mode='.urlencode((string) $mode);
|
||||
}
|
||||
if ($begin_h != '') {
|
||||
$param .= '&begin_h='.urlencode($begin_h);
|
||||
$param .= '&begin_h='.((int) $begin_h);
|
||||
}
|
||||
if ($end_h != '') {
|
||||
$param .= '&end_h='.urlencode($end_h);
|
||||
$param .= '&end_h='.((int) $end_h);
|
||||
}
|
||||
if ($begin_d != '') {
|
||||
$param .= '&begin_d='.urlencode((string) ($begin_d));
|
||||
$param .= '&begin_d='.((int) $begin_d);
|
||||
}
|
||||
if ($end_d != '') {
|
||||
$param .= '&end_d='.urlencode((string) ($end_d));
|
||||
$param .= '&end_d='.((int) $end_d);
|
||||
}
|
||||
$param .= "&maxprint=".urlencode((string) ($maxprint));
|
||||
|
||||
|
|
@ -489,7 +490,7 @@ $newcardbutton = '';
|
|||
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
|
||||
$tmpforcreatebutton = dol_getdate(dol_now('tzuserrel'), true);
|
||||
|
||||
$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
|
||||
$newparam .= '&month='.str_pad((string) $month, 2, "0", STR_PAD_LEFT).'&year='.((int) $tmpforcreatebutton['year']);
|
||||
|
||||
$urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
$urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
|
||||
|
|
@ -524,7 +525,7 @@ $eventarray = array();
|
|||
|
||||
|
||||
// DEFAULT CALENDAR + AUTOEVENT CALENDAR + CONFERENCEBOOTH CALENDAR
|
||||
$sql = 'SELECT';
|
||||
$sql = "SELECT";
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " DISTINCT";
|
||||
}
|
||||
|
|
@ -536,20 +537,34 @@ $sql .= ' a.fk_user_author,a.fk_user_action,';
|
|||
$sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,';
|
||||
$sql .= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
|
||||
$sql .= ' ca.code, ca.libelle as type_label, ca.color, ca.type as type_type, ca.picto as type_picto';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
|
||||
// We must filter on resource table
|
||||
if ($resourceid > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) {
|
||||
// TODO Replace with a AND EXISTS
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
|
||||
if ($filtert != '-1' && $filtert != '-2' && $filtert != '-3') {
|
||||
$sql .= " AND ar.fk_element IN (".$db->sanitize($filtert).")";
|
||||
} elseif ($filtert == -3) {
|
||||
$sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
|
||||
}
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element";
|
||||
}
|
||||
$sql .= ' WHERE a.fk_action = ca.id';
|
||||
$sql .= ' AND a.entity IN ('.getEntity('agenda').')';
|
||||
|
||||
$sql .= " WHERE a.fk_action = ca.id";
|
||||
$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda
|
||||
|
||||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
|
|
@ -570,9 +585,16 @@ if (!empty($actioncode)) {
|
|||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} else {
|
||||
} elseif ($actioncode !== '-1' && $actioncode !== '-3') {
|
||||
if (is_array($actioncode)) {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
|
||||
foreach ($actioncode as $key => $val) {
|
||||
if ($val == '-1' || $val == '-2') {
|
||||
unset($actioncode[$key]);
|
||||
}
|
||||
}
|
||||
if (!empty($actioncode)) {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
|
||||
}
|
||||
} else {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", explode(',', $actioncode))."'", 1).")";
|
||||
}
|
||||
|
|
@ -587,7 +609,7 @@ if ($pid) {
|
|||
}
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (!$user->hasRight('societe', 'client', 'voir')) {
|
||||
if (isModEnabled("societe") && !$user->hasRight('societe', 'client', 'voir')) {
|
||||
$search_sale = $user->id;
|
||||
}
|
||||
// Search on sale representative
|
||||
|
|
@ -602,10 +624,7 @@ if ($search_sale && $search_sale != '-1') {
|
|||
if ($socid) {
|
||||
$sql .= " AND a.fk_soc = ".((int) $socid);
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
$sql .= " AND ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
}
|
||||
|
||||
if ($mode == 'show_day') {
|
||||
$sql .= " AND (";
|
||||
$sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
|
||||
|
|
@ -616,7 +635,7 @@ if ($mode == 'show_day') {
|
|||
$sql .= " OR ";
|
||||
$sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year, 'tzuserrel'))."'";
|
||||
$sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year, 'tzuserrel'))."')";
|
||||
$sql .= ')';
|
||||
$sql .= ")";
|
||||
} else {
|
||||
// To limit array
|
||||
$sql .= " AND (";
|
||||
|
|
@ -634,6 +653,7 @@ if ($type) {
|
|||
$sql .= " AND ca.id = ".((int) $type);
|
||||
}
|
||||
if ($status == '0') {
|
||||
// To do (not started)
|
||||
$sql .= " AND a.percent = 0";
|
||||
}
|
||||
if ($status === 'na') {
|
||||
|
|
@ -651,26 +671,33 @@ if ($status == 'todo') {
|
|||
$sql .= " AND (a.percent >= 0 AND a.percent < 100)";
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
if (($filtert > 0 || $filtert == -3) || $usergroup > 0) {
|
||||
// TODO Replace with a AND EXISTS
|
||||
$sql .= " AND (";
|
||||
if ($filtert > 0) {
|
||||
$sql .= "ar.fk_element = ".$filtert;
|
||||
$sql .= "ar.fk_element = ".((int) $filtert);
|
||||
} elseif ($filtert == -3) {
|
||||
$sql .= "ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
|
||||
}
|
||||
$sql .= ")";
|
||||
}
|
||||
|
||||
// Sort on date
|
||||
$sql .= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
||||
$sql .= $db->order("fk_user_action, datep");
|
||||
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/pertype.php", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$MAXONSAMEPAGE = 10000; // Useless to have more. Protection to avoid memory overload when high number of event (for example after a mass import)
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
while ($i < $num && $i < $MAXONSAMEPAGE) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
// Discard auto action if option is on
|
||||
|
|
|
|||
|
|
@ -54,19 +54,14 @@ $DELAYFORCACHE = 300; // 300 seconds
|
|||
|
||||
$disabledefaultvalues = GETPOSTINT('disabledefaultvalues');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$check_holiday = GETPOSTINT('check_holiday');
|
||||
$filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3);
|
||||
$filtert = GETPOSTINT("search_filtert", 3) ? GETPOSTINT("search_filtert", 3) : GETPOSTINT("filtert", 3);
|
||||
$filtert = GETPOST("search_filtert", "intcomma", 3) ? GETPOST("search_filtert", "intcomma", 3) : GETPOST("filtert", "intcomma", 3);
|
||||
$usergroup = GETPOSTINT("search_usergroup", 3) ? GETPOSTINT("search_usergroup", 3) : GETPOSTINT("usergroup", 3);
|
||||
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
|
||||
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
$showbirthday = getDolGlobalInt('AGENDA_ENABLE_SHOW_BIRTHDAY_PER_USER'); // disabled by default
|
||||
|
||||
// If no choice done on calendar owner (like on left menu link "Agenda"), we filter on current user by default.
|
||||
/*if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) {
|
||||
$filtert = (string) $user->id;
|
||||
}*/
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
|
||||
|
|
@ -91,7 +86,7 @@ if ($socid < 0) {
|
|||
$socid = '';
|
||||
}
|
||||
|
||||
$canedit = 1;
|
||||
$canedit = 1; // can read events of others
|
||||
if (!$user->hasRight('agenda', 'myactions', 'read')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
|
@ -102,8 +97,6 @@ if (!$user->hasRight('agenda', 'allactions', 'read') || $filter == 'mine') { //
|
|||
$filtert = (string) $user->id;
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$mode = 'show_peruser';
|
||||
$resourceid = GETPOSTINT("search_resourceid") ? GETPOSTINT("search_resourceid") : GETPOSTINT("resourceid");
|
||||
$year = GETPOSTINT("year") ? GETPOSTINT("year") : date("Y");
|
||||
|
|
@ -133,6 +126,7 @@ if ($dateselect > 0) {
|
|||
$year = GETPOSTINT('dateselectyear');
|
||||
}
|
||||
|
||||
// working hours
|
||||
$tmp = getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18');
|
||||
$tmp = str_replace(' ', '', $tmp); // FIX 7533
|
||||
$tmparray = explode('-', $tmp);
|
||||
|
|
@ -148,6 +142,7 @@ if ($end_h <= $begin_h) {
|
|||
$end_h = $begin_h + 1;
|
||||
}
|
||||
|
||||
// working days
|
||||
$tmp = getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS', '1-5');
|
||||
$tmp = str_replace(' ', '', $tmp); // FIX 7533
|
||||
$tmparray = explode('-', $tmp);
|
||||
|
|
@ -171,19 +166,22 @@ if (empty($mode) && !GETPOSTISSET('mode')) {
|
|||
$mode = getDolGlobalString('AGENDA_DEFAULT_VIEW', 'show_peruser');
|
||||
}
|
||||
|
||||
// View by month
|
||||
if (GETPOST('viewcal', 'alpha') && $mode != 'show_day' && $mode != 'show_week' && $mode != 'show_peruser') {
|
||||
$mode = 'show_month';
|
||||
$day = '';
|
||||
} // View by month
|
||||
}
|
||||
// View by week
|
||||
if (GETPOST('viewweek', 'alpha') || $mode == 'show_week') {
|
||||
$mode = 'show_week';
|
||||
$week = ($week ? $week : date("W"));
|
||||
$day = ($day ? $day : date("d"));
|
||||
} // View by week
|
||||
}
|
||||
// View by day
|
||||
if (GETPOST('viewday', 'alpha') || $mode == 'show_day') {
|
||||
$mode = 'show_day';
|
||||
$day = ($day ? $day : date("d"));
|
||||
} // View by day
|
||||
}
|
||||
|
||||
$object = new ActionComm($db);
|
||||
|
||||
|
|
@ -335,10 +333,12 @@ if ($status == 'todo') {
|
|||
}
|
||||
|
||||
$param = '';
|
||||
if ($actioncode || GETPOSTISSET('search_actioncode')) {
|
||||
if (($actioncode && $actioncode !== '-1') || GETPOSTISSET('search_actioncode')) {
|
||||
if (is_array($actioncode)) {
|
||||
foreach ($actioncode as $str_action) {
|
||||
$param .= "&search_actioncode[]=".urlencode($str_action);
|
||||
if ($str_action != '-1') {
|
||||
$param .= "&search_actioncode[]=".urlencode($str_action);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$param .= "&search_actioncode=".urlencode($actioncode);
|
||||
|
|
@ -531,16 +531,16 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda'
|
|||
|
||||
$urltocreateaction = DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
$urltocreateaction .= '&apyear='.$tmpforcreatebutton['year'].'&apmonth='.$tmpforcreatebutton['mon'].'&apday='.$tmpforcreatebutton['mday'].'&aphour='.$tmpforcreatebutton['hours'].'&apmin='.$tmpforcreatebutton['minutes'];
|
||||
$urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"] . $newparam);
|
||||
$urltocreateaction .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?'.$newparam);
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', $urltocreateaction);
|
||||
}
|
||||
|
||||
|
||||
// Define the legend/list of calendard to show
|
||||
$s = '';
|
||||
$link = '';
|
||||
|
||||
// Define the legend/list of calendard to show
|
||||
$s = '';
|
||||
|
||||
$showextcals = $listofextcals;
|
||||
$bookcalcalendars = array();
|
||||
|
|
@ -554,7 +554,7 @@ if (isModEnabled("bookcal")) {
|
|||
$sql .= " WHERE bc.status = 1";
|
||||
$sql .= " AND ba.status = 1";
|
||||
$sql .= " AND bc.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda
|
||||
if (!empty($filtert) && $filtert != '-1') {
|
||||
if (!empty($filtert) && $filtert != '-1' && $filtert != '-2') {
|
||||
$sql .= " AND bc.visibility IN (".$db->sanitize($filtert, 0, 0, 0, 0).")";
|
||||
}
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -677,7 +677,7 @@ $sql .= " a.id, a.label,";
|
|||
$sql .= " a.datep,";
|
||||
$sql .= " a.datep2,";
|
||||
$sql .= " a.percent,";
|
||||
$sql .= " a.fk_user_author,a.fk_user_action,";
|
||||
$sql .= " a.fk_user_author, a.fk_user_action,";
|
||||
$sql .= " a.transparency, a.priority, a.fulldayevent, a.location,";
|
||||
$sql .= " a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,";
|
||||
$sql .= " a.fk_element, a.elementtype,";
|
||||
|
|
@ -692,12 +692,16 @@ $sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as ca, ".MAIN_DB_PREFIX."actioncom
|
|||
if ($resourceid > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_resources as r";
|
||||
}
|
||||
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
if (($filtert != '-1' && $filtert != '-2') || $usergroup > 0) {
|
||||
// TODO Replace with a AND EXISTS
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as ar";
|
||||
$sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type='user'";
|
||||
if ($filtert > 0) {
|
||||
$sql .= " AND ar.fk_element = ".((int) $filtert);
|
||||
$sql .= " ON ar.fk_actioncomm = a.id AND ar.element_type = 'user'";
|
||||
if ($filtert != '' && $filtert != '-1' && $filtert != '-2' && $filtert != '-3') {
|
||||
$sql .= " AND ar.fk_element IN (".$db->sanitize($filtert).")";
|
||||
} elseif ($filtert == '-3') {
|
||||
$sql .= " AND ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element AND ugu.fk_usergroup = ".((int) $usergroup);
|
||||
|
|
@ -706,6 +710,7 @@ if ($filtert > 0 || $usergroup > 0) {
|
|||
|
||||
$sql .= " WHERE a.fk_action = ca.id";
|
||||
$sql .= " AND a.entity IN (".getEntity('agenda').")"; // bookcal is a "virtual view" of agenda
|
||||
|
||||
// Condition on actioncode
|
||||
if (!empty($actioncode)) {
|
||||
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) {
|
||||
|
|
@ -726,9 +731,16 @@ if (!empty($actioncode)) {
|
|||
$sql .= " AND ca.type != 'systemauto'";
|
||||
} elseif ($actioncode == 'AC_ALL_AUTO') {
|
||||
$sql .= " AND ca.type = 'systemauto'";
|
||||
} elseif (/* !empty($actioncode) && */ $actioncode !== '-1') {
|
||||
} elseif ($actioncode !== '-1' && $actioncode !== '-3') {
|
||||
if (is_array($actioncode)) {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
|
||||
foreach ($actioncode as $key => $val) {
|
||||
if ($val == '-1' || $val == '-2') {
|
||||
unset($actioncode[$key]);
|
||||
}
|
||||
}
|
||||
if (!empty($actioncode)) {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", $actioncode)."'", 1).")";
|
||||
}
|
||||
} else {
|
||||
$sql .= " AND ca.code IN (".$db->sanitize("'".implode("','", explode(',', $actioncode))."'", 1).")";
|
||||
}
|
||||
|
|
@ -805,10 +817,13 @@ if ($status == 'todo') {
|
|||
$sql .= " AND (a.percent >= 0 AND a.percent < 100)";
|
||||
}
|
||||
// We must filter on assignment table
|
||||
if ($filtert > 0 || $usergroup > 0) {
|
||||
if (($filtert > 0 || $filtert == -3) || $usergroup > 0) {
|
||||
// TODO Replace with a AND EXISTS
|
||||
$sql .= " AND (";
|
||||
if ($filtert > 0) {
|
||||
$sql .= "ar.fk_element = ".((int) $filtert);
|
||||
} elseif ($filtert == -3) {
|
||||
$sql .= "ar.fk_element IN (".$db->sanitize(implode(',', $user->getAllChildIds(1))).")";
|
||||
}
|
||||
if ($usergroup > 0) {
|
||||
$sql .= ($filtert > 0 ? " OR " : "")." ugu.fk_usergroup = ".((int) $usergroup);
|
||||
|
|
@ -1056,8 +1071,8 @@ if ($showbirthday) { // always false @phpstan-ignore-line
|
|||
}
|
||||
}
|
||||
|
||||
// LEAVE-HOLIDAY CALENDAR
|
||||
if ($user->hasRight("holiday", "read")) {
|
||||
// LEAVE-HOLIDAY CALENDAR
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
|
|
@ -1499,6 +1514,7 @@ $link = '';
|
|||
// Show div with list of calendars
|
||||
print $s;
|
||||
|
||||
// Top filters
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print_actions_filter($form, $canedit, $search_status, $year, $month, $day, $showbirthday, '', (string) $filtert, '', $pid, $socid, $action, -1, $actioncode, $usergroup, '', $resourceid, $search_categ_cus);
|
||||
print '</div>';
|
||||
|
|
@ -1543,13 +1559,13 @@ while ($currentdaytoshow < $lastdaytoshow) {
|
|||
print $langs->trans("DaysOfWeek").'</span>';
|
||||
print "\n";
|
||||
print '<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
|
||||
print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
|
||||
print '<input type="number" class="shortbis" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
|
||||
if (empty($conf->dol_use_jmobile)) {
|
||||
print ' - ';
|
||||
} else {
|
||||
print '</div><div class="ui-block-b">';
|
||||
}
|
||||
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
|
||||
print '<input type="number" class="shortbis" name="end_d" value="'.$end_d.'" min="1" max="7">';
|
||||
print '</div></div>';
|
||||
}
|
||||
|
||||
|
|
@ -1582,13 +1598,13 @@ while ($currentdaytoshow < $lastdaytoshow) {
|
|||
print $langs->trans("Hours").'</span>';
|
||||
print "\n";
|
||||
print '<div class="ui-grid-a inline-block"><div class="ui-block-a nowraponall">';
|
||||
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
|
||||
print '<input type="number" class="shortbis" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
|
||||
if (empty($conf->dol_use_jmobile)) {
|
||||
print ' - ';
|
||||
} else {
|
||||
print '</div><div class="ui-block-b">';
|
||||
}
|
||||
print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
|
||||
print '<input type="number" class="shortbis" name="end_h" value="'.$end_h.'" min="1" max="24">';
|
||||
if (empty($conf->dol_use_jmobile)) {
|
||||
print ' '.$langs->trans("HourShort");
|
||||
}
|
||||
|
|
@ -1630,7 +1646,7 @@ while ($currentdaytoshow < $lastdaytoshow) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
/* Use this list to have lines for all users */
|
||||
/* Use this list to have lines of all users to show */
|
||||
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
|
||||
$sql .= " FROM ".$db->prefix()."user as u";
|
||||
if (isModEnabled('multicompany') && getDolGlobalInt('MULTICOMPANY_TRANSVERSE_MODE')) {
|
||||
|
|
@ -1661,6 +1677,13 @@ while ($currentdaytoshow < $lastdaytoshow) {
|
|||
// External users should see only contacts of their company
|
||||
$sql .= " AND u.fk_soc = ".((int) $user->socid);
|
||||
}
|
||||
// Filter on users in hierarchy
|
||||
if (!$canedit || $filtert == '-3') { // If we can't read event of others
|
||||
if (!$user->hasRight('user', 'user', 'lire') || $filtert == '-3') {
|
||||
$usersInHierarchy = $user->getAllChildIds(1);
|
||||
$sql .= " AND u.rowid IN (".$db->sanitize(implode(',', $usersInHierarchy)).")";
|
||||
}
|
||||
}
|
||||
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
|
|
@ -2272,7 +2295,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
foreach ($cases1[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style1 = 'onclickopenref peruser_busy';
|
||||
$style1 .= 'peruser_busy ';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
$style1 .= ' '.$ev['css'];
|
||||
|
|
@ -2292,7 +2315,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
foreach ($cases2[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style2 = 'onclickopenref peruser_busy';
|
||||
$style2 .= 'peruser_busy ';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
$style2 .= ' '.$ev['css'];
|
||||
|
|
@ -2312,7 +2335,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
foreach ($cases3[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style3 = 'onclickopenref peruser_busy';
|
||||
$style3 .= 'peruser_busy ';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
$style3 .= ' '.$ev['css'];
|
||||
|
|
@ -2332,7 +2355,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
}
|
||||
foreach ($cases4[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style4 = 'onclickopenref peruser_busy';
|
||||
$style4 .= 'peruser_busy ';
|
||||
}
|
||||
if ($ev['css']) {
|
||||
$style4 .= ' '.$ev['css'];
|
||||
|
|
@ -2450,13 +2473,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
print '<table class="nobordernopadding case centpercent">';
|
||||
print '<tr>';
|
||||
print '<td ';
|
||||
if ($style1 == 'peruser_notbusy') {
|
||||
if (preg_match('/peruser_notbusy/', $style1)) {
|
||||
print 'style="border: 1px solid #'.($color1 ? $color1 : "888").' !important" ';
|
||||
} elseif ($color1) {
|
||||
print 'style="background: #'.$color1.'; "';
|
||||
}
|
||||
print 'class="';
|
||||
print ($style1 ? $style1.' ' : '');
|
||||
print $style1;
|
||||
print 'center'.($title1 ? ' classfortooltip' : '').($title1 ? ' cursorpointer' : '').'"';
|
||||
print 'ref="'.$ref1.'_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_00_'.($ids1 ? $ids1 : 'none').'"';
|
||||
print ($title1 ? ' title="'.$title1.'"' : '').'>';
|
||||
|
|
@ -2464,13 +2487,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
print '</td>';
|
||||
|
||||
print '<td ';
|
||||
if ($style2 == 'peruser_notbusy') {
|
||||
if (preg_match('/peruser_notbusy/', $style2)) {
|
||||
print 'style="border: 1px solid #'.($color2 ? $color2 : "888").' !important" ';
|
||||
} elseif ($color2) {
|
||||
print 'style="background: #'.$color2.'; "';
|
||||
}
|
||||
print 'class="';
|
||||
print ($style2 ? $style2.' ' : '');
|
||||
print $style2;
|
||||
print 'center'.($title2 ? ' classfortooltip' : '').($title2 ? ' cursorpointer' : '').'"';
|
||||
print ' ref="'.$ref2.'_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_15_'.($ids2 ? $ids2 : 'none').'"';
|
||||
print ($title2 ? ' title="'.$title2.'"' : '').'>';
|
||||
|
|
@ -2478,13 +2501,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
print '</td>';
|
||||
|
||||
print '<td ';
|
||||
if ($style3 == 'peruser_notbusy') {
|
||||
if (preg_match('/peruser_notbusy/', $style3)) {
|
||||
print 'style="border: 1px solid #'.($color3 ? $color3 : "888").' !important" ';
|
||||
} elseif ($color3) {
|
||||
print 'style="background: #'.$color3.'; "';
|
||||
}
|
||||
print 'class="';
|
||||
print ($style3 ? $style3.' ' : '');
|
||||
print $style3;
|
||||
print 'center'.($title3 ? ' classfortooltip' : '').($title3 ? ' cursorpointer' : '').'"';
|
||||
print ' ref="'.$ref3.'_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_30_'.($ids3 ? $ids3 : 'none').'"';
|
||||
print ($title3 ? ' title="'.$title3.'"' : '').'>';
|
||||
|
|
@ -2492,13 +2515,13 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||
print '</td>';
|
||||
|
||||
print '<td ';
|
||||
if ($style4 == 'peruser_notbusy') {
|
||||
if (preg_match('/peruser_notbusy/', $style4)) {
|
||||
print 'style="border: 1px solid #'.($color4 ? $color4 : "888").' !important" ';
|
||||
} elseif ($color4) {
|
||||
print 'style="background: #'.$color4.'; "';
|
||||
}
|
||||
print 'class="';
|
||||
print ($style4 ? $style4.' ' : '');
|
||||
print $style4;
|
||||
print 'center'.($title4 ? ' classfortooltip' : '').($title4 ? ' cursorpointer' : '').'"';
|
||||
print ' ref="'.$ref4.'_'.$username->id.'_'.sprintf("%04d", $year).'_'.sprintf("%02d", $month).'_'.sprintf("%02d", $day).'_'.sprintf("%02d", $h).'_45_'.($ids4 ? $ids4 : 'none').'"';
|
||||
print ($title4 ? ' title="'.$title4.'"' : '').'>';
|
||||
|
|
|
|||
|
|
@ -971,7 +971,7 @@ if ($object->id > 0) {
|
|||
// $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
|
||||
// $urlsource = '/comm/propal/card.php?id='.$objp->cid;
|
||||
// print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir);
|
||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
if (($db->jdate($objp->date_limit) < ($now - getWarningDelay('propal', 'cloture'))) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
|
|
@ -1260,7 +1260,7 @@ if ($object->id > 0) {
|
|||
$late = '';
|
||||
foreach ($contrat->lines as $line) {
|
||||
if ($contrat->status == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) {
|
||||
if (((!empty($line->date_end) ? $line->date_end : 0) + $conf->contract->services->expires->warning_delay) < $now) {
|
||||
if (((!empty($line->date_end) ? $line->date_end : 0) + getWarningDelay('contract', 'service', 'expires')) < $now) {
|
||||
$late = img_warning($langs->trans("Late"));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1187,7 +1187,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
|
|||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
//$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
|
||||
$warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ? img_warning($langs->trans("Late")) : '';
|
||||
$warning = ($db->jdate($obj->dfv) < ($now - getWarningDelay('propal', 'cloture'))) ? img_warning($langs->trans("Late")) : '';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
|
|
|||
|
|
@ -641,6 +641,27 @@ class AdvanceTargetingMailing extends CommonObject
|
|||
if ($arrayquery['options_'.$key] > 0) {
|
||||
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key]).")";
|
||||
}
|
||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'chkbxlst'
|
||||
&& is_array($arrayquery['options_'.$key])) {
|
||||
if (count($arrayquery['options_'.$key])) {
|
||||
$i2 = 0;
|
||||
$field = "te.".$key;
|
||||
$sqlwhereselllist="";
|
||||
foreach ($arrayquery['options_'.$key] as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
$sqlwhereselllist .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$this->db->escape($data).",%'";
|
||||
$sqlwhereselllist .= " OR ".$field." = '".$this->db->escape($data)."'";
|
||||
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data)."'";
|
||||
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data).",%'";
|
||||
$sqlwhereselllist .= ")";
|
||||
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
|
||||
}
|
||||
}
|
||||
if (!empty($sqlwhereselllist)) {
|
||||
$sqlwhere[] = "( ".$sqlwhereselllist." )";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_array($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key])."'", 1)."))";
|
||||
|
|
@ -784,6 +805,31 @@ class AdvanceTargetingMailing extends CommonObject
|
|||
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery["options_".$key."_cnct"]).")";
|
||||
}
|
||||
}
|
||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
|
||||
if ($arrayquery['options_'.$key."_cnct"] > 0) {
|
||||
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key."_cnct"]).")";
|
||||
}
|
||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'chkbxlst'
|
||||
&& is_array($arrayquery['options_'.$key.'_cnct'])) {
|
||||
if (count($arrayquery['options_'.$key.'_cnct'])) {
|
||||
$i2 = 0;
|
||||
$field = "te.".$key;
|
||||
$sqlwhereselllist="";
|
||||
foreach ($arrayquery['options_'.$key.'_cnct'] as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
$sqlwhereselllist .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$this->db->escape($data).",%'";
|
||||
$sqlwhereselllist .= " OR ".$field." = '".$this->db->escape($data)."'";
|
||||
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data)."'";
|
||||
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data).",%'";
|
||||
$sqlwhereselllist .= ")";
|
||||
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
|
||||
}
|
||||
}
|
||||
if (!empty($sqlwhereselllist)) {
|
||||
$sqlwhere[] = "( ".$sqlwhereselllist." )";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_array($arrayquery['options_'.$key.'_cnct'])) {
|
||||
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key."_cnct"])."'", 1)."))";
|
||||
|
|
@ -888,6 +934,31 @@ class AdvanceTargetingMailing extends CommonObject
|
|||
if ($arrayquery['options_'.$key] != '') {
|
||||
$sqlwhere[] = " (tse.".$key." = ".((int) $arrayquery["options_".$key]).")";
|
||||
}
|
||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
|
||||
if ($arrayquery['options_'.$key] > 0) {
|
||||
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery["options_".$key]).")";
|
||||
}
|
||||
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'chkbxlst'
|
||||
&& is_array($arrayquery['options_'.$key])) {
|
||||
if (count($arrayquery['options_'.$key])) {
|
||||
$i2 = 0;
|
||||
$field = "tse.".$key;
|
||||
$sqlwhereselllist="";
|
||||
foreach ($arrayquery['options_'.$key] as $data) {
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
$sqlwhereselllist .= ($i2 > 0 ? " OR (" : "(").$field." LIKE '".$this->db->escape($data).",%'";
|
||||
$sqlwhereselllist .= " OR ".$field." = '".$this->db->escape($data)."'";
|
||||
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data)."'";
|
||||
$sqlwhereselllist .= " OR ".$field." LIKE '%,".$this->db->escape($data).",%'";
|
||||
$sqlwhereselllist .= ")";
|
||||
$i2++; // a criteria for 1 more field was added to string (we can add several criteria for the same field as it is a multiselect search criteria)
|
||||
}
|
||||
}
|
||||
if (!empty($sqlwhereselllist)) {
|
||||
$sqlwhere[] = "( ".$sqlwhereselllist." )";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (is_array($arrayquery['options_'.$key])) {
|
||||
$sqlwhere[] = " (tse.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery["options_".$key])."'", 1)."))";
|
||||
|
|
|
|||
|
|
@ -3085,7 +3085,7 @@ if ($action == 'create') {
|
|||
} else {
|
||||
if (!empty($object->fin_validite)) {
|
||||
print dol_print_date($object->fin_validite, 'day');
|
||||
if ($object->status == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - $conf->propal->cloture->warning_delay)) {
|
||||
if ($object->status == Propal::STATUS_VALIDATED && $object->fin_validite < ($now - getWarningDelay('propal', 'cloture'))) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 William Mead <william@m34d.com>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -203,6 +204,7 @@ class Proposals extends DolibarrApi
|
|||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal AS t";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe AS s ON (s.rowid = t.fk_soc)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."propal_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('propal').')';
|
||||
if ($socids) {
|
||||
|
|
|
|||
|
|
@ -3555,13 +3555,13 @@ class Propal extends CommonObject
|
|||
$status = 0;
|
||||
$label = $labelShort = '';
|
||||
if ($mode == 'opened') {
|
||||
$delay_warning = $conf->propal->cloture->warning_delay;
|
||||
$delay_warning = getWarningDelay('propal', 'cloture');
|
||||
$status = self::STATUS_VALIDATED;
|
||||
$label = $langs->transnoentitiesnoconv("PropalsToClose");
|
||||
$labelShort = $langs->transnoentitiesnoconv("ToAcceptRefuse");
|
||||
}
|
||||
if ($mode == 'signed') {
|
||||
$delay_warning = $conf->propal->facturation->warning_delay;
|
||||
$delay_warning = getWarningDelay('propal', 'facturation');
|
||||
$status = self::STATUS_SIGNED;
|
||||
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
|
||||
$labelShort = $langs->trans("ToBill");
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) {
|
|||
$filedir = $conf->propal->multidir_output[$obj->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->propalid;
|
||||
|
||||
$warning = ($db->jdate($obj->dfv) < ($now - $conf->propal->cloture->warning_delay)) ? img_warning($langs->trans("Late")) : '';
|
||||
$warning = ($db->jdate($obj->dfv) < ($now - getWarningDelay('propal', 'cloture'))) ? img_warning($langs->trans("Late")) : '';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ if (!empty($searchCategoryProductList)) {
|
|||
}
|
||||
}
|
||||
if ($search_option == 'late') {
|
||||
$sql .= " AND p.fin_validite < '".$db->idate(dol_now() - $conf->propal->cloture->warning_delay)."'";
|
||||
$sql .= " AND p.fin_validite < '".$db->idate(dol_now() - getWarningDelay('propal', 'cloture'))."'";
|
||||
}
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
|
@ -2382,7 +2382,7 @@ while ($i < $imaxinloop) {
|
|||
// Note public
|
||||
if (!empty($arrayfields['p.note_public']['checked'])) {
|
||||
print '<td class="sensiblehtmlcontent center">';
|
||||
print dolPrintHTML($obj->note_public);
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -2391,7 +2391,7 @@ while ($i < $imaxinloop) {
|
|||
// Note private
|
||||
if (!empty($arrayfields['p.note_private']['checked'])) {
|
||||
print '<td class="sensiblehtmlcontent center">';
|
||||
print dolPrintHTML($obj->note_private);
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ class Orders extends DolibarrApi
|
|||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande AS t";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe AS s ON (s.rowid = t.fk_soc)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('commande').')';
|
||||
if ($socids) {
|
||||
|
|
|
|||
|
|
@ -1068,10 +1068,15 @@ class Commande extends CommonOrder
|
|||
for ($i = 0; $i < $num; $i++) {
|
||||
$line = $this->lines[$i];
|
||||
|
||||
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
|
||||
// Test and convert into OrderLine object this->lines[$i]. When coming from REST API, we may still have an array
|
||||
//if (! is_object($line)) $line=json_decode(json_encode($line), false); // convert recursively array into object.
|
||||
if (!is_object($line)) {
|
||||
$line = (object) $line;
|
||||
$lineobj = new OrderLine($this->db);
|
||||
foreach ($line as $key => $val) {
|
||||
$lineobj->$key = $val;
|
||||
}
|
||||
$line = $lineobj;
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonorder.class.php'; // Because the CommonOrderLine is still in commonorder.class.php file
|
||||
require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php';
|
||||
|
||||
|
||||
|
|
@ -150,6 +151,42 @@ class OrderLine extends CommonOrderLine
|
|||
*/
|
||||
public $packaging;
|
||||
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int<-6,6>|string,alwayseditable?:int<0,1>,noteditable?:int<0,1>,default?:string,index?:int,foreignkey?:string,searchall?:int<0,1>,isameasure?:int<0,1>,css?:string,csslist?:string,help?:string,showoncombobox?:int<0,4>,disabled?:int<0,1>,arrayofkeyval?:array<int|string,string>,autofocusoncreate?:int<0,1>,comment?:string,copytoclipboard?:int<1,2>,validate?:int<0,1>,showonheader?:int<0,1>}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' => array('type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
|
||||
'ref' => array('type' => 'varchar(50)', 'label' => 'Ref', 'enabled' => 1, 'visible' => -1, 'showoncombobox' => 1, 'position' => 15, 'searchall' => 1),
|
||||
'ref_ext' => array('type' => 'varchar(255)', 'label' => 'RefExt', 'enabled' => 1, 'visible' => 0, 'position' => 20),
|
||||
'ref_customer' => array('type' => 'varchar(50)', 'label' => 'RefCustomer', 'enabled' => 1, 'visible' => -1, 'position' => 25, 'searchall' => 1),
|
||||
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 30, 'index' => 1),
|
||||
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 35),
|
||||
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 40),
|
||||
'fk_commande' => array('type' => 'integer:Commande:commande/class/commande.class.php', 'label' => 'Order', 'enabled' => 'isModEnabled("societe")', 'visible' => -1, 'notnull' => 1, 'position' => 70),
|
||||
'fk_projet' => array('type' => 'integer:Project:projet/class/project.class.php:1:(fk_statut:=:1)', 'label' => 'Project', 'enabled' => "isModEnabled('project')", 'visible' => -1, 'position' => 75),
|
||||
'fk_product' => array('type' => 'integer:Product:product/class/product.class.php:1', 'label' => 'ProductOrService', 'enabled' => "isModEnabled('product') || isModEnabled('service')", 'visible' => -1, 'position' => 76),
|
||||
//'fk_commercial_signature' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative Signature', 'enabled' => 1, 'visible' => -1, 'position' => 80),
|
||||
//'fk_commercial_suivi' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'SaleRepresentative follower', 'enabled' => 1, 'visible' => -1, 'position' => 85),
|
||||
'fk_user_author' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserAuthor', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 90),
|
||||
'total_ht' => array('type' => 'double(24,8)', 'label' => 'TotalHT', 'enabled' => 1, 'visible' => -1, 'position' => 125, 'isameasure' => 1),
|
||||
'total_tva' => array('type' => 'double(24,8)', 'label' => 'VAT', 'enabled' => 1, 'visible' => -1, 'position' => 130, 'isameasure' => 1),
|
||||
'localtax1' => array('type' => 'double(24,8)', 'label' => 'LocalTax1', 'enabled' => 1, 'visible' => -1, 'position' => 135, 'isameasure' => 1),
|
||||
'localtax2' => array('type' => 'double(24,8)', 'label' => 'LocalTax2', 'enabled' => 1, 'visible' => -1, 'position' => 140, 'isameasure' => 1),
|
||||
'total_ttc' => array('type' => 'double(24,8)', 'label' => 'TotalTTC', 'enabled' => 1, 'visible' => -1, 'position' => 145, 'isameasure' => 1),
|
||||
'note_public' => array('type' => 'html', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 105, 'searchall' => 1),
|
||||
'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 110, 'searchall' => 1),
|
||||
'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 115),
|
||||
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 120),
|
||||
'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 125),
|
||||
'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'visible' => -2, 'notnull' => -1, 'position' => 135),
|
||||
'last_main_doc' => array('type' => 'varchar(255)', 'label' => 'Last main doc', 'enabled' => 1, 'visible' => -1, 'position' => 140),
|
||||
'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'position' => 500, 'notnull' => 1, 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', 2 => 'Closed'))
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
* Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
|
||||
* Copyright (C) 2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
|
||||
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
|
||||
* Copyright (C) 2025 Lenin Rivas <lenin.rivas777@gmail.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
|
||||
|
|
@ -492,6 +493,36 @@ if (empty($reshook)) {
|
|||
$error++;
|
||||
}
|
||||
|
||||
// Linked Expeditions
|
||||
if (getDolGlobalString('ORDER_MASS_ACTION_BILLED_LINK_EXPEDITIONS')) {
|
||||
$cmd->fetchObjectLinked();
|
||||
// Add object linked
|
||||
if (!$error && $cmd->id && !empty($cmd->linkedObjectsIds['shipping']) && is_array($cmd->linkedObjectsIds['shipping'])) {
|
||||
$cmd->linked_objects = $cmd->linkedObjectsIds;
|
||||
foreach ($cmd->linked_objects as $origin_type => $tmp_origin_id) {
|
||||
// IF more of same type
|
||||
if ($origin_type == 'shipping') {
|
||||
if (is_array($tmp_origin_id)) { // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
|
||||
foreach ($tmp_origin_id as $origin_id) {
|
||||
$res = $objecttmp->add_object_linked($origin_type, $origin_id);
|
||||
if (!$res) {
|
||||
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else { // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
|
||||
$origin_id = $tmp_origin_id;
|
||||
$res = $objecttmp->add_object_linked($origin_type, $origin_id);
|
||||
if (!$res) {
|
||||
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->errors[0]);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$lines = $cmd->lines;
|
||||
if (empty($lines) && method_exists($cmd, 'fetch_lines')) {
|
||||
|
|
@ -2908,8 +2939,8 @@ while ($i < $imaxinloop) {
|
|||
|
||||
// Note public
|
||||
if (!empty($arrayfields['c.note_public']['checked'])) {
|
||||
print '<td class="flat maxwidth250imp">';
|
||||
print '<div class="small lineheightsmall">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public), 5).'</div>';
|
||||
print '<td class="sensiblehtmlcontent maxwidth250imp classfortooltip" title="'.dolPrintHTMLForAttribute(dolGetFirstLineOfText($obj->note_public, 20)).'">';
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -2918,8 +2949,8 @@ while ($i < $imaxinloop) {
|
|||
|
||||
// Note private
|
||||
if (!empty($arrayfields['c.note_private']['checked'])) {
|
||||
print '<td class="flat maxwidth250imp">';
|
||||
print '<div class="small lineheightsmall">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private), 5).'</div>';
|
||||
print '<td class="sensiblehtmlcontent maxwidth250imp classfortooltip" title="'.dolPrintHTMLForAttribute(dolGetFirstLineOfText($obj->note_private, 20)).'">';
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -191,11 +191,11 @@ if (empty($user->socid)) {
|
|||
$checkedtypetiers = 0;
|
||||
$arrayfields = array(
|
||||
// Détail commande
|
||||
'rowid' => array('label' => 'TechnicalID', 'checked' => '-1', 'position' => 1, 'enabled' => '1'),
|
||||
'pr.ref' => array('label' => 'ProductRef', 'checked' => '1', 'position' => 2),
|
||||
'pr.desc' => array('label' => 'ProductDescription', 'checked' => '-1', 'position' => 3),
|
||||
'cdet.qty' => array('label' => 'QtyOrdered', 'checked' => '1', 'position' => 4),
|
||||
'rowid' => array('label' => 'LineID', 'checked' => '-1', 'position' => 1, 'enabled' => '1'),
|
||||
'c.ref' => array('label' => "RefOrder", 'checked' => '1', 'position' => 5),
|
||||
'pr.ref' => array('label' => 'ProductRef', 'checked' => '1', 'position' => 6),
|
||||
'pr.desc' => array('label' => 'ProductDescription', 'checked' => '-1', 'position' => 7),
|
||||
'cdet.qty' => array('label' => 'QtyOrdered', 'checked' => '1', 'position' => 8),
|
||||
'c.ref_client' => array('label' => "RefCustomerOrder", 'checked' => '-1', 'position' => 10),
|
||||
'p.ref' => array('label' => "ProjectRef", 'checked' => '-1', 'enabled' => (string) (int) isModEnabled('project'), 'position' => 20),
|
||||
'p.title' => array('label' => "ProjectLabel", 'checked' => '0', 'enabled' => (string) (int) isModEnabled('project'), 'position' => 25),
|
||||
|
|
@ -1032,7 +1032,13 @@ if ($resql) {
|
|||
print '<input class="flat searchstring width50" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Détail commande
|
||||
// Ref order
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Product ref
|
||||
if (!empty($arrayfields['pr.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).'">';
|
||||
|
|
@ -1049,12 +1055,6 @@ if ($resql) {
|
|||
print '<td class="liste_titre"></td>';
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Ref customer
|
||||
if (!empty($arrayfields['c.ref_client']['checked'])) {
|
||||
print '<td class="liste_titre" align="left">';
|
||||
|
|
@ -1321,11 +1321,14 @@ if ($resql) {
|
|||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
}
|
||||
|
||||
// Détail commande
|
||||
// Detail order
|
||||
if (!empty($arrayfields['rowid']['checked'])) {
|
||||
// @phan-suppress-next-line PhanTypeInvalidDimOffset
|
||||
print_liste_field_titre($arrayfields['rowid']['label'], $_SERVER["PHP_SELF"], 'rowid', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['pr.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
|
|
@ -1336,9 +1339,6 @@ if ($resql) {
|
|||
print_liste_field_titre($arrayfields['cdet.qty']['label'], $_SERVER["PHP_SELF"], 'cdet.qty', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], 'c.ref', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.ref_client']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['c.ref_client']['label'], $_SERVER["PHP_SELF"], 'c.ref_client', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
|
|
@ -1611,6 +1611,22 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
// Ref order
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Product Ref
|
||||
if (!empty($arrayfields['pr.ref']['checked'])) {
|
||||
if (!empty($obj->product_rowid)) {
|
||||
|
|
@ -1660,22 +1676,6 @@ if ($resql) {
|
|||
}
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['c.ref']['checked'])) {
|
||||
print '<td class="nowraponall">';
|
||||
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
|
||||
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Ref customer
|
||||
if (!empty($arrayfields['c.ref_client']['checked'])) {
|
||||
print '<td class="nowrap tdoverflowmax200">'.$obj->ref_client.'</td>';
|
||||
|
|
|
|||
|
|
@ -213,6 +213,7 @@ class Invoices extends DolibarrApi
|
|||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture AS t";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe AS s ON (s.rowid = t.fk_soc)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('invoice').')';
|
||||
if ($socids) {
|
||||
|
|
@ -1616,10 +1617,10 @@ class Invoices extends DolibarrApi
|
|||
* Warning: Take care that all invoices are owned by the same customer.
|
||||
* Example of value for parameter arrayofamounts: {"1": {"amount": "99.99", "multicurrency_amount": ""}, "2": {"amount": "", "multicurrency_amount": "10"}}
|
||||
*
|
||||
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
|
||||
* @param array $arrayofamounts {@from body} Array with id of invoices with amount to pay for each invoice
|
||||
* @phan-param array<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
|
||||
* @phpstan-param array<string,array{amount:string,multicurrency_amount:string}> $arrayofamounts
|
||||
* @param string $datepaye {@from body} Payment date
|
||||
* @param string $datepaye {@from body} Payment date
|
||||
* @param int $paymentid {@from body} Payment mode Id {@min 1}
|
||||
* @param string $closepaidinvoices {@from body} Close paid invoices {@choice yes,no}
|
||||
* @param int $accountid {@from body} Account Id {@min 1}
|
||||
|
|
@ -1694,23 +1695,23 @@ class Invoices extends DolibarrApi
|
|||
$totalpaid = $this->invoice->getSommePaiement($is_multicurrency);
|
||||
$totalcreditnotes = $this->invoice->getSumCreditNotesUsed($is_multicurrency);
|
||||
$totaldeposits = $this->invoice->getSumDepositsUsed($is_multicurrency);
|
||||
$remainstopay = $amount = price2num($total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
$remainstopay = $amount = (float) price2num($total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
if (!$is_multicurrency && $amountarray["amount"] != 'remain') {
|
||||
$amount = price2num($amountarray["amount"], 'MT');
|
||||
$amount = (float) price2num($amountarray["amount"], 'MT');
|
||||
}
|
||||
|
||||
if ($is_multicurrency && $amountarray["multicurrency_amount"] != 'remain') {
|
||||
$amount = price2num($amountarray["multicurrency_amount"], 'MT');
|
||||
$amount = (float) price2num($amountarray["multicurrency_amount"], 'MT');
|
||||
}
|
||||
|
||||
if ($amount > $remainstopay && !$accepthigherpayment) {
|
||||
if (abs($amount) > abs($remainstopay) && !$accepthigherpayment) {
|
||||
$this->db->rollback();
|
||||
throw new RestException(400, 'Payment amount on invoice ID '.$id.' ('.$amount.') is higher than remain to pay ('.$remainstopay.')');
|
||||
}
|
||||
|
||||
if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) {
|
||||
$amount = price2num(-1 * (float) $amount, 'MT');
|
||||
$amount = (float) price2num(-1 * abs((float) $amount), 'MT');
|
||||
}
|
||||
|
||||
if ($is_multicurrency) {
|
||||
|
|
|
|||
277
htdocs/compta/facture/class/api_paiements.class.php
Normal file
277
htdocs/compta/facture/class/api_paiements.class.php
Normal file
|
|
@ -0,0 +1,277 @@
|
|||
<?php
|
||||
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
dol_include_once('/compta/paiement/class/paiement.class.php');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \file compta/paiement/class/api_paiement.class.php
|
||||
* \ingroup paiement
|
||||
* \brief File for API management of paiement.
|
||||
*/
|
||||
|
||||
/**
|
||||
* API class for paiement
|
||||
*
|
||||
* @access protected
|
||||
* @class DolibarrApiAccess {@requires user,external}
|
||||
*/
|
||||
class Paiements extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* @var Paiement {@type Paiement}
|
||||
*/
|
||||
public $paiement;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @url GET /
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db;
|
||||
$this->db = $db;
|
||||
$this->paiement = new Paiement($this->db);
|
||||
}
|
||||
|
||||
/* BEGIN MODULEBUILDER API PAIEMENT */
|
||||
|
||||
/**
|
||||
* Get properties of a paiement object
|
||||
*
|
||||
* Return an array with paiement information
|
||||
*
|
||||
* @param int $id ID of paiement
|
||||
* @return Object Object with cleaned properties
|
||||
* @phan-return Paiement Object with cleaned properties
|
||||
* @phpstan-return Paiement Object with cleaned properties
|
||||
*
|
||||
* @phan-return Paiement
|
||||
*
|
||||
*
|
||||
* @throws RestException 403 Not allowed
|
||||
* @throws RestException 404 Not found
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('facture', 'lire')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$result = $this->paiement->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Paiement not found');
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->paiement);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List paiements
|
||||
*
|
||||
* Get a list of paiements
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
* @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
|
||||
* @return array Array of paiements objects
|
||||
* @phan-return array<int,Paiement>
|
||||
* @phpstan-return array<int,Paiement>
|
||||
*
|
||||
* @throws RestException 403 Not allowed
|
||||
* @throws RestException 503 System error
|
||||
*
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '')
|
||||
{
|
||||
$obj_ret = array();
|
||||
$tmpobject = new Paiement($this->db);
|
||||
|
||||
if (!DolibarrApiAccess::$user->hasRight('facture', 'lire')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".$this->db->prefix().$tmpobject->table_element." AS t";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
if ($tmpobject->ismultientitymanaged) {
|
||||
$sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
|
||||
}
|
||||
if ($sqlfilters) {
|
||||
$errormessage = '';
|
||||
$sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
if ($errormessage) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
$i = 0;
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$tmp_object = new Paiement($this->db);
|
||||
if ($tmp_object->fetch($obj->rowid)) {
|
||||
$obj_ret[] = $this->_filterObjectProperties($this->_cleanObjectDatas($tmp_object), $properties);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving Paiement list: '.$this->db->lasterror());
|
||||
}
|
||||
|
||||
return $obj_ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update paiement
|
||||
*
|
||||
* @param int $id Id of paiement to update
|
||||
* @param array $request_data Data
|
||||
* @phan-param ?array<string,mixed> $request_data
|
||||
* @phpstan-param ?array<string,mixed> $request_data
|
||||
* @return Object Object after update
|
||||
* @phan-return Paiement
|
||||
* @phpstan-return Paiement
|
||||
*
|
||||
* @throws RestException 403 Not allowed
|
||||
* @throws RestException 404 Not found
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('facture', 'creer')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$result = $this->paiement->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'paiement not found');
|
||||
}
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') {
|
||||
continue;
|
||||
}
|
||||
if ($field === 'caller') {
|
||||
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller
|
||||
$this->paiement->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09');
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->paiement->$field = $this->_checkValForAPI($field, $value, $this->paiement);
|
||||
}
|
||||
|
||||
// Clean data
|
||||
// $this->paiement->abc = sanitizeVal($this->paiement->abc, 'alphanohtml');
|
||||
|
||||
if ($this->paiement->update(DolibarrApiAccess::$user, 0) > 0) {
|
||||
return $this->get($id);
|
||||
} else {
|
||||
throw new RestException(500, $this->paiement->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete paiement
|
||||
*
|
||||
* @param int $id Paiement ID
|
||||
* @return array
|
||||
* @phan-return array<string,array{code:int,message:string}>
|
||||
* @phpstan-return array<string,array{code:int,message:string}>
|
||||
*
|
||||
* @throws RestException 403 Not allowed
|
||||
* @throws RestException 404 Not found
|
||||
* @throws RestException 409 Nothing to do
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->hasRight('facture', 'supprimer')) {
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
$result = $this->paiement->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Paiement not found');
|
||||
}
|
||||
|
||||
if ($this->paiement->delete(DolibarrApiAccess::$user) == 0) {
|
||||
throw new RestException(409, 'Error when deleting Paiement : '.$this->paiement->error);
|
||||
} elseif ($this->paiement->delete(DolibarrApiAccess::$user) < 0) {
|
||||
throw new RestException(500, 'Error when deleting Paiement : '.$this->paiement->error);
|
||||
}
|
||||
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => 'Paiement deleted'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* END MODULEBUILDER API PAIEMENT */
|
||||
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Clean sensitive object data fields
|
||||
* @phpstan-template T of Object
|
||||
*
|
||||
* @param Object $object Object to clean
|
||||
* @return Object Object with cleaned properties
|
||||
*
|
||||
* @phpstan-param T $object
|
||||
* @phpstan-return T
|
||||
*/
|
||||
protected function _cleanObjectDatas($object)
|
||||
{
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->rowid);
|
||||
unset($object->canvas);
|
||||
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +55,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
|||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'bills', 'compta', 'admin', 'other'));
|
||||
|
||||
$search_all = trim(GETPOST('search_all', 'alphanohtml'));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOSTINT('show_files');
|
||||
|
|
@ -64,6 +66,7 @@ $toselect = GETPOST('toselect', 'array');
|
|||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...)
|
||||
$groupby = GETPOST('groupby', 'aZ09');
|
||||
|
||||
$socid = GETPOSTINT('socid');
|
||||
|
||||
|
|
@ -123,6 +126,14 @@ $pagenext = $page + 1;
|
|||
$object = new FactureRec($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'f.titre' => "Ref",
|
||||
's.nom' => "ThirdParty",
|
||||
's.code_client' => "CustomerCodeShort",
|
||||
'fdc.description' => 'Description',
|
||||
);
|
||||
|
||||
if (($id > 0 || $ref) && $action != 'create' && $action != 'add') {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
if (!$ret) {
|
||||
|
|
@ -182,9 +193,13 @@ if ($socid > 0) {
|
|||
|
||||
$objecttype = 'facture_rec';
|
||||
|
||||
$permissiontoread = $user->hasRight("facture", "read");
|
||||
$permissionnote = $user->hasRight('facture', 'creer'); // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->hasRight('facture', 'creer'); // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->hasRight('facture', 'creer'); // Used by the include of actions_lineupdonw.inc.php
|
||||
$permissiontodelete = $user->hasRight("facture", "delete");
|
||||
|
||||
$uploaddir = $conf->facture->dir_output;
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'facture', $object->id, $objecttype);
|
||||
|
|
@ -202,7 +217,7 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa
|
|||
$massaction = '';
|
||||
}
|
||||
|
||||
$parameters = array('socid' => $socid);
|
||||
$parameters = array('arrayfields' => &$arrayfields, 'socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
|
@ -246,6 +261,7 @@ if (empty($reshook)) {
|
|||
$search_unit_frequency = '';
|
||||
$search_nb_gen_done = '';
|
||||
$search_status = '';
|
||||
$search_all = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
|
@ -255,11 +271,8 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Mass actions
|
||||
/*$objectclass='MyObject';
|
||||
$objectlabel='MyObject';
|
||||
$permissiontoread = $user->hasRight("mymodule", "read");
|
||||
$permissiontodelete = $user->hasRight("mymodule", "delete");
|
||||
$uploaddir = $conf->mymodule->dir_output;
|
||||
/*$objectclass = 'MyObject';
|
||||
$objectlabel = 'MyObject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';*/
|
||||
}
|
||||
|
||||
|
|
@ -389,6 +402,10 @@ if ($search_date_when_end) {
|
|||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
||||
if ($search_all) {
|
||||
$sql .= " AND EXISTS (SELECT fdc.rowid FROM ".MAIN_DB_PREFIX."facturedet_rec as fdc WHERE f.rowid = fdc.fk_facture ".natural_search(array_keys($fieldstosearchall), $search_all).")";
|
||||
}
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
|
|
@ -403,7 +420,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
|
|
@ -429,6 +446,12 @@ if (!$resql) {
|
|||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->facid;
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
|
@ -447,6 +470,15 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|||
if ($limit > 0 && $limit != $conf->liste_limit) {
|
||||
$param .= '&limit='.((int) $limit);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
if ($groupby != '') {
|
||||
$param .= '&groupby='.urlencode($groupby);
|
||||
}
|
||||
if ($search_all) {
|
||||
$param .= '&search_all='.urlencode($search_all);
|
||||
}
|
||||
if ($socid > 0) {
|
||||
$param .= '&socid='.urlencode((string) ($socid));
|
||||
}
|
||||
|
|
@ -522,14 +554,11 @@ if ($search_nb_gen_done != '') {
|
|||
if ($search_status != '') {
|
||||
$param .= '&search_status='.urlencode($search_status);
|
||||
}
|
||||
if ($optioncss != '') {
|
||||
$param .= '&optioncss='.urlencode($optioncss);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
// Add $param from hooks
|
||||
$parameters = array('param' => &$param);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$param .= $hookmanager->resPrint;
|
||||
|
||||
// List of mass actions available
|
||||
|
|
@ -566,6 +595,13 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
|||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'</span><br><br>';
|
||||
|
||||
if ($search_all) {
|
||||
foreach ($fieldstosearchall as $key => $val) {
|
||||
$fieldstosearchall[$key] = $langs->trans($val);
|
||||
}
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
|
||||
$moreforfilter = '';
|
||||
|
|
@ -597,7 +633,7 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
|||
print '<tr class="liste_titre_filter">';
|
||||
// Action column
|
||||
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch center">';
|
||||
print '<td class="liste_titre center maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons('left');
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
|
@ -729,7 +765,7 @@ if (!empty($arrayfields['status']['checked'])) {
|
|||
}
|
||||
// Action column
|
||||
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
|
||||
print '<td class="liste_titre maxwidthsearch center">';
|
||||
print '<td class="liste_titre center maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -2920,7 +2920,7 @@ if ($num > 0) {
|
|||
// Note public
|
||||
if (!empty($arrayfields['f.note_public']['checked'])) {
|
||||
print '<td class="sensiblehtmlcontent center">';
|
||||
print dolPrintHTML($obj->note_public);
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
@ -2928,8 +2928,8 @@ if ($num > 0) {
|
|||
}
|
||||
// Note private
|
||||
if (!empty($arrayfields['f.note_private']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dolPrintHTML($obj->note_private);
|
||||
print '<td class="sensiblehtmlcontent center">';
|
||||
print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -828,7 +828,7 @@ if ($result >= 0) {
|
|||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<button class="btn-low-emphasis --btn-icon AutoFillAmount" data-rowname="'.$namef.'" data-value="'.($sign * (float) $multicurrency_remaintopay).'">'.img_picto("Auto fill", 'rightarrow');
|
||||
}
|
||||
print '<input '.$min.' '.$max.' type="number" step="any" size="8" class="multicurrency_amount" name="'.$namef.'" value="'.GETPOST($namef).'">';
|
||||
print '<input '.$min.' '.$max.' type="text" class="multicurrency_amount" name="'.$namef.'" value="'.GETPOST($namef).'">';
|
||||
print '<input type="hidden" class="multicurrency_remain" name="'.$nameRemain.'" value="'.$multicurrency_remaintopay.'">';
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.(GETPOST($namef) != '0' ? GETPOST($namef) : '').'" disabled>';
|
||||
|
|
@ -899,7 +899,7 @@ if ($result >= 0) {
|
|||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<button class="btn-low-emphasis --btn-icon AutoFillAmount" data-rowname="'.$namef.'" data-value="'.($sign * (float) $remaintopay).'">'.img_picto("Auto fill", 'rightarrow').'</button>';
|
||||
}
|
||||
print '<input '.$max.' '.$min.' type="number" step="any" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is required to be used by javascript callForResult();
|
||||
print '<input '.$max.' '.$min.' type="text" size="8" class="amount" name="'.$namef.'" value="'.dol_escape_htmltag(GETPOST($namef)).'">'; // class is required to be used by javascript callForResult();
|
||||
print '<input type="hidden" class="remain" name="'.$nameRemain.'" value="'.$remaintopay.'">';
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth75" name="'.$namef.'_disabled" value="'.dol_escape_htmltag(GETPOST($namef)).'" disabled>';
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ if (isModEnabled('stripe')) {
|
|||
|
||||
$service = 'StripeTest';
|
||||
$servicestatus = 0;
|
||||
if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) {
|
||||
if (getDolGlobalString('STRIPE_LIVE')/* && !GETPOST('forcesandbox', 'alpha')*/) {
|
||||
$service = 'StripeLive';
|
||||
$servicestatus = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -296,7 +296,8 @@ class Paiement extends CommonObject
|
|||
/**
|
||||
* Create payment of invoices into database.
|
||||
* It uses this->amounts and ->multicurrency_amounts to get the list of detail of payment for each invoices for the payment.
|
||||
* For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative
|
||||
* For payment of a customer invoice, amounts are positive, for payment of credit note, amounts are negative.
|
||||
* Can also close the invoice if remain to pay is 0.
|
||||
* This will set also ->amount and ->multicurrency_amount at end.
|
||||
*
|
||||
* @param User $user Object user
|
||||
|
|
|
|||
|
|
@ -123,7 +123,9 @@ class Contracts extends DolibarrApi
|
|||
}
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat AS t LEFT JOIN ".MAIN_DB_PREFIX."contrat_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat AS t";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe AS s ON (s.rowid = t.fk_soc)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contrat_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('contrat').')';
|
||||
if ($socids) {
|
||||
$sql .= " AND t.fk_soc IN (".$this->db->sanitize($socids).")";
|
||||
|
|
|
|||
|
|
@ -2221,8 +2221,10 @@ class Contrat extends CommonObject
|
|||
|
||||
$sql = "SELECT c.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||
if (!empty($product_categories)) {
|
||||
if (!empty($product_categories) || !empty($line_status)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON cd.fk_contrat = c.rowid";
|
||||
}
|
||||
if (!empty($product_categories)) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = cd.fk_product AND cp.fk_categorie IN (".$this->db->sanitize(implode(', ', $product_categories)).")";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc =".((int) $this->socid);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
|
||||
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2015-2025 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2021 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
|
|
@ -48,25 +47,27 @@
|
|||
* @var User $user
|
||||
*
|
||||
* @var string $dolibarr_main_url_root
|
||||
* @var string $action
|
||||
* @var string $massaction
|
||||
* @var string $confirm
|
||||
* @var ?int[] $toselect
|
||||
* @var ?string $diroutputmassaction
|
||||
* @var string $uploaddir
|
||||
* @var string $objectclass
|
||||
* @var ?string $objectlabel
|
||||
*
|
||||
* @var int $error
|
||||
*
|
||||
* @var ?string $permissiontoadd
|
||||
* @var ?string $permissiontoread
|
||||
* @var ?string $permissiontodelete
|
||||
* @var ?string $permissiontoclose
|
||||
* @var ?string $permissiontoapprove
|
||||
* @var ?int[] $toselect
|
||||
* @var ?string $diroutputmassaction
|
||||
* @var ?string $objectlabel
|
||||
* @var ?string $option
|
||||
* @var int $deliveryreceipt
|
||||
* @var string $action
|
||||
* @var string $massaction
|
||||
* @var string $objectclass
|
||||
* @var string $uploaddir
|
||||
* @var string $confirm
|
||||
* @var string $month
|
||||
* @var string $year
|
||||
* @var int $error
|
||||
*
|
||||
* @var ?string $search_status
|
||||
* @var ?int $hidedetails
|
||||
* @var ?int $hidedesc
|
||||
* @var ?int $hideref
|
||||
|
|
@ -94,7 +95,6 @@ if (empty($objectclass) || empty($uploaddir)) {
|
|||
if (empty($massaction)) {
|
||||
$massaction = '';
|
||||
}
|
||||
$error = 0;
|
||||
|
||||
// Note: list of strings for objectclass could be extended to accepted/expected classes
|
||||
'
|
||||
|
|
@ -840,13 +840,24 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
|
|||
}
|
||||
|
||||
$arrayofinclusion = array();
|
||||
foreach ($listofobjectref as $tmppdf) {
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$';
|
||||
$parameters = array(
|
||||
'listofobjectref' => $listofobjectref,
|
||||
'arrayofinclusion' => &$arrayofinclusion,
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('updateSearchRegexToMergeDoc', $parameters, $object, $action);
|
||||
|
||||
if (empty($reshook)) {
|
||||
foreach ($listofobjectref as $tmppdf) {
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$';
|
||||
}
|
||||
foreach ($listofobjectref as $tmppdf) {
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[\w\-\'\&\.]+\.pdf$'; // To include PDF generated from ODX files
|
||||
}
|
||||
}
|
||||
foreach ($listofobjectref as $tmppdf) {
|
||||
$arrayofinclusion[] = '^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9\-\_\'\&\.]+\.pdf$'; // To include PDF generated from ODX files
|
||||
}
|
||||
$listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, 1);
|
||||
|
||||
$listoffiles = dol_dir_list($uploaddir, 'all', 1, $arrayofinclusion, '\.meta$|\.png$', 'date', SORT_DESC, 0, 1);
|
||||
|
||||
dol_syslog("Found ".count($listoffiles)." files");
|
||||
|
||||
// build list of files with full path
|
||||
$files = array();
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
|||
$result = $object->fetch($id);
|
||||
|
||||
if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) {
|
||||
$resultthirdparty = $object->fetch_thirdparty();
|
||||
$object->fetch_thirdparty();
|
||||
$thirdparty = $object->thirdparty;
|
||||
if (is_object($thirdparty)) {
|
||||
$sendtosocid = $thirdparty->id;
|
||||
|
|
|
|||
|
|
@ -496,15 +496,20 @@ if ($useajax) {
|
|||
print '<script nonce="'.getNonce().'" type="text/javascript">';
|
||||
|
||||
// Enable jquery handlers on new generated HTML objects (same code than into lib_footer.js.php)
|
||||
// Because the content is reloaded by ajax call, we must also reenable some jquery hooks
|
||||
// Wrapper to manage document_preview
|
||||
// Because the content is reloaded by ajax call, we must also redefine/reenable some jquery hooks.
|
||||
|
||||
// Handler to manage document_preview on click on a .documentpreview css class.
|
||||
if ($conf->browser->layout != 'phone') {
|
||||
print "\n/* JS CODE TO ENABLE document_preview */\n";
|
||||
print '
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".documentpreview").click(function () {
|
||||
console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\'));
|
||||
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), \''.dol_escape_js($langs->transnoentities("Preview")).'\');
|
||||
var titledocpreview = $(this).attr(\'data-title\');
|
||||
if (titledocpreview == undefined || titledocpreview == "") {
|
||||
titledocpreview = \''.dol_escape_js($langs->transnoentities("Preview")).'\'
|
||||
}
|
||||
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), titledocpreview);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ if (isModEnabled('shipping') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_SH
|
|||
if (isModEnabled('invoice') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED') && $user->hasRight('facture', 'lire')) {
|
||||
$arrayresult['searchintoinvoice'] = array('position' => 90, 'img' => 'object_bill', 'label' => $langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text' => img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url' => DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
if (isModEnabled('invoice') && !getDolGlobalString('MAIN_SEARCHFORM_CUSTOMER_INVOICE_REC_DISABLED') && $user->hasRight('facture', 'lire')) {
|
||||
$arrayresult['searchintoinvoicerec'] = array('position' => 90, 'img' => 'object_bill', 'label' => $langs->trans("SearchIntoCustomerInvoicesRec", $search_boxvalue), 'text' => img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoicesRec", $search_boxvalue), 'url' => DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
}
|
||||
|
||||
if (isModEnabled('supplier_proposal') && !getDolGlobalString('MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED') && $user->hasRight('supplier_proposal', 'lire')) {
|
||||
$arrayresult['searchintosupplierpropal'] = array('position' => 100, 'img' => 'object_supplier_proposal', 'label' => $langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text' => img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url' => DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ class box_actions_future extends ModeleBoxes
|
|||
$this->enabled = isModEnabled('agenda');
|
||||
|
||||
$this->hidden = !($user->hasRight('agenda', 'myactions', 'read'));
|
||||
|
||||
$this->urltoaddentry = DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
|
||||
$this->msgNoRecords = 'NoUpcomingEvent';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -65,7 +69,7 @@ class box_actions_future extends ModeleBoxes
|
|||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $user, $langs, $conf;
|
||||
global $user, $langs;
|
||||
|
||||
$this->max = $max;
|
||||
|
||||
|
|
@ -76,7 +80,10 @@ class box_actions_future extends ModeleBoxes
|
|||
$societestatic = new Societe($this->db);
|
||||
$actionstatic = new ActionComm($this->db);
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleFutureActions", $max));
|
||||
$text = $langs->trans("BoxTitleFutureActions", $max);
|
||||
$this->info_box_head = array(
|
||||
'text' => $text.'<a class="paddingleft" href="'.DOL_URL_ROOT.'/comm/action/list.php?sortfield=a.datep&datestart_dtstartday='.dol_print_date($now, '%d').'&datestart_dtstartmonth='.dol_print_date($now, '%m').'&datestart_dtstartyear='.dol_print_date($now, '%Y').'&sortorder=ASC"><span class="badge">...</span></a>'
|
||||
);
|
||||
|
||||
if ($user->hasRight('agenda', 'myactions', 'read')) {
|
||||
$sql = "SELECT a.id, a.label, a.datep as dp, a.percent as percentage";
|
||||
|
|
@ -177,13 +184,6 @@ class box_actions_future extends ModeleBoxes
|
|||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text' => '<span class="opacitymedium">'.$langs->trans("NoActionsToDo").'</span>'
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ class box_commandes extends ModeleBoxes
|
|||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$num=0;
|
||||
$line = 0;
|
||||
|
||||
while ($line < $num) {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class box_contacts extends ModeleBoxes
|
|||
$this->hidden = !($user->hasRight('societe', 'lire') && $user->hasRight('societe', 'contact', 'lire'));
|
||||
|
||||
$this->urltoaddentry = DOL_URL_ROOT.'/contact/card.php?action=create';
|
||||
|
||||
$this->msgNoRecords = 'NoRecordedContacts';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class box_services_contracts extends ModeleBoxes
|
|||
$thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur;
|
||||
|
||||
$dateline = $this->db->jdate($objp->date_line);
|
||||
if ($contractstatic->status == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + $conf->contrat->services->expires->warning_delay) < $now) {
|
||||
if ($contractstatic->status == Contrat::STATUS_VALIDATED && $objp->contractline_status == ContratLigne::STATUS_OPEN && !empty($dateline) && ($dateline + getWarningDelay('contract', 'services', 'expires')) < $now) {
|
||||
$late = img_warning($langs->trans("Late"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -205,26 +205,26 @@ class CMailFile
|
|||
/**
|
||||
* CMailFile
|
||||
*
|
||||
* @param string $subject Topic/Subject of mail
|
||||
* @param string $to Recipients emails (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]"). Note: the keyword '__SUPERVISOREMAIL__' is not allowed here and must be replaced by caller.
|
||||
* @param string $from Sender email (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]")
|
||||
* @param string $msg Message
|
||||
* @param ?string[] $filename_list List of files to attach (full path of filename on file system)
|
||||
* @param ?string[] $mimetype_list List of MIME type of attached files
|
||||
* @param ?string[] $mimefilename_list List of attached file name in message
|
||||
* @param string $addr_cc Email cc (Example: 'abc@def.com, ghk@lmn.com')
|
||||
* @param string $addr_bcc Email bcc (Note: This is autocompleted with MAIN_MAIL_AUTOCOPY_TO if defined)
|
||||
* @param int<0,1> $deliveryreceipt Ask a delivery receipt
|
||||
* @param int<-1,1> $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable)
|
||||
* @param string $errors_to Email for errors-to
|
||||
* @param string|array<string,string> $css Css option (should be array, legacy: empty string if none)
|
||||
* @param string $trackid Tracking string (contains type and id of related element)
|
||||
* @param string $moreinheader More in header. $moreinheader must contains the "\r\n" at end of each line
|
||||
* @param string $sendcontext 'standard', 'emailing', 'ticket', 'password', ... (used to define which sending mode and parameters to use)
|
||||
* @param string $replyto Reply-to email (will be set to the same value than From by default if not provided)
|
||||
* @param string $upload_dir_tmp Temporary directory (used to convert images embedded as img src=data:image)
|
||||
* @param string $in_reply_to Message-ID of the message we reply to
|
||||
* @param string $references String with list of Message-ID of the thread ('<123> <456> ...')
|
||||
* @param string $subject Topic/Subject of mail
|
||||
* @param string $to Recipients emails (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]"). Note: the keyword '__SUPERVISOREMAIL__' is not allowed here and must be replaced by caller.
|
||||
* @param string $from Sender email (RFC 2822: "Name firstname <email>[, ...]" or "email[, ...]" or "<email>[, ...]")
|
||||
* @param string $msg Message
|
||||
* @param ?string[] $filename_list List of files to attach (full path of filename on file system)
|
||||
* @param ?string[] $mimetype_list List of MIME type of attached files
|
||||
* @param ?string[] $mimefilename_list List of attached file name in message
|
||||
* @param string $addr_cc Email cc (Example: 'abc@def.com, ghk@lmn.com')
|
||||
* @param string $addr_bcc Email bcc (Note: This is autocompleted with MAIN_MAIL_AUTOCOPY_TO if defined)
|
||||
* @param int<0,1> $deliveryreceipt Ask a delivery receipt
|
||||
* @param int<-1,1> $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable)
|
||||
* @param string $errors_to Email for errors-to
|
||||
* @param string|array<string,string> $css Css option (should be array, legacy: empty string if none)
|
||||
* @param string $trackid Tracking string (contains type and id of related element)
|
||||
* @param string $moreinheader More in header. $moreinheader must contains the "\r\n" at end of each line
|
||||
* @param string $sendcontext 'standard', 'emailing', 'ticket', 'password', ... (used to define which sending mode and parameters to use)
|
||||
* @param string $replyto Reply-to email (will be set to the same value than From by default if not provided)
|
||||
* @param string $upload_dir_tmp Temporary directory (used to convert images embedded as img src=data:image)
|
||||
* @param string $in_reply_to Message-ID of the message we reply to
|
||||
* @param string $references String with list of Message-ID of the thread ('<123> <456> ...')
|
||||
*/
|
||||
public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '', $upload_dir_tmp = '', $in_reply_to = '', $references = '')
|
||||
{
|
||||
|
|
@ -651,7 +651,9 @@ class CMailFile
|
|||
$smtps->setOptions($options);
|
||||
}
|
||||
|
||||
$this->msgid = time().'.'.mt_rand(100, 999).'.SMTPs-dolibarr-'.$this->trackid.'@'.$host;
|
||||
$this->msgid = uniqid('', true).'.SMTPs-dolibarr-'.$this->trackid.'@'.$host;
|
||||
|
||||
$smtps->setMessageID($this->msgid);
|
||||
|
||||
$this->smtps = $smtps;
|
||||
} elseif ($this->sendmode == 'swiftmailer') {
|
||||
|
|
@ -674,7 +676,7 @@ class CMailFile
|
|||
$headers = $this->message->getHeaders();
|
||||
|
||||
$headers->addTextHeader('X-Dolibarr-TRACKID', $this->trackid.'@'.$host);
|
||||
$this->msgid = time().'.'.mt_rand(100, 999).'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
|
||||
$this->msgid = uniqid('', true).'.swiftmailer-dolibarr-'.$this->trackid.'@'.$host;
|
||||
$headerID = $this->msgid;
|
||||
$msgid = $headers->get('Message-ID');
|
||||
if ($msgid instanceof Swift_Mime_Headers_IdentificationHeader) {
|
||||
|
|
@ -1677,11 +1679,11 @@ class CMailFile
|
|||
|
||||
$trackid = $this->trackid;
|
||||
if ($trackid) {
|
||||
$this->msgid = time().'.'.mt_rand(100, 999).'.phpmail-dolibarr-'.$trackid.'@'.$host;
|
||||
$this->msgid = uniqid('', true).'.phpmail-dolibarr-'.$trackid.'@'.$host;
|
||||
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2; // Uppercase seems replaced by phpmail
|
||||
$out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2;
|
||||
} else {
|
||||
$this->msgid = time().'.'.mt_rand(100, 999).'.phpmail@'.$host;
|
||||
$this->msgid = uniqid('', true).'.phpmail@'.$host;
|
||||
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1341,7 +1341,7 @@ abstract class CommonInvoice extends CommonObject
|
|||
// Set a default value for service if not provided
|
||||
if (empty($service)) {
|
||||
$service = 'StripeTest';
|
||||
if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) {
|
||||
if (getDolGlobalString('STRIPE_LIVE')/* && !GETPOST('forcesandbox', 'alpha')*/) {
|
||||
$service = 'StripeLive';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10791,6 +10791,9 @@ abstract class CommonObject
|
|||
if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) {
|
||||
$fieldvalues['date_modification'] = $this->db->idate($now);
|
||||
}
|
||||
if (getDolGlobalString('MAIN_DISABLE_AUTO_UPDATE_OF_TMS_FIELDS') && array_key_exists('tms', $fieldvalues)) {
|
||||
$fieldvalues['tms'] = $this->db->idate($now);
|
||||
}
|
||||
if (array_key_exists('fk_user_modif', $fieldvalues) && !($fieldvalues['fk_user_modif'] > 0)) {
|
||||
$fieldvalues['fk_user_modif'] = $user->id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,8 +119,6 @@ class Fiscalyear extends CommonObject
|
|||
$this->db = $db;
|
||||
|
||||
$this->ismultientitymanaged = 1;
|
||||
$this->labelStatusShort = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed');
|
||||
$this->labelStatus = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2140,13 +2140,13 @@ class Form
|
|||
* @param int<0,1>|string $show_empty 0=list with no empty value, 1=add also an empty value into list
|
||||
* @param int[]|null $exclude Array list of users id to exclude
|
||||
* @param int $disabled If select list must be disabled
|
||||
* @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. User '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
|
||||
* @param int[]|''|'hierarchy'|'hierarchyme' $include Array list of users id to include. Use '' for all users or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me
|
||||
* @param int[]|'' $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled
|
||||
* @param string $force_entity '0' or list of Ids of environment to force, separated by a comma, or 'default' = do no extend to all entities allowed to superadmin.
|
||||
* @param int $maxlength Maximum length of string into list (0=no limit)
|
||||
* @param int<-1,1> $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status
|
||||
* @param string $morefilter Add more filters into sql request (Example: '(employee:=:1)'). This value must not come from user input.
|
||||
* @param int<0,1> $show_every 0=default list, 1=add also a value "Everybody" at beginning of list
|
||||
* @param int<0,3> $showalso 0=default list, 1=add also a value "Everybody" at beginning of list, 2=add also a value "My team" at beginning of list (if user has at least 1 people), 3=add also "Everybody" + "My Team"
|
||||
* @param string $enableonlytext If option $enableonlytext is set, we use this text to explain into label why record is disabled. Not used if enableonly is empty.
|
||||
* @param string $morecss More css
|
||||
* @param int<0,1> $notdisabled Show only active users (note: this will also happen, whatever is this option, if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
|
||||
|
|
@ -2156,14 +2156,14 @@ class Form
|
|||
* @return string|array<int,string|array{id:int,label:string,labelhtml:string,color:string,picto:string}> HTML select string
|
||||
* @see select_dolgroups()
|
||||
*/
|
||||
public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $notdisabled = 0, $outputmode = 0, $multiple = false, $forcecombo = 0)
|
||||
public function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '', $maxlength = 0, $showstatus = 0, $morefilter = '', $showalso = 0, $enableonlytext = '', $morecss = '', $notdisabled = 0, $outputmode = 0, $multiple = false, $forcecombo = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf, $user, $langs, $hookmanager;
|
||||
global $action;
|
||||
|
||||
// If no preselected user defined, we take current user
|
||||
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) {
|
||||
if ((is_numeric($selected) && ($selected < -3 || empty($selected))) && !getDolGlobalString('SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE')) {
|
||||
$selected = $user->id;
|
||||
}
|
||||
|
||||
|
|
@ -2173,23 +2173,38 @@ class Form
|
|||
$selected = array($selected);
|
||||
}
|
||||
|
||||
// Exclude some users in $excludeUsers string
|
||||
$excludeUsers = null;
|
||||
$includeUsers = null;
|
||||
|
||||
// Exclude some users
|
||||
if (is_array($exclude)) {
|
||||
$excludeUsers = implode(",", $exclude);
|
||||
}
|
||||
// Include some uses
|
||||
|
||||
// Include some users in $includeUsers string
|
||||
$includeUsers = null;
|
||||
$includeUsersArray = array();
|
||||
if (is_array($include)) {
|
||||
$includeUsers = implode(",", $include);
|
||||
$includeUsersArray = $include;
|
||||
} elseif ($include == 'hierarchy') {
|
||||
// Build list includeUsers to have only hierarchy
|
||||
$includeUsers = implode(",", $user->getAllChildIds(0));
|
||||
// Build list includeUsersArray to have only hierarchy
|
||||
$includeUsersArray = $user->getAllChildIds(0);
|
||||
} elseif ($include == 'hierarchyme') {
|
||||
// Build list includeUsers to have only hierarchy and current user
|
||||
$includeUsers = implode(",", $user->getAllChildIds(1));
|
||||
// Build list includeUsersArray to have only hierarchy and current user
|
||||
$includeUsersArray = $user->getAllChildIds(1);
|
||||
}
|
||||
// Get list of allowed users
|
||||
/* We do not limit list of users. Because we should limit this only for combo list into HR features where we may be allowed to
|
||||
* see all other users and element in other. For example in agenda, we can have permission to read all event of otherusers.
|
||||
* So we disable this.
|
||||
if (!$user->hasRight('user', 'user', 'lire')) {
|
||||
if (empty($includeUsersArray)) {
|
||||
$includeUsers = implode(",", $user->getAllChildIds(1));
|
||||
} else {
|
||||
$includeUsers = implode(",", array_intersect($includeUsersArray, $user->getAllChildIds(1)));
|
||||
}
|
||||
} else {
|
||||
$includeUsers = implode(",", $includeUsersArray);
|
||||
} */
|
||||
$includeUsers = implode(",", $includeUsersArray);
|
||||
|
||||
$num = 0;
|
||||
|
||||
|
|
@ -2297,7 +2312,23 @@ class Form
|
|||
'picto' => ''
|
||||
);
|
||||
}
|
||||
if ($show_every) {
|
||||
if ($showalso == 2 || $showalso == 3) {
|
||||
$out .= '<option value="-3"' . ((in_array(-3, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("MyTeam") . ' --</option>' . "\n";
|
||||
|
||||
$hasAtLeastOneSubordinate = (count($user->getAllChildIds(1)) > 1);
|
||||
if ($hasAtLeastOneSubordinate) {
|
||||
//$sql = "SELECT rowid FROM".MAIN_DB_PREFIX."user "
|
||||
$outarray[-3] = '-- ' . $langs->trans("MyTeam") . ' --';
|
||||
$outarray2[-3] = array(
|
||||
'id' => -3,
|
||||
'label' => '-- ' . $langs->trans("MyTeam") . ' --',
|
||||
'labelhtml' => '-- ' . $langs->trans("MyTeam") . ' --',
|
||||
'color' => '',
|
||||
'picto' => ''
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($showalso == 1 || $showalso == 3) {
|
||||
$out .= '<option value="-2"' . ((in_array(-2, $selected)) ? ' selected' : '') . '>-- ' . $langs->trans("Everybody") . ' --</option>' . "\n";
|
||||
|
||||
$outarray[-2] = '-- ' . $langs->trans("Everybody") . ' --';
|
||||
|
|
@ -8112,7 +8143,9 @@ class Form
|
|||
|
||||
if ($typehour == 'select' || $typehour == 'textselect') {
|
||||
$retstring .= '<select class="flat" id="select_' . $prefix . 'min" name="' . $prefix . 'min"' . ($disabled ? ' disabled' : '') . '>';
|
||||
for ($min = 0; $min <= 55; $min += 5) {
|
||||
$step = getDolGlobalInt('MAIN_DURATION_STEP');
|
||||
$duration_step = ($step > 0) ? $step : 5;
|
||||
for ($min = 0; $min <= 59; $min += $duration_step) {
|
||||
$retstring .= '<option value="' . $min . '"';
|
||||
if (is_numeric($minSelected) && $minSelected == $min) {
|
||||
$retstring .= ' selected';
|
||||
|
|
|
|||
|
|
@ -666,7 +666,6 @@ class FormAccounting extends Form
|
|||
public static function printJournalLine($langs, $date, $ref, $accountAccounting, $labelOperation, $paymentMode, $amount)
|
||||
{
|
||||
$out = '<tr class="oddeven">';
|
||||
$out .= '<td></td>';
|
||||
$out .= '<td>'.$date.'</td>';
|
||||
$out .= '<td>'.$ref.'</td>';
|
||||
// Ledger account
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ class FormProjets extends Form
|
|||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">';
|
||||
$out .= '<select class="valignmiddle flat' . ($morecss ? ' ' . $morecss : '') . '"' . ($disabled ? ' disabled="disabled"' : '') . ' id="' . $htmlname . '" name="' . $htmlname . '">'."\n";
|
||||
}
|
||||
if (!empty($show_empty)) {
|
||||
$out .= '<option value="0" class="optiongrey">';
|
||||
|
|
@ -411,7 +411,7 @@ class FormProjets extends Form
|
|||
} else {
|
||||
$out .= ' ';
|
||||
}
|
||||
$out .= '</option>';
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
|
@ -486,7 +486,7 @@ class FormProjets extends Form
|
|||
$out .= '<option value="' . $obj->rowid . '" selected';
|
||||
$out .= ' data-html="' . dol_escape_htmltag($labeltoshowhtml) . '"';
|
||||
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||
$out .= '>' . $labeltoshow . '</option>';
|
||||
$out .= '>' . $labeltoshow . '</option>'."\n";
|
||||
} else {
|
||||
if ($hideunselectables && $disabled && ($selected != $obj->rowid)) {
|
||||
$resultat = '';
|
||||
|
|
@ -500,7 +500,7 @@ class FormProjets extends Form
|
|||
$resultat .= ' data-html="' . dol_escape_htmltag($labeltoshowhtml) . '"';
|
||||
$resultat .= '>';
|
||||
$resultat .= $labeltoshow;
|
||||
$resultat .= '</option>';
|
||||
$resultat .= '</option>'."\n";
|
||||
}
|
||||
$out .= $resultat;
|
||||
}
|
||||
|
|
@ -509,7 +509,7 @@ class FormProjets extends Form
|
|||
}
|
||||
}
|
||||
if (empty($option_only)) {
|
||||
$out .= '</select>';
|
||||
$out .= '</select>'."\n";
|
||||
}
|
||||
|
||||
$this->nboftasks = $num;
|
||||
|
|
|
|||
|
|
@ -1685,10 +1685,19 @@ class FormTicket
|
|||
}
|
||||
*/
|
||||
|
||||
// From
|
||||
// From (and Reply-To if defined)
|
||||
$from = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_FROM');
|
||||
print '<tr class="email_line"><td class="width200"><span class="">'.$langs->trans("MailFrom").'</span></td>';
|
||||
print '<td><span class="">'.img_picto('', 'email', 'class="pictofixedwidth"').$from.'</span></td></tr>';
|
||||
$replyto = getDolGlobalString('TICKET_NOTIFICATION_EMAIL_REPLYTO');
|
||||
print '<tr class="email_line"><td class="width200"><span class="">'.$langs->trans("MailFrom");
|
||||
if ($replyto) {
|
||||
print ' <span class="opacitymedium">('.$langs->trans("MailReply").')</span>';
|
||||
}
|
||||
print '</span></td>';
|
||||
print '<td><span class="">'.img_picto('', 'email', 'class="pictofixedwidth"').$from;
|
||||
if ($replyto) {
|
||||
print ' <span class="opacitymedium">('.$replyto.')</span>';
|
||||
}
|
||||
print '</span></td></tr>';
|
||||
|
||||
// Recipients / adressed-to
|
||||
print '<tr class="email_line"><td>'.$langs->trans('MailRecipients');
|
||||
|
|
|
|||
|
|
@ -44,7 +44,9 @@ class InfoBox
|
|||
1 => 'UsersHome',
|
||||
2 => 'MembersHome',
|
||||
3 => 'ThirdpartiesHome',
|
||||
4 => 'productindex',
|
||||
11 => 'TicketsHome',
|
||||
20 => 'interventionindex',
|
||||
27 => 'AccountancyHome'
|
||||
);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,11 @@ class SMTPs
|
|||
*/
|
||||
private $_smtpsToken = null;
|
||||
|
||||
/**
|
||||
* @var ?string Message-ID to use
|
||||
*/
|
||||
private $_msgId = null;
|
||||
|
||||
/**
|
||||
* @var ?array{org:string,real?:string,addr:string,user:string,host:string} Who sends the Message
|
||||
* This can be defined via a INI file or via a setter method
|
||||
|
|
@ -293,8 +298,20 @@ class SMTPs
|
|||
*/
|
||||
private $_options = array();
|
||||
|
||||
|
||||
/**
|
||||
* Set delivery receipt
|
||||
* Set Message-ID
|
||||
*
|
||||
* @param string $_msgId Message-ID to use
|
||||
* @return void
|
||||
*/
|
||||
public function setMessageID($_msgId = '')
|
||||
{
|
||||
$this->_msgId = $_msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set options
|
||||
*
|
||||
* @param array<string,array<string,mixed>> $_options An array of options for stream_context_create()
|
||||
* @return void
|
||||
|
|
@ -1546,16 +1563,15 @@ class SMTPs
|
|||
|
||||
$host = dol_getprefix('email');
|
||||
|
||||
//NOTE: Message-ID should probably contain the username of the user who sent the msg
|
||||
$_header .= 'Subject: '.$this->getSubject()."\r\n";
|
||||
$_header .= 'Date: '.date("r")."\r\n";
|
||||
|
||||
$trackid = $this->getTrackId();
|
||||
if ($trackid) {
|
||||
$_header .= 'Message-ID: <'.time().'.SMTPs-dolibarr-'.$trackid.'@'.$host.">\r\n";
|
||||
$_header .= 'Message-ID: <'.(empty($this->_msgId) ? uniqid().'.SMTPs-dolibarr-'.$trackid.'@'.$host : $this->_msgId).">\r\n";
|
||||
$_header .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host."\r\n";
|
||||
} else {
|
||||
$_header .= 'Message-ID: <'.time().'.SMTPs@'.$host.">\r\n";
|
||||
$_header .= 'Message-ID: <'.(empty($this->_msgId) ? uniqid().'.SMTPs@'.$host : $this->_msgId).">\r\n";
|
||||
}
|
||||
if (!empty($_SERVER['REMOTE_ADDR'])) {
|
||||
$_header .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR']."\r\n";
|
||||
|
|
|
|||
|
|
@ -39,7 +39,10 @@
|
|||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*
|
||||
* @var ?int[] $toselect Items selected on page, only used to see if not empty here
|
||||
* @var ?int[] $toselect Items selected on page, only used to see if not empty here
|
||||
* @var ?int $SHOWLEGEND Show legend or not
|
||||
* @var string $customreportkey Custom report key
|
||||
* @var string $customsql Custom SQL
|
||||
*/
|
||||
'
|
||||
@phan-var-force ?int[] $toselect
|
||||
|
|
@ -89,8 +92,6 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
|
|||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
|
||||
|
||||
$object = null;
|
||||
} else {
|
||||
// When included into a main page
|
||||
|
|
@ -128,7 +129,7 @@ if (!isset($search_graph)) {
|
|||
if (!empty($object)) {
|
||||
$objecttype = $object->element.($object->module ? '@'.$object->module : '');
|
||||
}
|
||||
if (!is_string($objecttype) || empty($objecttype)) {
|
||||
if ((!is_string($objecttype) || empty($objecttype)) && isModEnabled('societe')) {
|
||||
$objecttype = 'thirdparty';
|
||||
}
|
||||
'@phan-var-force string $objecttype'; // Help phan that suggests $objecttype can be null
|
||||
|
|
@ -161,16 +162,17 @@ $arrayoftype = array(
|
|||
'thirdparty' => array('langs' => 'companies', 'label' => 'ThirdParties', 'picto' => 'company', 'ObjectClassName' => 'Societe', 'enabled' => isModEnabled('societe'), 'ClassPath' => "/societe/class/societe.class.php"),
|
||||
'contact' => array('label' => 'Contacts', 'picto' => 'contact', 'ObjectClassName' => 'Contact', 'enabled' => isModEnabled('societe'), 'ClassPath' => "/contact/class/contact.class.php"),
|
||||
'proposal' => array('label' => 'Proposals', 'picto' => 'proposal', 'ObjectClassName' => 'Propal', 'enabled' => isModEnabled('propal'), 'ClassPath' => "/comm/propal/class/propal.class.php"),
|
||||
'order' => array('label' => 'Orders', 'picto' => 'order', 'ObjectClassName' => 'Commande', 'enabled' => isModEnabled('order'), 'ClassPath' => "/commande/class/commande.class.php"),
|
||||
'order' => array('langs' => 'orders', 'label' => 'Orders', 'picto' => 'order', 'ObjectClassName' => 'Commande', 'enabled' => isModEnabled('order'), 'ClassPath' => "/commande/class/commande.class.php"),
|
||||
'orderdet' => array('langs' => 'orders', 'label' => 'SaleOrderLines', 'picto' => 'order', 'ObjectClassName' => 'OrderLine', 'enabled' => isModEnabled('order'), 'ClassPath' => "/commande/class/orderline.class.php"),
|
||||
'invoice' => array('langs' => 'facture', 'label' => 'Invoices', 'picto' => 'bill', 'ObjectClassName' => 'Facture', 'enabled' => isModEnabled('invoice'), 'ClassPath' => "/compta/facture/class/facture.class.php"),
|
||||
'invoice_template' => array('label' => 'PredefinedInvoices', 'picto' => 'bill', 'ObjectClassName' => 'FactureRec', 'enabled' => isModEnabled('invoice'), 'ClassPath' => "/compta/class/facturerec.class.php", 'langs' => 'bills'),
|
||||
'contract' => array('label' => 'Contracts', 'picto' => 'contract', 'ObjectClassName' => 'Contrat', 'enabled' => isModEnabled('contract'), 'ClassPath' => "/contrat/class/contrat.class.php", 'langs' => 'contracts'),
|
||||
'contractdet' => array('label' => 'ContractLines', 'picto' => 'contract', 'ObjectClassName' => 'ContratLigne', 'enabled' => isModEnabled('contract'), 'ClassPath' => "/contrat/class/contrat.class.php", 'langs' => 'contracts'),
|
||||
'invoice_template' => array('langs' => 'bills', 'label' => 'PredefinedInvoices', 'picto' => 'bill', 'ObjectClassName' => 'FactureRec', 'enabled' => isModEnabled('invoice'), 'ClassPath' => "/compta/class/facturerec.class.php"),
|
||||
'contract' => array('langs' => 'contracts', 'label' => 'Contracts', 'picto' => 'contract', 'ObjectClassName' => 'Contrat', 'enabled' => isModEnabled('contract'), 'ClassPath' => "/contrat/class/contrat.class.php"),
|
||||
'contractdet' => array('langs' => 'contracts', 'label' => 'ContractLines', 'picto' => 'contract', 'ObjectClassName' => 'ContratLigne', 'enabled' => isModEnabled('contract'), 'ClassPath' => "/contrat/class/contrat.class.php"),
|
||||
'bom' => array('label' => 'BOM', 'picto' => 'bom', 'ObjectClassName' => 'Bom', 'enabled' => isModEnabled('bom')),
|
||||
'mrp' => array('label' => 'MO', 'picto' => 'mrp', 'ObjectClassName' => 'Mo', 'enabled' => isModEnabled('mrp'), 'ClassPath' => "/mrp/class/mo.class.php"),
|
||||
'ticket' => array('label' => 'Ticket', 'picto' => 'ticket', 'ObjectClassName' => 'Ticket', 'enabled' => isModEnabled('ticket')),
|
||||
'member' => array('label' => 'Adherent', 'picto' => 'member', 'ObjectClassName' => 'Adherent', 'enabled' => isModEnabled('member'), 'ClassPath' => "/adherents/class/adherent.class.php", 'langs' => 'members'),
|
||||
'cotisation' => array('label' => 'Subscriptions', 'picto' => 'member', 'ObjectClassName' => 'Subscription', 'enabled' => isModEnabled('member'), 'ClassPath' => "/adherents/class/subscription.class.php", 'langs' => 'members'),
|
||||
'member' => array('langs' => 'members', 'label' => 'Adherent', 'picto' => 'member', 'ObjectClassName' => 'Adherent', 'enabled' => isModEnabled('member'), 'ClassPath' => "/adherents/class/adherent.class.php"),
|
||||
'cotisation' => array('langs' => 'members', 'label' => 'Subscriptions', 'picto' => 'member', 'ObjectClassName' => 'Subscription', 'enabled' => isModEnabled('member'), 'ClassPath' => "/adherents/class/subscription.class.php"),
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -209,6 +211,7 @@ if ($objecttype) {
|
|||
|
||||
if ($fileforclass !== null) {
|
||||
dol_include_once($fileforclass);
|
||||
|
||||
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
|
||||
}
|
||||
if (!empty($ObjectClassName)) {
|
||||
|
|
@ -356,8 +359,6 @@ if (!empty($object->element_for_permission)) {
|
|||
|
||||
restrictedArea($user, $features, 0, '');
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
|
@ -384,6 +385,7 @@ if (!defined('USE_CUSTOM_REPORT_AS_INCLUDE')) {
|
|||
}
|
||||
}
|
||||
|
||||
// Define $newarrayoftype that is array of object available for report
|
||||
$newarrayoftype = array();
|
||||
foreach ($arrayoftype as $key => $val) {
|
||||
if (dol_eval((string) $val['enabled'], 1, 1, '1')) {
|
||||
|
|
@ -635,7 +637,8 @@ if (!defined('MAIN_CUSTOM_REPORT_KEEP_GRAPH_ONLY')) {
|
|||
// Select object
|
||||
print '<div class="divadvancedsearchfield center floatnone">';
|
||||
print '<div class="inline-block"><span class="opacitymedium">'.$langs->trans("StatisticsOn").'</span></div> ';
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1, '', 0, 1);
|
||||
|
||||
print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth250', 1, '', 0, 1);
|
||||
if (empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="submit" class="button buttongen button-save nomargintop" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||
} else {
|
||||
|
|
@ -651,41 +654,42 @@ if (!defined('MAIN_CUSTOM_REPORT_KEEP_GRAPH_ONLY')) {
|
|||
}
|
||||
print '</div><div class="clearboth"></div>';
|
||||
|
||||
// Filter (you can use param &show_search_component_params_hidden=1 for debug)
|
||||
if (!empty($object)) {
|
||||
if (!empty($newarrayoftype)) {
|
||||
// Filter (you can use param &show_search_component_params_hidden=1 for debug)
|
||||
if (!empty($object)) {
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params, array(), $search_component_params_hidden, $arrayoffilterfields);
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// YAxis (add measures into array)
|
||||
$count = 0;
|
||||
//var_dump($arrayofmesures);
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span></div>';
|
||||
$simplearrayofmesures = array();
|
||||
foreach ($arrayofmesures as $key => $val) {
|
||||
$simplearrayofmesures[$key] = $arrayofmesures[$key]['label'];
|
||||
}
|
||||
print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300 widthcentpercentminusx', 1, 0, '', '', $langs->transnoentitiesnoconv("Measures")); // Fill the array $arrayofmeasures with possible fields
|
||||
print '</div>';
|
||||
|
||||
// XAxis
|
||||
$count = 0;
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print $form->searchComponent(array($object->element => $object->fields), $search_component_params, array(), $search_component_params_hidden, $arrayoffilterfields);
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>';
|
||||
//var_dump($arrayofxaxis);
|
||||
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400 widthcentpercentminusx'); // Fill the array $arrayofxaxis with possible fields
|
||||
print '</div>';
|
||||
|
||||
// Group by
|
||||
$count = 0;
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>';
|
||||
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300 widthcentpercentminusx', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// YAxis (add measures into array)
|
||||
$count = 0;
|
||||
//var_dump($arrayofmesures);
|
||||
print '<div class="divadvancedsearchfield clearboth">';
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span><span class="fas fa-caret-left caretleftaxis" title="'.dol_escape_htmltag($langs->trans("Measures")).'"></span></div>';
|
||||
$simplearrayofmesures = array();
|
||||
foreach ($arrayofmesures as $key => $val) {
|
||||
$simplearrayofmesures[$key] = $arrayofmesures[$key]['label'];
|
||||
}
|
||||
print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300 widthcentpercentminusx', 1, 0, '', '', $langs->transnoentitiesnoconv("Measures")); // Fill the array $arrayofmeasures with possible fields
|
||||
print '</div>';
|
||||
|
||||
// XAxis
|
||||
$count = 0;
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block"><span class="fas fa-ruler-combined paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span><span class="fas fa-caret-down caretdownaxis" title="'.dol_escape_htmltag($langs->trans("XAxis")).'"></span></div>';
|
||||
//var_dump($arrayofxaxis);
|
||||
print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400 widthcentpercentminusx'); // Fill the array $arrayofxaxis with possible fields
|
||||
print '</div>';
|
||||
|
||||
// Group by
|
||||
$count = 0;
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright pictofixedwidth" title="'.dol_escape_htmltag($langs->trans("GroupBy")).'"></span></div>';
|
||||
print $formother->selectGroupByField($object, $search_groupby, $arrayofgroupby, 'minwidth250 maxwidth300 widthcentpercentminusx', $langs->trans("GroupBy")); // Fill the array $arrayofgroupby with possible fields
|
||||
print '</div>';
|
||||
|
||||
|
||||
if ($mode == 'grid') {
|
||||
// YAxis
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
|
|
@ -747,13 +751,12 @@ if (!defined('MAIN_CUSTOM_REPORT_KEEP_GRAPH_ONLY')) {
|
|||
print '</div>';
|
||||
}
|
||||
|
||||
//if ($mode == 'graph') {
|
||||
//
|
||||
//}
|
||||
if (!empty($newarrayoftype)) {
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<input type="submit" class="button buttongen button-save nomargintop" value="'.$langs->trans("Refresh").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<div class="divadvancedsearchfield">';
|
||||
print '<input type="submit" class="button buttongen button-save nomargintop" value="'.$langs->trans("Refresh").'">';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
}
|
||||
|
|
@ -1217,6 +1220,10 @@ if ($sql) {
|
|||
print '<!-- Section to show the result -->'."\n";
|
||||
print '<div class="customreportsoutput'.($totalnbofrecord ? '' : ' customreportsoutputnotdata').'">';
|
||||
|
||||
if (empty($newarrayoftype)) {
|
||||
$langs->load("admin");
|
||||
print info_admin($langs->trans("NoSupportedModulesHaveBeenActivated"), 0, 0, 'warning');
|
||||
}
|
||||
|
||||
if ($mode == 'grid') {
|
||||
// TODO
|
||||
|
|
|
|||
|
|
@ -233,7 +233,11 @@ if ($conf->browser->layout != 'phone') {
|
|||
// Click on the preview picto
|
||||
jQuery(".documentpreview").click(function () {
|
||||
console.log("We click on preview for element with href="+$(this).attr(\'href\')+" mime="+$(this).attr(\'mime\'));
|
||||
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), \''.dol_escape_js($langs->transnoentities("Preview")).'\');
|
||||
var titledocpreview = $(this).attr(\'data-title\');
|
||||
if (titledocpreview == undefined || titledocpreview == "") {
|
||||
titledocpreview = \''.dol_escape_js($langs->transnoentities("Preview")).'\'
|
||||
}
|
||||
document_preview($(this).attr(\'href\'), $(this).attr(\'mime\'), titledocpreview);
|
||||
return false;
|
||||
});
|
||||
});'."\n";
|
||||
|
|
|
|||
|
|
@ -677,6 +677,11 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
|||
});
|
||||
if (forcereload) {
|
||||
var url = window.location.href;
|
||||
|
||||
/* reset action param */
|
||||
url = url.replace(/action=\w+/g, '');
|
||||
|
||||
/* reset dol_resetcache param */
|
||||
if (url.indexOf('dol_resetcache') < 0) {
|
||||
if (url.indexOf('?') > -1) {
|
||||
url = url + "&dol_resetcache=1";
|
||||
|
|
@ -684,6 +689,8 @@ function setConstant(url, code, input, entity, strict, forcereload, userid, toke
|
|||
url = url + "?dol_resetcache=1";
|
||||
}
|
||||
}
|
||||
|
||||
/* reset page_y param */
|
||||
var page_y = $(document).scrollTop();
|
||||
url = url.replace(/page_y=\d+/g, '');
|
||||
if (page_y > 0) {
|
||||
|
|
@ -1047,61 +1054,67 @@ function document_preview(file, type, title)
|
|||
|
||||
if ($.inArray(type, ValidImageTypes) < 0) {
|
||||
/* Not an image */
|
||||
var width='85%';
|
||||
var object_width='100%';
|
||||
var width = '85%';
|
||||
var object_width = '100%';
|
||||
var height = ($( window ).height() - 60) * 0.90;
|
||||
var object_height='98%';
|
||||
var object_height = '98%';
|
||||
|
||||
show_preview('notimage');
|
||||
|
||||
} else {
|
||||
/* This is an image */
|
||||
var object_width=0;
|
||||
var object_height=0;
|
||||
var object_width = 0;
|
||||
var object_height = 0;
|
||||
|
||||
var img = new Image();
|
||||
|
||||
img.src = file;
|
||||
img.onload = function() {
|
||||
object_width = this.width;
|
||||
object_height = this.height;
|
||||
object_width = this.width; /* the real width of image */
|
||||
object_height = this.height; /* the real height of image */
|
||||
|
||||
width = $( window ).width()*0.90;
|
||||
console.log("object_width="+object_width+" window width="+width);
|
||||
if(object_width < width){
|
||||
/* Complete title with size of image */
|
||||
title = title + ' (' + object_width + ' x ' + object_height + ')';
|
||||
|
||||
popupWidth = $( window ).width() * 0.9 - 50;
|
||||
console.log("object_width="+object_width+" popup window width="+popupWidth);
|
||||
if (object_width < popupWidth) {
|
||||
console.log("Object width is small, we set width of popup according to image width.");
|
||||
width = object_width + 30
|
||||
popupWidth = object_width + 50
|
||||
}
|
||||
height = $( window ).height()*0.85;
|
||||
console.log("object_height="+object_height+" window height="+height);
|
||||
if(object_height < height){
|
||||
popupHeight = $( window ).height() * 0.85 - 100;
|
||||
console.log("object_height="+object_height+" popup window height="+popupHeight);
|
||||
if (object_height < (popupHeight - 100)) {
|
||||
console.log("Object height is small, we set height of popup according to image height.");
|
||||
height = object_height + 100
|
||||
}
|
||||
else
|
||||
{
|
||||
popupHeight = object_height + 100
|
||||
} else {
|
||||
showOriginalSizeButton = true;
|
||||
}
|
||||
|
||||
show_preview('image');
|
||||
|
||||
};
|
||||
img.src = file;
|
||||
}
|
||||
|
||||
/* This function is local to document_preview. Variables like file, type, title, object_width and object_height are global inside this function */
|
||||
function show_preview(mode) {
|
||||
/* console.log("mode="+mode+" file="+file+" type="+type+" title=title+" width="+width+" height="+height); */
|
||||
/* console.log("mode="+mode+" file="+file+" type="+type+" title=title+" width="+popupWidth+" height="+popupHeight); */
|
||||
var newElem = '<object name="objectpreview" data="'+file+'" type="'+type+'" width="'+object_width+'" height="'+object_height+'" param="noparam"></object>';
|
||||
|
||||
optionsbuttons = {}
|
||||
if (mode == 'image' && showOriginalSizeButton)
|
||||
{
|
||||
if (mode == 'image') {
|
||||
var curRot = 0;
|
||||
var savMaxHeight = 0;
|
||||
optionsbuttons = {
|
||||
"<?php echo dol_escape_js($langs->transnoentitiesnoconv("OriginalSize")); ?>": function() { console.log("Click on original size"); jQuery(".ui-dialog-content.ui-widget-content > object").css({ "max-height": "none" }); },
|
||||
"<?php echo dol_escape_js($langs->transnoentitiesnoconv("RotateImage")); ?>": function() { curRot += 90; jQuery(".ui-dialog-content.ui-widget-content > object").css("transform","rotate(" + curRot + "deg)"); },
|
||||
"<?php echo dol_escape_js($langs->transnoentitiesnoconv("CloseWindow")); ?>": function() { $( this ).dialog( "close" ); }
|
||||
'<?php echo dol_escape_js($langs->transnoentitiesnoconv("RotateImage")); ?>': function() { curRot += 90; jQuery(".ui-dialog-content.ui-widget-content > object").css("transform","rotate(" + curRot + "deg)"); },
|
||||
'<?php echo dol_escape_js($langs->transnoentitiesnoconv("CloseWindow")); ?>': function() { $( this ).dialog( "close" ); }
|
||||
};
|
||||
if (showOriginalSizeButton) {
|
||||
optionsbuttons = {
|
||||
'<?php echo dol_escape_js($langs->transnoentitiesnoconv("OriginalSize")); ?>': function() { console.log("Click on original size button"); savMaxHeight = jQuery(".ui-dialog-content.ui-widget-content > object").css("max-height"); console.log("savMaxHeight="+savMaxHeight); jQuery(".ui-dialog-content.ui-widget-content > object").css({ "max-height": (savMaxHeight == "none" ? "100%" : "none") }); },
|
||||
...optionsbuttons
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
$("#dialogforpopup").addClass("center");
|
||||
|
|
@ -1110,15 +1123,14 @@ function document_preview(file, type, title)
|
|||
$("#dialogforpopup").dialog({
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
width: width,
|
||||
height: height,
|
||||
width: popupWidth,
|
||||
height: popupHeight,
|
||||
modal: true,
|
||||
title: title,
|
||||
buttons: optionsbuttons
|
||||
});
|
||||
|
||||
if (showOriginalSizeButton)
|
||||
{
|
||||
if (showOriginalSizeButton) {
|
||||
jQuery(".ui-dialog-content.ui-widget-content > object").css({ "max-height": "100%", "width": "auto", "margin-left": "auto", "margin-right": "auto", "display": "block" });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -901,6 +901,11 @@ function security_prepare_head()
|
|||
$head[$h][2] = 'audit';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/openid_connect.php";
|
||||
$head[$h][1] = $langs->trans("OpenIDconnectSetup");
|
||||
$head[$h][2] = 'openid';
|
||||
$h++;
|
||||
|
||||
|
||||
// Show permissions lines
|
||||
$nbPerms = 0;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ function print_actions_filter(
|
|||
// Assigned to user
|
||||
print '<div class="divsearchfield">';
|
||||
print img_picto($langs->trans("ActionsToDoBy"), 'user', 'class="pictofixedwidth inline-block"');
|
||||
print $form->select_dolusers($filtert, 'search_filtert', 1, null, (int) !$canedit, '', '', '0', 0, 0, '', 0, '', 'minwidth100 maxwidth250 widthcentpercentminusx');
|
||||
print $form->select_dolusers($filtert, 'search_filtert', 1, null, (int) !$canedit, '', '', '0', 0, 0, '', 2, '', 'minwidth100 maxwidth250 widthcentpercentminusx');
|
||||
print '</div>';
|
||||
|
||||
// Assigned to user group
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ function societe_prepare_head(Societe $object)
|
|||
|
||||
$servicestatus = 0;
|
||||
if (isModEnabled('stripe')) {
|
||||
if (getDolGlobalString('STRIPE_LIVE') && !GETPOST('forcesandbox', 'alpha')) {
|
||||
if (getDolGlobalString('STRIPE_LIVE')/* && !GETPOST('forcesandbox', 'alpha')*/) {
|
||||
$servicestatus = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ function dol_basename($pathfile)
|
|||
* @param string $utf8_path Starting path from which to search. This is a full path.
|
||||
* @param string $types Can be "directories", "files", or "all"
|
||||
* @param int $recursive Determines whether subdirectories are searched
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
|
||||
* but must not contains the start and end '/'. Filter is checked into basename only.
|
||||
* @param string|string[] $filter Regex or Array of Regex filter to restrict list. The regex value must be escaped for '/' by doing preg_quote($var,'/'), since this char is used for preg_match function,
|
||||
* but must NOT contains the start and end '/'. Filter is checked into basename only.
|
||||
* @param string|string[] $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked both into fullpath and into basename (So '^xxx' may exclude 'xxx/dirscanned/...' and dirscanned/xxx').
|
||||
* @param string $sortcriteria Sort criteria ('','fullname','relativename','name','date','size')
|
||||
* @param int $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
|
|
@ -66,22 +66,39 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
|||
global $object;
|
||||
|
||||
if ($recursive <= 1) { // Avoid too verbose log
|
||||
// Verify filters (only on first call to function)
|
||||
$filters_ok = true;
|
||||
$error_info = "";
|
||||
|
||||
// Verify filters (only on the first call of the function)
|
||||
$filter_ok = true;
|
||||
if (!is_array($filter)) {
|
||||
if (strlen($filter) > 25000) { // Note that limit depends on syntax of filter
|
||||
dol_syslog("Value for filter is too large", LOG_ERR);
|
||||
$filter_ok = false;
|
||||
} else {
|
||||
// Check that all '/' are escaped.
|
||||
if ((int) preg_match('/(?:^|[^\\\\])\//', $filter) > 0) {
|
||||
$excludefilter_ok = false;
|
||||
$error_info .= " error='filter_has_unescaped_slash'";
|
||||
dol_syslog("'$filter' has unescaped '/'", LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure we have an array for the exclusions
|
||||
$excludefilter_ok = true;
|
||||
$exclude_array = ($excludefilter === null || $excludefilter === '') ? array() : (is_array($excludefilter) ? $excludefilter : array($excludefilter));
|
||||
foreach ((array($filter) + $exclude_array) as $f) {
|
||||
foreach ($exclude_array as $f) {
|
||||
// Check that all '/' are escaped.
|
||||
if ((int) preg_match('/(?:^|[^\\\\])\//', $f) > 0) {
|
||||
$filters_ok = false;
|
||||
$error_info .= " error='$f unescaped_slash'";
|
||||
$excludefilter_ok = false;
|
||||
$error_info .= " error='excludefilter_has_unescaped_slash'";
|
||||
dol_syslog("'$f' has unescaped '/'", LOG_ERR);
|
||||
}
|
||||
}
|
||||
dol_syslog("files.lib.php::dol_dir_list path=".$utf8_path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($excludefilter).$error_info);
|
||||
// print 'xxx'."files.lib.php::dol_dir_list path=".$utf8_path." types=".$types." recursive=".$recursive." filter=".$filter." excludefilter=".json_encode($exclude_array);
|
||||
if (!$filters_ok) {
|
||||
|
||||
dol_syslog("files.lib.php::dol_dir_list path=".$utf8_path." types=".$types." recursive=".$recursive." filter=".json_encode($filter)." excludefilter=".json_encode($excludefilter).$error_info);
|
||||
// print 'xxx'."files.lib.php::dol_dir_list path=".$utf8_path." types=".$types." recursive=".$recursive." filter=".json_encode($filter)." excludefilter=".json_encode($exclude_array);
|
||||
if (!$filter_ok || !$excludefilter_ok) {
|
||||
// Return empty array when filters are invalid
|
||||
return array();
|
||||
}
|
||||
|
|
@ -156,11 +173,10 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
|||
$utf8_file = $os_file;
|
||||
}
|
||||
|
||||
$qualified = 1;
|
||||
|
||||
$utf8_fullpathfile = $utf8_path_cursor."/".$utf8_file; // Temp variable for speed
|
||||
|
||||
// Check if file is qualified
|
||||
$qualified = 1;
|
||||
foreach ($excludefilterarray as $filt) {
|
||||
if (preg_match('/'.$filt.'/i', $utf8_file) || preg_match('/'.$filt.'/i', $utf8_fullpathfile)) {
|
||||
$qualified = 0;
|
||||
|
|
@ -185,7 +201,28 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
|||
$fileperm = dol_fileperm($utf8_fullpathfile);
|
||||
}
|
||||
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $utf8_file)) { // We do not search key $filter into all $path, only into $file part
|
||||
$qualifiedforfilter = 0;
|
||||
if (empty($filter)) {
|
||||
$qualifiedforfilter = 1;
|
||||
} else {
|
||||
$testpregmatch = false;
|
||||
if (is_array($filter)) {
|
||||
$chunks = array_chunk($filter, 500);
|
||||
foreach ($chunks as $chunk) {
|
||||
$testpregmatch = preg_match('/'.implode('|', $chunk).'/i', $utf8_file); // May failed if $filter too large
|
||||
if ($testpregmatch) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$testpregmatch = preg_match('/'.$filter.'/i', $utf8_file); // May failed if $filter too large
|
||||
}
|
||||
if ($testpregmatch) {
|
||||
$qualifiedforfilter = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($qualifiedforfilter) { // We do not search key $filter into all $path, only into $file part
|
||||
$reg = array();
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $utf8_fullpathfile, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
|
|
@ -219,7 +256,28 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
|||
$filesize = dol_filesize($utf8_fullpathfile);
|
||||
}
|
||||
|
||||
if (!$filter || preg_match('/'.$filter.'/i', $utf8_file)) { // We do not search key $filter into $utf8_path, only into $utf8_file
|
||||
$qualifiedforfilter = 0;
|
||||
if (empty($filter)) {
|
||||
$qualifiedforfilter = 1;
|
||||
} else {
|
||||
$testpregmatch = false;
|
||||
if (is_array($filter)) {
|
||||
$chunks = array_chunk($filter, 500);
|
||||
foreach ($chunks as $chunk) {
|
||||
$testpregmatch = preg_match('/'.implode('|', $chunk).'/i', $utf8_file); // May failed if $filter too large
|
||||
if ($testpregmatch) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$testpregmatch = preg_match('/'.$filter.'/i', $utf8_file); // May failed if $filter too large
|
||||
}
|
||||
if ($testpregmatch) {
|
||||
$qualifiedforfilter = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($qualifiedforfilter) { // We do not search key $filter into all $path, only into $file part
|
||||
if (empty($nbsecondsold) || $filedate <= ($now - $nbsecondsold)) {
|
||||
preg_match('/([^\/]+)\/[^\/]+$/', $utf8_fullpathfile, $reg);
|
||||
$level1name = (isset($reg[1]) ? $reg[1] : '');
|
||||
|
|
@ -285,7 +343,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
|
|||
$sql .= ", description";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files";
|
||||
if (!empty($object->entity) && $object->entity != $conf->entity) {
|
||||
if (!empty($object->entity)) {
|
||||
$sql .= " WHERE entity = ".((int) $object->entity);
|
||||
} else {
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity);
|
||||
|
|
@ -332,6 +390,7 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
|
|||
"acl" => $obj->acl,
|
||||
"share" => $obj->share,
|
||||
"description" => ($mode ? $obj->description : '')
|
||||
// TODO Add 'content' with $mode == 2 ?
|
||||
);
|
||||
}
|
||||
$i++;
|
||||
|
|
@ -405,6 +464,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
|
|||
//var_dump($relativedir);
|
||||
//var_dump($filearray);
|
||||
//var_dump($filearrayindatabase);
|
||||
//var_dump($object->entity);
|
||||
|
||||
// Complete filearray with properties found into $filearrayindatabase
|
||||
foreach ($filearray as $key => $val) {
|
||||
|
|
@ -436,6 +496,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
|
|||
|
||||
if (!preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filename)) { // If not a tmp file
|
||||
dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it");
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile = new EcmFiles($db);
|
||||
|
||||
|
|
@ -452,6 +513,10 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir, $object =
|
|||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keywords = ''; // keyword content
|
||||
// When you scan file with dol_dir_list_in_database, you scan for files in entity of object (like with projects), even if you
|
||||
// are connected into another entity. So we must also create record that was not found into the entity scan, so the one of the object).
|
||||
$ecmfile->entity = empty($object->entity) ? $conf->entity : $object->entity;
|
||||
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
|
|
|
|||
|
|
@ -423,14 +423,12 @@ function getWarningDelay($module, $parmlevel1, $parmlevel2 = '')
|
|||
}
|
||||
|
||||
if ($parmlevel2) {
|
||||
if (!empty($conf->$module->$warningDelayPath->warning_delay)) {
|
||||
if (!empty($conf->$module->$warningDelayPath->$parmlevel2->warning_delay)) {
|
||||
return (int) $conf->$module->$warningDelayPath->$parmlevel2->warning_delay;
|
||||
}
|
||||
if (!empty($conf->$module) && !empty($conf->$module->$warningDelayPath) && !empty($conf->$module->$warningDelayPath->$parmlevel2) && !empty($conf->$module->$warningDelayPath->$parmlevel2->warning_delay)) {
|
||||
return (int) $conf->$module->$warningDelayPath->$parmlevel2->warning_delay;
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->$module->$warningDelayPath->warning_delay)) {
|
||||
return (int) $conf->$module->$warningDelayPath->$parmlevel1->warning_delay;
|
||||
if (!empty($conf->$module) && !empty($conf->$module->$warningDelayPath) && !empty($conf->$module->$warningDelayPath->warning_delay)) {
|
||||
return (int) $conf->$module->$warningDelayPath->warning_delay;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -836,7 +834,7 @@ function GETPOSTISARRAY($paramname, $method = 0)
|
|||
* 'alphawithlgt'=alpha with lgt
|
||||
* 'alphanohtml'=check there is no html content and no " and no ../
|
||||
* 'aZ'=check it's a-z only
|
||||
* 'aZ09'=check it's simple alpha string (recommended for keys)
|
||||
* 'aZ09'=check it's simple alpha string (recommended for keys, it includes a-z0-9_\-\.)
|
||||
* 'aZ09arobase'=check it's a string for an element type ('myobject@mymodule')
|
||||
* 'aZ09comma'=check it's a string for a sortfield or sortorder
|
||||
* 'san_alpha'=Use filter_var with FILTER_SANITIZE_STRING (do not use this for free text string)
|
||||
|
|
@ -1530,7 +1528,6 @@ function dol_include_once($relpath, $classname = '')
|
|||
dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!empty($classname) && !class_exists($classname)) {
|
||||
return include $fullpath;
|
||||
} else {
|
||||
|
|
@ -8530,14 +8527,21 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
|
|||
{
|
||||
if (is_null($allowed_attributes)) {
|
||||
$allowed_attributes = array(
|
||||
"allow", "allowfullscreen", "alt", "async", "class", "content", "contenteditable", "crossorigin", "data-html", "frameborder", "height", "href", "id", "name", "property", "rel", "src", "style", "target", "title", "type", "width",
|
||||
"allow", "allowfullscreen", "alt", "async", "class", "contenteditable", "crossorigin", "data-html", "frameborder", "height", "href", "id", "name", "property", "rel", "src", "style", "target", "title", "type", "width",
|
||||
// HTML5
|
||||
"header", "footer", "nav", "section", "menu", "menuitem"
|
||||
);
|
||||
}
|
||||
// Always add content and http-equiv for meta tags, required to force encoding and keep html content in utf8 by load/saveHTML functions.
|
||||
if (!in_array("content", $allowed_attributes)) {
|
||||
$allowed_attributes[] = "content";
|
||||
}
|
||||
if (!in_array("http-equiv", $allowed_attributes)) {
|
||||
$allowed_attributes[] = "http-equiv";
|
||||
}
|
||||
|
||||
if (class_exists('DOMDocument') && !empty($stringtoclean)) {
|
||||
$stringtoclean = '<?xml encoding="UTF-8"><html><body>'.$stringtoclean.'</body></html>';
|
||||
$stringtoclean = '<?xml encoding="UTF-8"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>'.$stringtoclean.'</body></html>';
|
||||
|
||||
// Warning: loadHTML does not support HTML5 on old libxml versions.
|
||||
$dom = new DOMDocument('', 'UTF-8');
|
||||
|
|
@ -8588,12 +8592,15 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
|
|||
}
|
||||
}
|
||||
|
||||
$dom->encoding = 'UTF-8';
|
||||
|
||||
$return = $dom->saveHTML(); // This may add a LF at end of lines, so we will trim later
|
||||
//$return = '<html><body>aaaa</p>bb<p>ssdd</p>'."\n<p>aaa</p>aa<p>bb</p>";
|
||||
|
||||
$return = preg_replace('/^'.preg_quote('<?xml encoding="UTF-8">', '/').'/', '', $return);
|
||||
$return = preg_replace('/^'.preg_quote('<html><body>', '/').'/', '', $return);
|
||||
$return = preg_replace('/'.preg_quote('</body></html>', '/').'$/', '', $return);
|
||||
$return = preg_replace('/^'.preg_quote('<html><head><', '/').'[^<>]*'.preg_quote('></head><body>', '/').'/', '', $return);
|
||||
$return = preg_replace('/'.preg_quote('</body></html>', '/').'$/', '', trim($return));
|
||||
|
||||
return trim($return);
|
||||
} else {
|
||||
return $stringtoclean;
|
||||
|
|
@ -8765,17 +8772,24 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
|
|||
// like 'abc' that wrongly ends up, without the trick, with '<p>abc</p>'
|
||||
|
||||
if (dol_textishtml($out)) {
|
||||
$out = '<?xml encoding="UTF-8"><div class="tricktoremove">'.$out.'</div>';
|
||||
$out = '<?xml encoding="UTF-8"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><div class="tricktoremove">'.$out.'</div></body></html>';
|
||||
} else {
|
||||
$out = '<?xml encoding="UTF-8"><div class="tricktoremove">'.dol_nl2br($out).'</div>';
|
||||
$out = '<?xml encoding="UTF-8"><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><div class="tricktoremove">'.dol_nl2br($out).'</div></body></html>';
|
||||
}
|
||||
|
||||
$dom->loadHTML($out, LIBXML_HTML_NODEFDTD | LIBXML_ERR_NONE | LIBXML_HTML_NOIMPLIED | LIBXML_NONET | LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NOXMLDECL);
|
||||
|
||||
$dom->encoding = 'UTF-8';
|
||||
|
||||
$out = trim($dom->saveHTML());
|
||||
|
||||
// Remove the trick added to solve pb with text without parent tag
|
||||
$out = preg_replace('/^<\?xml encoding="UTF-8"><div class="tricktoremove">/', '', $out);
|
||||
$out = preg_replace('/<\/div>$/', '', $out);
|
||||
// Remove the trick added to solve pb with text in utf8 and text without parent tag
|
||||
$out = preg_replace('/^'.preg_quote('<?xml encoding="UTF-8">', '/').'/', '', $out);
|
||||
$out = preg_replace('/^'.preg_quote('<html><head><', '/').'[^<>]+'.preg_quote('></head><body><div class="tricktoremove">', '/').'/', '', $out);
|
||||
$out = preg_replace('/'.preg_quote('</div></body></html>', '/').'$/', '', trim($out));
|
||||
// $out = preg_replace('/^<\?xml encoding="UTF-8"><div class="tricktoremove">/', '', $out);
|
||||
// $out = preg_replace('/<\/div>$/', '', $out);
|
||||
// var_dump('rrrrrrrrrrrrrrrrrrrrrrrrrrrrr'.$out);
|
||||
} catch (Exception $e) {
|
||||
// If error, invalid HTML string with no way to clean it
|
||||
//print $e->getMessage();
|
||||
|
|
@ -8828,6 +8842,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
|
|||
}
|
||||
|
||||
// Clear ZERO WIDTH NO-BREAK SPACE, ZERO WIDTH SPACE, ZERO WIDTH JOINER
|
||||
// TODO $out = preg_replace('/[\x{2000}-\x{200D}\x{FEFF}]/u', ' ', $out);
|
||||
$out = preg_replace('/[\x{200B}-\x{200D}\x{FEFF}]/u', ' ', $out);
|
||||
|
||||
// Clean some html entities that are useless so text is cleaner
|
||||
|
|
@ -8889,7 +8904,7 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = '
|
|||
$out = preg_replace('/on(repeat|begin|finish|beforeinput)[a-z]*\s*=/i', '', $out);
|
||||
} while ($oldstringtoclean != $out);
|
||||
|
||||
// Check the limit of external links that are automatically executed in a Rich text content. We count:
|
||||
// Check the limit of external links that are automatically executed in a Rich text content. We count:
|
||||
// '<img' to avoid <img src="http...">, we can only accept "<img src="data:..."
|
||||
// 'url(' to avoid inline style like background: url(http...
|
||||
// '<link' to avoid <link href="http...">
|
||||
|
|
@ -9287,7 +9302,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
|
|||
$substitutionarray = array_merge($substitutionarray, array(
|
||||
'__MYCOMPANY_NAME__' => $mysoc->name,
|
||||
'__MYCOMPANY_EMAIL__' => $mysoc->email,
|
||||
'__MYCOMPANY_URL__' => $mysoc->url,
|
||||
'__MYCOMPANY_PHONE__' => dol_print_phone($mysoc->phone, '', 0, 0, '', " ", '', '', -1),
|
||||
'__MYCOMPANY_PHONEMOBILE__' => dol_print_phone($mysoc->phone_mobile, '', 0, 0, '', " ", '', '', -1),
|
||||
'__MYCOMPANY_FAX__' => dol_print_phone($mysoc->fax, '', 0, 0, '', " ", '', '', -1),
|
||||
'__MYCOMPANY_PROFID1__' => $mysoc->idprof1,
|
||||
'__MYCOMPANY_PROFID2__' => $mysoc->idprof2,
|
||||
|
|
@ -10889,14 +10906,14 @@ function verifCond($strToEvaluate, $onlysimplestring = '1')
|
|||
|
||||
/**
|
||||
* Replace eval function to add more security.
|
||||
* This function is called by verifCond() or trans() and transnoentitiesnoconv().
|
||||
* This function is called by verifCond() for example.
|
||||
*
|
||||
* @param string $s String to evaluate
|
||||
* @param int<0,1> $returnvalue 0=No return (deprecated, used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
|
||||
* @param int<0,1> $hideerrors 1=Hide errors
|
||||
* @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
|
||||
* '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
|
||||
* '2' (used for example for the compute property of extrafields)=Accept also '<[]'
|
||||
* @param string $onlysimplestring '0' (deprecated, do not use it anymore) = Accept all chars,
|
||||
* '1' (most common use) = Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
|
||||
* '2' (used for example for the compute property of extrafields) = Accept also '<[]'
|
||||
* @return string Return result of eval (even if type can be int, it is safer to assume string and find all potential typing issues as abs(dol_eval(...)).
|
||||
* @see verifCond(), checkPHPCode() to see sanitizing rules that should be very close.
|
||||
* @phan-suppress PhanPluginUnsafeEval
|
||||
|
|
@ -11263,14 +11280,26 @@ function dol_eval_standard($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestr
|
|||
$forbiddenphpstrings = array_merge($forbiddenphpstrings, array('_ENV', '_SESSION', '_COOKIE', '_GET', '_GLOBAL', '_POST', '_REQUEST', 'ReflectionFunction'));
|
||||
|
||||
// We list all forbidden function as keywords we don't want to see (we don't mind it if is "kewyord(" or just "keyword", we don't want "keyword" at all)
|
||||
// We must exclude all functions that allow to execute another function. This includes all function that has a parameter with type "callable" to avoid things
|
||||
// like we can do with array_map and its callable parameter: dol_eval('json_encode(array_map(implode("",["ex","ec"]), ["id"]))', 1, 1, '0')
|
||||
$forbiddenphpfunctions = array();
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("override_function", "session_id", "session_create_id", "session_regenerate_id"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func", "call_user_func_array"));
|
||||
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("array_all", "array_any", "array_diff_ukey", "array_filter", "array_find", "array_find_key", "array_map", "array_reduce", "array_intersect_uassoc", "array_intersect_ukey", "array_walk", "array_walk_recursive"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("usort", "uasort", "uksort", "preg_replace_callback", "preg_replace_callback_array", "header_register_callback"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("set_error_handler", "set_exception_handler", "libxml_set_external_entity_loader", "register_shutdown_function", "register_tick_function", "unregister_tick_function"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("spl_autoload_register", "spl_autoload_unregister", "iterator_apply", "session_set_save_handler"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("forward_static_call", "forward_static_call_array", "register_postsend_function"));
|
||||
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("ob_start"));
|
||||
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("exec", "passthru", "shell_exec", "system", "proc_open", "popen"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_eval", "dol_eval_new", "dol_eval_standard", "dol_concatdesc", "executeCLI", "verifCond", "GETPOST")); // native dolibarr functions
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("readline_completion_function", "readline_callback_handler_install"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include"));
|
||||
|
|
|
|||
|
|
@ -1965,8 +1965,9 @@ function version_webserver()
|
|||
*/
|
||||
function getListOfModels($db, $type, $maxfilenamelength = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$liste = array();
|
||||
global $conf, $hookmanager, $langs;
|
||||
|
||||
$docmodels = array();
|
||||
$found = 0;
|
||||
$dirtoscan = '';
|
||||
|
||||
|
|
@ -2017,21 +2018,21 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
|
|||
if (count($listoffiles)) {
|
||||
foreach ($listoffiles as $record) {
|
||||
$max = ($maxfilenamelength ? $maxfilenamelength : 28);
|
||||
$liste[$obj->id.':'.$record['fullname']] = dol_trunc($record['name'], $max, 'middle');
|
||||
$docmodels[$obj->id.':'.$record['fullname']] = dol_trunc($record['name'], $max, 'middle');
|
||||
}
|
||||
} else {
|
||||
$liste[0] = $obj->label.': '.$langs->trans("None");
|
||||
$docmodels[0] = $obj->label.': '.$langs->trans("None");
|
||||
}
|
||||
} else {
|
||||
if ($type == 'member' && $obj->doc_template_name == 'standard') { // Special case, if member template, we add variant per format
|
||||
global $_Avery_Labels;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
|
||||
foreach ($_Avery_Labels as $key => $val) {
|
||||
$liste[$obj->id.':'.$key] = ($obj->label ? $obj->label : $obj->doc_template_name).' '.$val['name'];
|
||||
$docmodels[$obj->id.':'.$key] = ($obj->label ? $obj->label : $obj->doc_template_name).' '.$val['name'];
|
||||
}
|
||||
} else {
|
||||
// Common usage
|
||||
$liste[$obj->id] = $obj->label ? $obj->label : $obj->doc_template_name;
|
||||
$docmodels[$obj->id] = $obj->label ? $obj->label : $obj->doc_template_name;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
|
|
@ -2040,9 +2041,18 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
|
|||
dol_print_error($db);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$parameters = array(
|
||||
'list' => &$docmodels,
|
||||
'found' => &$found,
|
||||
'type' => $type,
|
||||
'maxfilenamelength' => $maxfilenamelength,
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('getListOfModels', $parameters);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if ($found) {
|
||||
return $liste;
|
||||
return $docmodels;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2774,6 +2784,8 @@ function getModuleDirForApiClass($moduleobject)
|
|||
$moduledirforclass = 'workstation';
|
||||
} elseif ($moduleobject == 'accounting') {
|
||||
$moduledirforclass = 'accountancy';
|
||||
} elseif ($moduleobject == 'paiements') {
|
||||
$moduledirforclass = 'compta/facture';
|
||||
} elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms', 'receptions', 'partnerships', 'recruitments'))) {
|
||||
$moduledirforclass = preg_replace('/s$/', '', $moduleobject);
|
||||
} elseif ($moduleobject == 'paymentsalaries') {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@
|
|||
* - you can set MAIN_SECURITY_ANTI_SSRF_SERVER_IP to set static ip of server
|
||||
* - common local lookup ips like 127.*.*.* are automatically added
|
||||
*
|
||||
* You can enable constant MAIN_CURL_DEBUG to get detail of output/input into dolibarr_curl.logfile.
|
||||
*
|
||||
* @param string $url URL to call.
|
||||
* @param 'POST'|'GET'|'HEAD'|'PUT'|'PUTALREADYFORMATED'|'POSTALREADYFORMATED'|'DELETE' $postorget 'POST', 'GET', 'HEAD', 'PUT', 'PUTALREADYFORMATED', 'POSTALREADYFORMATED', 'DELETE'
|
||||
* @param string $param Parameters of URL (x=value1&y=value2) or may be a formatted content with $postorget='PUTALREADYFORMATED'
|
||||
|
|
@ -44,13 +46,12 @@
|
|||
*/
|
||||
function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = 1, $addheaders = array(), $allowedschemes = array('http', 'https'), $localurl = 0, $ssl_verifypeer = -1, $timeoutconnect = 0, $timeoutresponse = 0)
|
||||
{
|
||||
//declaring of global variables
|
||||
global $conf;
|
||||
$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ? 0 : $conf->global->MAIN_PROXY_USE;
|
||||
$PROXY_HOST = !getDolGlobalString('MAIN_PROXY_HOST') ? 0 : $conf->global->MAIN_PROXY_HOST;
|
||||
$PROXY_PORT = !getDolGlobalString('MAIN_PROXY_PORT') ? 0 : $conf->global->MAIN_PROXY_PORT;
|
||||
$PROXY_USER = !getDolGlobalString('MAIN_PROXY_USER') ? 0 : $conf->global->MAIN_PROXY_USER;
|
||||
$PROXY_PASS = !getDolGlobalString('MAIN_PROXY_PASS') ? 0 : $conf->global->MAIN_PROXY_PASS;
|
||||
// Get global variables for proxy use
|
||||
$USE_PROXY = getDolGlobalInt('MAIN_PROXY_USE');
|
||||
$PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST');
|
||||
$PROXY_PORT = getDolGlobalInt('MAIN_PROXY_PORT');
|
||||
$PROXY_USER = getDolGlobalString('MAIN_PROXY_USER');
|
||||
$PROXY_PASS = getDolGlobalString('MAIN_PROXY_PASS');
|
||||
|
||||
dol_syslog("getURLContent postorget=".$postorget." URL=".$url." param=".$param);
|
||||
|
||||
|
|
@ -66,7 +67,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
|||
print $nvpStr;
|
||||
exit;*/
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function');
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, 'Dolibarr geturl function'); // set the Dolibarr user agent name
|
||||
|
||||
// We use @ here because this may return warning if safe mode is on or open_basedir is on (following location is forbidden when safe mode is on).
|
||||
// We force value to false so we will manage redirection ourself later.
|
||||
|
|
|
|||
|
|
@ -22,28 +22,6 @@
|
|||
* \brief Functions for the module openid_connect
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @return array<array{0:string,1:string,2:string}> Array of tabs to show
|
||||
*/
|
||||
function openid_connect_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/admin/openid_connect.php", 1);
|
||||
$head[$h][1] = $langs->trans("Parameters");
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'openid_connect_admin');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return the current state
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2588,7 +2588,7 @@ function pdf_getLinkedObjects(&$object, $outputlangs)
|
|||
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DatePropal");
|
||||
$linkedobjects[$objecttype]['date_value'] = dol_print_date($elementobject->date, 'day', '', $outputlangs);
|
||||
}
|
||||
} elseif ($objecttype == 'commande' || $objecttype == 'supplier_order') {
|
||||
} elseif ($objecttype == 'commande' || $objecttype == 'supplier_order' || $objecttype == 'order_supplier') {
|
||||
'@phan-var-force array<Commande|CommandeFournisseur> $objects';
|
||||
$outputlangs->load('orders');
|
||||
|
||||
|
|
|
|||
|
|
@ -1512,9 +1512,14 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
|
|||
dol_mkdir(dirname($filetosave));
|
||||
|
||||
$fp = fopen($filetosave, "w");
|
||||
fwrite($fp, $tmpgeturl['content']);
|
||||
fclose($fp);
|
||||
dolChmod($filetosave);
|
||||
if ($fp) {
|
||||
fwrite($fp, $tmpgeturl['content']);
|
||||
fclose($fp);
|
||||
dolChmod($filetosave);
|
||||
} else {
|
||||
setEventMessages('Error failed to open file '.$filetosave.' for writing', null, 'errors');
|
||||
//print 'Failed to open file '.$filetosave.' for writing.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ class pdf_balance extends ModelePdfAccountancy
|
|||
$curY,
|
||||
$nexY,
|
||||
$default_font_size,
|
||||
$langs->trans('GrandTotals'),
|
||||
$langs->transnoentities('GrandTotals'),
|
||||
$tab_top_newpage,
|
||||
$totalDebit,
|
||||
$totalCredit,
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ class pdf_bookkeeping extends ModelePdfAccountancy
|
|||
$curY,
|
||||
$nexY,
|
||||
$default_font_size,
|
||||
$langs->trans('GrandTotals'),
|
||||
$langs->transnoentities('GrandTotals'),
|
||||
$tab_top_newpage,
|
||||
$totalDebit,
|
||||
$totalCredit,
|
||||
|
|
|
|||
|
|
@ -512,7 +512,7 @@ class pdf_ledger extends ModelePdfAccountancy
|
|||
$curY,
|
||||
$nexY,
|
||||
$default_font_size,
|
||||
$langs->trans('GrandTotals'),
|
||||
$langs->transnoentities('GrandTotals'),
|
||||
$tab_top_newpage,
|
||||
$totalDebit,
|
||||
$totalCredit,
|
||||
|
|
|
|||
|
|
@ -39,8 +39,6 @@ class modCron extends DolibarrModules
|
|||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$this->db = $db;
|
||||
$this->numero = 2300;
|
||||
|
||||
|
|
@ -141,8 +139,8 @@ class modCron extends DolibarrModules
|
|||
'url'=>'/cron/list.php?leftmenu=admintools',
|
||||
'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>500,
|
||||
'enabled'=>'$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules
|
||||
'enabled'=>'isModEnabled("cron") && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||
'perms'=>'$user->hasRight("cron", "read")', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$r++;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue