Merge https://github.com/Dolibarr/dolibarr into dolibarr_partnership
This commit is contained in:
commit
6f85cab6c4
18
.tx/config
18
.tx/config
@ -128,6 +128,12 @@ source_file = htdocs/langs/en_US/errors.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.eventorganization]
|
||||
file_filter = htdocs/langs/<lang>/eventorganization.lang
|
||||
source_file = htdocs/langs/en_US/eventorganization.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.exports]
|
||||
file_filter = htdocs/langs/<lang>/exports.lang
|
||||
source_file = htdocs/langs/en_US/exports.lang
|
||||
@ -182,6 +188,12 @@ source_file = htdocs/langs/en_US/interventions.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.knowledgemanagement]
|
||||
file_filter = htdocs/langs/<lang>/knowledgemanagement.lang
|
||||
source_file = htdocs/langs/en_US/knowledgemanagement.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.languages-not-res]
|
||||
file_filter = htdocs/langs/<lang>/languages.lang
|
||||
source_file = htdocs/langs/en_US/languages.lang
|
||||
@ -278,6 +290,12 @@ source_file = htdocs/langs/en_US/other.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.partnership]
|
||||
file_filter = htdocs/langs/<lang>/partnership.lang
|
||||
source_file = htdocs/langs/en_US/partnership.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.paybox]
|
||||
file_filter = htdocs/langs/<lang>/paybox.lang
|
||||
source_file = htdocs/langs/en_US/paybox.lang
|
||||
|
||||
24
COPYRIGHT
24
COPYRIGHT
@ -12,41 +12,41 @@ Dolibarr uses some external libraries released under different licenses. This is
|
||||
Component Version License GPL Compatible Usage
|
||||
-------------------------------------------------------------------------------------
|
||||
PHP libraries:
|
||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
ADOdb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP2 0.2.0 LGPL-2.1+ Yes Lib to make geoip convert
|
||||
GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert
|
||||
Mobiledetect 2.8.34 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)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files
|
||||
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service
|
||||
PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
|
||||
PSR/Logs 1.0 Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? Library for cache (used by PHPSpreadSheet)
|
||||
PSR/Logs 1.0 Library for logs (used by DebugBar)
|
||||
PSR/simple-cache ? MIT License Yes Library for cache (used by PHPSpreadSheet)
|
||||
Restler 3.1.1 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 3.2.2 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
Stripe 7.67.0 MIT licence Yes Library for Stripe module
|
||||
Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
|
||||
Stripe 7.67.0 MIT Licence Yes Library for Stripe module
|
||||
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 2.9.4 MIT License Yes JS library for graph
|
||||
ChartJS 2.9.4 MIT License Yes JS library for graph
|
||||
jQuery 3.5.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images)
|
||||
jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place)
|
||||
jQuery jNotify 1.1.00 Apache Software License 2.0 Yes JS library plugin jNotify (to use ajax popups)
|
||||
jQuery jNotify 1.1.00 Apache License 2.0 Yes JS library plugin jNotify (to use ajax popups)
|
||||
jQuery jPicker 1.1.6 GPL and MIT License Yes JS library for color picker with not defined list of colors
|
||||
jQuery jqueryFileTree 1.0.1 GPL and MIT License Yes JS library for filetree
|
||||
jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
|
||||
@ -54,13 +54,13 @@ jQuery TableDnD 0.6 GPL and MIT License Yes
|
||||
jQuery Timepicker 1.1.0 GPL and MIT License Yes JS library Timepicker addon for Datepicker
|
||||
jsGanttImproved 2.7.3 BSD License Yes JS library (to build Gantt reports)
|
||||
JsTimezoneDetect 1.0.6 MIT License Yes JS library to detect user timezone
|
||||
SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer
|
||||
SwaggerUI 2.2.10 GPL-2+ Yes JS library to offer the REST API explorer
|
||||
|
||||
Image libraries:
|
||||
Octicons 8.1 MIT Yes
|
||||
|
||||
Font libraries:
|
||||
Fontawesome 5.13 Font Awesome Free licence Yes
|
||||
Fontawesome 5.13 Font Awesome Free Licence Yes
|
||||
|
||||
|
||||
For licenses compatibility informations:
|
||||
|
||||
@ -7,13 +7,18 @@ English Dolibarr ChangeLog
|
||||
|
||||
For users:
|
||||
----------
|
||||
NEW: Feature to make inventories
|
||||
NEW: Several security issues after a second private bug bounty campaign.
|
||||
|
||||
NEW: Add a security center page with all information and advices related to the security of your instance
|
||||
NEW: Add a performance center page with all information and advices related to the performance of your instance
|
||||
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
|
||||
|
||||
|
||||
For developers:
|
||||
---------------
|
||||
* start new module EventOrganization
|
||||
* start new module Event Organization Management
|
||||
* start new module Partnership Management
|
||||
* start new module Knowledge Management
|
||||
|
||||
|
||||
|
||||
|
||||
@ -51,16 +51,17 @@ export DEBEMAIL="eldy@destailleur.fr"
|
||||
|
||||
export QUILT_PATCHES=debian/patches
|
||||
|
||||
# To use Alioth.debian.org
|
||||
* Create an account login
|
||||
* Update your ~/.ssh/config file to add:
|
||||
Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org
|
||||
|
||||
# Note: alioth.debian.org is outdated --> https://alioth-archive.debian.org/ --> https://salsa.debian.org/public
|
||||
* Create an account login
|
||||
* Update your ~/.ssh/config file to add:
|
||||
Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org
|
||||
User eldy-guest
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
* Check login on page https://alioth.debian.org/users/login
|
||||
Ex: https://alioth.debian.org/users/eldy-guest
|
||||
* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH
|
||||
* Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
|
||||
* Check login on page https://alioth.debian.org/users/login
|
||||
Ex: https://alioth.debian.org/users/eldy-guest
|
||||
* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH
|
||||
* Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
|
||||
|
||||
|
||||
|
||||
@ -82,7 +83,7 @@ Ex: https://alioth.debian.org/users/eldy-guest
|
||||
# dpkg -c package.deb List content of package
|
||||
# dpkg -I package.deb Give informations on package
|
||||
# dpkg -i package.deb Install a package
|
||||
# dpkg-reconfigure -plow package Reconfigure package
|
||||
# dpkg-reconfigure -plow package Reconfigure package
|
||||
# dpkg -L packagename List content of installed package
|
||||
# dpkg -r packagename Remove config files and interactive saved answers
|
||||
# dpkg -s packagename Give status of installed package
|
||||
@ -90,7 +91,7 @@ Ex: https://alioth.debian.org/users/eldy-guest
|
||||
#
|
||||
# dpkg-buildpackage -us -uc Build a source and binary package
|
||||
#
|
||||
# gdebi package.deb Install a package + dependencies
|
||||
# gdebi package.deb Install a package + dependencies
|
||||
|
||||
|
||||
|
||||
@ -98,21 +99,21 @@ Ex: https://alioth.debian.org/users/eldy-guest
|
||||
|
||||
- Post an ITP with reportbugs :
|
||||
> reportbug -B debian --email username@domain.tld wnpp
|
||||
See page http://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents.
|
||||
See page https://www.debian.org/devel/wnpp/#l1 for example of ITP requests contents.
|
||||
|
||||
- Wait until you received bug number.
|
||||
For first ITP submission of Dolibarr, bug id was 634783.
|
||||
|
||||
- Check bug is into database by searching with id on
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783
|
||||
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634783
|
||||
|
||||
- Add a line for upstream into file changelog with bug number
|
||||
|
||||
- Call for a mentor on ML debian-mentors to upload packages
|
||||
|
||||
- Once package is uploaded, following URL are available:
|
||||
http://packages.qa.debian.org/package.html
|
||||
http://bugs.debian.org/package
|
||||
https://packages.qa.debian.org/package.html
|
||||
https://bugs.debian.org/package
|
||||
|
||||
|
||||
##### Modify severity of a bug ticket
|
||||
|
||||
9
build/phpstan/README
Normal file
9
build/phpstan/README
Normal file
@ -0,0 +1,9 @@
|
||||
PHPStan
|
||||
|
||||
https://phpstan.org
|
||||
|
||||
PHPStan requires PHP >= 7.1
|
||||
|
||||
Install: composer require --dev phpstan/phpstan
|
||||
|
||||
Config File: phpstan.neon
|
||||
@ -3,48 +3,54 @@ README (English)
|
||||
RPM Package tools
|
||||
##################################################
|
||||
|
||||
This directory contains files used by makepack-dolibarr.pl
|
||||
script to build a package, ready to be distributed,
|
||||
with format RPM (for Redhat, OpenSuse, Mandriva, ...).
|
||||
This directory contains files used by makepack-dolibarr.pl script to build a package,
|
||||
ready to be distributed with format RPM (https://rpm.org)
|
||||
for Linux Distributions like Redhat, Fedora, CentOS, OpenSuse, OpenMandriva, Mageia ...
|
||||
|
||||
|
||||
# This is standard command to work on RPM packaging:
|
||||
#
|
||||
|
||||
# To install all packagers tools:
|
||||
# Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it
|
||||
# OpenSuse: yast --install update-desktop-files
|
||||
#
|
||||
- Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it
|
||||
- OpenSuse: yast --install update-desktop-files
|
||||
|
||||
# rpmlint file.rpm Test a package
|
||||
# mock -r fedora-15-i386 --rebuild ../SRPMS/hello-2.7-1.fc15.src.rpm
|
||||
#
|
||||
|
||||
|
||||
# On Fedora
|
||||
# rpm -i --test dolibarr-...rpm To list dependencies of RPM
|
||||
# yum -v install dolibarr-...rpm To install package and dependencies
|
||||
# yum -v erase dolibarr To remove package
|
||||
# chcon -R -h -t httpd_sys_script_rw_t /file To add temporary context rw for httpd on /file
|
||||
# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" To add persistent context rw for httpd on /dir (this add file_contexts.local)
|
||||
# restorecon -R -v /file Restore values into files (cancel chcon, validate semanage)
|
||||
#
|
||||
# =========
|
||||
# rpm -i --test dolibarr-...rpm to list dependencies of RPM
|
||||
# yum -v install dolibarr-...rpm to install package and dependencies
|
||||
# yum -v erase dolibarr to remove package
|
||||
# chcon -R -h -t httpd_sys_script_rw_t /file to add temporary context rw for httpd on /file
|
||||
# restorecon -R -v /file to restore values into files (cancel chcon, validate semanage)
|
||||
# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" to add persistent context rw for httpd on /dir (this add file_contexts.local)
|
||||
|
||||
|
||||
# On OpenSuse
|
||||
# zypper install dolibarr-...rpm To install package and dependencies
|
||||
# zypper remove dolibarr To remove package
|
||||
# zypper search xxx To search a package
|
||||
#
|
||||
# ===========
|
||||
# zypper install dolibarr-...rpm to install package and dependencies
|
||||
# zypper remove dolibarr to remove package
|
||||
# zypper search xxx to search a package
|
||||
|
||||
|
||||
# On Mageia (after su - root)
|
||||
# urpmi dolibarr-...rpm To install package and dependencies
|
||||
# urpme dolibarr To remove package
|
||||
# ===========================
|
||||
# urpmi dolibarr-...rpm to install package and dependencies
|
||||
# urpme dolibarr to remove package
|
||||
#
|
||||
# More on rpm on page http://www.trustonme.net/didactels/273.html
|
||||
|
||||
|
||||
To submit a package to Fedora:
|
||||
- Create account on bugzilla.redhat.com
|
||||
- Create account on fedoraproject.org
|
||||
- Create SRPMS package.
|
||||
- Upload package onf http://fedorapeople.org
|
||||
- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review
|
||||
- Create account on https://bugzilla.redhat.com
|
||||
- Create account on https://developer.fedoraproject.org/
|
||||
- Create SRPMS package
|
||||
- Upload package on https://fedorapeople.org
|
||||
- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review
|
||||
|
||||
This is example of content of review field (used for Bug 723326 - https://bugzilla.redhat.com/show_bug.cgi?id=723326):
|
||||
SRPMS URL: http://www.dolibarr.org/files/fedora/dolibarr-x.y.z-xxx.src.rpm
|
||||
SRPMS URL: https://www.dolibarr.org/files/fedora/dolibarr-x.y.z-xxx.src.rpm
|
||||
Description: Dolibarr ERP & CRM is an easy to use open source/free software
|
||||
for small and medium companies, foundations or freelances. It includes
|
||||
different features for Enterprise Resource Planning (ERP) and Customer
|
||||
@ -56,4 +62,4 @@ is my first package to maintain myself. So i'm seeking a sponsor.
|
||||
- Install fedora packager tools: yum install fedora-packager
|
||||
- Setup fedora packagers tools: fedora-packager-setup
|
||||
- Send your package: koji build --scratch f16 path_to_source_RPM
|
||||
- Check if package is available: http://koji.fedoraproject.org/koji/
|
||||
- Check if package is available: https://koji.fedoraproject.org/koji/
|
||||
|
||||
@ -185,6 +185,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/emailcollector
|
||||
%_datadir/dolibarr/htdocs/eventorganization
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
@ -198,6 +199,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/knowledgemanagement
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
@ -206,6 +208,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/mrp
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/partnership
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
@ -227,6 +230,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/workstation
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
|
||||
@ -67,7 +67,8 @@ Requires: httpd, php >= 5.3.0, php-cli, php-gd, php-ldap, php-imap, php-mbstring
|
||||
Requires: mysql-server, mysql
|
||||
Requires: php-mysqli >= 4.1.0
|
||||
%endif
|
||||
%endif
|
||||
%endif%_datadir/dolibarr/htdocs/eventorganization
|
||||
|
||||
%endif
|
||||
|
||||
# Set yes to build test package, no for release (this disable need of /usr/bin/php not found by OpenSuse)
|
||||
@ -265,6 +266,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/emailcollector
|
||||
%_datadir/dolibarr/htdocs/eventorganization
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
@ -278,6 +280,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/knowledgemanagement
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
@ -286,6 +289,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/mrp
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/partnership
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
@ -307,6 +311,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/workstation
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
|
||||
@ -182,6 +182,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/emailcollector
|
||||
%_datadir/dolibarr/htdocs/eventorganization
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
@ -195,6 +196,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/knowledgemanagement
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
@ -203,6 +205,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/mrp
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/partnership
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
@ -224,6 +227,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/workstation
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
|
||||
@ -193,6 +193,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/emailcollector
|
||||
%_datadir/dolibarr/htdocs/eventorganization
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
@ -206,6 +207,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/includes
|
||||
%_datadir/dolibarr/htdocs/install
|
||||
%_datadir/dolibarr/htdocs/intracommreport
|
||||
%_datadir/dolibarr/htdocs/knowledgemanagement
|
||||
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
|
||||
%_datadir/dolibarr/htdocs/loan
|
||||
%_datadir/dolibarr/htdocs/mailmanspip
|
||||
@ -214,6 +216,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/mrp
|
||||
%_datadir/dolibarr/htdocs/multicurrency
|
||||
%_datadir/dolibarr/htdocs/opensurvey
|
||||
%_datadir/dolibarr/htdocs/partnership
|
||||
%_datadir/dolibarr/htdocs/paybox
|
||||
%_datadir/dolibarr/htdocs/paypal
|
||||
%_datadir/dolibarr/htdocs/printing
|
||||
@ -235,6 +238,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/workstation
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
|
||||
@ -225,9 +225,6 @@ JQUERYFILETREE:
|
||||
|
||||
RESTLER:
|
||||
--------
|
||||
Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
|
||||
|
||||
+With swagger 2:
|
||||
|
||||
* Add line into Util.php to complete function
|
||||
|
||||
@ -249,6 +246,13 @@ Change content of file htdocs/includes/restler/framework/Luracast/Restler/explor
|
||||
if (!is_string($haystack)) return false;
|
||||
|
||||
|
||||
+With swagger 2 provided into /explorer:
|
||||
----------------------------------------
|
||||
|
||||
Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
|
||||
|
||||
|
||||
|
||||
PARSEDOWN
|
||||
---------
|
||||
|
||||
|
||||
1
dev/initdemo/.gitignore
vendored
Normal file
1
dev/initdemo/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/initdemopostsql.sql
|
||||
@ -232,6 +232,10 @@ else
|
||||
fi
|
||||
|
||||
|
||||
if [ -s "$mydir/initdemopostsql.sql" ]; then
|
||||
mysql -P$port $base < "$mydir/initdemopostsql.sql"
|
||||
fi
|
||||
|
||||
|
||||
if [ "x$res" = "x0" ]
|
||||
then
|
||||
|
||||
@ -39,7 +39,7 @@ if [ "x$confirm" != "xconfirm" ]
|
||||
then
|
||||
echo "----- $0 -----"
|
||||
echo "Usage: initdemopassword.sh confirm [base port login pass password_hash_algo]"
|
||||
echo "password_hash_algo can be md5 of password_hash"
|
||||
echo "password_hash_algo can be md5 or password_hash"
|
||||
exit
|
||||
fi
|
||||
|
||||
@ -149,15 +149,19 @@ then
|
||||
fi
|
||||
#echo "mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile"
|
||||
#mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
|
||||
echo "echo \"UPDATE llx_user SET pass_crypted = MD5('$demopass') WHERE login = '$demologin';\" | mysql -P$port $base"
|
||||
|
||||
if [ "x$demopasshash" != "xpassword_hash" ]
|
||||
if [ "x${demopasshash}" != "xpassword_hash" ]
|
||||
then
|
||||
newpass=`echo '<?php echo md5("$demopass"); ?>' | php`
|
||||
echo '<?php echo MD5("$demopass"); ?>' > /tmp/tmp.php
|
||||
newpass=`php -f /tmp/tmp.php`
|
||||
rm /tmp/tmp.php
|
||||
else
|
||||
newpass=`echo '<?php echo password_hash("$demopass", PASSWORD_DEFAULT); ?>' | php`
|
||||
echo '<?php echo password_hash("'$demopass'", PASSWORD_DEFAULT); ?>' > /tmp/tmp.php
|
||||
newpass=`php -f /tmp/tmp.php`
|
||||
rm /tmp/tmp.php
|
||||
fi
|
||||
|
||||
echo "echo \"UPDATE llx_user SET pass_crypted = '$newpass' WHERE login = '$demologin';\" | mysql -P$port $base"
|
||||
echo "UPDATE llx_user SET pass_crypted = '$newpass' WHERE login = '$demologin';" | mysql -P$port $base
|
||||
export res=$?
|
||||
|
||||
@ -166,6 +170,10 @@ if [ $res -ne 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -s "$mydir/initdemopostsql.sql" ]; then
|
||||
mysql -P$port $base < "$mydir/initdemopostsql.sql"
|
||||
fi
|
||||
|
||||
|
||||
if [ "x$res" = "x0" ]
|
||||
then
|
||||
|
||||
6
dev/resources/iso-normes/EORI.txt
Normal file
6
dev/resources/iso-normes/EORI.txt
Normal file
@ -0,0 +1,6 @@
|
||||
EORI
|
||||
|
||||
https://en.wikipedia.org/wiki/EORI_number
|
||||
|
||||
in Dolibarr avaiable since v13
|
||||
- it is set to field 'profid5'
|
||||
@ -16,7 +16,7 @@
|
||||
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/nltechno*</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
|
||||
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
|
||||
<exclude-pattern type="relative">source</exclude-pattern>
|
||||
<exclude-pattern type="relative">.git</exclude-pattern>
|
||||
|
||||
<!-- List of all tests -->
|
||||
|
||||
@ -17,3 +17,7 @@ for Linux OS
|
||||
to install or to update transifex client:
|
||||
sudo pip install --upgrade transifex-client
|
||||
|
||||
|
||||
Comparison of Terms between ERPs
|
||||
---------------------------------
|
||||
https://wiki.dolibarr.org/index.php?title=Comparison_of_Terms_between_ERPs
|
||||
|
||||
@ -54,8 +54,8 @@ $code = GETPOST('code', 'alpha');
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
@ -442,7 +442,7 @@ if ($id) {
|
||||
} else {
|
||||
$sql .= " WHERE ";
|
||||
}
|
||||
$sql .= " c.rowid = ".$search_country_id;
|
||||
$sql .= " c.rowid = ".((int) $search_country_id);
|
||||
}
|
||||
|
||||
// If sort order is "country", we use country_code instead
|
||||
|
||||
@ -48,8 +48,8 @@ if (empty($user->rights->accounting->chartofaccount)) {
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
|
||||
@ -169,7 +169,7 @@ foreach ($list_account_main as $key) {
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accountsmain');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -186,7 +186,7 @@ foreach ($list_account as $key) {
|
||||
print '<td width="50%">'.$label.'</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 'accounts');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -302,7 +302,9 @@ if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX").'</td>';
|
||||
print '<td>'.$langs->trans("ACCOUNTANCY_COMBO_FOR_AUX");
|
||||
print ' - <span class="opacitymedium">'.$langs->trans("NotRecommended").'</span>';
|
||||
print '</td>';
|
||||
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';
|
||||
|
||||
@ -51,8 +51,8 @@ if (empty($user->rights->accounting->chartofaccount)) {
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
|
||||
@ -183,7 +183,7 @@ if ($action == 'update') {
|
||||
}
|
||||
if ($result <= 0) {
|
||||
// setEventMessages(null, $accounting->errors, 'errors');
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br/> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
} else {
|
||||
$db->begin();
|
||||
@ -270,8 +270,8 @@ if (empty($pcgvercode)) {
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,";
|
||||
$sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,";
|
||||
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
|
||||
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
@ -280,14 +280,14 @@ $sql .= " p.tms, p.fk_product_type as product_type,";
|
||||
$sql .= " aa.rowid as aaid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = pa." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ppe." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
|
||||
} else {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'";
|
||||
}
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "pa.") . $accountancy_field_name, $search_current_account);
|
||||
$sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, $search_current_account);
|
||||
}
|
||||
if ($search_current_account_valid == 'withoutvalidaccount') {
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
@ -466,7 +466,7 @@ if ($result) {
|
||||
} else {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "pa.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -30,6 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.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/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
@ -38,9 +39,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("accountancy", "compta"));
|
||||
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Load variable for pagination
|
||||
@ -60,7 +58,7 @@ $pagenext = $page + 1;
|
||||
$show_subgroup = GETPOST('show_subgroup', 'alpha');
|
||||
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
$search_ledger_code = GETPOST('search_ledger_code', 'array');
|
||||
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
|
||||
if ($search_accountancy_code_start == - 1) {
|
||||
$search_accountancy_code_start = '';
|
||||
@ -134,6 +132,12 @@ if (!empty($search_accountancy_code_end)) {
|
||||
$filter['t.numero_compte<='] = $search_accountancy_code_end;
|
||||
$param .= '&search_accountancy_code_end='.$search_accountancy_code_end;
|
||||
}
|
||||
if (!empty($search_ledger_code)) {
|
||||
$filter['t.code_journal'] = $search_ledger_code;
|
||||
foreach ($search_ledger_code as $code) {
|
||||
$param .= '&search_ledger_code[]='.urlencode($code);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
@ -157,6 +161,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_date_end = '';
|
||||
$search_accountancy_code_start = '';
|
||||
$search_accountancy_code_end = '';
|
||||
$search_ledger_code = array();
|
||||
$filter = array();
|
||||
}
|
||||
|
||||
@ -249,6 +254,12 @@ if ($action != 'export_csv') {
|
||||
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: ';
|
||||
$moreforfilter .= '<input type="checkbox" name="show_subgroup" id="show_subgroup" value="show_subgroup"'.($show_subgroup == 'show_subgroup' ? ' checked' : '').'>';
|
||||
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
|
||||
$moreforfilter .= $langs->trans("Journal");
|
||||
$moreforfilter .= $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1);
|
||||
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
@ -261,17 +272,16 @@ if ($action != 'export_csv') {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
|
||||
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
|
||||
|
||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre" colspan="'.$colspan.'">';
|
||||
print $langs->trans('From');
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts');
|
||||
print ' ';
|
||||
print $langs->trans('to');
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts');
|
||||
print '</td>';
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
@ -415,7 +425,8 @@ if ($action != 'export_csv') {
|
||||
} else {
|
||||
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>';
|
||||
}
|
||||
print '<td class="center">'.$link;
|
||||
print '<td class="center">';
|
||||
print $link;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -563,7 +563,7 @@ if ($action == 'create') {
|
||||
{
|
||||
$sqlmid = 'SELECT rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac";
|
||||
$sqlmid .= " WHERE fac.rowid=" . $object->fk_doc;
|
||||
$sqlmid .= " WHERE fac.rowid=" . ((int) $object->fk_doc);
|
||||
dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid) {
|
||||
|
||||
@ -72,7 +72,7 @@ if ($search_accountancy_code_end == - 1) {
|
||||
$search_accountancy_code_end = '';
|
||||
}
|
||||
|
||||
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code");
|
||||
$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code", 'alpha');
|
||||
$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
|
||||
if ($search_accountancy_aux_code_start == - 1) {
|
||||
$search_accountancy_aux_code_start = '';
|
||||
@ -457,12 +457,14 @@ if (count($filter) > 0) {
|
||||
$sqlwhere[] = $key.'=\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
|
||||
$sqlwhere[] = $key.'\''.$db->escape($value).'\'';
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
} elseif ($key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\'';
|
||||
} elseif ($key == 't.subledger_account') {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||
@ -750,36 +752,29 @@ if (!empty($arrayfields['t.doc_ref']['checked'])) {
|
||||
if (!empty($arrayfields['t.numero_compte']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 1);
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'account');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 1);
|
||||
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'account');
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Subledger account
|
||||
if (!empty($arrayfields['t.subledger_account']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<div class="nowrap">';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print $langs->trans('From').' ';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<div class="nowrap">';
|
||||
//print $langs->trans('From').' ';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount');
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount');
|
||||
print '</div>';
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'" placeholder="'.$langs->trans("From").'">';
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code" value="'.$search_accountancy_aux_code.'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
|
||||
print $langs->trans('to').' ';
|
||||
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
} else {
|
||||
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'" placeholder="'.$langs->trans("to").'">';
|
||||
}
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
}
|
||||
// Label operation
|
||||
|
||||
@ -473,7 +473,7 @@ class AccountancyCategory // extends CommonObject
|
||||
$sql .= " SELECT DISTINCT aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity.")";
|
||||
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
|
||||
@ -562,7 +562,7 @@ class AccountancyCategory // extends CommonObject
|
||||
$sql = "SELECT aa.rowid, aa.account_number";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " AND aa.entity = ".$conf->entity;
|
||||
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
|
||||
@ -589,8 +589,8 @@ class AccountancyCategory // extends CommonObject
|
||||
$accountincptsadded[$account_number_formated] = 1;
|
||||
// We found an account number that is in list $cpts of account to add
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account";
|
||||
$sql .= " SET fk_accounting_category=".$id_cat;
|
||||
$sql .= " WHERE rowid=".$obj->rowid;
|
||||
$sql .= " SET fk_accounting_category=".((int) $id_cat);
|
||||
$sql .= " WHERE rowid=".((int) $obj->rowid);
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resqlupdate = $this->db->query($sql);
|
||||
if (!$resqlupdate) {
|
||||
@ -629,7 +629,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " SET fk_accounting_category= 0";
|
||||
$sql .= " WHERE aa.rowid= ".$cpt_id;
|
||||
$sql .= " WHERE aa.rowid = ".((int) $cpt_id);
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(__METHOD__." sql=".$sql, LOG_DEBUG);
|
||||
|
||||
@ -557,7 +557,7 @@ class AccountancyExport
|
||||
$Tab['signe_montant'] = '+';
|
||||
|
||||
// The amount must be in centimes without decimal points.
|
||||
$Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT);
|
||||
$Tab['montant'] = str_pad(abs(($data->debit - $data->credit) * 100), 12, '0', STR_PAD_LEFT);
|
||||
$Tab['contrepartie'] = str_repeat(' ', 8);
|
||||
|
||||
// Force date format : %d%m%y
|
||||
|
||||
@ -347,10 +347,10 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , label = ".($this->label ? "'".$this->db->escape($this->label)."'" : "''");
|
||||
$sql .= " , labelshort = ".($this->labelshort ? "'".$this->db->escape($this->labelshort)."'" : "''");
|
||||
$sql .= " , fk_accounting_category = ".(empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||
$sql .= " , fk_user_modif = ".$user->id;
|
||||
$sql .= " , fk_user_modif = ".((int) $user->id);
|
||||
$sql .= " , active = ".(int) $this->active;
|
||||
$sql .= " , reconcilable = ".(int) $this->reconcilable;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -129,13 +129,13 @@ class BookKeeping extends CommonObject
|
||||
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated Use $amount
|
||||
* @deprecated No more used (we have info into debit/credit and sens)
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated No more used
|
||||
* @deprecated No more used (we have info into debit/credit and sens)
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
@ -287,34 +287,38 @@ class BookKeeping extends CommonObject
|
||||
$this->piece_num = 0;
|
||||
|
||||
// First check if line not yet already in bookkeeping.
|
||||
// Note that we must include doc_type - fk_doc - numero_compte - label to be sure to have unicity of line (we may have several lines
|
||||
// Note that we must include 'doc_type - fk_doc - numero_compte - label' to be sure to have unicity of line (because we may have several lines
|
||||
// with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account)
|
||||
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
|
||||
// The page to make journalization make the test on couple doc_type - fk_doc only.
|
||||
// The page that make transfer make the test on couple (doc_type - fk_doc) only.
|
||||
$sql = "SELECT count(*) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'";
|
||||
$sql .= " AND fk_doc = ".$this->fk_doc;
|
||||
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
|
||||
// DO NOT USE THIS IN PRPDUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries.
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||
// DO NOT USE THIS IN PRODUCTION. This will generate a lot of trouble into reports and will corrupt database (by generating duplicate entries.
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 if record is for several lines
|
||||
}
|
||||
$sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'";
|
||||
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
|
||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
||||
$sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
$row = $this->db->fetch_object($resql);
|
||||
if ($row->nb == 0) {
|
||||
// Determine piece_num
|
||||
if ($row->nb == 0) { // Not already into bookkeeping
|
||||
// Check to know if piece_num already exists for data we try to insert to reuse the same value
|
||||
$sqlnum = "SELECT piece_num";
|
||||
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sqlnum .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; // For example doc_type = 'bank'
|
||||
$sqlnum .= " AND fk_docdet = ".$this->db->escape($this->fk_docdet); // fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ...
|
||||
$sqlnum .= " AND fk_doc = ".$this->fk_doc;
|
||||
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) {
|
||||
// fk_docdet is rowid into llx_bank or llx_facturedet or llx_facturefourndet, or ...
|
||||
$sqlnum .= " AND fk_docdet = ".((int) $this->fk_docdet);
|
||||
}
|
||||
$sqlnum .= " AND doc_ref = '".$this->db->escape($this->doc_ref)."'"; // ref of source object
|
||||
$sqlnum .= " AND entity IN (".getEntity('accountancy').")";
|
||||
$sqlnum .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
|
||||
dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
@ -327,15 +331,14 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sqlnum .= " WHERE entity IN (".getEntity('accountancy').")";
|
||||
$sqlnum .= " WHERE entity = ".$conf->entity; // Do not use getEntity for accounting features
|
||||
|
||||
dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
if ($resqlnum) {
|
||||
$objnum = $this->db->fetch_object($resqlnum);
|
||||
$this->piece_num = $objnum->maxpiecenum;
|
||||
}
|
||||
dol_syslog(get_class($this).":: create this->piece_num=".$this->piece_num, LOG_DEBUG);
|
||||
dol_syslog(get_class($this).":: create now this->piece_num=".$this->piece_num, LOG_DEBUG);
|
||||
}
|
||||
if (empty($this->piece_num)) {
|
||||
$this->piece_num = 1;
|
||||
@ -371,8 +374,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ", ".(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
|
||||
$sql .= ", '".$this->db->escape($this->doc_type)."'";
|
||||
$sql .= ", '".$this->db->escape($this->doc_ref)."'";
|
||||
$sql .= ", ".$this->fk_doc;
|
||||
$sql .= ", ".$this->fk_docdet;
|
||||
$sql .= ", ".((int) $this->fk_doc);
|
||||
$sql .= ", ".((int) $this->fk_docdet);
|
||||
$sql .= ", ".(!empty($this->thirdparty_code) ? ("'".$this->db->escape($this->thirdparty_code)."'") : "NULL");
|
||||
$sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL");
|
||||
$sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL");
|
||||
@ -632,8 +635,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' '.(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'").',';
|
||||
$sql .= ' '.(!isset($this->doc_type) ? 'NULL' : "'".$this->db->escape($this->doc_type)."'").',';
|
||||
$sql .= ' '.(!isset($this->doc_ref) ? 'NULL' : "'".$this->db->escape($this->doc_ref)."'").',';
|
||||
$sql .= ' '.(empty($this->fk_doc) ? '0' : $this->fk_doc).',';
|
||||
$sql .= ' '.(empty($this->fk_docdet) ? '0' : $this->fk_docdet).',';
|
||||
$sql .= ' '.(empty($this->fk_doc) ? '0' : (int) $this->fk_doc).',';
|
||||
$sql .= ' '.(empty($this->fk_docdet) ? '0' : (int) $this->fk_docdet).',';
|
||||
$sql .= ' '.(!isset($this->thirdparty_code) ? 'NULL' : "'".$this->db->escape($this->thirdparty_code)."'").',';
|
||||
$sql .= ' '.(!isset($this->subledger_account) ? 'NULL' : "'".$this->db->escape($this->subledger_account)."'").',';
|
||||
$sql .= ' '.(!isset($this->subledger_label) ? 'NULL' : "'".$this->db->escape($this->subledger_label)."'").',';
|
||||
@ -1121,6 +1124,12 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
|
||||
} elseif ($key == 't.subledger_label') {
|
||||
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
|
||||
} elseif ($key == 't.code_journal' && !empty($value)) {
|
||||
if (is_array($value)) {
|
||||
$sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
|
||||
} else {
|
||||
$sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
|
||||
}
|
||||
} else {
|
||||
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
|
||||
}
|
||||
@ -1860,7 +1869,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND asy.rowid = " . ((int) $pcgver);
|
||||
$sql .= " AND ab.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
*/
|
||||
@ -1893,7 +1902,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = ".$pcgver;
|
||||
$sql .= " AND asy.rowid = ".((int) $pcgver);
|
||||
$sql .= " AND ab.entity IN (".getEntity('accountancy').")";
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ if (!empty($id)) {
|
||||
$sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
|
||||
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell as code_sell,";
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell as code_sell,";
|
||||
}
|
||||
@ -110,7 +110,7 @@ if (!empty($id)) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = l.fk_facture";
|
||||
|
||||
@ -110,13 +110,13 @@ if ($action == 'validatehistory') {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}*/
|
||||
@ -126,15 +126,15 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
}
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra,";
|
||||
if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) {
|
||||
$sql .= " sa.accountancy_code_sell as company_code_sell";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_sell as company_code_sell";
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell";
|
||||
}
|
||||
@ -145,10 +145,10 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$alias_societe_perentity = empty($conf->global->ACCOUNTANCY_COMPANY_SHARED) ? "s" : "sa";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa";
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
@ -170,7 +170,7 @@ if ($action == 'validatehistory') {
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
$isBuyerInEEC = isInEEC($objp); // This make a database request but there is a cache into $conf->cache['country_code_in_EEC']
|
||||
|
||||
// Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
|
||||
@ -53,9 +53,14 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day = GETPOST("search_day", "int");
|
||||
$search_month = GETPOST("search_month", "int");
|
||||
$search_year = GETPOST("search_year", "int");
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
@ -109,9 +114,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_day = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
@ -184,9 +194,9 @@ $sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, f
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell,";
|
||||
$sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell,";
|
||||
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
}
|
||||
$sql .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,";
|
||||
$sql .= " fd.situation_percent,";
|
||||
@ -198,7 +208,7 @@ $sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
@ -240,7 +250,12 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("fd.tva_tx", price2num($search_vat), 1);
|
||||
}
|
||||
$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
@ -315,14 +330,23 @@ if ($result) {
|
||||
if ($search_vat) {
|
||||
$param .= "&search_vat=".urlencode($search_vat);
|
||||
}
|
||||
if ($search_day) {
|
||||
$param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_month) {
|
||||
$param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_year) {
|
||||
$param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_country) {
|
||||
$param .= "&search_country=".urlencode($search_country);
|
||||
@ -357,12 +381,13 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
||||
}
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -59,9 +59,14 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day = GETPOST("search_day", "int");
|
||||
$search_month = GETPOST("search_month", "int");
|
||||
$search_year = GETPOST("search_year", "int");
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
@ -135,9 +140,14 @@ if (empty($reshook)) {
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_day = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
@ -219,8 +229,8 @@ $sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,";
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
@ -229,8 +239,8 @@ $sql .= " p.tosell as status, p.tobuy as status_buy,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " sa.accountancy_code_sell as company_code_sell";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_sell as company_code_sell";
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell";
|
||||
}
|
||||
@ -240,16 +250,16 @@ $sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.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);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa";
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
@ -289,7 +299,12 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
|
||||
}
|
||||
$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
@ -368,14 +383,23 @@ if ($result) {
|
||||
if ($search_lineid) {
|
||||
$param .= '&search_lineid='.urlencode($search_lineid);
|
||||
}
|
||||
if ($search_day) {
|
||||
$param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_month) {
|
||||
$param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_year) {
|
||||
$param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_invoice) {
|
||||
$param .= '&search_invoice='.urlencode($search_invoice);
|
||||
@ -436,12 +460,13 @@ if ($result) {
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre center nowraponall minwidth100imp">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
}
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
@ -450,7 +475,7 @@ if ($result) {
|
||||
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50 right" name="search_vat" placeholder="%" size="1" value="'.dol_escape_htmltag($search_vat).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1);
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth125', 'code2', 1, 0, 1, null, 1);
|
||||
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></td>';
|
||||
@ -687,8 +712,8 @@ if ($result) {
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
// Found accounts
|
||||
print '<td>';
|
||||
$s = '<span class="small">1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
@ -699,7 +724,7 @@ if ($result) {
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
if ($objp->product_id > 0) {
|
||||
print '<br>';
|
||||
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = ''; $ttype = 'help';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
@ -716,7 +741,7 @@ if ($result) {
|
||||
} else {
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<br>';
|
||||
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = '';
|
||||
$s .= $langs->trans("NotDefined");
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
@ -724,7 +749,7 @@ if ($result) {
|
||||
}
|
||||
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
|
||||
print '<br>';
|
||||
$s = '<span class="small">3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': </span>';
|
||||
$s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
|
||||
$shelp = '';
|
||||
$s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : '<span style="'.$code_sell_t_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
|
||||
@ -103,13 +103,13 @@ if ($action == 'validatehistory') {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=".$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
|
||||
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=".$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
|
||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("LineOfExpenseReport").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,16 +35,23 @@ $langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "ban
|
||||
$hookmanager->initHooks(array('accountancyindex'));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
if ($user->socid > 0) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->socid > 0) {
|
||||
/*
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
*/
|
||||
if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -120,7 +120,8 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,";
|
||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, u.statut as userstatus,";
|
||||
$sql .= " bu2.type as typeop_user,";
|
||||
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid";
|
||||
@ -130,7 +131,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid A
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
||||
$sql .= " WHERE ba.fk_accountancy_journal=".$id_journal;
|
||||
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
|
||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||
if ($date_start && $date_end) {
|
||||
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
||||
@ -259,7 +260,8 @@ if ($result) {
|
||||
'lastname' => $obj->lastname,
|
||||
'firstname' => $obj->firstname,
|
||||
'email' => $obj->useremail,
|
||||
'accountancy_code' => $compta_user
|
||||
'accountancy_code' => $compta_user,
|
||||
'status' => $obj->userstatus
|
||||
);
|
||||
|
||||
// Variable bookkeeping ($obj->rowid is Bank Id)
|
||||
@ -328,8 +330,10 @@ if ($result) {
|
||||
$userstatic->email = $tabuser[$obj->rowid]['email'];
|
||||
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
|
||||
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
|
||||
$userstatic->statut = $tabuser[$obj->rowid]['status'];
|
||||
$userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code'];
|
||||
if ($userstatic->id > 0) {
|
||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
|
||||
} else {
|
||||
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||
}
|
||||
@ -507,6 +511,18 @@ var_dump($tabtype);*/
|
||||
if (!$error && $action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
|
||||
$accountingaccountcustomer = new AccountingAccount($db);
|
||||
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
|
||||
$accountingaccountsupplier = new AccountingAccount($db);
|
||||
$accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
|
||||
$accountingaccountpayment = new AccountingAccount($db);
|
||||
$accountingaccountpayment->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
|
||||
$accountingaccountsuspense = new AccountingAccount($db);
|
||||
$accountingaccountsuspense->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true);
|
||||
|
||||
$error = 0;
|
||||
foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
@ -530,6 +546,9 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
// Line into bank account
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch(null, $k, true); // $k is accounting bank account. TODO We should use a cache here to avoid this fetch
|
||||
$account_label = $accountingaccount->label;
|
||||
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
@ -545,10 +564,9 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'bank';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $account_label;
|
||||
|
||||
$bookkeeping->label_operation = $reflabel;
|
||||
$bookkeeping->montant = $mt;
|
||||
@ -606,6 +624,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'bank';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_bank"];
|
||||
|
||||
$bookkeeping->label_operation = $reflabel;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
@ -620,78 +639,63 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = $accountingaccountcustomer->label;
|
||||
} elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
|
||||
$bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = $accountingaccountsupplier->label;
|
||||
} elseif ($tabtype[$key] == 'payment_expensereport') {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = $accountingaccountpayment->label;
|
||||
} elseif ($tabtype[$key] == 'payment_salary') {
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = $accountingaccountpayment->label;
|
||||
} elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'payment_vat') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'payment_donation') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'member') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'payment_loan') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->subledger_account = $k;
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$accountingaccount->fetch(null, $tabpay[$key]["account_various"], true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $tabpay[$key]["account_various"];
|
||||
|
||||
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'banktransfert') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} else {
|
||||
if ($tabtype[$key] == 'unknown') { // Unknown transaction, we will use a waiting account for thirdparty.
|
||||
@ -699,9 +703,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_compte = $accountingaccountsuspense->label;
|
||||
}
|
||||
}
|
||||
$bookkeeping->label_operation = $reflabel;
|
||||
@ -1323,42 +1325,42 @@ function getSourceDocRef($val, $typerecord)
|
||||
} elseif ($typerecord == 'payment_supplier') {
|
||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
|
||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".((int) $val["paymentsupplierid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
|
||||
} elseif ($typerecord == 'payment_expensereport') {
|
||||
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
||||
$sqlmid .= " WHERE pe.rowid=".((int) $val["paymentexpensereport"])." AND pe.fk_expensereport = e.rowid";
|
||||
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
|
||||
} elseif ($typerecord == 'payment_salary') {
|
||||
$sqlmid = 'SELECT s.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
|
||||
$sqlmid .= " WHERE s.rowid=".((int) $val["paymentsalid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
|
||||
} elseif ($typerecord == 'sc') {
|
||||
$sqlmid = 'SELECT sc.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
|
||||
$sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
|
||||
$sqlmid .= " WHERE sc.rowid=".((int) $val["paymentscid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("SocialContribution");
|
||||
} elseif ($typerecord == 'payment_vat') {
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
|
||||
$sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
|
||||
$sqlmid .= " WHERE v.rowid=".((int) $val["paymentvatid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("PaymentVat");
|
||||
} elseif ($typerecord == 'payment_donation') {
|
||||
$sqlmid = 'SELECT payd.fk_donation as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
|
||||
$sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
|
||||
$sqlmid .= " WHERE payd.fk_donation=".((int) $val["paymentdonationid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("Donation");
|
||||
} elseif ($typerecord == 'payment_loan') {
|
||||
$sqlmid = 'SELECT l.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
|
||||
$sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
|
||||
$sqlmid .= " WHERE l.rowid=".((int) $val["paymentloanid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("LoanPayment");
|
||||
} elseif ($typerecord == 'payment_various') {
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
|
||||
$sqlmid .= " WHERE v.rowid=".((int) $val["paymentvariousid"]);
|
||||
$ref = $langs->transnoentitiesnoconv("VariousPayment");
|
||||
}
|
||||
// Add warning
|
||||
|
||||
@ -206,6 +206,9 @@ if ($action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
$error = 0;
|
||||
|
||||
$accountingaccountexpense = new AccountingAccount($db);
|
||||
$accountingaccountexpense->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
|
||||
foreach ($taber as $key => $val) { // Loop on each expense report
|
||||
$errorforline = 0;
|
||||
|
||||
@ -225,12 +228,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'expense_report';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
|
||||
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
|
||||
$bookkeeping->subledger_label = $tabuser[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
$bookkeeping->label_compte = $accountingaccountexpense->label;
|
||||
|
||||
$bookkeeping->label_operation = $tabuser[$key]['name'];
|
||||
$bookkeeping->montant = $mt;
|
||||
@ -274,10 +277,13 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'expense_report';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
|
||||
$bookkeeping->label_operation = $accountingaccount->label;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
@ -322,6 +328,9 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label
|
||||
$account_label = $accountingaccount->label;
|
||||
|
||||
// get compte id and label
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
@ -330,12 +339,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->doc_type = 'expense_report';
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = $val["fk_expensereportdet"];
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch($k, null, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $account_label;
|
||||
|
||||
$bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %';
|
||||
$bookkeeping->montant = $mt;
|
||||
|
||||
@ -106,9 +106,17 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
|
||||
$sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,";
|
||||
$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,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_buy,";
|
||||
}
|
||||
$sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$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."societe as s ON s.rowid = f.fk_soc";
|
||||
@ -240,7 +248,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$sql = "SELECT COUNT(fd.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
|
||||
$sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0";
|
||||
$sql .= " AND fd.total_ttc <> 0 AND fk_facture_fourn = ".$key;
|
||||
$sql .= " AND fd.total_ttc <> 0 AND fk_facture_fourn = ".((int) $key);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -262,6 +270,9 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
$accountingaccountsupplier = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountsupplier->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
@ -323,12 +334,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
$bookkeeping->label_compte = $accountingaccountsupplier->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
@ -363,8 +374,11 @@ if ($action == 'writebookkeeping') {
|
||||
// Product / Service
|
||||
if (!$errorforline) {
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
$resultfetch = $accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$label_account = $accountingaccount->label;
|
||||
|
||||
// get compte id and label
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
if ($resultfetch > 0) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
@ -374,11 +388,14 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$label_account;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
|
||||
@ -424,6 +441,9 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label
|
||||
$label_account = $accountingaccount->label;
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
@ -433,12 +453,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch($k, null, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
|
||||
$bookkeeping->montant = $mt;
|
||||
@ -486,9 +506,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' NPR';
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
|
||||
|
||||
@ -110,14 +110,14 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
|
||||
$sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell";
|
||||
$sql .= " ppe.accountancy_code_sell";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
|
||||
@ -148,7 +148,7 @@ if ($in_bookkeeping == 'notyet') {
|
||||
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
|
||||
}
|
||||
$sql .= " ORDER BY f.datef";
|
||||
//print $sql;
|
||||
//print $sql; exit;
|
||||
|
||||
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -264,7 +264,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$sql = "SELECT COUNT(fd.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
|
||||
$sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0";
|
||||
$sql .= " AND fd.total_ttc <> 0 AND fk_facture = ".$key;
|
||||
$sql .= " AND fd.total_ttc <> 0 AND fk_facture = ".((int) $key);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -285,6 +285,9 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
$companystatic = new Societe($db);
|
||||
$invoicestatic = new Facture($db);
|
||||
$accountingaccountcustomer = new AccountingAccount($db);
|
||||
|
||||
$accountingaccountcustomer->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
$errorforline = 0;
|
||||
@ -344,12 +347,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
|
||||
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
$bookkeeping->label_compte = $accountingaccountcustomer->label;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount");
|
||||
$bookkeeping->montant = $mt;
|
||||
@ -384,8 +387,11 @@ if ($action == 'writebookkeeping') {
|
||||
// Product / Service
|
||||
if (!$errorforline) {
|
||||
foreach ($tabht[$key] as $k => $mt) {
|
||||
$resultfetch = $accountingaccount->fetch(null, $k, true); // TODO Use a cache
|
||||
$label_account = $accountingaccount->label;
|
||||
|
||||
// get compte id and label
|
||||
if ($accountingaccount->fetch(null, $k, true)) {
|
||||
if ($resultfetch > 0) {
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
@ -395,11 +401,14 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$label_account;
|
||||
$bookkeeping->montant = $mt;
|
||||
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
|
||||
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
|
||||
@ -444,6 +453,9 @@ if ($action == 'writebookkeeping') {
|
||||
|
||||
foreach ($arrayofvat[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label
|
||||
$label_account = $accountingaccount->label;
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
$bookkeeping->date_lim_reglement = $val["datereg"];
|
||||
@ -453,12 +465,12 @@ if ($action == 'writebookkeeping') {
|
||||
$bookkeeping->fk_doc = $key;
|
||||
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
|
||||
$bookkeeping->thirdparty_code = $companystatic->code_client;
|
||||
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
|
||||
$accountingaccount->fetch($k, null, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->label_compte = $label_account;
|
||||
|
||||
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
|
||||
$bookkeeping->montant = $mt;
|
||||
|
||||
@ -101,10 +101,18 @@ $formaccounting = new FormAccounting($db);
|
||||
|
||||
if (!empty($id)) {
|
||||
$sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
|
||||
$sql .= ", aa.account_number, aa.label";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy as code_buy,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_buy as code_buy,";
|
||||
}
|
||||
$sql .= " aa.account_number, aa.label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);
|
||||
|
||||
@ -118,13 +118,13 @@ if ($action == 'validatehistory') {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
||||
} else {
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . ((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.$conf->entity;
|
||||
$sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||
}*/
|
||||
@ -132,20 +132,35 @@ if ($action == 'validatehistory') {
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
}
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra, s.accountancy_code_buy as company_code_buy";
|
||||
$sql .= " s.tva_intra,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " spe.accountancy_code_buy as company_code_buy";
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_buy as company_code_buy";
|
||||
}
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " INNER 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 ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -54,9 +54,14 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day = GETPOST("search_day", "int");
|
||||
$search_month = GETPOST("search_month", "int");
|
||||
$search_year = GETPOST("search_year", "int");
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
@ -94,6 +99,9 @@ if (empty($user->rights->accounting->mouvements->lire)) {
|
||||
}
|
||||
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -109,14 +117,19 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_day = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
|
||||
$error = 0;
|
||||
|
||||
if (!(GETPOST('account_parent', 'int') >= 0)) {
|
||||
@ -124,7 +137,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
|
||||
}
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
|
||||
@ -184,7 +196,11 @@ $sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invo
|
||||
$sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
|
||||
$sql .= " aa.label, aa.labelshort, aa.account_number,";
|
||||
$sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,";
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
}
|
||||
$sql .= " co.code as country_code, co.label as country,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur";
|
||||
$parameters = array();
|
||||
@ -192,6 +208,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
@ -225,7 +244,12 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
|
||||
}
|
||||
$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
@ -306,14 +330,23 @@ if ($result) {
|
||||
if ($search_vat) {
|
||||
$param .= "&search_vat=".urlencode($search_vat);
|
||||
}
|
||||
if ($search_day) {
|
||||
$param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_month) {
|
||||
$param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_year) {
|
||||
$param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_country) {
|
||||
$param .= "&search_country=".urlencode($search_country);
|
||||
@ -350,12 +383,13 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center nowraponall">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
}
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
@ -60,9 +60,14 @@ $search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'alpha');
|
||||
$search_vat = GETPOST('search_vat', 'alpha');
|
||||
$search_day = GETPOST("search_day", "int");
|
||||
$search_month = GETPOST("search_month", "int");
|
||||
$search_year = GETPOST("search_year", "int");
|
||||
$search_date_startday = GETPOST('search_date_startday', 'int');
|
||||
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
|
||||
$search_date_startyear = GETPOST('search_date_startyear', 'int');
|
||||
$search_date_endday = GETPOST('search_date_endday', 'int');
|
||||
$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
|
||||
$search_date_endyear = GETPOST('search_date_endyear', 'int');
|
||||
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
|
||||
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
|
||||
$search_country = GETPOST('search_country', 'alpha');
|
||||
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
|
||||
@ -140,9 +145,14 @@ if (empty($reshook)) {
|
||||
$search_amount = '';
|
||||
$search_account = '';
|
||||
$search_vat = '';
|
||||
$search_day = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_date_startday = '';
|
||||
$search_date_startmonth = '';
|
||||
$search_date_startyear = '';
|
||||
$search_date_endday = '';
|
||||
$search_date_endmonth = '';
|
||||
$search_date_endyear = '';
|
||||
$search_date_start = '';
|
||||
$search_date_end = '';
|
||||
$search_country = '';
|
||||
$search_tvaintra = '';
|
||||
}
|
||||
@ -188,7 +198,7 @@ if ($massaction == 'ventil' && $user->rights->accounting->bind->write) {
|
||||
$msg .= '<div><span style="color:green">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("VentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'</span></div>';
|
||||
$ok++;
|
||||
} else {
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br/> <pre>'.$sql.'</pre></span></div>';
|
||||
$msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NotVentilatedinAccount").' : '.length_accountg($accountventilated->account_number).'<br> <pre>'.$sql.'</pre></span></div>';
|
||||
$ko++;
|
||||
}
|
||||
}
|
||||
@ -224,8 +234,8 @@ $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_lab
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,";
|
||||
$sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
|
||||
} else {
|
||||
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
@ -235,7 +245,7 @@ $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " sa.accountancy_code_buy as company_code_buy";
|
||||
$sql .= " spe.accountancy_code_buy as company_code_buy";
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_buy as company_code_buy";
|
||||
}
|
||||
@ -245,16 +255,16 @@ $sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.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);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity);
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa";
|
||||
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
|
||||
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
@ -293,7 +303,12 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1);
|
||||
}
|
||||
$sql .= dolSqlDateFilter('f.datef', $search_day, $search_month, $search_year);
|
||||
if ($search_date_start) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||
}
|
||||
if ($search_date_end) {
|
||||
$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||
}
|
||||
if (strlen(trim($search_country))) {
|
||||
$arrayofcode = getCountriesInEEC();
|
||||
$country_code_in_EEC = $country_code_in_EEC_without_me = '';
|
||||
@ -372,14 +387,23 @@ if ($result) {
|
||||
if ($search_lineid) {
|
||||
$param .= '&search_lineid='.urlencode($search_lineid);
|
||||
}
|
||||
if ($search_day) {
|
||||
$param .= '&search_day='.urlencode($search_day);
|
||||
if ($search_date_startday) {
|
||||
$param .= '&search_date_startday='.urlencode($search_date_startday);
|
||||
}
|
||||
if ($search_month) {
|
||||
$param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_date_startmonth) {
|
||||
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
|
||||
}
|
||||
if ($search_year) {
|
||||
$param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_date_startyear) {
|
||||
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
|
||||
}
|
||||
if ($search_date_endday) {
|
||||
$param .= '&search_date_endday='.urlencode($search_date_endday);
|
||||
}
|
||||
if ($search_date_endmonth) {
|
||||
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
|
||||
}
|
||||
if ($search_date_endyear) {
|
||||
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
|
||||
}
|
||||
if ($search_invoice) {
|
||||
$param .= '&search_invoice='.urlencode($search_invoice);
|
||||
@ -444,12 +468,13 @@ if ($result) {
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="'.dol_escape_htmltag($search_lineid).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
|
||||
//print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
print '<td class="liste_titre center nowraponall minwidth100imp">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">';
|
||||
}
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">';
|
||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
||||
print '<td class="liste_titre center">';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
|
||||
print '</div>';
|
||||
print '<div class="nowrap">';
|
||||
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat maxwidth100" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
|
||||
@ -671,8 +696,8 @@ if ($result) {
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
// Found accounts
|
||||
print '<td>';
|
||||
$s = '<span class="small">1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
|
||||
print '<td class="small">';
|
||||
$s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
|
||||
$shelp .= $langs->trans("SaleEEC");
|
||||
@ -683,7 +708,7 @@ if ($result) {
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
if ($objp->product_id > 0) {
|
||||
print '<br>';
|
||||
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountfor == 'eec') {
|
||||
$shelp = $langs->trans("SaleEEC");
|
||||
@ -694,13 +719,13 @@ if ($result) {
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
} else {
|
||||
print '<br>';
|
||||
$s = '<span class="small">2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
|
||||
$s = '2. '.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$shelp = '';
|
||||
$s .= $langs->trans("NotDefined");
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
}
|
||||
print '<br>';
|
||||
$s = '<span class="small">3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': </span>';
|
||||
$s = '3. '.(($objp->type_l == 1) ? $langs->trans("ServiceForThisThirdparty") : $langs->trans("ProductForThisThirdparty")).': ';
|
||||
$shelp = '';
|
||||
$s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>');
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2020-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -34,7 +33,6 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "members"));
|
||||
|
||||
@ -944,17 +944,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
function initfieldrequired()
|
||||
{
|
||||
function initfieldrequired() {
|
||||
jQuery("#tdcompany").removeClass("fieldrequired");
|
||||
jQuery("#tdlastname").removeClass("fieldrequired");
|
||||
jQuery("#tdfirstname").removeClass("fieldrequired");
|
||||
if (jQuery("#morphy").val() == \'mor\')
|
||||
{
|
||||
if (jQuery("#morphy").val() == \'mor\') {
|
||||
jQuery("#tdcompany").addClass("fieldrequired");
|
||||
}
|
||||
if (jQuery("#morphy").val() == \'phy\')
|
||||
{
|
||||
if (jQuery("#morphy").val() == \'phy\') {
|
||||
jQuery("#tdlastname").addClass("fieldrequired");
|
||||
jQuery("#tdfirstname").addClass("fieldrequired");
|
||||
}
|
||||
@ -1178,17 +1175,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
function initfieldrequired()
|
||||
{
|
||||
function initfieldrequired() {
|
||||
jQuery("#tdcompany").removeClass("fieldrequired");
|
||||
jQuery("#tdlastname").removeClass("fieldrequired");
|
||||
jQuery("#tdfirstname").removeClass("fieldrequired");
|
||||
if (jQuery("#morphy").val() == \'mor\')
|
||||
{
|
||||
if (jQuery("#morphy").val() == \'mor\') {
|
||||
jQuery("#tdcompany").addClass("fieldrequired");
|
||||
}
|
||||
if (jQuery("#morphy").val() == \'phy\')
|
||||
{
|
||||
if (jQuery("#morphy").val() == \'phy\') {
|
||||
jQuery("#tdlastname").addClass("fieldrequired");
|
||||
jQuery("#tdfirstname").addClass("fieldrequired");
|
||||
}
|
||||
@ -1762,12 +1756,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print $langs->trans("SubscriptionNotNeeded");
|
||||
} elseif (!$adht->subscription) {
|
||||
print $langs->trans("SubscriptionNotRecorded");
|
||||
if ($object->statut > 0) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
|
||||
}
|
||||
} else {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($object->statut > 0) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
|
||||
}
|
||||
}
|
||||
@ -1812,7 +1806,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding">';
|
||||
print '<tr><td>';
|
||||
print $form->select_company($object->socid, 'socid', '', 1);
|
||||
print '</td>';
|
||||
@ -1877,97 +1871,91 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if ($action != 'editlogin' && $action != 'editthirdparty') {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->statut == 1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a></div>'."\n";
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Send card by email
|
||||
// TODO Remove this to replace with a template
|
||||
/*
|
||||
if ($user->rights->adherent->creer)
|
||||
{
|
||||
if ($object->statut >= 1)
|
||||
{
|
||||
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a></div>\n";
|
||||
if ($user->rights->adherent->creer) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($object->email) print '<a class="butAction" href="card.php?rowid='.$object->id.'&action=sendinfo">'.$langs->trans("SendCardByMail")."</a>\n";
|
||||
else print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendCardByMail")."</a>\n";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</span>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
|
||||
} else {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</span>";
|
||||
}*/
|
||||
|
||||
// Modify
|
||||
if ($user->rights->adherent->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=edit">'.$langs->trans("Modify").'</a></div>'."\n";
|
||||
if (!$user->rights->adherent->creer) {
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</span>'."\n";
|
||||
}
|
||||
|
||||
// Validate
|
||||
if ($object->statut == -1) {
|
||||
if (Adherent::STATUS_DRAFT == $object->statut) {
|
||||
if ($user->rights->adherent->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Validate").'</a></div>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Validate").'</a>'."\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Validate").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Reactivate
|
||||
if ($object->statut == 0 || $object->statut == -2) {
|
||||
if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $Object->statut) {
|
||||
if ($user->rights->adherent->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Reenable")."</a></div>\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=valid">'.$langs->trans("Reenable")."</a>\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Reenable").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Resiliate
|
||||
if ($object->statut >= 1) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=resiliate">'.$langs->trans("Resiliate")."</a></div>\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=resiliate">'.$langs->trans("Resiliate")."</a></span>\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Resiliate").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Exclude
|
||||
if ($object->statut >= 1) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->statut) {
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$id.'&action=exclude">'.$langs->trans("Exclude")."</a></div>\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.$id.'&action=exclude">'.$langs->trans("Exclude")."</a></span>\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Exclude").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Exclude").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Create third party
|
||||
if (!empty($conf->societe->enabled) && !$object->socid) {
|
||||
if ($user->rights->societe->creer) {
|
||||
if ($object->statut != -1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>'."\n";;
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";;
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>'."\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrThirdParty").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Create user
|
||||
if (!$user->socid && !$object->user_id) {
|
||||
if ($user->rights->user->user->creer) {
|
||||
if ($object->statut != -1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>'."\n";
|
||||
if (Adherent::STATUS_DRAFT != $object->statut) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a></div>'."\n";
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("CreateDolibarrLogin").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1976,18 +1964,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
$isinspip = $mailmanspip->is_in_spip($object);
|
||||
|
||||
if ($isinspip == 1) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=del_spip">'.$langs->trans("DeleteIntoSpip").'</a></div>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.$object->id.'&action=del_spip">'.$langs->trans("DeleteIntoSpip").'</a>'."\n";
|
||||
}
|
||||
if ($isinspip == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip").'</a></div>'."\n";
|
||||
print '<a class="butAction" href="card.php?rowid='.$object->id.'&action=add_spip">'.$langs->trans("AddIntoSpip").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->supprimer) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>'."\n";
|
||||
print '<a class="butActionDelete" href="card.php?rowid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a>'."\n";
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><font class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</font></div>'."\n";
|
||||
print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Delete").'</span>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2025,7 +2013,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
if ($linktoelem) {
|
||||
print ($somethingshown?'':'<br>').$linktoelem;
|
||||
}
|
||||
*/
|
||||
|
||||
// Show online payment link
|
||||
|
||||
@ -44,7 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
*/
|
||||
class Adherent extends CommonObject
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string ID to identify managed object
|
||||
*/
|
||||
@ -210,12 +209,11 @@ class Adherent extends CommonObject
|
||||
*/
|
||||
public $morphy;
|
||||
|
||||
/**
|
||||
* @var int Info can be public
|
||||
*/
|
||||
public $public;
|
||||
|
||||
// -2:exclu, -1:brouillon, 0:resilie, >=1:valide,paye
|
||||
// def in common object
|
||||
//public $status;
|
||||
|
||||
/**
|
||||
* @var string photo of member
|
||||
*/
|
||||
@ -333,11 +331,28 @@ class Adherent extends CommonObject
|
||||
'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 190),
|
||||
'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => -1, 'position' => 195),
|
||||
'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500,
|
||||
'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', -1 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')),
|
||||
'arrayofkeyval' => array(-1 => 'Draft', 1 => 'Validated', 0 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')),
|
||||
'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800),
|
||||
'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805)
|
||||
);
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
*/
|
||||
const STATUS_DRAFT = -1;
|
||||
/**
|
||||
* Validated status
|
||||
*/
|
||||
const STATUS_VALIDATED = 1;
|
||||
/**
|
||||
* Resiliated
|
||||
*/
|
||||
const STATUS_RESILIATED = 0;
|
||||
/**
|
||||
* Excluded
|
||||
*/
|
||||
const STATUS_EXCLUDED = -2;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -347,7 +362,8 @@ class Adherent extends CommonObject
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->statut = -1;
|
||||
$this->statut = self::STATUS_DRAFT;
|
||||
$this->status = $this->statut;
|
||||
// l'adherent n'est pas public par defaut
|
||||
$this->public = 0;
|
||||
// les champs optionnels sont vides
|
||||
@ -1579,9 +1595,11 @@ class Adherent extends CommonObject
|
||||
* @param string $emetteur_nom Name of cheque writer
|
||||
* @param string $emetteur_banque Name of bank of cheque
|
||||
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
|
||||
* @param string $ext_payment_id External id of payment (for example Stripe charge id)
|
||||
* @param string $ext_payment_site Name of external paymentmode (for example 'stripe')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0)
|
||||
public function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0, $ext_payment_id = '', $ext_payment_site = '')
|
||||
{
|
||||
global $conf, $langs, $user, $mysoc;
|
||||
|
||||
@ -1606,8 +1624,8 @@ class Adherent extends CommonObject
|
||||
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullname($langs), 'member');
|
||||
if ($inserturlid > 0) {
|
||||
// Update table subscription
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid;
|
||||
$sql .= " WHERE rowid=".$subscriptionid;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".((int) $insertid);
|
||||
$sql .= " WHERE rowid=".((int) $subscriptionid);
|
||||
|
||||
dol_syslog("subscription::subscription", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1761,6 +1779,8 @@ class Adherent extends CommonObject
|
||||
$paiement->paiementid = dol_getIdFromCode($this->db, $operation, 'c_paiement', 'code', 'id', 1);
|
||||
$paiement->num_payment = $num_chq;
|
||||
$paiement->note_public = $label;
|
||||
$paiement->ext_payment_id = $ext_payment_id;
|
||||
$paiement->ext_payment_site = $ext_payment_site;
|
||||
|
||||
if (!$error) {
|
||||
// Create payment line for invoice
|
||||
@ -1843,7 +1863,7 @@ class Adherent extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 1) {
|
||||
if ($this->statut == self::STATUS_VALIDATED) {
|
||||
dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
@ -1851,7 +1871,7 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = 1";
|
||||
$sql .= " statut = ".self::STATUS_VALIDATED;
|
||||
$sql .= ", datevalid = '".$this->db->idate($now)."'";
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
@ -1859,7 +1879,7 @@ class Adherent extends CommonObject
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->statut = 1;
|
||||
$this->statut = self::STATUS_VALIDATED;
|
||||
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_VALIDATE', $user);
|
||||
@ -1895,7 +1915,7 @@ class Adherent extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 0) {
|
||||
if ($this->statut == self::STATUS_RESILIATED) {
|
||||
dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
@ -1903,13 +1923,13 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = 0";
|
||||
$sql .= " statut = ".self::STATUS_RESILIATED;
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->statut = 0;
|
||||
$this->statut = self::STATUS_RESILIATED;
|
||||
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_RESILIATE', $user);
|
||||
@ -1945,7 +1965,7 @@ class Adherent extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 0) {
|
||||
if ($this->statut == self::STATUS_EXCLUDED) {
|
||||
dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
@ -1953,13 +1973,13 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = -2";
|
||||
$sql .= " statut = ".self::STATUS_EXCLUDED;
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->statut = 0;
|
||||
$this->statut = self::STATUS_EXCLUDED;
|
||||
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('MEMBER_EXCLUDE', $user);
|
||||
@ -2264,11 +2284,11 @@ class Adherent extends CommonObject
|
||||
$labelStatus = '';
|
||||
$labelStatusShort = '';
|
||||
|
||||
if ($status == -1) {
|
||||
if ($status == self::STATUS_DRAFT) {
|
||||
$statusType = 'status0';
|
||||
$labelStatus = $langs->trans("MemberStatusDraft");
|
||||
$labelStatusShort = $langs->trans("MemberStatusDraftShort");
|
||||
} elseif ($status >= 1) {
|
||||
} elseif ($status >= self::STATUS_VALIDATED) {
|
||||
if ($need_subscription == 0) {
|
||||
$statusType = 'status4';
|
||||
$labelStatus = $langs->trans("MemberStatusNoSubscription");
|
||||
@ -2286,11 +2306,11 @@ class Adherent extends CommonObject
|
||||
$labelStatus = $langs->trans("MemberStatusPaid");
|
||||
$labelStatusShort = $langs->trans("MemberStatusPaidShort");
|
||||
}
|
||||
} elseif ($status == 0) {
|
||||
} elseif ($status == self::STATUS_RESILIATED) {
|
||||
$statusType = 'status6';
|
||||
$labelStatus = $langs->trans("MemberStatusResiliated");
|
||||
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
|
||||
} elseif ($status == -2) {
|
||||
} elseif ($status == self::STATUS_EXCLUDED) {
|
||||
$statusType = 'status10';
|
||||
$labelStatus = $langs->trans("MemberStatusExcluded");
|
||||
$labelStatusShort = $langs->trans("MemberStatusExcludedShort");
|
||||
@ -2356,11 +2376,11 @@ class Adherent extends CommonObject
|
||||
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE a.fk_adherent_type = t.rowid";
|
||||
if ($mode == 'expired') {
|
||||
$sql .= " AND a.statut = 1";
|
||||
$sql .= " AND a.statut = ".self::STATUS_VALIDATED;
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')";
|
||||
} elseif ($mode == 'shift') {
|
||||
$sql .= " AND a.statut = -1";
|
||||
$sql .= " AND a.statut = ".self::STATUS_DRAFT;
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
}
|
||||
|
||||
@ -2377,10 +2397,10 @@ class Adherent extends CommonObject
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$label = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_VALIDATED.'&filter=outofdate';
|
||||
} elseif ($mode == 'shift') {
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1';
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_DRAFT;
|
||||
$label = $langs->trans("MembersListToValid");
|
||||
$labelShort = $langs->trans("ToValidate");
|
||||
}
|
||||
@ -2493,7 +2513,7 @@ class Adherent extends CommonObject
|
||||
$this->birth = $now;
|
||||
$this->photo = '';
|
||||
$this->public = 1;
|
||||
$this->statut = 0;
|
||||
$this->statut = self::STATUS_DRAFT;
|
||||
|
||||
$this->datefin = $now;
|
||||
$this->datevalid = $now;
|
||||
@ -2812,7 +2832,7 @@ class Adherent extends CommonObject
|
||||
global $conf;
|
||||
|
||||
//Only valid members
|
||||
if ($this->statut <= 0) {
|
||||
if ($this->statut != self::STATUS_VALIDATED) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->datefin) {
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2018-2019 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -89,6 +89,11 @@ class AdherentType extends CommonObject
|
||||
*/
|
||||
public $subscription;
|
||||
|
||||
/**
|
||||
* @var float amount for subscription
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/** @var string Public note */
|
||||
public $note;
|
||||
|
||||
@ -361,11 +366,12 @@ class AdherentType extends CommonObject
|
||||
$sql .= "libelle = '".$this->db->escape($this->label)."',";
|
||||
$sql .= "morphy = '".$this->db->escape($this->morphy)."',";
|
||||
$sql .= "subscription = '".$this->db->escape($this->subscription)."',";
|
||||
$sql .= "amount = '".$this->db->escape($this->amount)."',";
|
||||
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
|
||||
$sql .= "note = '".$this->db->escape($this->note)."',";
|
||||
$sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
|
||||
$sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
$sql .= " WHERE rowid =".((int) $this->id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -455,7 +461,7 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.mail_valid, d.note, d.vote";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note, d.vote";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.rowid = ".(int) $rowid;
|
||||
|
||||
@ -475,6 +481,7 @@ class AdherentType extends CommonObject
|
||||
$this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1);
|
||||
$this->duration_unit = substr($obj->duration, -1);
|
||||
$this->subscription = $obj->subscription;
|
||||
$this->amount = $obj->amount;
|
||||
$this->mail_valid = $obj->mail_valid;
|
||||
$this->note = $obj->note;
|
||||
$this->vote = $obj->vote;
|
||||
@ -535,6 +542,45 @@ class AdherentType extends CommonObject
|
||||
return $adherenttypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of amount by type id
|
||||
*
|
||||
* @param int $status Filter on status of type
|
||||
* @return array List of types of members
|
||||
*/
|
||||
public function amountByType($status = null)
|
||||
{
|
||||
|
||||
global $conf, $langs;
|
||||
|
||||
$amountbytype = array();
|
||||
|
||||
$sql = "SELECT rowid, amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql .= " WHERE entity IN (".getEntity('member_type').")";
|
||||
if ($status !== null) {
|
||||
$sql .= " AND statut = ".((int) $status);
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$nump = $this->db->num_rows($resql);
|
||||
|
||||
if ($nump) {
|
||||
$i = 0;
|
||||
while ($i < $nump) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$amountbytype[$obj->rowid] = $obj->amount;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print $this->db->error();
|
||||
}
|
||||
return $amountbytype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array of Member objects for member type this->id (or all if this->id not defined)
|
||||
*
|
||||
|
||||
@ -240,7 +240,7 @@ class Members extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -105,7 +105,7 @@ class MembersTypes extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ class Subscriptions extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
@ -165,7 +165,7 @@ class Subscription extends CommonObject
|
||||
} else {
|
||||
$type = $this->fk_type;
|
||||
}
|
||||
$sql .= " VALUES (".$this->fk_adherent.", '".$this->db->escape($type)."', '".$this->db->idate($now)."',";
|
||||
$sql .= " VALUES (".((int) $this->fk_adherent).", '".$this->db->escape($type)."', '".$this->db->idate($now)."',";
|
||||
$sql .= " '".$this->db->idate($this->dateh)."',";
|
||||
$sql .= " '".$this->db->idate($this->datef)."',";
|
||||
$sql .= " ".$this->amount.",";
|
||||
@ -217,7 +217,7 @@ class Subscription extends CommonObject
|
||||
$sql .= " datef,";
|
||||
$sql .= " subscription, note, fk_bank";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."subscription";
|
||||
$sql .= " WHERE rowid=".$rowid;
|
||||
$sql .= " WHERE rowid=".((int) $rowid);
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -354,7 +354,7 @@ if ($sall) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||
}
|
||||
if ($search_type > 0) {
|
||||
$sql .= " AND t.rowid=".$db->escape($search_type);
|
||||
$sql .= " AND t.rowid=".((int) $search_type);
|
||||
}
|
||||
if ($search_filter == 'withoutsubscription') {
|
||||
$sql .= " AND (datefin IS NULL OR t.subscription = 0)";
|
||||
@ -1102,7 +1102,7 @@ while ($i < min($num, $limit)) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="nowrap left">';
|
||||
if ($obj->subscription == 'yes') {
|
||||
if (!empty($obj->subscription)) {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($obj->statut > 0) {
|
||||
print " ".img_warning();
|
||||
|
||||
@ -590,7 +590,7 @@ if ($rowid > 0) {
|
||||
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<table class="nobordernopadding">';
|
||||
print '<tr><td>';
|
||||
print $form->select_company($object->fk_soc, 'socid', '', 1);
|
||||
print '</td>';
|
||||
@ -677,7 +677,7 @@ if ($rowid > 0) {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank = b.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
|
||||
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".$rowid;
|
||||
$sql .= " WHERE d.rowid = c.fk_adherent AND d.rowid=".((int) $rowid);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -170,7 +170,7 @@ if (isset($date_select) && $date_select != '') {
|
||||
}
|
||||
if ($search_ref) {
|
||||
if (is_numeric($search_ref)) {
|
||||
$sql .= " AND (c.rowid = ".$db->escape($search_ref).")";
|
||||
$sql .= " AND c.rowid = ".((int) $search_ref);
|
||||
} else {
|
||||
$sql .= " AND 1 = 2"; // Always wrong
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -70,6 +71,7 @@ $label = GETPOST("label", "alpha");
|
||||
$morphy = GETPOST("morphy", "alpha");
|
||||
$status = GETPOST("status", "int");
|
||||
$subscription = GETPOST("subscription", "int");
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
$duration_value = GETPOST('duration_value', 'int');
|
||||
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||
$vote = GETPOST("vote", "int");
|
||||
@ -114,14 +116,15 @@ if ($cancel) {
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->amount = $amount;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (int) $vote;
|
||||
$object->vote = (int) $vote;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -164,15 +167,16 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
|
||||
|
||||
$object->oldcopy = clone $object;
|
||||
|
||||
$object->label = trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
$object->label= trim($label);
|
||||
$object->morphy = trim($morphy);
|
||||
$object->status = (int) $status;
|
||||
$object->subscription = (int) $subscription;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->amount = $amount;
|
||||
$object->duration_value = $duration_value;
|
||||
$object->duration_unit = $duration_unit;
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
@ -222,7 +226,7 @@ llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
|
||||
if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
//print dol_get_fiche_head('');
|
||||
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut as status, d.morphy";
|
||||
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.vote, d.statut as status, d.morphy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
|
||||
$sql .= " WHERE d.entity IN (".getEntity('member_type').")";
|
||||
|
||||
@ -268,6 +272,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
print '<th>'.$langs->trans("Label").'</th>';
|
||||
print '<th class="center">'.$langs->trans("MembersNature").'</th>';
|
||||
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Amount").'</th>';
|
||||
print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Status").'</th>';
|
||||
print '<th> </th>';
|
||||
@ -283,6 +288,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
$membertype->label = $objp->rowid;
|
||||
$membertype->status = $objp->status;
|
||||
$membertype->subscription = $objp->subscription;
|
||||
$membertype->amount = $objp->amount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
@ -300,6 +306,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.yn($objp->subscription).'</td>';
|
||||
print '<td class="center">'.price($objp->amount).'</td>';
|
||||
print '<td class="center">'.yn($objp->vote).'</td>';
|
||||
print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
|
||||
if ($user->rights->adherent->configurer) {
|
||||
@ -358,6 +365,10 @@ if ($action == 'create') {
|
||||
print $form->selectyesno("subscription", 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
||||
print '<input name="amount" size="5" value="'.price($amount).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
|
||||
print '</td></tr>';
|
||||
@ -434,6 +445,10 @@ if ($rowid > 0) {
|
||||
print yn($object->subscription);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
|
||||
print price($object->amount);
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print yn($object->vote);
|
||||
print '</tr>';
|
||||
@ -496,13 +511,13 @@ if ($rowid > 0) {
|
||||
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,";
|
||||
$sql .= " d.datefin,";
|
||||
$sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut as status,";
|
||||
$sql .= " t.libelle as type, t.subscription";
|
||||
$sql .= " t.libelle as type, t.subscription, t.amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid ";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND t.rowid = ".$object->id;
|
||||
$sql .= " AND t.rowid = ".((int) $object->id);
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array("f.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
|
||||
$sql .= natural_search(array("d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
|
||||
}
|
||||
if ($status != '') {
|
||||
$sql .= natural_search('d.statut', $status, 2);
|
||||
@ -702,7 +717,7 @@ if ($rowid > 0) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="nowrap left">';
|
||||
if ($objp->subscription == 'yes') {
|
||||
if (!empty($objp->subscription)) {
|
||||
print $langs->trans("SubscriptionNotReceived");
|
||||
if ($objp->status > 0) {
|
||||
print " ".img_warning();
|
||||
@ -781,6 +796,10 @@ if ($rowid > 0) {
|
||||
print $form->selectyesno("subscription", $object->subscription, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td>';
|
||||
print '<input name="amount" size="5" value="'.price($object->amount).'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
print $form->selectyesno("vote", $object->vote, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -87,7 +87,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
|
||||
if ($object->setMultiLangs($user) > 0) {
|
||||
$action = '';
|
||||
} else {
|
||||
$action = 'add';
|
||||
$action = 'create';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@ -185,7 +185,7 @@ print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action == '') {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=add&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=create&rowid='.$object->id.'">'.$langs->trans("Add").'</a>';
|
||||
if ($cnt_trans > 0) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/adherents/type_translation.php?action=edit&rowid='.$object->id.'">'.$langs->trans("Update").'</a>';
|
||||
}
|
||||
@ -208,7 +208,13 @@ if ($action == 'edit') {
|
||||
if (!empty($object->multilangs)) {
|
||||
foreach ($object->multilangs as $key => $value) {
|
||||
$s = picto_from_langcode($key);
|
||||
print '<br>'.($s ? $s.' ' : '').' <b>'.$langs->trans('Language_'.$key).':</b> <a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
|
||||
print '<br>';
|
||||
print '<div class="inline-block marginbottomonly">';
|
||||
print ($s ? $s.' ' : '').'<b>'.$langs->trans('Language_'.$key).':</b>';
|
||||
print '</div>';
|
||||
print '<div class="inline-block marginbottomonly floatright">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"')."</a><br>";
|
||||
print '</div>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
@ -231,11 +237,17 @@ if ($action == 'edit') {
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
} elseif ($action != 'add') {
|
||||
} elseif ($action != 'create') {
|
||||
if (!empty($object->multilangs)) {
|
||||
foreach ($object->multilangs as $key => $value) {
|
||||
$s = picto_from_langcode($key);
|
||||
print ($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>';
|
||||
print '<div class="inline-block marginbottomonly">';
|
||||
print ($s ? $s.' ' : '').'<b>'.$langs->trans('Language_'.$key).':</b>';
|
||||
print '</div>';
|
||||
print '<div class="inline-block marginbottomonly floatright">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'">'.img_delete('', 'class="valigntextbottom"').'</a>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
@ -244,9 +256,11 @@ if ($action == 'edit') {
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
if (!$cnt_trans && $action != 'add') {
|
||||
if (!$cnt_trans && $action != 'create') {
|
||||
print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>';
|
||||
}
|
||||
}
|
||||
@ -257,7 +271,7 @@ if ($action == 'edit') {
|
||||
* Form to add a new translation
|
||||
*/
|
||||
|
||||
if ($action == 'add' && $user->rights->adherent->configurer) {
|
||||
if ($action == 'create' && $user->rights->adherent->configurer) {
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/accountant.php
|
||||
* \ingroup accountant
|
||||
* \ingroup core
|
||||
* \brief Setup page to configure accountant / auditor
|
||||
*/
|
||||
|
||||
|
||||
68
htdocs/admin/accounting.php
Normal file
68
htdocs/admin/accounting.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/accounting.php
|
||||
* \ingroup accounting
|
||||
* \brief Setup page to configure accountanting module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'companies'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Nothing
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url = '';
|
||||
llxHeader('', $langs->trans("ConfigAccountingExpert"), $help_url);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans("ConfigAccountingExpert"), $linkback, 'title_setup');
|
||||
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Accounting").' - '.$langs->transnoentitiesnoconv("Setup"))."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -112,8 +112,11 @@ if ($action == "save" && empty($cancel)) {
|
||||
* View
|
||||
*/
|
||||
|
||||
$wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $wikihelp);
|
||||
// $wikihelp = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
|
||||
$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda';
|
||||
|
||||
llxHeader('', $langs->trans("AgendaSetup"), $help_url);
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("AgendaSetup"), $linkback, 'title_setup');
|
||||
|
||||
@ -114,8 +114,8 @@ if ($action == 'add') {
|
||||
if (empty($arrayofexistingboxid[$boxid['value']])) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||
$sql .= "box_id, position, box_order, fk_user, entity";
|
||||
$sql .= ") values (";
|
||||
$sql .= $boxid['value'].", ".$pos.", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= $boxid['value'].", ".((int) $pos).", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog("boxes.php activate box", LOG_DEBUG);
|
||||
@ -156,7 +156,7 @@ if ($action == 'delete') {
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " AND box_id=".$obj->box_id;
|
||||
$sql .= " AND box_id=".((int) $obj->box_id);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -255,7 +255,7 @@ if ($resql) {
|
||||
// We renumber the order of the boxes if one of them is in ''
|
||||
// This occurs just after an insert.
|
||||
if ($decalage) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($decalage)."' WHERE rowid=".$obj->rowid;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($decalage)."' WHERE rowid=".((int) $obj->rowid);
|
||||
$db->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -359,16 +359,16 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 0, $options);
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL0').'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 1, $options);
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL1').'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 2, $options);
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL2').'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 3, $options);
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||
print ' <= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL3').'"/> %</td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -70,8 +70,8 @@ if (!$allowed) {
|
||||
$acts = array(); $actl = array();
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset');
|
||||
$listlimit = GETPOST('listlimit') > 0 ?GETPOST('listlimit') : 1000; // To avoid too long dictionaries
|
||||
@ -1151,7 +1151,7 @@ if ($id) {
|
||||
$sql .= " WHERE 1 = 1";
|
||||
}
|
||||
if ($search_country_id > 0) {
|
||||
$sql .= " AND c.rowid = ".$search_country_id;
|
||||
$sql .= " AND c.rowid = ".((int) $search_country_id);
|
||||
}
|
||||
if ($search_code != '' && $id == 9) {
|
||||
$sql .= natural_search("code_iso", $search_code);
|
||||
|
||||
@ -322,7 +322,7 @@ class Dolistore
|
||||
$html .= '<tr class="app oddeven '.$compatible.'">
|
||||
<td class="center" width="210"><div class="newAppParent">'.$newapp.$images.'</div></td>
|
||||
<td class="margeCote"><h2 class="appTitle">'.$product->name->language[$this->lang - 1]
|
||||
.'<br/><small>'.$version.'</small></h2>
|
||||
.'<br><small>'.$version.'</small></h2>
|
||||
<small> '.dol_print_date(dol_stringtotime($product->date_upd), 'dayhour').' - '.$langs->trans('Ref').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'</small><br><br>'.$product->description_short->language[$this->lang - 1].'</td>';
|
||||
// do not load if display none
|
||||
//$html .= '<td style="display:none;" class="long_description">'.$product->description->language[$this->lang - 1].'</td>';
|
||||
|
||||
@ -66,6 +66,8 @@ $arrayofparameters = array(
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -180,15 +182,14 @@ if ($action == 'updateMask') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
//$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$page_name = "EventOrganizationSetup";
|
||||
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'eventorganization');
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
// Configuration header
|
||||
$head = eventorganizationAdminPrepareHead();
|
||||
|
||||
@ -59,12 +59,14 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url = '';
|
||||
$page_name = "EventOrganizationSetup";
|
||||
|
||||
llxHeader('', $langs->trans("EventOrganizationSetup"));
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("EventOrganizationSetup"), $linkback, 'eventorganization');
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
|
||||
$head = eventorganizationAdminPrepareHead();
|
||||
|
||||
@ -63,17 +63,19 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url = '';
|
||||
$page_name = 'EventOrganizationSetup';
|
||||
|
||||
llxHeader('', $langs->trans("EventOrganizationSetup"), $help_url);
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("EventOrganizationSetup"), $linkback, 'title_setup');
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
|
||||
$head = eventorganizationAdminPrepareHead();
|
||||
|
||||
print dol_get_fiche_head($head, 'conferenceorboothattendee_extrafields', $langs->trans("ConferenceOrBoothAttendeeExtraFields"), -1, 'account');
|
||||
print dol_get_fiche_head($head, 'conferenceorboothattendee_extrafields', $langs->trans("ConferenceOrBoothAttendeeExtraFields"), -1, 'eventorganization');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
|
||||
@ -136,7 +136,7 @@ if (GETPOST("delete")) {
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " AND box_id = ".$obj->rowid;
|
||||
$sql .= " AND box_id = ".((int) $obj->rowid);
|
||||
$resql = $db->query($sql);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
|
||||
|
||||
@ -211,11 +211,12 @@ if ($action == 'update') {
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
|
||||
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
|
||||
@ -311,8 +312,9 @@ print '<br>';
|
||||
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="otherparameters" class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th>'.$langs->trans("Miscellaneous").'</th><th></th>';
|
||||
print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
|
||||
print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("Miscellaneous").'</th>';
|
||||
print '<th></th>';
|
||||
print '<th width="20"> </tg>';
|
||||
print '</tr>';
|
||||
|
||||
@ -401,8 +403,7 @@ print '</tr>';
|
||||
|
||||
// Show bugtrack link
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
|
||||
print ajax_constantonoff("MAIN_BUGTRACK_ENABLELINK", array(), $conf->entity, 0, 0, 1, 0);
|
||||
//print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK', $conf->global->MAIN_BUGTRACK_ENABLELINK, 1);
|
||||
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" size="32" value="'.(isset($conf->global->MAIN_BUGTRACK_ENABLELINK) ? $conf->global->MAIN_BUGTRACK_ENABLELINK : '').'">';
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -441,8 +442,9 @@ print '<br>';
|
||||
|
||||
// Other
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="edit" class="noborder centpercent editmode">';
|
||||
print '<tr class="liste_titre"><th>'.$langs->trans("LoginPage").'</th><th></th>';
|
||||
print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
|
||||
print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("LoginPage").'</th>';
|
||||
print '<th></th>';
|
||||
print '<th width="20"> </th>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySet
|
||||
print "<br><br>";
|
||||
print '</span>';
|
||||
|
||||
print '<br>';
|
||||
print '<br><br>';
|
||||
|
||||
// Show info setup company
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
|
||||
|
||||
631
htdocs/admin/knowledgemanagement.php
Normal file
631
htdocs/admin/knowledgemanagement.php
Normal file
@ -0,0 +1,631 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 SuperAdmin
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file knowledgemanagement/admin/setup.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief KnowledgeManagement setup page.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--; $j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
$res = @include "../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
global $langs, $user;
|
||||
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once DOL_DOCUMENT_ROOT."/knowledgemanagement/lib/knowledgemanagement.lib.php";
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "knowledgemanagement"));
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'knowledgemanagement';
|
||||
|
||||
$arrayofparameters = array(
|
||||
'KNOWLEDGEMANAGEMENT_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>0),
|
||||
//'KNOWLEDGEMANAGEMENT_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
|
||||
//'KNOWLEDGEMANAGEMENT_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
|
||||
//'KNOWLEDGEMANAGEMENT_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
|
||||
//'KNOWLEDGEMANAGEMENT_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
|
||||
//'KNOWLEDGEMANAGEMENT_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
|
||||
);
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ((float) DOL_VERSION >= 6) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
}
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
|
||||
if ($maskconstorder) {
|
||||
$res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'specimen') {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
|
||||
$tmpobject = new $tmpobjectkey($db);
|
||||
$tmpobject->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/knowledgemanagement/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
|
||||
if (file_exists($file)) {
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound) {
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($tmpobject, $langs) > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
|
||||
return;
|
||||
} else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
} elseif ($action == 'setmod') {
|
||||
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
} elseif ($action == 'set') {
|
||||
// Activate a model
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if ($conf->global->$constforval == "$value") {
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setdoc') {
|
||||
// Set or unset default model
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->$constforval = $value;
|
||||
}
|
||||
|
||||
// We disable/enable the document template (into llx_document_model table)
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
$tmpobjectkey = GETPOST('object');
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$page_name = "KnowledgeManagementSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
// Configuration header
|
||||
$head = knowledgemanagementAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'setup', $langs->trans('ModuleKnowledgeManagementName'), -1, "knowledgemanagement");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">'.$langs->trans("KnowledgeManagementSetupPage").'</span><br><br>';
|
||||
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
$setupnotempty++;
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||
print '<span id="helplink'.$constname.'" class="spanforparamtooltip">'.$form->textwithpicto($langs->trans($constname), $tooltiphelp, 1, 'info', '', 0, 3, 'tootips'.$constname).'</span>';
|
||||
print '</td><td>';
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print '<textarea class="flat" name="'.$constname.'" id="'.$constname.'" cols="50" rows="5" wrap="soft">' . "\n";
|
||||
print $conf->global->{$constname};
|
||||
print "</textarea>\n";
|
||||
} elseif ($val['type']== 'html') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
|
||||
$doleditor->Create();
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print $form->selectyesno($constname, $conf->global->{$constname}, 1);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
|
||||
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
|
||||
$arrayofmessagename = array();
|
||||
if (is_array($formmail->lines_model)) {
|
||||
foreach ($formmail->lines_model as $modelmail) {
|
||||
//var_dump($modelmail);
|
||||
$moreonlabel = '';
|
||||
if (!empty($arrayofmessagename[$modelmail->label])) {
|
||||
$moreonlabel = ' <span class="opacitymedium">(' . $langs->trans("SeveralLangugeVariatFound") . ')</span>';
|
||||
}
|
||||
// The 'label' is the key that is unique if we exclude the language
|
||||
$arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel;
|
||||
}
|
||||
}
|
||||
print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
} elseif (preg_match('/category:/', $val['type'])) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
$formother = new FormOther($db);
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
print img_picto('', 'category', 'class="pictofixedwidth"');
|
||||
print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort'));
|
||||
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
$formcompany = new FormCompany($db);
|
||||
print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname);
|
||||
} else {
|
||||
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button button-save" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
} else {
|
||||
if (!empty($arrayofparameters)) {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $constname => $val) {
|
||||
if ($val['enabled']==1) {
|
||||
$setupnotempty++;
|
||||
print '<tr class="oddeven"><td>';
|
||||
$tooltiphelp = (($langs->trans($constname . 'Tooltip') != $constname . 'Tooltip') ? $langs->trans($constname . 'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($constname), $tooltiphelp);
|
||||
print '</td><td>';
|
||||
|
||||
if ($val['type'] == 'textarea') {
|
||||
print dol_nl2br($conf->global->{$constname});
|
||||
} elseif ($val['type']== 'html') {
|
||||
print $conf->global->{$constname};
|
||||
} elseif ($val['type'] == 'yesno') {
|
||||
print ajax_constantonoff($constname);
|
||||
} elseif (preg_match('/emailtemplate:/', $val['type'])) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
|
||||
$tmp = explode(':', $val['type']);
|
||||
|
||||
$template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname});
|
||||
if ($template<0) {
|
||||
setEventMessages(null, $formmail->errors, 'errors');
|
||||
}
|
||||
print $langs->trans($template->label);
|
||||
} elseif (preg_match('/category:/', $val['type'])) {
|
||||
$c = new Categorie($db);
|
||||
$result = $c->fetch($conf->global->{$constname});
|
||||
if ($result < 0) {
|
||||
setEventMessages(null, $c->errors, 'errors');
|
||||
}
|
||||
$ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
|
||||
$toprint = array();
|
||||
foreach ($ways as $way) {
|
||||
$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
|
||||
}
|
||||
print '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
|
||||
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
|
||||
if ($conf->global->{$constname}==2) {
|
||||
print $langs->trans("Prospect");
|
||||
} elseif ($conf->global->{$constname}==3) {
|
||||
print $langs->trans("ProspectCustomer");
|
||||
} elseif ($conf->global->{$constname}==1) {
|
||||
print $langs->trans("Customer");
|
||||
} elseif ($conf->global->{$constname}==0) {
|
||||
print $langs->trans("NorProspectNorCustomer");
|
||||
}
|
||||
} else {
|
||||
print $conf->global->{$constname};
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
} else {
|
||||
//print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$moduledir = 'knowledgemanagement';
|
||||
$myTmpObjects = array();
|
||||
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
|
||||
|
||||
|
||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
if ($myTmpObjectKey == 'MyObject') {
|
||||
continue;
|
||||
}
|
||||
if ($myTmpObjectArray['includerefgeneration']) {
|
||||
/*
|
||||
* Orders Numbering model
|
||||
*/
|
||||
$setupnotempty++;
|
||||
|
||||
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
$langs->load("errors");
|
||||
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
} elseif ($tmp == 'NotConfigured') {
|
||||
print $langs->trans($tmp);
|
||||
} else {
|
||||
print $tmp;
|
||||
}
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$mytmpinstance = new $myTmpObjectKey($db);
|
||||
$mytmpinstance->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
|
||||
$nextval = $module->getNextValue($mytmpinstance);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
|
||||
$nextval = $langs->trans($nextval);
|
||||
}
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table><br>\n";
|
||||
}
|
||||
|
||||
if ($myTmpObjectArray['includedocgeneration']) {
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
$setupnotempty++;
|
||||
$type = strtolower($myTmpObjectKey);
|
||||
|
||||
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$realpath = $reldir."core/modules/".$moduledir.$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
if (file_exists($dir.'/'.$file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs);
|
||||
} else {
|
||||
print $module->description;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.$name.'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'KNOWLEDGEMANAGEMENT_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
if ($conf->global->$constforvar == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.$name.'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf') {
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 0);
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td class="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&object='.$myTmpObjectKey.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
|
||||
} else {
|
||||
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($setupnotempty)) {
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
|
||||
// Page end
|
||||
print dol_get_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
143
htdocs/admin/knowledgerecord_extrafields.php
Normal file
143
htdocs/admin/knowledgerecord_extrafields.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file admin/knowledgerecord_extrafields.php
|
||||
* \ingroup knowledgemanagement
|
||||
* \brief Page to setup extra fields of knowledgerecord
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--; $j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
$res = @include "../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('knowledgemanagement', 'admin'));
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) {
|
||||
$type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'knowledgemanagement_knowledgerecord'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url = '';
|
||||
$page_name = 'KnowledgeManagementSetup';
|
||||
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
|
||||
$head = knowledgemanagementAdminPrepareHead();
|
||||
|
||||
print dol_get_fiche_head($head, 'extra', $langs->trans("KnowledgeRecordExtraFields"), -1, 'knowledgemanagement');
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Creation of an optional field
|
||||
*/
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/*
|
||||
* Edition of an optional field
|
||||
*/
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -719,7 +719,7 @@ if ($action == 'edit') {
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.((int) $user->id).')';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
@ -88,7 +88,7 @@ foreach ($object->fields as $key => $val) {
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array();
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if ($val['searchall']) {
|
||||
if (!empty($val['searchall'])) {
|
||||
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||
}
|
||||
}
|
||||
@ -102,7 +102,7 @@ foreach ($object->fields as $key => $val) {
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
@ -240,7 +240,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
|
||||
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||
}
|
||||
if ($object->ismultientitymanaged == 1) {
|
||||
@ -497,11 +497,11 @@ foreach ($object->fields as $key => $val) {
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], empty($search[$key]) ? '' : $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(empty($search[$key]) ? '' : $search[$key]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
@ -552,7 +552,7 @@ print '</tr>'."\n";
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine = 0;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
||||
if (preg_match('/\$object/', $val)) {
|
||||
$needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
|
||||
@ -45,16 +45,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
// Load translation files required by the page
|
||||
$langsArray=array("errors", "admin", "mails", "languages");
|
||||
|
||||
if ($conf->adherent->enabled) {
|
||||
if (!empty($conf->adherent->enabled)) {
|
||||
$langsArray[]='members';
|
||||
}
|
||||
if ($conf->eventorganization->enabled) {
|
||||
if (!empty($conf->eventorganization->enabled)) {
|
||||
$langsArray[]='eventorganization';
|
||||
}
|
||||
|
||||
$langs->loadLangs($langsArray);
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -73,8 +74,8 @@ $acts = array();
|
||||
$actl = array();
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'alpha') > 0 ?GETPOST('listlimit', 'alpha') : 1000;
|
||||
@ -181,55 +182,55 @@ $elementList = array();
|
||||
$elementList['all'] = '-- '.dol_escape_htmltag($langs->trans("All")).' --';
|
||||
$elementList['none'] = '-- '.dol_escape_htmltag($langs->trans("None")).' --';
|
||||
$elementList['user'] = img_picto('', 'user', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToUser'));
|
||||
if ($conf->adherent->enabled && $user->rights->adherent->lire) {
|
||||
if (!empty($conf->adherent->enabled) && !empty($user->rights->adherent->lire)) {
|
||||
$elementList['member'] = img_picto('', 'object_member', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToMember'));
|
||||
}
|
||||
if ($conf->recruitment->enabled && $user->rights->recruitment->recruitmentjobposition->read) {
|
||||
if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->recruitmentjobposition->read)) {
|
||||
$elementList['recruitmentcandidature_send'] = img_picto('', 'recruitmentcandidature', 'class="paddingright"').dol_escape_htmltag($langs->trans('RecruitmentCandidatures'));
|
||||
}
|
||||
if ($conf->societe->enabled && $user->rights->societe->lire) {
|
||||
if (!empty($conf->societe->enabled) && !empty($user->rights->societe->lire)) {
|
||||
$elementList['thirdparty'] = img_picto('', 'company', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToThirdparty'));
|
||||
}
|
||||
if ($conf->projet->enabled) {
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$elementList['project'] = img_picto('', 'project', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToProject'));
|
||||
}
|
||||
if ($conf->propal->enabled && $user->rights->propal->lire) {
|
||||
if (!empty($conf->propal->enabled) && !empty($user->rights->propal->lire)) {
|
||||
$elementList['propal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendProposal'));
|
||||
}
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire) {
|
||||
if (!empty($conf->commande->enabled) && !empty($user->rights->commande->lire)) {
|
||||
$elementList['order_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendOrder'));
|
||||
}
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire) {
|
||||
if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
|
||||
$elementList['facture_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendInvoice'));
|
||||
}
|
||||
if ($conf->expedition->enabled) {
|
||||
if (!empty($conf->expedition->enabled)) {
|
||||
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
|
||||
}
|
||||
if ($conf->reception->enabled) {
|
||||
if (!empty($conf->reception->enabled)) {
|
||||
$elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
|
||||
}
|
||||
if ($conf->ficheinter->enabled) {
|
||||
if (!empty($conf->ficheinter->enabled)) {
|
||||
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
|
||||
}
|
||||
if ($conf->supplier_proposal->enabled) {
|
||||
if (!empty($conf->supplier_proposal->enabled)) {
|
||||
$elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation'));
|
||||
}
|
||||
if (($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_order->enabled && $user->rights->supplier_order->lire)) {
|
||||
if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && !empty($user->rights->supplier_order->lire))) {
|
||||
$elementList['order_supplier_send'] = img_picto('', 'order', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder'));
|
||||
}
|
||||
if (($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || ($conf->supplier_invoice->enabled && $user->rights->supplier_invoice->lire)) {
|
||||
if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->supplier_invoice->lire))) {
|
||||
$elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice'));
|
||||
}
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire) {
|
||||
if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
|
||||
$elementList['contract'] = img_picto('', 'contract', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendContract'));
|
||||
}
|
||||
if ($conf->ticket->enabled && $user->rights->ticket->read) {
|
||||
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
|
||||
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
|
||||
}
|
||||
if ($conf->agenda->enabled) {
|
||||
if (!empty($conf->agenda->enabled)) {
|
||||
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
|
||||
}
|
||||
if ($conf->eventorganization->enabled && $user->rights->eventorganization->read) {
|
||||
if (!empty($conf->eventorganization->enabled) && !empty($user->rights->eventorganization->read)) {
|
||||
$elementList['eventorganization_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventOrganization'));
|
||||
}
|
||||
|
||||
@ -1002,7 +1003,7 @@ if ($resql) {
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, '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
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
@ -1015,6 +1016,7 @@ if ($resql) {
|
||||
$showfield = 1;
|
||||
$align = "";
|
||||
$class = "tddict";
|
||||
$title = '';
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
if ($value == 'label' || $value == 'topic') {
|
||||
if ($langs->trans($valuetoshow) != $valuetoshow) {
|
||||
@ -1024,11 +1026,10 @@ if ($resql) {
|
||||
}
|
||||
if ($value == 'label') {
|
||||
$class .= ' tdoverflowmax100';
|
||||
$valuetoshow = '<span title="'.$valuetoshow.'">'.$valuetoshow.'</span>';
|
||||
}
|
||||
/*if ($value == 'topic') {
|
||||
$class .= ' tdoverflowmax300';
|
||||
}*/
|
||||
if ($value == 'topic') {
|
||||
$class .= 'tdoverflowmax200 small';
|
||||
}
|
||||
if ($value == 'type_template') {
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
$align = "center";
|
||||
@ -1069,7 +1070,13 @@ if ($resql) {
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
print '<!-- '.$fieldlist[$field].' -->';
|
||||
print '<td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
print '<td class="'.$class.'"';
|
||||
if ($value == 'topic') {
|
||||
print ' title="'.$valuetoshow.'"';
|
||||
}
|
||||
print '>';
|
||||
print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1086,12 +1093,11 @@ if ($resql) {
|
||||
if ($param) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
$url .= '&';
|
||||
|
||||
// Status / Active
|
||||
print '<td class="center nowrap">';
|
||||
if ($canbedisabled) {
|
||||
print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
|
||||
print '<a href="'.$url.'&action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$actl[$obj->active].'</span>';
|
||||
}
|
||||
@ -1100,10 +1106,10 @@ if ($resql) {
|
||||
// Modify link / Delete link
|
||||
print '<td class="center nowraponall" width="64">';
|
||||
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>';
|
||||
}
|
||||
if ($iserasable) {
|
||||
print '<a class="marginleftonly" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
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>';
|
||||
@ -1178,98 +1184,98 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
foreach ($fieldlist as $field => $value) {
|
||||
if ($fieldlist[$field] == 'fk_user') {
|
||||
if ($value == 'fk_user') {
|
||||
print '<td>';
|
||||
if ($user->admin) {
|
||||
print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
print $form->select_dolusers(empty($obj->{$value}) ? '' : $obj->{$value}, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 1, '', 0, '', 'maxwidth200');
|
||||
} else {
|
||||
if ($context == 'add') { // I am not admin and we show the add form
|
||||
print $user->getNomUrl(1); // Me
|
||||
$forcedvalue = $user->id;
|
||||
} else {
|
||||
if ($obj && !empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) {
|
||||
if ($obj && !empty($obj->{$value}) && $obj->{$value} > 0) {
|
||||
$fuser = new User($db);
|
||||
$fuser->fetch($obj->{$fieldlist[$field]});
|
||||
$fuser->fetch($obj->{$value});
|
||||
print $fuser->getNomUrl(1);
|
||||
$forcedvalue = $fuser->id;
|
||||
} else {
|
||||
$forcedvalue = $obj->{$fieldlist[$field]};
|
||||
$forcedvalue = $obj->{$value};
|
||||
}
|
||||
}
|
||||
$keyname = $fieldlist[$field];
|
||||
$keyname = $value;
|
||||
print '<input type="hidden" value="'.$forcedvalue.'" name="'.$keyname.'">';
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'lang') {
|
||||
} elseif ($value == 'lang') {
|
||||
print '<td>';
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||
$selectedlang = GETPOSTISSET('langcode') ?GETPOST('langcode', 'aZ09') : $langs->defaultlang;
|
||||
if ($context == 'edit') {
|
||||
$selectedlang = $obj->{$fieldlist[$field]};
|
||||
$selectedlang = $obj->{$value};
|
||||
}
|
||||
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
|
||||
} else {
|
||||
if (!empty($obj->{$fieldlist[$field]})) {
|
||||
print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]});
|
||||
if (!empty($obj->{$value})) {
|
||||
print $obj->{$value}.' - '.$langs->trans('Language_'.$obj->{$value});
|
||||
}
|
||||
$keyname = $fieldlist[$field];
|
||||
$keyname = $value;
|
||||
if ($keyname == 'lang') {
|
||||
$keyname = 'langcode'; // Avoid conflict with lang param
|
||||
}
|
||||
print '<input type="hidden" value="'.$obj->{$fieldlist[$field]}.'" name="'.$keyname.'">';
|
||||
print '<input type="hidden" value="'.(empty($obj->{$value}) ? '' : $obj->{$value}).'" name="'.$keyname.'">';
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($fieldlist[$field] == 'type_template') {
|
||||
} elseif ($value == 'type_template') {
|
||||
// Le type de template
|
||||
print '<td class="center">';
|
||||
if ($context == 'edit' && !empty($obj->{$fieldlist[$field]}) && !in_array($obj->{$fieldlist[$field]}, array_keys($elementList))) {
|
||||
if ($context == 'edit' && !empty($obj->{$value}) && !in_array($obj->{$value}, array_keys($elementList))) {
|
||||
// Current template type is an unknown type, so we must keep it as it is.
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
|
||||
print $obj->{$fieldlist[$field]};
|
||||
print '<input type="hidden" name="type_template" value="'.$obj->{$value}.'">';
|
||||
print $obj->{$value};
|
||||
} else {
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1, '', 0, 1);
|
||||
print $form->selectarray('type_template', $elementList, (!empty($obj->{$value}) ? $obj->{$value}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1, '', 0, 1);
|
||||
}
|
||||
print '</td>';
|
||||
} elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
} elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
continue;
|
||||
} elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
} elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
continue;
|
||||
} elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
} elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
|
||||
continue;
|
||||
} else {
|
||||
$size = ''; $class = ''; $classtd = '';
|
||||
if ($fieldlist[$field] == 'code') {
|
||||
if ($value == 'code') {
|
||||
$class = 'maxwidth100';
|
||||
}
|
||||
if ($fieldlist[$field] == 'label') {
|
||||
if ($value == 'label') {
|
||||
$class = 'maxwidth200';
|
||||
}
|
||||
if ($fieldlist[$field] == 'private') {
|
||||
if ($value == 'private') {
|
||||
$class = 'maxwidth50'; $classtd = 'center';
|
||||
}
|
||||
if ($fieldlist[$field] == 'position') {
|
||||
if ($value == 'position') {
|
||||
$class = 'maxwidth50'; $classtd = 'center';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle') {
|
||||
if ($value == 'libelle') {
|
||||
$class = 'quatrevingtpercent';
|
||||
}
|
||||
if ($fieldlist[$field] == 'topic') {
|
||||
if ($value == 'topic') {
|
||||
$class = 'quatrevingtpercent';
|
||||
}
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') {
|
||||
if ($value == 'sortorder' || $value == 'sens' || $value == 'category_type') {
|
||||
$size = 'size="2" ';
|
||||
}
|
||||
|
||||
print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
|
||||
if ($fieldlist[$field] == 'private') {
|
||||
if ($value == 'private') {
|
||||
if (empty($user->admin)) {
|
||||
print $form->selectyesno($fieldlist[$field], '1', 1);
|
||||
print $form->selectyesno($value, '1', 1);
|
||||
} else {
|
||||
//print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="1" name="'.$fieldlist[$field].'">';
|
||||
print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1);
|
||||
}
|
||||
} else {
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$value}) ? $obj->{$value}:'').'" name="'. $value .'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -520,9 +520,11 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
|
||||
$moreforfilter = '<div class="valignmiddle">';
|
||||
|
||||
$moreforfilter .= '<div class="floatright right pagination"><ul><li>';
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'common' ? '' : ' btnTitleSelected')));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition'.($mode == 'commonkanban' ? '' : ' btnTitleSelected')));
|
||||
$moreforfilter .= '<div class="floatright right pagination --module-list"><ul><li>';
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitleSeparator();
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$moreforfilter .= '</li></ul></div>';
|
||||
|
||||
//$moreforfilter .= '<div class="floatright center marginrightonly hideonsmartphone" style="padding-top: 3px"><span class="paddingright">'.$moreinfo.'</span> '.$moreinfo2.'</div>';
|
||||
@ -582,8 +584,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
|
||||
// Show list of modules
|
||||
$oldfamily = '';
|
||||
$foundoneexternalmodulewithupdate = 0;
|
||||
$linenum = 0;
|
||||
|
||||
foreach ($orders as $key => $value) {
|
||||
$linenum++;
|
||||
$tab = explode('_', $value);
|
||||
@ -591,6 +593,8 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$module_position = $tab[2];
|
||||
|
||||
$modName = $filename[$key];
|
||||
|
||||
/** @var DolibarrModules $objMod */
|
||||
$objMod = $modules[$modName];
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->version."<br>";
|
||||
@ -719,6 +723,22 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
$versiontrans .= $objMod->getVersion(1);
|
||||
}
|
||||
|
||||
if ($objMod->isCoreOrExternalModule() == 'external'
|
||||
&& (
|
||||
$action == 'checklastversion'
|
||||
// This is a bad practice to activate a synch external access during building of a page. 1 external module can hang the application.
|
||||
// Adding a cron job could be a good idea see DolibarrModules::checkForUpdate()
|
||||
|| !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
|
||||
)
|
||||
) {
|
||||
$checkRes = $objMod->checkForUpdate();
|
||||
if ($checkRes > 0) {
|
||||
setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion);
|
||||
} elseif ($checkRes < 0) {
|
||||
setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings');
|
||||
}
|
||||
}
|
||||
|
||||
// Define imginfo
|
||||
$imginfo = "info";
|
||||
if ($objMod->isCoreOrExternalModule() == 'external') {
|
||||
@ -893,17 +913,12 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
|
||||
// Version
|
||||
print '<td class="center nowrap" width="120px">';
|
||||
print $versiontrans;
|
||||
if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) { // This is a bad practice to activate a synch external access during building of a page. 1 external module can hang the application.
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
|
||||
if (!empty($objMod->url_last_version)) {
|
||||
$newversion = getURLContent($objMod->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only
|
||||
if (isset($newversion['content'])) {
|
||||
if (version_compare($newversion['content'], $versiontrans) > 0) {
|
||||
print " <span class='butAction' title='".$langs->trans('LastStableVersion')."'>".$newversion['content']."</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objMod->needUpdate) {
|
||||
$versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
|
||||
print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
|
||||
$foundoneexternalmodulewithupdate++;
|
||||
} else {
|
||||
print $versiontrans;
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
@ -921,6 +936,14 @@ if ($mode == 'common' || $mode == 'commonkanban') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'checklastversion') {
|
||||
if ($foundoneexternalmodulewithupdate) {
|
||||
setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldfamily) {
|
||||
if ($mode == 'commonkanban') {
|
||||
print '</div>';
|
||||
|
||||
@ -156,8 +156,9 @@ if ($resql) {
|
||||
$form = new Form($db);
|
||||
|
||||
$page_name = "MultiCurrencySetup";
|
||||
$help_url = '';
|
||||
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
@ -165,7 +166,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||
|
||||
// Configuration header
|
||||
$head = multicurrencyAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurrency");
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "multicurrency");
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
@ -303,7 +304,7 @@ print '<input type="hidden" name="action" value="add_currency">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>';
|
||||
print '<td class="right">';
|
||||
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('Rate').'" /> ';
|
||||
print '<input type="text" name="rate" value="" class="width75 right" placeholder="'.$langs->trans('Rate').'" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -328,7 +329,7 @@ foreach ($TCurrency as &$currency) {
|
||||
print '<input type="hidden" name="action" value="update_currency">';
|
||||
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
|
||||
print '1 '.$conf->currency.' = ';
|
||||
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" /> '.$currency->code.' ';
|
||||
print '<input type="text" name="rate" class="width75 right" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13"> '.$currency->code.' ';
|
||||
print '<input type="submit" name="updatecurrency" class="button" value="'.$langs->trans("Modify").'"> ';
|
||||
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '</form>';
|
||||
|
||||
@ -243,7 +243,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$elementLabel = $langs->trans('Intervention');
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$elementLabel = $langs->trans('Shipping');
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
|
||||
$elementLabel = $langs->trans('ExpenseReport');
|
||||
}
|
||||
|
||||
@ -271,6 +271,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
|
||||
$helptext = '';
|
||||
form_constantes($constantes, 3, $helptext);
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
|
||||
} else {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -300,7 +302,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$elementLabel = $langs->trans('Intervention');
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$elementLabel = $langs->trans('Shipping');
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
|
||||
$elementLabel = $langs->trans('ExpenseReport');
|
||||
}
|
||||
|
||||
@ -316,7 +318,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
print '<div class="opacitymedium">';
|
||||
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -343,28 +351,38 @@ print "</tr>\n";
|
||||
foreach ($listofnotifiedevents as $notifiedevent) {
|
||||
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
$elementPicto = $notifiedevent['elementtype'];
|
||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||
// Special cases
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||
$elementPicto = 'supplier_order';
|
||||
$elementLabel = $langs->trans('SupplierOrder');
|
||||
} elseif ($notifiedevent['elementtype'] == 'propal') {
|
||||
$elementLabel = $langs->trans('Proposal');
|
||||
} elseif ($notifiedevent['elementtype'] == 'facture') {
|
||||
$elementPicto = 'bill';
|
||||
$elementLabel = $langs->trans('Bill');
|
||||
} elseif ($notifiedevent['elementtype'] == 'commande') {
|
||||
$elementPicto = 'order';
|
||||
$elementLabel = $langs->trans('Order');
|
||||
} elseif ($notifiedevent['elementtype'] == 'ficheinter') {
|
||||
$elementPicto = 'intervention';
|
||||
$elementLabel = $langs->trans('Intervention');
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$elementPicto = 'shipment';
|
||||
$elementLabel = $langs->trans('Shipping');
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
|
||||
$elementPicto = 'expensereport';
|
||||
$elementLabel = $langs->trans('ExpenseReport');
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$elementLabel.'</td>';
|
||||
print '<td>';
|
||||
print img_picto('', $elementPicto, 'class="pictofixedwidth"');
|
||||
print $elementLabel;
|
||||
print '</td>';
|
||||
print '<td>'.$notifiedevent['code'].'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td><span class="opacitymedium">'.$label.'</span></td>';
|
||||
print '<td>';
|
||||
// Notification with threshold
|
||||
foreach ($conf->global as $key => $val) {
|
||||
@ -417,14 +435,6 @@ foreach ($listofnotifiedevents as $notifiedevent) {
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<div class="opacitymedium">';
|
||||
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
@ -189,7 +189,7 @@ foreach ($dirmodels as $reldir) {
|
||||
if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmo&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks'));
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@ -161,6 +161,10 @@ if (class_exists('TCPDI')) {
|
||||
|
||||
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
|
||||
|
||||
$head = pdf_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'general', $langs->trans("PDF"), -1, 'pdf');
|
||||
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFDesc"), $s)."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
@ -178,7 +182,7 @@ print load_fiche_titre($langs->trans("DictionaryPaperFormat"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
$selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
|
||||
if (empty($selected)) {
|
||||
@ -215,12 +219,16 @@ print load_fiche_titre($langs->trans("PDFAddressForging"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Hide VAT Intra on address
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
|
||||
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (!empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) ? $conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS', (!empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS)) ? $conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Show prof id in address into pdf
|
||||
@ -236,7 +244,11 @@ for ($i = 1; $i <= 6; $i++) {
|
||||
if ($pid) {
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
|
||||
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
|
||||
print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff($keyforconstant);
|
||||
} else {
|
||||
print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -254,16 +266,24 @@ $text = '';
|
||||
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
|
||||
if ($mysoc->useLocalTax(1)) {
|
||||
$locales = $langs->transcountry("LT1", $mysoc->country_code);
|
||||
$text = '<tr class="oddeven"><td>'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).'</td><td>';
|
||||
$text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
|
||||
$text = '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_SECOND_TAX');
|
||||
} else {
|
||||
$text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_SECOND_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_SECOND_TAX : 0, 1);
|
||||
}
|
||||
$text .= '</td></tr>';
|
||||
}
|
||||
|
||||
if ($mysoc->useLocalTax(2)) {
|
||||
$locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code);
|
||||
|
||||
$text .= '<tr class="oddeven"><td>'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).'</td><td>';
|
||||
$text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
|
||||
$text .= '<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT2", $mysoc->country_code)).'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
$text .= ajax_constantonoff('MAIN_PDF_MAIN_HIDE_THIRD_TAX');
|
||||
} else {
|
||||
$text .= $form->selectyesno('MAIN_PDF_MAIN_HIDE_THIRD_TAX', (!empty($conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX)) ? $conf->global->MAIN_PDF_MAIN_HIDE_THIRD_TAX : 0, 1);
|
||||
}
|
||||
$text .= '</td></tr>';
|
||||
}
|
||||
}
|
||||
@ -273,15 +293,20 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
|
||||
$title .= ' - '.$langs->trans("PDFLocaltax", $locales);
|
||||
}
|
||||
|
||||
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Hide any information on Sale tax / VAT
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Locataxes
|
||||
@ -317,13 +342,21 @@ if (!empty($conf->projet->enabled)) {
|
||||
//Invert sender and recipient
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_INVERT_SENDER_RECIPIENT');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (!empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) ? $conf->global->MAIN_INVERT_SENDER_RECIPIENT : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Place customer adress to the ISO location
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
|
||||
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_USE_ISO_LOCATION');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION', (!empty($conf->global->MAIN_PDF_USE_ISO_LOCATION)) ? $conf->global->MAIN_PDF_USE_ISO_LOCATION : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Use 2 languages into PDF
|
||||
@ -341,25 +374,41 @@ print '</td></tr>';
|
||||
//Desc
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DESC');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Ref
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_REF');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Details
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS');
|
||||
} else {
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits.
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SHOW_SUBPRODUCT_REF_IN_PDF", $langs->transnoentitiesnoconv("AssociatedProductsAbility"), $langs->transnoentitiesnoconv("Products")).'</td><td>';
|
||||
print $form->selectyesno('SHOW_SUBPRODUCT_REF_IN_PDF', (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) ? $conf->global->SHOW_SUBPRODUCT_REF_IN_PDF : 0, 1);
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('SHOW_SUBPRODUCT_REF_IN_PDF');
|
||||
} else {
|
||||
print $form->selectyesno('SHOW_SUBPRODUCT_REF_IN_PDF', (!empty($conf->global->SHOW_SUBPRODUCT_REF_IN_PDF)) ? $conf->global->SHOW_SUBPRODUCT_REF_IN_PDF : 0, 1);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Show more details in footer
|
||||
|
||||
125
htdocs/admin/pdf_other.php
Normal file
125
htdocs/admin/pdf_other.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2021 Anthony Berton <bertonanthony@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/pdf.php
|
||||
* \brief Page to setup PDF options
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'stocks', 'Trips'));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'update') {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup');
|
||||
|
||||
$head = pdf_admin_prepare_head();
|
||||
|
||||
print dol_get_fiche_head($head, 'other', $langs->trans("other"), -1, 'pdf');
|
||||
|
||||
print '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFOtherDesc"), $s)."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("Proposal"), '', '');
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table summary="more" class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_GENERATE_PROPOSALS_WITH_PICTURE").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_GENERATE_PROPOSALS_WITH_PICTURE');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_GENERATE_PROPOSALS_WITH_PICTURE", $arrval, $conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING").'</td><td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING", $arrval, $conf->global->MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button button-save" type="submit" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -431,7 +431,9 @@ if ($mode == 'template' && $user->admin) {
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td>';
|
||||
print '<div class="center"><input type="submit" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||
print '<td>'.dol_htmlentitiesbr($printer->listprinterstemplates[$line]['template']).'</td>';
|
||||
@ -459,18 +461,15 @@ if ($mode == 'template' && $user->admin) {
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
|
||||
print '</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -71,7 +71,7 @@ if ($action == 'activate_encrypt') {
|
||||
if (dol_hash($obj->pass)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " SET pass_crypted = '".dol_hash($obj->pass)."', pass = NULL";
|
||||
$sql .= " WHERE rowid=".$obj->rowid;
|
||||
$sql .= " WHERE rowid=".((int) $obj->rowid);
|
||||
//print $sql;
|
||||
|
||||
$resql2 = $db->query($sql);
|
||||
@ -394,18 +394,18 @@ print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
|
||||
print '<td align="center" width="60">';
|
||||
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
|
||||
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
}
|
||||
print '</td>';
|
||||
if (!$conf->global->DATABASE_PWD_ENCRYPTED) {
|
||||
if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Database conf file encryption
|
||||
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) {
|
||||
if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
|
||||
print '<td align="center" width="100">';
|
||||
if ($allow_disable_encryption) {
|
||||
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes
|
||||
@ -453,16 +453,16 @@ print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").'</td>';
|
||||
print '<td align="center" width="60">';
|
||||
if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) {
|
||||
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
}
|
||||
print '</td>';
|
||||
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) {
|
||||
if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) {
|
||||
if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
|
||||
print '<td align="center" width="100">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
|
||||
print "</td>";
|
||||
@ -481,8 +481,8 @@ if (GETPOST('info', 'int') > 0) {
|
||||
} else {
|
||||
print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n";
|
||||
}
|
||||
print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."<br>\n";
|
||||
print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."<br>\n";
|
||||
print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO')."<br>\n";
|
||||
print 'MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT')."<br>\n";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -139,8 +139,8 @@ if (preg_match('/[a-z]+/i', $version)) {
|
||||
}
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'</td></tr>'."\n";
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -110,7 +110,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
|
||||
print '<!-- for a local check target=local&xmlshortfile=... -->'."\n";
|
||||
if (dol_is_file($xmlfile)) {
|
||||
print '<input type="radio" name="target" value="local"'.((!GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"' : '').'"> '.$langs->trans("LocalSignature").' = ';
|
||||
print '<input type="radio" name="target" id="checkboxlocal" value="local"'.((!GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"' : '').'"> <label for="checkboxlocal">'.$langs->trans("LocalSignature").'</label> = ';
|
||||
print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'">';
|
||||
print '<br>';
|
||||
} else {
|
||||
@ -121,10 +121,10 @@ if (dol_is_file($xmlfile)) {
|
||||
}
|
||||
print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
|
||||
if ($enableremotecheck) {
|
||||
print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> '.$langs->trans("RemoteSignature").' = ';
|
||||
print '<input type="radio" name="target" id="checkboxremote" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> <label for="checkboxremote">'.$langs->trans("RemoteSignature").'</label> = ';
|
||||
print '<input name="xmlremote" class="flat minwidth400" value="'.dol_escape_htmltag($xmlremote).'"><br>';
|
||||
} else {
|
||||
print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.$xmlremote;
|
||||
print '<input type="radio" name="target" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.dol_escape_htmltag($xmlremote);
|
||||
if (!GETPOST('xmlremote')) {
|
||||
print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>';
|
||||
}
|
||||
@ -156,7 +156,7 @@ if (GETPOST('target') == 'local') {
|
||||
}
|
||||
}
|
||||
if (GETPOST('target') == 'remote') {
|
||||
$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only
|
||||
$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into api_setup.class.php.
|
||||
|
||||
// Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
||||
@ -164,7 +164,7 @@ if (GETPOST('target') == 'remote') {
|
||||
//print "xmlfilestart".$xmlfile."xmlfileend";
|
||||
$xml = simplexml_load_string($xmlfile);
|
||||
} else {
|
||||
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
|
||||
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
|
||||
setEventMessages($errormsg, null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
if (!$user->admin) {
|
||||
if (empty($user->admin)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ foreach ($modules as $key => $module) {
|
||||
$newModule->name = $module->getName();
|
||||
$newModule->version = $module->getVersion();
|
||||
$newModule->id = $key;
|
||||
$newModule->module_position = $module->module_position;
|
||||
$newModule->module_position = $module->getModulePosition();
|
||||
|
||||
$alt = $module->name.' - '.$modules_files[$key];
|
||||
|
||||
@ -164,17 +164,17 @@ foreach ($modules as $key => $module) {
|
||||
$newModule->permission = $permission;
|
||||
|
||||
// pre-filter list
|
||||
if ($search_name && !stristr($newModule->name, $search_name)) {
|
||||
if (!empty($search_name) && !stristr($newModule->name, $search_name)) {
|
||||
continue;
|
||||
}
|
||||
if ($search_version && !stristr($newModule->version, $search_version)) {
|
||||
if (!empty($search_version) && !stristr($newModule->version, $search_version)) {
|
||||
continue;
|
||||
}
|
||||
if ($search_id && !stristr($newModule->id, $search_id)) {
|
||||
if (!empty($search_id) && !stristr($newModule->id, $search_id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($search_permission) {
|
||||
if (!empty($search_permission)) {
|
||||
$found = false;
|
||||
|
||||
foreach ($newModule->permission as $permission) {
|
||||
@ -211,7 +211,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans("AvailableModules"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $massactionbutton, -1, '', 'title_setup', 0, '', '', 0, 1, 1);
|
||||
print_barre_liste($langs->trans("AvailableModules"), empty($page) ? 0 : $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', 'title_setup', 0, '', '', 0, 1, 1);
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ToActivateModule").'</span>';
|
||||
print '<br>';
|
||||
@ -324,7 +324,7 @@ foreach ($moduleList as $module) {
|
||||
}
|
||||
|
||||
if ($arrayfields['version']['checked']) {
|
||||
print '<td>'.$module->version.'</td>';
|
||||
print '<td class="nowraponall">'.$module->version.'</td>';
|
||||
}
|
||||
|
||||
if ($arrayfields['id']['checked']) {
|
||||
|
||||
@ -128,32 +128,13 @@ if ($test) {
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
|
||||
|
||||
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
|
||||
if (empty($dolibarr_main_prod)) {
|
||||
print ' '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<strong>'.$langs->trans("dolibarr_nocsrfcheck").'</strong>: '.$dolibarr_nocsrfcheck;
|
||||
if (!empty($dolibarr_nocsrfcheck)) {
|
||||
print img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<strong>'.$langs->trans("dolibarr_main_restrict_ip").'</strong>: '.$dolibarr_main_restrict_ip;
|
||||
/*if (empty($dolibarr_main_restrict_ip)) {
|
||||
print ' '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
|
||||
}*/
|
||||
print '<br>';
|
||||
// OS Permissions
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("PermissionsOnFiles"), '', 'folder');
|
||||
print load_fiche_titre($langs->trans("OSSetup").' - '.$langs->trans("PermissionsOnFiles"), '', 'folder');
|
||||
|
||||
print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
|
||||
$arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/custom'), 'name', SORT_ASC, 4, 1, '', 1);
|
||||
@ -205,48 +186,49 @@ if ($perms) {
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// File conf.php
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("Modules"), '', 'folder');
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("ConfigurationFile").' ('.$conffile.')', '', 'folder');
|
||||
|
||||
// Module log
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test = empty($conf->syslog->enabled);
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
|
||||
} else {
|
||||
if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("Syslog"));
|
||||
} else {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
|
||||
}
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
print '<strong>$dolibarr_main_prod</strong>: '.$dolibarr_main_prod;
|
||||
if (empty($dolibarr_main_prod)) {
|
||||
print ' '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module debugbar
|
||||
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
|
||||
$test = empty($conf->debugbar->enabled);
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
|
||||
} else {
|
||||
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 '<strong>$dolibarr_nocsrfcheck</strong>: '.$dolibarr_nocsrfcheck;
|
||||
if (!empty($dolibarr_nocsrfcheck)) {
|
||||
print img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<strong>$dolibarr_main_restrict_ip</strong>: ';
|
||||
if (empty($dolibarr_main_restrict_ip)) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("None").'</span>';
|
||||
//print ' <span class="opacitymedium">('.$langs->trans("RecommendedValueIs", $langs->transnoentitiesnoconv("IPsOfUsers")).')</span>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Menu security
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
|
||||
|
||||
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
|
||||
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? $langs->trans("Undefined") : '')." ";
|
||||
print '<span class="opacitymedium"> If unset: \'md5\'</span><br>';
|
||||
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_HASH_ALGO)." ";
|
||||
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
|
||||
print '<span class="opacitymedium"> If unset: \'md5\'</span>';
|
||||
}
|
||||
print '<br>';
|
||||
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
|
||||
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? $langs->trans("Undefined") : $conf->global->MAIN_SECURITY_SALT).'<br>';
|
||||
print '<strong>MAIN_SECURITY_SALT</strong> = '.(empty($conf->global->MAIN_SECURITY_SALT) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_SALT).'<br>';
|
||||
}
|
||||
if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
|
||||
print '<div class="info">The recommanded value for MAIN_SECURITY_HASH_ALGO is now \'password_hash\' but setting it now will make ALL existing passwords of all users not valid, so update is not possible.<br>';
|
||||
@ -258,6 +240,11 @@ if ($conf->global->MAIN_SECURITY_HASH_ALGO != 'password_hash') {
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<strong>MAIN_SECURITY_ANTI_SSRF_SERVER_IP</strong> = '.(empty($conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->MAIN_SECURITY_ANTI_SSRF_SERVER_IP)."<br>";
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<strong>'.$langs->trans("AntivirusEnabledOnUpload").'</strong>: ';
|
||||
print empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ? '' : img_picto('', 'tick').' ';
|
||||
print yn($conf->global->MAIN_ANTIVIRUS_COMMAND ? 1 : 0);
|
||||
@ -268,7 +255,6 @@ if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
|
||||
}
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
$securityevent = new Events($db);
|
||||
@ -291,11 +277,69 @@ if (!empty($eventstolog) && is_array($eventstolog)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
print '<br>';
|
||||
} else {
|
||||
print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Audit"));
|
||||
print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Audit")).'<br>';
|
||||
}
|
||||
|
||||
|
||||
// Modules/Applications
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("Modules"), '', 'folder');
|
||||
|
||||
// Module log
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test = empty($conf->syslog->enabled);
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
|
||||
} else {
|
||||
if ($conf->global->SYSLOG_LEVEL > LOG_NOTICE) {
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedWithTooHighLogLevel", $langs->transnoentities("Syslog"));
|
||||
} else {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), $conf->global->SYSLOG_LEVEL);
|
||||
}
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module debugbar
|
||||
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
|
||||
$test = empty($conf->debugbar->enabled);
|
||||
if ($test) {
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
|
||||
} else {
|
||||
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 '<br>';
|
||||
|
||||
|
||||
// APIs
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("API"), '', 'folder');
|
||||
|
||||
if (empty($conf->api->enabled) && empty($conf->webservices->enabled)) {
|
||||
print $langs->trans("APIsAreNotEnabled");
|
||||
} else {
|
||||
if (!empty($conf->webservices->enabled)) {
|
||||
print $langs->trans('YouEnableDeprecatedWSAPIsUseRESTAPIsInstead')."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
if (!empty($conf->api->enabled)) {
|
||||
print '<strong>API_ENDPOINT_RULES</strong> = '.(empty($conf->global->API_ENDPOINT_RULES) ? '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>' : $conf->global->API_ENDPOINT_RULES)."<br>\n";
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -260,7 +260,7 @@ print "<br>\n";
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="button">';
|
||||
print '<br/><br/>';
|
||||
print '<br><br>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -239,7 +239,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<label for="checkbox_use_quick">';
|
||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||
print '</label>';
|
||||
print '<br/>';
|
||||
print '<br>';
|
||||
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
|
||||
@ -289,7 +289,7 @@ if ($mode == 'overwrite') {
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit ? 1 : 0, 'maxwidthonsmartphone', 1);
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit ? 1 : 0, 'maxwidth250', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey) ? $transkey : "").'">';
|
||||
@ -338,7 +338,7 @@ if ($mode == 'overwrite') {
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<td class="small">';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
@ -482,7 +482,7 @@ if ($mode == 'searchkey') {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
@ -529,7 +529,7 @@ if ($mode == 'searchkey') {
|
||||
if ($i > ($offset + $limit)) {
|
||||
break;
|
||||
}
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td class="small">';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</td><td class="right nowraponall">';
|
||||
if (!empty($newlangfileonly->tab_translate[$key])) {
|
||||
|
||||
@ -48,8 +48,8 @@ if (!$user->admin) {
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on', 'class="size15x"');
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -490,6 +490,9 @@ if ($id) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isset($obj->position)) {
|
||||
$obj->position = 1;
|
||||
}
|
||||
|
||||
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'add');
|
||||
|
||||
@ -499,8 +502,6 @@ if ($id) {
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -33,11 +33,6 @@ require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php';
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "workstation"));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
@ -52,14 +47,19 @@ $value = GETPOST('value', 'alpha');
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ((float) DOL_VERSION >= 6) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconstorder = GETPOST('maskconstWorkstation', 'alpha');
|
||||
@ -157,19 +157,19 @@ if ($action == 'updateMask') {
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$help_url = '';
|
||||
$page_name = "WorkstationSetup";
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
llxHeader('', $langs->trans($page_name), $help_url);
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_workstation@workstation');
|
||||
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||
|
||||
// Configuration header
|
||||
$head = workstationAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', '', -1, "workstation@workstation");
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "workstation");
|
||||
|
||||
// Setup page goes here
|
||||
//echo '<span class="opacitymedium">'.$langs->trans("WorkstationSetupPage").'</span><br><br>';
|
||||
|
||||
@ -72,23 +72,27 @@ class DolibarrApi
|
||||
//$this->r->setSupportedFormats('jsonFormat');
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Executed method when API is called without parameter
|
||||
* Check and convert a string depending on its type/name.
|
||||
*
|
||||
* Display a short message an return a http code 200
|
||||
*
|
||||
* @return array
|
||||
* @param string $field Field name
|
||||
* @param string $value Value to check/clean
|
||||
* @param stdClass $object Object
|
||||
* @return string Value cleaned
|
||||
*/
|
||||
/* Disabled, most APIs does not share same signature for method index
|
||||
function index()
|
||||
protected function _checkValForAPI($field, $value, $object)
|
||||
{
|
||||
return array(
|
||||
'success' => array(
|
||||
'code' => 200,
|
||||
'message' => __class__.' is up and running!'
|
||||
)
|
||||
);
|
||||
}*/
|
||||
// phpcs:enable
|
||||
// TODO Use type detected in $object->fields
|
||||
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
|
||||
return checkVal($value, 'restricthtml');
|
||||
} else {
|
||||
return checkVal($value, 'alphanohtml');
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
@ -305,8 +309,9 @@ class DolibarrApi
|
||||
/**
|
||||
* Function to forge a SQL criteria
|
||||
*
|
||||
* @param array $matches Array of found string by regex search. Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.nature:is:NULL"
|
||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||
* @param array $matches Array of found string by regex search.
|
||||
* Example: "t.ref:like:'SO-%'" or "t.date_creation:<:'20160101'" or "t.date_creation:<:'2016-01-01 12:30:00'" or "t.nature:is:NULL"
|
||||
* @return string Forged criteria. Example: "t.field like 'abc%'"
|
||||
*/
|
||||
protected static function _forge_criteria_callback($matches)
|
||||
{
|
||||
@ -317,18 +322,26 @@ class DolibarrApi
|
||||
if (empty($matches[1])) {
|
||||
return '';
|
||||
}
|
||||
$tmp = explode(':', $matches[1]);
|
||||
$tmp = explode(':', $matches[1], 3);
|
||||
|
||||
if (count($tmp) < 3) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tmpescaped = $tmp[2];
|
||||
$operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0]));
|
||||
|
||||
$operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1])));
|
||||
|
||||
$tmpescaped = trim($tmp[2]);
|
||||
$regbis = array();
|
||||
if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||
if ($operator == 'IN') {
|
||||
$tmpescaped = "(".$db->sanitize($tmpescaped, 1).")";
|
||||
} elseif (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) {
|
||||
$tmpescaped = "'".$db->escape($regbis[1])."'";
|
||||
} else {
|
||||
$tmpescaped = $db->escape($tmpescaped);
|
||||
$tmpescaped = $db->sanitize($db->escape($tmpescaped));
|
||||
}
|
||||
return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped;
|
||||
|
||||
return $db->escape($operand).' '.$db->escape($operator)." ".$tmpescaped;
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,13 @@ class Login
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
global $db;
|
||||
global $conf, $db;
|
||||
$this->db = $db;
|
||||
|
||||
//$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1;
|
||||
if (!empty($conf->global->MAIN_MODULE_API_LOGIN_DISABLED)) {
|
||||
throw new RestException(403, "Error login APIs are disabled. You must get the token from backoffice to be able to use APIs");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,6 +57,28 @@ class Login
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @url GET /
|
||||
*/
|
||||
public function loginUnsecured($login, $password, $entity = '', $reset = 0)
|
||||
{
|
||||
return $this->index($login, $password, $entity, $reset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Login
|
||||
*
|
||||
* Request the API token for a couple username / password.
|
||||
* Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass into server log file).
|
||||
* Both methods are provided for developer conveniance. Best is to not use at all the login API method and enter directly the "DOLAPIKEY" into field at the top right of page. Note: The API token (DOLAPIKEY) can be found/set on the user page.
|
||||
*
|
||||
* @param string $login User login
|
||||
* @param string $password User password
|
||||
* @param string $entity Entity (when multicompany module is used). '' means 1=first company.
|
||||
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
||||
* @return array Response status and user token
|
||||
*
|
||||
* @throws RestException 403 Access denied
|
||||
* @throws RestException 500 System error
|
||||
*
|
||||
* @url POST /
|
||||
*/
|
||||
public function index($login, $password, $entity = '', $reset = 0)
|
||||
|
||||
@ -79,7 +79,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -206,7 +206,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -270,7 +270,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -660,7 +660,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -723,7 +723,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -790,7 +790,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -852,7 +852,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -924,7 +924,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -994,7 +994,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1067,7 +1067,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1131,7 +1131,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1189,7 +1189,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1248,7 +1248,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1313,7 +1313,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1371,7 +1371,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1429,7 +1429,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1489,7 +1489,7 @@ class Setup extends DolibarrApi
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -1631,8 +1631,8 @@ class Setup extends DolibarrApi
|
||||
global $langs, $conf;
|
||||
|
||||
if (!DolibarrApiAccess::$user->admin
|
||||
&& (empty($conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK)) {
|
||||
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGIN_ALLOWED_FOR_INTEGRITY_CHECK');
|
||||
&& (empty($conf->global->API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK) || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK)) {
|
||||
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_INTEGRITY_CHECK');
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
@ -1661,10 +1661,14 @@ class Setup extends DolibarrApi
|
||||
if (empty($xmlremote)) {
|
||||
$xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
|
||||
}
|
||||
if ($xmlremote && !preg_match('/^https?:\/\//', $xmlremote)) {
|
||||
if ($xmlremote && !preg_match('/^https?:\/\//i', $xmlremote)) {
|
||||
$langs->load("errors");
|
||||
throw new RestException(500, $langs->trans("ErrorURLMustStartWithHttp", $xmlremote));
|
||||
}
|
||||
if ($xmlremote && !preg_match('/\.xml$/', $xmlremote)) {
|
||||
$langs->load("errors");
|
||||
throw new RestException(500, $langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'));
|
||||
}
|
||||
|
||||
if ($target == 'local') {
|
||||
if (dol_is_file($xmlfile)) {
|
||||
@ -1673,7 +1677,7 @@ class Setup extends DolibarrApi
|
||||
throw new RestException(500, $langs->trans('XmlNotFound').': '.$xmlfile);
|
||||
}
|
||||
} else {
|
||||
$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only
|
||||
$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into filecheck.php.
|
||||
|
||||
// Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
|
||||
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
|
||||
@ -1681,7 +1685,7 @@ class Setup extends DolibarrApi
|
||||
//print "xmlfilestart".$xmlfile."endxmlfile";
|
||||
$xml = simplexml_load_string($xmlfile);
|
||||
} else {
|
||||
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
|
||||
$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
|
||||
throw new RestException(500, $errormsg);
|
||||
}
|
||||
}
|
||||
@ -1933,8 +1937,8 @@ class Setup extends DolibarrApi
|
||||
global $conf;
|
||||
|
||||
if (!DolibarrApiAccess::$user->admin
|
||||
&& (empty($conf->global->API_LOGIN_ALLOWED_FOR_GET_MODULES) || DolibarrApiAccess::$user->login != $conf->global->API_LOGIN_ALLOWED_FOR_GET_MODULES)) {
|
||||
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGIN_ALLOWED_FOR_GET_MODULES');
|
||||
&& (empty($conf->global->API_LOGINS_ALLOWED_FOR_GET_MODULES) || DolibarrApiAccess::$user->login != $conf->global->API_LOGINS_ALLOWED_FOR_GET_MODULES)) {
|
||||
throw new RestException(403, 'Error API open to admin users only or to the users with logins defined into constant API_LOGINS_ALLOWED_FOR_GET_MODULES');
|
||||
}
|
||||
|
||||
sort($conf->modules);
|
||||
|
||||
@ -119,7 +119,7 @@ if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API
|
||||
|
||||
// Analyze URLs
|
||||
// index.php/explorer do a redirect to index.php/explorer/
|
||||
// index.php/explorer/ called by swagger to build explorer page
|
||||
// index.php/explorer/ called by swagger to build explorer page index.php/explorer/index.html
|
||||
// index.php/explorer/.../....png|.css|.js called by swagger for resources to build explorer page
|
||||
// index.php/explorer/resources.json called by swagger to get list of all services
|
||||
// index.php/explorer/resources.json/xxx called by swagger to get detail of services xxx
|
||||
@ -218,6 +218,11 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
|
||||
continue;
|
||||
}
|
||||
|
||||
//$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1;
|
||||
if ($file_searched == 'api_login.class.php' && !empty($conf->global->MAIN_MODULE_API_LOGIN_DISABLED)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$regapi = array();
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi)) {
|
||||
$classname = ucwords($regapi[1]);
|
||||
@ -291,6 +296,29 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
|
||||
$classname = ucwords($moduleobject);
|
||||
|
||||
// Test rules on endpoints. For example:
|
||||
// $conf->global->API_ENDPOINT_RULES = 'endpoint1:1,endpoint2:1,...'
|
||||
if (!empty($conf->global->API_ENDPOINT_RULES)) {
|
||||
$listofendpoints = explode(',', $conf->global->API_ENDPOINT_RULES);
|
||||
$endpointisallowed = false;
|
||||
|
||||
foreach ($listofendpoints as $endpointrule) {
|
||||
$tmparray = explode(':', $endpointrule);
|
||||
if ($classfile == $tmparray[0] && $tmparray[1] == 1) {
|
||||
$endpointisallowed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $endpointisallowed) {
|
||||
dol_syslog('The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES', LOG_WARNING);
|
||||
print 'The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES';
|
||||
header('HTTP/1.1 501 API is forbidden by API_ENDPOINT_RULES');
|
||||
//session_destroy();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog('Search api file /'.$moduledirforclass.'/class/api_'.$classfile.'.class.php => dir_part_file='.$dir_part_file.' classname='.$classname);
|
||||
|
||||
$res = false;
|
||||
@ -314,7 +342,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
//exit;
|
||||
|
||||
// We do not want that restler output data if we use native compression (default behaviour) but we want to have it returned into a string.
|
||||
// We do not want that restler outputs data if we use native compression (default behaviour) but we want to have it returned into a string.
|
||||
Luracast\Restler\Defaults::$returnResponse = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
||||
|
||||
// Call API (we suppose we found it).
|
||||
|
||||
@ -188,7 +188,7 @@ class AssetType extends CommonObject
|
||||
$sql .= "accountancy_code_depreciation_asset = '".$this->db->escape($this->accountancy_code_depreciation_asset)."',";
|
||||
$sql .= "accountancy_code_depreciation_expense = '".$this->db->escape($this->accountancy_code_depreciation_expense)."',";
|
||||
$sql .= "note = '".$this->db->escape($this->note)."'";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
@ -55,8 +55,10 @@ $blocks = $block_static->getLog('just_certified', 0, 0, 'rowid', 'ASC');
|
||||
|
||||
$auth->signature = $block_static->getSignature();
|
||||
|
||||
foreach ($blocks as &$b) {
|
||||
$auth->blockchain .= $b->signature;
|
||||
if (is_array($bocks)) {
|
||||
foreach ($blocks as &$b) {
|
||||
$auth->blockchain .= $b->signature;
|
||||
}
|
||||
}
|
||||
|
||||
$hash = $auth->getBlockchainHash();
|
||||
|
||||
@ -71,8 +71,10 @@ class BlockedLogAuthority
|
||||
|
||||
$this->blockchain = '';
|
||||
|
||||
foreach ($blocks as &$b) {
|
||||
$this->blockchain .= $b->signature;
|
||||
if (is_array($bocks)) {
|
||||
foreach ($blocks as &$b) {
|
||||
$this->blockchain .= $b->signature;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->blockchain;
|
||||
@ -148,7 +150,7 @@ class BlockedLogAuthority
|
||||
|
||||
global $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch id=".$id, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch id=".((int) $id), LOG_DEBUG);
|
||||
|
||||
if (empty($id) && empty($signature)) {
|
||||
$this->error = 'BadParameter';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user