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

This commit is contained in:
Gauthier PC portable 024 2021-05-10 09:17:15 +02:00
commit f9afe7e81a
2343 changed files with 37528 additions and 11173 deletions

View File

@ -128,6 +128,12 @@ source_file = htdocs/langs/en_US/errors.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES 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] [dolibarr.exports]
file_filter = htdocs/langs/<lang>/exports.lang file_filter = htdocs/langs/<lang>/exports.lang
source_file = htdocs/langs/en_US/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 source_lang = en_US
type = MOZILLAPROPERTIES 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] [dolibarr.languages-not-res]
file_filter = htdocs/langs/<lang>/languages.lang file_filter = htdocs/langs/<lang>/languages.lang
source_file = htdocs/langs/en_US/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 source_lang = en_US
type = MOZILLAPROPERTIES 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] [dolibarr.paybox]
file_filter = htdocs/langs/<lang>/paybox.lang file_filter = htdocs/langs/<lang>/paybox.lang
source_file = htdocs/langs/en_US/paybox.lang source_file = htdocs/langs/en_US/paybox.lang

View File

@ -12,11 +12,11 @@ Dolibarr uses some external libraries released under different licenses. This is
Component Version License GPL Compatible Usage Component Version License GPL Compatible Usage
------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------
PHP libraries: 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 CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
EvalMath 1.0 BSD Yes Safe math expressions evaluation 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 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 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) NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
@ -28,11 +28,11 @@ php-iban 1.4.7 LGPL-3+ Yes
PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service 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 PHPPrintIPP 1.3 GPL-2+ Yes Library to send print IPP requests
PSR/Logs 1.0 Library for logs (used by DebugBar) PSR/Logs 1.0 Library for logs (used by DebugBar)
PSR/simple-cache ? Library for cache (used by PHPSpreadSheet) 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) 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 Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP
Stripe 7.67.0 MIT licence Yes Library for Stripe module Stripe 7.67.0 MIT Licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
@ -46,7 +46,7 @@ jQuery blockUI 2.70.0 GPL and MIT License Yes
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors 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 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 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 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 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 jQuery jquerytreeview 1.4.1 MIT License Yes JS library for filetree
@ -60,7 +60,7 @@ Image libraries:
Octicons 8.1 MIT Yes Octicons 8.1 MIT Yes
Font libraries: Font libraries:
Fontawesome 5.13 Font Awesome Free licence Yes Fontawesome 5.13 Font Awesome Free Licence Yes
For licenses compatibility informations: For licenses compatibility informations:

146
ChangeLog
View File

@ -7,14 +7,152 @@ English Dolibarr ChangeLog
For users: For users:
---------- ----------
NEW: Several security issues after a second private bug bounty campaign. NEW: Feature to make inventories
NEW: Several security issues after a second private bug hunting 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)
NEW: All main menu entries are using the picto of the module
NEW: Accountancy - Add closure menu
NEW: Accountancy - Add FEC import
NEW: Accountancy - Add a confirmation form with options on export
NEW: Accountancy - Add select date from/to in already bind customer and supplier list
NEW: Accountancy - Format FEC - Add new field DateLimitReglmt
NEW: Accountancy - In ledger & journals, show link on bank transaction
NEW: Accountancy - Possibility to filter on journals in balance
NEW: Accountancy - Add a page to list subledger accounts
NEW: add the Channel column into the list of orders
NEW: Add a check to avoid an invoice date in the future
NEW: Add some color and picto for the direction of movement
NEW: Add the column "alias" of company in the list of proposal, order, invoice
NEW: Add the column "Office phone" and "User mobile" in user list
NEW: Add the column "Price level"in thirdparty list
NEW: Add some company information in the dropdown login menu
NEW: Add constant MAIN_BUGTRACK_URL to set a custom url to redirect to when clicking on link "declare a bug"
NEW: Add contact tag and bulk email status on the thirparty+contact create form
NEW: Add db fields note_public and note_private for ECM module
NEW: Manage deposit on supplier invoice (& somes ajustments)
NEW: Add edit/delete action icons on categories list pages
NEW: Add hidden option to auto load input line extrafield into new lines
NEW: Add import profile to import BOM
NEW: Add last date of modification for website pages in the list of pages
NEW: Add link picto to the stock movement on the detail of production
NEW: Add mass action "Set tag" for product/service, user, thirdparty, warehouse, project, bank account, members
NEW: Add bulk action Validate and Set to billed on order list.
NEW: add bulk action to set a commercial proposal to status "Refused"
NEW: Add option CONTRACT_ALLOW_EXTERNAL_DOWNLOAD and SUPPLIER_PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD to make generated doc automatically shared.
NEW: Add option MAIN_SECURITY_ANTI_SSRF_SERVER_IP to define list of IPs that are local IPs
NEW: Add option SOCIETE_DISABLE_WORKFORCE to hide staff field
NEW: Add a new permission "Export website"
NEW: Add possibility to exports userGroups fields on user exports
NEW: Add price min and price min including tax into product export
NEW: Can search on lots or serials into the quick search bar
NEW: Add support for Friday as a non working day
NEW: Add a total in page of margin by user
NEW: Add the total of margin in invoice list
NEW: Can set a Warehouse on a Thirparty
NEW: auto notification with module Notification can use templated emails
NEW: Bank Entries : display user linked to a salary or a taxes
NEW: Can set a warehouse in a proposal
NEW: Can clone a cron job.
NEW: Can create a lot from the list view (Look and feel standardization).
NEW: Can filter files in GED on status Shared/Not shared
NEW: Can filter on extrafields date on lists
NEW: Can filter on rowid in list of blocked logs.
NEW: Can hide columns "time consumed" on timesheet per week.
NEW: Can set an employee on each social contribution
NEW: Can set a percentage when creating an invoice from another object
NEW: Can set if a ticket group is visible on public interface or not.
NEW: Can set order of execution of hooks
NEW: Can show the leave dates/holidays on the agenda view.
NEW: Can show the project ref into PDF documents
NEW: Can toggle FCKeditor on public/private notes
NEW: Can use captcha on public page to create a ticket
NEW: Check update availability for externals modules using a button on module page
NEW: Choose lines to use while creating intervention card from origin
NEW: Column shippement method, payment mode, payment term in proposal and order list
NEW: Conf for default actiomm status
NEW: customer ref for product customer prices
NEW: date and user signature on proposal (Issue 16062)
NEW: Dictionary for availability - Add a column position
NEW: TAKEPOS delayed payment in TakePOS
NEW: TAKEPOS display date range if exist in TakePOS
NEW: TAKEPOS display resiliate status in TakePOS for member
NEW: TAKEPOS Edit sales lines rights in TakePOS
NEW: TAKEPOS Option for Takepos to show the total price without tax
NEW: TAKEPOS More permission in TakePOS (Can edit added line, can modify once order sent to kitchen)
NEW: Can set a user related to a social contribution
NEW: ICS Direct debit can be set with a different value for each bank account
NEW: LDAP: usergroup search can be filtered
NEW: Make public bookmarks editable by admin users only
NEW: If main logo not defined, can use the squarred logo on login page
NEW: The manifest file can use the squared image if available
NEW: Add bulk actions for Bank Transfer
NEW: Enhance the multicurrency rate editor
NEW: Multiselect ledger account code filter on book keeping list
NEW: Normalyse Type company field with ajax combobox
NEW: option to automatically close an open project when all its tasks are done (=progress 100%)
NEW: option to select membership type on the online payment page for membership subscription or renewal
NEW: preload product description on selection for customer propal/order/invoice
NEW: Add a ref in product customer price
NEW: Save old page with .old extension on disk when editing a website page
NEW: Search usergroups & resources
NEW: Set status of all variants when changing status of parent
NEW: Setup Page for module creation with module builder enhancement #FoundationFunding
NEW: Show picto of module into the list of dictionaries
NEW: Show the total of payment on the payment confirmation page
NEW: Stock movement list - Add more complete date field
NEW: Support color for types of event
NEW: The global setup for Mandatory fields can now be done on combo list too.
NEW: translate in "en_US" to complete PR 16980
NEW: Update the list of taxes available by default for France
NEW: Add captcha on public page to create a ticket
NEW: Salary payment request and Salary payment are 2 different steps in workflow on Salary payment recording
NEW: VAT payment request and VAT payment are now 2 different steps in workflow on VAT payment recording
NEW: VAT report - Optimisation & collapse by rate
NEW: When we add contacts/users to a project, ask to also affect them on tasks.
NEW: When a doc file is shared, link is visible from the main page of doc.
NEW: Add option in Workflow module to set a shipment as closed.
NEW: Option to automatically create a login/user when a new subscription of a member is done online
NEW: #16378 More E-Mail Contact substitution Values for better salutation
NEW: option to keep the "Automatically create a total payment" checkbox empty on the tax creation page
NEW: #17113 Can upload a favicon in website module
NEW: #17292 default subscription amount by adherent type
NEW: start new experimental module Event Organization Management
NEW: start new experimental module Partnership Management
NEW: start new experimental module Knowledge Management
NEW: start new experimental module Workstations management
For developers: For developers:
--------------- ---------------
* start new module EventOrganization NEW: Can edit an object property in module builder
NEW: hook printFieldListTitle for cabyprodserv.php
NEW: Hook to allow external modules to add their own shortlist of recent objects
NEW: SQL-altering hooks in the turnover by product report
NEW: Add data-eec=1 for EEC countries on select for js interaction
NEW: Add experimental repair script to switch to dynamic row format and utf8mb4 encoding
NEW: add form confirm hook on company card
NEW: Add function showValueWithClipboardCPButton() to add a copy/paste
NEW: Add function showValueWithCopyAndPasteButton() to add a copy/paste
NEW: Add hook addSectionECMAuto method to add custom diretory into ECM auto files
NEW: Add native compression in rest apis
NEW: Product Variants API, add variant stock to response by parameter
NEW: Upgrade Stripe PHP lib to 7.67.0
NEW: Add link to OpenAPI specifications xml file in REST API module setup: swagger.json file can be included into external tools like redoc
NEW: Support sepa_debit in stripe paymentmethods list
NEW: Update doleditor.class.php for easily activate SCAYT
NEW: Add triggers in the function add_object_linked(), updateObjectLinked() and deleteObjectLinked()
NEW: Add triggers OBJECT_LINK_INSERT, OBJECT_LINK_UPDATE et OBJECT_LINK_DELETE in the function add_object_linked(), updateObjectLinked() and deleteObjectLinked()
NEW: API Add option $includeifobjectisused to get a product
NEW: API Get the list of product ids only
NEW: Can set a target image in dolcropresize function.
NEW: Can set a label as placeholder for combo lists.
NEW: Add pagination on Get Products response API
NEW: Add the DefaultValues CRUD class
NEW: Extrafields of documents lines are inside the lines, not any more on separate TR
NEW: unit selection on object edit line
NEW: #13739 #17390 Product API route added to get product stock and product with or without variants
WARNING: WARNING:

View File

@ -51,16 +51,17 @@ export DEBEMAIL="eldy@destailleur.fr"
export QUILT_PATCHES=debian/patches export QUILT_PATCHES=debian/patches
# To use Alioth.debian.org
* Create an account login # Note: alioth.debian.org is outdated --> https://alioth-archive.debian.org/ --> https://salsa.debian.org/public
* Update your ~/.ssh/config file to add: * Create an account login
Host svn.debian.org git.debian.org bzr.debian.org hg.debian.org darcs.debian.org arch.debian.org * 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 User eldy-guest
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_rsa
* Check login on page https://alioth.debian.org/users/login * Check login on page https://alioth.debian.org/users/login
Ex: https://alioth.debian.org/users/eldy-guest Ex: https://alioth.debian.org/users/eldy-guest
* Setup your ssh as described into page: http://wiki.debian.org/Alioth/SSH * 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/ * Ask to be included into project collab-maint: http://alioth.debian.org/projects/collab-maint/
@ -98,21 +99,21 @@ Ex: https://alioth.debian.org/users/eldy-guest
- Post an ITP with reportbugs : - Post an ITP with reportbugs :
> reportbug -B debian --email username@domain.tld wnpp > 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. - Wait until you received bug number.
For first ITP submission of Dolibarr, bug id was 634783. For first ITP submission of Dolibarr, bug id was 634783.
- Check bug is into database by searching with id on - 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 - Add a line for upstream into file changelog with bug number
- Call for a mentor on ML debian-mentors to upload packages - Call for a mentor on ML debian-mentors to upload packages
- Once package is uploaded, following URL are available: - Once package is uploaded, following URL are available:
http://packages.qa.debian.org/package.html https://packages.qa.debian.org/package.html
http://bugs.debian.org/package https://bugs.debian.org/package
##### Modify severity of a bug ticket ##### Modify severity of a bug ticket

View File

@ -542,7 +542,7 @@ $cfg['ThemePerServer'] = FALSE; // allow diferent theme for each co
* %f will be replaced by a list of field names. * %f will be replaced by a list of field names.
* (%t and %f only applies to DefaultQueryTable) * (%t and %f only applies to DefaultQueryTable)
*/ */
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1'; $cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1 = 1';
$cfg['DefaultQueryDatabase'] = ''; $cfg['DefaultQueryDatabase'] = '';
/** /**

9
build/phpstan/README Normal file
View File

@ -0,0 +1,9 @@
PHPStan
https://phpstan.org
PHPStan requires PHP >= 7.1
Install: composer require --dev phpstan/phpstan
Config File: phpstan.neon

View File

@ -3,48 +3,54 @@ README (English)
RPM Package tools RPM Package tools
################################################## ##################################################
This directory contains files used by makepack-dolibarr.pl This directory contains files used by makepack-dolibarr.pl script to build a package,
script to build a package, ready to be distributed, ready to be distributed with format RPM (https://rpm.org)
with format RPM (for Redhat, OpenSuse, Mandriva, ...). for Linux Distributions like Redhat, Fedora, CentOS, OpenSuse, OpenMandriva, Mageia ...
# This is standard command to work on RPM packaging: # This is standard command to work on RPM packaging:
#
# To install all packagers tools: # To install all packagers tools:
# Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it - Fedora: yum -y install rpmlint fedora-packager mock koji hunspell-en hunspell-es hunspell-fr hunspell-it
# OpenSuse: yast --install update-desktop-files - OpenSuse: yast --install update-desktop-files
#
# rpmlint file.rpm Test a package # rpmlint file.rpm Test a package
# mock -r fedora-15-i386 --rebuild ../SRPMS/hello-2.7-1.fc15.src.rpm # mock -r fedora-15-i386 --rebuild ../SRPMS/hello-2.7-1.fc15.src.rpm
#
# On Fedora # On Fedora
# rpm -i --test dolibarr-...rpm To list dependencies of RPM # =========
# yum -v install dolibarr-...rpm To install package and dependencies # rpm -i --test dolibarr-...rpm to list dependencies of RPM
# yum -v erase dolibarr To remove package # yum -v install dolibarr-...rpm to install package and dependencies
# chcon -R -h -t httpd_sys_script_rw_t /file To add temporary context rw for httpd on /file # yum -v erase dolibarr to remove package
# semanage fcontext -a -t httpd_sys_script_rw_t "/dir/(.*)?" To add persistent context rw for httpd on /dir (this add file_contexts.local) # chcon -R -h -t httpd_sys_script_rw_t /file to add temporary context rw for httpd on /file
# restorecon -R -v /file Restore values into files (cancel chcon, validate semanage) # 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 # On OpenSuse
# zypper install dolibarr-...rpm To install package and dependencies # ===========
# zypper remove dolibarr To remove package # zypper install dolibarr-...rpm to install package and dependencies
# zypper search xxx To search a package # zypper remove dolibarr to remove package
# # zypper search xxx to search a package
# On Mageia (after su - root) # 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: To submit a package to Fedora:
- Create account on bugzilla.redhat.com - Create account on https://bugzilla.redhat.com
- Create account on fedoraproject.org - Create account on https://developer.fedoraproject.org/
- Create SRPMS package. - Create SRPMS package
- Upload package onf http://fedorapeople.org - Upload package on https://fedorapeople.org
- Create a bug with form https://bugzilla.redhat.com/bugzilla/enter_bug.cgi?product=Fedora&format=fedora-review - 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): 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 Description: Dolibarr ERP & CRM is an easy to use open source/free software
for small and medium companies, foundations or freelances. It includes for small and medium companies, foundations or freelances. It includes
different features for Enterprise Resource Planning (ERP) and Customer 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 - Install fedora packager tools: yum install fedora-packager
- Setup fedora packagers tools: fedora-packager-setup - Setup fedora packagers tools: fedora-packager-setup
- Send your package: koji build --scratch f16 path_to_source_RPM - 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/

View File

@ -199,6 +199,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport %_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt %_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
@ -229,6 +230,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch

View File

@ -280,6 +280,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport %_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt %_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
@ -310,6 +311,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch

View File

@ -196,6 +196,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport %_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt %_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
@ -226,6 +227,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch

View File

@ -207,6 +207,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install
%_datadir/dolibarr/htdocs/intracommreport %_datadir/dolibarr/htdocs/intracommreport
%_datadir/dolibarr/htdocs/knowledgemanagement
%_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt %_datadir/dolibarr/htdocs/langs/HOWTO-Translation.txt
%_datadir/dolibarr/htdocs/loan %_datadir/dolibarr/htdocs/loan
%_datadir/dolibarr/htdocs/mailmanspip %_datadir/dolibarr/htdocs/mailmanspip
@ -237,6 +238,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/variants %_datadir/dolibarr/htdocs/variants
%_datadir/dolibarr/htdocs/webservices %_datadir/dolibarr/htdocs/webservices
%_datadir/dolibarr/htdocs/website %_datadir/dolibarr/htdocs/website
%_datadir/dolibarr/htdocs/workstation
%_datadir/dolibarr/htdocs/zapier %_datadir/dolibarr/htdocs/zapier
%_datadir/dolibarr/htdocs/*.ico %_datadir/dolibarr/htdocs/*.ico
%_datadir/dolibarr/htdocs/*.patch %_datadir/dolibarr/htdocs/*.patch

1
dev/initdemo/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/initdemopostsql.sql

View File

@ -232,6 +232,10 @@ else
fi fi
if [ -s "$mydir/initdemopostsql.sql" ]; then
mysql -P$port $base < "$mydir/initdemopostsql.sql"
fi
if [ "x$res" = "x0" ] if [ "x$res" = "x0" ]
then then

View File

@ -170,6 +170,10 @@ if [ $res -ne 0 ]; then
exit exit
fi fi
if [ -s "$mydir/initdemopostsql.sql" ]; then
mysql -P$port $base < "$mydir/initdemopostsql.sql"
fi
if [ "x$res" = "x0" ] if [ "x$res" = "x0" ]
then then

View File

@ -0,0 +1,6 @@
EORI
https://en.wikipedia.org/wiki/EORI_number
in Dolibarr avaiable since v13
- it is set to field 'profid5'

View File

@ -16,7 +16,7 @@
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern> <exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</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">*/htdocs/includes</exclude-pattern> <exclude-pattern type="relative">source</exclude-pattern>
<exclude-pattern type="relative">.git</exclude-pattern> <exclude-pattern type="relative">.git</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->

View File

@ -17,3 +17,7 @@ for Linux OS
to install or to update transifex client: to install or to update transifex client:
sudo pip install --upgrade 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
doc/images/appicon_32.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -169,7 +169,7 @@ foreach ($list_account_main as $key) {
print '</td>'; print '</td>';
// Value // Value
print '<td>'; // Do not force class=right, or it align also the content of the select box 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 '</td>';
print '</tr>'; print '</tr>';
} }
@ -186,7 +186,7 @@ foreach ($list_account as $key) {
print '<td width="50%">'.$label.'</td>'; print '<td width="50%">'.$label.'</td>';
// Value // Value
print '<td>'; // Do not force class=right, or it align also the content of the select box 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 '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -302,7 +302,9 @@ if (!empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
print '</tr>'; print '</tr>';
print '<tr class="oddeven">'; 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)) { 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">'; print '<td class="right"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?token='.newToken().'&action=setACCOUNTANCY_COMBO_FOR_AUX&value=0">';

View File

@ -270,8 +270,8 @@ if (empty($pcgvercode)) {
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,"; $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)) { if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,";
$sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,";
} else { } else {
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; $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,"; $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 .= " aa.rowid as aaid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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.account_number = pa." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; $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 { } 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 .= " 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').')'; $sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if (strlen(trim($search_current_account))) { 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') { if ($search_current_account_valid == 'withoutvalidaccount') {
$sql .= " AND aa.account_number IS NULL"; $sql .= " AND aa.account_number IS NULL";
@ -466,7 +466,7 @@ if ($result) {
} else { } else {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); 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"); print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco = $form->showCheckAddButtons('checkforselect', 1); $clickpitco = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center '); print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro> * 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> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.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/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.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 // Load translation files required by the page
$langs->loadLangs(array("accountancy", "compta")); $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'); $action = GETPOST('action', 'aZ09');
// Load variable for pagination // Load variable for pagination
@ -60,7 +58,7 @@ $pagenext = $page + 1;
$show_subgroup = GETPOST('show_subgroup', 'alpha'); $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_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_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'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
@ -134,6 +132,12 @@ if (!empty($search_accountancy_code_end)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&amp;search_accountancy_code_end='.$search_accountancy_code_end; $param .= '&amp;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)) { if (empty($conf->accounting->enabled)) {
accessforbidden(); accessforbidden();
@ -157,6 +161,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_date_end = ''; $search_date_end = '';
$search_accountancy_code_start = ''; $search_accountancy_code_start = '';
$search_accountancy_code_end = ''; $search_accountancy_code_end = '';
$search_ledger_code = array();
$filter = array(); $filter = array();
} }
@ -249,6 +254,12 @@ if ($action != 'export_csv') {
$moreforfilter .= '<label for="show_subgroup">'.$langs->trans('ShowSubtotalByGroup').'</label>: '; $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 .= '<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>'; $moreforfilter .= '</div>';
@ -261,17 +272,16 @@ if ($action != 'export_csv') {
print '</div>'; print '</div>';
} }
$colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4); $colspan = (!empty($conf->global->ACCOUNTANCY_SHOW_OPENING_BALANCE) ? 5 : 4);
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">'; print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" colspan="'.$colspan.'">'; print '<td class="liste_titre" colspan="'.$colspan.'">';
print $langs->trans('From'); print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, '', 'accounts');
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
print ' '; print ' ';
print $langs->trans('to'); print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, '', 'accounts');
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
print '</td>'; print '</td>';
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
@ -415,7 +425,8 @@ if ($action != 'export_csv') {
} else { } else {
print '<td class="nowraponall right">'.price(price2num($line->debit - $line->credit, 'MT')).'</td>'; 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 '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -72,7 +72,7 @@ if ($search_accountancy_code_end == - 1) {
$search_accountancy_code_end = ''; $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'); $search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
if ($search_accountancy_aux_code_start == - 1) { if ($search_accountancy_aux_code_start == - 1) {
$search_accountancy_aux_code_start = ''; $search_accountancy_aux_code_start = '';
@ -457,12 +457,14 @@ if (count($filter) > 0) {
$sqlwhere[] = $key.'=\''.$db->idate($value).'\''; $sqlwhere[] = $key.'=\''.$db->idate($value).'\'';
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key.'\''.$db->idate($value).'\''; $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).'\''; $sqlwhere[] = $key.'\''.$db->escape($value).'\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.$value; $sqlwhere[] = $key.'='.$value;
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { } elseif ($key == 't.numero_compte') {
$sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\''; $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<=') { } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
$sqlwhere[] = $key.'\''.$db->idate($value).'\''; $sqlwhere[] = $key.'\''.$db->idate($value).'\'';
} elseif ($key == 't.tms>=' || $key == 't.tms<=') { } 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'])) { if (!empty($arrayfields['t.numero_compte']['checked'])) {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<div class="nowrap">'; 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>';
print '<div class="nowrap">'; 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 '</div>';
print '</td>'; print '</td>';
} }
// Subledger account // Subledger account
if (!empty($arrayfields['t.subledger_account']['checked'])) { if (!empty($arrayfields['t.subledger_account']['checked'])) {
print '<td class="liste_titre">'; 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 // 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. // use setup of keypress to select thirdparty and this hang browser on large database.
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
print $langs->trans('From').' '; print '<div class="nowrap">';
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); //print $langs->trans('From').' ';
} else { print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount');
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'" placeholder="'.$langs->trans("From").'">';
}
print '</div>'; print '</div>';
print '<div class="nowrap">'; 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 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount');
// 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 '</div>';
} else {
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code" value="'.$search_accountancy_aux_code.'">';
}
print '</td>'; print '</td>';
} }
// Label operation // Label operation

View File

@ -129,13 +129,13 @@ class BookKeeping extends CommonObject
/** /**
* @var float FEC:Amount (Not necessary) * @var float FEC:Amount (Not necessary)
* @deprecated Use $amount * @deprecated No more used (we have info into debit/credit and sens)
*/ */
public $montant; public $montant;
/** /**
* @var float FEC:Amount (Not necessary) * @var float FEC:Amount (Not necessary)
* @deprecated No more used * @deprecated No more used (we have info into debit/credit and sens)
*/ */
public $amount; public $amount;
@ -287,34 +287,38 @@ class BookKeeping extends CommonObject
$this->piece_num = 0; $this->piece_num = 0;
// First check if line not yet already in bookkeeping. // 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) // 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. // 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 = "SELECT count(*) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; $sql .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'";
$sql .= " AND fk_doc = ".$this->fk_doc; $sql .= " AND fk_doc = ".$this->fk_doc;
if (!empty($conf->global->ACCOUNTANCY_ENABLE_FKDOCDET)) { 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. // 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 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 numero_compte = '".$this->db->escape($this->numero_compte)."'";
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'"; $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); $resql = $this->db->query($sql);
if ($resql) { if ($resql) {
$row = $this->db->fetch_object($resql); $row = $this->db->fetch_object($resql);
if ($row->nb == 0) { if ($row->nb == 0) { // Not already into bookkeeping
// Determine piece_num // Check to know if piece_num already exists for data we try to insert to reuse the same value
$sqlnum = "SELECT piece_num"; $sqlnum = "SELECT piece_num";
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sqlnum .= " WHERE doc_type = '".$this->db->escape($this->doc_type)."'"; // For example doc_type = 'bank' $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 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); dol_syslog(get_class($this).":: create sqlnum=".$sqlnum, LOG_DEBUG);
$resqlnum = $this->db->query($sqlnum); $resqlnum = $this->db->query($sqlnum);
@ -327,15 +331,14 @@ class BookKeeping extends CommonObject
if (empty($this->piece_num)) { if (empty($this->piece_num)) {
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
$sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; $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); $resqlnum = $this->db->query($sqlnum);
if ($resqlnum) { if ($resqlnum) {
$objnum = $this->db->fetch_object($resqlnum); $objnum = $this->db->fetch_object($resqlnum);
$this->piece_num = $objnum->maxpiecenum; $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)) { if (empty($this->piece_num)) {
$this->piece_num = 1; $this->piece_num = 1;
@ -1121,6 +1124,12 @@ class BookKeeping extends CommonObject
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.subledger_label') { } elseif ($key == 't.subledger_label') {
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; $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 { } else {
$sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\'';
} }

View File

@ -102,7 +102,7 @@ if (!empty($id)) {
$sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,"; $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,"; $sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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 { } else {
$sql .= " p.accountancy_code_sell as code_sell,"; $sql .= " p.accountancy_code_sell as code_sell,";
} }
@ -110,7 +110,7 @@ if (!empty($id)) {
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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 .= " 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"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = l.fk_facture";

View File

@ -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 .= " 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,"; $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)) { 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 { } 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_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 .= " 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 .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra,"; $sql .= " s.tva_intra,";
if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " sa.accountancy_code_sell as company_code_sell"; $sql .= " spe.accountancy_code_sell as company_code_sell";
} else { } else {
$sql .= " s.accountancy_code_sell as company_code_sell"; $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 .= " 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"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; $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 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 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; $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 while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result); $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) // Level 2: Search suggested account for product/service (similar code exists in page list.php to make manual binding)
$suggestedaccountingaccountfor = ''; $suggestedaccountingaccountfor = '';

View File

@ -53,9 +53,14 @@ $search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha');
$search_day = GETPOST("search_day", "int"); $search_date_startday = GETPOST('search_date_startday', 'int');
$search_month = GETPOST("search_month", "int"); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_year = GETPOST("search_year", "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_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
@ -109,9 +114,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_amount = ''; $search_amount = '';
$search_account = ''; $search_account = '';
$search_vat = ''; $search_vat = '';
$search_day = ''; $search_date_startday = '';
$search_month = ''; $search_date_startmonth = '';
$search_year = ''; $search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_country = ''; $search_country = '';
$search_tvaintra = ''; $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 .= " 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,"; $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)) { 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 { } 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 .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,";
$sql .= " fd.situation_percent,"; $sql .= " fd.situation_percent,";
@ -198,7 +208,7 @@ $sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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."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"; $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))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("fd.tva_tx", price2num($search_vat), 1); $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))) { if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC(); $arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = ''; $country_code_in_EEC = $country_code_in_EEC_without_me = '';
@ -315,14 +330,23 @@ if ($result) {
if ($search_vat) { if ($search_vat) {
$param .= "&search_vat=".urlencode($search_vat); $param .= "&search_vat=".urlencode($search_vat);
} }
if ($search_day) { if ($search_date_startday) {
$param .= '&search_day='.urlencode($search_day); $param .= '&search_date_startday='.urlencode($search_date_startday);
} }
if ($search_month) { if ($search_date_startmonth) {
$param .= '&search_month='.urlencode($search_month); $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
} }
if ($search_year) { if ($search_date_startyear) {
$param .= '&search_year='.urlencode($search_year); $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) { if ($search_country) {
$param .= "&search_country=".urlencode($search_country); $param .= "&search_country=".urlencode($search_country);
@ -357,12 +381,13 @@ if ($result) {
print '<tr class="liste_titre_filter">'; 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 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_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre center nowraponall">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">'; 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 '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">'; print '<div class="nowrap">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); 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>';
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_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>'; //print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* 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) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * 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_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha');
$search_day = GETPOST("search_day", "int"); $search_date_startday = GETPOST('search_date_startday', 'int');
$search_month = GETPOST("search_month", "int"); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_year = GETPOST("search_year", "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_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
@ -135,9 +140,14 @@ if (empty($reshook)) {
$search_amount = ''; $search_amount = '';
$search_account = ''; $search_account = '';
$search_vat = ''; $search_vat = '';
$search_day = ''; $search_date_startday = '';
$search_month = ''; $search_date_startmonth = '';
$search_year = ''; $search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_country = ''; $search_country = '';
$search_tvaintra = ''; $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 .= " 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,"; $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)) { 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,";
$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_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
} else { } 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_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,"; $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 .= " 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 .= " 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,"; $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)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " sa.accountancy_code_sell as company_code_sell"; $sql .= " spe.accountancy_code_sell as company_code_sell";
} else { } else {
$sql .= " s.accountancy_code_sell as company_code_sell"; $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 .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as 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 .= " 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 .= " 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"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; $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 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 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; $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))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1); $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))) { if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC(); $arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = ''; $country_code_in_EEC = $country_code_in_EEC_without_me = '';
@ -368,14 +383,23 @@ if ($result) {
if ($search_lineid) { if ($search_lineid) {
$param .= '&search_lineid='.urlencode($search_lineid); $param .= '&search_lineid='.urlencode($search_lineid);
} }
if ($search_day) { if ($search_date_startday) {
$param .= '&search_day='.urlencode($search_day); $param .= '&search_date_startday='.urlencode($search_date_startday);
} }
if ($search_month) { if ($search_date_startmonth) {
$param .= '&search_month='.urlencode($search_month); $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
} }
if ($search_year) { if ($search_date_startyear) {
$param .= '&search_year='.urlencode($search_year); $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) { if ($search_invoice) {
$param .= '&search_invoice='.urlencode($search_invoice); $param .= '&search_invoice='.urlencode($search_invoice);
@ -436,12 +460,13 @@ if ($result) {
print '<tr class="liste_titre_filter">'; 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 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_invoice" value="'.dol_escape_htmltag($search_invoice).'"></td>';
print '<td class="liste_titre center nowraponall minwidth100imp">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; 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 '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<div class="nowrap">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); 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>';
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_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>'; //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 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"><input type="text" class="flat maxwidth75imp" name="search_societe" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre">'; 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 '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="'.dol_escape_htmltag($search_tvaintra).'"></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>'; print '<td>'.$objp->tva_intra.'</td>';
// Found accounts // Found accounts
print '<td>'; print '<td class="small">';
$s = '<span class="small">1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
@ -699,7 +724,7 @@ if ($result) {
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
if ($objp->product_id > 0) { if ($objp->product_id > 0) {
print '<br>'; 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'; $shelp = ''; $ttype = 'help';
if ($suggestedaccountingaccountfor == 'eec') { if ($suggestedaccountingaccountfor == 'eec') {
$shelp = $langs->trans("SaleEEC"); $shelp = $langs->trans("SaleEEC");
@ -716,7 +741,7 @@ if ($result) {
} else { } else {
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>'; 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 = ''; $shelp = '';
$s .= $langs->trans("NotDefined"); $s .= $langs->trans("NotDefined");
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); 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)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
print '<br>'; 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 = ''; $shelp = '';
$s .= ($objp->code_sell_t > 0 ? length_accountg($objp->code_sell_t) : '<span style="'.$code_sell_t_notset.'">'.$langs->trans("NotDefined").'</span>'); $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); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);

View File

@ -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 = "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 .= " 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 .= " 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 .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid"; $sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid";
@ -259,7 +260,8 @@ if ($result) {
'lastname' => $obj->lastname, 'lastname' => $obj->lastname,
'firstname' => $obj->firstname, 'firstname' => $obj->firstname,
'email' => $obj->useremail, 'email' => $obj->useremail,
'accountancy_code' => $compta_user 'accountancy_code' => $compta_user,
'status' => $obj->userstatus
); );
// Variable bookkeeping ($obj->rowid is Bank Id) // Variable bookkeeping ($obj->rowid is Bank Id)
@ -328,8 +330,10 @@ if ($result) {
$userstatic->email = $tabuser[$obj->rowid]['email']; $userstatic->email = $tabuser[$obj->rowid]['email'];
$userstatic->firstname = $tabuser[$obj->rowid]['firstname']; $userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
$userstatic->lastname = $tabuser[$obj->rowid]['lastname']; $userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
$userstatic->statut = $tabuser[$obj->rowid]['status'];
$userstatic->accountancy_code = $tabuser[$obj->rowid]['accountancy_code'];
if ($userstatic->id > 0) { if ($userstatic->id > 0) {
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, 'accountancy', 0);
} else { } else {
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. $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') { if (!$error && $action == 'writebookkeeping') {
$now = dol_now(); $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; $error = 0;
foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
@ -530,6 +546,9 @@ if (!$error && $action == 'writebookkeeping') {
// Line into bank account // Line into bank account
foreach ($tabbq[$key] as $k => $mt) { foreach ($tabbq[$key] as $k => $mt) {
if ($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 = ''; $reflabel = '';
if (!empty($val['lib'])) { if (!empty($val['lib'])) {
$reflabel .= dol_string_nohtmltag($val['lib'])." - "; $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
@ -545,10 +564,9 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->doc_type = 'bank'; $bookkeeping->doc_type = 'bank';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true); $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $account_label;
$bookkeeping->label_operation = $reflabel; $bookkeeping->label_operation = $reflabel;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -606,6 +624,7 @@ if (!$error && $action == 'writebookkeeping') {
$bookkeeping->doc_type = 'bank'; $bookkeeping->doc_type = 'bank';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_operation = $reflabel; $bookkeeping->label_operation = $reflabel;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $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_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->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; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = $accountingaccountcustomer->label;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice } 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_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->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; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->label_compte = $accountingaccountsupplier->label;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_expensereport') { } elseif ($tabtype[$key] == 'payment_expensereport') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = $accountingaccountpayment->label;
$accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_salary') { } elseif ($tabtype[$key] == 'payment_salary') {
$bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->subledger_label = $tabuser[$key]['name'];
$bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = $accountingaccountpayment->label;
$accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution } elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_vat') { } elseif ($tabtype[$key] == 'payment_vat') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_donation') { } elseif ($tabtype[$key] == 'payment_donation') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'member') { } elseif ($tabtype[$key] == 'member') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_loan') { } elseif ($tabtype[$key] == 'payment_loan') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_various') { } elseif ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = $k; $bookkeeping->subledger_account = $k;
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $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"]; $bookkeeping->numero_compte = $tabpay[$key]["account_various"];
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'banktransfert') { } elseif ($tabtype[$key] == 'banktransfert') {
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$accountingaccount->fetch(null, $k, true); // TODO Use a cache
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} else { } else {
if ($tabtype[$key] == 'unknown') { // Unknown transaction, we will use a waiting account for thirdparty. 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_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE;
$bookkeeping->label_compte = $accountingaccountsuspense->label;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE, true);
$bookkeeping->label_compte = $accountingaccount->label;
} }
} }
$bookkeeping->label_operation = $reflabel; $bookkeeping->label_operation = $reflabel;

View File

@ -206,6 +206,9 @@ if ($action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0; $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 foreach ($taber as $key => $val) { // Loop on each expense report
$errorforline = 0; $errorforline = 0;
@ -225,12 +228,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code'];
$bookkeeping->subledger_label = $tabuser[$key]['name']; $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->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccountexpense->label;
$bookkeeping->label_operation = $tabuser[$key]['name']; $bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -274,10 +277,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = $accountingaccount->label; $bookkeeping->label_operation = $accountingaccount->label;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
@ -322,6 +328,9 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label
$account_label = $accountingaccount->label;
// get compte id and label // get compte id and label
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
@ -330,12 +339,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true); $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $account_label;
$bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'; $bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %';
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;

View File

@ -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 = "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 .= " 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 .= " 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 .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; $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 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn";
$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
@ -240,7 +248,7 @@ foreach ($tabfac as $key => $val) { // Loop on each invoice
$sql = "SELECT COUNT(fd.rowid) as nb"; $sql = "SELECT COUNT(fd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd";
$sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0"; $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); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -262,6 +270,9 @@ if ($action == 'writebookkeeping') {
$companystatic = new Societe($db); $companystatic = new Societe($db);
$invoicestatic = new FactureFournisseur($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 foreach ($tabfac as $key => $val) { // Loop on each invoice
$errorforline = 0; $errorforline = 0;
@ -323,12 +334,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccountsupplier->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount"); $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -363,8 +374,11 @@ if ($action == 'writebookkeeping') {
// Product / Service // Product / Service
if (!$errorforline) { if (!$errorforline) {
foreach ($tabht[$key] as $k => $mt) { 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 // get compte id and label
if ($accountingaccount->fetch(null, $k, true)) { if ($resultfetch > 0) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -374,11 +388,14 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $label_account;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$label_account;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
@ -424,6 +441,9 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label
$label_account = $accountingaccount->label;
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -433,12 +453,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true); $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $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->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -486,9 +506,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' NPR'; $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' NPR';
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';

View File

@ -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 .= " 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,"; $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)) { if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " pa.accountancy_code_sell"; $sql .= " ppe.accountancy_code_sell";
} else { } else {
$sql .= " p.accountancy_code_sell"; $sql .= " p.accountancy_code_sell";
} }
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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 .= " 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"; $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 .= " 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"; $sql .= " ORDER BY f.datef";
//print $sql; //print $sql; exit;
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG); dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
$result = $db->query($sql); $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 = "SELECT COUNT(fd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " WHERE fd.product_type <= 2 AND fd.fk_code_ventilation <= 0"; $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); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -285,6 +285,9 @@ if ($action == 'writebookkeeping') {
$companystatic = new Societe($db); $companystatic = new Societe($db);
$invoicestatic = new Facture($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 foreach ($tabfac as $key => $val) { // Loop on each invoice
$errorforline = 0; $errorforline = 0;
@ -344,12 +347,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccountcustomer->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount"); $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
@ -384,8 +387,11 @@ if ($action == 'writebookkeeping') {
// Product / Service // Product / Service
if (!$errorforline) { if (!$errorforline) {
foreach ($tabht[$key] as $k => $mt) { 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 // get compte id and label
if ($accountingaccount->fetch(null, $k, true)) { if ($resultfetch > 0) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -395,11 +401,14 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $label_account;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$label_account;
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@ -444,6 +453,9 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
$accountingaccount->fetch($k, null, true); // TODO Use a cache for label
$label_account = $accountingaccount->label;
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@ -453,12 +465,12 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true); $bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label; $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->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;

View File

@ -101,10 +101,18 @@ $formaccounting = new FormAccounting($db);
if (!empty($id)) { 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 = "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 .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,";
$sql .= ", aa.account_number, aa.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 .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; $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 .= " 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 .= " 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); $sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id);

View File

@ -132,20 +132,35 @@ if ($action == 'validatehistory') {
// Supplier Invoice Lines (must be same request than into page list.php for manual binding) // 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 = "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 .= " 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.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,";
$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,"; 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 .= " 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 .= " 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 .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $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 .= " 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 .= " 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."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; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$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 . "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 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; $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 .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2"; $sql .= " AND l.product_type <= 2";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com> /* 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) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * 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_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha');
$search_day = GETPOST("search_day", "int"); $search_date_startday = GETPOST('search_date_startday', 'int');
$search_month = GETPOST("search_month", "int"); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_year = GETPOST("search_year", "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_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
@ -94,6 +99,9 @@ if (empty($user->rights->accounting->mouvements->lire)) {
} }
$formaccounting = new FormAccounting($db);
/* /*
* Actions * Actions
*/ */
@ -109,14 +117,19 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_amount = ''; $search_amount = '';
$search_account = ''; $search_account = '';
$search_vat = ''; $search_vat = '';
$search_day = ''; $search_date_startday = '';
$search_month = ''; $search_date_startmonth = '';
$search_year = ''; $search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_country = ''; $search_country = '';
$search_tvaintra = ''; $search_tvaintra = '';
} }
if (is_array($changeaccount) && count($changeaccount) > 0) { if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) {
$error = 0; $error = 0;
if (!(GETPOST('account_parent', 'int') >= 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'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
} }
if (!$error) { if (!$error) {
$db->begin(); $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 .= " 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 .= " 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.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 .= " 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"; $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(); $parameters = array();
@ -192,6 +208,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; $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"; $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."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."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"; $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))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1); $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))) { if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC(); $arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = ''; $country_code_in_EEC = $country_code_in_EEC_without_me = '';
@ -306,14 +330,23 @@ if ($result) {
if ($search_vat) { if ($search_vat) {
$param .= "&search_vat=".urlencode($search_vat); $param .= "&search_vat=".urlencode($search_vat);
} }
if ($search_day) { if ($search_date_startday) {
$param .= '&search_day='.urlencode($search_day); $param .= '&search_date_startday='.urlencode($search_date_startday);
} }
if ($search_month) { if ($search_date_startmonth) {
$param .= '&search_month='.urlencode($search_month); $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
} }
if ($search_year) { if ($search_date_startyear) {
$param .= '&search_year='.urlencode($search_year); $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) { if ($search_country) {
$param .= "&search_country=".urlencode($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 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_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"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center nowraponall">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; 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 '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<div class="nowrap">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); 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>';
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_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>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* 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) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s * 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_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha');
$search_day = GETPOST("search_day", "int"); $search_date_startday = GETPOST('search_date_startday', 'int');
$search_month = GETPOST("search_month", "int"); $search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_year = GETPOST("search_year", "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_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
@ -140,9 +145,14 @@ if (empty($reshook)) {
$search_amount = ''; $search_amount = '';
$search_account = ''; $search_account = '';
$search_vat = ''; $search_vat = '';
$search_day = ''; $search_date_startday = '';
$search_month = ''; $search_date_startmonth = '';
$search_year = ''; $search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$search_country = ''; $search_country = '';
$search_tvaintra = ''; $search_tvaintra = '';
} }
@ -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 .= " 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,"; $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)) { 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,";
$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_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,";
} else { } 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_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,"; $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 .= " 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,"; $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)) { 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 { } else {
$sql .= " s.accountancy_code_buy as company_code_buy"; $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 .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as 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 .= " 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 .= " 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."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { 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_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; $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 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 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 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))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", price2num($search_vat), 1); $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))) { if (strlen(trim($search_country))) {
$arrayofcode = getCountriesInEEC(); $arrayofcode = getCountriesInEEC();
$country_code_in_EEC = $country_code_in_EEC_without_me = ''; $country_code_in_EEC = $country_code_in_EEC_without_me = '';
@ -372,14 +387,23 @@ if ($result) {
if ($search_lineid) { if ($search_lineid) {
$param .= '&search_lineid='.urlencode($search_lineid); $param .= '&search_lineid='.urlencode($search_lineid);
} }
if ($search_day) { if ($search_date_startday) {
$param .= '&search_day='.urlencode($search_day); $param .= '&search_date_startday='.urlencode($search_date_startday);
} }
if ($search_month) { if ($search_date_startmonth) {
$param .= '&search_month='.urlencode($search_month); $param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
} }
if ($search_year) { if ($search_date_startyear) {
$param .= '&search_year='.urlencode($search_year); $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) { if ($search_invoice) {
$param .= '&search_invoice='.urlencode($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 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_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"><input type="text" class="flat maxwidth50" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
print '<td class="liste_titre center nowraponall minwidth100imp">'; print '<td class="liste_titre center">';
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { print '<div class="nowrap">';
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_day" value="'.$search_day.'">'; 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 '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<div class="nowrap">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); 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>';
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_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>'; 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>'; print '<td>'.$objp->tva_intra.'</td>';
// Found accounts // Found accounts
print '<td>'; print '<td class="small">';
$s = '<span class="small">1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>'; $s = '1. '.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = ''; $shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') { if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC"); $shelp .= $langs->trans("SaleEEC");
@ -683,7 +708,7 @@ if ($result) {
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
if ($objp->product_id > 0) { if ($objp->product_id > 0) {
print '<br>'; 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 = ''; $shelp = '';
if ($suggestedaccountingaccountfor == 'eec') { if ($suggestedaccountingaccountfor == 'eec') {
$shelp = $langs->trans("SaleEEC"); $shelp = $langs->trans("SaleEEC");
@ -694,13 +719,13 @@ if ($result) {
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} else { } else {
print '<br>'; 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 = ''; $shelp = '';
$s .= $langs->trans("NotDefined"); $s .= $langs->trans("NotDefined");
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
} }
print '<br>'; 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 = ''; $shelp = '';
$s .= ($objp->code_buy_t > 0 ? length_accountg($objp->code_buy_t) : '<span style="'.$code_buy_t_notset.'">'.$langs->trans("NotDefined").'</span>'); $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); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);

View File

@ -9,7 +9,6 @@
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org> * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2020-2021 Frédéric France <frederic.france@netlogic.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 * 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 * it under the terms of the GNU General Public License as published by
@ -34,7 +33,6 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.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.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("admin", "members")); $langs->loadLangs(array("admin", "members"));
@ -107,6 +105,7 @@ if ($action == 'set_default') {
$res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity); $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
$res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity); $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity); $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
$res3 = dolibarr_set_const($db, 'ADHERENT_CREATE_EXTERNAL_USER_LOGIN', GETPOST('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity); $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation // Use vat for invoice creation
if ($conf->facture->enabled) { if ($conf->facture->enabled) {
@ -219,6 +218,11 @@ print '<tr class="oddeven"><td>'.$langs->trans("MemberSendInformationByMailByDef
print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1); print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
print "</td></tr>\n"; print "</td></tr>\n";
// Create an external user login for each new member subscription validated
print '<tr class="oddeven"><td>'.$langs->trans("MemberCreateAnExternalUserForSubscriptionValidated").'</td><td>';
print $form->selectyesno('ADHERENT_CREATE_EXTERNAL_USER_LOGIN', (!empty($conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN) ? $conf->global->ADHERENT_CREATE_EXTERNAL_USER_LOGIN : 0), 1);
print "</td></tr>\n";
// Insert subscription into bank account // Insert subscription into bank account
print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MoreActionsOnSubscription").'</td>';
$arraychoices = array('0'=>$langs->trans("None")); $arraychoices = array('0'=>$langs->trans("None"));

View File

@ -284,6 +284,7 @@ if (empty($reshook)) {
$object->phone_perso = trim(GETPOST("phone_perso", 'alpha')); $object->phone_perso = trim(GETPOST("phone_perso", 'alpha'));
$object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha')); $object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha'));
$object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$object->url = trim(GETPOST('member_url', 'custom', 0, FILTER_SANITIZE_URL));
$object->socialnetworks = array(); $object->socialnetworks = array();
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') {
@ -431,6 +432,7 @@ if (empty($reshook)) {
// $facebook=GETPOST("member_facebook", 'alpha'); // $facebook=GETPOST("member_facebook", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha'); // $linkedin=GETPOST("member_linkedin", 'alpha');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL));
$login = GETPOST("member_login", 'alphanohtml'); $login = GETPOST("member_login", 'alphanohtml');
$pass = GETPOST("password", 'alpha'); $pass = GETPOST("password", 'alpha');
$photo = GETPOST("photo", 'alpha'); $photo = GETPOST("photo", 'alpha');
@ -469,6 +471,7 @@ if (empty($reshook)) {
// $object->linkedin = $linkedin; // $object->linkedin = $linkedin;
$object->email = $email; $object->email = $email;
$object->url = $url;
$object->login = $login; $object->login = $login;
$object->pass = $pass; $object->pass = $pass;
$object->birth = $birthdate; $object->birth = $birthdate;
@ -537,6 +540,10 @@ if (empty($reshook)) {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors'); setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
} }
if (!empty($object->url) && !isValidUrl($object->url)) {
$langs->load("errors");
setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors');
}
$public = 0; $public = 0;
if (isset($public)) { if (isset($public)) {
$public = 1; $public = 1;
@ -937,17 +944,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
document.formsoc.submit(); document.formsoc.submit();
}); });
function initfieldrequired() function initfieldrequired() {
{
jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdcompany").removeClass("fieldrequired");
jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired");
jQuery("#tdfirstname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired");
if (jQuery("#morphy").val() == \'mor\') if (jQuery("#morphy").val() == \'mor\') {
{
jQuery("#tdcompany").addClass("fieldrequired"); jQuery("#tdcompany").addClass("fieldrequired");
} }
if (jQuery("#morphy").val() == \'phy\') if (jQuery("#morphy").val() == \'phy\') {
{
jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdlastname").addClass("fieldrequired");
jQuery("#tdfirstname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired");
} }
@ -1031,6 +1035,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>'; print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>'; print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET('member_email') ? GETPOST('member_email', 'alpha') : $object->email).'"></td></tr>';
// Website
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', '', $object, 0).'</td>';
print '<td>'.img_picto('', 'globe').' <input type="text" class="maxwidth500 widthcentpercentminusx" name="member_url" id="member_url" value="'.$object->url.'"></td></tr>';
// Address // Address
print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>'; print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="2">'.(GETPOSTISSET('address') ?GETPOST('address', 'alphanohtml') : $object->address).'</textarea>';
@ -1167,17 +1175,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
document.formsoc.action.value="edit"; document.formsoc.action.value="edit";
document.formsoc.submit(); document.formsoc.submit();
}); });
function initfieldrequired() function initfieldrequired() {
{
jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdcompany").removeClass("fieldrequired");
jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired");
jQuery("#tdfirstname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired");
if (jQuery("#morphy").val() == \'mor\') if (jQuery("#morphy").val() == \'mor\') {
{
jQuery("#tdcompany").addClass("fieldrequired"); jQuery("#tdcompany").addClass("fieldrequired");
} }
if (jQuery("#morphy").val() == \'phy\') if (jQuery("#morphy").val() == \'phy\') {
{
jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdlastname").addClass("fieldrequired");
jQuery("#tdfirstname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired");
} }
@ -1278,6 +1283,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>'; print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>'; print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
// Website
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>';
print '<td colspan="3">'.img_picto('', 'globe').' <input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET('member_url') ?GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'; print '<tr><td>'.$langs->trans("Address").'</td><td>';
print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml', 2) : $object->address).'</textarea>'; print '<textarea name="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.(GETPOSTISSET("address") ? GETPOST("address", 'alphanohtml', 2) : $object->address).'</textarea>';
@ -1747,12 +1756,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print $langs->trans("SubscriptionNotNeeded"); print $langs->trans("SubscriptionNotNeeded");
} elseif (!$adht->subscription) { } elseif (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded"); 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 print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
} }
} else { } else {
print $langs->trans("SubscriptionNotReceived"); 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 print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
} }
} }
@ -1797,7 +1806,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<input type="hidden" name="rowid" value="'.$object->id.'">'; print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="set'.$htmlname.'">'; print '<input type="hidden" name="action" value="set'.$htmlname.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding">';
print '<tr><td>'; print '<tr><td>';
print $form->select_company($object->socid, 'socid', '', 1); print $form->select_company($object->socid, 'socid', '', 1);
print '</td>'; print '</td>';
@ -1862,97 +1871,91 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($action != 'editlogin' && $action != 'editthirdparty') { if ($action != 'editlogin' && $action != 'editthirdparty') {
// Send // Send
if (empty($user->socid)) { if (empty($user->socid)) {
if ($object->statut == 1) { if (Adherent::STATUS_VALIDATED == $object->statut) {
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"; 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 // Send card by email
// TODO Remove this to replace with a template // TODO Remove this to replace with a template
/* /*
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer) {
{ if (Adherent::STATUS_VALIDATED == $object->statut) {
if ($object->statut >= 1) 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";
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 {
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"; print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("ValidateBefore")).'">'.$langs->trans("SendCardByMail")."</span>";
} }
else } else {
{ print '<span class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</span>";
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>";
}*/ }*/
// Modify // Modify
if ($user->rights->adherent->creer) { 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"; print '<a class="butAction" href="card.php?rowid='.$id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
} else { } 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 // Validate
if ($object->statut == -1) { if (Adherent::STATUS_DRAFT == $object->statut) {
if ($user->rights->adherent->creer) { 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 { } 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 // Reactivate
if ($object->statut == 0 || $object->statut == -2) { if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $Object->statut) {
if ($user->rights->adherent->creer) { 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 { } 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 // Resiliate
if ($object->statut >= 1) { if (Adherent::STATUS_VALIDATED == $object->statut) {
if ($user->rights->adherent->supprimer) { 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 { } 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 // Exclude
if ($object->statut >= 1) { if (Adherent::STATUS_VALIDATED == $object->statut) {
if ($user->rights->adherent->supprimer) { 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 { } 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 // Create third party
if (!empty($conf->societe->enabled) && !$object->socid) { if (!empty($conf->societe->enabled) && !$object->socid) {
if ($user->rights->societe->creer) { if ($user->rights->societe->creer) {
if ($object->statut != -1) { if (Adherent::STATUS_DRAFT != $object->statut) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a></div>'."\n";; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_thirdparty">'.$langs->trans("CreateDolibarrThirdParty").'</a>'."\n";;
} else { } 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 { } 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 // Create user
if (!$user->socid && !$object->user_id) { if (!$user->socid && !$object->user_id) {
if ($user->rights->user->user->creer) { if ($user->rights->user->user->creer) {
if ($object->statut != -1) { if (Adherent::STATUS_DRAFT != $object->statut) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a></div>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?rowid='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'."\n";
} else { } 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 { } 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";
} }
} }
@ -1961,18 +1964,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$isinspip = $mailmanspip->is_in_spip($object); $isinspip = $mailmanspip->is_in_spip($object);
if ($isinspip == 1) { 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) { 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 // Delete
if ($user->rights->adherent->supprimer) { 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 { } 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";
} }
} }
} }
@ -2010,7 +2013,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Show links to link elements // Show links to link elements
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); /*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem; if ($linktoelem) {
print ($somethingshown?'':'<br>').$linktoelem;
}
*/ */
// Show online payment link // Show online payment link

View File

@ -44,7 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
*/ */
class Adherent extends CommonObject class Adherent extends CommonObject
{ {
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object
*/ */
@ -141,6 +140,11 @@ class Adherent extends CommonObject
*/ */
public $email; public $email;
/**
* @var string url
*/
public $url;
/** /**
* @var array array of socialnetworks * @var array array of socialnetworks
*/ */
@ -205,12 +209,11 @@ class Adherent extends CommonObject
*/ */
public $morphy; public $morphy;
/**
* @var int Info can be public
*/
public $public; public $public;
// -2:exclu, -1:brouillon, 0:resilie, >=1:valide,paye
// def in common object
//public $status;
/** /**
* @var string photo of member * @var string photo of member
*/ */
@ -309,6 +312,7 @@ class Adherent extends CommonObject
'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90), 'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90),
'country' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95), 'country' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95),
'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => -1, 'position' => 100), 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => -1, 'position' => 100),
'url' =>array('type'=>'varchar(255)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 105), 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 105),
'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115), 'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115),
'phone_perso' => array('type' => 'varchar(30)', 'label' => 'Phone perso', 'enabled' => 1, 'visible' => -1, 'position' => 120), 'phone_perso' => array('type' => 'varchar(30)', 'label' => 'Phone perso', 'enabled' => 1, 'visible' => -1, 'position' => 120),
@ -327,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), '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), '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, '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), '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) '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 * Constructor
@ -341,7 +362,8 @@ class Adherent extends CommonObject
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = -1; $this->statut = self::STATUS_DRAFT;
$this->status = $this->statut;
// l'adherent n'est pas public par defaut // l'adherent n'est pas public par defaut
$this->public = 0; $this->public = 0;
// les champs optionnels sont vides // les champs optionnels sont vides
@ -645,6 +667,7 @@ class Adherent extends CommonObject
$this->setUpperOrLowerCase(); $this->setUpperOrLowerCase();
$this->note_public = ($this->note_public ? $this->note_public : $this->note_public); $this->note_public = ($this->note_public ? $this->note_public : $this->note_public);
$this->note_private = ($this->note_private ? $this->note_private : $this->note_private); $this->note_private = ($this->note_private ? $this->note_private : $this->note_private);
$this->url = $this->url ?clean_url($this->url, 0) : '';
// Check parameters // Check parameters
if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) { if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && !isValidEMail($this->email)) {
@ -670,6 +693,7 @@ class Adherent extends CommonObject
$sql .= ", country = ".($this->country_id > 0 ? $this->db->escape($this->country_id) : "null"); $sql .= ", country = ".($this->country_id > 0 ? $this->db->escape($this->country_id) : "null");
$sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null"); $sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
$sql .= ", email = '".$this->db->escape($this->email)."'"; $sql .= ", email = '".$this->db->escape($this->email)."'";
$sql .= ", url = ".(!empty($this->url) ? "'".$this->db->escape($this->url)."'" : "null");
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'"; $sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
$sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null"); $sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null");
$sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null"); $sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null");
@ -1282,7 +1306,7 @@ class Adherent extends CommonObject
$sql = "SELECT d.rowid, d.ref, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname,"; $sql = "SELECT d.rowid, d.ref, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname,";
$sql .= " d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql .= " d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql .= " d.note_public,"; $sql .= " d.note_public,";
$sql .= " d.email, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql .= " d.email, d.url, d.socialnetworks, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
$sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql .= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
$sql .= " d.datec as datec,"; $sql .= " d.datec as datec,";
$sql .= " d.tms as datem,"; $sql .= " d.tms as datem,";
@ -1361,6 +1385,7 @@ class Adherent extends CommonObject
$this->phone_perso = $obj->phone_perso; $this->phone_perso = $obj->phone_perso;
$this->phone_mobile = $obj->phone_mobile; $this->phone_mobile = $obj->phone_mobile;
$this->email = $obj->email; $this->email = $obj->email;
$this->url = $obj->url;
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true); $this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
@ -1838,7 +1863,7 @@ class Adherent extends CommonObject
$now = dol_now(); $now = dol_now();
// Check parameters // 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); dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING);
return 0; return 0;
} }
@ -1846,7 +1871,7 @@ class Adherent extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " statut = 1"; $sql .= " statut = ".self::STATUS_VALIDATED;
$sql .= ", datevalid = '".$this->db->idate($now)."'"; $sql .= ", datevalid = '".$this->db->idate($now)."'";
$sql .= ", fk_user_valid=".$user->id; $sql .= ", fk_user_valid=".$user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -1854,7 +1879,7 @@ class Adherent extends CommonObject
dol_syslog(get_class($this)."::validate", LOG_DEBUG); dol_syslog(get_class($this)."::validate", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->statut = 1; $this->statut = self::STATUS_VALIDATED;
// Call trigger // Call trigger
$result = $this->call_trigger('MEMBER_VALIDATE', $user); $result = $this->call_trigger('MEMBER_VALIDATE', $user);
@ -1890,7 +1915,7 @@ class Adherent extends CommonObject
$error = 0; $error = 0;
// Check parameters // 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); dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING);
return 0; return 0;
} }
@ -1898,13 +1923,13 @@ class Adherent extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " statut = 0"; $sql .= " statut = ".self::STATUS_RESILIATED;
$sql .= ", fk_user_valid=".$user->id; $sql .= ", fk_user_valid=".$user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->statut = 0; $this->statut = self::STATUS_RESILIATED;
// Call trigger // Call trigger
$result = $this->call_trigger('MEMBER_RESILIATE', $user); $result = $this->call_trigger('MEMBER_RESILIATE', $user);
@ -1940,7 +1965,7 @@ class Adherent extends CommonObject
$error = 0; $error = 0;
// Check parameters // 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); dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING);
return 0; return 0;
} }
@ -1948,13 +1973,13 @@ class Adherent extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
$sql .= " statut = -2"; $sql .= " statut = ".self::STATUS_EXCLUDED;
$sql .= ", fk_user_valid=".$user->id; $sql .= ", fk_user_valid=".$user->id;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->statut = 0; $this->statut = self::STATUS_EXCLUDED;
// Call trigger // Call trigger
$result = $this->call_trigger('MEMBER_EXCLUDE', $user); $result = $this->call_trigger('MEMBER_EXCLUDE', $user);
@ -2259,11 +2284,11 @@ class Adherent extends CommonObject
$labelStatus = ''; $labelStatus = '';
$labelStatusShort = ''; $labelStatusShort = '';
if ($status == -1) { if ($status == self::STATUS_DRAFT) {
$statusType = 'status0'; $statusType = 'status0';
$labelStatus = $langs->trans("MemberStatusDraft"); $labelStatus = $langs->trans("MemberStatusDraft");
$labelStatusShort = $langs->trans("MemberStatusDraftShort"); $labelStatusShort = $langs->trans("MemberStatusDraftShort");
} elseif ($status >= 1) { } elseif ($status >= self::STATUS_VALIDATED) {
if ($need_subscription == 0) { if ($need_subscription == 0) {
$statusType = 'status4'; $statusType = 'status4';
$labelStatus = $langs->trans("MemberStatusNoSubscription"); $labelStatus = $langs->trans("MemberStatusNoSubscription");
@ -2281,11 +2306,11 @@ class Adherent extends CommonObject
$labelStatus = $langs->trans("MemberStatusPaid"); $labelStatus = $langs->trans("MemberStatusPaid");
$labelStatusShort = $langs->trans("MemberStatusPaidShort"); $labelStatusShort = $langs->trans("MemberStatusPaidShort");
} }
} elseif ($status == 0) { } elseif ($status == self::STATUS_RESILIATED) {
$statusType = 'status6'; $statusType = 'status6';
$labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatus = $langs->trans("MemberStatusResiliated");
$labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort");
} elseif ($status == -2) { } elseif ($status == self::STATUS_EXCLUDED) {
$statusType = 'status10'; $statusType = 'status10';
$labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatus = $langs->trans("MemberStatusExcluded");
$labelStatusShort = $langs->trans("MemberStatusExcludedShort"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort");
@ -2351,11 +2376,11 @@ class Adherent extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE a.fk_adherent_type = t.rowid"; $sql .= " WHERE a.fk_adherent_type = t.rowid";
if ($mode == 'expired') { 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.entity IN (".getEntity('adherent').")";
$sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')"; $sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')";
} elseif ($mode == 'shift') { } elseif ($mode == 'shift') {
$sql .= " AND a.statut = -1"; $sql .= " AND a.statut = ".self::STATUS_DRAFT;
$sql .= " AND a.entity IN (".getEntity('adherent').")"; $sql .= " AND a.entity IN (".getEntity('adherent').")";
} }
@ -2372,10 +2397,10 @@ class Adherent extends CommonObject
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
$label = $langs->trans("MembersWithSubscriptionToReceive"); $label = $langs->trans("MembersWithSubscriptionToReceive");
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut=1&amp;filter=outofdate'; $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut='.self::STATUS_VALIDATED.'&amp;filter=outofdate';
} elseif ($mode == 'shift') { } elseif ($mode == 'shift') {
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut=-1'; $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&amp;statut='.self::STATUS_DRAFT;
$label = $langs->trans("MembersListToValid"); $label = $langs->trans("MembersListToValid");
$labelShort = $langs->trans("ToValidate"); $labelShort = $langs->trans("ToValidate");
} }
@ -2488,7 +2513,7 @@ class Adherent extends CommonObject
$this->birth = $now; $this->birth = $now;
$this->photo = ''; $this->photo = '';
$this->public = 1; $this->public = 1;
$this->statut = 0; $this->statut = self::STATUS_DRAFT;
$this->datefin = $now; $this->datefin = $now;
$this->datevalid = $now; $this->datevalid = $now;
@ -2807,7 +2832,7 @@ class Adherent extends CommonObject
global $conf; global $conf;
//Only valid members //Only valid members
if ($this->statut <= 0) { if ($this->statut != self::STATUS_VALIDATED) {
return false; return false;
} }
if (!$this->datefin) { if (!$this->datefin) {

View File

@ -89,6 +89,11 @@ class AdherentType extends CommonObject
*/ */
public $subscription; public $subscription;
/**
* @var float amount for subscription
*/
public $amount;
/** @var string Public note */ /** @var string Public note */
public $note; public $note;
@ -361,6 +366,7 @@ class AdherentType extends CommonObject
$sql .= "libelle = '".$this->db->escape($this->label)."',"; $sql .= "libelle = '".$this->db->escape($this->label)."',";
$sql .= "morphy = '".$this->db->escape($this->morphy)."',"; $sql .= "morphy = '".$this->db->escape($this->morphy)."',";
$sql .= "subscription = '".$this->db->escape($this->subscription)."',"; $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 .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
$sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "note = '".$this->db->escape($this->note)."',";
$sql .= "vote = ".(integer) $this->db->escape($this->vote).","; $sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
@ -455,7 +461,7 @@ class AdherentType extends CommonObject
{ {
global $langs, $conf; 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 .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $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_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1);
$this->duration_unit = substr($obj->duration, -1); $this->duration_unit = substr($obj->duration, -1);
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->amount = $obj->amount;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note;
$this->vote = $obj->vote; $this->vote = $obj->vote;
@ -535,6 +542,45 @@ class AdherentType extends CommonObject
return $adherenttypes; 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) * Return array of Member objects for member type this->id (or all if this->id not defined)
* *

View File

@ -240,7 +240,7 @@ class Members extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -105,7 +105,7 @@ class MembersTypes extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -103,7 +103,7 @@ class Subscriptions extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -247,6 +247,42 @@ if (empty($reshook)) {
} }
} }
// Create external user
if ($massaction == 'createexternaluser' && $user->rights->adherent->creer && $user->rights->user->user->creer) {
$tmpmember = new Adherent($db);
$error = 0;
$nbcreated = 0;
$db->begin();
foreach ($toselect as $idtoclose) {
$tmpmember->fetch($idtoclose);
if (!empty($tmpmember->fk_soc)) {
$nuser = new User($db);
$tmpuser = dol_clone($tmpmember);
$result = $nuser->create_from_member($tmpuser, $tmpmember->login);
if ($result < 0 && !count($tmpmember->errors)) {
setEventMessages($tmpmember->error, $tmpmember->errors, 'errors');
} else {
if ($result > 0) {
$nbcreated++;
}
}
}
}
if (!$error) {
setEventMessages($langs->trans("XExternalUserCreated", $nbcreated), null, 'mesgs');
$db->commit();
} else {
$db->rollback();
}
}
// Mass actions // Mass actions
$objectclass = 'Adherent'; $objectclass = 'Adherent';
$objectlabel = 'Members'; $objectlabel = 'Members';
@ -555,6 +591,9 @@ if ($user->rights->adherent->supprimer) {
if ($user->rights->societe->creer) { if ($user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
} }
if ($user->rights->adherent->creer && $user->rights->user->user->creer) {
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
}
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) { if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
$arrayofmassactions = array(); $arrayofmassactions = array();
} }
@ -1063,7 +1102,7 @@ while ($i < min($num, $limit)) {
print '</td>'; print '</td>';
} else { } else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($obj->subscription == 'yes') { if (!empty($obj->subscription)) {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($obj->statut > 0) { if ($obj->statut > 0) {
print " ".img_warning(); print " ".img_warning();

View File

@ -0,0 +1,558 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 NextGestion <contact@nextgestion.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 partnership_card.php
* \ingroup partnership
* \brief Page to create/edit/view partnership
*/
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment
$res = 0;
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
}
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
$i--; $j--;
}
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
}
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
}
// Try main.inc.php using relative path
if (!$res && file_exists("../main.inc.php")) {
$res = @include "../main.inc.php";
}
if (!$res && file_exists("../../main.inc.php")) {
$res = @include "../../main.inc.php";
}
if (!$res && file_exists("../../../main.inc.php")) {
$res = @include "../../../main.inc.php";
}
if (!$res) {
die("Include of main fails");
}
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
dol_include_once('/partnership/class/partnership.class.php');
dol_include_once('/partnership/lib/partnership.lib.php');
// Load translation files required by the page
$langs->loadLangs(array("companies","members","partnership", "other"));
// Get parameters
$id = GETPOST('id', 'int');
$memberid = GETPOST('rowid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'partnershipcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$member = new Adherent($db);
if ($memberid > 0) {
$member->fetch($memberid);
}
// Initialize technical objects
$object = new Partnership($db);
$extrafields = new ExtraFields($db);
$adht = new AdherentType($db);
$diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('partnershipthirdparty', 'globalcard')); // Note that conf->hooks_modules contains array
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
// Initialize array of search criterias
$search_all = GETPOST("search_all", 'alpha');
$search = array();
foreach ($object->fields as $key => $val) {
if (GETPOST('search_'.$key, 'alpha')) {
$search[$key] = GETPOST('search_'.$key, 'alpha');
}
}
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$permissiontoread = $user->rights->partnership->read;
$permissiontoadd = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->partnership->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->partnership->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->partnership->write; // Used by the include of actions_dellink.inc.php
$usercanclose = $user->rights->partnership->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$upload_dir = $conf->partnership->multidir_output[isset($object->entity) ? $object->entity : 1];
if ($conf->global->PARTNERSHIP_IS_MANAGED_FOR != 'member') accessforbidden();
if (empty($conf->partnership->enabled)) accessforbidden();
if (empty($permissiontoread)) accessforbidden();
if ($action == 'edit' && empty($permissiontoadd)) accessforbidden();
$partnershipid = $object->fetch(0, "", $memberid);
if (empty($action) && empty($partnershipid)) {
$action = 'create';
}
if (($action == 'update' || $action == 'edit') && $object->status != $object::STATUS_DRAFT) accessforbidden();
if (empty($memberid) && $object) {
$memberid = $object->fk_member;
}
/*
* Actions
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$date_start = dol_mktime(0, 0, 0, GETPOST('date_partnership_startmonth', 'int'), GETPOST('date_partnership_startday', 'int'), GETPOST('date_partnership_startyear', 'int'));
$date_end = dol_mktime(0, 0, 0, GETPOST('date_partnership_endmonth', 'int'), GETPOST('date_partnership_endday', 'int'), GETPOST('date_partnership_endyear', 'int'));
if (empty($reshook)) {
$error = 0;
$backtopage = dol_buildpath('/partnership/partnership.php', 1).'?rowid='.($memberid > 0 ? $memberid : '__ID__');
$triggermodname = 'PARTNERSHIP_MODIFY'; // Name of trigger action code to execute when we modify record
if ($action == 'add' && $permissiontoread) {
$error = 0;
$db->begin();
$now = dol_now();
if (!$error) {
$old_start_date = $object->date_partnership_start;
$object->fk_member = $memberid;
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->date_creation = $now;
$object->fk_user_creat = $user->id;
$object->entity = $conf->entity;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
}
if (!$error) {
$result = $object->create($user);
if ($result < 0) {
$error++;
if ($result == -4) {
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if ($error) {
$db->rollback();
$action = 'create';
} else {
$db->commit();
}
} elseif ($action == 'update' && $permissiontoread) {
$error = 0;
$db->begin();
$now = dol_now();
if (!$error) {
$object->oldcopy = clone $object;
$old_start_date = $object->date_partnership_start;
$object->date_partnership_start = (!GETPOST('date_partnership_start')) ? '' : $date_start;
$object->date_partnership_end = (!GETPOST('date_partnership_end')) ? '' : $date_end;
$object->note_public = GETPOST('note_public', 'restricthtml');
$object->fk_user_creat = $user->id;
$object->fk_user_modif = $user->id;
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
}
if (!$error) {
$result = $object->update($user);
if ($result < 0) {
$error++;
if ($result == -4) {
setEventMessages($langs->trans("ErrorRefAlreadyExists"), null, 'errors');
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
if ($error) {
$db->rollback();
$action = 'edit';
} else {
$db->commit();
}
} elseif ($action == 'confirm_close' || $action == 'update_extras') {
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
header("Location: ".$_SERVER['PHP_SELF']."?rowid=".$memberid);
exit;
}
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
}
$object->fields['fk_member']['visible'] = 0;
if ($object->id > 0 && $object->status == $object::STATUS_REFUSED && empty($action)) $object->fields['reason_decline_or_cancel']['visible'] = 1;
$object->fields['note_public']['visible'] = 1;
/*
* View
*
* Put here all code to build page
*/
$form = new Form($db);
$formfile = new FormFile($db);
$title = $langs->trans("Partnership");
llxHeader('', $title);
$form = new Form($db);
if ($memberid) {
$langs->load("members");
$member = new Adherent($db);
$result = $member->fetch($memberid);
if (!empty($conf->notification->enabled)) {
$langs->load("mails");
}
$adht->fetch($object->typeid);
$head = member_prepare_head($member);
print dol_get_fiche_head($head, 'partnership', $langs->trans("ThirdParty"), -1, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($member, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$member->login.'&nbsp;</td></tr>';
}
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$member->getmorphylib().'</td>';
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$member->company.'</td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$member->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
print '</table>';
print '</div>';
print dol_get_fiche_end();
$params = '';
print '<br>';
} else {
dol_print_error('', 'Parameter rowid not defined');
}
// Part to create
if ($action == 'create') {
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Partnership")), '', '');
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid;
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="rowid" value="'.$memberid.'">';
print '<input type="hidden" name="fk_member" value="'.$memberid.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print dol_get_fiche_head(array(), '');
print '<table class="border centpercent tableforfieldcreate">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '</table>'."\n";
print dol_get_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Validate")).'">';
print '&nbsp; ';
// print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="javascript:history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
print '</div>';
print '</form>';
}
// Part to edit record
if (($partnershipid || $ref) && $action == 'edit') {
print load_fiche_titre($langs->trans("Partnership"), '', '');
$backtopageforcancel = DOL_URL_ROOT.'/partnership/partnership.php?rowid='.$memberid;
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 '<input type="hidden" name="rowid" value="'.$memberid.'">';
print '<input type="hidden" name="fk_member" value="'.$memberid.'">';
if ($backtopage) {
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
if ($backtopageforcancel) {
print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
}
print dol_get_fiche_head();
print '<table class="border centpercent tableforfieldedit">'."\n";
// Common attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
print '</table>';
print dol_get_fiche_end();
print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
print load_fiche_titre($langs->trans("PartnershipDedicatedToThisMember", $langs->transnoentitiesnoconv("Partnership")), '', '');
$res = $object->fetch_optionals();
// $head = partnershipPrepareHead($object);
// print dol_get_fiche_head($head, 'card', $langs->trans("Partnership"), -1, $object->picto);
$linkback = '';
dol_banner_tab($object, 'id', $linkback, 0, 'rowid', 'ref');
$formconfirm = '';
// Close confirmation
if ($action == 'close') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClose'), $langs->trans('ConfirmClosePartnershipAsk', $object->ref), 'confirm_close', $formquestion, 'yes', 1);
}
// Reopon confirmation
if ($action == 'reopen') {
// Create an array for form
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToReopon'), $langs->trans('ConfirmReoponAsk', $object->ref), 'confirm_reopen', $formquestion, 'yes', 1);
}
// Refuse confirmatio
if ($action == 'refuse') {
//Form to close proposal (signed or not)
$formquestion = array(
array('type' => 'text', 'name' => 'reason_decline_or_cancel', 'label' => $langs->trans("Note"), 'morecss' => 'reason_decline_or_cancel', 'value' => '') // Field to complete private note (not replace)
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReasonDecline'), $text, 'confirm_refuse', $formquestion, '', 1, 250);
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
$formconfirm .= $hookmanager->resPrint;
} elseif ($reshook > 0) {
$formconfirm = $hookmanager->resPrint;
}
// Print form confirm
print $formconfirm;
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/partnership/partnership_list.php', 1).'?restore_lastsearch_values=1'.(!empty($memberid) ? '&rowid='.$memberid : '').'">'.$langs->trans("BackToList").'</a>';
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent tableforfield">'."\n";
// Common attributes
//$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field
//unset($object->fields['fk_project']); // Hide field already shown in banner
//unset($object->fields['fk_member']); // Hide field already shown in banner
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
// End of subscription date
$fadherent = new Adherent($db);
$fadherent->fetch($object->fk_member);
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
if ($fadherent->datefin) {
print dol_print_date($fadherent->datefin, 'day');
if ($fadherent->hasDelay()) {
print " ".img_warning($langs->trans("Late"));
}
} else {
if (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($fadherent->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
} else {
print $langs->trans("SubscriptionNotReceived");
if ($fadherent->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
}
}
}
print '</td></tr>';
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="clearboth"></div>';
print dol_get_fiche_end();
// Buttons for actions
if ($action != 'presend') {
print '<div class="tabsAction">'."\n";
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
if ($object->status == $object::STATUS_DRAFT) {
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?rowid='.$memberid.'&action=edit', '', $permissiontoadd);
}
// Show
if ($permissiontoadd) {
print dolGetButtonAction($langs->trans('ShowPartnership'), '', 'default', dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$object->id, '', $permissiontoadd);
}
// Cancel
if ($permissiontoadd) {
if ($object->status == $object::STATUS_ACCEPTED) {
print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
}
}
}
print '</div>'."\n";
}
}
// End of page
llxFooter();
$db->close();

View File

@ -590,7 +590,7 @@ if ($rowid > 0) {
print '<input type="hidden" name="rowid" value="'.$object->id.'">'; print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="set'.$htmlname.'">'; print '<input type="hidden" name="action" value="set'.$htmlname.'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding">';
print '<tr><td>'; print '<tr><td>';
print $form->select_company($object->fk_soc, 'socid', '', 1); print $form->select_company($object->fk_soc, 'socid', '', 1);
print '</td>'; print '</td>';

View File

@ -7,6 +7,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net> * Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat> * 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 * 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 * 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"); $morphy = GETPOST("morphy", "alpha");
$status = GETPOST("status", "int"); $status = GETPOST("status", "int");
$subscription = GETPOST("subscription", "int"); $subscription = GETPOST("subscription", "int");
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
$duration_value = GETPOST('duration_value', 'int'); $duration_value = GETPOST('duration_value', 'int');
$duration_unit = GETPOST('duration_unit', 'alpha'); $duration_unit = GETPOST('duration_unit', 'alpha');
$vote = GETPOST("vote", "int"); $vote = GETPOST("vote", "int");
@ -117,6 +119,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
$object->morphy = trim($morphy); $object->morphy = trim($morphy);
$object->status = (int) $status; $object->status = (int) $status;
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
$object->amount = $amount;
$object->duration_value = $duration_value; $object->duration_value = $duration_value;
$object->duration_unit = $duration_unit; $object->duration_unit = $duration_unit;
$object->note = trim($comment); $object->note = trim($comment);
@ -164,10 +167,11 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->oldcopy = clone $object; $object->oldcopy = clone $object;
$object->label = trim($label); $object->label= trim($label);
$object->morphy = trim($morphy); $object->morphy = trim($morphy);
$object->status = (int) $status; $object->status = (int) $status;
$object->subscription = (int) $subscription; $object->subscription = (int) $subscription;
$object->amount = $amount;
$object->duration_value = $duration_value; $object->duration_value = $duration_value;
$object->duration_unit = $duration_unit; $object->duration_unit = $duration_unit;
$object->note = trim($comment); $object->note = trim($comment);
@ -222,7 +226,7 @@ llxHeader('', $langs->trans("MembersTypeSetup"), $help_url);
if (!$rowid && $action != 'create' && $action != 'edit') { if (!$rowid && $action != 'create' && $action != 'edit') {
//print dol_get_fiche_head(''); //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 .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.entity IN (".getEntity('member_type').")"; $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>'.$langs->trans("Label").'</th>';
print '<th class="center">'.$langs->trans("MembersNature").'</th>'; print '<th class="center">'.$langs->trans("MembersNature").'</th>';
print '<th class="center">'.$langs->trans("SubscriptionRequired").'</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("VoteAllowed").'</th>';
print '<th class="center">'.$langs->trans("Status").'</th>'; print '<th class="center">'.$langs->trans("Status").'</th>';
print '<th>&nbsp;</th>'; print '<th>&nbsp;</th>';
@ -283,6 +288,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$membertype->label = $objp->rowid; $membertype->label = $objp->rowid;
$membertype->status = $objp->status; $membertype->status = $objp->status;
$membertype->subscription = $objp->subscription; $membertype->subscription = $objp->subscription;
$membertype->amount = $objp->amount;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
@ -300,6 +306,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
} }
print '</td>'; print '</td>';
print '<td class="center">'.yn($objp->subscription).'</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">'.yn($objp->vote).'</td>';
print '<td class="center">'.$membertype->getLibStatut(5).'</td>'; print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if ($user->rights->adherent->configurer) { if ($user->rights->adherent->configurer) {
@ -358,6 +365,10 @@ if ($action == 'create') {
print $form->selectyesno("subscription", 1, 1); print $form->selectyesno("subscription", 1, 1);
print '</td></tr>'; 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 '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1); print $form->selectyesno("vote", GETPOSTISSET("vote") ? GETPOST('vote', 'aZ09') : 1, 1);
print '</td></tr>'; print '</td></tr>';
@ -434,6 +445,10 @@ if ($rowid > 0) {
print yn($object->subscription); print yn($object->subscription);
print '</tr>'; 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 '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($object->vote); print yn($object->vote);
print '</tr>'; print '</tr>';
@ -496,13 +511,13 @@ if ($rowid > 0) {
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,"; $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,";
$sql .= " d.datefin,"; $sql .= " d.datefin,";
$sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; $sql .= " d.email, d.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 .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid "; $sql .= " WHERE d.fk_adherent_type = t.rowid ";
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
$sql .= " AND t.rowid = ".((int) $object->id); $sql .= " AND t.rowid = ".((int) $object->id);
if ($sall) { 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 != '') { if ($status != '') {
$sql .= natural_search('d.statut', $status, 2); $sql .= natural_search('d.statut', $status, 2);
@ -702,7 +717,7 @@ if ($rowid > 0) {
print '</td>'; print '</td>';
} else { } else {
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($objp->subscription == 'yes') { if (!empty($objp->subscription)) {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->status > 0) { if ($objp->status > 0) {
print " ".img_warning(); print " ".img_warning();
@ -781,6 +796,10 @@ if ($rowid > 0) {
print $form->selectyesno("subscription", $object->subscription, 1); print $form->selectyesno("subscription", $object->subscription, 1);
print '</td></tr>'; 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 '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote", $object->vote, 1); print $form->selectyesno("vote", $object->vote, 1);
print '</td></tr>'; print '</td></tr>';

View File

@ -87,7 +87,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
if ($object->setMultiLangs($user) > 0) { if ($object->setMultiLangs($user) > 0) {
$action = ''; $action = '';
} else { } else {
$action = 'add'; $action = 'create';
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -185,7 +185,7 @@ print "\n<div class=\"tabsAction\">\n";
if ($action == '') { if ($action == '') {
if ($user->rights->produit->creer || $user->rights->service->creer) { 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) { 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>'; 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)) { if (!empty($object->multilangs)) {
foreach ($object->multilangs as $key => $value) { foreach ($object->multilangs as $key => $value) {
$s = picto_from_langcode($key); $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 '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
@ -231,11 +237,17 @@ if ($action == 'edit') {
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} elseif ($action != 'add') { } elseif ($action != 'create') {
if (!empty($object->multilangs)) { if (!empty($object->multilangs)) {
foreach ($object->multilangs as $key => $value) { foreach ($object->multilangs as $key => $value) {
$s = picto_from_langcode($key); $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="fichecenter">';
print '<div class="underbanner clearboth"></div>'; 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 '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br>';
} }
} }
if (!$cnt_trans && $action != 'add') { if (!$cnt_trans && $action != 'create') {
print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>'; print '<div class="opacitymedium">'.$langs->trans('NoTranslation').'</div>';
} }
} }
@ -257,7 +271,7 @@ if ($action == 'edit') {
* Form to add a new translation * Form to add a new translation
*/ */
if ($action == 'add' && $user->rights->adherent->configurer) { if ($action == 'create' && $user->rights->adherent->configurer) {
//WYSIWYG Editor //WYSIWYG Editor
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';

View File

@ -359,16 +359,16 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE
print '<div>'; print '<div>';
print '<div class="inline-block" style="padding-right: 20px">'; print '<div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 0, $options); print img_weather($text, 0, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL0').'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 1, $options); print img_weather($text, 1, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL1').'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 2, $options); print img_weather($text, 2, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL2').'"/>&nbsp;%</td>';
print '</div><div class="inline-block" style="padding-right: 20px">'; print '</div><div class="inline-block" style="padding-right: 20px">';
print img_weather($text, 3, $options); print img_weather($text, 3, $options);
print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/>&nbsp;%</td>'; print ' &lt;= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.getDolGlobalString('MAIN_METEO_PERCENTAGE_LEVEL3').'"/>&nbsp;%</td>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';

View File

@ -100,7 +100,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 25, 0); $taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 0, 29, 0, 33, 34, 32, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 15, 30, 0, 37, 42, 0, 25, 0, 43, 0);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname = array(); $tabname = array();
@ -146,6 +146,7 @@ $tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact"; $tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
$tabname[41] = MAIN_DB_PREFIX."c_transport_mode"; $tabname[41] = MAIN_DB_PREFIX."c_transport_mode";
$tabname[42] = MAIN_DB_PREFIX."c_product_nature"; $tabname[42] = MAIN_DB_PREFIX."c_product_nature";
$tabname[43] = MAIN_DB_PREFIX."c_productbatch_qcstatus";
// Dictionary labels // Dictionary labels
$tablib = array(); $tablib = array();
@ -191,6 +192,7 @@ $tablib[39] = "DictionaryProspectContactLevel";
$tablib[40] = "DictionaryProspectContactStatus"; $tablib[40] = "DictionaryProspectContactStatus";
$tablib[41] = "DictionaryTransportMode"; $tablib[41] = "DictionaryTransportMode";
$tablib[42] = "DictionaryProductNature"; $tablib[42] = "DictionaryProductNature";
$tablib[43] = "DictionaryBatchStatus";
// Requests to extract data // Requests to extract data
$tabsql = array(); $tabsql = array();
@ -236,6 +238,7 @@ $tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_P
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact"; $tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
$tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode"; $tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode";
$tabsql[42] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_product_nature"; $tabsql[42] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_product_nature";
$tabsql[43] = "SELECT rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_productbatch_qcstatus";
// Criteria to sort dictionaries // Criteria to sort dictionaries
$tabsqlsort = array(); $tabsqlsort = array();
@ -281,6 +284,7 @@ $tabsqlsort[39] = "sortorder ASC";
$tabsqlsort[40] = "code ASC"; $tabsqlsort[40] = "code ASC";
$tabsqlsort[41] = "code ASC"; $tabsqlsort[41] = "code ASC";
$tabsqlsort[42] = "code ASC"; $tabsqlsort[42] = "code ASC";
$tabsqlsort[43] = "code ASC";
// Field names in select result for dictionary display // Field names in select result for dictionary display
$tabfield = array(); $tabfield = array();
@ -326,6 +330,7 @@ $tabfield[39] = "code,libelle,sortorder";
$tabfield[40] = "code,libelle,picto"; $tabfield[40] = "code,libelle,picto";
$tabfield[41] = "code,label"; $tabfield[41] = "code,label";
$tabfield[42] = "code,label"; $tabfield[42] = "code,label";
$tabfield[43] = "code,label";
// Edit field names for editing a record // Edit field names for editing a record
$tabfieldvalue = array(); $tabfieldvalue = array();
@ -371,6 +376,7 @@ $tabfieldvalue[39] = "code,libelle,sortorder";
$tabfieldvalue[40] = "code,libelle,picto"; $tabfieldvalue[40] = "code,libelle,picto";
$tabfieldvalue[41] = "code,label"; $tabfieldvalue[41] = "code,label";
$tabfieldvalue[42] = "code,label"; $tabfieldvalue[42] = "code,label";
$tabfieldvalue[43] = "code,label";
// Field names in the table for inserting a record // Field names in the table for inserting a record
$tabfieldinsert = array(); $tabfieldinsert = array();
@ -417,6 +423,7 @@ $tabfieldinsert[39] = "code,label,sortorder";
$tabfieldinsert[40] = "code,libelle,picto"; $tabfieldinsert[40] = "code,libelle,picto";
$tabfieldinsert[41] = "code,label"; $tabfieldinsert[41] = "code,label";
$tabfieldinsert[42] = "code,label"; $tabfieldinsert[42] = "code,label";
$tabfieldinsert[43] = "code,label";
// Rowid name of field depending if field is autoincrement on or off.. // Rowid name of field depending if field is autoincrement on or off..
// Use "" if id field is "rowid" and has autoincrement on // Use "" if id field is "rowid" and has autoincrement on
@ -464,6 +471,7 @@ $tabrowid[39] = "code";
$tabrowid[40] = "id"; $tabrowid[40] = "id";
$tabrowid[41] = ""; $tabrowid[41] = "";
$tabrowid[42] = "rowid"; $tabrowid[42] = "rowid";
$tabrowid[43] = "rowid";
// Condition to show dictionary in setup page // Condition to show dictionary in setup page
$tabcond = array(); $tabcond = array();
@ -509,6 +517,7 @@ $tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_
$tabcond[40] = (!empty($conf->societe->enabled) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)); $tabcond[40] = (!empty($conf->societe->enabled) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
$tabcond[41] = !empty($conf->intracommreport->enabled); $tabcond[41] = !empty($conf->intracommreport->enabled);
$tabcond[42] = !empty($conf->product->enabled); $tabcond[42] = !empty($conf->product->enabled);
$tabcond[43] = !empty($conf->product->enabled) && !empty($conf->productbatch->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2;
// List of help for fields // List of help for fields
$tabhelp = array(); $tabhelp = array();
@ -554,55 +563,58 @@ $tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp")); $tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"));
$tabhelp[41] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[41] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[42] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[42] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[43] = array('code'=>$langs->trans("EnterAnyCode"));
// Table to store complete informations (will replace all other table). Key is table name.
$tabcomplete = array(
'c_forme_juridique'=>array('picto'=>'company'),
'c_departements'=>array('picto'=>'country'),
'c_regions'=>array('picto'=>'country'),
'c_country'=>array('picto'=>'country'),
'c_civility'=>array('picto'=>'contact'),
'c_actioncomm'=>array('picto'=>'action'),
'c_chargesociales'=>array('picto'=>'bill'),
'c_typent'=>array('picto'=>'company'),
'c_currencies'=>array('picto'=>'multicurrency'),
'c_tva'=>array('picto'=>'bill'),
'c_type_contact'=>array('picto'=>'contact'),
'c_payment_term'=>array('picto'=>'bill'),
'c_paiement'=>array('picto'=>'bill'),
'c_ecotaxe'=>array('picto'=>'bill'),
'c_paper_format'=>array('picto'=>'generic'),
'c_prospectlevel'=>array('picto'=>'company'),
'c_type_fees'=>array('picto'=>'trip'),
'c_effectif'=>array('picto'=>'company'),
'c_input_method'=>array('picto'=>'order'),
'c_input_reason'=>array('picto'=>'order'),
'c_availability'=>array('picto'=>'shipment'),
'c_shipment_mode'=>array('picto'=>'shipment'),
'c_revenuestamp'=>array('picto'=>'bill'),
'c_type_resource'=>array('picto'=>'resource'),
'c_type_container'=>array('picto'=>'website'),
'c_stcomm'=>array('picto'=>'company'),
'c_holiday_types'=>array('picto'=>'holiday'),
'c_lead_status'=>array('picto'=>'project'),
'c_format_cards'=>array('picto'=>'generic'),
'c_hrm_public_holiday'=>array('picto'=>'holiday'),
'c_hrm_department'=>array('picto'=>'hrm'),
'c_hrm_function'=>array('picto'=>'hrm'),
'c_exp_tax_cat'=>array('picto'=>'expensereport'),
'c_exp_tax_range'=>array('picto'=>'expensereport'),
'c_units'=>array('picto'=>'product'),
'c_socialnetworks'=>array('picto'=>'share-alt'),
'c_product_nature'=>array('picto'=>'product'),
'c_transport_mode'=>array('picto'=>'incoterm'),
'c_prospectcontactlevel'=>array('picto'=>'company'),
'c_stcommcontact'=>array('picto'=>'company'),
'c_product_nature'=>array('picto'=>'product'),
'c_productbatch_qcstatus'=>array('picto'=>'batch'),
);
// List of check for fields (NOT USED YET)
$tabfieldcheck = array();
$tabfieldcheck[1] = array();
$tabfieldcheck[2] = array();
$tabfieldcheck[3] = array();
$tabfieldcheck[4] = array();
$tabfieldcheck[5] = array();
$tabfieldcheck[6] = array();
$tabfieldcheck[7] = array();
$tabfieldcheck[8] = array();
$tabfieldcheck[9] = array();
$tabfieldcheck[10] = array();
$tabfieldcheck[11] = array();
$tabfieldcheck[12] = array();
$tabfieldcheck[13] = array();
$tabfieldcheck[14] = array();
$tabfieldcheck[15] = array();
$tabfieldcheck[16] = array();
$tabfieldcheck[17] = array();
$tabfieldcheck[18] = array();
$tabfieldcheck[19] = array();
$tabfieldcheck[20] = array();
$tabfieldcheck[21] = array();
$tabfieldcheck[22] = array();
$tabfieldcheck[23] = array();
$tabfieldcheck[24] = array();
$tabfieldcheck[25] = array();
//$tabfieldcheck[26] = array();
$tabfieldcheck[27] = array();
$tabfieldcheck[28] = array();
$tabfieldcheck[29] = array();
$tabfieldcheck[30] = array();
//$tabfieldcheck[31] = array();
$tabfieldcheck[32] = array();
$tabfieldcheck[33] = array();
$tabfieldcheck[34] = array();
$tabfieldcheck[35] = array();
$tabfieldcheck[36] = array();
$tabfieldcheck[37] = array();
$tabfieldcheck[38] = array();
$tabfieldcheck[39] = array();
$tabfieldcheck[40] = array();
$tabfieldcheck[41] = array();
$tabfieldcheck[42] = array();
// Complete all arrays with entries found into modules // Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck); complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabcomplete);
// Defaut sortorder // Defaut sortorder
if (empty($sortfield)) { if (empty($sortfield)) {
@ -1968,6 +1980,9 @@ if ($id) {
} elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_product_nature') { } elseif ($value == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_product_nature') {
$langs->load("products"); $langs->load("products");
$valuetoshow = $langs->trans($obj->{$value}); $valuetoshow = $langs->trans($obj->{$value});
} elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_productbatch_qcstatus') {
$langs->load("productbatch");
$valuetoshow = $langs->trans($obj->{$value});
} }
$class .= ($class ? ' ' : '').'tddict'; $class .= ($class ? ' ' : '').'tddict';
if ($value == 'note' && $id == 10) { if ($value == 'note' && $id == 10) {
@ -2123,7 +2138,7 @@ if ($id) {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("Dictionary").'</td>'; print '<td colspan="2">'.$langs->trans("Dictionary").'</td>';
print '<td>'.$langs->trans("Table").'</td>'; print '<td></td>';
print '</tr>'; print '</tr>';
$showemptyline = ''; $showemptyline = '';
@ -2142,18 +2157,26 @@ if ($id) {
$value = $tabname[$i]; $value = $tabname[$i];
print '<tr class="oddeven"><td width="50%">'; print '<tr class="oddeven"><td width="50%">';
if (!empty($tabcond[$i])) { if (!empty($tabcond[$i])) {
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">'.$langs->trans($tablib[$i]).'</a>'; $tabnamenoprefix = preg_replace('/'.MAIN_DB_PREFIX.'/', '', $tabname[$i]);
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">';
if (!empty($tabcomplete[$tabnamenoprefix]['picto'])) {
print img_picto('', $tabcomplete[$tabnamenoprefix]['picto'], 'class="pictofixedwidth paddingrightonly"');
}
print $langs->trans($tablib[$i]);
print '</a>';
} else { } else {
print $langs->trans($tablib[$i]); print $langs->trans($tablib[$i]);
} }
print '</td>'; print '</td>';
print '<td>'; print '<td>';
/*if (empty($tabcond[$i])) print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?id='.$i.'">';
{ print img_picto('Edit', 'edit', '');
print info_admin($langs->trans("DictionaryDisabledSinceNoModuleNeedIt"),1); print '</a>';
}*/
print '</td>'; print '</td>';
print '<td>'.$tabname[$i].'</td></tr>'; print '<td class="right">';
print $form->textwithpicto('', $langs->trans("Table").': '.$tabname[$i]);
print '</td>';
print '</tr>';
$lastlineisempty = false; $lastlineisempty = false;
} else { } else {
if (!$lastlineisempty) { if (!$lastlineisempty) {

View File

@ -61,11 +61,15 @@ $arrayofparameters = array(
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1),
'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1), 'EVENTORGANIZATION_SECUREKEY'=>array('type'=>'securekey', 'enabled'=>1),
'SERVICE_BOOTH_LOCATION'=>array('type'=>'product', 'enabled'=>1),
'SERVICE_CONFERENCE_ATTENDEE_SUBSCRIPTION'=>array('type'=>'product', 'enabled'=>1),
); );
$error = 0; $error = 0;
$setupnotempty = 0; $setupnotempty = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
/* /*
* Actions * Actions
@ -180,15 +184,14 @@ if ($action == 'updateMask') {
$form = new Form($db); $form = new Form($db);
//$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$page_name = "EventOrganizationSetup"; $page_name = "EventOrganizationSetup";
llxHeader('', $langs->trans($page_name)); llxHeader('', $langs->trans($page_name));
// Subheader // Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>'; $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 // Configuration header
$head = eventorganizationAdminPrepareHead(); $head = eventorganizationAdminPrepareHead();
@ -276,8 +279,13 @@ if ($action == 'edit') {
});'; });';
print '</script>'; print '</script>';
} }
} elseif ($val['type'] == 'product') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname);
$form->select_produits($selected, $constname, '', 0);
}
} else { } else {
print '<input name="'.$constname.'" class="flat '.(empty($val['css']) ? 'minwidth200' : $val['css']).'" value="'.$conf->global->{$constname}.'">'; print '<input name="' . $constname . '" class="flat ' . (empty($val['css']) ? 'minwidth200' : $val['css']) . '" value="' . $conf->global->{$constname} . '">';
} }
print '</td></tr>'; print '</td></tr>';
} }
@ -346,6 +354,14 @@ if ($action == 'edit') {
} elseif ($conf->global->{$constname}==0) { } elseif ($conf->global->{$constname}==0) {
print $langs->trans("NorProspectNorCustomer"); print $langs->trans("NorProspectNorCustomer");
} }
} elseif ($val['type'] == 'product') {
$product = new Product($db);
$resprod = $product->fetch($conf->global->{$constname});
if ($resprod > 0) {
print $product->ref;
} elseif ($resprod < 0) {
setEventMessages(null, $object->errors, "errors");
}
} else { } else {
print $conf->global->{$constname}; print $conf->global->{$constname};
} }

View File

@ -59,12 +59,14 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * 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>'; $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(); $head = eventorganizationAdminPrepareHead();

View File

@ -63,17 +63,19 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View * 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>'; $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(); $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'; require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -312,8 +312,9 @@ print '<br>';
// Other // Other
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="otherparameters" class="noborder centpercent editmode">'; print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th>'.$langs->trans("Miscellaneous").'</th><th></th>'; print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("Miscellaneous").'</th>';
print '<th></th>';
print '<th width="20">&nbsp;</tg>'; print '<th width="20">&nbsp;</tg>';
print '</tr>'; print '</tr>';
@ -402,7 +403,7 @@ print '</tr>';
// Show bugtrack link // Show bugtrack link
print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" size="32" value="'.(isset($conf->global->MAIN_BUGTRACK_ENABLELINK) ? $conf->global->MAIN_BUGTRACK_ENABLELINK : '').'">'; print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="'.(empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ? '' : $conf->global->MAIN_BUGTRACK_ENABLELINK).'">';
print '</td>'; print '</td>';
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -441,8 +442,9 @@ print '<br>';
// Other // Other
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="edit" class="noborder centpercent editmode">'; print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
print '<tr class="liste_titre"><th>'.$langs->trans("LoginPage").'</th><th></th>'; print '<tr class="liste_titre"><th class="titlefieldmiddle">'.$langs->trans("LoginPage").'</th>';
print '<th></th>';
print '<th width="20">&nbsp;</th>'; print '<th width="20">&nbsp;</th>';
print '</tr>'; print '</tr>';

View File

@ -75,7 +75,7 @@ print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySet
print "<br><br>"; print "<br><br>";
print '</span>'; print '</span>';
print '<br>'; print '<br><br>';
// Show info setup company // Show info setup company
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {

View 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(' &gt;&gt; ', '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&amp;token='.newToken().'&amp;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&amp;token='.newToken().'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;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&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;token='.newToken().'&amp;object='.urlencode(strtolower($myTmpObjectKey)).'&amp;value='.$name.'&amp;scan_dir='.urlencode($module->scandir).'&amp;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();

View 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();

View File

@ -11,7 +11,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -160,19 +160,15 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
$tabhelp = array(); $tabhelp = array();
$tabhelp[25] = array( $tabhelp[25] = array(
'topic'=>$helpsubstit, 'topic'=>'<span class="small">'.$helpsubstit.'</span>',
'joinfiles'=>$langs->trans('AttachMainDocByDefault'), 'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'content'=>$helpsubstit, 'content'=>'<span class="small">'.$helpsubstit.'</span>',
'content_lines'=>$helpsubstitforlines, 'content_lines'=>'<span class="small">'.$helpsubstitforlines.'</span>',
'type_template'=>$langs->trans("TemplateForElement"), 'type_template'=>$langs->trans("TemplateForElement"),
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
'position'=>$langs->trans("PositionIntoComboList") 'position'=>$langs->trans("PositionIntoComboList")
); );
// List of check for fields (NOT USED YET)
$tabfieldcheck = array();
$tabfieldcheck[25] = array();
$elementList = array(); $elementList = array();
@ -337,13 +333,13 @@ if (empty($reshook)) {
} }
} }
// Si verif ok et action add, on ajoute la ligne // If previous test is ok action is add, we add the line
if ($ok && GETPOST('actionadd')) { if ($ok && GETPOST('actionadd')) {
// Add new entry // Add new entry
$sql = "INSERT INTO ".$tabname[$id]." ("; $sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields // List of fields
$sql .= $tabfieldinsert[$id]; $sql .= $tabfieldinsert[$id];
$sql .= ",active)"; $sql .= ", active, enabled)";
$sql .= " VALUES("; $sql .= " VALUES(";
// List of values // List of values
@ -394,7 +390,7 @@ if (empty($reshook)) {
} }
$i++; $i++;
} }
$sql .= ", 1)"; $sql .= ", 1, 1)";
dol_syslog("actionadd", LOG_DEBUG); dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -156,8 +156,9 @@ if ($resql) {
$form = new Form($db); $form = new Form($db);
$page_name = "MultiCurrencySetup"; $page_name = "MultiCurrencySetup";
$help_url = '';
llxHeader('', $langs->trans($page_name)); llxHeader('', $langs->trans($page_name), $help_url);
// Subheader // Subheader
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
@ -165,7 +166,7 @@ print load_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header // Configuration header
$head = multicurrencyAdminPrepareHead(); $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">'; print '<table class="noborder centpercent">';
@ -303,7 +304,7 @@ print '<input type="hidden" name="action" value="add_currency">';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$form->selectCurrency('', 'code', 1).'</td>'; print '<td>'.$form->selectCurrency('', 'code', 1).'</td>';
print '<td class="right">'; print '<td class="right">';
print '<input type="text" name="rate" value="" size="13" placeholder="'.$langs->trans('Rate').'" />&nbsp;'; print '<input type="text" name="rate" value="" class="width75 right" placeholder="'.$langs->trans('Rate').'" />&nbsp;';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -328,7 +329,7 @@ foreach ($TCurrency as &$currency) {
print '<input type="hidden" name="action" value="update_currency">'; print '<input type="hidden" name="action" value="update_currency">';
print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">'; print '<input type="hidden" name="fk_multicurrency" value="'.$currency->id.'">';
print '1 '.$conf->currency.' = '; print '1 '.$conf->currency.' = ';
print '<input type="text" name="rate" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13" />&nbsp;'.$currency->code.'&nbsp;'; print '<input type="text" name="rate" class="width75 right" value="'.($currency->rate->rate ? $currency->rate->rate : '').'" size="13">&nbsp;'.$currency->code.'&nbsp;';
print '<input type="submit" name="updatecurrency" class="button" value="'.$langs->trans("Modify").'">&nbsp;'; print '<input type="submit" name="updatecurrency" class="button" value="'.$langs->trans("Modify").'">&nbsp;';
print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">'; print '<input type="submit" name="deletecurrency" class="button" value="'.$langs->trans("Delete").'">';
print '</form>'; print '</form>';

View File

@ -243,7 +243,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$elementLabel = $langs->trans('Intervention'); $elementLabel = $langs->trans('Intervention');
} elseif ($notifiedevent['elementtype'] == 'shipping') { } elseif ($notifiedevent['elementtype'] == 'shipping') {
$elementLabel = $langs->trans('Shipping'); $elementLabel = $langs->trans('Shipping');
} elseif ($notifiedevent['elementtype'] == 'expensereport') { } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
$elementLabel = $langs->trans('ExpenseReport'); $elementLabel = $langs->trans('ExpenseReport');
} }
@ -271,6 +271,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$helptext = ''; $helptext = '';
form_constantes($constantes, 3, $helptext); form_constantes($constantes, 3, $helptext);
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';
} else { } else {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -300,7 +302,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
$elementLabel = $langs->trans('Intervention'); $elementLabel = $langs->trans('Intervention');
} elseif ($notifiedevent['elementtype'] == 'shipping') { } elseif ($notifiedevent['elementtype'] == 'shipping') {
$elementLabel = $langs->trans('Shipping'); $elementLabel = $langs->trans('Shipping');
} elseif ($notifiedevent['elementtype'] == 'expensereport') { } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
$elementLabel = $langs->trans('ExpenseReport'); $elementLabel = $langs->trans('ExpenseReport');
} }
@ -316,7 +318,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '</table>'; 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>'; print '</form>';
@ -343,28 +351,38 @@ print "</tr>\n";
foreach ($listofnotifiedevents as $notifiedevent) { foreach ($listofnotifiedevents as $notifiedevent) {
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; $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'])); $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
// Special cases // Special cases
if ($notifiedevent['elementtype'] == 'order_supplier') { if ($notifiedevent['elementtype'] == 'order_supplier') {
$elementPicto = 'supplier_order';
$elementLabel = $langs->trans('SupplierOrder'); $elementLabel = $langs->trans('SupplierOrder');
} elseif ($notifiedevent['elementtype'] == 'propal') { } elseif ($notifiedevent['elementtype'] == 'propal') {
$elementLabel = $langs->trans('Proposal'); $elementLabel = $langs->trans('Proposal');
} elseif ($notifiedevent['elementtype'] == 'facture') { } elseif ($notifiedevent['elementtype'] == 'facture') {
$elementPicto = 'bill';
$elementLabel = $langs->trans('Bill'); $elementLabel = $langs->trans('Bill');
} elseif ($notifiedevent['elementtype'] == 'commande') { } elseif ($notifiedevent['elementtype'] == 'commande') {
$elementPicto = 'order';
$elementLabel = $langs->trans('Order'); $elementLabel = $langs->trans('Order');
} elseif ($notifiedevent['elementtype'] == 'ficheinter') { } elseif ($notifiedevent['elementtype'] == 'ficheinter') {
$elementPicto = 'intervention';
$elementLabel = $langs->trans('Intervention'); $elementLabel = $langs->trans('Intervention');
} elseif ($notifiedevent['elementtype'] == 'shipping') { } elseif ($notifiedevent['elementtype'] == 'shipping') {
$elementPicto = 'shipment';
$elementLabel = $langs->trans('Shipping'); $elementLabel = $langs->trans('Shipping');
} elseif ($notifiedevent['elementtype'] == 'expensereport') { } elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
$elementPicto = 'expensereport';
$elementLabel = $langs->trans('ExpenseReport'); $elementLabel = $langs->trans('ExpenseReport');
} }
print '<tr class="oddeven">'; 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>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>'; print '<td><span class="opacitymedium">'.$label.'</span></td>';
print '<td>'; print '<td>';
// Notification with threshold // Notification with threshold
foreach ($conf->global as $key => $val) { foreach ($conf->global as $key => $val) {
@ -417,14 +435,6 @@ foreach ($listofnotifiedevents as $notifiedevent) {
} }
print '</table>'; 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 '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>'; print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'"></div>';

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
// Load translation files required by the page // 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) { if (!$user->admin) {
accessforbidden(); accessforbidden();
@ -161,6 +161,10 @@ if (class_exists('TCPDI')) {
print load_fiche_titre($langs->trans("PDF"), '', 'title_setup'); 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 '<span class="opacitymedium">'.$form->textwithpicto($langs->trans("PDFDesc"), $s)."</span><br>\n";
print "<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 '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">'; 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 : ''); $selected = (isset($conf->global->MAIN_PDF_FORMAT) ? $conf->global->MAIN_PDF_FORMAT : '');
if (empty($selected)) { if (empty($selected)) {
@ -215,12 +219,16 @@ print load_fiche_titre($langs->trans("PDFAddressForging"), '', '');
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table summary="more" class="noborder centpercent">'; 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 // Hide VAT Intra on address
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>'; 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>'; print '</td></tr>';
// Show prof id in address into pdf // Show prof id in address into pdf
@ -236,7 +244,11 @@ for ($i = 1; $i <= 6; $i++) {
if ($pid) { if ($pid) {
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS'; $keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
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 $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode);
}
print '</td></tr>'; print '</td></tr>';
} }
} }
@ -254,16 +266,24 @@ $text = '';
if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) { if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
if ($mysoc->useLocalTax(1)) { if ($mysoc->useLocalTax(1)) {
$locales = $langs->transcountry("LT1", $mysoc->country_code); $locales = $langs->transcountry("LT1", $mysoc->country_code);
$text = '<tr class="oddeven"><td>'.$langs->trans("HideLocalTaxOnPDF", $langs->transcountry("LT1", $mysoc->country_code)).'</td><td>'; $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 .= $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>'; $text .= '</td></tr>';
} }
if ($mysoc->useLocalTax(2)) { if ($mysoc->useLocalTax(2)) {
$locales .= ($locales ? ' & ' : '').$langs->transcountry("LT2", $mysoc->country_code); $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 .= '<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 .= $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>'; $text .= '</td></tr>';
} }
} }
@ -273,15 +293,20 @@ if ($mysoc->useLocalTax(1) || $mysoc->useLocalTax(2)) {
$title .= ' - '.$langs->trans("PDFLocaltax", $locales); $title .= ' - '.$langs->trans("PDFLocaltax", $locales);
} }
print load_fiche_titre($title, '', ''); print load_fiche_titre($title, '', '');
print '<table summary="more" class="noborder centpercent">'; 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 // Hide any information on Sale tax / VAT
print '<tr class="oddeven"><td>'.$langs->trans("HideAnyVATInformationOnPDF").'</td><td>'; 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>'; print '</td></tr>';
// Locataxes // Locataxes
@ -317,13 +342,21 @@ if (!empty($conf->projet->enabled)) {
//Invert sender and recipient //Invert sender and recipient
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>'; 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>'; print '</td></tr>';
// Place customer adress to the ISO location // Place customer adress to the ISO location
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>'; 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>'; print '</td></tr>';
// Use 2 languages into PDF // Use 2 languages into PDF
@ -341,25 +374,41 @@ print '</td></tr>';
//Desc //Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>'; 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>'; print '</td></tr>';
//Ref //Ref
print '<tr class="oddeven"><td>'.$langs->trans("HideRefOnPDF").'</td><td>'; 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>'; print '</td></tr>';
//Details //Details
print '<tr class="oddeven"><td>'.$langs->trans("HideDetailsOnPDF").'</td><td>'; 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>'; print '</td></tr>';
// SHOW_SUBPRODUCT_REF_IN_PDF - Option to show the detail of product ref for kits. // 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 '<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>'; print '</td></tr>';
// Show more details in footer // Show more details in footer

127
htdocs/admin/pdf_other.php Normal file
View File

@ -0,0 +1,127 @@
<?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&eacute;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();

View File

@ -431,7 +431,9 @@ if ($mode == 'template' && $user->admin) {
print '<td>'; print '<td>';
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>'; print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
print '</td>'; 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 { } else {
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>'; print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
print '<td>'.dol_htmlentitiesbr($printer->listprinterstemplates[$line]['template']).'</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 name="template" wrap="soft" cols="120" rows="12">';
print '</textarea>'; print '</textarea>';
print '</td>'; 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 '</tr>';
} }
print '</table>'; 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 '</form>';
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -394,18 +394,18 @@ print '</tr>';
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>'; print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
print '<td align="center" width="60">'; 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 img_picto($langs->trans("Active"), 'tick');
} }
print '</td>'; print '</td>';
if (!$conf->global->DATABASE_PWD_ENCRYPTED) { if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print '<td align="center" width="100">'; print '<td align="center" width="100">';
print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>'; print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>';
print "</td>"; print "</td>";
} }
// Database conf file encryption // Database conf file encryption
if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) {
print '<td align="center" width="100">'; print '<td align="center" width="100">';
if ($allow_disable_encryption) { if ($allow_disable_encryption) {
//On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes //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 '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").'</td>'; print '<td colspan="3">'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").'</td>';
print '<td align="center" width="60">'; 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 img_picto($langs->trans("Active"), 'tick');
} }
print '</td>'; print '</td>';
if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '<td align="center" width="100">'; print '<td align="center" width="100">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Activate").'</a>';
print "</td>"; print "</td>";
} }
if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) {
print '<td align="center" width="100">'; print '<td align="center" width="100">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_MAIN_SECURITY_DISABLEFORGETPASSLINK&token='.newToken().'">'.$langs->trans("Disable").'</a>';
print "</td>"; print "</td>";
@ -481,8 +481,8 @@ if (GETPOST('info', 'int') > 0) {
} else { } else {
print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n"; 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_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO')."<br>\n";
print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."<br>\n"; print 'MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT')."<br>\n";
} }
print '</div>'; print '</div>';

View File

@ -139,8 +139,8 @@ if (preg_match('/[a-z]+/i', $version)) {
} }
print '</td></tr>'."\n"; 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("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.getDolGlobalString('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("VersionLastInstall").'</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'</td></tr>'."\n";
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<br>'; print '<br>';

View File

@ -25,7 +25,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
if (!$user->admin) { if (empty($user->admin)) {
accessforbidden(); accessforbidden();
} }
@ -134,7 +134,7 @@ foreach ($modules as $key => $module) {
$newModule->name = $module->getName(); $newModule->name = $module->getName();
$newModule->version = $module->getVersion(); $newModule->version = $module->getVersion();
$newModule->id = $key; $newModule->id = $key;
$newModule->module_position = $module->module_position; $newModule->module_position = $module->getModulePosition();
$alt = $module->name.' - '.$modules_files[$key]; $alt = $module->name.' - '.$modules_files[$key];
@ -164,17 +164,17 @@ foreach ($modules as $key => $module) {
$newModule->permission = $permission; $newModule->permission = $permission;
// pre-filter list // pre-filter list
if ($search_name && !stristr($newModule->name, $search_name)) { if (!empty($search_name) && !stristr($newModule->name, $search_name)) {
continue; continue;
} }
if ($search_version && !stristr($newModule->version, $search_version)) { if (!empty($search_version) && !stristr($newModule->version, $search_version)) {
continue; continue;
} }
if ($search_id && !stristr($newModule->id, $search_id)) { if (!empty($search_id) && !stristr($newModule->id, $search_id)) {
continue; continue;
} }
if ($search_permission) { if (!empty($search_permission)) {
$found = false; $found = false;
foreach ($newModule->permission as $permission) { 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="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; 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 '<span class="opacitymedium">'.$langs->trans("ToActivateModule").'</span>';
print '<br>'; print '<br>';
@ -324,7 +324,7 @@ foreach ($moduleList as $module) {
} }
if ($arrayfields['version']['checked']) { if ($arrayfields['version']['checked']) {
print '<td>'.$module->version.'</td>'; print '<td class="nowraponall">'.$module->version.'</td>';
} }
if ($arrayfields['id']['checked']) { if ($arrayfields['id']['checked']) {

View File

@ -128,32 +128,13 @@ if ($test) {
} }
print '<br>'; 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; // OS Permissions
if (empty($dolibarr_main_prod)) {
print ' &nbsp; '.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').' &nbsp; '.$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 ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
}*/
print '<br>';
print '<br>'; print '<br>';
print '<br>'; 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>: '; print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
$arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/custom'), 'name', SORT_ASC, 4, 1, '', 1); $arrayoffilesinroot = dol_dir_list(DOL_DOCUMENT_ROOT, 'all', 1, '', array('\/custom'), 'name', SORT_ASC, 4, 1, '', 1);
@ -205,38 +186,36 @@ if ($perms) {
} }
print '<br>'; print '<br>';
print '<br>';
// File conf.php
print '<br>'; print '<br>';
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>$dolibarr_main_prod</strong>: '.$dolibarr_main_prod;
print '<strong>'.$langs->trans("Syslog").'</strong>: '; if (empty($dolibarr_main_prod)) {
$test = empty($conf->syslog->enabled); print ' &nbsp; '.img_picto('', 'warning').' '.$langs->trans("IfYouAreOnAProductionSetThis", 1);
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 '<br>'; print '<br>';
// Module debugbar print '<strong>$dolibarr_nocsrfcheck</strong>: '.$dolibarr_nocsrfcheck;
print '<strong>'.$langs->trans("DebugBar").'</strong>: '; if (!empty($dolibarr_nocsrfcheck)) {
$test = empty($conf->debugbar->enabled); print img_picto('', 'warning').' &nbsp; '.$langs->trans("IfYouAreOnAProductionSetThis", 0);
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>'; 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 '<br>';
print '<br>'; print '<br>';
@ -276,7 +255,6 @@ if (!empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) {
} }
} }
print '<br>'; print '<br>';
print '<br>'; print '<br>';
$securityevent = new Events($db); $securityevent = new Events($db);
@ -299,10 +277,67 @@ if (!empty($eventstolog) && is_array($eventstolog)) {
} }
} }
} }
print '<br>';
} else { } else {
print img_warning().' '.$langs->trans("NoSecurityEventsAreAduited", $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Audit")).'<br>'; 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>'; print '<br><br>';
// End of page // End of page

View File

@ -36,12 +36,12 @@ if (!$user->admin) {
$id = GETPOST('rowid', 'int'); $id = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optionscss', 'aZ09');
$langcode = GETPOST('langcode', 'alphanohtml'); $langcode = GETPOST('langcode', 'alphanohtml');
$transkey = GETPOST('transkey', 'alphanohtml'); $transkey = GETPOST('transkey', 'alphanohtml');
$transvalue = GETPOST('transvalue', 'restricthtml'); $transvalue = GETPOST('transvalue', 'restricthtml');
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey'; $mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey';
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -537,8 +537,8 @@ if ($mode == 'searchkey') {
// retrieve rowid // retrieve rowid
$sql = "SELECT rowid"; $sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans"; $sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
$sql .= " WHERE transkey = '".$db->escape($key)."'"; $sql .= " WHERE entity IN (".getEntity('overwrite_trans').")";
$sql .= " AND entity IN (".getEntity('overwrite_trans').")"; $sql .= " AND transkey = '".$db->escape($key)."'";
dol_syslog("translation::select from table", LOG_DEBUG); dol_syslog("translation::select from table", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {

View File

@ -33,11 +33,6 @@ require_once DOL_DOCUMENT_ROOT . '/workstation/lib/workstation.lib.php';
// Translations // Translations
$langs->loadLangs(array("admin", "workstation")); $langs->loadLangs(array("admin", "workstation"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters // Parameters
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
@ -52,14 +47,19 @@ $value = GETPOST('value', 'alpha');
$error = 0; $error = 0;
$setupnotempty = 0; $setupnotempty = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
// Access control
if (!$user->admin) {
accessforbidden();
}
/* /*
* Actions * 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') { if ($action == 'updateMask') {
$maskconstorder = GETPOST('maskconstWorkstation', 'alpha'); $maskconstorder = GETPOST('maskconstWorkstation', 'alpha');
@ -157,19 +157,19 @@ if ($action == 'updateMask') {
$form = new Form($db); $form = new Form($db);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $help_url = '';
$page_name = "WorkstationSetup"; $page_name = "WorkstationSetup";
llxHeader('', $langs->trans($page_name));
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader // Subheader
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>'; $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 // Configuration header
$head = workstationAdminPrepareHead(); $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 // Setup page goes here
//echo '<span class="opacitymedium">'.$langs->trans("WorkstationSetupPage").'</span><br><br>'; //echo '<span class="opacitymedium">'.$langs->trans("WorkstationSetupPage").'</span><br><br>';

View File

@ -72,6 +72,7 @@ class DolibarrApi
//$this->r->setSupportedFormats('jsonFormat'); //$this->r->setSupportedFormats('jsonFormat');
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Check and convert a string depending on its type/name. * Check and convert a string depending on its type/name.
* *
@ -82,8 +83,9 @@ class DolibarrApi
* @param stdClass $object Object * @param stdClass $object Object
* @return string Value cleaned * @return string Value cleaned
*/ */
protected function checkValForAPI($field, $value, $object) protected function _checkValForAPI($field, $value, $object)
{ {
// phpcs:enable
// TODO Use type detected in $object->fields // TODO Use type detected in $object->fields
if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) {
return checkVal($value, 'restricthtml'); return checkVal($value, 'restricthtml');
@ -307,7 +309,8 @@ class DolibarrApi
/** /**
* Function to forge a SQL criteria * 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" * @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%'" * @return string Forged criteria. Example: "t.field like 'abc%'"
*/ */
protected static function _forge_criteria_callback($matches) protected static function _forge_criteria_callback($matches)
@ -319,18 +322,26 @@ class DolibarrApi
if (empty($matches[1])) { if (empty($matches[1])) {
return ''; return '';
} }
$tmp = explode(':', $matches[1]); $tmp = explode(':', $matches[1], 3);
if (count($tmp) < 3) { if (count($tmp) < 3) {
return ''; 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(); $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])."'"; $tmpescaped = "'".$db->escape($regbis[1])."'";
} else { } 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;
} }
} }

View File

@ -79,7 +79,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -142,7 +142,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -206,7 +206,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -270,7 +270,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -370,7 +370,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -545,7 +545,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -660,7 +660,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -723,7 +723,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -790,7 +790,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -852,7 +852,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -924,7 +924,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -994,7 +994,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1067,7 +1067,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1131,7 +1131,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1189,7 +1189,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1248,7 +1248,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1313,7 +1313,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1371,7 +1371,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1429,7 +1429,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -1489,7 +1489,7 @@ class Setup extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -55,8 +55,10 @@ $blocks = $block_static->getLog('just_certified', 0, 0, 'rowid', 'ASC');
$auth->signature = $block_static->getSignature(); $auth->signature = $block_static->getSignature();
foreach ($blocks as &$b) { if (is_array($bocks)) {
foreach ($blocks as &$b) {
$auth->blockchain .= $b->signature; $auth->blockchain .= $b->signature;
}
} }
$hash = $auth->getBlockchainHash(); $hash = $auth->getBlockchainHash();

View File

@ -71,9 +71,11 @@ class BlockedLogAuthority
$this->blockchain = ''; $this->blockchain = '';
if (is_array($bocks)) {
foreach ($blocks as &$b) { foreach ($blocks as &$b) {
$this->blockchain .= $b->signature; $this->blockchain .= $b->signature;
} }
}
return $this->blockchain; return $this->blockchain;
} }

View File

@ -572,10 +572,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') { if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
if ($action != 'editline') { if ($action != 'editline') {
// Add products/services form // Add products/services form
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, null, '/bom/tpl');
} }
} }
@ -607,7 +610,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Back to draft // Back to draft
if ($object->status == $object::STATUS_VALIDATED) { if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=setdraft&token='.newToken().'">'.$langs->trans("SetToDraft").'</a>'."\n";
} }
} }
@ -624,34 +627,34 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($object->status == $object::STATUS_DRAFT) { if ($object->status == $object::STATUS_DRAFT) {
if ($permissiontoadd) { if ($permissiontoadd) {
if (is_array($object->lines) && count($object->lines) > 0) { if (is_array($object->lines) && count($object->lines) > 0) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate&amp;token='.newToken().'">'.$langs->trans("Validate").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate&amp;token='.newToken().'">'.$langs->trans("Validate").'</a>'."\n";
} else { } else {
$langs->load("errors"); $langs->load("errors");
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'; print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'."\n";
} }
} }
} }
// Re-open // Re-open
if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) { if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>'."\n";
} }
// Create MO // Create MO
if ($conf->mrp->enabled) { if ($conf->mrp->enabled) {
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>'."\n";
} }
} }
// Clone // Clone
if ($permissiontoadd) { if ($permissiontoadd) {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&object=bom">'.$langs->trans("ToClone").'</a>'."\n";
} }
// Close / Cancel // Close / Cancel
if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close">'.$langs->trans("Disable").'</a>'."\n";
} }
/* /*

View File

@ -495,20 +495,20 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
// -------------------------------------------------------------------- // --------------------------------------------------------------------
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
if ($key == 'status') { if ($key == 'status') {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">'; print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { 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'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth150', 1);
} elseif (strpos($val['type'], 'integer:') === 0) { } elseif (strpos($val['type'], 'integer:') === 0) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) { } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
@ -543,7 +543,7 @@ foreach ($object->fields as $key => $val) {
$cssforfield .= ($cssforfield ? ' ' : '').'center'; $cssforfield .= ($cssforfield ? ' ' : '').'center';
} elseif (in_array($val['type'], array('timestamp'))) { } elseif (in_array($val['type'], array('timestamp'))) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') { } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (!empty($arrayfields['t.'.$key]['checked'])) { if (!empty($arrayfields['t.'.$key]['checked'])) {
@ -601,7 +601,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
} }
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') { if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status' && empty($val['arrayofkeyval'])) {
$cssforfield .= ($cssforfield ? ' ' : '').'right'; $cssforfield .= ($cssforfield ? ' ' : '').'right';
} }
if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) { if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) {

View File

@ -151,7 +151,7 @@ class Boms extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -81,7 +81,7 @@ class BOM extends CommonObject
* 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
* 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* *
@ -97,7 +97,7 @@ class BOM extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'autofocusoncreate'=>1),
'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150'), 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
//'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
@ -1117,7 +1117,7 @@ class BOMLine extends CommonObjectLine
* 'help' is a string visible as a tooltip on field * 'help' is a string visible as a tooltip on field
* 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
*/ */
// BEGIN MODULEBUILDER PROPERTIES // BEGIN MODULEBUILDER PROPERTIES

View File

@ -196,7 +196,6 @@ if ($action == 'create') {
if ($id > 0 && !preg_match('/^add/i', $action)) { if ($id > 0 && !preg_match('/^add/i', $action)) {
if ($action == 'edit') { if ($action == 'edit') {
print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">'; print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -148,7 +148,7 @@ class Categories extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -1170,6 +1170,7 @@ if ($action == 'create') {
if (GETPOST('contactid', 'int')) { if (GETPOST('contactid', 'int')) {
$preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int'); $preselectedids[GETPOST('contactid', 'int')] = GETPOST('contactid', 'int');
} }
if ($origin=='contact') $preselectedids[GETPOST('originid', 'int')] = GETPOST('originid', 'int');
print img_picto('', 'contact', 'class="paddingrightonly"'); print img_picto('', 'contact', 'class="paddingrightonly"');
print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid'); print $form->selectcontacts(GETPOST('socid', 'int'), $preselectedids, 'socpeopleassigned[]', 1, '', '', 0, 'minwidth300 quatrevingtpercent', false, 0, array(), false, 'multiple', 'contactid');
print '</td></tr>'; print '</td></tr>';

View File

@ -161,7 +161,7 @@ class AgendaEvents extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -217,7 +217,7 @@ class AgendaEvents extends DolibarrApi
$result = $this->_validate($request_data); $result = $this->_validate($request_data);
foreach ($request_data as $field => $value) { foreach ($request_data as $field => $value) {
$this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
} }
/*if (isset($request_data["lines"])) { /*if (isset($request_data["lines"])) {
$lines = array(); $lines = array();
@ -270,7 +270,7 @@ class AgendaEvents extends DolibarrApi
continue; continue;
} }
$this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm);
} }
if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) { if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) {

View File

@ -222,14 +222,23 @@ if (empty($reshook)) {
$onlinepaymentenabled++; $onlinepaymentenabled++;
} }
if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$substitutionarray['__ONLINEPAYMENTLINK_MEMBER__'] = getHtmlOnlinePaymentLink('member', $obj->source_id);
$substitutionarray['__ONLINEPAYMENTLINK_DONATION__'] = getHtmlOnlinePaymentLink('donation', $obj->source_id);
$substitutionarray['__ONLINEPAYMENTLINK_ORDER__'] = getHtmlOnlinePaymentLink('order', $obj->source_id);
$substitutionarray['__ONLINEPAYMENTLINK_INVOICE__'] = getHtmlOnlinePaymentLink('invoice', $obj->source_id);
$substitutionarray['__ONLINEPAYMENTLINK_CONTRACTLINE__'] = getHtmlOnlinePaymentLink('contractline', $obj->source_id);
$substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
$substitutionarray['__SECUREKEYPAYMENT_DONATION__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
} else { } else {
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'member'.$obj->source_id, 2);
$substitutionarray['__SECUREKEYPAYMENT_DONATION__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'donation'.$obj->source_id, 2);
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'order'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'order'.$obj->source_id, 2);
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'invoice'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'invoice'.$obj->source_id, 2);
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'contractline'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'contractline'.$obj->source_id, 2);

View File

@ -355,7 +355,7 @@ class FormAdvTargetEmailing extends Form
$sql = "SELECT c.rowid, c.name, c.fk_element"; $sql = "SELECT c.rowid, c.name, c.fk_element";
$sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c"; $sql .= " FROM ".MAIN_DB_PREFIX."advtargetemailing as c";
$sql .= " WHERE type_element='$type_element'"; $sql .= " WHERE type_element = '".$this->db->escape($type_element)."'";
$sql .= " ORDER BY c.name"; $sql .= " ORDER BY c.name";
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -302,9 +302,26 @@ if (empty($reshook)) {
} }
} elseif ($action == 'setecheance' && $usercancreate) { } elseif ($action == 'setecheance' && $usercancreate) {
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result >= 0) {
if ($result < 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
dol_print_error($db, $object->error); $outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model = $object->model_pdf;
$ret = $object->fetch($id); // Reload to get new records
if ($ret > 0) {
$object->fetch_thirdparty();
}
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'setdate_livraison' && $usercancreate) { } elseif ($action == 'setdate_livraison' && $usercancreate) {
$result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear']));
@ -2457,10 +2474,12 @@ if ($action == 'create') {
if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines') {
if ($action != 'editline') { if ($action != 'editline') {
// Add products/services form // Add products/services form
$object->formAddObjectLine(1, $mysoc, $soc);
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, $soc);
} else { } else {
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('formEditObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook

View File

@ -199,7 +199,7 @@ class Proposals extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -269,7 +269,7 @@ class Propal extends CommonObject
* 'help' is a string visible as a tooltip on field * 'help' is a string visible as a tooltip on field
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* *
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.

View File

@ -2442,11 +2442,13 @@ if ($action == 'create' && $usercancreate) {
if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines') { if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines') {
if ($action != 'editline') { if ($action != 'editline') {
// Add free products/services // Add free products/services
$object->formAddObjectLine(1, $mysoc, $soc);
$parameters = array(); $parameters = array();
// Note that $action and $object may be modified by hook // Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, $soc);
} }
} }
print '</table>'; print '</table>';
@ -2468,7 +2470,7 @@ if ($action == 'create' && $usercancreate) {
if (empty($reshook)) { if (empty($reshook)) {
// Reopen a closed order // Reopen a closed order
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) { if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a></div>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=reopen">'.$langs->trans('ReOpen').'</a>';
} }
// Send // Send
@ -2551,39 +2553,39 @@ if ($action == 'create' && $usercancreate) {
// Set to shipped // Set to shipped
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a>';
} }
// Create bill and Classify billed // Create bill and Classify billed
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {
if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { if (!empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a></div>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;origin='.$object->element.'&amp;originid='.$object->id.'&amp;socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
} }
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a></div>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifybilled">'.$langs->trans("ClassifyBilled").'</a>';
} }
} }
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) { if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifyunbilled">'.$langs->trans("ClassifyUnBilled").'</a></div>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=classifyunbilled">'.$langs->trans("ClassifyUnBilled").'</a>';
} }
} }
// Clone // Clone
if ($usercancreate) { if ($usercancreate) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a></div>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$object->socid.'&amp;action=clone&amp;object=order">'.$langs->trans("ToClone").'</a>';
} }
// Cancel order // Cancel order
if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) { if ($object->statut == Commande::STATUS_VALIDATED && (!empty($usercanclose) || !empty($usercancancel))) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("Cancel").'</a></div>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=cancel">'.$langs->trans("Cancel").'</a>';
} }
// Delete order // Delete order
if ($usercandelete) { if ($usercandelete) {
if ($numshipping == 0) { if ($numshipping == 0) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans('Delete').'</a></div>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans('Delete').'</a>';
} else { } else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a></div>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("ShippingExist").'">'.$langs->trans("Delete").'</a>';
} }
} }
} }

View File

@ -202,7 +202,7 @@ class Orders extends DolibarrApi
if (!DolibarrApi::_checkFilters($sqlfilters)) { if (!DolibarrApi::_checkFilters($sqlfilters)) {
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }

View File

@ -280,7 +280,7 @@ class Commande extends CommonOrder
* 'help' is a string visible as a tooltip on field * 'help' is a string visible as a tooltip on field
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* *
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.

View File

@ -11,6 +11,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2021 Anthony Berton <anthony.berton@bb2a.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -103,6 +104,7 @@ $search_shippable = GETPOST('search_shippable', 'aZ09');
$search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int');
$search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int'); $search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int');
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int'); $search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
// Security check // Security check
$id = (GETPOST('orderid') ?GETPOST('orderid', 'int') : GETPOST('id', 'int')); $id = (GETPOST('orderid') ?GETPOST('orderid', 'int') : GETPOST('id', 'int'));
@ -175,6 +177,7 @@ $arrayfields = array(
'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)), 'c.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'position'=>66 , 'enabled'=>!empty($conf->expedition->enabled)),
'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0, 'position'=>67), 'c.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0, 'position'=>67),
'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0, 'position'=>68), 'c.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0, 'position'=>68),
'c.fk_input_reason'=>array('label'=>"Channel", 'checked'=>0, 'position'=>69),
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75),
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80),
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85),
@ -264,6 +267,7 @@ if (empty($reshook)) {
$search_fk_cond_reglement = ''; $search_fk_cond_reglement = '';
$search_fk_shipping_method = ''; $search_fk_shipping_method = '';
$search_fk_mode_reglement = ''; $search_fk_mode_reglement = '';
$search_fk_input_reason = '';
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
@ -274,12 +278,123 @@ if (empty($reshook)) {
$objectclass = 'Commande'; $objectclass = 'Commande';
$objectlabel = 'Orders'; $objectlabel = 'Orders';
$permissiontoread = $user->rights->commande->lire; $permissiontoread = $user->rights->commande->lire;
$permissiontoadd = $user->rights->commande->creer;
$permissiontodelete = $user->rights->commande->supprimer; $permissiontodelete = $user->rights->commande->supprimer;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$permissiontovalidate = $user->rights->commande->order_advance->validate;
$permissiontoclose = $user->rights->commande->order_advance->close;
$permissiontocancel = $user->rights->commande->order_advance->annuler;
$permissiontosendbymail = $user->rights->commande->order_advance->send;
} else {
$permissiontovalidate = $user->rights->commande->creer;
$permissiontoclose = $user->rights->commande->creer;
$permissiontocancel = $user->rights->commande->creer;
$permissiontosendbymail = $user->rights->commande->creer;
}
$uploaddir = $conf->commande->multidir_output[$conf->entity]; $uploaddir = $conf->commande->multidir_output[$conf->entity];
$triggersendname = 'ORDER_SENTBYMAIL'; $triggersendname = 'ORDER_SENTBYMAIL';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
} }
if ($action == 'validate' && $permissiontoadd) {
if (GETPOST('confirm') == 'yes') {
$objecttmp = new $objectclass($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($objecttmp->fetch($checked)) {
if ($objecttmp->statut == 0) {
if (!empty($objecttmp->fk_warehouse)) {
$idwarehouse = $objecttmp->fk_warehouse;
} else {
$idwarehouse = 0;
}
if ($objecttmp->valid($user, $idwarehouse)) {
setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
if ($action == 'shipped' && $permissiontoadd) {
if (GETPOST('confirm') == 'yes') {
$objecttmp = new $objectclass($db);
$db->begin();
$error = 0;
foreach ($toselect as $checked) {
if ($objecttmp->fetch($checked)) {
if ($objecttmp->statut == 1) {
if ($objecttmp->cloture($user)) {
setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs');
} else {
setEventMessage($langs->trans('CantBeValidated'), 'errors');
$error++;
}
} else {
setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors');
$error++;
}
} else {
dol_print_error($db);
$error++;
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
}
}
// Closed records
if (!$error && $massaction === 'setbilled' && $permissiontoclose) {
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result > 0) {
$result = $objecttmp->classifyBilled($user, 0);
if ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
} else {
$nbok++;
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
}
$db->commit();
} else {
$db->rollback();
}
}
/* /*
* View * View
@ -312,6 +427,7 @@ $sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
$sql .= " u.login,"; $sql .= " u.login,";
$sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method'; $sql .= ' c.fk_cond_reglement,c.fk_mode_reglement,c.fk_shipping_method';
$sql .= ' ,c.fk_input_reason';
if ($search_categ_cus) { if ($search_categ_cus) {
$sql .= ", cc.fk_categorie, cc.fk_soc"; $sql .= ", cc.fk_categorie, cc.fk_soc";
} }
@ -438,7 +554,7 @@ if ($search_company_alias) {
$sql .= natural_search('s.name_alias', $search_company_alias); $sql .= natural_search('s.name_alias', $search_company_alias);
} }
if ($search_sale > 0) { if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale; $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
} }
if ($search_user > 0) { if ($search_user > 0) {
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
@ -480,19 +596,22 @@ if ($search_project != '') {
$sql .= natural_search("p.title", $search_project); $sql .= natural_search("p.title", $search_project);
} }
if ($search_categ_cus > 0) { if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); $sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
} }
if ($search_categ_cus == -2) { if ($search_categ_cus == -2) {
$sql .= " AND cc.fk_categorie IS NULL"; $sql .= " AND cc.fk_categorie IS NULL";
} }
if ($search_fk_cond_reglement > 0) { if ($search_fk_cond_reglement > 0) {
$sql .= " AND c.fk_cond_reglement = ".$db->escape($search_fk_cond_reglement); $sql .= " AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
} }
if ($search_fk_shipping_method > 0) { if ($search_fk_shipping_method > 0) {
$sql .= " AND c.fk_shipping_method = ".$db->escape($search_fk_shipping_method); $sql .= " AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
} }
if ($search_fk_mode_reglement > 0) { if ($search_fk_mode_reglement > 0) {
$sql .= " AND c.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement); $sql .= " AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
}
if ($search_fk_input_reason > 0) {
$sql .= " AND c.fk_input_reason = ".((int) $search_fk_input_reason);
} }
// Add where from extra fields // Add where from extra fields
@ -694,22 +813,38 @@ if ($resql) {
if ($search_fk_mode_reglement > 0) { if ($search_fk_mode_reglement > 0) {
$param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement; $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement;
} }
if ($search_fk_input_reason > 0) {
$param .= '&search_fk_input_reason='.$search_fk_input_reason;
}
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
'generate_doc'=>$langs->trans("ReGeneratePDF"), 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
'cancelorders'=>$langs->trans("Cancel"),
'presend'=>$langs->trans("SendByMail"),
); );
if ($user->rights->facture->creer) { if ($permissiontovalidate) {
$arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisCustomer"); $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate");
} }
if ($user->rights->commande->supprimer) { if ($permissiontosendbymail) {
$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete"); $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail");
}
if ($permissiontoclose) {
$arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped");
}
if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
}
if ($user->rights->facture->creer) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
}
if ($permissiontoclose) {
$arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled");
}
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
} }
if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { if (in_array($massaction, array('presend', 'predelete', 'createbills'))) {
$arrayofmassactions = array(); $arrayofmassactions = array();
@ -720,7 +855,7 @@ if ($resql) {
if (!empty($socid)) { if (!empty($socid)) {
$url .= '&socid='.$socid; $url .= '&socid='.$socid;
} }
$newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $user->rights->commande->creer); $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd);
// Lines of title fields // Lines of title fields
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -744,6 +879,13 @@ if ($resql) {
$trackid = 'ord'.$object->id; $trackid = 'ord'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($massaction == 'prevalidate') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1);
}
if ($massaction == 'preshipped') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("CloseOrder"), $langs->trans("ConfirmCloseOrder"), "shipped", null, '', 0, 200, 500, 1);
}
if ($massaction == 'createbills') { if ($massaction == 'createbills') {
//var_dump($_REQUEST); //var_dump($_REQUEST);
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
@ -970,6 +1112,12 @@ if ($resql) {
$form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1); $form->select_types_paiements($search_fk_mode_reglement, 'search_fk_mode_reglement', '', 0, 1, 1, 0, -1);
print '</td>'; print '</td>';
} }
// Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td class="liste_titre">';
$form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1);
print '</td>';
}
if (!empty($arrayfields['c.total_ht']['checked'])) { if (!empty($arrayfields['c.total_ht']['checked'])) {
// Amount // Amount
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
@ -1151,6 +1299,9 @@ if ($resql) {
if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) { if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) {
print_liste_field_titre($arrayfields['c.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['c.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "c.fk_mode_reglement", "", $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print_liste_field_titre($arrayfields['c.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "c.fk_input_reason", "", $param, '', $sortfield, $sortorder);
}
if (!empty($arrayfields['c.total_ht']['checked'])) { if (!empty($arrayfields['c.total_ht']['checked'])) {
print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
} }
@ -1435,6 +1586,15 @@ if ($resql) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }
} }
// Channel
if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
print '<td>';
$form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', '');
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Amount HT // Amount HT
if (!empty($arrayfields['c.total_ht']['checked'])) { if (!empty($arrayfields['c.total_ht']['checked'])) {
print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n"; print '<td class="nowrap right"><span class="amount">'.price($obj->total_ht)."</span></td>\n";
@ -1740,8 +1900,8 @@ if ($resql) {
$urlsource .= str_replace('&amp;', '&', $param); $urlsource .= str_replace('&amp;', '&', $param);
$filedir = $diroutputmassaction; $filedir = $diroutputmassaction;
$genallowed = $user->rights->commande->lire; $genallowed = $permissiontoread;
$delallowed = $user->rights->commande->creer; $delallowed = $permissiontoadd;
print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
} else { } else {

View File

@ -64,7 +64,7 @@ llxHeader();
print load_fiche_titre("Bilan"); print load_fiche_titre("Bilan");
print '<br>'; print '<br>';
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="2">'; print '<table class="noborder" width="100%" cellpadding="2">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
echo '<td colspan="2">'.$langs->trans("Summary").'</td>'; echo '<td colspan="2">'.$langs->trans("Summary").'</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -247,7 +247,7 @@ class Account extends CommonObject
* 'help' is a string visible as a tooltip on field * 'help' is a string visible as a tooltip on field
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") * 'arrayofkeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
* 'comment' is not used. You can store here any text of your choice. It is not used by application. * 'comment' is not used. You can store here any text of your choice. It is not used by application.
* *
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
@ -1680,6 +1680,27 @@ class Account extends CommonObject
$this->owner_address = 'Owner address'; $this->owner_address = 'Owner address';
$this->country_id = 1; $this->country_id = 1;
} }
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty($db, $origin_id, $dest_id)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_url SET url_id = ".((int) $dest_id)." WHERE url_id = ".((int) $origin_id)." AND type='company'";
if (!$db->query($sql)) {
//if ($ignoreerrors) return true; // TODO Not enough. If there is A-B on kept thirdarty and B-C on old one, we must get A-B-C after merge. Not A-B.
//$this->errors = $db->lasterror();
return false;
} else {
return true;
}
}
} }

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