diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index f35dc90f0b8..f532dbd9e3b 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 1 #php-version: '7.1' - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v2022.3.4 + uses: JetBrains/qodana-action@v2023.1.0 #with: # php-version: '7.1' env: diff --git a/.mailmap b/.mailmap index ae4b0eb7146..f5486ee8634 100644 --- a/.mailmap +++ b/.mailmap @@ -89,3 +89,9 @@ Baffir Abbes bafbes GUERRIER Kevin Remy Younes remy Estephe Loridan Estephe L. +Anthony Berton Anthony Berton +Anthony Berton Berton Anthony +Anthony Berton BB2A-Anthony +Anthony Berton Anthony Berton +Anthony Berton Berton Anthony +Anthony Berton BB2A-Anthony \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ee378d191dd..6cb27e2307f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,7 +77,7 @@ jobs: php: '8.1' env: DB=mysql - stage: PHP Dev - if: type = push AND branch = develop + if: type = push AND branch = developdisabled php: '8.2' env: DB=mysql diff --git a/COPYRIGHT b/COPYRIGHT index 93f4a43fee1..20762c37fe6 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -24,12 +24,12 @@ Component Version License GPL Compatible ------------------------------------------------------------------------------------- PHP libraries: 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 3.0 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers GeoIP2 0.2.0 Apache License 2.0 Yes Lib to make geoip convert Mobiledetect 2.8.41 MIT License Yes Detect mobile devices browsers NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency -ParseDown 1.6 MIT License Yes Markdown parser +ParseDown 1.7.4 MIT License Yes Markdown parser PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files PHPDebugBar 1.18.2 MIT License Yes Used only by the module "debugbar" for developers PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth @@ -43,7 +43,7 @@ Restler 3.1.1 LGPL-3+ Yes Sabre 3.2.2 BSD Yes DAV support Swift Mailer 5.4.2-DEV MIT License Yes Comprehensive mailing tools for PHP Symfony/var-dumper ??? MIT License Yes Library to make var dump (used by DebugBar) -Stripe 7.67.0 MIT Licence Yes Library for Stripe module +Stripe 10.7.0 MIT Licence Yes Library for Stripe module TCPDF 6.3.2 LGPL-3+ Yes PDF generation TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement diff --git a/ChangeLog b/ChangeLog index 62ccda4bbb8..a0d32f49010 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,186 @@ English Dolibarr ChangeLog ***** ChangeLog for 18.0.0 compared to 17.0.0 ***** -NEW: PHP 8.2 compatibility. +For uses: +--------- + +NEW: PHP 8.2 compatibility (test not yet completed). +NEW: #22740 Add OpenID Connect impl +NEW: #23436 Group social networks fields +NEW: Accountancy - Add specific page to export accounting data rather than the journals page +NEW: Accountancy - Add sub-account balance FPC22 +NEW: Accountancy - Manage customer retained warranty FPC21+ +NEW: Accountancy - Manage intra-community VAT on supplier invoices - FPC22 +NEW: adapt category and product pictures sizes on takepos +NEW: Add ability of ODT support to supplier invoices +NEW: Add a public virtual card page for each user +NEW: Add a status on supplier price ref (WIP to close a supplier ref) +NEW: Add a trigger when create a shipping line batch and fix propagate missing errors +NEW: add bookmarks in selectable landing pages for users +NEW: Add column ext_payment_site for societe_rib +NEW: add convertion of images to webp for a single image +NEW: Add CRC for currency symbol before amount +NEW: add css editor to admin ihm +NEW: add customer code to invoices listing +NEW: Add Customer Order delivered (ORDER_NEW) in module Notification +NEW: add customize CSS in admin/ihm settings +NEW: Add date due and labels into customer comm card +NEW: Add dropdown button actions (example on Create button on project) +NEW: added an option to display the progress of tickets on the public interface +NEW: Add field reply-to in email collector as possible filter +NEW: Add filter on nb of generation done in list of recurring invoices +NEW: Add filters and sort on product unit column +NEW: adding button Send Email on the salary file +NEW: Add link to edit VAT list from error message of missing VAT +NEW: add link to thirdparty tickets history +NEW: add margin in paiement/card.php +NEW: Add mass action delete on VAT +NEW: Add more zip, town, country for owner of a bank account +NEW: add numbering modules for members +NEW: add option keepspace into dol_string_nospecialchar() +NEW: Add origin info when create a product batch when created from a movement stock +NEW: Add possibility to choose format #21426 +NEW: Add SQL contraint on product_stock table to allow only exsting product and warehouse#23543 +NEW: Add statistics by amount on statistics of products. +NEW: Add STRIPE_DEBUG, a way to log Stripe IPN +NEW: Add sub total in order list det +NEW: Add warehouse create and modify triggers. +NEW: Add widget box_members_by_tags.php +NEW: An external module can modify the quick search fields +NEW: Auto activate some modules on install (export/import/wysiwyg editor) +NEW: Autofill email form with the email template with status "Default" on +NEW: Bank name no more mandatory on creation. Can be generated if empty. +NEW: batch referential objets +NEW: Better responsive for mass actions +NEW: Can add any contact on events if global MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT is set at 1 +NEW: Can add the add now link on date into addfieldvalue() +NEW: Can bin accounting line for a given month +NEW: Can edit account on miscellaneous payment (if not transfered) +NEW: Can edit inline the vat number from supplier tab +NEW: Can fill date of salary payment with date of start of salary +NEW: Can filter on a custom group of accounts. Perf or ledger list. +NEW: Can go back to draft on shipment when stock change not on validate +NEW: Can modify bank account of sepa payment (if file not sent yet) +NEW: Can modify margin rates in offers like VAT rates. +NEW: Can modify the date of payment of a salary (if not reconciled) +NEW: Can now edit service name for oauth token +NEW: Can receive more than qty ordered on reception +NEW: Can select several warehouses into the view stock at date in past +NEW: Can select the export format during export of journals +NEW: Can set a checkbox in formconfirm by clicking on the label +NEW: Can set background style with MAIN_LOGIN_BACKGROUND_STYLE +NEW: Can set flag default value on email templates +NEW: Can set the page "List of opportunities" as landing page +NEW: Can show the sql request used on emailing selection +NEW: can stay on edit field when errors occurs +NEW: Can test a geoip conversion from the geoip setup page +NEW: Captcha for public member's subscription form +NEW: category of operation for crabe PDF model +NEW: color for start date and owner +NEW: comment in api_mymodule for seperate methods +NEW: constant PROPALE_ADDON_NOTE_PUBLIC_DEFAULT +NEW: create email substitution variable for intervention signature URL +NEW: Date for salary payment includes the hour/min +NEW: Debug the custom CSS feature to avoid a directory search/scan at +NEW: dev name +NEW: Disable bad reputation product price +NEW: dolExplodeIntoArray can accept regex +NEW: dol_sort_array can sort on alphabetical order even if val is num +NEW: don't have closed contact proposed as receiver for the mails +NEW: Dynamic choice of warehouse and batch in MO production. +NEW: element time integration code + sql +NEW: events list with color +NEW: expend/collapse list of social networks +NEW: filter for Signed+Billed in proposals +NEW: Filter on amount and qty on list of service's contracts +NEW: filter on entity in import +NEW: formconfirm can support field with format datetime +NEW: getCommonSubstitutionArray to have more substitute keys +NEW: helper functions for dates + small demo case +NEW: hook printFieldListFrom in contact list +NEW: inc.php: handle parameters from argv +NEW: Increment website counter on each page access in website module +NEW: Invalidate all sessions of a user when password is modified. +NEW: Invoice - Show Category of operations +NEW: iSuiteExpert export model +NEW: Keep a link between user created from recruitment and application +NEW: limit load products in takepos +NEW: List product in orders +NEW: Make it possible to select hours and minutes in form_confirm +NEW: map table to element for get entity in import +NEW: migration script + delete old table + rename fields and indexes +NEW: Multicurrency REST API to create, update, delete, update rate... +NEW: Multiselect for filter on prospection status +NEW: Name and date to print on PDF Sign +NEW: [Bulk delete Project tasks] +NEW: No overwrite of optionals during put() contact +NEW: Notification for Sign or Refused Propal from Online Page +NEW: notify also the contributor affected to a ticket if a new message public is post (add global TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ALSO_CONTRIBUTOR) +NEW: Now we can edit amount on vat and salaries clone action +NEW: only get openned contact from liste_contact function, to not have acces to closed contact as mail receiver +NEW: operation type in email collector to load or create contact +NEW: option filter for NoSalesRepresentativeAffected in proposals list +NEW: Option to manage deposit slips for more payment modes (not only +NEW: Option to show column for field and line selection on the left +NEW: Order export : allow to export field 'shipment method'. +NEW: payment default values when supplier order created from reception +NEW: Payment : manage contracts +NEW: Possibility to link to German pages in help +NEW: presend mass action in contact list +NEW: product images on popup are cached +NEW: Provide the oldcopy value when calling setValueFrom() function with a trigger key +NEW: Quadratus export with attachments in accountancy export +NEW: referential objects of batch +NEW: remove default percentage for event creation url +NEW: remove keys whose table element is the same as element in map list +NEW: repair script skip views +NEW: Save date to invalidate other session into user table +NEW: search on time spent duration range +NEW: Send an email when ticket assigned +NEW: Send a notification email when ticket assigned +NEW: sepaStripe now creates the payment mode with type pm_ using new API +NEW: set payment default values when supplier order created from reception +NEW: set ticket status to answered if the client has answered from the public interface +NEW: set today start time at begining +NEW: Setup emailcollector easier. Can also use ! for negative search. +NEW: Show counter of access of website in website list +NEW: Show main currency in company info user tooltip +NEW: Show module into list of emails templates +NEW: Show picto into the combobox of widgets +NEW: Show supplier invoice ref of direct debit transfer tab invoices +NEW: show supplier name in getNomUrl of supplier order +NEW: sort of column of custom group of account +NEW: Stock limit for alert and desired optimal stock by product and warehouse import +NEW: substitute date now in email collector +NEW: Support different bank account for several direct debit payments +NEW: Support multiselect in the warehouse selection combo box +NEW: Support option MAIN_SECURITY_MAXFILESIZE_DOWNLOADED #yogosha10660 +NEW: table llx_element_time to store time spent on several elements (mo, ticket...) +NEW: The batch for remind on due date can be setup for using validation date +NEW: The refresh link for imap collector is always visible +NEW: The upgrade process can be done by creating a file upgrade.unlock +NEW: Tooltip to explain how to add a photo on a product +NEW: Use a cache file for external RSS in calendar +NEW: Use by default the domain $dolibarr_main_url_root for SMTP HELO +NEW: use more recent model by default +NEW: VAT can be modified during add of line +NEW: write all fields and their properties in asciidoc format +NEW: Can add an array of several links in date selector + +For developers or integrators: +------------------------------ + +NEW: triggers on mailing +NEW: add function for listiong objects from directory +NEW: Add helplist property to describe fields of obects +NEW: Add hook in loadLotStock() in html.formproduct.class.php file, add hook 'llxFooter', Add hook online sign +NEW: Update lib parsedownto 1.7.4, phpspreadsheet lib to v1.12, ESCPOS v3.0 +NEW: Support contact in post() document API +NEW: updating in modulbuilder on tab Menu when adding object +NEW: Add/Edit permissions in ModuleBuilder +NEW: Better generated documentation for modulebuilder +NEW: Add sent info in the parameters provided to the hook sendMailAfter +NEW: add setAsSelectUser into factory for generic setup page WARNING: @@ -269,18 +448,20 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Minimal PHP version is now PHP 7.0 instead of PHP 5.6 +* Core has introduced a Universal Filter Syntax for seach criteria. Example: ((((field1:=:value1) OR (field2:in:1,2,3)) AND ...). In rare case, some filters + could be provided by URL parameters. For such cases (societe/ajax/company.php), use of Universal Filter Syntax become mandatory. * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product->getNomUrl() * Trigger ORDER_SUPPLIER_DISPATCH is removed, use ORDER_SUPPLIER_RECEIVE and/or LINEORDER_SUPPLIER_DISPATCH instead. * All functions fetch_all() have been set to deprecated for naming consitency, use fetchAll() instead. * Code standardization: '$user->rights->propale' is now '$user->rights->propal' everywhere. * Deprecated method set_billed() on shipment and reception class has been removed. Use setBilled() instead. * Tables llx_prelevement_facture and llx_prelevement_facture_demande have been renamed into llx_prelevement and llx_prelevement_demande. -* Rename MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and rename MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES -* Rename the substitution for "project label" instead of "project title" in substitution variables -* You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object. +* Renamed MAIN_LIST_ALLOW_NOTES into MAIN_LIST_HIDE_NOTES and renamed MAIN_LIST_ALLOW_PRIVATE_NOTES into MAIN_LIST_HIDE_PRIVATE_NOTES +* Renamed the substitution for "project label" instead of "project title" in substitution variables +* You must use "$objectoffield" to manipulate the current object inside the form of computed custom extrafields instead of $obj/$object. * Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all) * The property $url_last_version must be public if defined into module descriptor files; -* Filters in class field definitions must be a Dolibarr filter syntax string. + ***** ChangeLog for 16.0.5 compared to 16.0.4 ***** diff --git a/SECURITY.md b/SECURITY.md index 3c89a2f38e1..1c281099885 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,8 +6,8 @@ This file contains some policies about the security reports on Dolibarr ERP CRM | Version | Supported | | ---------- | ---------------------- | -| <= 16.0.2 | :x: | -| >= 16.0.3 | :white_check_mark: | +| <= 17.0.0 | :x: | +| >= 17.0.1 | :white_check_mark: | | >= develop | :white_check_mark: | ## Reporting a Vulnerability diff --git a/build/doxygen/dolibarr-doxygen.doxyfile b/build/doxygen/dolibarr-doxygen.doxyfile index 6f668ebad7e..2bcb32a1540 100644 --- a/build/doxygen/dolibarr-doxygen.doxyfile +++ b/build/doxygen/dolibarr-doxygen.doxyfile @@ -220,7 +220,7 @@ OPTIMIZE_OUTPUT_VHDL = NO # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. -EXTENSION_MAPPING = +EXTENSION_MAPPING = example=PHP # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should @@ -602,7 +602,7 @@ INPUT_ENCODING = UTF-8 # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 -FILE_PATTERNS = *.php *.pl +FILE_PATTERNS = *.php *.pl *.sql *.example # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. diff --git a/build/exe/doliwamp/Languages/MyCatalan.isl b/build/exe/doliwamp/Languages/MyCatalan.isl index b157d1cea27..cb1066b5f91 100644 --- a/build/exe/doliwamp/Languages/MyCatalan.isl +++ b/build/exe/doliwamp/Languages/MyCatalan.isl @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reini OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr OldVersionFoundButFailedToMoveInNew=S'ha trobat una versió antiga de base de dades, però no es pot moure per a ser utilitzada per la nova versió de Dolibarr -DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp. +DLLMissing=La teva instal·lació windows no té el component "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instal·la primer la versió de 32-bit (vcredist_x86.exe) (pots trobar-la a https://www.microsoft.com/en-us/download/) i reiniciar després la instal·lació/actualització de DoliWamp. ContinueAnyway=Continua igualment (el procés d'instal·lació podria fallar sense aquest prerequisit) diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index 9c91ae92e4a..2a6c8b9a4ba 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with the new Dolibarr version -DLLMissing=Your Windows installation is missing the "Microsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. +DLLMissing=Your Windows installation is missing The "Microsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. ContinueAnyway=Continue anyway (install process may fail without this prerequisite) diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index c3fd15cbac8..6c6294fb7c4 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=L'installeur DoliWamp va maintenant d OldVersionFoundAndMoveInNew=Une ancienne version de base a t trouve et dplace pour fonctionner avec la nouvelle version de Dolibarr. OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a t trouve mais ne peut tre dplace pour tre utilise avec la nouvelle version de Dolibarr. -DLLMissing=L'installation de votre Windows est incomplte. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2012". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp aprs. +DLLMissing=L'installation de votre Windows est incomplte. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2015". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp aprs. ContinueAnyway=Continuer malgr tout (le process d'installaton chouera) diff --git a/build/exe/doliwamp/Languages/MyGerman.isl b/build/exe/doliwamp/Languages/MyGerman.isl index 8bfd78dbea2..132260b7273 100644 --- a/build/exe/doliwamp/Languages/MyGerman.isl +++ b/build/exe/doliwamp/Languages/MyGerman.isl @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apa OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden. OldVersionFoundButFailedToMoveInNew=Eine alte Datenbankversion wurde gefunden, konnte jedoch nicht verschoben werden, um mit der neuen Dolibarr-Version verwendet zu werden. -DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. +DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2015" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. ContinueAnyway=Fahren Sie trotzdem fort (der Installationsvorgang kann ohne diese Voraussetzung fehlschlagen). diff --git a/build/exe/doliwamp/Languages/MySpanish.isl b/build/exe/doliwamp/Languages/MySpanish.isl index c31aedf895f..6880a9263e1 100644 --- a/build/exe/doliwamp/Languages/MySpanish.isl +++ b/build/exe/doliwamp/Languages/MySpanish.isl @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reinici OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr OldVersionFoundButFailedToMoveInNew=Se ha encontrado una versión antigua de base de datos, pero no se pudo mover para ser utilizada por la nueva versión de Dolibarr -DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2012". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp. +DLLMissing=Su instalación Windows no tiene el componente "Microsoft Visual C++ Redistributable for Visual Studio 2015". Instale primero la versión de 32-bit (vcredist_x86.exe) (puedes encontrarlo en https://www.microsoft.com/en-us/download/) y reiniciar después la instalación/actualización de DoliWamp. ContinueAnyway=Continua igualmente (el proceso de instalación podría fallar sin este prerequisito) diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 7bc42a0bf88..184022ecf18 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -27,12 +27,12 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke Prerequisites to build autoexe DoliWamp package from Windows: -> Install Perl for Windwos (https://strawberryperl.com/) +> Install Perl for Windows (https://strawberryperl.com/) > Install isetup-5.5.8.exe (https://www.jrsoftware.org) > Install WampServer-3.2.*-64.exe (Apache 2.4.51, PHP 7.3.33, MariaDB 10.6.5 for example. Version must match the values found into doliwamp.iss) > Install GIT for Windows (https://git-scm.com/ => You must choose option "Add Git bash profile", "Git commit as-is") -> Install Dolibarr verions: - git clone https://github.com/dolibarr/dolibarr +> Install Dolibarr current version: + git clone https://github.com/dolibarr/dolibarr or git clone --branch X.Y https://github.com/dolibarr/dolibarr > Add the path of PHP (C:\wamp64\bin\php\php7.3.33) and InnoSetup (C:\Program Files (x86)\Inno Setup 5) into the %PATH% of Windows. diff --git a/dev/initdemo/mysqldump_dolibarr_17.0.0.sql b/dev/initdemo/mysqldump_dolibarr_17.0.0.sql index 4e2f622e7ee..20112e77bb6 100644 --- a/dev/initdemo/mysqldump_dolibarr_17.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_17.0.0.sql @@ -8511,7 +8511,6 @@ CREATE TABLE `llx_oauth_token` ( LOCK TABLES `llx_oauth_token` WRITE; /*!40000 ALTER TABLE `llx_oauth_token` DISABLE KEYS */; -INSERT INTO `llx_oauth_token` VALUES (5,'Google-bbb','O:33:\"OAuth\\OAuth2\\Token\\StdOAuth2Token\":4:{s:14:\"\0*\0accessToken\";s:213:\"ya29.a0AVvZVspOt6VbV__LcmVXJorqkcctfy5fIYrw75WO67fvPr5TEXsf_9Vyv3uuEmM5x2aHaHUVZyZT-ksOAvrMoIqUAMomVsLq9lfuTlnPqWLViZN9PtK6wjRqxWWPrIW5vx8_5W-tBnMkECI6nwUoZJiw1kIQOkAaCgYKAcISAQASFQGbdwaIxGW7tliRYKieCUJOyLDmpg0166\";s:15:\"\0*\0refreshToken\";s:103:\"1//03afP-2eKt8kACgYIARAAGAMSNwF-L9IrLBFL7IE-lJNkb7tEHGppNzxSScqUFdBZJxGKex5_0Ux3hZcImM6tjodn98orN5YI1oU\";s:12:\"\0*\0endOfLife\";i:1675817952;s:14:\"\0*\0extraParams\";a:3:{s:5:\"scope\";s:73:\"https://www.googleapis.com/auth/userinfo.profile https://mail.google.com/\";s:10:\"token_type\";s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XpFhquINMjGPryrvxv0CiR5YHeyRVRDoonmWLpl4JtszJNaRau9GuY3HM/gs9Uj2RFRqV4F5Iq/ISIRE0+56ejcBcee2q3vgIcHLpT//tuorPL7pejN9tQ6FmXZcKfSd1UQys7bqM/gzrEI+PMWpm+ZxUhnjhlcv+zr40rARGncQpopkDg9kYRlv4GLlB56ftzdQF+hxENiR7RiXtgxE+sOnZu3UHjUW3Ofdp6aoJd4wt436gXWr2abrTiG9VO/cnf91mapiloNNR+wWManh3asKfcSTfzJo9jFyWaaoSmC1pBhO2/exkUSUbSDROyTeQaq5KbeWc11/HLkStR4kVSi0vX+j8SVftOv7EJTw6J7M9s/tq8Hq/RtKR3+taafALlCzMIiQPu33w8ywEk/PrPEhpN14X/ntFhMdxGFUpzX0zscN2StvAzPKa3kXSfoTWdfXyl7oLAtIFatXqgvhY7m2OEQoFZviiapROL+pvhacOlnmqW7kvR+k2RhBMLrVa77tC2IM2L2WFphXhggRWVrCJkih1qM1bwFx/o/uKYdnK72hfrtAOKIbPrzShn/dkWGLwadNmBEYw9i0NU9qMGuYfbQ5s72qrFdfTxkvAsI7s9NFHX9DD6WPvXloBGfERzKiL2vxBIKChOfcC/HkmQZZgExZJZYtJS8c91Z7qQrfrNnjiFpOaB/QaBbCq8RTIgn4TZcBCsjffqsoUj2LjQy8oO8ogIBYpNAZIUt81oJVvP/atHdJg88Yw+8zyieHhdNgbjFUL2MczhUew/H+zNd+sK3SkOfln8x+LwsB5WApB0aLqr/DgKlPJobmg9JW7KY=',NULL,NULL,NULL,1,NULL,NULL,NULL,'2023-02-07 19:25:54','2023-02-07 22:40:27'),(25,'Microsoft-ddd','dolcrypt:AES-256-CTR:c01912ec63ab6a5d:79/P919C25E4UmekShuqsQwBqv6ezoVoRCeNDrmGW5h7sN/M18K/qQgCJAIyZ/9Jqxcef86UlCt3BT9wUIh1iAykU7RHYPYhBrGocsVElDJxfvsCjjPEF+qnDxeQfsBlyLIU0FCH56x4VHRn4yyebTOnEOUn7Ok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S7pkh5Wak/2v8Cv5BENB9JzGMtLrVr7aZHNBld0u6oRjM1QDDxPF8yjlmzKgENi4V269GLEIeJBKqGLZLyei7HUSo2kVROB28piK424TvntB1dkhhrdXNvB676SpJXIaMRYgLY5hXQuCR95i6ixPa9WNPooRk0rGAUwMZYCBA/RjGq1HxNGAcZX6MWuJiWZIj2TzN7hn1jy+WKBa9DxZk/dS1NoHRIjB0eZP9AUjyl0ddesgZEZaq01fKeBTWJoOKKtZyvcw6mw3AxsTIjphM5K+8a+5Q+MArxtcmBs/uqpkBuJKMp7M8H7l1lxMwQbr5BqK7MVOS617hI1KIYlJGnNLIAMV5cC/T43jzXA1NHRqYp3aaflhxknoEOW4r5QcBgRXqt3pERbqJNPLYqSubrT0Js6VWcssAm2NHim6lfGlgm+mKtaAdNBUMdDJk+458H1or/l8l+fcm+WfLBmDsFxo/Q/k+jeFbN5y/GIPtGnOyu/lAoudmlAxrCGqv4q5fq76zjh/W0Be7lApS9WNBlS7W8cAjhREox2Hb44DNpjc5KXXJU/0Id3cHJLPcbgQ8C9bak9v+A3ErXjfJSsg6S+m9nUJNIqYsFWJIvO7GlTnzQMFG9McsJtHzZTyS0Lfb4SaMzSmZ2XAp74W7gsTyTD+4QG3y',NULL,NULL,NULL,1,NULL,NULL,NULL,'2023-02-08 00:35:57','2023-02-08 03:40:28'); /*!40000 ALTER TABLE `llx_oauth_token` ENABLE KEYS */; UNLOCK TABLES; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 324f5d8d447..34766f92778 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -95,7 +95,7 @@ $arrayfields = array( 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1) ); -if ($conf->global->MAIN_FEATURES_LEVEL < 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { unset($arrayfields['categories']); unset($arrayfields['aa.reconcilable']); } @@ -146,7 +146,7 @@ if (empty($reshook)) { $search_array_options = array(); } if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on - || (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) { // a submit of form is done and chartofaccounts combo has been modified + || (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != getDolGlobalInt('CHARTOFACCOUNTS'))) { // a submit of form is done and chartofaccounts combo has been modified if ($chartofaccounts > 0 && $permissiontoadd) { // Get language code for this $chartofaccounts $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_country as c, '.MAIN_DB_PREFIX.'accounting_system as a'; @@ -228,7 +228,7 @@ if ($action == 'delete') { print $formconfirm; } -$pcgver = $conf->global->CHARTOFACCOUNTS; +$pcgver = getDolGlobalInt('CHARTOFACCOUNTS'); $sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent, aa.label, aa.labelshort, aa.fk_accounting_category,"; $sql .= " aa.reconcilable, aa.active, aa.import_key,"; @@ -240,8 +240,8 @@ $sql .= " WHERE asy.rowid = ".((int) $pcgver); //print $sql; if (strlen(trim($search_account))) { $lengthpaddingaccount = 0; - if ($conf->global->ACCOUNTING_LENGTH_GACCOUNT || $conf->global->ACCOUNTING_LENGTH_AACCOUNT) { - $lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_GACCOUNT, $conf->global->ACCOUNTING_LENGTH_AACCOUNT); + if (getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT') || getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) { + $lengthpaddingaccount = max(getDolGlobalInt('ACCOUNTING_LENGTH_GACCOUNT'), getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')); } $search_account_tmp = $search_account; $weremovedsomezero = 0; @@ -289,7 +289,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 126b7ac9c07..26287a5bbb8 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -76,7 +76,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; } else { - $sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS); + $sql = "SELECT pcg_version FROM " . MAIN_DB_PREFIX . "accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS')); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result = $db->query($sql); @@ -139,7 +139,7 @@ if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { } else { $result = $object->fetch($id); - $sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) $conf->global->CHARTOFACCOUNTS); + $sql = "SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid=".((int) getDolGlobalInt('CHARTOFACCOUNTS')); dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result2 = $db->query($sql); @@ -211,7 +211,7 @@ $form = new Form($db); $formaccounting = new FormAccounting($db); $accountsystem = new AccountancySystem($db); -$accountsystem->fetch($conf->global->CHARTOFACCOUNTS); +$accountsystem->fetch(getDolGlobalInt('CHARTOFACCOUNTS')); $title = $langs->trans('AccountAccounting')." - ".$langs->trans('Card'); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 27226d388f6..d0be20bb918 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -97,14 +97,14 @@ $help_url = "EN:Module_Double_Entry_Accounting"; llxHeader('', $title, $help_url); -$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut, f.entity"; +$sql = "SELECT f.rowid, f.label, f.date_start, f.date_end, f.statut as status, f.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_fiscalyear as f"; $sql .= " WHERE f.entity = ".$conf->entity; $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 @@ -137,14 +137,19 @@ if ($result) { print ''.$langs->trans("DateEnd").''; print ''.$langs->trans("NumberOfAccountancyEntries").''; print ''.$langs->trans("NumberOfAccountancyMovements").''; - print ''.$langs->trans("Statut").''; + print ''.$langs->trans("Status").''; print ''; if ($num) { while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); + $fiscalyearstatic->ref = $obj->rowid; $fiscalyearstatic->id = $obj->rowid; + $fiscalyearstatic->date_start = $obj->date_start; + $fiscalyearstatic->date_end = $obj->date_end; + $fiscalyearstatic->statut = $obj->status; + $fiscalyearstatic->status = $obj->status; print ''; print ''; @@ -155,7 +160,7 @@ if ($result) { print ''.dol_print_date($db->jdate($obj->date_end), 'day').''; print ''.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).''; print ''.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).''; - print ''.$fiscalyearstatic->LibStatut($obj->statut, 5).''; + print ''.$fiscalyearstatic->LibStatut($obj->status, 5).''; print ''; $i++; } diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 174d8fdf13e..3b6f12566fe 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -361,7 +361,7 @@ print ''; foreach ($list as $key) { print ''; - if (!empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) { + if (getDolGlobalInt('ACCOUNTING_MANAGE_ZERO') && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) { continue; } @@ -394,10 +394,10 @@ foreach ($list_binding as $key) { // Value print ''; if ($key == 'ACCOUNTING_DATE_START_BINDING') { - print $form->selectDate((!empty($conf->global->$key) ? $db->idate($conf->global->$key) : -1), $key, 0, 0, 1); + print $form->selectDate((getDolGlobalInt($key) ? (int) getDolGlobalInt($key) : -1), $key, 0, 0, 1); } elseif ($key == 'ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER') { $array = array(0=>$langs->trans("PreviousMonth"), 1=>$langs->trans("CurrentMonth"), 2=>$langs->trans("Fiscalyear")); - print $form->selectarray($key, $array, (isset($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage'); + print $form->selectarray($key, $array, getDolGlobalInt('ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER', 0), 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage'); } else { print ''; } diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 01bfa1da942..45ce2c7c763 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -394,7 +394,7 @@ if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= $db->order($sortfield, $sortorder); $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 31b99be39a3..86df8d69416 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -78,7 +78,7 @@ $arrayfields = array( 'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1) ); -if ($conf->global->MAIN_FEATURES_LEVEL < 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { unset($arrayfields['reconcilable']); } @@ -137,8 +137,8 @@ $sql .= " AND sa.code_compta <> ''"; //print $sql; if (strlen(trim($search_subaccount))) { $lengthpaddingaccount = 0; - if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) { - $lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT); + if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) { + $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT'); } $search_subaccount_tmp = $search_subaccount; $weremovedsomezero = 0; @@ -184,8 +184,8 @@ $sql .= " AND sa.code_compta_fournisseur <> ''"; //print $sql; if (strlen(trim($search_subaccount))) { $lengthpaddingaccount = 0; - if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) { - $lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT); + if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) { + $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT'); } $search_subaccount_tmp = $search_subaccount; $weremovedsomezero = 0; @@ -231,8 +231,8 @@ $sql .= " AND u.accountancy_code <> ''"; //print $sql; if (strlen(trim($search_subaccount))) { $lengthpaddingaccount = 0; - if ($conf->global->ACCOUNTING_LENGTH_AACCOUNT) { - $lengthpaddingaccount = max($conf->global->ACCOUNTING_LENGTH_AACCOUNT); + if (getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT')) { + $lengthpaddingaccount = getDolGlobalInt('ACCOUNTING_LENGTH_AACCOUNT'); } $search_subaccount_tmp = $search_subaccount; $weremovedsomezero = 0; @@ -274,7 +274,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index c45a1202419..1670776ab6e 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -254,7 +254,7 @@ llxHeader('', $title_page); if ($action != 'export_csv') { // List $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { if ($type == 'sub') { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter, 'AND', 1); } else { @@ -304,7 +304,7 @@ if ($action != 'export_csv') { print '\n"; // print the div tag that will contain the map diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 10b711e943f..833c0518d9a 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -241,7 +241,7 @@ $sql .= $hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -647,7 +647,7 @@ while ($i < $imaxinloop) { $subscription->fk_bank = $accountstatic->getNomUrl(1); } // Output Kanban - print $subscription->getKanbanView(''); + print $subscription->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print ''; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 394a17433f4..52c16a8ce4b 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -50,6 +50,7 @@ $mode = GETPOST('mode', 'alopha'); $sall = GETPOST("sall", "alpha"); $filter = GETPOST("filter", 'alpha'); +$search_ref = GETPOST('search_ref', 'alpha'); $search_lastname = GETPOST('search_lastname', 'alpha'); $search_login = GETPOST('search_login', 'alpha'); $search_email = GETPOST('search_email', 'alpha'); @@ -96,15 +97,6 @@ $hookmanager->initHooks(array('membertypecard', 'globalcard')); // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers - $search_lastname = ""; - $search_login = ""; - $search_email = ""; - $type = ""; - $sall = ""; -} - - // Security check $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); @@ -113,6 +105,15 @@ $result = restrictedArea($user, 'adherent', $rowid, 'adherent_type'); * Actions */ +if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $search_ref = ""; + $search_lastname = ""; + $search_login = ""; + $search_email = ""; + $type = ""; + $sall = ""; +} + if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; @@ -341,7 +342,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') { } //output kanban $membertype->label = $objp->label; - print $membertype->getKanbanView(''); + print $membertype->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print ''; @@ -456,12 +457,12 @@ if ($action == 'create') { print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('comment', (GETPOSTISSET('comment') ? GETPOST('comment', 'restricthtml') : $object->note_public), '', 200, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print ''.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('mail_valid', GETPOSTISSET('mail_valid') ? GETPOST('mail_valid') : $object->mail_valid, '', 250, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print ''; @@ -549,6 +550,7 @@ if ($rowid > 0) { print dol_get_fiche_end(); + /* * Buttons */ @@ -561,8 +563,16 @@ if ($rowid > 0) { } // Add + if ($object->morphy == 'phy') { + $morphy = 'phy'; + } elseif ($object->morphy == 'mor') { + $morphy = 'mor'; + } else { + $morphy = ''; + } + if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) { - print ''; + print ''; } else { print ''; } @@ -581,9 +591,9 @@ if ($rowid > 0) { $now = dol_now(); - $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe as company,"; + $sql = "SELECT d.rowid, d.ref, d.entity, d.login, d.firstname, d.lastname, d.societe as company, d.fk_soc,"; $sql .= " d.datefin,"; - $sql .= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; + $sql .= " d.email, d.photo, d.fk_adherent_type as type_id, d.morphy, d.statut as status,"; $sql .= " t.libelle as type, t.subscription, t.amount"; $sqlfields = $sql; // $sql fields to remove for count total @@ -603,6 +613,9 @@ if ($rowid > 0) { $sql .= natural_search(array("d.firstname", "d.lastname"), GETPOST('search', 'alpha')); } } + if (!empty($search_ref)) { + $sql .= natural_search("d.ref", $search_ref); + } if (!empty($search_lastname)) { $sql .= natural_search(array("d.firstname", "d.lastname"), $search_lastname); } @@ -621,7 +634,7 @@ if ($rowid > 0) { // Count total nb of records $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -691,6 +704,9 @@ if ($rowid > 0) { if (!empty($status)) { $param .= "&status=".urlencode($status); } + if (!empty($search_ref)) { + $param .= "&search_ref=".urlencode($search_ref); + } if (!empty($search_lastname)) { $param .= "&search_lastname=".urlencode($search_lastname); } @@ -732,6 +748,9 @@ if ($rowid > 0) { print ''; } + print ''; + print ''; + print ''; print ''; @@ -761,6 +780,7 @@ if ($rowid > 0) { if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); } + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "d.ref", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); @@ -780,13 +800,19 @@ if ($rowid > 0) { $datefin = $db->jdate($objp->datefin); + $adh->id = $objp->rowid; + $adh->ref = $objp->ref; + $adh->login = $objp->login; $adh->lastname = $objp->lastname; $adh->firstname = $objp->firstname; $adh->datefin = $datefin; $adh->need_subscription = $objp->subscription; $adh->statut = $objp->status; + $adh->email = $objp->email; + $adh->photo = $objp->photo; print ''; + // Actions if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; @@ -798,6 +824,12 @@ if ($rowid > 0) { } print ""; } + + // Ref + print ""; + print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1); + print "\n"; + // Lastname if ($objp->company != '') { print ''.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).''."\n"; @@ -871,10 +903,6 @@ if ($rowid > 0) { print "\n"; print ''; print ''; - - if ($num > $limit) { - print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); - } } else { dol_print_error($db); } @@ -943,12 +971,12 @@ if ($rowid > 0) { print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('comment', $object->note_public, '', 220, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print ""; print ''.$langs->trans("WelcomeEMail").''; - $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%'); + $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%'); $doleditor->Create(); print ""; diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 85b346b4225..38988d4aa34 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -289,7 +289,7 @@ if ($action == 'create' && $user->hasRight('adherent', 'configurer')) { print ''; print ''.$langs->trans('Label').''; print ''.$langs->trans('Description').''; - $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, ROWS_3, '90%'); + $doleditor = new DolEditor('desc', '', '', 160, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), ROWS_3, '90%'); $doleditor->Create(); print ''; diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 7c7eecc84f0..b6e30f65454 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -161,7 +161,7 @@ if (!empty($triggers)) { $module = 'fournisseur'; } if ($module == 'shipping') { - $module = 'expedition_bon'; + $module = 'expedition'; } if ($module == 'member') { $module = 'adherent'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index b366ea928ef..93db0398687 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -531,7 +531,7 @@ print ''; print ''; print $langs->trans("PaymentMode").''; print ''; -if (empty($conf->facture->enabled)) { +if (!isModEnabled('facture')) { print ''; } print ''; @@ -540,7 +540,7 @@ print "\n"; print ''; print "".$langs->trans("SuggestPaymentByRIBOnAccount").""; print ""; -if (empty($conf->facture->enabled)) { +if (!isModEnabled('facture')) { if (isModEnabled("banque")) { $sql = "SELECT rowid, label"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; @@ -579,7 +579,7 @@ print ""; print ''; print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; -if (empty($conf->facture->enabled)) { +if (!isModEnabled('facture')) { print ''; print ''; print ''; -print ''."\n"; +print ''."\n"; // Name print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyInfo").'
'; @@ -572,12 +572,14 @@ print '
'; + print '
'; + // IDs of the company (country-specific) print '
'; print ''; -print ''; +print ''; $langs->load("companies"); @@ -688,7 +690,7 @@ print ''; print '
'; print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("CompanyIds").'
'; print ''; -print ''; +print ''; print "\n"; print ''; } elseif ($value == 'country_id') { if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 98a4eec28fb..452ae74d614 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -149,7 +149,7 @@ if (GETPOST('addfilter', 'alpha')) { if ($result > 0) { $object->fetchFilters(); } else { - setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); + setEventMessages($emailcollectorfilter->error, $emailcollectorfilter->errors, 'errors'); } } @@ -161,7 +161,7 @@ if ($action == 'deletefilter') { if ($result > 0) { $object->fetchFilters(); } else { - setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); + setEventMessages($emailcollectorfilter->error, $emailcollectorfilter->errors, 'errors'); } } } @@ -192,7 +192,7 @@ if (GETPOST('addoperation', 'alpha')) { $object->fetchActions(); } else { $error++; - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + setEventMessages($emailcollectoroperation->error, $emailcollectoroperation->errors, 'errors'); } } } @@ -216,7 +216,7 @@ if ($action == 'updateoperation') { $object->fetchActions(); } else { $error++; - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + setEventMessages($emailcollectoroperation->error, $emailcollectoroperation->errors, 'errors'); } } } @@ -228,7 +228,7 @@ if ($action == 'deleteoperation') { if ($result > 0) { $object->fetchActions(); } else { - setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); + setEventMessages($emailcollectoroperation->error, $emailcollectoroperation->errors, 'errors'); } } } @@ -242,7 +242,7 @@ if ($action == 'collecttest') { setEventMessages($object->lastresult, null, 'mesgs'); } else { $debuginfo = $object->debuginfo; - setEventMessages($object->error, null, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } $action = ''; @@ -257,7 +257,7 @@ if ($action == 'confirm_collect') { setEventMessages($object->lastresult, null, 'mesgs'); } else { $debuginfo = $object->debuginfo; - setEventMessages($object->error, null, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } $action = ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 20d9ddf4ac9..6c916dff3db 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -275,7 +275,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objec $sql .= $hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); @@ -555,7 +555,7 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban - print $object->getKanbanView(''); + print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print '
'; print ''; diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index b26cefba580..7124a24c82a 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -184,7 +184,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) { if ($range->range_active == 1) { if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) { echo ''; - echo ''; + echo ''; } else { echo ''.img_edit().''; if (!empty($range->ik->id)) { diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 5a5c2f25c0e..ff7178a9ed3 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -64,7 +64,7 @@ $conditions = array( 'NOTE_PRIVATE' => 1, 'SOCIETE' => 1, 'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")), - 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), + 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'USERSIGN' => 1, 'MAILING' => isModEnabled('mailing'), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 504197fac7a..e4ad9c71bb6 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -809,7 +809,7 @@ if ($action == 'edit') { if (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail' && empty($conf->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) { $messagetoshow = $langs->trans("WarningPHPMail").'
'.$langs->trans("WarningPHPMailA").'
'.$langs->trans("WarningPHPMailB").'
'.$langs->trans("WarningPHPMailC").'

'.$langs->trans("WarningPHPMailD"); $messagetoshow .= ' '.$langs->trans("WarningPHPMailDbis", '{s1}', '{s2}'); - $linktosetvar1 = ''; + $linktosetvar1 = ''; $linktosetvar2 = ''; $messagetoshow = str_replace('{s1}', $linktosetvar1, $messagetoshow); $messagetoshow = str_replace('{s2}', $linktosetvar2, $messagetoshow); diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 1f638be3286..062aac55962 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -59,6 +59,16 @@ $substitutionarrayfortest = array( ); complete_substitutions_array($substitutionarrayfortest, $langs); +// List of sending methods +$listofmethods = array(); +$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup'); +$listofmethods['mail'] = 'PHP mail function'; +//$listofmethods['simplemail']='Simplemail class'; +$listofmethods['smtps'] = 'SMTP/SMTPS socket library'; +if (version_compare(phpversion(), '7.0', '>=')) { + $listofmethods['swiftmailer'] = 'Swift Mailer socket library'; +} + // Security check if (!$user->admin) { accessforbidden(); @@ -147,16 +157,6 @@ print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup'); $head = email_admin_prepare_head(); -// List of sending methods -$listofmethods = array(); -$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup'); -$listofmethods['mail'] = 'PHP mail function'; -//$listofmethods['simplemail']='Simplemail class'; -$listofmethods['smtps'] = 'SMTP/SMTPS socket library'; -if (version_compare(phpversion(), '7.0', '>=')) { - $listofmethods['swiftmailer'] = 'Swift Mailer socket library'; -} - // List of oauth services $oauthservices = array(); diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 280a3b06247..1a8f9ff90d5 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -298,7 +298,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 167e851a6c2..c2874c7db3d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -93,7 +93,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; if (empty($sortfield)) { - $sortfield = 'type_template, lang, position, label'; + $sortfield = 'type_template,lang,position,label'; } if (empty($sortorder)) { $sortorder = 'ASC'; @@ -109,21 +109,21 @@ $tabname[25] = MAIN_DB_PREFIX."c_email_templates"; // Nom des champs en resultat de select pour affichage du dictionnaire $tabfield = array(); -$tabfield[25] = "label,lang,type_template,fk_user,private,position,module,topic,joinfiles,content"; +$tabfield[25] = "label,lang,type_template,fk_user,private,position,module,topic,joinfiles,defaultfortype,content"; if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabfield[25] .= ',content_lines'; } // Nom des champs d'edition pour modification d'un enregistrement $tabfieldvalue = array(); -$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,content"; +$tabfieldvalue[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content"; if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabfieldvalue[25] .= ',content_lines'; } // Nom des champs dans la table pour insertion d'un enregistrement $tabfieldinsert = array(); -$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,content"; +$tabfieldinsert[25] = "label,lang,type_template,fk_user,private,position,topic,joinfiles,defaultfortype,content"; if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabfieldinsert[25] .= ',content_lines'; } @@ -164,13 +164,14 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tabhelp = array(); $tabhelp[25] = array( 'label'=>$langs->trans('EnterAnyCode'), - 'topic'=>''.$helpsubstit.'', - 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), - 'content'=>''.$helpsubstit.'', - 'content_lines'=>''.$helpsubstitforlines.'', 'type_template'=>$langs->trans("TemplateForElement"), 'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), - 'position'=>$langs->trans("PositionIntoComboList") + 'position'=>$langs->trans("PositionIntoComboList"), + 'topic'=>''.$helpsubstit.'', + 'joinfiles'=>$langs->trans('AttachMainDocByDefault'), + 'defaultfortype'=>$langs->trans("DefaultForTypeDesc"), + 'content'=>''.$helpsubstit.'', + 'content_lines'=>''.$helpsubstitforlines.'' ); @@ -214,10 +215,10 @@ if (isModEnabled('ficheinter')) { if (isModEnabled('supplier_proposal')) { $elementList['supplier_proposal_send'] = img_picto('', 'propal', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierRequestForQuotation')); } -if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && !empty($user->rights->supplier_order->lire))) { +if (isModEnabled("supplier_order") && ($user->hasRight('fournisseur', 'commande', 'lire') || $user->hasRight('supplier_order', 'read'))) { $elementList['order_supplier_send'] = img_picto('', 'order', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierOrder')); } -if ((isModEnabled("fournisseur") && !empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && !empty($user->rights->supplier_invoice->lire))) { +if (isModEnabled("supplier_invoice") && ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'read'))) { $elementList['invoice_supplier_send'] = img_picto('', 'bill', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToSendSupplierInvoice')); } if (isModEnabled('contrat') && !empty($user->rights->contrat->lire)) { @@ -307,7 +308,7 @@ if (empty($reshook)) { $ok = 1; foreach ($listfield as $f => $value) { // Not mandatory fields - if (in_array($value, ['joinfiles', 'content', 'content_lines', 'module'])) { + if (in_array($value, ['joinfiles', 'defaultfortype', 'content', 'content_lines', 'module'])) { continue; } @@ -383,6 +384,9 @@ if (empty($reshook)) { if ($value == 'position' && !is_numeric($_POST[$keycode])) { $_POST[$keycode] = '1'; } + if ($value == 'defaultfortype' && !is_numeric($_POST[$keycode])) { + $_POST[$keycode] = '0'; + } //var_dump($keycode.' '.$value); if ($i) { @@ -400,7 +404,7 @@ if (empty($reshook)) { } } elseif ($keycode == 'content') { $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfiles', 'private', 'position', 'entity'))) { + } elseif (in_array($keycode, array('joinfiles', 'defaultfortype', 'private', 'position', 'entity'))) { $sql .= (int) GETPOST($keycode, 'int'); } else { $sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'"; @@ -430,7 +434,7 @@ if (empty($reshook)) { // Modify entry $sql = "UPDATE ".$tabname[$id]." SET "; - // Modifie valeur des champs + // Modify value of fields $i = 0; foreach ($listfieldmodify as $field) { if ($field == 'entity') { @@ -449,20 +453,20 @@ if (empty($reshook)) { } // Rename some POST variables into a generic name - if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) { + if ($field == 'fk_user' && !(GETPOST('fk_user', 'int') > 0)) { $_POST['fk_user'] = ''; } if ($field == 'topic') { - $_POST['topic'] = $_POST['topic-'.$rowid]; + $_POST['topic'] = GETPOST('topic-'.$rowid); } if ($field == 'joinfiles') { - $_POST['joinfiles'] = $_POST['joinfiles-'.$rowid]; + $_POST['joinfiles'] = GETPOST('joinfiles-'.$rowid); } if ($field == 'content') { - $_POST['content'] = $_POST['content-'.$rowid]; + $_POST['content'] = GETPOST('content-'.$rowid, 'restricthtml'); } if ($field == 'content_lines') { - $_POST['content_lines'] = $_POST['content_lines-'.$rowid]; + $_POST['content_lines'] = GETPOST('content_lines-'.$rowid, 'restricthtml'); } if ($i) { @@ -470,7 +474,7 @@ if (empty($reshook)) { } $sql .= $field."="; - if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) { + if (GETPOST($keycode) == '' || (!in_array($keycode, array('langcode', 'position', 'private', 'defaultfortype')) && !GETPOST($keycode))) { $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work } elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') { $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work @@ -482,16 +486,15 @@ if (empty($reshook)) { } } elseif ($keycode == 'content') { $sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; - } elseif (in_array($keycode, array('joinfiles', 'private', 'position'))) { + } elseif (in_array($keycode, array('joinfiles', 'defaultfortype', 'private', 'position'))) { $sql .= (int) GETPOST($keycode, 'int'); } else { $sql .= "'".$db->escape(GETPOST($keycode, 'alphanohtml'))."'"; } - $i++; } - $sql .= " WHERE ".$rowidcol." = ".((int) $rowid); + $sql .= " WHERE ".$db->escape($rowidcol)." = ".((int) $rowid); if (!$user->admin) { // A non admin user can only edit its own template $sql .= " AND fk_user = ".((int) $user->id); } @@ -572,7 +575,7 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu $morejs = array(); $morecss = array(); -$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active"; +$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, defaultfortype, content_lines, content, enabled, active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql .= " WHERE entity IN (".getEntity('email_template').")"; if (!$user->admin) { @@ -693,6 +696,7 @@ if ($action == 'create') { $obj->position = GETPOST('position'); $obj->topic = GETPOST('topic'); $obj->joinfiles = GETPOST('joinfiles'); + $obj->defaultfortype = GETPOST('defaultfortype') ? 1 : 0; $obj->content = GETPOST('content', 'restricthtml'); // Form to add a new line @@ -711,9 +715,9 @@ if ($action == 'create') { // dans les dictionnaires de donnees $valuetoshow = ucfirst($fieldlist[$field]); // Par defaut $valuetoshow = $langs->trans($valuetoshow); // try to translate - $align = "left"; + $css = "left"; if ($fieldlist[$field] == 'module') { - $valuetoshow = ''; + $valuetoshow = ' '; } if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); @@ -724,20 +728,20 @@ if ($action == 'create') { if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); } + if ($fieldlist[$field] == 'position') { + $css = 'center'; + } if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); } - if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') { + if ($fieldlist[$field] == 'label') { $valuetoshow = $langs->trans("Code"); } if ($fieldlist[$field] == 'type_template') { - $valuetoshow = $langs->trans("TypeOfTemplate"); $align = "center"; + $valuetoshow = $langs->trans("TypeOfTemplate"); $css = "center"; } - if ($fieldlist[$field] == 'private') { - $align = 'center'; - } - if ($fieldlist[$field] == 'position') { - $align = 'center'; + if (in_array($fieldlist[$field], array('private', 'private', 'defaultfortype'))) { + $css = 'center'; } if ($fieldlist[$field] == 'topic') { @@ -753,7 +757,7 @@ if ($action == 'create') { $valuetoshow = ''; } if ($valuetoshow != '') { - print ''; print ""; + print ''; - print ''; + print '
'; } + print ''; + print '
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->trans("FiscalYearInformation").'
'; @@ -703,7 +705,7 @@ print load_fiche_titre($langs->trans("TypeOfSaleTaxes"), '', 'object_payment'); print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -733,7 +735,7 @@ print "
'.$langs->trans("VATManagement").''.$langs->trans("Description").''.$langs->trans("VATManagement").' 
"; print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -777,7 +779,7 @@ print "
'.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).''.$langs->trans("Description").''.$form->textwithpicto($langs->transcountry("LocalTax1Management", $mysoc->country_code), $langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code)).' 
"; print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -821,7 +823,7 @@ print "
'.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).''.$langs->trans("Description").''.$form->textwithpicto($langs->transcountry("LocalTax2Management", $mysoc->country_code), $langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)).' 
"; print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; if ($mysoc->useRevenueStamp()) { diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 6b0b722b629..81f1da40615 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -383,7 +383,12 @@ if (!is_array($result) && $result < 0) { print ''; } - print ''; + // Multicompany + print ''; // Actions print ''; @@ -1609,25 +1611,56 @@ if ($id > 0) { $i = 0; // There is several pages - if ($num > $listlimit || $page) { + if (($num > $listlimit) || $page) { print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print '
'; } + $filterfound = 0; + foreach ($fieldlist as $field => $value) { + if ($value == 'entity') { + continue; + } + + $showfield = 1; // By default + if ($value == 'region_id' || $value == 'country_id') { + $showfield = 0; + } + + if ($showfield) { + if ($value == 'country') { + $filterfound++; + } elseif ($value == 'code') { + $filterfound++; + } + } + } + print '
'; print '
'.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).''.$langs->trans("Description").''.$form->textwithpicto($langs->trans("RevenueStamp"), $langs->trans("RevenueStampDesc")).' 
'; + if (isModEnabled('multicompany')) { + print dol_escape_htmltag($defaultvalue->entity); + } + print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 33833162b11..210413b87f2 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -101,7 +101,7 @@ $hookmanager->initHooks(array('admin', 'dictionaryadmin')); // 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. -$taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0); +$taborder = array(9, 15, 30, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 6, 24, 0, 29, 0, 33, 34, 32, 28, 17, 35, 36, 0, 10, 31, 23, 12, 13, 7, 0, 14, 0, 22, 20, 18, 21, 41, 0, 37, 42, 0, 43, 0, 25, 0, 44, 0); // Name of SQL tables of dictionaries $tabname = array(); @@ -135,7 +135,7 @@ $tabname[27] = "c_stcomm"; $tabname[28] = "c_holiday_types"; $tabname[29] = "c_lead_status"; $tabname[30] = "c_format_cards"; -//$tabname[31]= "accounting_system"; +$tabname[31] = "c_invoice_subtype"; $tabname[32] = "c_hrm_public_holiday"; $tabname[33] = "c_hrm_department"; $tabname[34] = "c_hrm_function"; @@ -182,7 +182,7 @@ $tablib[27] = "DictionaryProspectStatus"; $tablib[28] = "DictionaryHolidayTypes"; $tablib[29] = "DictionaryOpportunityStatus"; $tablib[30] = "DictionaryFormatCards"; -//$tablib[31]= "DictionaryAccountancysystem"; +$tablib[31] = "DictionaryInvoiceSubtype"; $tablib[32] = "DictionaryPublicHolidays"; $tablib[33] = "DictionaryDepartment"; $tablib[34] = "DictionaryFunction"; @@ -205,10 +205,10 @@ $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as lib $tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; -$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; +$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays = c.rowid and c.active = 1"; $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as country_id, c.code as country_code, c.label as country, t.position, t.active FROM ".MAIN_DB_PREFIX."c_typent as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON t.fk_country=c.rowid"; $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; -$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; +$tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid"; $tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; $tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]); $tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]); @@ -229,7 +229,7 @@ $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN $tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; $tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status"; $tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards"; -//$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s"; +$tabsql[31] = "SELECT t.rowid, t.code, t.label, c.label as country, c.code as country_code, t.fk_country as country_id, t.active FROM ".MAIN_DB_PREFIX."c_invoice_subtype as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_country = c.rowid"; $tabsql[32] = "SELECT a.id as rowid, a.entity, a.code, a.fk_country as country_id, c.code as country_code, c.label as country, a.dayrule, a.day, a.month, a.year, a.active FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as a LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON a.fk_country=c.rowid AND c.active=1"; $tabsql[33] = "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department"; $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function"; @@ -276,7 +276,7 @@ $tabsqlsort[27] = "code ASC"; $tabsqlsort[28] = "sortorder ASC, country ASC, code ASC"; $tabsqlsort[29] = "position ASC"; $tabsqlsort[30] = "code ASC"; -//$tabsqlsort[31]="pcg_version ASC"; +$tabsqlsort[31] = "country ASC, code ASC"; $tabsqlsort[32] = "country, year ASC, month ASC, day ASC"; $tabsqlsort[33] = "code ASC"; $tabsqlsort[34] = "code ASC"; @@ -323,7 +323,7 @@ $tabfield[27] = "code,libelle,picto"; $tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country,block_if_negative,sortorder"; $tabfield[29] = "code,label,percent,position"; $tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -//$tabfield[31]= "pcg_version,label"; +$tabfield[31] = "country_id,country,code,label"; $tabfield[32] = "code,dayrule,year,month,day,country_id,country"; $tabfield[33] = "code,label"; $tabfield[34] = "code,label"; @@ -370,7 +370,7 @@ $tabfieldvalue[27] = "code,libelle,picto"; $tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country,block_if_negative,sortorder"; $tabfieldvalue[29] = "code,label,percent,position"; $tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -//$tabfieldvalue[31]= "pcg_version,label"; +$tabfieldvalue[31] = "country,code,label"; $tabfieldvalue[32] = "code,dayrule,day,month,year,country"; $tabfieldvalue[33] = "code,label"; $tabfieldvalue[34] = "code,label"; @@ -417,8 +417,7 @@ $tabfieldinsert[27] = "code,libelle,picto"; $tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder"; $tabfieldinsert[29] = "code,label,percent,position"; $tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y"; -//$tabfieldinsert[31]= "pcg_version,label"; -//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country"; +$tabfieldinsert[31] = "fk_country,code,label"; $tabfieldinsert[32] = "code,dayrule,day,month,year,fk_country"; $tabfieldinsert[33] = "code,label"; $tabfieldinsert[34] = "code,label"; @@ -467,7 +466,7 @@ $tabrowid[27] = "id"; $tabrowid[28] = ""; $tabrowid[29] = ""; $tabrowid[30] = ""; -//$tabrowid[31]= ""; +$tabrowid[31]= ""; $tabrowid[32] = "id"; $tabrowid[33] = "rowid"; $tabrowid[34] = "rowid"; @@ -495,15 +494,15 @@ $tabcond[8] = isModEnabled("societe"); $tabcond[9] = true; $tabcond[10] = true; $tabcond[11] = (isModEnabled("societe")); -$tabcond[12] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); -$tabcond[13] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); +$tabcond[12] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); +$tabcond[13] = (isModEnabled('commande') || isModEnabled("propal") || isModEnabled('facture') || isModEnabled("supplier_invoice") || isModEnabled("supplier_order")); $tabcond[14] = (isModEnabled("product") && (isModEnabled('ecotax') || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY))); $tabcond[15] = true; $tabcond[16] = (isModEnabled("societe") && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)); $tabcond[17] = (isModEnabled('deplacement') || isModEnabled('expensereport')); $tabcond[18] = isModEnabled("expedition") || isModEnabled("reception"); $tabcond[19] = isModEnabled("societe"); -$tabcond[20] = (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order"); +$tabcond[20] = isModEnabled("supplier_order"); $tabcond[21] = isModEnabled("propal"); $tabcond[22] = (isModEnabled('commande') || isModEnabled("propal")); $tabcond[23] = true; @@ -514,7 +513,7 @@ $tabcond[27] = isModEnabled("societe"); $tabcond[28] = isModEnabled('holiday'); $tabcond[29] = isModEnabled('project'); $tabcond[30] = (isModEnabled('label') || isModEnabled('barcode') || isModEnabled('adherent')); // stickers format dictionary -//$tabcond[31]= isModEnabled('accounting'); +$tabcond[31] = ((isModEnabled('facture') || isModEnabled('supplier_invoice')) && $mysoc->country_code == 'GR'); $tabcond[32] = (isModEnabled('holiday') || isModEnabled('hrm')); $tabcond[33] = isModEnabled('hrm'); $tabcond[34] = isModEnabled('hrm'); @@ -576,6 +575,7 @@ $tabcomplete = array( 'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), 'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), 'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), + 'c_invoice_subtype'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))), ); @@ -714,7 +714,7 @@ if (empty($reshook)) { $ok = 1; foreach ($listfield as $f => $value) { // Discard check of mandatory fields for country for some tables - if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { + if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryInvoiceSubtype', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) { continue; // For some pages, country is not mandatory } if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) { @@ -1201,7 +1201,7 @@ if ($search_country_id > 0) { $param .= '&search_country_id='.urlencode($search_country_id); } if ($search_code != '') { - $param .= '&search_code='.urlencode($search_country_id); + $param .= '&search_code='.urlencode($search_code); } if ($entity != '') { $param .= '&entity='.(int) $entity; @@ -1580,7 +1580,9 @@ if ($id > 0) { } print ''; if ($action != 'edit') { - print ''; + print ''; + } else { + print ''; } print '
'; // Title line with search input fields print ''."\n"; print ''; - $filterfound = 0; + + // Action button + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $colspan++; + } + + $colspan = 0; foreach ($fieldlist as $field => $value) { if ($value == 'entity') { continue; } $showfield = 1; // By default - if ($value == 'region_id' || $value == 'country_id') { $showfield = 0; } @@ -1637,34 +1670,51 @@ if ($id > 0) { print ''; - $filterfound++; + $colspan++; } elseif ($value == 'code') { print ''; - $filterfound++; + $colspan++; } else { print ''; + $colspan++; } } } if ($id == 4) { print ''; + $colspan++; print ''; + $colspan++; } + print ''; - print ''; + $colspan++; } - print ''; + print ''; // Title of lines print ''."\n"; print ''; + + // Action button + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } + foreach ($fieldlist as $field => $value) { if ($value == 'entity') { continue; @@ -1896,17 +1946,90 @@ if ($id > 0) { print getTitleFieldOfList($langs->trans("Favorite"), 0, $_SERVER["PHP_SELF"], "favorite", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); } + // Status print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); + + // Action button + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } print ''; if ($num) { // Lines with values while ($i < $num) { $obj = $db->fetch_object($resql); + + // Can an entry be erased or disabled ? + // all true by default + $iserasable = 1; + $canbedisabled = 1; + $canbemodified = 1; + if (isset($obj->code) && $id != 10 && $id != 42) { + if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { + $iserasable = 0; $canbedisabled = 0; + } elseif ($obj->code == 'RECEP') { + $iserasable = 0; $canbedisabled = 0; + } elseif ($obj->code == 'EF0') { + $iserasable = 0; $canbedisabled = 0; + } + } + if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) { + $iserasable = 0; $canbedisabled = 0; + if (in_array($obj->code, array('banner'))) { + $canbedisabled = 1; + } + } + if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { + $iserasable = 0; + } + if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) { + $canbedisabled = 0; $canbedisabled = 0; + } + $canbemodified = $iserasable; + + if (!empty($obj->code) && $obj->code == 'RECEP') { + $canbemodified = 1; + } + if ($tabname[$id] == "c_actioncomm") { + $canbemodified = 1; + } + + // Build Url. The table is id=, the id of line is rowid= + $rowidcol = $tabrowid[$id]; + // If rowidcol not defined + if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) { + $rowidcol = 'rowid'; + } + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + if (!empty($param)) { + $url .= '&'.$param; + } + if (!is_null($withentity)) { + $url .= '&entity='.$withentity; + } + $url .= '&'; + + //print_r($obj); print ''; + + // Action button + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { $tmpaction = 'edit'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); @@ -2141,56 +2264,6 @@ if ($id > 0) { } } - // Can an entry be erased or disabled ? - // all true by default - $iserasable = 1; - $canbedisabled = 1; - $canbemodified = 1; - if (isset($obj->code) && $id != 10 && $id != 42) { - if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { - $iserasable = 0; $canbedisabled = 0; - } elseif ($obj->code == 'RECEP') { - $iserasable = 0; $canbedisabled = 0; - } elseif ($obj->code == 'EF0') { - $iserasable = 0; $canbedisabled = 0; - } - } - if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page'))) { - $iserasable = 0; $canbedisabled = 0; - if (in_array($obj->code, array('banner'))) { - $canbedisabled = 1; - } - } - if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { - $iserasable = 0; - } - if (in_array(empty($obj->code) ? '' : $obj->code, array('AC_OTH', 'AC_OTH_AUTO')) || in_array(empty($obj->type) ? '' : $obj->type, array('systemauto'))) { - $canbedisabled = 0; $canbedisabled = 0; - } - $canbemodified = $iserasable; - - if (!empty($obj->code) && $obj->code == 'RECEP') { - $canbemodified = 1; - } - if ($tabname[$id] == "c_actioncomm") { - $canbemodified = 1; - } - - // Build Url. The table is id=, the id of line is rowid= - $rowidcol = $tabrowid[$id]; - // If rowidcol not defined - if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) { - $rowidcol = 'rowid'; - } - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); - if (!empty($param)) { - $url .= '&'.$param; - } - if (!is_null($withentity)) { - $url .= '&entity='.$withentity; - } - $url .= '&'; - // Favorite & EEC // Only activated on country dictionary if ($id == 4) { @@ -2229,29 +2302,28 @@ if ($id > 0) { } print ""; - // Modify link - if ($canbemodified) { - print ''; - } else { - print ''; - } - - // Delete link - if ($iserasable) { - print ''; - } else { - print ''; } print "\n"; } $i++; } + } else { + print ''; } print '
'; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print ''; print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone'); print ''; print ''; print ''; print ''; - if ($filterfound) { - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; + $colspan++; + + // Action button + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print '
'; + // Modify link + if ($canbemodified) { + print ''.img_edit().''; + } + // Delete link + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } + } + print ''.img_edit().' '; - if ($user->admin) { - print ''.img_delete().''; + // Action button + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + // Modify link + if ($canbemodified) { + print ''.img_edit().''; + } + // Delete link + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } } - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ' 
'.$langs->trans("NoRecordFound").'
'; @@ -2372,8 +2444,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') continue; } // For state page, we do not show the country input (we link to region, not country) print '
'; - $fieldname = 'country'; - print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone'); + + $selected = (!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')); + if (!GETPOSTISSET('code')) { + $selected = GETPOST('countryidforinsert'); + } + print $form->select_country($selected, $value, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone'); print '
'; + print ''; if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; } elseif (!empty($tabhelp[$id][$value])) { @@ -793,19 +797,19 @@ if ($action == 'create') { fieldList($fieldlist, $obj, $tabname[$id], 'add'); } } - + // Action column print ''; print '
'; + // Show fields for topic, join files and body $fieldsforcontent = array('topic', 'joinfiles', 'content'); if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); } foreach ($fieldsforcontent as $tmpfieldlist) { - print '
'; - // Topic of email if ($tmpfieldlist == 'topic') { print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; @@ -830,13 +834,14 @@ if ($action == 'create') { if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%'); + $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 400, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } - print '
'; if ($action != 'edit') { @@ -870,7 +875,7 @@ print ''; $i = 0; -$param = '&id='.$id; +$param = '&id='.((int) $id); if ($search_label) { $param .= '&search_label='.urlencode($search_label); } @@ -911,7 +916,13 @@ if ($num > $listlimit) { // Title line with search boxes print ''; - +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} foreach ($fieldlist as $field => $value) { if ($value == 'module') { print ''; @@ -935,23 +946,29 @@ foreach ($fieldlist as $field => $value) { print ''; } } - -if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { +/*if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { print ''; -} - +}*/ +// Status +print ''; // Action column -print ''; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} print ''; // Title of lines print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); +} foreach ($fieldlist as $field => $value) { $showfield = 1; // By defaut - $align = "left"; + $css = "left"; $sortable = 1; $valuetoshow = ''; $forcenowrap = 1; @@ -959,13 +976,13 @@ foreach ($fieldlist as $field => $value) { $tmparray=getLabelOfField($fieldlist[$field]); $showfield=$tmp['showfield']; $valuetoshow=$tmp['valuetoshow']; - $align=$tmp['align']; + $css=$tmp['align']; $sortable=$tmp['sortable']; */ $valuetoshow = ucfirst($fieldlist[$field]); // By defaut $valuetoshow = $langs->trans($valuetoshow); // try to translate if ($fieldlist[$field] == 'module') { - $align = 'tdoverflowmax100'; + $css = 'tdoverflowmax100'; } if ($fieldlist[$field] == 'fk_user') { $valuetoshow = $langs->trans("Owner"); @@ -980,18 +997,20 @@ foreach ($fieldlist as $field => $value) { $valuetoshow = $langs->trans("Code"); } if ($fieldlist[$field] == 'type_template') { - $align = 'center'; + $css = 'center'; $valuetoshow = $langs->trans("TypeOfTemplate"); } if ($fieldlist[$field] == 'private') { - $align = 'center'; + $css = 'center'; } if ($fieldlist[$field] == 'position') { - $align = 'center'; + $css = 'center'; } if ($fieldlist[$field] == 'joinfiles') { - $valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; $forcenowrap = 0; + $valuetoshow = $langs->trans("FilesAttachedToEmail"); + $css = 'center'; + $forcenowrap = 0; } if ($fieldlist[$field] == 'content') { $valuetoshow = $langs->trans("Content"); $showfield = 0; @@ -1011,14 +1030,17 @@ foreach ($fieldlist as $field => $value) { } $sortfieldtouse = ($sortable ? $fieldlist[$field] : ''); if ($sortfieldtouse == 'type_template') { - $sortfieldtouse.= ',label'; + $sortfieldtouse.= 'type_template,lang,position,label'; } - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $align.' '); + print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $css.' '); } } print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); -print getTitleFieldOfList(''); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); +} print ''; if ($num) { @@ -1037,42 +1059,57 @@ if ($num) { $reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } // Show main fields if (empty($reshook)) { fieldList($fieldlist, $obj, $tabname[$id], 'edit'); } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print "\n"; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; - print ''; } } + print ''; + print ''; + print ''; print "\n"; @@ -1125,8 +1163,34 @@ if ($num) { $nbqualified++; + // Can an entry be erased or disabled ? + $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default + if (!$user->admin && $obj->fk_user != $user->id) { + $iserasable = 0; + $canbedisabled = 0; + $canbemodified = 0; + } + + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + if ($param) { + $url .= '&'.$param; + } + print ''; + // Action column - Modify link / Delete link + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -1139,7 +1203,7 @@ if ($num) { continue; } $showfield = 1; - $align = ""; + $css = ""; $class = "tddict"; $title = ''; $tmpvar = $fieldlist[$field]; @@ -1158,7 +1222,7 @@ if ($num) { } if ($value == 'type_template') { $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow; - $align = "center"; + $css = "center"; } if ($value == 'lang' && $valuetoshow) { $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow); @@ -1171,7 +1235,7 @@ if ($num) { } } if ($value == 'private') { - $align = "center"; + $css = "center"; if ($valuetoshow) { $valuetoshow = yn($valuetoshow); } else { @@ -1179,18 +1243,18 @@ if ($num) { } } if ($value == 'position') { - $align = "center"; + $css = "center"; } - if ($value == 'joinfiles') { - $align = "center"; + if (in_array($value, array('joinfiles', 'defaultfortype'))) { + $css = "center"; if ($valuetoshow) { $valuetoshow = yn(1); } else { $valuetoshow = ''; } } - if ($align) { - $class .= ' '.$align; + if ($css) { + $class .= ' '.$css; } // Show value for field @@ -1207,19 +1271,6 @@ if ($num) { } } - // Can an entry be erased or disabled ? - $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default - if (!$user->admin && $obj->fk_user != $user->id) { - $iserasable = 0; - $canbedisabled = 0; - $canbemodified = 0; - } - - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); - if ($param) { - $url .= '&'.$param; - } - // Status / Active print '"; - // Modify link / Delete link - print ''; } - if ($iserasable) { - print ''.img_delete().''; - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin - } - print ''; print "\n"; } @@ -1288,6 +1341,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') $formadmin = new FormAdmin($db); foreach ($fieldlist as $field => $value) { + //print $value; if ($value == 'module') { print ''; } elseif ($value == 'fk_user') { @@ -1343,11 +1397,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') } print ''; } elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { - continue; + //print ''; } elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { - continue; + print ''; } elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { - continue; + //print ''; } else { $size = ''; $class = ''; $classtd = ''; if ($value == 'code') { @@ -1357,19 +1411,19 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') $class = 'maxwidth200'; } if ($value == 'private') { - $class = 'maxwidth50'; $classtd = 'center'; + $class = 'maxwidth50'; + $classtd = 'center'; } if ($value == 'position') { - $class = 'maxwidth50 center'; $classtd = 'center'; - } - if ($value == 'libelle') { - $class = 'quatrevingtpercent'; + $class = 'maxwidth50 center'; + $classtd = 'center'; } if ($value == 'topic') { $class = 'quatrevingtpercent'; } - if ($value == 'sortorder' || $value == 'sens' || $value == 'category_type') { - $size = 'size="2" '; + if ($value == 'defaultfortype') { + $class = 'width25 center'; + $classtd = 'center'; } print ''; @@ -1377,10 +1431,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') if (empty($user->admin)) { print $form->selectyesno($value, '1', 1); } else { - print $form->selectyesno($value, (isset($obj->{$value}) ? $obj->{$value}:''), 1); + print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1); } } else { - print ''; + print ''; } print ''; } diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 09172e985e9..94d33d6059c 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -127,10 +127,10 @@ foreach ($modulesdir as $dir) { // We discard modules according to features level (PS: if module is activated we always show it) $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); - if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) { + if ($objMod->version == 'development' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2))) { $modulequalified = 0; } - if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) { + if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1))) { $modulequalified = 0; } if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) { @@ -369,14 +369,32 @@ if ($mode == 'desc') { if ($mode == 'feature') { $text .= '
'.$langs->trans("DependsOn").': '; - if (count($objMod->depends)) { - $text .= join(',', $objMod->depends); + if (is_array($objMod->depends) && count($objMod->depends)) { + $i = 0; + foreach ($objMod->depends as $modulestringorarray) { + if (is_array($modulestringorarray)) { + $text .= ($i ? ', ' : '').join(', ', $modulestringorarray); + } else { + $text .= ($i ? ', ' : '').$modulestringorarray; + } + $i++; + } } else { $text .= ''.$langs->trans("None").''; } + $text .= '
'; + $text .= '
'.$langs->trans("RequiredBy").': '; - if (count($objMod->requiredby)) { - $text .= join(',', $objMod->requiredby); + if (is_array($objMod->requiredby) && count($objMod->requiredby)) { + $i = 0; + foreach ($objMod->requiredby as $modulestringorarray) { + if (is_array($modulestringorarray)) { + $text .= ($i ? ', ' : '').join(', ', $modulestringorarray); + } else { + $text .= ($i ? ', ' : '').$modulestringorarray; + } + $i++; + } } else { $text .= ''.$langs->trans("None").''; } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index a0e741a290f..c6ba25be465 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -396,10 +396,10 @@ foreach ($modulesdir as $dir) { // We discard modules according to features level (PS: if module is activated we always show it) $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); - if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) { + if ($objMod->version == 'development' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2))) { $modulequalified = 0; } - if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) { + if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1))) { $modulequalified = 0; } if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) { @@ -598,7 +598,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) { $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); - if ($conf->global->MAIN_FEATURES_LEVEL < 0) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 0) { $array_version['deprecated'] = $langs->trans("Deprecated"); } if ($conf->global->MAIN_FEATURES_LEVEL > 0) { @@ -1165,7 +1165,7 @@ if ($mode == 'deploy') { $fullurl = ''.$urldolibarrmodules.''; $message = ''; - if (!empty($allowonlineinstall)) { + if ($allowonlineinstall) { if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) { $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $allowfromweb = -1; @@ -1184,7 +1184,7 @@ if ($mode == 'deploy') { } else { if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) { // Show clean message - if (!is_numeric('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) { + if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) { $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))); } else { $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs')); diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 5945ebfb5d5..c72ea2cea24 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -143,6 +143,15 @@ if ($action == 'add_currency') { } +$TAvailableCurrency = array(); +$sql = "SELECT code_iso, label, unicode, active FROM ".MAIN_DB_PREFIX."c_currencies"; +$resql = $db->query($sql); +if ($resql) { + while ($obj = $db->fetch_object($resql)) { + $TAvailableCurrency[$obj->code_iso] = array('code'=>$obj->code_iso, 'active'=>$obj->active); + } +} + $TCurrency = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."multicurrency WHERE entity = ".((int) $conf->entity); $resql = $db->query($sql); @@ -319,10 +328,15 @@ print '
'; print ''; +// Main currency print ''; print ''; +print $form->textwithpicto(' ', $langs->trans("BaseCurrency")); +if (!empty($TAvailableCurrency[$conf->currency]) && empty($TAvailableCurrency[$conf->currency]['active'])) { + print img_warning('Warning: This code has been disabled into Home - Setup - Dictionaries - Currencies'); +} +print ''; print ''; print ''; @@ -332,7 +346,11 @@ foreach ($TCurrency as &$currency) { } print ''; - print ''; + print ''; print ''; //USTRD print ''; print ''; +print ''; print ''; */ diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index a8ae4501ca5..f515ea56600 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -317,6 +317,7 @@ if ($mode == 'config' && $user->admin) { print ''; print ''; print "\n"; + $ret = $printer->listprinters(); $nbofprinters = count($printer->listprinters); diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 9c8473f5f7f..211996712a9 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -310,7 +310,7 @@ $found = 0; print ''; print ''; print ''; print ''; print ''; print ''; print ''; } diff --git a/htdocs/asset/class/assetaccountancycodes.class.php b/htdocs/asset/class/assetaccountancycodes.class.php index 60b545ba6ce..6c33e3af901 100644 --- a/htdocs/asset/class/assetaccountancycodes.class.php +++ b/htdocs/asset/class/assetaccountancycodes.class.php @@ -174,7 +174,7 @@ class AssetAccountancyCodes extends CommonObject public function updateAccountancyCodes($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0) { global $langs, $hookmanager; - dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger"); + dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); $error = 0; $this->errors = array(); diff --git a/htdocs/asset/class/assetdepreciationoptions.class.php b/htdocs/asset/class/assetdepreciationoptions.class.php index f2411ea4494..8d52fa1a6a4 100644 --- a/htdocs/asset/class/assetdepreciationoptions.class.php +++ b/htdocs/asset/class/assetdepreciationoptions.class.php @@ -418,7 +418,7 @@ class AssetDepreciationOptions extends CommonObject public function updateDeprecationOptions($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0) { global $langs, $hookmanager; - dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger"); + dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); $error = 0; $this->errors = array(); diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 8f8c551d66b..5ff5f6d0382 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -299,7 +299,7 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 8ccf50a8ab1..d87a9ea55c8 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -301,7 +301,7 @@ $sql .= !empty($hookmanager->resPrint) ? (" HAVING 1=1 " . $hookmanager->resPrin // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* This old and fast method to get and count full list returns all record so use a high amount of memory. $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 2f5096f6436..433c22979da 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -188,7 +188,7 @@ if (!empty($number)) { } else { $txt = "Call Asterisk dialer for caller: ".$caller.", called: ".$called." clicktodiallogin: ".$login; dol_syslog($txt); - print ''."\n"; + print ''."\n"; print ''; fputs($oSocket, "Action: login\r\n"); fputs($oSocket, "Events: off\r\n"); diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index bf5a07f98b5..8d03c029cd6 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -550,7 +550,10 @@ if (is_array($blocks)) { print ''; // Link to source object - print ''.$object_link.''; + print ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index e27cd0a2e1c..10fc6c3030d 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -170,6 +170,13 @@ if (empty($reshook)) { $disable_stock_change = GETPOST('disable_stock_change', 'int'); $efficiency = price2num(GETPOST('efficiency', 'alpha')); $fk_unit = GETPOST('fk_unit', 'alphanohtml'); + + if (!empty($idprod) && $conf->workstation->enabled) { + $product = new Product($db); + $res = $product->fetch($idprod); + if ($res > 0 && $product->type == Product::TYPE_SERVICE) $fk_default_workstation = $product->fk_default_workstation; + } + if ($qty == '') { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors'); $error++; @@ -206,7 +213,7 @@ if (empty($reshook)) { } } - $result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options); + $result = $object->addLine($idprod, $qty, $qty_frozen, $disable_stock_change, $efficiency, -1, $bom_child_id, null, $fk_unit, $array_options, $fk_default_workstation); if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -566,7 +573,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->table_element_line)) { // Products - $res = $object->fetchLinesbytypeproduct(0); + $res = $object->fetchLinesbytypeproduct(0); // Load all lines products into ->lines $object->calculateCosts(); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); @@ -615,7 +622,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Services $filtertype = 1; - $res = $object->fetchLinesbytypeproduct(1); + $res = $object->fetchLinesbytypeproduct(1); // Load all lines services into ->lines $object->calculateCosts(); print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 0819c4f1cd1..e8b648d94cd 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -385,7 +385,7 @@ $sql=preg_replace('/,\s*$/','', $sql); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -688,7 +688,7 @@ while ($i < $imaxinloop) { print '
'; } // Output kanban - print $object->getKanbanView(''); + print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print '
'; print ''; diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index 439d1c23031..67b0baac323 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -121,7 +121,7 @@ class Boms extends DolibarrApi if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } - $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t"; + $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." AS t LEFT JOIN ".MAIN_DB_PREFIX.$tmpobject->table_element."_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 43a40705660..b54eb38ebd4 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -227,7 +227,6 @@ class BOM extends CommonObject public $unit_cost = 0; - /** * Constructor * @@ -569,10 +568,11 @@ class BOM extends CommonObject * @param int $fk_bom_child Id of BOM Child * @param string $import_key Import Key * @param string $fk_unit Unit - * @param array $array_options extrafields array + * @param array $array_options extrafields array + * @param int $fk_default_workstation Default workstation * @return int <0 if KO, Id of created object if OK */ - public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0) + public function addLine($fk_product, $qty, $qty_frozen = 0, $disable_stock_change = 0, $efficiency = 1.0, $position = -1, $fk_bom_child = null, $import_key = null, $fk_unit = '', $array_options = 0, $fk_default_workstation = null) { global $mysoc, $conf, $langs, $user; @@ -627,33 +627,34 @@ class BOM extends CommonObject } // Insert line - $this->line = new BOMLine($this->db); + $line = new BOMLine($this->db); - $this->line->context = $this->context; + $line->context = $this->context; - $this->line->fk_bom = $this->id; - $this->line->fk_product = $fk_product; - $this->line->qty = $qty; - $this->line->qty_frozen = $qty_frozen; - $this->line->disable_stock_change = $disable_stock_change; - $this->line->efficiency = $efficiency; - $this->line->fk_bom_child = $fk_bom_child; - $this->line->import_key = $import_key; - $this->line->position = $rankToUse; - $this->line->fk_unit = $fk_unit; + $line->fk_bom = $this->id; + $line->fk_product = $fk_product; + $line->qty = $qty; + $line->qty_frozen = $qty_frozen; + $line->disable_stock_change = $disable_stock_change; + $line->efficiency = $efficiency; + $line->fk_bom_child = $fk_bom_child; + $line->import_key = $import_key; + $line->position = $rankToUse; + $line->fk_unit = $fk_unit; + $line->fk_default_workstation = $fk_default_workstation; if (is_array($array_options) && count($array_options) > 0) { - $this->line->array_options = $array_options; + $line->array_options = $array_options; } - $result = $this->line->create($user); + $result = $line->create($user); if ($result > 0) { $this->calculateCosts(); $this->db->commit(); return $result; } else { - $this->error = $this->line->error; + $this->setErrorsFromObject($line); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -722,8 +723,7 @@ class BOM extends CommonObject $staticLine = clone $line; $line->oldcopy = $staticLine; - $this->line = $line; - $this->line->context = $this->context; + $line->context = $this->context; // Rank to use $rankToUse = (int) $position; @@ -741,32 +741,32 @@ class BOM extends CommonObject } - $this->line->fk_bom = $this->id; - $this->line->qty = $qty; - $this->line->qty_frozen = $qty_frozen; - $this->line->disable_stock_change = $disable_stock_change; - $this->line->efficiency = $efficiency; - $this->line->import_key = $import_key; - $this->line->position = $rankToUse; + $line->fk_bom = $this->id; + $line->qty = $qty; + $line->qty_frozen = $qty_frozen; + $line->disable_stock_change = $disable_stock_change; + $line->efficiency = $efficiency; + $line->import_key = $import_key; + $line->position = $rankToUse; if (!empty($fk_unit)) { - $this->line->fk_unit = $fk_unit; + $line->fk_unit = $fk_unit; } if (is_array($array_options) && count($array_options) > 0) { // We replace values in this->line->array_options only for entries defined into $array_options foreach ($array_options as $key => $value) { - $this->line->array_options[$key] = $array_options[$key]; + $line->array_options[$key] = $array_options[$key]; } } - $result = $this->line->update($user); + $result = $line->update($user); if ($result > 0) { $this->calculateCosts(); $this->db->commit(); return $result; } else { - $this->error = $this->line->error; + $this->setErrorsFromObject($line); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -801,10 +801,9 @@ class BOM extends CommonObject $staticLine = clone $line; $line->oldcopy = $staticLine; - $this->line = $line; - $this->line->context = $this->context; + $line->context = $this->context; - $result = $this->line->delete($user, $notrigger); + $result = $line->delete($user, $notrigger); //Positions (rank) reordering foreach ($this->lines as $bl) { @@ -819,7 +818,7 @@ class BOM extends CommonObject $this->db->commit(); return $result; } else { - $this->error = $this->line->error; + $this->setErrorsFromObject($line); dol_syslog(get_class($this)."::addLine error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; @@ -1423,21 +1422,32 @@ class BOM extends CommonObject } } } else { - //Convert qty to hour - $unit = measuringUnitString($line->fk_unit, '', '', 1); - $qty = convertDurationtoHour($line->qty, $unit); + // Convert qty of line into hours + $unitforline = measuringUnitString($line->fk_unit, '', '', 1); + $qtyhourforline = convertDurationtoHour($line->qty, $unitforline); if (isModEnabled('workstation') && !empty($tmpproduct->fk_default_workstation)) { $workstation = new Workstation($this->db); $res = $workstation->fetch($tmpproduct->fk_default_workstation); - if ($res > 0) $line->total_cost = price2num($qty * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); + if ($res > 0) $line->total_cost = price2num($qtyhourforline * ($workstation->thm_operator_estimated + $workstation->thm_machine_estimated), 'MT'); else { $this->error = $workstation->error; return -3; } } else { - $line->total_cost = price2num($qty * $tmpproduct->cost_price, 'MT'); + $defaultdurationofservice = $tmpproduct->duration; + $reg = array(); + $qtyhourservice = 0; + if (preg_match('/^(\d+)([a-z]+)$/', $defaultdurationofservice, $reg)) { + $qtyhourservice = convertDurationtoHour($reg[1], $reg[2]); + } + + if ($qtyhourservice) { + $line->total_cost = price2num($qtyhourforline / $qtyhourservice * $tmpproduct->cost_price, 'MT'); + } else { + $line->total_cost = price2num($line->qty * $tmpproduct->cost_price, 'MT'); + } } $this->total_cost += $line->total_cost; @@ -1670,6 +1680,7 @@ class BOMLine extends CommonObjectLine 'fk_unit' => array('type'=>'integer', 'label'=>'Unit', 'enabled'=>1, 'visible'=>1, 'position'=>120, 'notnull'=>-1,), 'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), + 'fk_default_workstation' =>array('type'=>'integer', 'label'=>'DefaultWorkstation', 'enabled'=>1, 'visible'=>1, 'notnull'=>0, 'position'=>1050) ); /** @@ -1732,6 +1743,12 @@ class BOMLine extends CommonObjectLine */ public $childBom = array(); + /** + * @var int Service Workstation + */ + public $fk_default_workstation; + + /** * Constructor diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 0d49937e6d2..69928c2545a 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -196,10 +196,6 @@ if ($filtertype != 1) { print ''; print ''; - -if (is_object($objectline)) { - print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1, 'line'); -} ?> '; @@ -3569,7 +3590,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli } } - //if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) + //if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) if (isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) { $type = 'AC_TEL'; $link = ''; @@ -3786,22 +3807,22 @@ function dol_print_address($address, $htmlid, $element, $id, $noprint = 0, $char // TODO Remove this block, we can add this using the hook now $showgmap = $showomap = 0; - if (($element == 'thirdparty' || $element == 'societe') && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS)) { + if (($element == 'thirdparty' || $element == 'societe') && isModEnabled('google') && !empty($conf->global->GOOGLE_ENABLE_GMAPS)) { $showgmap = 1; } - if ($element == 'contact' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) { + if ($element == 'contact' && isModEnabled('google') && !empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) { $showgmap = 1; } - if ($element == 'member' && !empty($conf->google->enabled) && !empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) { + if ($element == 'member' && isModEnabled('google') && !empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) { $showgmap = 1; } - if (($element == 'thirdparty' || $element == 'societe') && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) { + if (($element == 'thirdparty' || $element == 'societe') && isModEnabled('openstreetmap') && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) { $showomap = 1; } - if ($element == 'contact' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) { + if ($element == 'contact' && isModEnabled('openstreetmap') && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) { $showomap = 1; } - if ($element == 'member' && !empty($conf->openstreetmap->enabled) && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) { + if ($element == 'member' && isModEnabled('openstreetmap') && !empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) { $showomap = 1; } if ($showgmap) { @@ -5431,7 +5452,7 @@ function load_fiche_titre($titre, $morehtmlright = '', $picto = 'generic', $pict * Print a title with navigation controls for pagination * * @param string $titre Title to show (required) - * @param int $page Numero of page to show in navigation links (required) + * @param int|null $page Numero of page to show in navigation links (required) * @param string $file Url of page (required) * @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder). Value must be 'urlencoded' before calling function. * @param string $sortfield Field to sort on ('' by default) @@ -5458,6 +5479,8 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', $savtotalnboflines = $totalnboflines; $totalnboflines = abs((int) $totalnboflines); + $page = (int) $page; + if ($picto == 'setup') { $picto = 'title_setup.png'; } @@ -5508,7 +5531,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', } // Show navigation bar $pagelist = ''; - if ($savlimit != 0 && ((int) $page > 0 || $num > $limit)) { + if ($savlimit != 0 && ($page > 0 || $num > $limit)) { if ($totalnboflines) { // If we know total nb of lines // Define nb of extra page links before and after selected page + ... + first or last $maxnbofpage = (empty($conf->dol_optimize_smallscreen) ? 4 : 0); @@ -5569,7 +5592,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '', } if ($savlimit || $morehtmlright || $morehtmlrightbeforearrow) { - print_fleche_navigation((int) $page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow, $hidenavigation); // output the div and ul for previous/last completed with page numbers into $pagelist + print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit, $morehtmlrightbeforearrow, $hidenavigation); // output the div and ul for previous/last completed with page numbers into $pagelist } // js to autoselect page field on focus @@ -6204,7 +6227,7 @@ function isOnlyOneLocalTax($local) * Get values of localtaxes (1 or 2) for company country for the common vat with the highest value * * @param int $local LocalTax to get - * @return string Values of localtax (Can be '20', '-19:-15:-9') + * @return string Values of localtax (Can be '20', '-19:-15:-9') or 'Error' */ function get_localtax_by_third($local) { @@ -6221,12 +6244,14 @@ function get_localtax_by_third($local) $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); - return $obj->localtax; - } else { - return 'Error'; + if ($obj) { + return $obj->localtax; + } else { + return '0'; + } } - return '0'; + return 'Error'; } @@ -7280,15 +7305,16 @@ function dol_htmlwithnojs($stringtoencode, $nouseofiframesandbox = 0, $check = ' do { $oldstringtoclean = $out; + libxml_use_internal_errors(false); // Avoid to fill memory with xml errors + if (!empty($out) && !empty($conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML) && $check != 'restricthtmlallowunvalid') { try { $dom = new DOMDocument; // Add a trick to solve pb with text without parent tag - // like '

Foo

bar

' that wrongly ends up without the trick into '

Foo

bar

' - // like 'abc' that wrongly ends up without the tric into with '

abc

' + // like '

Foo

bar

' that wrongly ends up, without the trick, with '

Foo

bar

' + // like 'abc' that wrongly ends up, without the trick, with '

abc

' $out = '
'.$out.'
'; - - $dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL); + $dom->loadHTML($out, LIBXML_HTML_NODEFDTD|LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL); $out = trim($dom->saveHTML()); // Remove the trick added to solve pb with text without parent tag @@ -8010,7 +8036,6 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, if ($object->fetch_optionals() > 0) { if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { - $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; if ($extrafields->attributes[$object->table_element]['type'][$key] == 'date') { $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = dol_print_date($object->array_options['options_'.$key], 'day'); $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'_LOCALE__'] = dol_print_date($object->array_options['options_'.$key], 'day', 'tzserver', $outputlangs); @@ -8026,6 +8051,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, } elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'price') { $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'_FORMATED__'] = price($object->array_options['options_'.$key]); + } elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') { + $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; } } } @@ -9764,7 +9791,7 @@ function printCommonFooter($zone = 'private') // Google Analytics // TODO Add a hook here - if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AN_ID)) { + if (isModEnabled('google') && !empty($conf->global->MAIN_GOOGLE_AN_ID)) { $tmptagarray = explode(',', $conf->global->MAIN_GOOGLE_AN_ID); foreach ($tmptagarray as $tmptag) { print "\n"; @@ -11264,6 +11291,9 @@ function getElementProperties($element_type) $classpath = 'comm/action/class'; $subelement = 'Actioncomm'; $module = 'agenda'; + } elseif ($element_type == 'cronjob') { + $classpath = 'cron/class'; + $module = 'cron'; } elseif ($element_type == 'adherent_type') { $classpath = 'adherents/class'; $classfile = 'adherent_type'; @@ -11338,6 +11368,9 @@ function getElementProperties($element_type) $classpath = 'adherents/class'; $module = 'adherent'; $subelement = 'adherent'; + } elseif ($element_type == 'usergroup') { + $classpath = 'user/class'; + $module = 'user'; } elseif ($element_type == 'mo') { $classpath = 'mrp/class'; $classfile = 'mo'; @@ -11397,6 +11430,10 @@ function getElementProperties($element_type) $classname = 'Websitepage'; $module = 'website'; $subelement = 'websitepage'; + } elseif ($element_type == 'fiscalyear') { + $classpath = 'core/class'; + $module = 'accounting'; + $subelement = 'fiscalyear'; } if (empty($classfile)) { @@ -11751,11 +11788,14 @@ function jsonOrUnserialize($stringtodecode) /** * forgeSQLFromUniversalSearchCriteria * - * @param string $filter String with universal search string. Must be (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot'. + * @param string $filter String with universal search string. Must be (aaa:bbb:...) with + * aaa is a field name (with alias or not) and + * bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot'. * @param string $error Error message + * @param int $noand 0=Default, 1=Do not add the AND before the condition string. * @return string Return forged SQL string */ -function forgeSQLFromUniversalSearchCriteria($filter, &$error = '') +function forgeSQLFromUniversalSearchCriteria($filter, &$error = '', $noand = 0) { $regexstring = '\(([a-zA-Z0-9_\.]+:[<>!=insotlke]+:[^\(\)]+)\)'; // Must be (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot' @@ -11768,11 +11808,11 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$error = '') $t = str_replace(array('and','or','AND','OR',' '), '', $t); // Remove the only strings allowed between each () criteria // If the string result contains something else than '()', the syntax was wrong if (preg_match('/[^\(\)]/', $t)) { - $error = 'Bad syntax of the search string, filter criteria is inhalited'; + $error = 'Bad syntax of the search string, filter criteria is invalidated'; return 'Filter syntax error'; // Bad syntax of the search string, we force a SQL not found } - return " AND (".preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).")"; + return ($noand ? "" : " AND ")."(".preg_replace_callback('/'.$regexstring.'/i', 'dolForgeCriteriaCallback', $filter).")"; } /** diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index ce639624f1a..4a8cb27cdef 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -113,8 +113,8 @@ function dolGetModulesDirs($subdir = '') /** * Try to guess default paper format according to language into $langs * - * @param Translate $outputlangs Output lang to use to autodetect output format if setup not done - * @return string Default paper format code + * @param Translate|null $outputlangs Output lang to use to autodetect output format if setup not done + * @return string Default paper format code */ function dol_getDefaultFormat(Translate $outputlangs = null) { @@ -2668,6 +2668,8 @@ function getModuleDirForApiClass($moduleobject) $moduledirforclass = 'fichinter'; } elseif ($moduleobject == 'mos') { $moduledirforclass = 'mrp'; + } elseif ($moduleobject == 'accounting') { + $moduledirforclass = 'accountancy'; } elseif (in_array($moduleobject, array('products', 'expensereports', 'users', 'tickets', 'boms', 'receptions'))) { $moduledirforclass = preg_replace('/s$/', '', $moduleobject); } diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index ec64e77f42e..67b9f7e15b2 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -23,12 +23,34 @@ */ // Define size of logo small and mini +// TODO Remove this and call getDefaultImageSizes() instead $maxwidthsmall = 480; $maxheightsmall = 270; // Near 16/9eme $maxwidthmini = 128; $maxheightmini = 72; // 16/9eme $quality = 80; +/** + * Return default values for image sizes + * + * @return array Array of default values + */ +function getDefaultImageSizes() +{ + $maxwidthsmall = 480; + $maxheightsmall = 270; // Near 16/9eme + $maxwidthmini = 128; + $maxheightmini = 72; // 16/9eme + $quality = 80; + + return array( + 'maxwidthsmall' => $maxwidthsmall, + 'maxheightsmall' => $maxheightsmall, + 'maxwidthmini' => $maxwidthmini, + 'maxheightmini' => $maxheightmini, + 'quality' => $quality + ); +} /** * Return if a filename is file name of a supported image format @@ -599,7 +621,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', } // Before PHP8, img was a resource, With PHP8, it is a GdImage - if (!is_resource($img) && !($img instanceof \GdImage)) { + if (!is_resource($img) && !($img instanceof GdImage)) { dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); return 0; } diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 9c49035a757..cba7b3aa10d 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -56,7 +56,7 @@ function facture_prepare_head($object) $h++; } - if (!empty($conf->prelevement->enabled)) { + if (isModEnabled('prelevement')) { $nbStandingOrders = 0; $sql = "SELECT COUNT(pfd.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_demande as pfd"; @@ -1142,7 +1142,7 @@ function getPurchaseInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0) $result = ''; - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)) { + if (isModEnabled("supplier_invoice") && ($user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('supplier_invoice', 'read'))) { $facstatic = new FactureFournisseur($db); $sql = "SELECT ff.rowid, ff.ref, ff.fk_statut as status, ff.type, ff.libelle as label, ff.total_ht, ff.total_tva, ff.total_ttc, ff.paye"; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index d5f2a6e50c8..c1fbaaa3e17 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -482,6 +482,16 @@ function deletePerms($file) dolReplaceInFile($file, array($allContent => '')); } +/** + * Compare two value + * @param int|string $a value 1 + * @param int|string $b value 2 + * @return int less 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal. +*/ +function compareFirstValue($a, $b) +{ + return strcmp($a[0], $b[0]); +} /** * Rewriting all permissions after any actions * @param string $file filename or path @@ -515,11 +525,46 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $action) $permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'"; $permissions[$i][5] = "\$this->rights[\$r][5] = '".$permissions[$i][5]."';\n\t\t"; } + // for group permissions by object + $perms_grouped = array(); + foreach ($permissions as $perms) { + $object = $perms[4]; + if (!isset($perms_grouped[$object])) { + $perms_grouped[$object] = []; + } + $perms_grouped[$object][] = $perms; + } + //$perms_grouped = array_values($perms_grouped); + $permissions = $perms_grouped; + + + // parcourir les objets + $o=0; + foreach ($permissions as &$object) { + // récupérer la permission de l'objet + $p = 1; + foreach ($object as &$obj) { + if (str_contains($obj[5], 'read')) { + $obj[0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', (".$o." * 10) + 0 + 1)"; + } elseif (str_contains($obj[5], 'write')) { + $obj[0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', (".$o." * 10) + 1 + 1)"; + } elseif (str_contains($obj[5], 'delete')) { + $obj[0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', (".$o." * 10) + 2 + 1)"; + } else { + $obj[0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', (".$o." * 10) + ".$p." + 1)"; + $p++; + } + } + usort($object, 'compareFirstValue'); + $o++; + } //convert to string foreach ($permissions as $perms) { - $rights[] = implode(";\n\t\t", $perms); - $rights[] = "\$r++;\n\t\t"; + foreach ($perms as $per) { + $rights[] = implode(";\n\t\t", $per); + $rights[] = "\$r++;\n\t\t"; + } } $rights_str = implode("", $rights); // delete all permission from file @@ -527,6 +572,8 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $action) // rewrite all permission again dolReplaceInFile($file, array('/* BEGIN MODULEBUILDER PERMISSIONS */' => '/* BEGIN MODULEBUILDER PERMISSIONS */'."\n\t\t".$rights_str)); return 1; + } else { + return -1; } } @@ -613,6 +660,7 @@ function writePropsInAsciiDoc($file, $objectname, $destfile) } // end table $table .= "|==="; + $table .= "__ end table for object $objectname"; //write in file $writeInFile = dolReplaceInFile($destfile, array('== DATA SPECIFICATIONS'=> $table)); if ($writeInFile<0) { @@ -621,6 +669,23 @@ function writePropsInAsciiDoc($file, $objectname, $destfile) return 1; } +/** + * Delete property from documentation if we delete object + * @param string $file file or path + * @param string $objectname name of object wants to deleted + * @return void + */ +function deletePropsFromDoc($file, $objectname) +{ + + $start = "== Table of fields and their properties for object *".ucfirst($objectname)."* : "; + $end = "__ end table for object ".ucfirst($objectname); + $str = file_get_contents($file); + $search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s'; + $new_contents = preg_replace($search, '', $str); + file_put_contents($file, $new_contents); +} + /** * Search a string and return all lines needed from file * @param string $file file for searching @@ -742,3 +807,108 @@ function writePermsInAsciiDoc($file, $destfile) } return 1; } + +/** + * Add Object in ModuleApi File + * @param string $file path of file + * @param array $objects array of objects in the module + * @param string $modulename name of module + * @return int 1 if OK, -1 if KO + */ +function addObjectsToApiFile($file, $objects, $modulename) +{ + if (!file_exists($file)) { + return -1; + } + $content = file($file); + $includeClass = "dol_include_once('/mymodule/class/myobject.class.php');"; + $props = "public \$myobject;"; + $varcomented = "@var MyObject \$myobject {@type MyObject}"; + $constructObj = "\$this->myobject = new MyObject(\$this->db);"; + + // add properties and declare them in consturctor + foreach ($content as $lineNumber => &$lineContent) { + if (strpos($lineContent, $varcomented) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}". PHP_EOL; + } + //var_dump($lineContent);exit; + } + if (strpos($lineContent, $props) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "\tpublic \$".strtolower($object).";". PHP_EOL; + } + } + if (strpos($lineContent, $constructObj) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);". PHP_EOL; + } + } + if (strpos($lineContent, $includeClass) !== false) { + $lineContent = ''; + foreach ($objects as $object) { + $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');". PHP_EOL; + } + } + } + $allContent = implode("", $content); + file_put_contents($file, $allContent); + + //add methods for each object + $allContent = getFromFile($file, '/*begin methods CRUD*/', '/*end methods CRUD*/'); + foreach ($objects as $object) { + $contentReplaced =str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent); + dolReplaceInFile($file, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/')); + } + dolReplaceInFile($file, array($allContent => '','MyModule' => ucfirst($modulename))); + return 1; +} + +/** + * Remove Object variables and methods from API_Module File + * @param string $file file api module + * @param string $objectname name of object whant to remove + * @param string $modulename name of module + * @return int 1 if OK, -1 if KO + */ +function removeObjectFromApiFile($file, $objectname, $modulename) +{ + $begin = '/*CRUD FOR '.strtoupper($objectname).'*/'; + $end = '/*END CRUD FOR '.strtoupper($objectname).'*/'; + $includeClass = "dol_include_once('/".strtolower($modulename)."/class/".strtolower($objectname).".class.php');"; + $varcomentedDel = "\t * @var ".$objectname." \$".strtolower($objectname)." {@type ".$objectname."}"; + $propsDel = "\tpublic \$".strtolower($objectname).";"; + $constructObjDel = "\t\t\$this->".strtolower($objectname)." = new ".$objectname."(\$this->db);"; + + if (!file_exists($file)) { + return -1; + } + $content = file($file); + // for delete property and the initialization from the construct + foreach ($content as $lineNumber => &$lineContent) { + if (strpos($lineContent, $includeClass) !== false) { + $lineContent = ''; + } + if (strpos($lineContent, $varcomentedDel) !== false) { + $lineContent = ''; + } + if (strpos($lineContent, $propsDel) !== false) { + $lineContent = ''; + } + if (strpos($lineContent, $constructObjDel) !== false) { + $lineContent = ''; + } + } + $allContent = implode("", $content); + file_put_contents($file, $allContent); + // for delete methods of object + $allContent = getFromFile($file, $begin, $end); + $check = dolReplaceInFile($file, array($allContent => '')); + if ($check) { + dolReplaceInFile($file, array($begin => '', $end => '')); + } + return 1; +} diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index cb5a2247953..8368df4496e 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -60,28 +60,28 @@ function commande_prepare_head(Commande $object) $h++; } - if ((isModEnabled('expedition_bon') && $user->hasRight('expedition', 'lire')) - || (isModEnabled('delivery_note') && $user->hasRight('expedition', 'delivery', 'lire'))) { + if ((getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'lire')) + || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'lire'))) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; - if (isModEnabled('expedition_bon')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { $text .= $langs->trans("Shipments"); } - if (isModEnabled('expedition_bon') && isModEnabled('delivery_note')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { $text .= ' - '; } - if (isModEnabled('delivery_note')) { + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { $text .= $langs->trans("Receivings"); } if ($nbShipments > 0 || $nbReceiption > 0) { $text .= ''.($nbShipments ? $nbShipments : 0); } - if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ' - '; } - if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ($nbReceiption ? $nbReceiption : 0); } if ($nbShipments > 0 || $nbReceiption > 0) { diff --git a/htdocs/core/lib/parsemd.lib.php b/htdocs/core/lib/parsemd.lib.php index 72903dd9e76..284ea81e6d3 100644 --- a/htdocs/core/lib/parsemd.lib.php +++ b/htdocs/core/lib/parsemd.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2023 Laurent Destailleur * * 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 @@ -18,7 +18,7 @@ /** * \file htdocs/core/lib/parsemd.lib.php - * \brief This file contains functions dedicated to MD parsind. + * \brief This file contains functions dedicated to MD parsing. */ /** @@ -31,6 +31,14 @@ */ function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null) { + // Replace a HTML string with a Markdown syntax + $content = preg_replace('/([^<]+)<\/a>/', '[\2](\1)', $content); + //$content = preg_replace('/([^<]+)<\/a>/', '[\3](\1){:target="\2"}', $content); + $content = preg_replace('/([^<]+)<\/a>/', '[\3](\1)', $content); + + // Replace HTML coments + $content = preg_replace('//ms', '', $content); // We remove HTML comment that are not MD comment because they will be escaped and output when setSafeMode is set to true. + if (is_array($replaceimagepath)) { foreach ($replaceimagepath as $key => $val) { $keytoreplace = ']('.$key; @@ -40,8 +48,9 @@ function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null) } if ($parser == 'parsedown') { include_once DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php'; - $Parsedown = new Parsedown(); - $content = $Parsedown->text($content); + $parsedown = new Parsedown(); + $parsedown->setSafeMode(true); // This will escape HTML link into html entities but markdown links are ok + $content = $parsedown->text($content); } else { $content = nl2br($content); } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 3b893e39256..4371f55d0c5 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -78,9 +78,9 @@ function pdf_admin_prepare_head() /** * Return array with format properties of default PDF format * - * @param Translate $outputlangs Output lang to use to autodetect output format if we need 'auto' detection - * @param string $mode 'setup' = Use setup, 'auto' = Force autodetection whatever is setup - * @return array Array('width'=>w,'height'=>h,'unit'=>u); + * @param Translate|null $outputlangs Output lang to use to autodetect output format if we need 'auto' detection + * @param string $mode 'setup' = Use setup, 'auto' = Force autodetection whatever is setup + * @return array Array('width'=>w,'height'=>h,'unit'=>u); */ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup') { @@ -241,7 +241,7 @@ function pdf_getEncryption($pathoffile) $content = file_get_contents($pathoffile); //ob_start(); - @($parser = new \TCPDF_PARSER(ltrim($content))); + @($parser = new TCPDF_PARSER(ltrim($content))); list($xref, $data) = $parser->getParsedData(); unset($parser); //ob_end_clean(); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index ed3f8d7a4a3..408f661e2b9 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -70,7 +70,7 @@ function product_prepare_head($object) } if (!empty($object->status_buy) || (isModEnabled('margin') && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase - if ((((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->fournisseur->lire) + if ((isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'read') || $user->hasRight('supplier_invoice', 'read')) || (isModEnabled('margin') && $user->hasRight("margin", "liretous")) ) { if ($usercancreadprice) { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 47e45225205..dd7026a0d60 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -126,7 +126,7 @@ function project_prepare_head(Project $project, $moreparam = '') $h++; } - if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) + if (isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice") || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('facture') || isModEnabled('contrat') || isModEnabled('ficheinter') || isModEnabled('agenda') || isModEnabled('deplacement') || isModEnabled('stock')) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 588418c7449..b24fec85a9c 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -42,16 +42,19 @@ function propal_prepare_head($object) $head[$h][2] = 'comm'; $h++; - if ((empty($conf->commande->enabled) && ((isModEnabled("expedition") && isModEnabled('expedition_bon') && $user->rights->expedition->lire) - || (isModEnabled("expedition") && !empty($conf->delivery_note->enabled) && $user->rights->expedition->delivery->lire)))) { + if ((empty($conf->commande->enabled) && ((isModEnabled("expedition") && getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->rights->expedition->lire) + || (isModEnabled("expedition") && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->rights->expedition->delivery->lire)))) { $langs->load("sendings"); $text = ''; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; - if (isModEnabled('expedition_bon')) { + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) { $text = $langs->trans("Shipment"); } - if (isModEnabled('delivery_note')) { - $text .= '/'.$langs->trans("Receivings"); + if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { + $text .= '/'; + } + if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) { + $text .= $langs->trans("Receivings"); } $head[$h][1] = $text; $head[$h][2] = 'shipping'; diff --git a/htdocs/core/lib/reception.lib.php b/htdocs/core/lib/reception.lib.php index e697908e8cb..16e036991f9 100644 --- a/htdocs/core/lib/reception.lib.php +++ b/htdocs/core/lib/reception.lib.php @@ -46,6 +46,13 @@ function reception_prepare_head(Reception $object) $head[$h][2] = 'reception'; $h++; + if ($object->statut == Reception::STATUS_DRAFT) { + $head[$h][0] = DOL_URL_ROOT."/reception/dispatch.php?id=".$object->id; + $head[$h][1] = $langs->trans("DispatchCard"); + $head[$h][2] = 'dispatch'; + $h++; + } + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $objectsrc = $object; if ($object->origin == 'supplier_order' && $object->origin_id > 0) { diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3c9ca5e34d9..f75bb21eae9 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -109,6 +109,7 @@ function dolGetRandomBytes($length) /** * Encode a string with a symetric encryption. Used to encrypt sensitive data into database. * Note: If a backup is restored onto another instance with a different $dolibarr_main_instance_unique_id, then decoded value will differ. + * This function is called for example by dol_set_const() when saving a sensible data into database configuration table llx_const. * * @param string $chain string to encode * @param string $key If '', we use $dolibarr_main_instance_unique_id @@ -335,7 +336,7 @@ function dolGetLdapPasswordHash($password, $type = 'md5') * @param string $features Features to check (it must be module name or $object->element. Can be a 'or' check with 'levela|levelb'. * Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * This is used to check permission $user->rights->features->... - * @param int|string|object $object Object or Object ID or list of Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). + * @param int|string|Object $object Object or Object ID or list of Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany module. Param not used if objectid is null (optional). * @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'sublevela|sublevelb'. * This is used to check permission $user->rights->features->feature2... @@ -400,11 +401,11 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($features == 'productbatch') { $features = 'produit'; } - if ($features == 'fournisseur') { // When vendor invoice and pruchase order are into module 'fournisseur' + if ($features == 'fournisseur') { // When vendor invoice and purchase order are into module 'fournisseur' $features = 'fournisseur'; - if ($object->element == 'invoice_supplier') { + if (is_object($object) && $object->element == 'invoice_supplier') { $feature2 = 'facture'; - } elseif ($object->element == 'order_supplier') { + } elseif (is_object($object) && $object->element == 'order_supplier') { $feature2 = 'commande'; } } @@ -508,6 +509,11 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($subfeature == 'user' && $user->id == $objectid) { continue; // A user can always read its own card } + if ($subfeature == 'fiscalyear' && $user->hasRight('accounting', 'fiscalyear', 'write')) { + // only one right for fiscalyear + $tmpreadok = 1; + continue; + } if (!empty($subfeature) && empty($user->rights->$feature->$subfeature->lire) && empty($user->rights->$feature->$subfeature->read)) { $tmpreadok = 0; } elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { @@ -983,6 +989,8 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $checkonentitydone = 1; } + //var_dump($checkonentitydone); + if (!$checkonentitydone && !in_array($feature, $nocheck) && $objectid > 0) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield // If external user: Check permission for external users if ($user->socid > 0) { @@ -994,7 +1002,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $sql .= " WHERE dbt.rowid IN (".$db->sanitize($objectid, 1).")"; $sql .= " AND dbt.".$dbt_keyfield." = ".((int) $user->socid); } elseif (isModEnabled("societe") && empty($user->rights->societe->client->voir)) { - // If internal user: Check permission for internal users that are restricted on their objects + // If internal user without permission to see all thirdparties: Check permission for internal users that are restricted on their objects if ($feature != 'ticket') { if (empty($dbt_keyfield)) { dol_print_error('', 'Param dbt_keyfield is required but not defined'); @@ -1016,7 +1024,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $sql .= " AND (sc.fk_user = ".((int) $user->id)." OR sc.fk_user IS NULL)"; } } elseif (isModEnabled('multicompany')) { - // If multicompany and internal users with all permissions, check user is in correct entity + // If multicompany, and user is an internal user with all permissions, check that object is in correct entity $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")"; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index b60054b9701..f6d354d9431 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -572,19 +572,20 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token if (!empty($conf->use_javascript_ajax)) { print "\n".''; print ''; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index dc30d1296f9..3ecf97813e7 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -177,7 +177,7 @@ if ($resql) { * Draft orders */ -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { +if (isModEnabled("supplier_order")) { $sql = "SELECT c.rowid, c.ref, s.nom as name, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index adf75194fde..776c1e62fe2 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -970,7 +970,7 @@ $sql .= $hookmanager->resPrint; // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -1694,7 +1694,7 @@ if ($resql) { $thirdpartytmp->fournisseur = $obj->fournisseur; $objectstatic->socid = $thirdpartytmp->getNomUrl('supplier', 0, 0, -1); // Output Kanban - print $objectstatic->getKanbanView(''); + print $objectstatic->getKanbanView('', array('selected' => in_array($objectstatic->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print ''; diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index fb8179f2042..1e08deb7fd0 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1059,9 +1059,9 @@ if ($action == 'create') { print dol_get_fiche_end(); $title = $langs->trans("ProductsAndServices"); - if (empty($conf->service->enabled)) { + if (!isModEnabled("service")) { $title = $langs->trans("Products"); - } elseif (empty($conf->product->enabled)) { + } elseif (!isModEnabled("product")) { $title = $langs->trans("Services"); } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 393c32e500a..e98bc12cba2 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -69,7 +69,7 @@ if (isModEnabled('incoterm')) { } $id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int')); -$socid = GETPOST('socid', 'int'); + $action = GETPOST('action', 'aZ09'); $confirm = GETPOST("confirm"); $ref = GETPOST('ref', 'alpha'); @@ -110,10 +110,11 @@ if ($id > 0 || !empty($ref)) { } // Security check -$socid = ''; +$socid = GETPOST('socid', 'int'); if (!empty($user->socid)) { $socid = $user->socid; } + $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', 'rowid', $isdraft); @@ -2199,7 +2200,8 @@ if ($action == 'create') { print $societe->getNomUrl(1, 'supplier'); print ''; } else { - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', '(s.fournisseur = 1 AND s.status = 1)', 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500'); + $filter = '((s.fournisseur:=:1) AND (s.status:=:1))'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company(empty($societe->id) ? 0 : $societe->id, 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth175 widthcentpercentminusxx maxwidth500'); // reload page to retrieve supplier informations if (empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE_DISABLED)) { print ''; +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/reception/document.php b/htdocs/reception/document.php index 56854244f7b..6641cfaecf6 100644 --- a/htdocs/reception/document.php +++ b/htdocs/reception/document.php @@ -79,7 +79,7 @@ if ($id > 0 || !empty($ref)) { } // Linked documents - if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { + if ($origin == 'order_supplier' && $object->$typeobject->id && isModEnabled("supplier_order")) { $objectsrc = new CommandeFournisseur($db); $objectsrc->fetch($object->$typeobject->id); } diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index fe47b95fb1e..7b28d571bc5 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -2,7 +2,8 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2023 Alexandre Spangaro * * 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 @@ -345,6 +346,9 @@ if (empty($reshook)) { $objecttmp->remise_absolue = $remise_absolue; $objecttmp->transport_mode_id = $transport_mode_id; + // if the VAT reverse-charge is activated by default in supplier card to resume the information + $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge; + $objecttmp->fk_project = $rcp->fk_project; //$objecttmp->multicurrency_code = $rcp->multicurrency_code; if (empty($createbills_onebythird)) { @@ -704,7 +708,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // No $sql .= $hookmanager->resPrint; $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); diff --git a/htdocs/reception/note.php b/htdocs/reception/note.php index 6edb752ead8..1d8688a35e6 100644 --- a/htdocs/reception/note.php +++ b/htdocs/reception/note.php @@ -54,7 +54,7 @@ if ($id > 0 || !empty($ref)) { } // Linked documents - if ($origin == 'order_supplier' && $object->$typeobject->id && (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || isModEnabled("supplier_order"))) { + if ($origin == 'order_supplier' && $object->$typeobject->id && isModEnabled("supplier_order")) { $objectsrc = new CommandeFournisseur($db); $objectsrc->fetch($object->$typeobject->id); } diff --git a/htdocs/recruitment/class/api_recruitment.class.php b/htdocs/recruitment/class/api_recruitment.class.php index b665bda1279..bcce3d9b92c 100644 --- a/htdocs/recruitment/class/api_recruitment.class.php +++ b/htdocs/recruitment/class/api_recruitment.class.php @@ -165,7 +165,7 @@ class Recruitment extends DolibarrApi if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } - $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t"; + $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." AS t LEFT JOIN ".MAIN_DB_PREFIX.$tmpobject->table_element."_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale @@ -272,7 +272,7 @@ class Recruitment extends DolibarrApi if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } - $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t"; + $sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." AS t LEFT JOIN ".MAIN_DB_PREFIX.$tmpobject->table_element."_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index d44294ac9bd..065d56d8857 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -1116,7 +1116,7 @@ class RecruitmentJobPosition extends CommonObject */ public function getKanbanView($option = '', $arraydata = null) { - global $langs, $obj; + global $langs; $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); @@ -1138,7 +1138,9 @@ class RecruitmentJobPosition extends CommonObject $return .= ' | '.$langs->trans("Remuneration").' : '.$this->remuneration_suggested.''; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(3).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '.$obj->nbapplications.'
'; + $return .= '
'.$this->getLibStatut(3).' | '.$langs->trans("RecruitmentCandidatures", '', '', '', '', 5).' : '; + $return .= $arraydata['nbapplications']; + $return .= '
'; } $return .= ''; $return .= ''; diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index deca6c40548..a878aab0c22 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -312,7 +312,7 @@ $sql = preg_replace('/,\s*$/', '', $sql); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -747,15 +747,16 @@ while ($i < $imaxinloop) { print '
'; diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 82bad29b8ea..5a759250ae6 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -289,7 +289,7 @@ $sql = preg_replace('/,\s*$/', '', $sql); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* This old and fast method to get and count full list returns all record so use a high amount of memory. */ $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); @@ -597,7 +597,7 @@ while ($i < $imaxinloop) { $selected = 0; } // Output Kanban - print $object->getKanbanView(''); + print $object->getKanbanView('', array('nbapplications'=>$obj->nbapplications, 'selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print ''; print ''; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index b9050d190d2..8045b2857cb 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -542,7 +542,7 @@ class Dolresource extends CommonObject } $sql .= $this->db->order($sortfield, $sortorder); $this->num_all = 0; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $result = $this->db->query($sql); $this->num_all = $this->db->num_rows($result); } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 8ad57e0d93b..2395b6bf1b3 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -200,7 +200,7 @@ print ''; print ''; print ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $ret = $object->fetchAll('', '', 0, 0, $filter); if ($ret == -1) { dol_print_error($db, $object->error); diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 70c69761559..5a908a4d58e 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -303,7 +303,7 @@ $sql .= " pst.code"; // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -663,7 +663,7 @@ while ($i < $imaxinloop) { $selected = 1; } } - print $salstatic->getKanbanView('', array('user' => $userstatic)); + print $salstatic->getKanbanView('', array('user' => $userstatic, 'selected' => $selected)); if ($i == ($imaxinloop - 1)) { print ''; print ''; diff --git a/htdocs/salaries/payments.php b/htdocs/salaries/payments.php index adee2a2ebf1..710a7b88c35 100644 --- a/htdocs/salaries/payments.php +++ b/htdocs/salaries/payments.php @@ -286,7 +286,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $resql = $db->query($sql); $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 @@ -574,7 +574,7 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban - print $paymentsalstatic->getKanbanView(''); + print $paymentsalstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print '
'; print ''; diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 669f4349247..e79a28310f2 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -73,7 +73,7 @@ if (!$sortorder) { $object = new Societe($db); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('agendathirdparty')); +$hookmanager->initHooks(array('agendathirdparty', 'globalcard')); // Security check $socid = GETPOST('socid', 'int'); diff --git a/htdocs/societe/ajax/ajaxcompanies.php b/htdocs/societe/ajax/ajaxcompanies.php index 08d914d562a..aca9a4eaddb 100644 --- a/htdocs/societe/ajax/ajaxcompanies.php +++ b/htdocs/societe/ajax/ajaxcompanies.php @@ -20,7 +20,7 @@ /** * \file htdocs/societe/ajax/ajaxcompanies.php - * \brief File to return Ajax response on third parties request + * \brief File to return Ajax response on third parties request. Search is done on name|name_alias|code_client|code_fournisseur */ if (!defined('NOTOKENRENEWAL')) { @@ -53,107 +53,127 @@ if ($id > 0) { // Security check if ($user->socid > 0) { $socid = $user->socid; - $object->id = $socid; + if ($object->socid && $socid != $object->socid) { + accessforbidden('Not allowed to access thirdparty id '.$id.' with an external user on id '.$socid); + } } -restrictedArea($user, 'societe', $object->id, '&societe'); +restrictedArea($user, 'societe', $object, '&societe'); /* * View */ -// Ajout directives pour resoudre bug IE -//header('Cache-Control: Public, must-revalidate'); -//header('Pragma: public'); - //top_htmlhead("", "", 1); // Replaced with top_httphead. An ajax page does not need html header. -top_httphead(); +top_httphead('application/json'); //print ''."\n"; -// Generate list of companies -if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn', 'int')) { - $return_arr = array(); +$return_arr = array(); - // Define filter on text typed - $socid = GETPOST('newcompany'); - if (!$socid) { - $socid = GETPOST('socid', 'int'); - } - if (!$socid) { - $socid = GETPOST('id_fourn', 'int'); - } - - $sql = "SELECT s.rowid, s.nom"; - if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { - $sql .= ", s.client, s.fournisseur, s.code_client, s.code_fournisseur"; - } - if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { - $sql .= ", s.address, s.zip, s.town"; - $sql .= ", dictp.code as country_code"; - } - $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays"; - } - $sql .= " WHERE s.entity IN (".getEntity('societe').")"; - if ($socid) { - $sql .= " AND ("; - // Add criteria on name/code - if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index - $sql .= "nom LIKE '".$db->escape($socid)."%'"; - $sql .= " OR code_client LIKE '".$db->escape($socid)."%'"; - $sql .= " OR code_fournisseur LIKE '".$db->escape($socid)."%'"; - } else { - $sql .= "nom LIKE '%".$db->escape($socid)."%'"; - $sql .= " OR code_client LIKE '%".$db->escape($socid)."%'"; - $sql .= " OR code_fournisseur LIKE '%".$db->escape($socid)."%'"; - } - if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) { - $sql .= " OR rowid = ".((int) $socid); - } - $sql .= ")"; - } - //if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters - $sql .= " ORDER BY nom ASC"; - - //dol_syslog("ajaxcompanies", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) { - while ($row = $db->fetch_array($resql)) { - $label = ''; - if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { - if (($row['client']) && (!empty($row['code_client']))) { - $label = $row['code_client'].' - '; - } - if (($row['fournisseur']) && (!empty($row['code_fournisseur']))) { - $label .= $row['code_fournisseur'].' - '; - } - } - - $label .= $row['nom']; - - if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { - $label .= ($row['address'] ? ' - '.$row['address'] : '').($row['zip'] ? ' - '.$row['zip'] : '').($row['town'] ? ' '.$row['town'] : ''); - if (!empty($row['country_code'])) { - $label .= ', '.$langs->trans('Country'.$row['country_code']); - } - } - if ($socid) { - $label = preg_replace('/('.preg_quote($socid, '/').')/i', '$1', $label, 1); - } - $row_array['label'] = $label; - $row_array['value'] = $row['nom']; - $row_array['key'] = $row['rowid']; - - array_push($return_arr, $row_array); - } - - echo json_encode($return_arr); - } else { - echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error')); - } -} else { - echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter')); +// Define filter on text typed +$socid = GETPOST('newcompany'); +if (!$socid) { + $socid = GETPOST('socid', 'int'); +} +if (!$socid) { + $socid = GETPOST('id_fourn', 'int'); +} + +// Generate list of companies +if (! $socid) { + echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter')); + exit; +} + +$sql = "SELECT s.rowid, s.nom, s.name_alias, s.code_client, s.code_fournisseur, s.address, s.zip, s.town, s.email, s.siren, s.siret, s.ape, s.idprof4, s.idprof5, s.idprof6, s.client, s.fournisseur, s.datec, s.logo"; +if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { + $sql .= ", dictp.code as country_code"; +} +$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; +if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays"; +} +$sql .= " WHERE s.entity IN (".getEntity('societe').")"; +if ($socid) { + $sql .= " AND ("; + // Add criteria on name/code + if (!empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) { // Can use index + $sql .= "s.nom LIKE '".$db->escape($db->escapeforlike($socid))."%'"; + $sql .= " OR s.name_alias LIKE '".$db->escape($db->escapeforlike($socid))."%'"; + $sql .= " OR s.code_client LIKE '".$db->escape($db->escapeforlike($socid))."%'"; + $sql .= " OR s.code_fournisseur LIKE '".$db->escape($db->escapeforlike($socid))."%'"; + } else { + $sql .= "s.nom LIKE '%".$db->escape($db->escapeforlike($socid))."%'"; + $sql .= " OR s.name_alias LIKE '%".$db->escape($db->escapeforlike($socid))."%'"; + $sql .= " OR s.code_client LIKE '%".$db->escape($db->escapeforlike($socid))."%'"; + $sql .= " OR s.code_fournisseur LIKE '%".$db->escape($db->escapeforlike($socid))."%'"; + } + if (!empty($conf->global->SOCIETE_ALLOW_SEARCH_ON_ROWID)) { + $sql .= " OR s.rowid = ".((int) $socid); + } + $sql .= ")"; +} +// Protection for external user access +if ($user->socid > 0) { + $sql .= " AND s.rowid = ".((int) $user->socid); +} +//if (GETPOST("filter")) $sql.= " AND (".GETPOST("filter", "alpha").")"; // Add other filters +$sql .= " ORDER BY s.nom ASC"; + +//dol_syslog("ajaxcompanies", LOG_DEBUG); +$resql = $db->query($sql); +if ($resql) { + while ($row = $db->fetch_array($resql)) { + $label = ''; + if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { + if (($row['client']) && (!empty($row['code_client']))) { + $label = $row['code_client'].' - '; + } + if (($row['fournisseur']) && (!empty($row['code_fournisseur']))) { + $label .= $row['code_fournisseur'].' - '; + } + } + + $label .= $row['nom']; + + if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { + $label .= ($row['address'] ? ' - '.$row['address'] : '').($row['zip'] ? ' - '.$row['zip'] : '').($row['town'] ? ' '.$row['town'] : ''); + if (!empty($row['country_code'])) { + $label .= ', '.$langs->trans('Country'.$row['country_code']); + } + } + if ($socid) { + $label = preg_replace('/('.preg_quote($socid, '/').')/i', '$1', $label, 1); + } + $row_array['label'] = $label; + + $row_array['value'] = $row['nom']; + $row_array['key'] = $row['rowid']; + + $row_array['name_alias'] = $row['name_alias']; + $row_array['client'] = $row['client']; + $row_array['fournisseur'] = $row['fournisseur']; + $row_array['code_client'] = $row['code_client']; + $row_array['code_fournisseur'] = $row['code_fournisseur']; + $row_array['address'] = $row['address']; + $row_array['zip'] = $row['zip']; + $row_array['town'] = $row['town']; + $row_array['email'] = $row['email']; + $row_array['siren'] = $row['siren']; + $row_array['siret'] = $row['siret']; + $row_array['ape'] = $row['ape']; + $row_array['idprof4'] = $row['idprof4']; + $row_array['idprof5'] = $row['idprof5']; + $row_array['idprof6'] = $row['idprof6']; + $row_array['datec'] = $row['datec']; + $row_array['logo'] = $row['logo']; + + array_push($return_arr, $row_array); + } + + echo json_encode($return_arr); +} else { + echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error')); } diff --git a/htdocs/societe/ajax/company.php b/htdocs/societe/ajax/company.php index 7bdfe6e0e34..f625b94bed7 100644 --- a/htdocs/societe/ajax/company.php +++ b/htdocs/societe/ajax/company.php @@ -19,7 +19,8 @@ /** * \file htdocs/societe/ajax/company.php - * \brief File to return Ajax response on thirdparty list request + * \brief File to return Ajax response on thirdparty list request. Used by the combo list of thirdparties. + * Search done on name, name_alias, barcode, tva_intra, ... */ if (!defined('NOTOKENRENEWAL')) { @@ -48,8 +49,8 @@ $outjson = (GETPOST('outjson', 'int') ? GETPOST('outjson', 'int') : 0); $action = GETPOST('action', 'aZ09'); $id = GETPOST('id', 'int'); $excludeids = GETPOST('excludeids', 'intcomma'); -$showtype = GETPOSTINT('showtype'); -$showcode = GETPOSTINT('showcode'); +$showtype = GETPOSTINT('showtype', 'alpha'); +$showcode = GETPOSTINT('showcode', 'alpha'); $object = new Societe($db); if ($id > 0) { @@ -69,6 +70,8 @@ restrictedArea($user, 'societe', $object->id, '&societe'); * View */ +top_httphead('application/json'); + //print ''."\n"; //print_r($_GET); @@ -90,10 +93,6 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { } else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; - $langs->load("companies"); - - top_httphead(); - if (empty($htmlname)) { return; } @@ -124,9 +123,9 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) { $arrayresult = $form->select_thirdparty_list(0, $htmlname, $filter, 1, $showtype, 0, null, $searchkey, $outjson, 0, 'minwidth100', '', false, $excludeids, $showcode); - $db->close(); - if ($outjson) { print json_encode($arrayresult); } } + +$db->close(); diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index a2b320e50db..0ed8d07fe51 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -188,7 +188,7 @@ abstract class ActionsCardCommon $s = $modCodeClient->getToolTip($langs, $this->object, 0); $this->tpl['help_customercode'] = $form->textwithpicto('', $s, 1); - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { + if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { $this->tpl['supplier_enabled'] = 1; // Load object modCodeFournisseur diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 1e034d46322..1ee7e003b2a 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -133,7 +133,7 @@ class ActionsCardCompany extends ActionsCardCommon $s .= ' '; if ($conf->use_javascript_ajax) { - $s .= '
'.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; @@ -161,7 +161,7 @@ class ActionsCardCompany extends ActionsCardCommon $s .= '   '; if ($conf->use_javascript_ajax) { - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5e2af49e4d4..3f62deb8a98 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1091,7 +1091,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->client = 1; } - if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { + if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur = 1; } @@ -1368,10 +1368,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; print ''; - print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); - /* Disabled. Must be implenteted by keeping the input text but calling ajax on a keydown of the input and output - data of duplicate into a div under the input. We need to keep the widgetForTranslation also for some countries. - */ + print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); // For some countries that need the company name in 2 languages + // This implementation of the feature to search already existing company has been disabled. It must be implemented by keeping the "input text" and we must call the search ajax societe/ajax/ajaxcompanies.php + // on a keydown of the input. We should show data about a duplicate found if we found less than 5 answers into a div under the input. /* print ''; print "\n".''; print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $s .= 'country_id).'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; @@ -1836,7 +1835,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Supplier - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { + if (isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { print ''; } -//if ($conf->agenda->enabled && $user->rights->agenda->myactions->read) $elementTypeArray['action']=$langs->transnoentitiesnoconv('Events'); +//if (isModEnabled('agenda') && $user->rights->agenda->myactions->read) $elementTypeArray['action']=$langs->transnoentitiesnoconv('Events'); if ($object->client) { print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + print_liste_field_titre(($mode != 'kanban' ? $selectedfields : ''), $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.rowid']['checked'])) { - print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder, 'actioncolumn '); + print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"], "s.rowid", "", $param, ' data-key="id"', $sortfield, $sortorder, ''); $totalarray['nbfield']++; } if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder, 'actioncolumn '); + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, ' data-key="ref"', $sortfield, $sortorder, ' '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.name_alias']['checked'])) { @@ -1510,7 +1510,7 @@ if (!empty($arrayfields['s.import_key']['checked'])) { } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); + print_liste_field_titre(($mode != 'kanban' ? $selectedfields : ''), $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn '); $totalarray['nbfield']++; // For the column action } print ''."\n"; @@ -1564,7 +1564,7 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban - print $companystatic->getKanbanView(''); + print $companystatic->getKanbanView('', array('selected' => in_array($obj->rowid, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print '
'; print ''; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index f299ef2ee82..e7dabe47154 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -184,7 +184,7 @@ if ($result > 0) { print ''; } - if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { + if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { print ''; - if (!empty($conf->prelevement->enabled)) { + if (isModEnabled('prelevement')) { // RUM //print ''; print ''; @@ -1695,7 +1695,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' //var_dump($src); print ''; - if (!empty($conf->prelevement->enabled)) { + if (isModEnabled('prelevement')) { // RUM print ''; } else { print '
'; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; -$searchpicto = $form->showFilterButtons(); -print $searchpicto; -print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'; + print ''; + print ''; + print ''; + print '
'; + print ''; + print '
'; + print ''; + print ''; + print ''; + print '
'; + print ''; + print '
'; - print ''; - print ''; - print ''; - print '
'; - print ''; - print '
'; $fieldsforcontent = array('topic', 'joinfiles', 'content'); if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { - $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); + $fieldsforcontent[] = 'content_lines'; } foreach ($fieldsforcontent as $tmpfieldlist) { $showfield = 1; - $align = "left"; + $css = "left"; $valuetoshow = $obj->$tmpfieldlist; $class = 'tddict'; // Show value for field if ($showfield) { // Show line for topic, joinfiles and content - print '
'; if ($tmpfieldlist == 'topic') { print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; print ''; + print '
'."\n"; } if ($tmpfieldlist == 'joinfiles') { print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1); + print '
'."\n"; } if ($tmpfieldlist == 'content') { @@ -1085,6 +1122,7 @@ if ($num) { print $doleditor->Create(1); } if ($tmpfieldlist == 'content_lines') { + print '
'."\n"; print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { @@ -1093,11 +1131,11 @@ if ($num) { $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } - print '
'; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + print ''.img_delete().''; + //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin + } + print ''; if ($canbedisabled) { @@ -1229,16 +1280,18 @@ if ($num) { } print "'; - if ($canbemodified) { - print ''.img_edit().''; + // Action column - Modify link / Delete link + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + print ''.img_delete().''; + //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin + } + print '
'.$conf->currency; print ' ('.$langs->getCurrencySymbol($conf->currency).')'; -print $form->textwithpicto(' ', $langs->trans("BaseCurrency")).'1
'.$currency->code.' - '.$currency->name.''.$currency->code.' - '.$currency->name; + if (!empty($TAvailableCurrency[$currency->code]) && empty($TAvailableCurrency[$currency->code]['active'])) { + print img_warning('Warning: The code '.$currency->code.' has been disabled into Home - Setup - Dictionaries - Currencies'); + } + print ''; print '
'; print ''; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index f86f6d5c27f..7893b271d06 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -188,7 +188,7 @@ print '
'.$langs->trans("USTRD").''; -print '
'.$langs->trans("Parameters").'
'.$langs->trans("ReStockOnBill").''; -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { +if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if ($conf->use_javascript_ajax) { if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); @@ -332,7 +332,7 @@ $found++; print '
'.$langs->trans("ReStockOnValidateOrder").''; -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { +if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) { if ($conf->use_javascript_ajax) { if ($disabled) { print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"'); @@ -381,7 +381,7 @@ if (isModEnabled("reception")) { print '
'.$langs->trans("ReStockOnDispatchOrder").''; - if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) { + if (isModEnabled("supplier_order")) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition'); } else { diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index fd586e24c95..10301bf3aed 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -424,7 +424,7 @@ print '
'; print ''.$langs->trans("HTTPCacheStaticResources").' - '; print $form->textwithpicto($langs->trans("CacheByServer"), $langs->trans("CacheByServerDesc")); print ':
'; -// No cahce on PHP +// No cache on PHP //print '
'.img_picto('','warning.png').' '.$langs->trans("FilesOfTypeNotCompressed",'php (.php)').'
'; //print '
'.img_picto('','tick.png').' '.$langs->trans("FilesOfTypeNotCached",'php (.php)').'
'; // Cache on rest diff --git a/htdocs/admin/system/security.php b/htdocs/admin/system/security.php index bc3f4609d1f..4229a6def80 100644 --- a/htdocs/admin/system/security.php +++ b/htdocs/admin/system/security.php @@ -173,7 +173,7 @@ print '
'; print ''.$langs->trans("XDebug").': '; $test = !function_exists('xdebug_is_enabled') && !extension_loaded('xdebug'); if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); + print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); } else { print img_picto('', 'warning').' '.$langs->trans("ModuleActivatedMayExposeInformation", $langs->transnoentities("XDebug")); print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; @@ -480,30 +480,57 @@ print load_fiche_titre($langs->trans("Modules"), '', 'folder'); // Module log print ''.$langs->trans("Syslog").': '; -$test = !isModEnabled('syslog'); -if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); +$test = isModEnabled('syslog'); +if (!$test) { + print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); } else { if (getDolGlobalInt('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"), getDolGlobalInt('SYSLOG_LEVEL')); + print img_picto('', 'tick').' '.$langs->trans("ModuleSyslogActivatedButLevelNotTooVerbose", $langs->transnoentities("Syslog"), getDolGlobalInt('SYSLOG_LEVEL')); } //print ' '.$langs->trans("MoreInformation").' XDebug admin page'; } print '
'; +print '
'; + // Module debugbar print ''.$langs->trans("DebugBar").': '; -$test = empty($conf->debugbar->enabled); -if ($test) { - print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); +$test = isModEnabled('debugbar'); +if (!$test) { + print img_picto('', 'tick').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis"); } else { print img_picto('', 'error').' '.$langs->trans("ModuleActivatedDoNotUseInProduction", $langs->transnoentities("DebugBar")); //print ' '.$langs->trans("MoreInformation").' XDebug admin page'; } print '
'; +print '
'; + +// Modules for Payments +$test = isModEnabled('stripe'); +if ($test) { + print ''.$langs->trans("Stripe").': '; + if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { + print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe")); + } else { + print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe")); + } + print '
'; +} else { + $test = isModEnabled('paypal'); + if ($test) { + print ''.$langs->trans("Paypal").': '; + if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { + print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal")); + } else { + print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal")); + } + print '
'; + } +} + // APIs diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index cf55c7b9127..28d347bcabe 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -122,7 +122,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array( 'family'=>'classify_supplier_proposal', 'position'=>60, - 'enabled'=>(isModEnabled('supplier_proposal') && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'enabled'=>(isModEnabled('supplier_proposal') && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 'picto'=>'supplier_proposal', 'warning'=>'' ), @@ -131,7 +131,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION'=>array( 'family'=>'classify_supplier_order', 'position'=>63, - 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))), + 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && isModEnabled("reception") && isModEnabled('supplier_order')), 'picto'=>'supplier_order', 'warning'=>'' ), @@ -139,7 +139,7 @@ $workflowcodes = array( 'WORKFLOW_ORDER_CLASSIFY_RECEIVED_RECEPTION_CLOSED'=>array( 'family'=>'classify_supplier_order', 'position'=>64, - 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && (isModEnabled("reception")) && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !isModEnabled('supplier_order'))), + 'enabled'=>(!empty($conf->global->MAIN_FEATURES_LEVEL) && isModEnabled("reception") && isModEnabled('supplier_order')), 'picto'=>'supplier_order', 'warning'=>'' ), @@ -147,7 +147,7 @@ $workflowcodes = array( 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER'=>array( 'family'=>'classify_supplier_order', 'position'=>65, - 'enabled'=>((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), + 'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'picto'=>'supplier_order', 'warning'=>'' ), @@ -164,7 +164,7 @@ $workflowcodes = array( 'WORKFLOW_EXPEDITION_CLASSIFY_CLOSED_INVOICE'=>array( 'family'=>'classify_reception', 'position'=>95, - 'enabled'=>(isModEnabled("reception") && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 'enabled'=>(isModEnabled("reception") && (isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 'picto'=>'reception' ), diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 3a1a176d818..bfe6c0e3b39 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -80,7 +80,7 @@ class DolibarrApi * * @param string $field Field name * @param string $value Value to check/clean - * @param stdClass $object Object + * @param Object $object Object * @return string Value cleaned */ protected function _checkValForAPI($field, $value, $object) @@ -278,7 +278,6 @@ class DolibarrApi * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @return bool - * @throws RestException */ protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') { diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 6402bdcb72e..31693bfec9a 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -30,11 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/iUs require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Resources.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/Defaults.php'; require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/RestException.php'; -use \Luracast\Restler\iAuthenticate; -use \Luracast\Restler\iUseAuthentication; -use \Luracast\Restler\Resources; -use \Luracast\Restler\Defaults; -use \Luracast\Restler\RestException; +use Luracast\Restler\iAuthenticate; +use Luracast\Restler\iUseAuthentication; +use Luracast\Restler\Resources; +use Luracast\Restler\Defaults; +use Luracast\Restler\RestException; /** * Dolibarr API access class diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d7fd1ea7118..63481f777b1 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Xebax Christy * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2016 Jean-François Ferry + * Copyright (C) 2023 Romain Neil * * 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 @@ -221,6 +222,22 @@ class Documents extends DolibarrApi if ($result <= 0) { throw new RestException(500, 'Error generating document'); } + } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + + $this->contract = new Contrat($this->db); + $result = $this->contract->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + + if (!$result) { + throw new RestException(404, 'Contract not found'); + } + + $templateused = $doctemplate ? $doctemplate : $this->contract->model_pdf; + $result = $this->contract->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + + if ($result <= 0) { + throw new RestException(500, 'Error generating document missing doctemplate parameter'); + } } else { throw new RestException(403, 'Generation not available for this modulepart'); } @@ -502,6 +519,17 @@ class Documents extends DolibarrApi // $upload_dir = $conf->ecm->dir_output; // $type = 'all'; // $recursive = 0; + } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { + $modulepart = 'contrat'; + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + + $object = new Contrat($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Contract not found'); + } + + $upload_dir = $conf->contrat->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'contract'); } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); } @@ -667,11 +695,19 @@ class Documents extends DolibarrApi $modulepart = 'propale'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $object = new Propal($this->db); + } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { + $modulepart = 'agenda'; + require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; + $object = new ActionComm($this->db); } elseif ($modulepart == 'contact' || $modulepart == 'socpeople') { $modulepart = 'contact'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($this->db); $fetchbyid = true; + } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { + $modulepart = 'contrat'; + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + $object = new Contrat($this->db); } else { // TODO Implement additional moduleparts throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); @@ -752,6 +788,11 @@ class Documents extends DolibarrApi throw new RestException(500, "File with name '".$original_file."' already exists."); } + // in case temporary directory admin/temp doesn't exist + if (!dol_is_dir(dirname($destfiletmp))) { + dol_mkdir(dirname($destfiletmp)); + } + $fhandle = @fopen($destfiletmp, 'w'); if ($fhandle) { $nbofbyteswrote = fwrite($fhandle, $newfilecontent); diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 1b107746319..4d0a553d1e6 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -544,7 +544,7 @@ if ($action == 'edit') { print ''; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancysystem.class.php'; $accountsystem = new AccountancySystem($db); - $accountsystem->fetch($conf->global->CHARTOFACCOUNTS); + $accountsystem->fetch(getDolGlobalInt('CHARTOFACCOUNTS')); $sql = 'SELECT DISTINCT pcg_type FROM ' . MAIN_DB_PREFIX . 'accounting_account'; $sql .= " WHERE fk_pcg_version = '" . $db->escape($accountsystem->ref) . "'"; $sql .= ' AND entity in ('.getEntity('accounting_account', 0).')'; // Always limit to current entity. No sharing in accountancy. @@ -645,7 +645,7 @@ if ($action == 'edit') { print getDolGlobalString($constname); } } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } print '
'; + print ''; // $object_link can be a ''; // Amount print ''.price($block->amounts).'
'; print '
'; } - $recuitment = new RecruitmentJobPosition($db); - $recuitment->fetch($obj->fk_recruitmentjobposition); - $object->fk_recruitmentjobposition = $recuitment->getNomUrl(); + // TODO Use a cache for $recruitment + $recruitment = new RecruitmentJobPosition($db); + $recruitment->fetch($obj->fk_recruitmentjobposition); + $object->phone = $obj->phone; if ($massactionbutton || $massaction) { $selected = 0; } // Output Kanban - print $object->getKanbanView(''); + print $object->getKanbanView('', array('jobpositionlink'=>$recruitment->getNomUrl(1), 'selected' => in_array($object->id, $arrayofselected))); if ($i == ($imaxinloop - 1)) { print '
'; print '
'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0); @@ -2495,7 +2494,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "}\n"; print ''; print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; @@ -2963,7 +2962,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "}\n"; print ''; print "\n"; - $s .= ''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index dc88baf0c28..93a4668cf7c 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -149,7 +149,7 @@ if (!$vatNumber) { print '
'; print $langs->trans("VATIntraManualCheck", $langs->trans("VATIntraCheckURL"), $langs->transnoentitiesnoconv("VATIntraCheckURL")).'
'; print '
'; -print '
'; +print '
'; if ($messagetoshow) { print '

'; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 8552f257fcc..ef7f3d00e89 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -577,7 +577,7 @@ class Thirdparties extends DolibarrApi throw new RestException(501, 'Module "Thirdparties" needed for this request'); } - if (empty($conf->product->enabled)) { + if (!isModEnabled("product")) { throw new RestException(501, 'Module "Products" needed for this request'); } @@ -622,8 +622,7 @@ class Thirdparties extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number - * - * @return mixed + * @return array|void * * @url GET {id}/categories */ @@ -640,17 +639,17 @@ class Thirdparties extends DolibarrApi $categories = new Categorie($this->db); - $result = $categories->getListForItem($id, 'customer', $sortfield, $sortorder, $limit, $page); + $arrayofcateg = $categories->getListForItem($id, 'customer', $sortfield, $sortorder, $limit, $page); - if (is_numeric($result) && $result < 0) { + if (is_numeric($arrayofcateg) && $arrayofcateg < 0) { throw new RestException(503, 'Error when retrieve category list : '.$categories->error); } - if (is_numeric($result) && $result == 0) { // To fix a return of 0 instead of empty array of method getListForItem + if (is_numeric($arrayofcateg) && $arrayofcateg >= 0) { // To fix a return of 0 instead of empty array of method getListForItem return array(); } - return $result; + return $arrayofcateg; } /** @@ -658,8 +657,7 @@ class Thirdparties extends DolibarrApi * * @param int $id Id of thirdparty * @param int $category_id Id of category - * - * @return mixed + * @return Object|void * * @url POST {id}/categories/{category_id} */ @@ -697,7 +695,7 @@ class Thirdparties extends DolibarrApi * @param int $id Id of thirdparty * @param int $category_id Id of category * - * @return mixed + * @return Object|void * * @url DELETE {id}/categories/{category_id} */ @@ -1792,7 +1790,7 @@ class Thirdparties extends DolibarrApi * Clean sensible object datas * * @param Object $object Object to clean - * @return array|mixed Object with cleaned properties + * @return Object Object with cleaned properties */ protected function _cleanObjectDatas($object) { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 26a6169dbe6..7598e9a0838 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -102,9 +102,9 @@ class CompanyBankAccount extends Account /** * Create bank information record. * - * @param User $user User - * @param int $notrigger 1=Disable triggers - * @return int <0 if KO, > 0 if OK (ID of newly created company bank account information) + * @param User|null $user User + * @param int $notrigger 1=Disable triggers + * @return int <0 if KO, > 0 if OK (ID of newly created company bank account information) */ public function create(User $user = null, $notrigger = 0) { @@ -170,13 +170,13 @@ class CompanyBankAccount extends Account /** * Update bank account * - * @param User $user Object user - * @param int $notrigger 1=Disable triggers - * @return int <=0 if KO, >0 if OK + * @param User|null $user Object user + * @param int $notrigger 1=Disable triggers + * @return int <=0 if KO, >0 if OK */ public function update(User $user = null, $notrigger = 0) { - global $conf, $langs; + global $langs; $error = 0; @@ -205,7 +205,7 @@ class CompanyBankAccount extends Account $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; $sql .= ",default_rib = ".((int) $this->default_rib); - if (!empty($conf->prelevement->enabled)) { + if (isModEnabled('prelevement')) { $sql .= ",frstrecur = '".$this->db->escape($this->frstrecur)."'"; $sql .= ",rum = '".$this->db->escape($this->rum)."'"; $sql .= ",date_rum = ".($this->date_rum ? "'".$this->db->idate($this->date_rum)."'" : "null"); @@ -321,9 +321,9 @@ class CompanyBankAccount extends Account /** * Delete a rib from database * - * @param User $user User deleting - * @param int $notrigger 1=Disable triggers - * @return int <0 if KO, >0 if OK + * @param User|null $user User deleting + * @param int $notrigger 1=Disable triggers + * @return int <0 if KO, >0 if OK */ public function delete(User $user = null, $notrigger = 0) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9415901152e..a9f9cdea193 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -41,6 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonincoterm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonsocialnetworks.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonpeople.class.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; @@ -51,6 +52,7 @@ class Societe extends CommonObject { use CommonIncoterm; use CommonSocialNetworks; + use CommonPeople; /** * @var string ID of module. @@ -2038,10 +2040,10 @@ class Societe extends CommonObject /** * Delete a third party from database and all its dependencies (contacts, rib...) * - * @param int $id Id of third party to delete - * @param User $fuser User who ask to delete thirdparty - * @param int $call_trigger 0=No, 1=yes - * @return int <0 if KO, 0 if nothing done, >0 if OK + * @param int $id Id of third party to delete + * @param User|null $fuser User who ask to delete thirdparty + * @param int $call_trigger 0=No, 1=yes + * @return int <0 if KO, 0 if nothing done, >0 if OK */ public function delete($id, User $fuser = null, $call_trigger = 1) { @@ -2970,7 +2972,7 @@ class Societe extends CommonObject } } if (empty($option) || preg_match('/supplier/', $option)) { - if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $this->fournisseur) { + if ((isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $this->fournisseur) { $s .= '<'.$tag.' class="vendor-back" title="'.$langs->trans("Supplier").'" href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$this->id.'">'.dol_substr($langs->trans("Supplier"), 0, 1).''; } } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 07436ae6140..5b993769449 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -147,7 +147,7 @@ if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 3362755d962..d0f20cd5296 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -231,9 +231,9 @@ $arrayfields = array( 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1), 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))), 's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode), - 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), - 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(isModEnabled("supplier_order") || isModEnabled("supplier_invoice"))), 's.address'=>array('label'=>"Address", 'position'=>19, 'checked'=>0), 's.zip'=>array('label'=>"Zip", 'position'=>20, 'checked'=>1), 's.town'=>array('label'=>"Town", 'position'=>21, 'checked'=>0), @@ -740,7 +740,7 @@ $sql .= $hookmanager->resPrint; // Count total nb of records with no order and no limits $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { /* The fast and low memory method to get and count full list converts the sql into a sql count */ $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); @@ -1355,15 +1355,15 @@ $totalarray['nbfield'] = 0; // -------------------------------------------------------------------- print '
'; print $langs->trans('SupplierCode').''; print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); @@ -410,7 +410,7 @@ if ($result > 0) { // Count total nb of records $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 93ec01e0524..4d00d056a82 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1440,7 +1440,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); print_liste_field_titre("BIC"); - if (!empty($conf->prelevement->enabled)) { + if (isModEnabled('prelevement')) { print_liste_field_titre("RUM"); print_liste_field_titre("DateRUM"); print_liste_field_titre("WithdrawMode"); @@ -1530,7 +1530,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print dol_escape_htmltag($rib->bic); print ''.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).''.dol_escape_htmltag($rib->rum).''; //var_dump($src); diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index dafe53a19d8..dae56b10c53 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -456,7 +456,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { if ($result < 0) { setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } else { - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $nbtotalofrecords = $result; } } @@ -536,7 +536,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // Count total nb of records $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { + if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $nbtotalofrecords = $prodcustprice->fetchAll('', '', 0, 0, $filter); } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 4af74bdb2ce..8c467882a01 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -323,7 +323,7 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; -if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { +if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $result = $db->query($sql); $nbtotalofrecords = $db->num_rows($result); if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 79520727955..80c144f43ba 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1273,7 +1273,8 @@ if ($action == 'create') { print ''; - print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); + $filter = '(s.fournisseur:=:1)'; + print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) { print '