Merge branch 'develop' into develop#1

This commit is contained in:
Lucas Marcouiller 2023-04-28 11:31:43 +02:00 committed by GitHub
commit 79b686fb33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
890 changed files with 18299 additions and 7746 deletions

View File

@ -89,3 +89,9 @@ Baffir Abbes <bafbes@users.noreply.github.com> bafbes <bafbes@users.noreply.gith
Kevin Guerrier <guerrier.k@gmail.com> GUERRIER Kevin <guerrier.k@gmail.com> Kevin Guerrier <guerrier.k@gmail.com> GUERRIER Kevin <guerrier.k@gmail.com>
Remy Younes <ryounes@gmail.com> remy <ryounes@gmail.com> Remy Younes <ryounes@gmail.com> remy <ryounes@gmail.com>
Estephe Loridan <github@estephe.me> Estephe L. <github@estephe.me> Estephe Loridan <github@estephe.me> Estephe L. <github@estephe.me>
Anthony Berton <anthony.berton@bb2a.fr> Anthony Berton <anthony.berton@bb2a.fr>
Anthony Berton <anthony.berton@bb2a.fr> Berton Anthony <anthony.berton@bb2a.fr>
Anthony Berton <anthony.berton@bb2a.fr> BB2A-Anthony <anthony.berton@bb2a.fr>
Anthony Berton <anthony.berton@bb2a.fr> Anthony Berton <bertonanthony@gmail.com>
Anthony Berton <anthony.berton@bb2a.fr> Berton Anthony <bertonanthony@gmail.com>
Anthony Berton <anthony.berton@bb2a.fr> BB2A-Anthony <bertonanthony@gmail.com>

View File

@ -53,6 +53,10 @@ addons:
- php8.1-mysqli - php8.1-mysqli
- php8.1-xml - php8.1-xml
- php8.1-intl - php8.1-intl
- php8.2-pgsql
- php8.2-mysqli
- php8.2-xml
- php8.2-intl
env: env:
global: global:
@ -73,8 +77,8 @@ jobs:
php: '8.1' php: '8.1'
env: DB=mysql env: DB=mysql
- stage: PHP Dev - stage: PHP Dev
if: type = push AND branch = 17.0 if: type = push AND branch = developdisabled
php: nightly php: '8.2'
env: DB=mysql env: DB=mysql
notifications: notifications:
@ -120,7 +124,7 @@ install:
squizlabs/php_codesniffer ^3 squizlabs/php_codesniffer ^3
fi fi
# phpunit 9 is required for php 8 # phpunit 9 is required for php 8
if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
composer self-update 2.4.4 composer self-update 2.4.4
composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \ composer -n require --ignore-platform-reqs phpunit/phpunit ^8 \
php-parallel-lint/php-parallel-lint ^1.2 \ php-parallel-lint/php-parallel-lint ^1.2 \
@ -260,7 +264,7 @@ before_script:
# enable php-fpm # enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- | - |
if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '8.0' ] || [ "$TRAVIS_PHP_VERSION" = '8.1' ] || [ "$TRAVIS_PHP_VERSION" = '8.2' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
# Copy the included pool # Copy the included pool
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
fi fi

View File

@ -29,7 +29,7 @@ GeoIP2 0.2.0 Apache License 2.0 Yes
Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser ParseDown 1.7.4 MIT License Yes Markdown parser
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
PHPDebugBar 1.18.2 MIT License Yes Used only by the module "debugbar" for developers PHPDebugBar 1.18.2 MIT License Yes Used only by the module "debugbar" for developers
PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth
@ -43,7 +43,7 @@ Restler 3.1.1 LGPL-3+ Yes
Sabre 3.2.2 BSD Yes DAV support Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar) Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar)
Stripe 7.67.0 MIT Licence Yes Library for Stripe module Stripe 10.7.0 MIT Licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement

View File

@ -269,18 +269,21 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Minimal PHP version is now PHP 7.0 instead of PHP 5.6 * Minimal PHP version is now PHP 7.0 instead of PHP 5.6
* Core has introduced a Universal Filter Syntax for seach criteria. Example: ((((field1:=:value1) OR (field2:in:1,2,3)) AND ...). In rare case, some filters
could be provided by URL parameters. For such cases (societe/ajax/company.php), use of Universal Filter Syntax become mandatory.
* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl() * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl()
* Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. * Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead.
* All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead. * All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead.
* Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere. * Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere.
* Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead. * Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead.
* Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande. * Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande.
* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES * Renamed MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and renamed MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES
* Rename the substitution for "project label" instead of "project title" in substitution variables * Renamed the substitution for "project label" instead of "project title" in substitution variables
* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object. * You must use "$objectoffield" to manipulate the current object inside the form of computed custom extrafields instead of $obj/$object.
* Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all) * Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all)
* The property $url_last_version must be public if defined into module descriptor files; * The property $url_last_version must be public if defined into module descriptor files;
***** ChangeLog for 16.0.5 compared to 16.0.4 ***** ***** ChangeLog for 16.0.5 compared to 16.0.4 *****
FIX: 16.0 propalestats Unknown column 'p.fk_soc' in 'on clause' FIX: 16.0 propalestats Unknown column 'p.fk_soc' in 'on clause'

View File

@ -6,8 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported | | Version | Supported |
| ---------- | ---------------------- | | ---------- | ---------------------- |
| <= 16.0.2 | :x: | | <= 17.0.0 | :x: |
| >= 16.0.3 | :white_check_mark: | | >= 17.0.1 | :white_check_mark: |
| >= develop | :white_check_mark: | | >= develop | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability

View File

@ -19,6 +19,10 @@ override_dh_auto_clean:
override_dh_auto_build: override_dh_auto_build:
# Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant # Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant
# Force the compression format for control files
override_dh_builddeb:
dh_builddeb -- -Zxz
#override_dh_compress: #override_dh_compress:
# dh_compress --no-act -X.png # dh_compress --no-act -X.png

View File

@ -1,3 +1,5 @@
# Force use of gzip compression by dpkg-buildpackage # Force use of gzip compression by dpkg-buildpackage for the tarball *.debian.tar.gz
# See also option --compression from command line of dpkg-buildpackage
# Format for the control files are defined into the rules file in override_dh_builddeb section
compression = "gzip" compression = "gzip"
#compression-level = 9 #compression-level = 9

View File

@ -220,7 +220,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
EXTENSION_MAPPING = EXTENSION_MAPPING = example=PHP
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should # to include (a tag file for) the STL sources as input, then you should
@ -602,7 +602,7 @@ INPUT_ENCODING = UTF-8
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
FILE_PATTERNS = *.php *.pl FILE_PATTERNS = *.php *.pl *.sql *.example
# The RECURSIVE tag can be used to turn specify whether or not subdirectories # The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO. # should be searched for input files as well. Possible values are YES and NO.

View File

@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reini
OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr
OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr
DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp. DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp.
ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit) ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit)

View File

@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version
OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version
DLLMissing=Your Windows installation is missing the "Microsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. DLLMissing=Your Windows installation is missing The "Microsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
ContinueAnyway=Continue anyway (install process may fail without this prerequisite) ContinueAnyway=Continue anyway (install process may fail without this prerequisite)

View File

@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=L'installeur DoliWamp va maintenant d
OldVersionFoundAndMoveInNew=Une ancienne version de base a été trouvée et déplacée pour fonctionner avec la nouvelle version de Dolibarr. OldVersionFoundAndMoveInNew=Une ancienne version de base a été trouvée et déplacée pour fonctionner avec la nouvelle version de Dolibarr.
OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a été trouvée mais ne peut être déplacée pour être utilisée avec la nouvelle version de Dolibarr. OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a été trouvée mais ne peut être déplacée pour être utilisée avec la nouvelle version de Dolibarr.
DLLMissing=L'installation de votre Windows est incomplète. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2012". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver à https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp après. DLLMissing=L'installation de votre Windows est incomplète. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2015". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver à https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp après.
ContinueAnyway=Continuer malgré tout (le process d'installaton échouera) ContinueAnyway=Continuer malgré tout (le process d'installaton échouera)

View File

@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apa
OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden. OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden.
OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden. OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden.
DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after.
ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen). ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen).

View File

@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reinici
OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr
OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr
DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp. DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp.
ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito) ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito)

View File

@ -1050,7 +1050,7 @@ if ($nboftargetok) {
print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n";
chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"); chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build");
#$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build";
$cmd="dpkg-buildpackage -us -uc"; $cmd="dpkg-buildpackage -us -uc --compression=gzip";
print "Launch DEB build ($cmd)\n"; print "Launch DEB build ($cmd)\n";
$ret=`$cmd 2>&1 3>&1`; $ret=`$cmd 2>&1 3>&1`;
print $ret."\n"; print $ret."\n";

View File

@ -27,12 +27,12 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke
Prerequisites to build autoexe DoliWamp package from Windows: Prerequisites to build autoexe DoliWamp package from Windows:
> Install Perl for Windwos (https://strawberryperl.com/) > Install Perl for Windows (https://strawberryperl.com/)
> Install isetup-5.5.8.exe (https://www.jrsoftware.org) > Install isetup-5.5.8.exe (https://www.jrsoftware.org)
> Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss) > Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss)
> Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is") > Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is")
> Install Dolibarr verions: > Install Dolibarr current version:
git clone https://github.com/dolibarr/dolibarr git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr
> Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows. > Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows.

View File

@ -321,7 +321,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_account) { if ($search_account) {
$param .= '&search_account='.urlencode($search_account); $param .= '&search_account='.urlencode($search_account);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -81,6 +81,10 @@ $list_account[] = '---Others---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT'; $list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT'; $list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT'; $list_account[] = 'ACCOUNTING_VAT_PAY_ACCOUNT';
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT';
$list_account[] = 'ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT';
}
if (isModEnabled('banque')) { if (isModEnabled('banque')) {
$list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH'; $list_account[] = 'ACCOUNTING_ACCOUNT_TRANSFER_CASH';
} }

View File

@ -97,7 +97,7 @@ $help_url = "EN:Module_Double_Entry_Accounting";
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; $sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut as status, f.entity";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f";
$sql .= " WHERE f.entity = ".$conf->entity; $sql .= " WHERE f.entity = ".$conf->entity;
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
@ -137,14 +137,19 @@ if ($result) {
print '<td>'.$langs->trans("DateEnd").'</td>'; print '<td>'.$langs->trans("DateEnd").'</td>';
print '<td class="center">'.$langs->trans("NumberOfAccountancyEntries").'</td>'; print '<td class="center">'.$langs->trans("NumberOfAccountancyEntries").'</td>';
print '<td class="center">'.$langs->trans("NumberOfAccountancyMovements").'</td>'; print '<td class="center">'.$langs->trans("NumberOfAccountancyMovements").'</td>';
print '<td class="right">'.$langs->trans("Statut").'</td>'; print '<td class="right">'.$langs->trans("Status").'</td>';
print '</tr>'; print '</tr>';
if ($num) { if ($num) {
while ($i < $num && $i < $max) { while ($i < $num && $i < $max) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$fiscalyearstatic->ref = $obj->rowid;
$fiscalyearstatic->id = $obj->rowid; $fiscalyearstatic->id = $obj->rowid;
$fiscalyearstatic->date_start = $obj->date_start;
$fiscalyearstatic->date_end = $obj->date_end;
$fiscalyearstatic->statut = $obj->status;
$fiscalyearstatic->status = $obj->status;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -155,7 +160,7 @@ if ($result) {
print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>'; print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>';
print '<td class="center">'.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).'</td>'; print '<td class="center">'.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).'</td>';
print '<td class="center">'.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).'</td>'; print '<td class="center">'.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).'</td>';
print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->statut, 5).'</td>'; print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->status, 5).'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -66,12 +66,7 @@ $error = 0;
* Actions * Actions
*/ */
if (in_array($action, array( if (in_array($action, array('setBANK_DISABLE_DIRECT_INPUT', 'setACCOUNTANCY_COMBO_FOR_AUX', 'setACCOUNTING_MANAGE_ZERO'))) {
'setBANK_DISABLE_DIRECT_INPUT',
'setACCOUNTANCY_COMBO_FOR_AUX',
'setACCOUNTING_MANAGE_ZERO',
'setACCOUNTING_LIST_SORT_VENTILATION_TODO',
'setACCOUNTING_LIST_SORT_VENTILATION_DONE'))) {
$constname = preg_replace('/^set/', '', $action); $constname = preg_replace('/^set/', '', $action);
$constvalue = GETPOST('value', 'int'); $constvalue = GETPOST('value', 'int');
$res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, $constname, $constvalue, 'yesno', 0, '', $conf->entity);
@ -121,34 +116,6 @@ if ($action == 'update') {
} }
} }
if ($action == 'setlistsorttodo') {
$setlistsorttodo = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $setlistsorttodo, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setlistsortdone') {
$setlistsortdone = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
if ($action == 'setmanagezero') { if ($action == 'setmanagezero') {
$setmanagezero = GETPOST('value', 'int'); $setmanagezero = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
@ -275,6 +242,19 @@ if ($action == 'setenableautolettering') {
} }
} }
if ($action == 'setenablevatreversecharge') {
$setenablevatreversecharge = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE", $setenablevatreversecharge, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
/* /*
* View * View
@ -404,33 +384,6 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>'; print '<td colspan="2">'.$langs->trans('BindingOptions').'</td>';
print "</tr>\n"; print "</tr>\n";
// TO DO Mutualize code for yes/no constants
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_TODO&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE").'</td>';
if (!empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTING_LIST_SORT_VENTILATION_DONE&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
// Param a user $user->rights->accounting->chartofaccount can access // Param a user $user->rights->accounting->chartofaccount can access
foreach ($list_binding as $key) { foreach ($list_binding as $key) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
@ -495,14 +448,20 @@ print '</tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// Lettering params
// Show advanced options
print '<br>';
// Advanced params
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('Options').' '.$langs->trans('Lettering').'</td>'; print '<td colspan="2">' . $langs->trans('OptionsAdvanced') . '</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ACCOUNTING_ENABLE_LETTERING").'</td>'; print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_LETTERING"), $langs->trans("ACCOUNTING_ENABLE_LETTERING_DESC", $langs->transnoentitiesnoconv("NumMvts")).'<br>'.$langs->trans("EnablingThisFeatureIsNotNecessary")).'</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">'; print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setenablelettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
@ -516,7 +475,8 @@ print '</tr>';
if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) { if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>' . $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING") . '</td>'; print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING"), $langs->trans("ACCOUNTING_ENABLE_AUTOLETTERING_DESC")) . '</td>';
if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) { if (!empty($conf->global->ACCOUNTING_ENABLE_AUTOLETTERING)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">'; print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenableautolettering&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
@ -529,8 +489,23 @@ if (!empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
print '</tr>'; print '</tr>';
} }
print '<tr class="oddeven">';
print '<td>';
print $form->textwithpicto($langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE"), $langs->trans("ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE_DESC", $langs->transnoentities("MenuDefaultAccounts"))).'</td>';
if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="right"><a class="reposition" href="' . $_SERVER['PHP_SELF'] . '?token=' . newToken() . '&action=setenablevatreversecharge&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '</tr>';
print '</table>'; print '</table>';
print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>'; print '<div class="center"><input type="submit" class="button button-edit" name="button" value="'.$langs->trans('Modify').'"></div>';
print '</form>'; print '</form>';

View File

@ -416,7 +416,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($searchCategoryProductOperator == 1) { if ($searchCategoryProductOperator == 1) {
$param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator); $param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator);

View File

@ -296,7 +296,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_subaccount) { if ($search_subaccount) {
$param .= '&search_subaccount='.urlencode($search_subaccount); $param .= '&search_subaccount='.urlencode($search_subaccount);

View File

@ -327,7 +327,7 @@ if ($action != 'export_csv') {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2022 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr> * Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
@ -29,7 +29,6 @@
// Load Dolibarr environment // Load Dolibarr environment
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
@ -96,14 +95,6 @@ $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_star
$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear); $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
$search_import_key = GETPOST("search_import_key", 'alpha'); $search_import_key = GETPOST("search_import_key", 'alpha');
//var_dump($search_date_start);exit;
if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
$action = 'delbookkeepingyear';
}
if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
$action = 'export_file';
}
$search_account_category = GETPOST('search_account_category', 'int'); $search_account_category = GETPOST('search_account_category', 'int');
$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha'); $search_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
@ -159,7 +150,7 @@ $hookmanager->initHooks(array('bookkeepinglist'));
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
$form = new Form($db); $form = new Form($db);
if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) { if (!in_array($action, array('delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) { if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
$query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
$query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
@ -201,8 +192,8 @@ $arrayfields = array(
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>0),
't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>0, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
); );
@ -210,13 +201,6 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) {
unset($arrayfields['t.lettering_code']); unset($arrayfields['t.lettering_code']);
} }
$accountancyexport = new AccountancyExport($db);
$listofformat = $accountancyexport->getType();
$formatexportset = getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV');
if (empty($listofformat[$formatexportset])) {
$formatexportset = 1;
}
$error = 0; $error = 0;
if (!isModEnabled('accounting')) { if (!isModEnabled('accounting')) {
@ -457,49 +441,6 @@ if (empty($reshook)) {
$param .= '&search_import_key='.urlencode($search_import_key); $param .= '&search_import_key='.urlencode($search_import_key);
} }
//if ($action == 'delbookkeepingyearconfirm' && !$user->hasRight('accounting', 'mouvements', 'supprimer_tous')) {
// $delmonth = GETPOST('delmonth', 'int');
// $delyear = GETPOST('delyear', 'int');
// if ($delyear == -1) {
// $delyear = 0;
// }
// $deljournal = GETPOST('deljournal', 'alpha');
// if ($deljournal == -1) {
// $deljournal = 0;
// }
//
// if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
// $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
// if ($result < 0) {
// setEventMessages($object->error, $object->errors, 'errors');
// } else {
// setEventMessages("RecordDeleted", null, 'mesgs');
// }
//
// // Make a redirect to avoid to launch the delete later after a back button
// header("Location: list.php".($param ? '?'.$param : ''));
// exit;
// } else {
// setEventMessages("NoRecordDeleted", null, 'warnings');
// }
//}
if ($action == 'setreexport') {
$setreexport = GETPOST('value', 'int');
if (!dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) {
$error++;
}
if (!$error) {
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
} else {
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'warnings');
}
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
// Mass actions // Mass actions
$objectclass = 'Bookkeeping'; $objectclass = 'Bookkeeping';
$objectlabel = 'Bookkeeping'; $objectlabel = 'Bookkeeping';
@ -707,103 +648,12 @@ if (count($filter) > 0) {
} }
} }
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')'; $sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
if (empty($conf->global->ACCOUNTING_REEXPORT)) {
$sql .= " AND t.date_export IS NULL";
}
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND '.implode(' AND ', $sqlwhere); $sql .= ' AND '.implode(' AND ', $sqlwhere);
} }
//print $sql; //print $sql;
// Export into a file with format defined into setup (FEC, CSV, ...)
// Must be after definition of $sql
if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
// TODO Replace the fetchAll to get all ->line followed by call to ->export(). It currently consumes too much memory on large export.
// Replace this with the query($sql) and loop on each line to export them.
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// Export files then exit
$accountancyexport = new AccountancyExport($db);
$formatexport = GETPOST('formatexport', 'int');
$notexportlettering = GETPOST('notexportlettering', 'alpha');
if (!empty($notexportlettering)) {
if (is_array($object->lines)) {
foreach ($object->lines as $k => $movement) {
unset($object->lines[$k]->lettering_code);
unset($object->lines[$k]->date_lettering);
}
}
}
$notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
$notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
$withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
// Output data on screen or download
$result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
$error = 0;
if ($result < 0) {
$error++;
} else {
if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
if (is_array($object->lines)) {
dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
// Specify as export : update field date_export or date_validated
$db->begin();
// TODO Merge update for each line into one gloacl using rowid IN (list of movement ids)
foreach ($object->lines as $movement) {
$now = dol_now();
$setfields = '';
if (!empty($notifiedexportdate) && empty($movement->date_export)) {
$setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
}
if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
$setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
}
if ($setfields) {
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET ".$setfields;
$sql .= " WHERE rowid = ".((int) $movement->id);
$result = $db->query($sql);
if (!$result) {
$error++;
break;
}
}
}
if (!$error) {
$db->commit();
} else {
$error++;
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
$db->rollback();
}
}
}
}
if ($error) {
setEventMessages('', $accountancyexport->errors, 'errors');
header('Location: '.$_SERVER['PHP_SELF']);
}
exit(); // download or show errors
}
}
/* /*
* View * View
*/ */
@ -857,111 +707,6 @@ llxHeader('', $title_page);
$formconfirm = ''; $formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
$form_question['formatexport'] = array(
'name' => 'formatexport',
'type' => 'select',
'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
'values' => $listofformat,
'default' => $formatexportset,
'morecss' => 'minwidth200 maxwidth200'
);
$form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
// If 1, we check by default.
$checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
$form_question['notexportlettering'] = array(
'name' => 'notexportlettering',
'type' => 'checkbox',
'label' => $langs->trans('NotExportLettering'),
'value' => $checked,
);
$form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
}
// If 1 or not set, we check by default.
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
$form_question['notifiedexportdate'] = array(
'name' => 'notifiedexportdate',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedExportDate'),
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
);
$form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
// If 0 or not set, we NOT check by default.
$checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE));
$form_question['notifiedvalidationdate'] = array(
'name' => 'notifiedvalidationdate',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
'value' => $checked,
);
$form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
}
// add documents in an archive for accountancy export (Quadratus)
if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS) {
$form_question['notifiedexportfull'] = array(
'name' => 'notifiedexportfull',
'type' => 'checkbox',
'label' => $langs->trans('NotifiedExportFull'),
'value' => 'false',
);
}
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
}
//if ($action == 'delbookkeepingyear') {
// $form_question = array();
// $delyear = GETPOST('delyear', 'int');
// $deljournal = GETPOST('deljournal', 'alpha');
//
// if (empty($delyear)) {
// $delyear = dol_print_date(dol_now(), '%Y');
// }
// $month_array = array();
// for ($i = 1; $i <= 12; $i++) {
// $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
// }
// $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
// $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
//
// $form_question['delmonth'] = array(
// 'name' => 'delmonth',
// 'type' => 'select',
// 'label' => $langs->trans('DelMonth'),
// 'values' => $month_array,
// 'morecss' => 'minwidth150',
// 'default' => ''
// );
// $form_question['delyear'] = array(
// 'name' => 'delyear',
// 'type' => 'select',
// 'label' => $langs->trans('DelYear'),
// 'values' => $year_array,
// 'default' => $delyear
// );
// $form_question['deljournal'] = array(
// 'name' => 'deljournal',
// 'type' => 'other', // We don't use select here, the journal_array is already a select html component
// 'label' => $langs->trans('DelJournal'),
// 'value' => $journal_array,
// 'default' => $deljournal
// );
//
// $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 320);
//}
// Print form confirm // Print form confirm
print $formconfirm; print $formconfirm;
@ -970,7 +715,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
// List of mass actions available // List of mass actions available
@ -1015,21 +760,6 @@ if ($reshook < 0) {
$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
// Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("ClickToHideAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToHideAlreadyExportedLines").'</span>';
$newcardbutton .= '</a>';
} else {
$newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("DocsAlreadyExportedAreExcluded"), 'switch_on', 'class="warning size15x valignmiddle"');
$newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreExcluded").'</span>';
$newcardbutton .= '</a>';
}
if ($user->hasRight('accounting', 'mouvements', 'export')) {
$newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder), $user->hasRight('accounting', 'mouvements', 'export'));
}
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub'.$param, '', 1, array('morecss' => 'marginleftonly'));
@ -1608,13 +1338,6 @@ print $hookmanager->resPrint;
print "</table>"; print "</table>";
print '</div>'; print '</div>';
// TODO Replace this with mass delete action
//if ($user->rights->accounting->mouvements->supprimer_tous) {
// print '<div class="tabsAction tabsActionNoBottom">'."\n";
// print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
// print '</div>';
//}
print '</form>'; print '</form>';
// End of page // End of page

View File

@ -686,7 +686,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -816,8 +816,8 @@ class AccountancyExport
// Keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!! // Keep correct quadra named field instead of anon filler libelle_ecriture2 is 30 char not 32 !!!!
// as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec // as we use utf8, we must remove accent to have only one ascii char instead of utf8 2 chars for specials that report wrong line size that will exceed import format spec
// TODO: we should filter more than only accent to avoid wrong line size // TODO: we should filter more than only accent to avoid wrong line size
// TODO: remove invoice number doc_ref in libelle, // TODO: remove invoice number doc_ref in label,
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software // TODO: we should offer an option for customer to build the label using invoice number / name / date in accounting software
//$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30); //$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30); $Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
$Tab['codetva'] = str_repeat(' ', 2); $Tab['codetva'] = str_repeat(' ', 2);

View File

@ -684,9 +684,9 @@ class AccountingAccount extends CommonObject
} }
/** /**
* Retourne le libelle du statut d'un user (actif, inactif) * Return the label of the status
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
@ -696,10 +696,10 @@ class AccountingAccount extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Return the label of a given status
* *
* @param int $status Id status * @param int $status Id status
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
public function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)

View File

@ -312,10 +312,10 @@ class AccountingJournal extends CommonObject
} }
/** /**
* Retourne le libelle du statut d'un user (actif, inactif) * Return the label of the status
* *
* @param int $mode 0=libelle long, 1=libelle court * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of type * @return string Label of status
*/ */
public function getLibType($mode = 0) public function getLibType($mode = 0)
{ {
@ -327,7 +327,7 @@ class AccountingJournal extends CommonObject
* Return type of an accounting journal * Return type of an accounting journal
* *
* @param int $nature Id type * @param int $nature Id type
* @param int $mode 0=libelle long, 1=libelle court * @param int $mode 0=label long, 1=label short
* @return string Label of type * @return string Label of type
*/ */
public function LibType($nature, $mode = 0) public function LibType($nature, $mode = 0)

View File

@ -65,10 +65,10 @@ $search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'aZ09comma'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusonPour le détail de la facture ref…e') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { if (empty($page) || $page < 0) {
$page = 0; $page = 0;
} }
@ -81,6 +81,8 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} else {
$sortorder = "ASC";
} }
} }
@ -159,6 +161,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->hasRight('ac
} }
} }
if (GETPOST('sortfield') == 'f.datef, f.ref, fd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/* /*
* View * View
@ -317,7 +325,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_societe) { if ($search_societe) {
$param .= "&search_societe=".urlencode($search_societe); $param .= "&search_societe=".urlencode($search_societe);

View File

@ -91,6 +91,8 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} else {
$sortorder = "ASC";
} }
} }
@ -208,6 +210,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
} }
} }
if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
}
/* /*
@ -382,7 +389,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_societe) { if ($search_societe) {
$param .= '&search_societe='.urlencode($search_societe); $param .= '&search_societe='.urlencode($search_societe);

View File

@ -75,6 +75,8 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} else {
$sortorder = "ASC";
} }
} }
@ -149,6 +151,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
} }
} }
if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/* /*
* View * View
@ -248,7 +256,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_login) { if ($search_login) {
$param .= '&search_login='.urlencode($search_login); $param .= '&search_login='.urlencode($search_login);

View File

@ -84,6 +84,8 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} else {
$sortorder = "ASC";
} }
} }
@ -199,6 +201,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
} }
} }
if (GETPOST('sortfield') == 'erd.date, erd.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
}
/* /*
@ -306,7 +313,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_login) { if ($search_login) {
$param .= '&search_login='.urlencode($search_login); $param .= '&search_login='.urlencode($search_login);

View File

@ -1211,6 +1211,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
$i++;
} }
} }
@ -1336,6 +1338,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
$i++;
} }
} }
} else { // Waiting account } else { // Waiting account
@ -1373,11 +1377,18 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
$i++;
} }
} }
} }
} }
if (!$i) {
$colspan = 8;
print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -615,6 +615,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
$i++;
} }
} }
@ -649,6 +651,8 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print "</tr>"; print "</tr>";
$i++;
} }
// VAT // VAT
@ -685,11 +689,18 @@ if (empty($action) || $action == 'view') {
print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt >= 0 ? price($mt) : '')."</td>";
print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>"; print '<td class="right nowraponall amount">'.($mt < 0 ? price(-$mt) : '')."</td>";
print "</tr>"; print "</tr>";
$i++;
} }
} }
} }
} }
if (!$i) {
$colspan = 7;
print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
@ -32,6 +32,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
@ -103,9 +104,11 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
} }
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlr, f.close_code,"; $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle as label, f.ref_supplier, f.date_lim_reglement as dlr, f.close_code, f.vat_reverse_charge,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code, fd.info_bits,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur,"; $sql .= " p.default_vat_code AS product_buy_default_vat_code, p.tva_tx as product_buy_vat, p.localtax1_tx as product_buy_localvat1, p.localtax2_tx as product_buy_localvat2,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.fk_pays,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_customer as code_compta,"; $sql .= " spe.accountancy_code_customer as code_compta,";
$sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,"; $sql .= " spe.accountancy_code_supplier as code_compta_fournisseur,";
@ -127,6 +130,7 @@ if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
} }
@ -166,12 +170,18 @@ if ($result) {
$tablocaltax2 = array(); $tablocaltax2 = array();
$tabcompany = array(); $tabcompany = array();
$tabother = array(); $tabother = array();
$tabrctva = array();
$tabrclocaltax1 = array();
$tabrclocaltax2 = array();
$num = $db->num_rows($result); $num = $db->num_rows($result);
// Variables // Variables
$cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'; $cptfour = ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined';
$cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined'; $cpttva = (!empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined';
$rcctva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_CREDIT : 'NotDefined';
$rcdtva = (!empty($conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT)) ? $conf->global->ACCOUNTING_VAT_BUY_REVERSE_CHARGES_DEBIT : 'NotDefined';
$country_code_in_EEC = getCountriesInEEC(); // This make a database call but there is a cache done into $conf->cache['country_code_in_EEC']
$i = 0; $i = 0;
while ($i < $num) { while ($i < $num) {
@ -230,6 +240,53 @@ if ($result) {
$tablocaltax2[$obj->rowid][$compta_localtax2] = 0; $tablocaltax2[$obj->rowid][$compta_localtax2] = 0;
} }
// VAT Reverse charge
if (($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) && $obj->vat_reverse_charge == 1 && in_array($obj->country_code, $country_code_in_EEC)) {
$rcvatdata = getTaxesFromId($obj->product_buy_vat . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : ''), $mysoc, $mysoc, 0);
$rcc_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_tva = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
$rcc_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_localtax1 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
$rcc_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_credit']) ? $vatdata['accountancy_code_vat_reverse_charge_credit'] : $rcctva);
$rcd_compta_localtax2 = (!empty($vatdata['accountancy_code_vat_reverse_charge_debit']) ? $vatdata['accountancy_code_vat_reverse_charge_debit'] : $rcdtva);
if (price2num($obj->product_buy_vat) || !empty($obj->product_buy_default_vat_code)) {
$vat_key = vatrate($obj->product_buy_vat) . ($obj->product_buy_default_vat_code ? ' (' . $obj->product_buy_default_vat_code . ')' : '');
$val_value = $vat_key;
$def_tva[$obj->rowid][$rcc_compta_tva][$vat_key] = $val_value;
$def_tva[$obj->rowid][$rcd_compta_tva][$vat_key] = $val_value;
}
if (!isset($tabrctva[$obj->rowid][$rcc_compta_tva])) {
$tabrctva[$obj->rowid][$rcc_compta_tva] = 0;
}
if (!isset($tabrctva[$obj->rowid][$rcd_compta_tva])) {
$tabrctva[$obj->rowid][$rcd_compta_tva] = 0;
}
if (!isset($tabrclocaltax1[$obj->rowid][$rcc_compta_localtax1])) {
$tabrclocaltax1[$obj->rowid][$rcc_compta_localtax1] = 0;
}
if (!isset($tabrclocaltax1[$obj->rowid][$rcd_compta_localtax1])) {
$tabrclocaltax1[$obj->rowid][$rcd_compta_localtax1] = 0;
}
if (!isset($tabrclocaltax2[$obj->rowid][$rcc_compta_localtax2])) {
$tabrclocaltax2[$obj->rowid][$rcc_compta_localtax2] = 0;
}
if (!isset($tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2])) {
$tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] = 0;
}
$rcvat = (double) price2num($obj->total_ttc * $obj->product_buy_vat / 100, 'MT');
$rclocalvat1 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat1 / 100, 'MT');
$rclocalvat2 = (double) price2num($obj->total_ttc * $obj->product_buy_localvat2 / 100, 'MT');
$tabrctva[$obj->rowid][$rcd_compta_tva] += $rcvat;
$tabrctva[$obj->rowid][$rcc_compta_tva] -= $rcvat;
$tabrclocaltax1[$obj->rowid][$rcd_compta_localtax1] += $rclocalvat1;
$tabrclocaltax1[$obj->rowid][$rcc_compta_localtax1] -= $rclocalvat1;
$tabrclocaltax2[$obj->rowid][$rcd_compta_localtax2] += $rclocalvat2;
$tabrclocaltax2[$obj->rowid][$rcc_compta_localtax2] -= $rclocalvat2;
}
$tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc; $tabttc[$obj->rowid][$compta_soc] += $obj->total_ttc;
$tabht[$obj->rowid][$compta_prod] += $obj->total_ht; $tabht[$obj->rowid][$compta_prod] += $obj->total_ht;
$tabtva[$obj->rowid][$compta_tva] += $obj->total_tva; $tabtva[$obj->rowid][$compta_tva] += $obj->total_tva;
@ -470,6 +527,29 @@ if ($action == 'writebookkeeping') {
$arrayofvat = $tablocaltax2; $arrayofvat = $tablocaltax2;
} }
// VAT Reverse charge
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$has_vat = false;
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$has_vat = true;
}
}
if (!$has_vat) {
$arrayofvat = $tabrctva;
if ($numtax == 1) {
$arrayofvat = $tabrclocaltax1;
}
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
}
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label
@ -720,6 +800,29 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$arrayofvat = $tablocaltax2; $arrayofvat = $tablocaltax2;
} }
// VAT Reverse charge
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$has_vat = false;
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$has_vat = true;
}
}
if (!$has_vat) {
$arrayofvat = $tabrctva;
if ($numtax == 1) {
$arrayofvat = $tabrclocaltax1;
}
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
}
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '"'.$key.'"'.$sep; print '"'.$key.'"'.$sep;
@ -998,6 +1101,29 @@ if (empty($action) || $action == 'view') {
$arrayofvat = $tablocaltax2; $arrayofvat = $tablocaltax2;
} }
// VAT Reverse charge
if ($mysoc->country_code == 'FR' || !empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
$has_vat = false;
foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) {
$has_vat = true;
}
}
if (!$has_vat) {
$arrayofvat = $tabrctva;
if ($numtax == 1) {
$arrayofvat = $tabrclocaltax1;
}
if ($numtax == 2) {
$arrayofvat = $tabrclocaltax2;
}
if (!is_array($arrayofvat[$key])) {
$arrayofvat[$key] = array();
}
}
}
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -272,9 +272,10 @@ $object_label = $langs->trans("ObjectsRef");
if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef"); if ($object->nature == 2 || $object->nature == 3) $object_label = $langs->trans("InvoiceRef");
if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef"); if ($object->nature == 5) $object_label = $langs->trans("ExpenseReportRef");
/*
* Show result array // Show result array
*/ $i = 0;
print '<br>'; print '<br>';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
@ -304,11 +305,21 @@ if (is_array($journal_data) && !empty($journal_data)) {
print '<td class="right nowraponall">' . $line['debit'] . '</td>'; print '<td class="right nowraponall">' . $line['debit'] . '</td>';
print '<td class="right nowraponall">' . $line['credit'] . '</td>'; print '<td class="right nowraponall">' . $line['credit'] . '</td>';
print '</tr>'; print '</tr>';
$i++;
} }
} }
} }
} }
if (!$i) {
$colspan = 7;
if ($object->nature == 4) {
$colspan++;
}
print '<tr class="oddeven"><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@ -83,6 +83,8 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} else {
$sortorder = "ASC";
} }
} }
@ -164,6 +166,12 @@ if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->acco
} }
} }
if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $value, 'yesno', 0, '', $conf->entity);
}
/* /*
* View * View
@ -322,7 +330,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_societe) { if ($search_societe) {
$param .= "&search_societe=".urlencode($search_societe); $param .= "&search_societe=".urlencode($search_societe);

View File

@ -93,6 +93,8 @@ if (!$sortfield) {
if (!$sortorder) { if (!$sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
} else {
$sortorder = "ASC";
} }
} }
@ -210,6 +212,11 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
} }
} }
if (GETPOST('sortfield') == 'f.datef, f.ref, l.rowid') {
$value = (GETPOST('sortorder') == 'asc,asc,asc' ? 0 : 1);
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_TODO", $value, 'yesno', 0, '', $conf->entity);
}
/* /*
@ -386,7 +393,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_societe) { if ($search_societe) {
$param .= '&search_societe='.urlencode($search_societe); $param .= '&search_societe='.urlencode($search_societe);

View File

@ -73,7 +73,7 @@ $search_agenda_label = GETPOST('search_agenda_label');
$objcanvas = null; $objcanvas = null;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('memberagenda')); $hookmanager->initHooks(array('memberagenda', 'globalcard'));
// Security check // Security check
$result = restrictedArea($user, 'adherent', $id); $result = restrictedArea($user, 'adherent', $id);

View File

@ -1403,7 +1403,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</table>'; print '</table>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print $form->buttonsSaveCancel("Save", ''); print $form->buttonsSaveCancel("Save", 'Cancel');
print '</form>'; print '</form>';
} }
@ -2041,7 +2041,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($useonlinepayment) { if ($useonlinepayment) {
print '<br>'; print '<br>';
if (empty($amount)) { // Take the maximum amount among what the member is supposed to pay / has paid in the past if (empty($amount)) { // Take the maximum amount among what the member is supposed to pay / has paid in the past
$amount = price(max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount)); $amount = max($adht->amount, $object->first_subscription_amount, $object->last_subscription_amount);
} }
if (empty($amount)) { if (empty($amount)) {
$amount = 0; $amount = 0;

View File

@ -1247,7 +1247,7 @@ class Adherent extends CommonObject
if ($result >= 0) { if ($result >= 0) {
$result = $luser->setPassword($user, $this->pass, 0, 0, 1); $result = $luser->setPassword($user, $this->pass, 0, 0, 1);
if ($result < 0) { if (is_numeric($result) && $result < 0) {
$this->error = $luser->error; $this->error = $luser->error;
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
$error++; $error++;
@ -2413,8 +2413,7 @@ class Adherent extends CommonObject
} }
// Only picto // Only picto
if ($withpictoimg > 0) { if ($withpictoimg > 0) {
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'. $picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams), 0, 0, $notooltip ? 0 : 1).'</span>';
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : $dataparams.' class="'.$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1).'</span>';
} else { } else {
// Picto must be a photo // Picto must be a photo
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>'; $picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>';
@ -3062,7 +3061,7 @@ class Adherent extends CommonObject
$blockingerrormsg = ''; $blockingerrormsg = '';
if (empty($conf->adherent->enabled)) { // Should not happen. If module disabled, cron job should not be visible. if (!isModEnabled('adherent')) { // Should not happen. If module disabled, cron job should not be visible.
$langs->load("agenda"); $langs->load("agenda");
$this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent")); $this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0; return 0;

View File

@ -774,7 +774,7 @@ class AdherentType extends CommonObject
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) { if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (' class="'.(($withpicto != 2) ? 'paddingright' : '').'"'), 0, 0, $notooltip ? 0 : 1);
} }
if ($withpicto != 2) { if ($withpicto != 2) {
$result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label); $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);

View File

@ -452,10 +452,10 @@ class Subscription extends CommonObject
/** /**
* Retourne le libelle du statut d'une adhesion * Return the label of the status
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label * @return string Label of status
*/ */
public function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
@ -464,16 +464,19 @@ class Subscription extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Return the label of a given status
* *
* @param int $status Id status * @param int $status Id status
* @return string Label * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/ */
public function LibStatut($status) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load("members");
//$langs->load("members");
return ''; return '';
} }

View File

@ -188,7 +188,8 @@ $result = restrictedArea($user, 'adherent');
*/ */
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $massaction = ''; $action = 'list';
$massaction = '';
} }
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
$massaction = ''; $massaction = '';
@ -324,14 +325,17 @@ $formother = new FormOther($db);
$membertypestatic = new AdherentType($db); $membertypestatic = new AdherentType($db);
$memberstatic = new Adherent($db); $memberstatic = new Adherent($db);
$now = dol_now();
// Page Header // Page Header
$title = $langs->trans("Members")." - ".$langs->trans("List"); $title = $langs->trans("Members")." - ".$langs->trans("List");
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder'; $help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros|DE:Modul_Mitglieder';
llxHeader('', $title, $help_url); $morejs = array();
$morecss = array();
$now = dol_now(); // Build and execute select
// --------------------------------------------------------------------
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
$sql = "SELECT DISTINCT"; $sql = "SELECT DISTINCT";
} else { } else {
@ -356,7 +360,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
// Add fields from hooks // Add fields from hooks
$parameters = array(); $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 .= $hookmanager->resPrint;
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
@ -487,16 +491,14 @@ if ($search_country) {
if ($search_import_key) { if ($search_import_key) {
$sql .= natural_search("d.import_key", $search_import_key); $sql .= natural_search("d.import_key", $search_import_key);
} }
// Add where from extra fields // Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks // Add where from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // 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; $sql .= $hookmanager->resPrint;
// Count total nb of records with no order and no limits // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */ /* The fast and low memory method to get and count full list converts the sql into a sql count */
@ -510,7 +512,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
dol_print_error($db); 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; $page = 0;
$offset = 0; $offset = 0;
} }
@ -533,8 +535,7 @@ if (!$resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array(); // Direct jump if only one record found
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;
@ -542,6 +543,13 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
exit; exit;
} }
// Output page
// --------------------------------------------------------------------
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
$arrayofselected = is_array($toselect) ? $toselect : array();
if ($search_type > 0) { if ($search_type > 0) {
$membertype = new AdherentType($db); $membertype = new AdherentType($db);
@ -558,7 +566,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($sall != "") { if ($sall != "") {
$param .= "&sall=".urlencode($sall); $param .= "&sall=".urlencode($sall);
@ -712,7 +720,7 @@ if (!empty($moreforfilter)) {
} }
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
if ($massactionbutton) { if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
} }
@ -1351,7 +1359,7 @@ if ($num == 0) {
$colspan++; $colspan++;
} }
} }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} }
$db->free($resql); $db->free($resql);

View File

@ -451,7 +451,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
$param .= '&id='.$rowid; $param .= '&id='.$rowid;
if ($optioncss != '') { if ($optioncss != '') {

View File

@ -50,6 +50,7 @@ $mode = GETPOST('mode', 'alopha');
$sall = GETPOST("sall", "alpha"); $sall = GETPOST("sall", "alpha");
$filter = GETPOST("filter", 'alpha'); $filter = GETPOST("filter", 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
$search_lastname = GETPOST('search_lastname', 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha');
$search_login = GETPOST('search_login', 'alpha'); $search_login = GETPOST('search_login', 'alpha');
$search_email = GETPOST('search_email', 'alpha'); $search_email = GETPOST('search_email', 'alpha');
@ -96,15 +97,6 @@ $hookmanager->initHooks(array('membertypecard', 'globalcard'));
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
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
$search_lastname = "";
$search_login = "";
$search_email = "";
$type = "";
$sall = "";
}
// Security check // Security check
$result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
@ -113,6 +105,15 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type');
* Actions * Actions
*/ */
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
$search_ref = "";
$search_lastname = "";
$search_login = "";
$search_email = "";
$type = "";
$sall = "";
}
if (GETPOST('cancel', 'alpha')) { if (GETPOST('cancel', 'alpha')) {
$action = 'list'; $action = 'list';
$massaction = ''; $massaction = '';
@ -456,12 +457,12 @@ if ($action == 'create') {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
$doleditor->Create(); $doleditor->Create();
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
@ -549,6 +550,7 @@ if ($rowid > 0) {
print dol_get_fiche_end(); print dol_get_fiche_end();
/* /*
* Buttons * Buttons
*/ */
@ -561,8 +563,16 @@ if ($rowid > 0) {
} }
// Add // Add
if ($object->morphy == 'phy') {
$morphy = 'phy';
} elseif ($object->morphy == 'mor') {
$morphy = 'mor';
} else {
$morphy = '';
}
if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) { if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) {
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.($morphy ? '&morphy='.urlencode($morphy) : '').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
} }
@ -581,9 +591,9 @@ if ($rowid > 0) {
$now = dol_now(); $now = dol_now();
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,"; $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,";
$sql .= " d.datefin,"; $sql .= " d.datefin,";
$sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
$sql .= " t.libelle as type, t.subscription, t.amount"; $sql .= " t.libelle as type, t.subscription, t.amount";
$sqlfields = $sql; // $sql fields to remove for count total $sqlfields = $sql; // $sql fields to remove for count total
@ -603,6 +613,9 @@ if ($rowid > 0) {
$sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha')); $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha'));
} }
} }
if (!empty($search_ref)) {
$sql .= natural_search("d.ref", $search_ref);
}
if (!empty($search_lastname)) { if (!empty($search_lastname)) {
$sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname); $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname);
} }
@ -691,6 +704,9 @@ if ($rowid > 0) {
if (!empty($status)) { if (!empty($status)) {
$param .= "&status=".urlencode($status); $param .= "&status=".urlencode($status);
} }
if (!empty($search_ref)) {
$param .= "&search_ref=".urlencode($search_ref);
}
if (!empty($search_lastname)) { if (!empty($search_lastname)) {
$param .= "&search_lastname=".urlencode($search_lastname); $param .= "&search_lastname=".urlencode($search_lastname);
} }
@ -732,6 +748,9 @@ if ($rowid > 0) {
print '</td>'; print '</td>';
} }
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre left">'; print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>'; print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
@ -761,6 +780,7 @@ if ($rowid > 0) {
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);
} }
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder);
@ -780,13 +800,19 @@ if ($rowid > 0) {
$datefin = $db->jdate($objp->datefin); $datefin = $db->jdate($objp->datefin);
$adh->id = $objp->rowid;
$adh->ref = $objp->ref;
$adh->login = $objp->login;
$adh->lastname = $objp->lastname; $adh->lastname = $objp->lastname;
$adh->firstname = $objp->firstname; $adh->firstname = $objp->firstname;
$adh->datefin = $datefin; $adh->datefin = $datefin;
$adh->need_subscription = $objp->subscription; $adh->need_subscription = $objp->subscription;
$adh->statut = $objp->status; $adh->statut = $objp->status;
$adh->email = $objp->email;
$adh->photo = $objp->photo;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Actions // Actions
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">'; print '<td class="center">';
@ -798,6 +824,12 @@ if ($rowid > 0) {
} }
print "</td>"; print "</td>";
} }
// Ref
print "<td>";
print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print "</td>\n";
// Lastname // Lastname
if ($objp->company != '') { if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
@ -943,12 +975,12 @@ if ($rowid > 0) {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";

View File

@ -289,7 +289,7 @@ if ($action == 'create' && $user->hasRight('adherent', 'configurer')) {
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" class="minwidth300" value="'.dol_escape_htmltag(GETPOST("libelle", 'alphanohtml')).'"></td></tr>'; print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" class="minwidth300" value="'.dol_escape_htmltag(GETPOST("libelle", 'alphanohtml')).'"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%'); $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), ROWS_3, '90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';

View File

@ -55,6 +55,7 @@ $error = 0;
$title = $langs->trans("ConfigAccountingExpert"); $title = $langs->trans("ConfigAccountingExpert");
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';

View File

@ -161,7 +161,7 @@ if (!empty($triggers)) {
$module = 'fournisseur'; $module = 'fournisseur';
} }
if ($module == 'shipping') { if ($module == 'shipping') {
$module = 'expedition_bon'; $module = 'expedition';
} }
if ($module == 'member') { if ($module == 'member') {
$module = 'adherent'; $module = 'adherent';

View File

@ -531,7 +531,7 @@ print '<td>';
print '<input type="hidden" name="action" value="setribchq">'; print '<input type="hidden" name="action" value="setribchq">';
print $langs->trans("PaymentMode").'</td>'; print $langs->trans("PaymentMode").'</td>';
print '<td align="right">'; print '<td align="right">';
if (empty($conf->facture->enabled)) { if (!isModEnabled('facture')) {
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
} }
print '</td>'; print '</td>';
@ -540,7 +540,7 @@ print "</tr>\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>"; print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>"; print "<td>";
if (empty($conf->facture->enabled)) { if (!isModEnabled('facture')) {
if (isModEnabled("banque")) { if (isModEnabled("banque")) {
$sql = "SELECT rowid, label"; $sql = "SELECT rowid, label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
@ -579,7 +579,7 @@ print "</td></tr>";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>"; print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
print "<td>"; print "<td>";
if (empty($conf->facture->enabled)) { if (!isModEnabled('facture')) {
print '<select class="flat" name="chq" id="chq">'; print '<select class="flat" name="chq" id="chq">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>'; print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>'; print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
@ -682,7 +682,7 @@ print '</form>';
// Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. // Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation.
// TODO Must be implemented by PDF templates // TODO Must be implemented by PDF templates
// Ask for payment bank during order // Ask for payment bank during order
if ($conf->banque->enabled) { if (isModEnabled("banque")) {
print '<tr class="oddeven"><td>'; print '<tr class="oddeven"><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td class="center">';

View File

@ -404,7 +404,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n"; print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->trans("CompanyInfo").'</th><th></th></tr>'."\n";
// Name // Name
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
@ -572,12 +572,14 @@ print '</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// IDs of the company (country-specific) // IDs of the company (country-specific)
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td class="titlefieldcreate wordbreak">'.$langs->trans("CompanyIds").'</td><td></td></tr>';
$langs->load("companies"); $langs->load("companies");
@ -688,7 +690,7 @@ print '</div>';
print '<br>'; print '<br>';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</td><td>'.$langs->trans("Value").'</td>'; print '<td class="titlefieldcreate">'.$langs->trans("FiscalYearInformation").'</td><td></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>'; print '<tr class="oddeven"><td><label for="SOCIETE_FISCAL_MONTH_START">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
@ -703,7 +705,7 @@ print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment');
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$langs->trans("VATManagement").'</td><td>'.$langs->trans("Description").'</td>'; print '<td class="titlefieldcreate">'.$langs->trans("VATManagement").'</td><td></td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -733,7 +735,7 @@ print "</table>";
print '<br>'; print '<br>';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>'; print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).'</td><td></td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -777,7 +779,7 @@ print "</table>";
print '<br>'; print '<br>';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td>'.$langs->trans("Description").'</td>'; print '<td class="titlefieldcreate">'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).'</td><td></td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -821,7 +823,7 @@ print "</table>";
print '<br>'; print '<br>';
print '<table class="noborder centpercent editmode">'; print '<table class="noborder centpercent editmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td>'.$langs->trans("Description").'</td>'; print '<td>'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).'</td><td></td>';
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
if ($mysoc->useRevenueStamp()) { if ($mysoc->useRevenueStamp()) {

View File

@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($optioncss != '') { if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);
@ -383,7 +383,12 @@ if (!is_array($result) && $result < 0) {
print '</td>'; print '</td>';
} }
print '<td></td>'; // Multicompany
print '<td>';
if (isModEnabled('multicompany')) {
print dol_escape_htmltag($defaultvalue->entity);
}
print '</td>';
// Actions // Actions
print '<td class="center">'; print '<td class="center">';

View File

@ -101,7 +101,7 @@ $hookmanager->initHooks(array('admin', 'dictionaryadmin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0); $taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 31, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname = array(); $tabname = array();
@ -135,7 +135,7 @@ $tabname[27] = "c_stcomm";
$tabname[28] = "c_holiday_types"; $tabname[28] = "c_holiday_types";
$tabname[29] = "c_lead_status"; $tabname[29] = "c_lead_status";
$tabname[30] = "c_format_cards"; $tabname[30] = "c_format_cards";
//$tabname[31]= "accounting_system"; $tabname[31] = "c_invoice_subtype";
$tabname[32] = "c_hrm_public_holiday"; $tabname[32] = "c_hrm_public_holiday";
$tabname[33] = "c_hrm_department"; $tabname[33] = "c_hrm_department";
$tabname[34] = "c_hrm_function"; $tabname[34] = "c_hrm_function";
@ -182,7 +182,7 @@ $tablib[27] = "DictionaryProspectStatus";
$tablib[28] = "DictionaryHolidayTypes"; $tablib[28] = "DictionaryHolidayTypes";
$tablib[29] = "DictionaryOpportunityStatus"; $tablib[29] = "DictionaryOpportunityStatus";
$tablib[30] = "DictionaryFormatCards"; $tablib[30] = "DictionaryFormatCards";
//$tablib[31]= "DictionaryAccountancysystem"; $tablib[31] = "DictionaryInvoiceSubtype";
$tablib[32] = "DictionaryPublicHolidays"; $tablib[32] = "DictionaryPublicHolidays";
$tablib[33] = "DictionaryDepartment"; $tablib[33] = "DictionaryDepartment";
$tablib[34] = "DictionaryFunction"; $tablib[34] = "DictionaryFunction";
@ -205,10 +205,10 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "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[6] = "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[7] = "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[7] = "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[8] = "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[8] = "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[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10] = "SELECT t.rowid, t.code, 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.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[10] = "SELECT t.rowid, t.code, 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.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid";
$tabsql[11] = "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[11] = "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[12] = "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 = ".getEntity($tabname[12]); $tabsql[12] = "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 = ".getEntity($tabname[12]);
$tabsql[13] = "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 = ".getEntity($tabname[13]); $tabsql[13] = "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 = ".getEntity($tabname[13]);
@ -229,7 +229,7 @@ $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; $tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; $tabsql[31] = "SELECT t.rowid, t.code, t.label, c.label as country, c.code as country_code, t.fk_country as country_id, t.active FROM ".MAIN_DB_PREFIX."c_invoice_subtype as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_country = c.rowid";
$tabsql[32] = "SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.dayrule, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country=c.rowid AND c.active=1"; $tabsql[32] = "SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.dayrule, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country=c.rowid AND c.active=1";
$tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; $tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
@ -276,7 +276,7 @@ $tabsqlsort[27] = "code ASC";
$tabsqlsort[28] = "sortorder ASC, country ASC, code ASC"; $tabsqlsort[28] = "sortorder ASC, country ASC, code ASC";
$tabsqlsort[29] = "position ASC"; $tabsqlsort[29] = "position ASC";
$tabsqlsort[30] = "code ASC"; $tabsqlsort[30] = "code ASC";
//$tabsqlsort[31]="pcg_version ASC"; $tabsqlsort[31] = "country ASC, code ASC";
$tabsqlsort[32] = "country, year ASC, month ASC, day ASC"; $tabsqlsort[32] = "country, year ASC, month ASC, day ASC";
$tabsqlsort[33] = "code ASC"; $tabsqlsort[33] = "code ASC";
$tabsqlsort[34] = "code ASC"; $tabsqlsort[34] = "code ASC";
@ -323,7 +323,7 @@ $tabfield[27] = "code,libelle,picto";
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder"; $tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder";
$tabfield[29] = "code,label,percent,position"; $tabfield[29] = "code,label,percent,position";
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label"; $tabfield[31] = "country_id,country,code,label";
$tabfield[32] = "code,dayrule,year,month,day,country_id,country"; $tabfield[32] = "code,dayrule,year,month,day,country_id,country";
$tabfield[33] = "code,label"; $tabfield[33] = "code,label";
$tabfield[34] = "code,label"; $tabfield[34] = "code,label";
@ -370,7 +370,7 @@ $tabfieldvalue[27] = "code,libelle,picto";
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder"; $tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder";
$tabfieldvalue[29] = "code,label,percent,position"; $tabfieldvalue[29] = "code,label,percent,position";
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldvalue[31]= "pcg_version,label"; $tabfieldvalue[31] = "country,code,label";
$tabfieldvalue[32] = "code,dayrule,day,month,year,country"; $tabfieldvalue[32] = "code,dayrule,day,month,year,country";
$tabfieldvalue[33] = "code,label"; $tabfieldvalue[33] = "code,label";
$tabfieldvalue[34] = "code,label"; $tabfieldvalue[34] = "code,label";
@ -417,8 +417,7 @@ $tabfieldinsert[27] = "code,libelle,picto";
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder"; $tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder";
$tabfieldinsert[29] = "code,label,percent,position"; $tabfieldinsert[29] = "code,label,percent,position";
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; $tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfieldinsert[31]= "pcg_version,label"; $tabfieldinsert[31] = "fk_country,code,label";
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[32] = "code,dayrule,day,month,year,fk_country"; $tabfieldinsert[32] = "code,dayrule,day,month,year,fk_country";
$tabfieldinsert[33] = "code,label"; $tabfieldinsert[33] = "code,label";
$tabfieldinsert[34] = "code,label"; $tabfieldinsert[34] = "code,label";
@ -467,7 +466,7 @@ $tabrowid[27] = "id";
$tabrowid[28] = ""; $tabrowid[28] = "";
$tabrowid[29] = ""; $tabrowid[29] = "";
$tabrowid[30] = ""; $tabrowid[30] = "";
//$tabrowid[31]= ""; $tabrowid[31]= "";
$tabrowid[32] = "id"; $tabrowid[32] = "id";
$tabrowid[33] = "rowid"; $tabrowid[33] = "rowid";
$tabrowid[34] = "rowid"; $tabrowid[34] = "rowid";
@ -495,15 +494,15 @@ $tabcond[8] = isModEnabled("societe");
$tabcond[9] = true; $tabcond[9] = true;
$tabcond[10] = true; $tabcond[10] = true;
$tabcond[11] = (isModEnabled("societe")); $tabcond[11] = (isModEnabled("societe"));
$tabcond[12] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); $tabcond[12] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || isModEnabled("supplier_invoice") || isModEnabled("supplier_order"));
$tabcond[13] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); $tabcond[13] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || isModEnabled("supplier_invoice") || isModEnabled("supplier_order"));
$tabcond[14] = (isModEnabled("product") && (isModEnabled('ecotax') || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY))); $tabcond[14] = (isModEnabled("product") && (isModEnabled('ecotax') || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
$tabcond[15] = true; $tabcond[15] = true;
$tabcond[16] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); $tabcond[16] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
$tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport')); $tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport'));
$tabcond[18] = isModEnabled("expedition") || isModEnabled("reception"); $tabcond[18] = isModEnabled("expedition") || isModEnabled("reception");
$tabcond[19] = isModEnabled("societe"); $tabcond[19] = isModEnabled("societe");
$tabcond[20] = (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order"); $tabcond[20] = isModEnabled("supplier_order");
$tabcond[21] = isModEnabled("propal"); $tabcond[21] = isModEnabled("propal");
$tabcond[22] = (isModEnabled('commande') || isModEnabled("propal")); $tabcond[22] = (isModEnabled('commande') || isModEnabled("propal"));
$tabcond[23] = true; $tabcond[23] = true;
@ -514,7 +513,7 @@ $tabcond[27] = isModEnabled("societe");
$tabcond[28] = isModEnabled('holiday'); $tabcond[28] = isModEnabled('holiday');
$tabcond[29] = isModEnabled('project'); $tabcond[29] = isModEnabled('project');
$tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary $tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary
//$tabcond[31]= isModEnabled('accounting'); $tabcond[31] = ((isModEnabled('facture') || isModEnabled('supplier_invoice')) && $mysoc->country_code == 'GR');
$tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm')); $tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm'));
$tabcond[33] = isModEnabled('hrm'); $tabcond[33] = isModEnabled('hrm');
$tabcond[34] = isModEnabled('hrm'); $tabcond[34] = isModEnabled('hrm');
@ -576,6 +575,7 @@ $tabcomplete = array(
'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), 'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), 'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), 'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
'c_invoice_subtype'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
); );
@ -714,7 +714,7 @@ if (empty($reshook)) {
$ok = 1; $ok = 1;
foreach ($listfield as $f => $value) { foreach ($listfield as $f => $value) {
// Discard check of mandatory fields for country for some tables // Discard check of mandatory fields for country for some tables
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryInvoiceSubtype', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) {
continue; // For some pages, country is not mandatory continue; // For some pages, country is not mandatory
} }
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) {
@ -1201,7 +1201,7 @@ if ($search_country_id > 0) {
$param .= '&search_country_id='.urlencode($search_country_id); $param .= '&search_country_id='.urlencode($search_country_id);
} }
if ($search_code != '') { if ($search_code != '') {
$param .= '&search_code='.urlencode($search_country_id); $param .= '&search_code='.urlencode($search_code);
} }
if ($entity != '') { if ($entity != '') {
$param .= '&entity='.(int) $entity; $param .= '&entity='.(int) $entity;
@ -1580,7 +1580,9 @@ if ($id > 0) {
} }
print '<td colspan="3" class="center">'; print '<td colspan="3" class="center">';
if ($action != 'edit') { if ($action != 'edit') {
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans("Add").'">';
} else {
print '<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans("Add").'">';
} }
print '</td>'; print '</td>';
@ -1609,25 +1611,56 @@ if ($id > 0) {
$i = 0; $i = 0;
// There is several pages // There is several pages
if ($num > $listlimit || $page) { if (($num > $listlimit) || $page) {
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>'); print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
} }
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
continue;
}
$showfield = 1; // By default
if ($value == 'region_id' || $value == 'country_id') {
$showfield = 0;
}
if ($showfield) {
if ($value == 'country') {
$filterfound++;
} elseif ($value == 'code') {
$filterfound++;
}
}
}
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
// Title line with search input fields // Title line with search input fields
print '<!-- line title to search record -->'."\n"; print '<!-- line title to search record -->'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
$filterfound = 0;
// Action button
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
$colspan++;
}
$colspan = 0;
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
if ($value == 'entity') { if ($value == 'entity') {
continue; continue;
} }
$showfield = 1; // By default $showfield = 1; // By default
if ($value == 'region_id' || $value == 'country_id') { if ($value == 'region_id' || $value == 'country_id') {
$showfield = 0; $showfield = 0;
} }
@ -1637,34 +1670,51 @@ if ($id > 0) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
$filterfound++; $colspan++;
} elseif ($value == 'code') { } elseif ($value == 'code') {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">'; print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '</td>'; print '</td>';
$filterfound++; $colspan++;
} else { } else {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
$colspan++;
} }
} }
} }
if ($id == 4) { if ($id == 4) {
print '<td></td>'; print '<td></td>';
$colspan++;
print '<td></td>'; print '<td></td>';
$colspan++;
} }
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre right" colspan="2">'; $colspan++;
// Action button
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
if ($filterfound) { if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0); $searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
} }
print '</td>'; print '</td>';
$colspan++;
}
print '</tr>'; print '</tr>';
// Title of lines // Title of lines
print '<!-- line title of record -->'."\n"; print '<!-- line title of record -->'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action button
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList('');
}
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
if ($value == 'entity') { if ($value == 'entity') {
continue; continue;
@ -1896,17 +1946,90 @@ if ($id > 0) {
print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
} }
// Status
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
// Action button
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print getTitleFieldOfList(''); }
print '</tr>'; print '</tr>';
if ($num) { if ($num) {
// Lines with values // Lines with values
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Can an entry be erased or disabled ?
// all true by default
$iserasable = 1;
$canbedisabled = 1;
$canbemodified = 1;
if (isset($obj->code) && $id != 10 && $id != 42) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $canbedisabled = 0;
} elseif ($obj->code == 'RECEP') {
$iserasable = 0; $canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0; $canbedisabled = 0;
}
}
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) {
$iserasable = 0; $canbedisabled = 0;
if (in_array($obj->code, array('banner'))) {
$canbedisabled = 1;
}
}
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) {
$iserasable = 0;
}
if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) {
$canbedisabled = 0; $canbedisabled = 0;
}
$canbemodified = $iserasable;
if (!empty($obj->code) && $obj->code == 'RECEP') {
$canbemodified = 1;
}
if ($tabname[$id] == "c_actioncomm") {
$canbemodified = 1;
}
// Build Url. The table is id=, the id of line is rowid=
$rowidcol = $tabrowid[$id];
// If rowidcol not defined
if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
$rowidcol = 'rowid';
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if (!empty($param)) {
$url .= '&'.$param;
}
if (!is_null($withentity)) {
$url .= '&entity='.$withentity;
}
$url .= '&';
//print_r($obj); //print_r($obj);
print '<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ? '' : $obj->rowid).'">'; print '<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ? '' : $obj->rowid).'">';
// Action button
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center maxwidthsearch nowraponall">';
// Modify link
if ($canbemodified) {
print '<a class="reposition editfielda marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
}
// Delete link
if ($iserasable) {
if ($user->admin) {
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
}
print '</td>';
}
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
$tmpaction = 'edit'; $tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
@ -2141,56 +2264,6 @@ if ($id > 0) {
} }
} }
// Can an entry be erased or disabled ?
// all true by default
$iserasable = 1;
$canbedisabled = 1;
$canbemodified = 1;
if (isset($obj->code) && $id != 10 && $id != 42) {
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) {
$iserasable = 0; $canbedisabled = 0;
} elseif ($obj->code == 'RECEP') {
$iserasable = 0; $canbedisabled = 0;
} elseif ($obj->code == 'EF0') {
$iserasable = 0; $canbedisabled = 0;
}
}
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) {
$iserasable = 0; $canbedisabled = 0;
if (in_array($obj->code, array('banner'))) {
$canbedisabled = 1;
}
}
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) {
$iserasable = 0;
}
if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) {
$canbedisabled = 0; $canbedisabled = 0;
}
$canbemodified = $iserasable;
if (!empty($obj->code) && $obj->code == 'RECEP') {
$canbemodified = 1;
}
if ($tabname[$id] == "c_actioncomm") {
$canbemodified = 1;
}
// Build Url. The table is id=, the id of line is rowid=
$rowidcol = $tabrowid[$id];
// If rowidcol not defined
if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
$rowidcol = 'rowid';
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if (!empty($param)) {
$url .= '&'.$param;
}
if (!is_null($withentity)) {
$url .= '&entity='.$withentity;
}
$url .= '&';
// Favorite & EEC // Favorite & EEC
// Only activated on country dictionary // Only activated on country dictionary
if ($id == 4) { if ($id == 4) {
@ -2229,29 +2302,28 @@ if ($id > 0) {
} }
print "</td>"; print "</td>";
// Action button
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center maxwidthsearch">';
// Modify link // Modify link
if ($canbemodified) { if ($canbemodified) {
print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>'; print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
} else {
print '<td>&nbsp;</td>';
} }
// Delete link // Delete link
if ($iserasable) { if ($iserasable) {
print '<td class="center">';
if ($user->admin) { if ($user->admin) {
print '<a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>'; print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
} }
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>'; print '</td>';
} else {
print '<td>&nbsp;</td>';
} }
print "</tr>\n"; print "</tr>\n";
} }
$i++; $i++;
} }
} else {
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
} }
print '</table>'; print '</table>';
@ -2372,8 +2444,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
continue; continue;
} // For state page, we do not show the country input (we link to region, not country) } // For state page, we do not show the country input (we link to region, not country)
print '<td>'; print '<td>';
$fieldname = 'country';
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone'); $selected = (!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : ''));
if (!GETPOSTISSET('code')) {
$selected = GETPOST('countryidforinsert');
}
print $form->select_country($selected, $value, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
print '</td>'; print '</td>';
} elseif ($value == 'country_id') { } elseif ($value == 'country_id') {
if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate) if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate)

View File

@ -603,7 +603,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Filters // Filters
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table id="tablelineoffilters" class="noborder margintable noshadow">'; print '<table id="tablelineoffilters" class="noborder nobordertop noshadow">';
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
print '<td>'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>'; print '<td>'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'</td><td></td><td></td>';
print '</tr>'; print '</tr>';
@ -615,20 +615,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')), 'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')),
'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')), 'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')),
'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')), 'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')),
'replyto'=>array('label'=>'ReplyTo', 'data-placeholder'=>$langs->trans('SearchString')),
'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')), 'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')),
'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')), 'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')),
// disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2 // disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2
//'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value //'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value
//'X1'=>'---', //'X1'=>'---',
//'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'),
//'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'),
'X2'=>'---', 'X2'=>'---',
'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1), 'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1),
'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1), 'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1),
'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1), 'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1),
'answered'=>array('label'=>'Answered', 'data-noparam'=>1), 'answered'=>array('label'=>'Answered', 'data-noparam'=>1),
'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')), 'smaller'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("SmallerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')), 'larger'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("LargerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')),
'X3'=>'---', 'X3'=>'---',
'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1), 'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1),
'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1), 'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1),
@ -662,7 +661,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td><td>'; print '</td><td>';
print '<input type="text" name="rulevalue" id="rulevalue">'; print '<input type="text" name="rulevalue" id="rulevalue">';
print '</td>'; print '</td>';
print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button small" value="'.$langs->trans("Add").'"></td>'; print '<td class="right"><input type="submit" name="addfilter" id="addfilter" class="flat button smallpaddingimp" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
// List filters // List filters
foreach ($object->filters as $rulefilter) { foreach ($object->filters as $rulefilter) {
@ -690,7 +689,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder noshadow">'; print '<table id="tablelines" class="noborder noshadow">';
print '<tr class="liste_titre nodrag nodrop">'; print '<tr class="liste_titre nodrag nodrop">';
print '<td>'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'</td><td></td><td></td><td></td>'; print '<td>'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).'</td>';
print '<td>';
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
print $form->textwithpicto($langs->trans("Parameters"), $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
print '</td>';
print '<td></td>';
print '<td></td>';
print '</tr>'; print '</tr>';
$arrayoftypes = array( $arrayoftypes = array(
@ -730,13 +735,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<td>'; print '<td>';
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1); print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1);
print '</td><td>'; print '</td><td>';
//print '<input type="text" name="operationparam">'; print '<textarea class="centpercent" name="operationparam" rows="3"></textarea>';
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
print $form->textwithpicto('<input type="text" name="operationparam">', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '</td>'; print '</td>';
print '<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button small" value="'.$langs->trans("Add").'"></td>'; print '<td class="right"><input type="submit" name="addoperation" id="addoperation" class="flat button smallpaddingimp" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
// List operations // List operations
$nboflines = count($object->actions); $nboflines = count($object->actions);
@ -766,12 +769,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td>'; print '</td>';
print '<td class="wordbreak minwidth300 small">'; print '<td class="wordbreak minwidth300 small">';
if ($action == 'editoperation' && $ruleaction['id'] == $operationid) { if ($action == 'editoperation' && $ruleaction['id'] == $operationid) {
print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.dol_escape_htmltag($ruleaction['actionparam']).'"><br>'; //print '<input type="text" class="quatrevingtquinzepercent" name="operationparam2" value="'.dol_escape_htmltag($ruleaction['actionparam']).'"><br>';
print '<textarea class="centpercent" name="operationparam2" rows="3">';
print dol_escape_htmltag($ruleaction['actionparam'], 0, 1);
print '</textarea>';
print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'">'; print '<input type="hidden" name="rowidoperation2" value="'.$ruleaction['id'].'">';
print '<input type="submit" class="button small button-save" name="saveoperation2" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button small button-save" name="saveoperation2" value="'.$langs->trans("Save").'">';
print '<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button small button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
} else { } else {
print dol_escape_htmltag($ruleaction['actionparam']); print dol_nl2br(dol_escape_htmltag($ruleaction['actionparam'], 0, 1));
} }
print '</td>'; print '</td>';
// Move up/down // Move up/down

View File

@ -337,7 +337,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key]) && count($search[$key])) {

View File

@ -64,7 +64,7 @@ $conditions = array(
'NOTE_PRIVATE' => 1, 'NOTE_PRIVATE' => 1,
'SOCIETE' => 1, 'SOCIETE' => 1,
'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")), 'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")),
'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")),
'USERSIGN' => 1, 'USERSIGN' => 1,
'MAILING' => isModEnabled('mailing'), 'MAILING' => isModEnabled('mailing'),
'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')),

View File

@ -809,7 +809,7 @@ if ($action == 'edit') {
if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) {
$messagetoshow = $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD"); $messagetoshow = $langs->trans("WarningPHPMail").'<br>'.$langs->trans("WarningPHPMailA").'<br>'.$langs->trans("WarningPHPMailB").'<br>'.$langs->trans("WarningPHPMailC").'<br><br>'.$langs->trans("WarningPHPMailD");
$messagetoshow .= ' '.$langs->trans("WarningPHPMailDbis", '{s1}', '{s2}'); $messagetoshow .= ' '.$langs->trans("WarningPHPMailDbis", '{s1}', '{s2}');
$linktosetvar1 = '<a href="'.$_SERVER["PHP_SELF"].'?action=disablephpmailwarning&token='.newToken().'">'; $linktosetvar1 = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=disablephpmailwarning&token='.newToken().'">';
$linktosetvar2 = '</a>'; $linktosetvar2 = '</a>';
$messagetoshow = str_replace('{s1}', $linktosetvar1, $messagetoshow); $messagetoshow = str_replace('{s1}', $linktosetvar1, $messagetoshow);
$messagetoshow = str_replace('{s2}', $linktosetvar2, $messagetoshow); $messagetoshow = str_replace('{s2}', $linktosetvar2, $messagetoshow);

View File

@ -59,6 +59,16 @@ $substitutionarrayfortest = array(
); );
complete_substitutions_array($substitutionarrayfortest, $langs); complete_substitutions_array($substitutionarrayfortest, $langs);
// List of sending methods
$listofmethods = array();
$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
if (version_compare(phpversion(), '7.0', '>=')) {
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
}
// Security check // Security check
if (!$user->admin) { if (!$user->admin) {
accessforbidden(); accessforbidden();
@ -147,16 +157,6 @@ print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
$head = email_admin_prepare_head(); $head = email_admin_prepare_head();
// List of sending methods
$listofmethods = array();
$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
if (version_compare(phpversion(), '7.0', '>=')) {
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
}
// List of oauth services // List of oauth services
$oauthservices = array(); $oauthservices = array();

View File

@ -334,7 +334,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key]) && count($search[$key])) {
@ -627,7 +627,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td class="nowrap center">'; print '<td class="nowrap center">';
$url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid; $url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid;
if ($limit) { if ($limit) {
$url .= '&limit='.urlencode($limit); $url .= '&limit='.((int) $limit);
} }
if ($page) { if ($page) {
$url .= '&page='.urlencode($page); $url .= '&page='.urlencode($page);

View File

@ -93,7 +93,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (empty($sortfield)) { if (empty($sortfield)) {
$sortfield = 'type_template, lang, position, label'; $sortfield = 'type_template,lang,position,label';
} }
if (empty($sortorder)) { if (empty($sortorder)) {
$sortorder = 'ASC'; $sortorder = 'ASC';
@ -109,21 +109,21 @@ $tabname[25] = MAIN_DB_PREFIX."c_email_templates";
// Nom des champs en resultat de select pour affichage du dictionnaire // Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield = array(); $tabfield = array();
$tabfield[25] = "label,lang,type_template,fk_user,private,position,module,topic,joinfiles,content"; $tabfield[25] = "label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfield[25] .= ',content_lines'; $tabfield[25] .= ',content_lines';
} }
// Nom des champs d'edition pour modification d'un enregistrement // Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue = array(); $tabfieldvalue = array();
$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,content"; $tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfieldvalue[25] .= ',content_lines'; $tabfieldvalue[25] .= ',content_lines';
} }
// Nom des champs dans la table pour insertion d'un enregistrement // Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert = array(); $tabfieldinsert = array();
$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,content"; $tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content";
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabfieldinsert[25] .= ',content_lines'; $tabfieldinsert[25] .= ',content_lines';
} }
@ -164,13 +164,14 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabhelp = array(); $tabhelp = array();
$tabhelp[25] = array( $tabhelp[25] = array(
'label'=>$langs->trans('EnterAnyCode'), 'label'=>$langs->trans('EnterAnyCode'),
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'content'=>'<span class="small">'.$helpsubstit.'</span>',
'content_lines'=>'<span class="small">'.$helpsubstitforlines.'</span>',
'type_template'=>$langs->trans("TemplateForElement"), 'type_template'=>$langs->trans("TemplateForElement"),
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
'position'=>$langs->trans("PositionIntoComboList") 'position'=>$langs->trans("PositionIntoComboList"),
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'defaultfortype'=>$langs->trans("DefaultForTypeDesc"),
'content'=>'<span class="small">'.$helpsubstit.'</span>',
'content_lines'=>'<span class="small">'.$helpsubstitforlines.'</span>'
); );
@ -214,10 +215,10 @@ if (isModEnabled('ficheinter')) {
if (isModEnabled('supplier_proposal')) { if (isModEnabled('supplier_proposal')) {
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation')); $elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
} }
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire))) { if (isModEnabled("supplier_order") && ($user->hasRight('fournisseur', 'commande', 'lire') || $user->hasRight('supplier_order', 'read'))) {
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder')); $elementList['order_supplier_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
} }
if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) { if (isModEnabled("supplier_invoice") && ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'read'))) {
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice')); $elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
} }
if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) { if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) {
@ -307,7 +308,7 @@ if (empty($reshook)) {
$ok = 1; $ok = 1;
foreach ($listfield as $f => $value) { foreach ($listfield as $f => $value) {
// Not mandatory fields // Not mandatory fields
if (in_array($value, ['joinfiles', 'content', 'content_lines', 'module'])) { if (in_array($value, ['joinfiles', 'defaultfortype', 'content', 'content_lines', 'module'])) {
continue; continue;
} }
@ -383,6 +384,9 @@ if (empty($reshook)) {
if ($value == 'position' && !is_numeric($_POST[$keycode])) { if ($value == 'position' && !is_numeric($_POST[$keycode])) {
$_POST[$keycode] = '1'; $_POST[$keycode] = '1';
} }
if ($value == 'defaultfortype' && !is_numeric($_POST[$keycode])) {
$_POST[$keycode] = '0';
}
//var_dump($keycode.' '.$value); //var_dump($keycode.' '.$value);
if ($i) { if ($i) {
@ -400,7 +404,7 @@ if (empty($reshook)) {
} }
} elseif ($keycode == 'content') { } elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfiles', 'private', 'position', 'entity'))) { } elseif (in_array($keycode, array('joinfiles', 'defaultfortype', 'private', 'position', 'entity'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} else { } else {
$sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'";
@ -430,7 +434,7 @@ if (empty($reshook)) {
// Modify entry // Modify entry
$sql = "UPDATE ".$tabname[$id]." SET "; $sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs // Modify value of fields
$i = 0; $i = 0;
foreach ($listfieldmodify as $field) { foreach ($listfieldmodify as $field) {
if ($field == 'entity') { if ($field == 'entity') {
@ -449,20 +453,20 @@ if (empty($reshook)) {
} }
// Rename some POST variables into a generic name // Rename some POST variables into a generic name
if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) { if ($field == 'fk_user' && !(GETPOST('fk_user', 'int') > 0)) {
$_POST['fk_user'] = ''; $_POST['fk_user'] = '';
} }
if ($field == 'topic') { if ($field == 'topic') {
$_POST['topic'] = $_POST['topic-'.$rowid]; $_POST['topic'] = GETPOST('topic-'.$rowid);
} }
if ($field == 'joinfiles') { if ($field == 'joinfiles') {
$_POST['joinfiles'] = $_POST['joinfiles-'.$rowid]; $_POST['joinfiles'] = GETPOST('joinfiles-'.$rowid);
} }
if ($field == 'content') { if ($field == 'content') {
$_POST['content'] = $_POST['content-'.$rowid]; $_POST['content'] = GETPOST('content-'.$rowid);
} }
if ($field == 'content_lines') { if ($field == 'content_lines') {
$_POST['content_lines'] = $_POST['content_lines-'.$rowid]; $_POST['content_lines'] = GETPOST('content_lines-'.$rowid);
} }
if ($i) { if ($i) {
@ -470,7 +474,7 @@ if (empty($reshook)) {
} }
$sql .= $field."="; $sql .= $field."=";
if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) { if (GETPOST($keycode) == '' || (!in_array($keycode, array('langcode', 'position', 'private', 'defaultfortype')) && !GETPOST($keycode))) {
$sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
} elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') { } elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') {
$sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
@ -482,12 +486,11 @@ if (empty($reshook)) {
} }
} elseif ($keycode == 'content') { } elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
} elseif (in_array($keycode, array('joinfiles', 'private', 'position'))) { } elseif (in_array($keycode, array('joinfiles', 'defaultfortype', 'private', 'position'))) {
$sql .= (int) GETPOST($keycode, 'int'); $sql .= (int) GETPOST($keycode, 'int');
} else { } else {
$sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'";
} }
$i++; $i++;
} }
@ -572,7 +575,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu
$morejs = array(); $morejs = array();
$morecss = array(); $morecss = array();
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active"; $sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, defaultfortype, content_lines, content, enabled, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql .= " WHERE entity IN (".getEntity('email_template').")"; $sql .= " WHERE entity IN (".getEntity('email_template').")";
if (!$user->admin) { if (!$user->admin) {
@ -623,7 +626,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if (!empty($search) && is_array($search)) { if (!empty($search) && is_array($search)) {
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
@ -693,6 +696,7 @@ if ($action == 'create') {
$obj->position = GETPOST('position'); $obj->position = GETPOST('position');
$obj->topic = GETPOST('topic'); $obj->topic = GETPOST('topic');
$obj->joinfiles = GETPOST('joinfiles'); $obj->joinfiles = GETPOST('joinfiles');
$obj->defaultfortype = GETPOST('defaultfortype') ? 1 : 0;
$obj->content = GETPOST('content', 'restricthtml'); $obj->content = GETPOST('content', 'restricthtml');
// Form to add a new line // Form to add a new line
@ -711,9 +715,9 @@ if ($action == 'create') {
// dans les dictionnaires de donnees // dans les dictionnaires de donnees
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate $valuetoshow = $langs->trans($valuetoshow); // try to translate
$align = "left"; $css = "left";
if ($fieldlist[$field] == 'module') { if ($fieldlist[$field] == 'module') {
$valuetoshow = ''; $valuetoshow = '&nbsp;';
} }
if ($fieldlist[$field] == 'fk_user') { if ($fieldlist[$field] == 'fk_user') {
$valuetoshow = $langs->trans("Owner"); $valuetoshow = $langs->trans("Owner");
@ -724,20 +728,20 @@ if ($action == 'create') {
if ($fieldlist[$field] == 'type') { if ($fieldlist[$field] == 'type') {
$valuetoshow = $langs->trans("Type"); $valuetoshow = $langs->trans("Type");
} }
if ($fieldlist[$field] == 'position') {
$css = 'center';
}
if ($fieldlist[$field] == 'code') { if ($fieldlist[$field] == 'code') {
$valuetoshow = $langs->trans("Code"); $valuetoshow = $langs->trans("Code");
} }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { if ($fieldlist[$field] == 'label') {
$valuetoshow = $langs->trans("Code"); $valuetoshow = $langs->trans("Code");
} }
if ($fieldlist[$field] == 'type_template') { if ($fieldlist[$field] == 'type_template') {
$valuetoshow = $langs->trans("TypeOfTemplate"); $align = "center"; $valuetoshow = $langs->trans("TypeOfTemplate"); $css = "center";
} }
if ($fieldlist[$field] == 'private') { if (in_array($fieldlist[$field], array('private', 'private', 'defaultfortype'))) {
$align = 'center'; $css = 'center';
}
if ($fieldlist[$field] == 'position') {
$align = 'center';
} }
if ($fieldlist[$field] == 'topic') { if ($fieldlist[$field] == 'topic') {
@ -753,7 +757,7 @@ if ($action == 'create') {
$valuetoshow = ''; $valuetoshow = '';
} }
if ($valuetoshow != '') { if ($valuetoshow != '') {
print '<th class="'.$align.'">'; print '<th class="'.$css.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) { } elseif (!empty($tabhelp[$id][$value])) {
@ -793,19 +797,19 @@ if ($action == 'create') {
fieldList($fieldlist, $obj, $tabname[$id], 'add'); fieldList($fieldlist, $obj, $tabname[$id], 'add');
} }
} }
// Action column
print '<td class="right">'; print '<td class="right">';
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
print '<tr class="impair nodrag nodrop nohover"><td colspan="9" class="nobottom">';
// Show fields for topic, join files and body // Show fields for topic, join files and body
$fieldsforcontent = array('topic', 'joinfiles', 'content'); $fieldsforcontent = array('topic', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
} }
foreach ($fieldsforcontent as $tmpfieldlist) { foreach ($fieldsforcontent as $tmpfieldlist) {
print '<tr class="impair nodrag nodrop nohover"><td colspan="8" class="nobottom">';
// Topic of email // Topic of email
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
@ -830,13 +834,14 @@ if ($action == 'create') {
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$okforextended = false; $okforextended = false;
} }
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%'); $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 400, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
} }
print '</td>'; print '<br>';
print '</tr>';
} }
print '</tr>';
print '</table>'; print '</table>';
if ($action != 'edit') { if ($action != 'edit') {
@ -870,7 +875,7 @@ print '<table class="noborder centpercent">';
$i = 0; $i = 0;
$param = '&id='.$id; $param = '&id='.((int) $id);
if ($search_label) { if ($search_label) {
$param .= '&search_label='.urlencode($search_label); $param .= '&search_label='.urlencode($search_label);
} }
@ -911,7 +916,13 @@ if ($num > $listlimit) {
// Title line with search boxes // Title line with search boxes
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center" width="64">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
if ($value == 'module') { if ($value == 'module') {
print '<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).'"></td>'; print '<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).'"></td>';
@ -935,23 +946,29 @@ foreach ($fieldlist as $field => $value) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
} }
/*if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }*/
// Status
print '<td></td>';
// Action column // Action column
print '<td class="liste_titre right" width="64">'; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
$searchpicto = $form->showFilterButtons(); print '<td class="liste_titre center" width="64">';
print $searchpicto; $searchpicto = $form->showFilterButtons();
print '</td>'; print $searchpicto;
print '</td>';
}
print '</tr>'; print '</tr>';
// Title of lines // Title of lines
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList('');
}
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
$showfield = 1; // By defaut $showfield = 1; // By defaut
$align = "left"; $css = "left";
$sortable = 1; $sortable = 1;
$valuetoshow = ''; $valuetoshow = '';
$forcenowrap = 1; $forcenowrap = 1;
@ -959,13 +976,13 @@ foreach ($fieldlist as $field => $value) {
$tmparray=getLabelOfField($fieldlist[$field]); $tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield']; $showfield=$tmp['showfield'];
$valuetoshow=$tmp['valuetoshow']; $valuetoshow=$tmp['valuetoshow'];
$align=$tmp['align']; $css=$tmp['align'];
$sortable=$tmp['sortable']; $sortable=$tmp['sortable'];
*/ */
$valuetoshow = ucfirst($fieldlist[$field]); // By defaut $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate $valuetoshow = $langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field] == 'module') { if ($fieldlist[$field] == 'module') {
$align = 'tdoverflowmax100'; $css = 'tdoverflowmax100';
} }
if ($fieldlist[$field] == 'fk_user') { if ($fieldlist[$field] == 'fk_user') {
$valuetoshow = $langs->trans("Owner"); $valuetoshow = $langs->trans("Owner");
@ -980,18 +997,20 @@ foreach ($fieldlist as $field => $value) {
$valuetoshow = $langs->trans("Code"); $valuetoshow = $langs->trans("Code");
} }
if ($fieldlist[$field] == 'type_template') { if ($fieldlist[$field] == 'type_template') {
$align = 'center'; $css = 'center';
$valuetoshow = $langs->trans("TypeOfTemplate"); $valuetoshow = $langs->trans("TypeOfTemplate");
} }
if ($fieldlist[$field] == 'private') { if ($fieldlist[$field] == 'private') {
$align = 'center'; $css = 'center';
} }
if ($fieldlist[$field] == 'position') { if ($fieldlist[$field] == 'position') {
$align = 'center'; $css = 'center';
} }
if ($fieldlist[$field] == 'joinfiles') { if ($fieldlist[$field] == 'joinfiles') {
$valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; $forcenowrap = 0; $valuetoshow = $langs->trans("FilesAttachedToEmail");
$css = 'center';
$forcenowrap = 0;
} }
if ($fieldlist[$field] == 'content') { if ($fieldlist[$field] == 'content') {
$valuetoshow = $langs->trans("Content"); $showfield = 0; $valuetoshow = $langs->trans("Content"); $showfield = 0;
@ -1011,14 +1030,17 @@ foreach ($fieldlist as $field => $value) {
} }
$sortfieldtouse = ($sortable ? $fieldlist[$field] : ''); $sortfieldtouse = ($sortable ? $fieldlist[$field] : '');
if ($sortfieldtouse == 'type_template') { if ($sortfieldtouse == 'type_template') {
$sortfieldtouse.= ',label'; $sortfieldtouse.= 'type_template,lang,position,label';
} }
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $align.' '); print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $css.' ');
} }
} }
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList(''); // Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print getTitleFieldOfList('');
}
print '</tr>'; print '</tr>';
if ($num) { if ($num) {
@ -1037,12 +1059,8 @@ if ($num) {
$reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors; $error = $hookmanager->error; $errors = $hookmanager->errors;
// Show main fields // Action column
if (empty($reshook)) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
fieldList($fieldlist, $obj, $tabname[$id], 'edit');
}
print '<td></td><td></td><td></td>';
print '<td class="center">'; print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
@ -1050,29 +1068,48 @@ if ($num) {
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>'; print '</td>';
}
// Show main fields
if (empty($reshook)) {
fieldList($fieldlist, $obj, $tabname[$id], 'edit');
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
}
print "</tr>\n";
print '<tr class="oddeven nohover'.(in_array($tmpfieldlist, array('topic', 'joinfiles')) ? ' nobottom' : '').'" id="tr-'.$tmpfieldlist.'-'.$rowid.'">';
print '<td colspan="10">';
$fieldsforcontent = array('topic', 'joinfiles', 'content'); $fieldsforcontent = array('topic', 'joinfiles', 'content');
if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); $fieldsforcontent[] = 'content_lines';
} }
foreach ($fieldsforcontent as $tmpfieldlist) { foreach ($fieldsforcontent as $tmpfieldlist) {
$showfield = 1; $showfield = 1;
$align = "left"; $css = "left";
$valuetoshow = $obj->$tmpfieldlist; $valuetoshow = $obj->$tmpfieldlist;
$class = 'tddict'; $class = 'tddict';
// Show value for field // Show value for field
if ($showfield) { if ($showfield) {
// Show line for topic, joinfiles and content // Show line for topic, joinfiles and content
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
print '<td colspan="9">';
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">'; print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
print '<br>'."\n";
} }
if ($tmpfieldlist == 'joinfiles') { if ($tmpfieldlist == 'joinfiles') {
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> '; print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1); print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
print '<br>'."\n";
} }
if ($tmpfieldlist == 'content') { if ($tmpfieldlist == 'content') {
@ -1085,6 +1122,7 @@ if ($num) {
print $doleditor->Create(1); print $doleditor->Create(1);
} }
if ($tmpfieldlist == 'content_lines') { if ($tmpfieldlist == 'content_lines') {
print '<br>'."\n";
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>'; print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$okforextended = true; $okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
@ -1093,11 +1131,11 @@ if ($num) {
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1); print $doleditor->Create(1);
} }
}
}
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
}
}
print "</tr>\n"; print "</tr>\n";
@ -1125,8 +1163,34 @@ if ($num) {
$nbqualified++; $nbqualified++;
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (!$user->admin && $obj->fk_user != $user->id) {
$iserasable = 0;
$canbedisabled = 0;
$canbemodified = 0;
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
// Action column - Modify link / Delete link
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall" width="64">';
if ($canbemodified) {
print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
}
if ($iserasable) {
print '<a class="marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
}
print '</td>';
}
$tmpaction = 'view'; $tmpaction = 'view';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
@ -1139,7 +1203,7 @@ if ($num) {
continue; continue;
} }
$showfield = 1; $showfield = 1;
$align = ""; $css = "";
$class = "tddict"; $class = "tddict";
$title = ''; $title = '';
$tmpvar = $fieldlist[$field]; $tmpvar = $fieldlist[$field];
@ -1158,7 +1222,7 @@ if ($num) {
} }
if ($value == 'type_template') { if ($value == 'type_template') {
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
$align = "center"; $css = "center";
} }
if ($value == 'lang' && $valuetoshow) { if ($value == 'lang' && $valuetoshow) {
$valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow); $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
@ -1171,7 +1235,7 @@ if ($num) {
} }
} }
if ($value == 'private') { if ($value == 'private') {
$align = "center"; $css = "center";
if ($valuetoshow) { if ($valuetoshow) {
$valuetoshow = yn($valuetoshow); $valuetoshow = yn($valuetoshow);
} else { } else {
@ -1179,18 +1243,18 @@ if ($num) {
} }
} }
if ($value == 'position') { if ($value == 'position') {
$align = "center"; $css = "center";
} }
if ($value == 'joinfiles') { if (in_array($value, array('joinfiles', 'defaultfortype'))) {
$align = "center"; $css = "center";
if ($valuetoshow) { if ($valuetoshow) {
$valuetoshow = yn(1); $valuetoshow = yn(1);
} else { } else {
$valuetoshow = ''; $valuetoshow = '';
} }
} }
if ($align) { if ($css) {
$class .= ' '.$align; $class .= ' '.$css;
} }
// Show value for field // Show value for field
@ -1207,19 +1271,6 @@ if ($num) {
} }
} }
// Can an entry be erased or disabled ?
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
if (!$user->admin && $obj->fk_user != $user->id) {
$iserasable = 0;
$canbedisabled = 0;
$canbemodified = 0;
}
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) {
$url .= '&'.$param;
}
// Status / Active // Status / Active
print '<td class="center nowrap">'; print '<td class="center nowrap">';
if ($canbedisabled) { if ($canbedisabled) {
@ -1229,7 +1280,8 @@ if ($num) {
} }
print "</td>"; print "</td>";
// Modify link / Delete link // Action column - Modify link / Delete link
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall" width="64">'; print '<td class="center nowraponall" width="64">';
if ($canbemodified) { if ($canbemodified) {
print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>'; print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
@ -1239,6 +1291,7 @@ if ($num) {
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
} }
print '</td>'; print '</td>';
}
print "</tr>\n"; print "</tr>\n";
} }
@ -1288,6 +1341,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
//print $value;
if ($value == 'module') { if ($value == 'module') {
print '<td></td>'; print '<td></td>';
} elseif ($value == 'fk_user') { } elseif ($value == 'fk_user') {
@ -1343,11 +1397,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
} }
print '</td>'; print '</td>';
} elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue; //print '<td></td>';
} elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue; print '<td></td>';
} elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { } elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue; //print '<td></td>';
} else { } else {
$size = ''; $class = ''; $classtd = ''; $size = ''; $class = ''; $classtd = '';
if ($value == 'code') { if ($value == 'code') {
@ -1357,19 +1411,19 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
$class = 'maxwidth200'; $class = 'maxwidth200';
} }
if ($value == 'private') { if ($value == 'private') {
$class = 'maxwidth50'; $classtd = 'center'; $class = 'maxwidth50';
$classtd = 'center';
} }
if ($value == 'position') { if ($value == 'position') {
$class = 'maxwidth50 center'; $classtd = 'center'; $class = 'maxwidth50 center';
} $classtd = 'center';
if ($value == 'libelle') {
$class = 'quatrevingtpercent';
} }
if ($value == 'topic') { if ($value == 'topic') {
$class = 'quatrevingtpercent'; $class = 'quatrevingtpercent';
} }
if ($value == 'sortorder' || $value == 'sens' || $value == 'category_type') { if ($value == 'defaultfortype') {
$size = 'size="2" '; $class = 'width25 center';
$classtd = 'center';
} }
print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>'; print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
@ -1377,10 +1431,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
if (empty($user->admin)) { if (empty($user->admin)) {
print $form->selectyesno($value, '1', 1); print $form->selectyesno($value, '1', 1);
} else { } else {
print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1); print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1);
} }
} else { } else {
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$value}) ? $obj->{$value}:'').'" name="'. $value .'">'; print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'">';
} }
print '</td>'; print '</td>';
} }

View File

@ -369,14 +369,32 @@ if ($mode == 'desc') {
if ($mode == 'feature') { if ($mode == 'feature') {
$text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> '; $text .= '<br><strong>'.$langs->trans("DependsOn").':</strong> ';
if (count($objMod->depends)) { if (is_array($objMod->depends) && count($objMod->depends)) {
$text .= join(',', $objMod->depends); $i = 0;
foreach ($objMod->depends as $modulestringorarray) {
if (is_array($modulestringorarray)) {
$text .= ($i ? ', ' : '').join(', ', $modulestringorarray);
} else {
$text .= ($i ? ', ' : '').$modulestringorarray;
}
$i++;
}
} else { } else {
$text .= '<span class="opacitymedium">'.$langs->trans("None").'</span>'; $text .= '<span class="opacitymedium">'.$langs->trans("None").'</span>';
} }
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> '; $text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
if (count($objMod->requiredby)) { if (is_array($objMod->requiredby) && count($objMod->requiredby)) {
$text .= join(',', $objMod->requiredby); $i = 0;
foreach ($objMod->requiredby as $modulestringorarray) {
if (is_array($modulestringorarray)) {
$text .= ($i ? ', ' : '').join(', ', $modulestringorarray);
} else {
$text .= ($i ? ', ' : '').$modulestringorarray;
}
$i++;
}
} else { } else {
$text .= '<span class="opacitymedium">'.$langs->trans("None").'</span>'; $text .= '<span class="opacitymedium">'.$langs->trans("None").'</span>';
} }
@ -478,7 +496,7 @@ if ($mode == 'feature') {
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) { if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) {
$yesno = 'Yes'; $yesno = 'Yes';
} else { } else {
$yesno = 'No'; $yesno = '<span class="opacitymedium">No</span>';
} }
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db); $interfaces = new Interfaces($db);

View File

@ -231,7 +231,7 @@ if ($action == 'install') {
if (!$error) { if (!$error) {
@dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory
$submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulenameval; $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulenameval;
if (!dol_is_dir($modulenamedir)) { if (!dol_is_dir($submodulenamedir)) {
$submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval; $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval;
} }
dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval); dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval);
@ -476,7 +476,7 @@ foreach ($modulesdir as $dir) {
dol_syslog("Module ".get_class($objMod)." not qualified"); dol_syslog("Module ".get_class($objMod)." not qualified");
} }
} else { } else {
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>"; print "admin/modules.php Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
} }
} catch (Exception $e) { } catch (Exception $e) {
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
@ -1165,7 +1165,7 @@ if ($mode == 'deploy') {
$fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>'; $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>';
$message = ''; $message = '';
if (!empty($allowonlineinstall)) { if ($allowonlineinstall) {
if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) { if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
$message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb = -1; $allowfromweb = -1;
@ -1184,7 +1184,7 @@ if ($mode == 'deploy') {
} else { } else {
if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) { if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
// Show clean message // Show clean message
if (!is_numeric('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) { if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
$message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))); $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
} else { } else {
$message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs')); $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));

View File

@ -188,7 +188,7 @@ print '</td></tr>';
//USTRD //USTRD
print '<tr class="oddeven"><td>'.$langs->trans("USTRD").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("USTRD").'</td>';
print '<td>'; print '<td>';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->PRELEVEMENT_USTRD.'" class="width100"></td>'; print '<input type="text" name="CREDITTRANSFER_USTRD" value="'.$conf->global->CREDITTRANSFER_USTRD.'" class="width100"></td>';
print '</td></tr>'; print '</td></tr>';
*/ */

View File

@ -317,6 +317,7 @@ if ($mode == 'config' && $user->admin) {
print '<th>'.$langs->trans("Parameters").'</th>'; print '<th>'.$langs->trans("Parameters").'</th>';
print '<th></th>'; print '<th></th>';
print "</tr>\n"; print "</tr>\n";
$ret = $printer->listprinters(); $ret = $printer->listprinters();
$nbofprinters = count($printer->listprinters); $nbofprinters = count($printer->listprinters);

View File

@ -181,16 +181,25 @@ $formproduct = new FormProduct($db);
$disabled = ''; $disabled = '';
if (isModEnabled('productbatch')) { if (isModEnabled('productbatch')) {
// If module lot/serial enabled, we force the inc/dec mode to STOCK_CALCULATE_ON_SHIPMENT_CLOSE and STOCK_CALCULATE_ON_RECEPTION_CLOSE
$langs->load("productbatch"); $langs->load("productbatch");
$disabled = ' disabled'; $disabled = ' disabled';
print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced"));
// STOCK_CALCULATE_ON_SHIPMENT_CLOSE
$descmode = $langs->trans('DeStockOnShipmentOnClosing');
if (!isModEnabled('reception')) {
// STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER
$incmode = $langs->trans('ReStockOnDispatchOrder');
} else {
// STOCK_CALCULATE_ON_RECEPTION_CLOSE
$incmode = $langs->trans('StockOnReceptionOnClosing');
}
print info_admin($langs->trans("WhenProductBatchModuleOnOptionAreForced", $descmode, $incmode));
} }
//if (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT))
//{
print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule")); print info_admin($langs->trans("IfYouUsePointOfSaleCheckModule"));
print '<br>'; print '<br>';
//}
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
@ -221,7 +230,7 @@ if (isModEnabled('facture')) {
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
@ -242,7 +251,7 @@ if (isModEnabled('commande')) {
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
@ -261,7 +270,7 @@ if (isModEnabled("expedition")) {
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
@ -278,7 +287,7 @@ if (isModEnabled("expedition")) {
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
@ -301,7 +310,7 @@ $found = 0;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnBill").'</td>'; print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td class="right">'; print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
if ($disabled) { if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
@ -313,7 +322,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
@ -323,7 +332,7 @@ $found++;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>'; print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
if ($disabled) { if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
@ -335,7 +344,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
@ -372,7 +381,7 @@ if (isModEnabled("reception")) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>'; print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { if (isModEnabled("supplier_order")) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else { } else {
@ -380,7 +389,7 @@ if (isModEnabled("reception")) {
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
} }
} else { } else {
print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")).'</span>';
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;

View File

@ -424,7 +424,7 @@ print '<br>';
print '<strong>'.$langs->trans("HTTPCacheStaticResources").' - '; print '<strong>'.$langs->trans("HTTPCacheStaticResources").' - ';
print $form->textwithpicto($langs->trans("CacheByServer"), $langs->trans("CacheByServerDesc")); print $form->textwithpicto($langs->trans("CacheByServer"), $langs->trans("CacheByServerDesc"));
print ':</strong><br>'; print ':</strong><br>';
// No cahce on PHP // No cache on PHP
//print '<div id="httpcachephpok">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'</div>'; //print '<div id="httpcachephpok">'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'</div>';
//print '<div id="httpcachephpko">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeNotCached",'php (.php)').'</div>'; //print '<div id="httpcachephpko">'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeNotCached",'php (.php)').'</div>';
// Cache on rest // Cache on rest

View File

@ -173,7 +173,7 @@ print '<br>';
print '<strong>'.$langs->trans("XDebug").'</strong>: '; print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug'); $test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug');
if ($test) { if ($test) {
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
} else { } else {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug"));
print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>'; print ' - '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
@ -480,30 +480,57 @@ print load_fiche_titre($langs->trans("Modules"), '', 'folder');
// Module log // Module log
print '<strong>'.$langs->trans("Syslog").'</strong>: '; print '<strong>'.$langs->trans("Syslog").'</strong>: ';
$test = !isModEnabled('syslog'); $test = isModEnabled('syslog');
if ($test) { if (!$test) {
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
} else { } else {
if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) { if (getDolGlobalInt('SYSLOG_LEVEL') > LOG_NOTICE) {
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog")); print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
} else { } else {
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL')); print img_picto('', 'tick').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL'));
} }
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
} }
print '<br>'; print '<br>';
print '<br>';
// Module debugbar // Module debugbar
print '<strong>'.$langs->trans("DebugBar").'</strong>: '; print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
$test = empty($conf->debugbar->enabled); $test = isModEnabled('debugbar');
if ($test) { if (!$test) {
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
} else { } else {
print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar")); print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>'; //print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
} }
print '<br>'; print '<br>';
print '<br>';
// Modules for Payments
$test = isModEnabled('stripe');
if ($test) {
print '<strong>'.$langs->trans("Stripe").'</strong>: ';
if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
} else {
print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
}
print '<br>';
} else {
$test = isModEnabled('paypal');
if ($test) {
print '<strong>'.$langs->trans("Paypal").'</strong>: ';
if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
} else {
print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
}
print '<br>';
}
}
// APIs // APIs
@ -601,6 +628,9 @@ print '<br>';
print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>"; print '<strong>MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES</strong> = '.getDolGlobalString('MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': 1)</span>')."<br>";
print '<br>'; print '<br>';
print '<strong>MAIN_DISALLOW_EXT_URL_INTO_DESCRIPTIONS</strong> = '.getDolGlobalString('MAIN_DISALLOW_EXT_URL_INTO_DESCRIPTIONS', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
print '<br>';
print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>"; print '<strong>MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL</strong> = '.getDolGlobalString('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL', '<span class="opacitymedium">'.$langs->trans("Undefined").' &nbsp; ('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or").' 0)</span>')."<br>";
print '<br>'; print '<br>';

View File

@ -259,7 +259,7 @@ if ($result) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($optioncss != '') { if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);

View File

@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if (isset($optioncss) && $optioncss != '') { if (isset($optioncss) && $optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);

View File

@ -122,7 +122,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array(
'family'=>'classify_supplier_proposal', 'family'=>'classify_supplier_proposal',
'position'=>60, 'position'=>60,
'enabled'=>(isModEnabled('supplier_proposal') && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 'enabled'=>(isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto'=>'supplier_proposal', 'picto'=>'supplier_proposal',
'warning'=>'' 'warning'=>''
), ),
@ -131,7 +131,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array(
'family'=>'classify_supplier_order', 'family'=>'classify_supplier_order',
'position'=>63, 'position'=>63,
'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))), 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && isModEnabled("reception") && isModEnabled('supplier_order')),
'picto'=>'supplier_order', 'picto'=>'supplier_order',
'warning'=>'' 'warning'=>''
), ),
@ -139,7 +139,7 @@ $workflowcodes = array(
'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array(
'family'=>'classify_supplier_order', 'family'=>'classify_supplier_order',
'position'=>64, 'position'=>64,
'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))), 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && isModEnabled("reception") && isModEnabled('supplier_order')),
'picto'=>'supplier_order', 'picto'=>'supplier_order',
'warning'=>'' 'warning'=>''
), ),
@ -147,7 +147,7 @@ $workflowcodes = array(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array( 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array(
'family'=>'classify_supplier_order', 'family'=>'classify_supplier_order',
'position'=>65, 'position'=>65,
'enabled'=>((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice")),
'picto'=>'supplier_order', 'picto'=>'supplier_order',
'warning'=>'' 'warning'=>''
), ),
@ -164,7 +164,7 @@ $workflowcodes = array(
'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array( 'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array(
'family'=>'classify_reception', 'family'=>'classify_reception',
'position'=>95, 'position'=>95,
'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 'enabled'=>(isModEnabled("reception") && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))),
'picto'=>'reception' 'picto'=>'reception'
), ),

View File

@ -197,7 +197,7 @@ if ($object->id > 0) {
$param .= '&contextpage=' . urlencode($contextpage); $param .= '&contextpage=' . urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit=' . urlencode($limit); $param .= '&limit='.((int) $limit);
} }

View File

@ -354,7 +354,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key]) && count($search[$key])) {

View File

@ -199,7 +199,7 @@ if ($object->id > 0) {
// $param .= '&contextpage=' . urlencode($contextpage); // $param .= '&contextpage=' . urlencode($contextpage);
// } // }
// if ($limit > 0 && $limit != $conf->liste_limit) { // if ($limit > 0 && $limit != $conf->liste_limit) {
// $param .= '&limit=' . urlencode($limit); // $param .= '&limit='.((int) $limit);
// } // }
// //
// //

View File

@ -360,7 +360,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key]) && count($search[$key])) {

View File

@ -325,7 +325,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_id != '') { if ($search_id != '') {
$param .= '&search_id='.urlencode($search_id); $param .= '&search_id='.urlencode($search_id);
@ -550,7 +550,10 @@ if (is_array($blocks)) {
print '</td>'; print '</td>';
// Link to source object // Link to source object
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>'; print '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link)).'"').'>';
print '<!-- object_link -->'; // $object_link can be a '<a href' link or a text
print $object_link;
print '</td>';
// Amount // Amount
print '<td class="right nowraponall">'.price($block->amounts).'</td>'; print '<td class="right nowraponall">'.price($block->amounts).'</td>';

View File

@ -241,7 +241,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }

View File

@ -170,6 +170,13 @@ if (empty($reshook)) {
$disable_stock_change = GETPOST('disable_stock_change', 'int'); $disable_stock_change = GETPOST('disable_stock_change', 'int');
$efficiency = price2num(GETPOST('efficiency', 'alpha')); $efficiency = price2num(GETPOST('efficiency', 'alpha'));
$fk_unit = GETPOST('fk_unit', 'alphanohtml'); $fk_unit = GETPOST('fk_unit', 'alphanohtml');
if (!empty($idprod) && $conf->workstation->enabled) {
$product = new Product($db);
$res = $product->fetch($idprod);
if ($res > 0 && $product->type == Product::TYPE_SERVICE) $fk_default_workstation = $product->fk_default_workstation;
}
if ($qty == '') { if ($qty == '') {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++; $error++;
@ -206,7 +213,7 @@ if (empty($reshook)) {
} }
} }
$result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options); $result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options, $fk_default_workstation);
if ($result <= 0) { if ($result <= 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -566,7 +573,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (!empty($object->table_element_line)) { if (!empty($object->table_element_line)) {
// Products // Products
$res = $object->fetchLinesbytypeproduct(0); $res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines
$object->calculateCosts(); $object->calculateCosts();
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product');
@ -615,7 +622,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Services // Services
$filtertype = 1; $filtertype = 1;
$res = $object->fetchLinesbytypeproduct(1); $res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines
$object->calculateCosts(); $object->calculateCosts();
print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service');

View File

@ -442,7 +442,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key])) { if (is_array($search[$key])) {

View File

@ -227,7 +227,6 @@ class BOM extends CommonObject
public $unit_cost = 0; public $unit_cost = 0;
/** /**
* Constructor * Constructor
* *
@ -570,9 +569,10 @@ class BOM extends CommonObject
* @param string $import_key Import Key * @param string $import_key Import Key
* @param string $fk_unit Unit * @param string $fk_unit Unit
* @param array $array_options extrafields array * @param array $array_options extrafields array
* @param int $fk_default_workstation Default workstation
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0) public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0, $fk_default_workstation = null)
{ {
global $mysoc, $conf, $langs, $user; global $mysoc, $conf, $langs, $user;
@ -627,33 +627,34 @@ class BOM extends CommonObject
} }
// Insert line // Insert line
$this->line = new BOMLine($this->db); $line = new BOMLine($this->db);
$this->line->context = $this->context; $line->context = $this->context;
$this->line->fk_bom = $this->id; $line->fk_bom = $this->id;
$this->line->fk_product = $fk_product; $line->fk_product = $fk_product;
$this->line->qty = $qty; $line->qty = $qty;
$this->line->qty_frozen = $qty_frozen; $line->qty_frozen = $qty_frozen;
$this->line->disable_stock_change = $disable_stock_change; $line->disable_stock_change = $disable_stock_change;
$this->line->efficiency = $efficiency; $line->efficiency = $efficiency;
$this->line->fk_bom_child = $fk_bom_child; $line->fk_bom_child = $fk_bom_child;
$this->line->import_key = $import_key; $line->import_key = $import_key;
$this->line->position = $rankToUse; $line->position = $rankToUse;
$this->line->fk_unit = $fk_unit; $line->fk_unit = $fk_unit;
$line->fk_default_workstation = $fk_default_workstation;
if (is_array($array_options) && count($array_options) > 0) { if (is_array($array_options) && count($array_options) > 0) {
$this->line->array_options = $array_options; $line->array_options = $array_options;
} }
$result = $this->line->create($user); $result = $line->create($user);
if ($result > 0) { if ($result > 0) {
$this->calculateCosts(); $this->calculateCosts();
$this->db->commit(); $this->db->commit();
return $result; return $result;
} else { } else {
$this->error = $this->line->error; $this->setErrorsFromObject($line);
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
@ -722,8 +723,7 @@ class BOM extends CommonObject
$staticLine = clone $line; $staticLine = clone $line;
$line->oldcopy = $staticLine; $line->oldcopy = $staticLine;
$this->line = $line; $line->context = $this->context;
$this->line->context = $this->context;
// Rank to use // Rank to use
$rankToUse = (int) $position; $rankToUse = (int) $position;
@ -741,32 +741,32 @@ class BOM extends CommonObject
} }
$this->line->fk_bom = $this->id; $line->fk_bom = $this->id;
$this->line->qty = $qty; $line->qty = $qty;
$this->line->qty_frozen = $qty_frozen; $line->qty_frozen = $qty_frozen;
$this->line->disable_stock_change = $disable_stock_change; $line->disable_stock_change = $disable_stock_change;
$this->line->efficiency = $efficiency; $line->efficiency = $efficiency;
$this->line->import_key = $import_key; $line->import_key = $import_key;
$this->line->position = $rankToUse; $line->position = $rankToUse;
if (!empty($fk_unit)) { if (!empty($fk_unit)) {
$this->line->fk_unit = $fk_unit; $line->fk_unit = $fk_unit;
} }
if (is_array($array_options) && count($array_options) > 0) { if (is_array($array_options) && count($array_options) > 0) {
// We replace values in this->line->array_options only for entries defined into $array_options // We replace values in this->line->array_options only for entries defined into $array_options
foreach ($array_options as $key => $value) { foreach ($array_options as $key => $value) {
$this->line->array_options[$key] = $array_options[$key]; $line->array_options[$key] = $array_options[$key];
} }
} }
$result = $this->line->update($user); $result = $line->update($user);
if ($result > 0) { if ($result > 0) {
$this->calculateCosts(); $this->calculateCosts();
$this->db->commit(); $this->db->commit();
return $result; return $result;
} else { } else {
$this->error = $this->line->error; $this->setErrorsFromObject($line);
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
@ -801,10 +801,9 @@ class BOM extends CommonObject
$staticLine = clone $line; $staticLine = clone $line;
$line->oldcopy = $staticLine; $line->oldcopy = $staticLine;
$this->line = $line; $line->context = $this->context;
$this->line->context = $this->context;
$result = $this->line->delete($user, $notrigger); $result = $line->delete($user, $notrigger);
//Positions (rank) reordering //Positions (rank) reordering
foreach ($this->lines as $bl) { foreach ($this->lines as $bl) {
@ -819,7 +818,7 @@ class BOM extends CommonObject
$this->db->commit(); $this->db->commit();
return $result; return $result;
} else { } else {
$this->error = $this->line->error; $this->setErrorsFromObject($line);
dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR);
$this->db->rollback(); $this->db->rollback();
return -2; return -2;
@ -1168,7 +1167,7 @@ class BOM extends CommonObject
$result .= $linkstart; $result .= $linkstart;
if ($withpicto) { if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), (($withpicto != 2) ? 'class="paddingright"' : ''), 0, 0, $notooltip ? 0 : 1);
} }
if ($withpicto != 2) { if ($withpicto != 2) {
$result .= $this->ref; $result .= $this->ref;
@ -1423,21 +1422,32 @@ class BOM extends CommonObject
} }
} }
} else { } else {
//Convert qty to hour // Convert qty of line into hours
$unit = measuringUnitString($line->fk_unit, '', '', 1); $unitforline = measuringUnitString($line->fk_unit, '', '', 1);
$qty = convertDurationtoHour($line->qty, $unit); $qtyhourforline = convertDurationtoHour($line->qty, $unitforline);
if (isModEnabled('workstation') && !empty($tmpproduct->fk_default_workstation)) { if (isModEnabled('workstation') && !empty($tmpproduct->fk_default_workstation)) {
$workstation = new Workstation($this->db); $workstation = new Workstation($this->db);
$res = $workstation->fetch($tmpproduct->fk_default_workstation); $res = $workstation->fetch($tmpproduct->fk_default_workstation);
if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); if ($res > 0) $line->total_cost = price2num($qtyhourforline * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT');
else { else {
$this->error = $workstation->error; $this->error = $workstation->error;
return -3; return -3;
} }
} else { } else {
$line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT'); $defaultdurationofservice = $tmpproduct->duration;
$reg = array();
$qtyhourservice = 0;
if (preg_match('/^(\d+)([a-z]+)$/', $defaultdurationofservice, $reg)) {
$qtyhourservice = convertDurationtoHour($reg[1], $reg[2]);
}
if ($qtyhourservice) {
$line->total_cost = price2num($qtyhourforline / $qtyhourservice * $tmpproduct->cost_price, 'MT');
} else {
$line->total_cost = price2num($line->qty * $tmpproduct->cost_price, 'MT');
}
} }
$this->total_cost += $line->total_cost; $this->total_cost += $line->total_cost;
@ -1670,6 +1680,7 @@ class BOMLine extends CommonObjectLine
'fk_unit' => array('type'=>'integer', 'label'=>'Unit', 'enabled'=>1, 'visible'=>1, 'position'=>120, 'notnull'=>-1,), 'fk_unit' => array('type'=>'integer', 'label'=>'Unit', 'enabled'=>1, 'visible'=>1, 'position'=>120, 'notnull'=>-1,),
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,), 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'fk_default_workstation' =>array('type'=>'integer', 'label'=>'DefaultWorkstation', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'position'=>1050)
); );
/** /**
@ -1732,6 +1743,12 @@ class BOMLine extends CommonObjectLine
*/ */
public $childBom = array(); public $childBom = array();
/**
* @var int Service Workstation
*/
public $fk_default_workstation;
/** /**
* Constructor * Constructor

View File

@ -196,10 +196,6 @@ if ($filtertype != 1) {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1, 'line');
}
?> ?>
<script> <script>

View File

@ -78,10 +78,14 @@ $objectline = new BOMLine($object->db);
$coldisplay = 0; $coldisplay = 0;
print "<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n"; print "<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n";
print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >'; print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
// Line nb
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
print '<td class="linecolnum center">'.($i + 1).'</td>'; print '<td class="linecolnum center">'.($i + 1).'</td>';
$coldisplay++; $coldisplay++;
} }
// Product
print '<td class="linecoldescription minwidth300imp">'; print '<td class="linecoldescription minwidth300imp">';
print '<div id="line_'.$line->id.'"></div>'; print '<div id="line_'.$line->id.'"></div>';
$coldisplay++; $coldisplay++;
@ -113,6 +117,7 @@ if (!empty($extrafields)) {
print '</td>'; print '</td>';
// Qty
print '<td class="linecolqty nowrap right">'; print '<td class="linecolqty nowrap right">';
$coldisplay++; $coldisplay++;
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
@ -142,7 +147,7 @@ if ($filtertype != 1) {
echo $line->efficiency; echo $line->efficiency;
print '</td>'; print '</td>';
} else { } else {
//Unité // Unit
print '<td class="linecolunit nowrap right">'; print '<td class="linecolunit nowrap right">';
$coldisplay++; $coldisplay++;
@ -158,14 +163,16 @@ if ($filtertype != 1) {
// Work station // Work station
if (isModEnabled('workstation')) { if (isModEnabled('workstation')) {
$workstation = new Workstation($object->db); $workstation = new Workstation($object->db);
$res = $workstation->fetch($tmpproduct->fk_default_workstation); $res = $workstation->fetch($line->fk_default_workstation);
print '<td class="linecolunit nowrap right">'; print '<td class="linecolworkstation nowrap right">';
$coldisplay++; $coldisplay++;
if ($res > 0) echo $workstation->getNomUrl(); if ($res > 0) echo $workstation->getNomUrl();
print '</td>'; print '</td>';
} }
} }
// Cost
$total_cost = 0; $total_cost = 0;
$tmpbom->calculateCosts(); $tmpbom->calculateCosts();
print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">'; print '<td id="costline_'.$line->id.'" class="linecolcost nowrap right">';
@ -312,10 +319,12 @@ if ($resql) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_line->total_cost, 'MT')).'</span></td>'; print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_line->total_cost, 'MT')).'</span></td>';
$this->total_cost += $line->total_cost; $this->total_cost += $line->total_cost;
} elseif ($sub_bom_product->cost_price > 0) { } elseif ($sub_bom_product->cost_price > 0) {
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>'; print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">';
print '<span class="amount">'.price(price2num($sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
$total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty; $total_cost+= $sub_bom_product->cost_price * $sub_bom_line->qty * $line->qty;
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined } elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'"><span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>'; print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">';
print '<span class="amount">'.price(price2num($sub_bom_product->pmp * $sub_bom_line->qty * $line->qty, 'MT')).'</span></td>';
$total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty; $total_cost.= $sub_bom_product->pmp * $sub_bom_line->qty * $line->qty;
} else { // Minimum purchase price if cost price and PMP aren't defined } else { // Minimum purchase price if cost price and PMP aren't defined
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price'; $sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';

View File

@ -247,7 +247,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }

View File

@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key]) && count($search[$key])) {

View File

@ -247,7 +247,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }

View File

@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
foreach ($search as $key => $val) { foreach ($search as $key => $val) {
if (is_array($search[$key]) && count($search[$key])) { if (is_array($search[$key]) && count($search[$key])) {

View File

@ -54,6 +54,12 @@ class Bookmark extends CommonObject
*/ */
public $db; public $db;
/**
* Last error code on a local method
* @var int Error number
*/
public $errno;
/** /**
* @var int ID * @var int ID
*/ */
@ -268,10 +274,10 @@ class Bookmark extends CommonObject
} }
/** /**
* Return label of contact status * Return the label of the status
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of contact status * @return string Label of status
*/ */
public function getLibStatut($mode) public function getLibStatut($mode)
{ {

View File

@ -221,7 +221,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($optioncss != '') { if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);

View File

@ -864,7 +864,12 @@ class Categorie extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX.(empty($this->MAP_OBJ_TABLE[$type]) ? $type : $this->MAP_OBJ_TABLE[$type])." as o"; $sql .= ", ".MAIN_DB_PREFIX.(empty($this->MAP_OBJ_TABLE[$type]) ? $type : $this->MAP_OBJ_TABLE[$type])." as o";
$sql .= " WHERE o.entity IN (".getEntity($obj->element).")"; $sql .= " WHERE o.entity IN (".getEntity($obj->element).")";
$sql .= " AND c.fk_categorie = ".((int) $this->id); $sql .= " AND c.fk_categorie = ".((int) $this->id);
// Compatibility with actioncomm table which has id instead of rowid
if ($this->MAP_OBJ_TABLE[$type] == "actioncomm" || $type == "actioncomm") {
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.id";
} else {
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid"; $sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid";
}
// Protection for external users // Protection for external users
if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) { if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) {
$sql .= " AND o.rowid = ".((int) $user->socid); $sql .= " AND o.rowid = ".((int) $user->socid);

View File

@ -590,7 +590,8 @@ if ($type == Categorie::TYPE_CUSTOMER) {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'; print '<tr class="liste_titre"><td>';
print $langs->trans("AddCustomerIntoCategory").' &nbsp;'; print $langs->trans("AddCustomerIntoCategory").' &nbsp;';
print $form->select_company('', 'elemid', 's.client IN (1,3)'); $filter = '(s.client:IN:1,3)';
print $form->select_company('', 'elemid', $filter);
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>'; print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
@ -670,7 +671,8 @@ if ($type == Categorie::TYPE_SUPPLIER) {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'; print '<tr class="liste_titre"><td>';
print $langs->trans("AddSupplierIntoCategory").' &nbsp;'; print $langs->trans("AddSupplierIntoCategory").' &nbsp;';
print $form->select_company('', 'elemid', 's.fournisseur = 1'); $filter ='(s.fournisseur:=:1)';
print $form->select_company('', 'elemid', $filter);
print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>'; print '<input type="submit" class="button buttongen" value="'.$langs->trans("ClassifyInCategory").'"></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';

View File

@ -1666,7 +1666,7 @@ class ActionComm extends CommonObject
} }
$canread = 0; $canread = 0;
if (!empty($user->rights->agenda->myactions->read) && $this->authorid == $user->id) { if ($user->hasRight('agenda', 'myactions', 'read') && ($this->authorid == $user->id || $this->userownerid == $user->id)) {
$canread = 1; // Can read my event $canread = 1; // Can read my event
} }
if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) { if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) {

View File

@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($actioncode != '') { if ($actioncode != '') {
if (is_array($actioncode)) { if (is_array($actioncode)) {
@ -934,6 +934,7 @@ while ($i < $imaxinloop) {
$actionstatic->datep = $db->jdate($obj->dp); $actionstatic->datep = $db->jdate($obj->dp);
$actionstatic->percentage = $obj->percent; $actionstatic->percentage = $obj->percent;
$actionstatic->authorid = $obj->fk_user_author; $actionstatic->authorid = $obj->fk_user_author;
$actionstatic->userownerid = $obj->fk_user_action;
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid // Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
// but only if we need it // but only if we need it

View File

@ -97,7 +97,7 @@ if (isModEnabled('supplier_proposal')) {
if (isModEnabled('commande')) { if (isModEnabled('commande')) {
$orderstatic = new Commande($db); $orderstatic = new Commande($db);
} }
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { if (isModEnabled("supplier_order")) {
$supplierorderstatic = new CommandeFournisseur($db); $supplierorderstatic = new CommandeFournisseur($db);
} }
@ -517,7 +517,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
* Draft interventions * Draft interventions
*/ */
if (isModEnabled('ficheinter')) { if (isModEnabled('ficheinter')) {
$sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut"; $sql = "SELECT f.rowid, f.ref, s.nom as name, f.fk_statut, f.duree as duration";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@ -572,12 +572,16 @@ if (isModEnabled('ficheinter')) {
$companystatic->canvas = $obj->canvas; $companystatic->canvas = $obj->canvas;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="nowraponall tdoverflowmax100">'; print '<td class="tdoverflowmax100">';
print $fichinterstatic->getNomUrl(1); print $fichinterstatic->getNomUrl(1);
print "</td>"; print "</td>";
print '<td class="nowrap tdoverflowmax100">'; print '<td class="tdoverflowmax100">';
print $companystatic->getNomUrl(1, 'customer'); print $companystatic->getNomUrl(1, 'customer');
print '</td></tr>'; print '</td>';
print '<td class="nowraponall tdoverflowmax100 right">';
print convertSecondToTime($obj->duration);
print '</td>';
print '</tr>';
$i++; $i++;
} }
} }
@ -669,7 +673,7 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>'; $s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>';
} }
/* /*
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $obj->fournisseur) if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $obj->fournisseur)
{ {
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>'; $s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>';
}*/ }*/
@ -700,7 +704,7 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
/* /*
* Last suppliers * Last suppliers
*/ */
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->hasRight('societe', 'lire')) { if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->hasRight('societe', 'lire')) {
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur";
@ -765,7 +769,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
{ {
$s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>'; $s .= '<a class="customer-back" title="'.$langs->trans("Customer").'" href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Customer"), 0, 1).'</a>';
}*/ }*/
if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $obj->fournisseur) { if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $obj->fournisseur) {
$s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>'; $s .= '<a class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$companystatic->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).'</a>';
} }
print $s; print $s;

View File

@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("mails"); $langs->loadLangs(array("mails", "admin"));
$id = (GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int')); $id = (GETPOST('mailid', 'int') ? GETPOST('mailid', 'int') : GETPOST('id', 'int'));
@ -48,20 +48,18 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$urlfrom = GETPOST('urlfrom'); $urlfrom = GETPOST('urlfrom');
$backtopageforcancel = GETPOST('backtopageforcancel');
// Initialize technical objects // Initialize technical objects
$object = new Mailing($db); $object = new Mailing($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$hookmanager->initHooks(array('mailingcard', 'globalcard'));
if ($id > 0) {
$result = $object->fetch($id);
}
// Fetch optionals attributes and labels // Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Load object
$hookmanager->initHooks(array('mailingcard', 'globalcard')); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray = FormMail::getAvailableSubstitKey('emailing'); $object->substitutionarray = FormMail::getAvailableSubstitKey('emailing');
@ -79,17 +77,26 @@ $object->substitutionarrayfortest = $substitutionarray;
// List of sending methods // List of sending methods
$listofmethods = array(); $listofmethods = array();
//$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
$listofmethods['mail'] = 'PHP mail function'; $listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library'; $listofmethods['smtps'] = 'SMTP/SMTPS socket library';
if (version_compare(phpversion(), '7.0', '>=')) {
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
}
// Security check // Security check
if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { if (empty($user->rights->mailing->lire) || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
accessforbidden(); accessforbidden();
} }
if (empty($action) && empty($object->id)) {
accessforbidden('Object not found');
}
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
/* /*
* Actions * Actions
*/ */
@ -567,7 +574,7 @@ if (empty($reshook)) {
} }
// Action update description of emailing // Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto') { if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') { if ($action == 'settitle') {
@ -582,10 +589,13 @@ if (empty($reshook)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) { } elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') {
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
} }
if (!$mesg) { if (!$mesg) {
if ($object->update($user) >= 0) { $result = $object->update($user);
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
} }
@ -747,20 +757,21 @@ llxHeader(
array() array()
); );
if ($action == 'create') { if ($action == 'create') {
// EMailing in creation mode // EMailing in creation mode
print '<form name="new_mailing" action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n"; print '<form name="new_mailing" action="'.$_SERVER['PHP_SELF'].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; $htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) { foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>'; $htmltext .= $key.' = '.$langs->trans($val).'<br>';
} }
$htmltext .= '</i>'; $htmltext .= '</span></i>';
$availablelink = $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'availvar'); $availablelink = $form->textwithpicto('<span class="opacitymedium">'.$langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'availvar');
//print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>'; //print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
@ -931,18 +942,9 @@ if ($action == 'create') {
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
print '<table class="border centpercent tableforfield">';
// Description
/*
print '<tr><td class="titlefield">';
print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
print '</td><td>';
print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string');
print '</td></tr>';
*/
// From // From
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
@ -975,10 +977,18 @@ if ($action == 'create') {
} }
print '</td></tr>'; print '</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails // Number of distinct emails
print '<tr><td>'; print '<tr><td class="titlefield">';
print $langs->trans("TotalNbOfDistinctRecipients"); print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">'; print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0); $nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) { if (is_numeric($nbemail)) {
$text = ''; $text = '';
@ -1000,12 +1010,34 @@ if ($action == 'create') {
} }
print '</td></tr>'; print '</td></tr>';
// Other attributes print '<tr><td>';
print $langs->trans("MAIN_MAIL_SENDMODE");
print '</td><td>';
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) {
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')];
} else {
$text = $listofmethods['mail'];
}
print $text;
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').')</span>';
}
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
}
print '</td></tr>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>';
print '</div>';
print "</div>"; print '<div class="clearboth"></div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
@ -1022,11 +1054,8 @@ if ($action == 'create') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEMailing', $object->ref), 'confirm_clone', $formquestion, 'yes', 2, 240);
} }
/* // Actions Buttons
* Actions Buttons if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test', 'editevenunsubscribe'))) {
*/
if (GETPOST('cancel', 'alpha') || $confirm == 'no' || $action == '' || in_array($action, array('settodraft', 'valid', 'delete', 'sendall', 'clone', 'test'))) {
print "\n\n<div class=\"tabsAction\">\n"; print "\n\n<div class=\"tabsAction\">\n";
if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) { if (($object->statut == 1) && ($user->hasRight('mailing', 'valider') || $object->user_validation == $user->id)) {
@ -1198,17 +1227,32 @@ if ($action == 'create') {
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/mailing/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Ref customer
$morehtmlref .= $form->editfieldkey("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("", 'title', $object->title, $object, $user->hasRight('mailing', 'creer'), 'string', '', null, null, '', 1);
$morehtmlref .= '</div>';
$morehtmlright = ''; $morehtmlright = '';
if ($object->statut == 2) { $nbtry = $nbok = 0;
$morehtmlright .= ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; if ($object->statut == 2 || $object->statut == 3) {
$nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko');
$morehtmlright .= ' ('.$nbtry.'/'.$object->nbemail;
if ($nbko) {
$morehtmlright .= ' - '.$nbko.' '.$langs->trans("Error");
}
$morehtmlright .= ') &nbsp; ';
} }
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
/* /*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
@ -1217,17 +1261,24 @@ if ($action == 'create') {
print '</td></tr>'; print '</td></tr>';
*/ */
// Topic
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
// From // From
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
// To // To
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>'; print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>'.dol_print_email($object->email_errorsto, 0, 0, 0, 0, 1).'</td></tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails // Number of distinct emails
print '<tr><td>'; print '<tr><td>';
print $langs->trans("TotalNbOfDistinctRecipients"); print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">'; print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0); $nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) { if (is_numeric($nbemail)) {
$text = ''; $text = '';
@ -1249,6 +1300,27 @@ if ($action == 'create') {
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td>';
print $langs->trans("MAIN_MAIL_SENDMODE");
print '</td><td>';
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) {
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')];
} else {
$text = $listofmethods['mail'];
}
print $text;
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').')</span>';
}
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
}
print '</td></tr>';
// Other attributes // Other attributes
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@ -1259,30 +1331,32 @@ if ($action == 'create') {
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print "<br><br>\n";
print "<br>\n";
print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n"; print '<form name="edit_mailing" action="card.php" method="post" enctype="multipart/form-data">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>'; $htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br><br><span class="small">';
foreach ($object->substitutionarray as $key => $val) { foreach ($object->substitutionarray as $key => $val) {
$htmltext .= $key.' = '.$langs->trans($val).'<br>'; $htmltext .= $key.' = '.$langs->trans($val).'<br>';
} }
$htmltext .= '</i>'; $htmltext .= '</span></i>';
// Print mail content // Print mail content
print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic'); print load_fiche_titre($langs->trans("EMail"), '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("AvailableVariables").'</span>', $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'generic');
print dol_get_fiche_head(null, '', '', -1); print dol_get_fiche_head(null, '', '', -1);
print '<table class="bordernooddeven" width="100%">'; print '<table class="bordernooddeven centpercent">';
// Subject // Subject
print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>'; print '<tr><td class="fieldrequired titlefield">'.$langs->trans("MailTopic").'</td><td colspan="3"><input class="flat quatrevingtpercent" type="text" name="sujet" value="'.$object->sujet.'"></td></tr>';
@ -1336,6 +1410,7 @@ if ($action == 'create') {
print '</table>'; print '</table>';
// Message // Message
print '<div style="padding-top: 10px">'; print '<div style="padding-top: 10px">';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2021 Laurent Destailleur <eldy@uers.sourceforge.net> * Copyright (C) 2005-2023 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
@ -32,9 +32,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("mails"); $langs->loadLangs(array("mails", "admin"));
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
@ -72,14 +73,24 @@ $result = $object->fetch($id);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('ciblescard', 'globalcard')); $hookmanager->initHooks(array('ciblescard', 'globalcard'));
$sqlmessage = '';
// List of sending methods
$listofmethods = array();
//$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
if (version_compare(phpversion(), '7.0', '>=')) {
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
}
// Security check // Security check
if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) {
accessforbidden(); accessforbidden();
} }
//$result = restrictedArea($user, 'mailing'); //$result = restrictedArea($user, 'mailing');
$sqlmessage = '';
/* /*
* Actions * Actions
@ -99,14 +110,22 @@ if ($action == 'add' && $user->hasRight('mailing', 'creer')) { // Add recipient
$classname = "mailing_".$module; $classname = "mailing_".$module;
if (file_exists($file)) { if (file_exists($file)) {
require_once $file; include_once $file;
// Add targets into database // Add targets into database
dol_syslog("Call add_to_target() on class ".$classname." evenunsubscribe=".$object->evenunsubscribe);
if (class_exists($classname)) {
$obj = new $classname($db); $obj = new $classname($db);
dol_syslog("Call add_to_target on class ".$classname); $obj->evenunsubscribe = $object->evenunsubscribe;
$result = $obj->add_to_target($id); $result = $obj->add_to_target($id);
$sqlmessage = $obj->sql; $sqlmessage = $obj->sql;
} else {
$result = -1;
break;
}
} }
} }
if ($result > 0) { if ($result > 0) {
@ -198,6 +217,38 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_dest_status = ''; $search_dest_status = '';
} }
// Action update description of emailing
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto' || $action == 'setevenunsubscribe') {
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
if ($action == 'settitle') {
$object->title = trim(GETPOST('title', 'alpha'));
} elseif ($action == 'setemail_from') {
$object->email_from = trim(GETPOST('email_from', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_replyto') {
$object->email_replyto = trim(GETPOST('email_replyto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'setemail_errorsto') {
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alphawithlgt')); // Must allow 'name <email>'
} elseif ($action == 'settitle' && empty($object->title)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
} elseif ($action == 'setfrom' && empty($object->email_from)) {
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
} elseif ($action == 'setevenunsubscribe') {
$object->evenunsubscribe = (GETPOST('evenunsubscribe') ? 1 : 0);
}
if (!$mesg) {
$result = $object->update($user);
if ($result >= 0) {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
$mesg = $object->error;
}
setEventMessages($mesg, null, 'errors');
$action = "";
}
/* /*
@ -224,7 +275,7 @@ if ($object->fetch($id) >= 0) {
$morehtmlright = ''; $morehtmlright = '';
$nbtry = $nbok = 0; $nbtry = $nbok = 0;
if ($object->statut == 2 || $object->statut == 3) { if ($object->statut == $object::STATUS_SENTPARTIALY || $object->statut == $object::STATUS_SENTCOMPLETELY) {
$nbtry = $object->countNbOfTargets('alreadysent'); $nbtry = $object->countNbOfTargets('alreadysent');
$nbko = $object->countNbOfTargets('alreadysentko'); $nbko = $object->countNbOfTargets('alreadysentko');
$nbok = ($nbtry - $nbko); $nbok = ($nbtry - $nbko);
@ -239,13 +290,12 @@ if ($object->fetch($id) >= 0) {
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
//print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td>';
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">';
$emailarray = CMailFile::getArrayAddress($object->email_from); $emailarray = CMailFile::getArrayAddress($object->email_from);
foreach ($emailarray as $email => $name) { foreach ($emailarray as $email => $name) {
if ($name && $name != $email) { if ($name && $name != $email) {
@ -264,7 +314,7 @@ if ($object->fetch($id) >= 0) {
print '</td></tr>'; print '</td></tr>';
// Errors to // Errors to
print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td colspan="3">'; print '<tr><td>'.$langs->trans("MailErrorsTo").'</td><td>';
$emailarray = CMailFile::getArrayAddress($object->email_errorsto); $emailarray = CMailFile::getArrayAddress($object->email_errorsto);
foreach ($emailarray as $email => $name) { foreach ($emailarray as $email => $name) {
if ($name != $email) { if ($name != $email) {
@ -280,10 +330,19 @@ if ($object->fetch($id) >= 0) {
} }
print '</td></tr>'; print '</td></tr>';
// Nb of distinct emails print '</table>';
print '<tr><td>'; print '</div>';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Number of distinct emails
print '<tr><td class="titlefield">';
print $langs->trans("TotalNbOfDistinctRecipients"); print $langs->trans("TotalNbOfDistinctRecipients");
print '</td><td colspan="3">'; print '</td><td>';
$nbemail = ($object->nbemail ? $object->nbemail : 0); $nbemail = ($object->nbemail ? $object->nbemail : 0);
if (is_numeric($nbemail)) { if (is_numeric($nbemail)) {
$text = ''; $text = '';
@ -295,7 +354,7 @@ if ($object->fetch($id) >= 0) {
} }
} }
if (empty($nbemail)) { if (empty($nbemail)) {
$nbemail .= ' '.img_warning('');//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>'; $nbemail .= ' '.img_warning($langs->trans('ToAddRecipientsChooseHere'));//.' <span class="warning">'.$langs->trans("NoTargetYet").'</span>';
} }
if ($text) { if ($text) {
print $form->textwithpicto($nbemail, $text, 1, 'warning'); print $form->textwithpicto($nbemail, $text, 1, 'warning');
@ -305,29 +364,58 @@ if ($object->fetch($id) >= 0) {
} }
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '<tr><td>';
print $langs->trans("MAIN_MAIL_SENDMODE");
print '</td><td>';
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE')) {
$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')];
} else {
$text = $listofmethods['mail'];
}
print $text;
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'default') {
if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') != 'mail') {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING').')</span>';
}
} elseif (getDolGlobalString('MAIN_MAIL_SENDMODE') != 'mail' && getDolGlobalString('MAIN_MAIL_SMTP_SERVER')) {
print ' <span class="opacitymedium">('.getDolGlobalString('MAIN_MAIL_SMTP_SERVER').')</span>';
}
print '</td></tr>';
print "</div>"; // Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<br>'; print '<br>';
$allowaddtarget = ($object->statut == 0); $allowaddtarget = ($object->statut == $object::STATUS_DRAFT);
// Show email selectors // Show email selectors
if ($allowaddtarget && $user->rights->mailing->creer) { if ($allowaddtarget && $user->rights->mailing->creer) {
print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic'); print load_fiche_titre($langs->trans("ToAddRecipientsChooseHere"), ($user->admin ?info_admin($langs->trans("YouCanAddYourOwnPredefindedListHere"), 1) : ''), 'generic');
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<div class="tagtable centpercent liste_titre_bydiv borderbottom" id="tablelines">'; print '<div class="tagtable centpercentimp liste_titre_bydiv borderbottom" id="tablelines">';
print '<div class="tagtr liste_titre">'; print '<div class="tagtr liste_titre">';
print '<div class="tagtd"></div>'; print '<div class="tagtd"></div>';
print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>'; print '<div class="tagtd">'.$langs->trans("RecipientSelectionModules").'</div>';
print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>'; print '<div class="tagtd center maxwidth150">'.$langs->trans("NbOfUniqueEMails").'</div>';
print '<div class="tagtd left">'.$langs->trans("Filter").'</div>'; print '<div class="tagtd left"><div class="inline-block">'.$langs->trans("Filters").'</div>';
print ' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <div class=" inline-block">'.$langs->trans("EvenUnsubscribe").' ';
print ajax_object_onoff($object, 'evenunsubscribe', 'evenunsubscribe', 'EvenUnsubscribe:switch_on:warning', 'EvenUnsubscribe', array(), 'small valignmiddle', '', 1);
print '</div>';
print '</div>';
print '<div class="tagtd">&nbsp;</div>'; print '<div class="tagtd">&nbsp;</div>';
print '</div>'; // End tr print '</div>'; // End tr
@ -386,8 +474,9 @@ if ($object->fetch($id) >= 0) {
$var = !$var; $var = !$var;
if ($allowaddtarget) { if ($allowaddtarget) {
print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&token='.newToken().'&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">'; print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="page_y" value="'.newToken().'">'; print '<input type="hidden" name="page_y" value="'.newToken().'">';
} else { } else {
print '<div '.$bctag[$var].'>'; print '<div '.$bctag[$var].'>';
@ -404,6 +493,8 @@ if ($object->fetch($id) >= 0) {
print '</div>'; print '</div>';
try { try {
$obj->evenunsubscribe = $object->evenunsubscribe; // Set flag to include/exclude email that has opt-out.
$nbofrecipient = $obj->getNbOfRecipients(''); $nbofrecipient = $obj->getNbOfRecipients('');
} catch (Exception $e) { } catch (Exception $e) {
dol_syslog($e->getMessage(), LOG_ERR); dol_syslog($e->getMessage(), LOG_ERR);
@ -470,8 +561,10 @@ if ($object->fetch($id) >= 0) {
// List of selected targets // List of selected targets
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,"; $sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text"; $sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text,";
$sql .= " COUNT(mu.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."mailing_unsubscribe as mu ON mu.email = mc.email";
$sql .= " WHERE mc.fk_mailing=".((int) $object->id); $sql .= " WHERE mc.fk_mailing=".((int) $object->id);
$asearchcriteriahasbeenset = 0; $asearchcriteriahasbeenset = 0;
if ($search_lastname) { if ($search_lastname) {
@ -494,8 +587,10 @@ if ($object->fetch($id) >= 0) {
$sql .= " AND mc.statut = ".((int) $search_dest_status); $sql .= " AND mc.statut = ".((int) $search_dest_status);
$asearchcriteriahasbeenset++; $asearchcriteriahasbeenset++;
} }
$sql .= ' GROUP BY mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms, mc.source_url, mc.source_id, mc.source_type, mc.error_text';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
// Count total nb of records // Count total nb of records
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
@ -529,7 +624,7 @@ if ($object->fetch($id) >= 0) {
$param = "&id=".$object->id; $param = "&id=".$object->id;
//if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($search_lastname) { if ($search_lastname) {
$param .= "&search_lastname=".urlencode($search_lastname); $param .= "&search_lastname=".urlencode($search_lastname);
@ -578,6 +673,14 @@ if ($object->fetch($id) >= 0) {
// Ligne des champs de filtres // Ligne des champs de filtres
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto;
print '</td>';
}
// EMail // EMail
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">'; print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
@ -614,10 +717,13 @@ if ($object->fetch($id) >= 0) {
print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1); print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1);
print '</td>'; print '</td>';
// Action column // Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre maxwidthsearch">'; print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
}
print '</tr>'; print '</tr>';
if ($page) { if ($page) {
@ -625,6 +731,10 @@ if ($object->fetch($id) >= 0) {
} }
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "mc.email", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Lastname", $_SERVER["PHP_SELF"], "mc.lastname", $param, "", "", $sortfield, $sortorder);
print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder);
@ -635,7 +745,10 @@ if ($object->fetch($id) >= 0) {
// Date sending // Date sending
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder); print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder);
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
}
print '</tr>'; print '</tr>';
$i = 0; $i = 0;
@ -656,10 +769,37 @@ if ($object->fetch($id) >= 0) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td class="tdoverflowmax150">'.img_picto('$obj->email', 'email', 'class="paddingright"').dol_escape_htmltag($obj->email).'</td>';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
}
}
/*if ($obj->statut == -1) // Sent with error
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/
print '</td>';
}
print '<td class="tdoverflowmax150">';
print img_picto($obj->email, 'email', 'class="paddingright"');
if ($obj->nb > 0) {
print img_warning($langs->trans("EmailOptedOut"), 'warning', 'pictofixedwidth');
}
print dol_escape_htmltag($obj->email);
print '</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>'; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>'; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->firstname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
print '<td><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>'; print '<td><span class="small">'.dol_escape_htmltag($obj->other).'</small></td>';
print '<td class="center tdoverflowmax150">'; print '<td class="center tdoverflowmax150">';
if (empty($obj->source_id) || empty($obj->source_type)) { if (empty($obj->source_id) || empty($obj->source_type)) {
print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
@ -691,7 +831,7 @@ if ($object->fetch($id) >= 0) {
print '</td>'; print '</td>';
// Status of recipient sending email (Warning != status of emailing) // Status of recipient sending email (Warning != status of emailing)
if ($obj->statut == 0) { if ($obj->statut == $object::STATUS_DRAFT) {
// Date sent // Date sent
print '<td align="center"></td>'; print '<td align="center"></td>';
@ -707,12 +847,13 @@ if ($object->fetch($id) >= 0) {
print '</td>'; print '</td>';
} }
// Search Icon // Action column
print '<td class="right">'; if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<!-- ID mailing_cibles = '.$obj->rowid.' -->'; print '<!-- ID mailing_cibles = '.$obj->rowid.' -->';
if ($obj->statut == 0) { // Not sent yet if ($obj->statut == $object::STATUS_DRAFT) { // Not sent yet
if (!empty($user->rights->mailing->creer) && $allowaddtarget) { if (!empty($user->rights->mailing->creer)) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>'; print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&rowid='.((int) $obj->rowid).$param.'">'.img_delete($langs->trans("RemoveRecipient")).'</a>';
} }
} }
/*if ($obj->statut == -1) // Sent with error /*if ($obj->statut == -1) // Sent with error
@ -720,6 +861,7 @@ if ($object->fetch($id) >= 0) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=retry&rowid='.$obj->rowid.$param.'">'.$langs->trans("Retry").'</a>';
}*/ }*/
print '</td>'; print '</td>';
}
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@ -61,6 +61,11 @@ class Mailing extends CommonObject
*/ */
public $body; public $body;
/**
* @var int 1=Email will be sent even to email that has opt-out
*/
public $evenunsubscribe;
/** /**
* @var int number of email * @var int number of email
*/ */
@ -190,7 +195,6 @@ class Mailing extends CommonObject
*/ */
public $substitutionarrayfortest; public $substitutionarrayfortest;
const STATUS_DRAFT = 0; const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1; const STATUS_VALIDATED = 1;
const STATUS_SENTPARTIALY = 2; const STATUS_SENTPARTIALY = 2;
@ -204,6 +208,8 @@ class Mailing extends CommonObject
*/ */
public function __construct($db) public function __construct($db)
{ {
global $langs;
$this->db = $db; $this->db = $db;
// List of language codes for status // List of language codes for status
@ -317,6 +323,7 @@ class Mailing extends CommonObject
$sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'"; $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'";
$sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'"; $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'";
$sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'"; $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'";
$sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe);
$sql .= " WHERE rowid = ".(int) $this->id; $sql .= " WHERE rowid = ".(int) $this->id;
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
@ -351,13 +358,14 @@ class Mailing extends CommonObject
* Get object from database * Get object from database
* *
* @param int $rowid Id of emailing * @param int $rowid Id of emailing
* @param string $ref Title to search from title
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function fetch($rowid) public function fetch($rowid, $ref = '')
{ {
global $conf; global $conf;
$sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage"; $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe";
$sql .= ", m.email_from, m.email_replyto, m.email_errorsto"; $sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
$sql .= ", m.statut, m.nbemail"; $sql .= ", m.statut, m.nbemail";
$sql .= ", m.fk_user_creat, m.fk_user_valid"; $sql .= ", m.fk_user_creat, m.fk_user_valid";
@ -366,7 +374,12 @@ class Mailing extends CommonObject
$sql .= ", m.date_envoi"; $sql .= ", m.date_envoi";
$sql .= ", m.extraparams"; $sql .= ", m.extraparams";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
$sql .= " WHERE m.rowid = ".(int) $rowid; $sql .= " WHERE entity IN (".getEntity('mailing').")";
if ($ref) {
$sql .= " AND m.titre = '".$this->db->escape($ref)."'";
} else {
$sql .= " AND m.rowid = ".(int) $rowid;
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -389,6 +402,7 @@ class Mailing extends CommonObject
$this->bgcolor = $obj->bgcolor; $this->bgcolor = $obj->bgcolor;
$this->bgimage = $obj->bgimage; $this->bgimage = $obj->bgimage;
$this->evenunsubscribe = $obj->evenunsubscribe;
$this->email_from = $obj->email_from; $this->email_from = $obj->email_from;
$this->email_replyto = $obj->email_replyto; $this->email_replyto = $obj->email_replyto;
@ -454,6 +468,7 @@ class Mailing extends CommonObject
$object->body = ''; $object->body = '';
$object->bgcolor = ''; $object->bgcolor = '';
$object->bgimage = ''; $object->bgimage = '';
$object->evenunsubscribe = 0;
//$object->email_from = ''; // We do not reset from email because it is a mandatory value //$object->email_from = ''; // We do not reset from email because it is a mandatory value
$object->email_replyto = ''; $object->email_replyto = '';

View File

@ -271,7 +271,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($optioncss != '') { if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss); $param .= '&optioncss='.urlencode($optioncss);

View File

@ -230,7 +230,7 @@ if ($object->id > 0) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
// Try to know count of actioncomm from cache // Try to know count of actioncomm from cache

View File

@ -1810,7 +1810,8 @@ if ($action == 'create') {
//$warehouse_id = $soc->warehouse_id; //$warehouse_id = $soc->warehouse_id;
} else { } else {
print '<td class="valuefieldcreate">'; print '<td class="valuefieldcreate">';
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))';
print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
print '<script> print '<script>
@ -2133,10 +2134,11 @@ if ($action == 'create') {
// Clone confirmation // Clone confirmation
if ($action == 'clone') { if ($action == 'clone') {
// Create an array for form // Create an array for form
$filter = '(s.client:IN:1,2,3)';
$formquestion = array( $formquestion = array(
// 'text' => $langs->trans("ConfirmClone"), // 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', $filter, '', 0, 0, null, 0, 'maxwidth300')),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0), array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => 0),
array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0), array('type' => 'checkbox', 'name' => 'update_desc', 'label' => $langs->trans('PuttingDescUpToDate'), 'value' => 0),
); );
@ -2904,7 +2906,7 @@ if ($action == 'create') {
} }
} }
// Create event // Create event
/*if ($conf->agenda->enabled && !empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. /*if (isModEnabled('agenda') && !empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{ {
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>'; print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}*/ }*/
@ -2935,7 +2937,7 @@ if ($action == 'create') {
// Create a purchase order // Create a purchase order
if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) {
if ($object->statut == Propal::STATUS_SIGNED && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order"))) { if ($object->statut == Propal::STATUS_SIGNED && isModEnabled("supplier_order")) {
if ($usercancreatepurchaseorder) { if ($usercancreatepurchaseorder) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("AddPurchaseOrder").'</a>';
} }

View File

@ -122,6 +122,7 @@ class Propal extends CommonObject
/** /**
* Status of the quote * Status of the quote
* @var int * @var int
* @deprecated Try to use $status now
* @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED * @see Propal::STATUS_DRAFT, Propal::STATUS_VALIDATED, Propal::STATUS_SIGNED, Propal::STATUS_NOTSIGNED, Propal::STATUS_BILLED
*/ */
public $statut; public $statut;
@ -326,7 +327,7 @@ class Propal extends CommonObject
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, '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), '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), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150), 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'isModEnabled("banque")', 'visible'=>-1, 'position'=>150),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161), 'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>161),
@ -1606,6 +1607,7 @@ class Propal extends CommonObject
$this->ref = $obj->ref; $this->ref = $obj->ref;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->ref_customer = $obj->ref_client;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->remise = $obj->remise; // TODO deprecated $this->remise = $obj->remise; // TODO deprecated

View File

@ -875,7 +875,7 @@ if ($resql) {
$param .= '&contextpage='.urlencode($contextpage); $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.urlencode($limit); $param .= '&limit='.((int) $limit);
} }
if ($sall) { if ($sall) {
$param .= '&sall='.urlencode($sall); $param .= '&sall='.urlencode($sall);

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