Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into FIX---Param-INVOICE_SHOW_SHIPPING_ADDRESS

This commit is contained in:
Anthony Berton 2023-05-04 11:03:58 +02:00
commit 3002c61aee
994 changed files with 24567 additions and 9390 deletions

View File

@ -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:

View File

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

View File

@ -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

View File

@ -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

191
ChangeLog
View File

@ -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 *****

View File

@ -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

View File

@ -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.

View File

@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=L'instal·lador DoliWamp intentarà iniciar o reini
OldVersionFoundAndMoveInNew=S'ha trobat una versió antiga de base de dades i ha estat moguda per a ser utilitzada per la nova versió de Dolibarr
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)

View File

@ -44,5 +44,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache
OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by the new Dolibarr version
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)

View File

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

View File

@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=Die DoliWamp-Installation wird nun starten oder Apa
OldVersionFoundAndMoveInNew=Eine alte Datenbankversion wurde gefunden und verschoben, um von der neuen Dolibarr-Version verwendet zu werden.
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).

View File

@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=El instalador DoliWamp intentará iniciar o reinici
OldVersionFoundAndMoveInNew=Se ha encontrado una versión antigua de base de datos y ha sido movida para ser utilizada por la nueva versión de Dolibarr
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)

View File

@ -27,12 +27,12 @@ Prerequisites to build autoexe DoliWamp package from Linux (solution seems broke
Prerequisites to build autoexe DoliWamp package from Windows:
> 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.

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -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');

View File

@ -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 '<td>'.$langs->trans("DateEnd").'</td>';
print '<td class="center">'.$langs->trans("NumberOfAccountancyEntries").'</td>';
print '<td class="center">'.$langs->trans("NumberOfAccountancyMovements").'</td>';
print '<td class="right">'.$langs->trans("Statut").'</td>';
print '<td class="right">'.$langs->trans("Status").'</td>';
print '</tr>';
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 '<tr class="oddeven">';
print '<td>';
@ -155,7 +160,7 @@ if ($result) {
print '<td class="left">'.dol_print_date($db->jdate($obj->date_end), 'day').'</td>';
print '<td class="center">'.$object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end).'</td>';
print '<td class="center">'.$object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end).'</td>';
print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->statut, 5).'</td>';
print '<td class="right">'.$fiscalyearstatic->LibStatut($obj->status, 5).'</td>';
print '</tr>';
$i++;
}

View File

@ -361,7 +361,7 @@ print '</tr>';
foreach ($list as $key) {
print '<tr class="oddeven value">';
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 '<td class="right">';
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 '<input type="text" class="maxwidth100" id="'.$key.'" name="'.$key.'" value="'.getDolGlobalString($key).'">';
}

View File

@ -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

View File

@ -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

View File

@ -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 '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#exportcsvbutton").click(function() {
jQuery("#exportcsvbutton").click(function(event) {
event.preventDefault();
console.log("Set action to export_csv");
jQuery("#action").val("export_csv");

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -559,7 +559,7 @@ llxHeader('', $title_page);
// List
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
// TODO Perf Replace this by a count
if ($type == 'sub') {
$nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);

View File

@ -466,7 +466,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " WHERE (aa.fk_accounting_category <> ".((int) $id)." OR aa.fk_accounting_category IS NULL)";
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " GROUP BY aa.account_number, aa.label";
@ -512,7 +512,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT aa.rowid, aa.account_number";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = ".((int) $conf->global->CHARTOFACCOUNTS);
$sql .= " AND asy.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'));
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = ".$conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
@ -839,7 +839,7 @@ class AccountancyCategory // extends CommonObject
exit();
}
$pcgverid = $conf->global->CHARTOFACCOUNTS;
$pcgverid = getDolGlobalInt('CHARTOFACCOUNTS');
$pcgvercode = dol_getIdFromCode($this->db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
if (empty($pcgvercode)) {
$pcgvercode = $pcgverid;

File diff suppressed because it is too large Load Diff

View File

@ -169,7 +169,7 @@ class AccountingAccount extends CommonObject
global $conf;
$this->db = $db;
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) $conf->global->CHARTOFACCOUNTS).")"; // Used to add a filter in Form::showrefnav method
$this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS')).")"; // Used to add a filter in Form::showrefnav method
}
/**
@ -198,7 +198,7 @@ class AccountingAccount extends CommonObject
$sql .= " AND a.entity = ".$conf->entity;
}
if (!empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).')';
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')';
}
if (!empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";

View File

@ -0,0 +1,276 @@
<?php
/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2019 Cedric Ancelin <icedo.anc@gmail.com>
* Copyright (C) 2023 Lionel Vessiller <lvessiller@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
/**
* API class for accountancy
*
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*
*/
class Accountancy extends DolibarrApi
{
/**
*
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
public static $FIELDS = array();
/**
* @var BookKeeping $bookkeeping {@type BookKeeping}
*/
public $bookkeeping;
/**
* @var AccountancyExport $accountancy_export {@type AccountancyExport}
*/
public $accountancyexport;
/**
* Constructor
*/
public function __construct()
{
global $db, $langs;
$this->db = $db;
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
$langs->load('accountancy');
$this->bookkeeping = new BookKeeping($this->db);
$this->accountancyexport = new AccountancyExport($this->db);
}
/**
* Accountancy export data
*
* @param string $period Period : 'lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear' or 'custom' (see above)
* @param string $date_min [=''] Start date of period if 'custom' is set in period parameter
* Date format is 'YYYY-MM-DD'
* @param string $date_max [=''] End date of period if 'custom' is set in period parameter
* Date format is 'YYYY-MM-DD'
* @param string $format [=''] by default uses '1' for 'Configurable (CSV)' for format number
* or '1000' for FEC
* or '1010' for FEC2
* (see AccountancyExport class)
* @param int $lettering [=0] by default don't export or 1 to export lettering data (columns 'letterring_code' and 'date_lettering' returns empty or not)
* @param int $alreadyexport [=0] by default export data only if it's not yet exported or 1 already exported (always export data even if 'date_export" is set)
* @param int $notnotifiedasexport [=0] by default notified as exported or 1 not notified as exported (when the export is done, notified or not the column 'date_export')
*
* @return string
*
* @url GET exportdata
*
* @throws RestException 401 Insufficient rights
* @throws RestException 404 Accountancy export period not found
* @throws RestException 404 Accountancy export start or end date not defined
* @throws RestException 404 Accountancy export format not found
* @throws RestException 500 Error on accountancy export
*/
public function exportData($period, $date_min = '', $date_max = '', $format = '', $lettering = 0, $alreadyexport = 0, $notnotifiedasexport = 0)
{
global $conf, $langs;
// check rights
if (!DolibarrApiAccess::$user->rights->accounting->mouvements->export) {
throw new RestException(401, 'No permission to export accounting');
}
// check parameters
$period_available_list = array('lastmonth', 'currentmonth', 'last3months', 'last6months', 'currentyear', 'lastyear', 'fiscalyear', 'lastfiscalyear', 'actualandlastfiscalyear', 'custom');
if (!in_array($period, $period_available_list)) {
throw new RestException(404, 'Accountancy export period not found');
}
if ($period == 'custom') {
if ($date_min == '' && $date_max == '') {
throw new RestException(404, 'Accountancy export start and end date for custom period not defined');
}
}
if ($format == '') {
$format = AccountancyExport::$EXPORT_TYPE_CONFIGURABLE; // uses default
}
// get objects
$bookkeeping = $this->bookkeeping;
$accountancyexport = $this->accountancyexport;
// find export format code from format number
$format_number_available_list = $accountancyexport->getType();
if (is_numeric($format)) {
$format_number = (int) $format;
} else {
$format_number = 0;
$format_label_available_list = array_flip($format_number_available_list);
if (isset($format_label_available_list[$format])) {
$format_number = $format_label_available_list[$format];
}
}
// get all format available and check if exists
if (!array_key_exists($format_number, $format_number_available_list)) {
throw new RestException(404, 'Accountancy export format not found');
}
$sortorder = 'ASC'; // by default
$sortfield = 't.piece_num, t.rowid'; // by default
// set filter for each period available
$filter = array();
$doc_date_start = null;
$doc_date_end= null;
$now = dol_now();
$now_arr = dol_getdate($now);
$now_month = $now_arr['mon'];
$now_year = $now_arr['year'];
if ($period == 'custom') {
if ($date_min != '') {
$time_min = strtotime($date_min);
if ($time_min !== false) {
$doc_date_start = $time_min;
}
}
if ($date_max != '') {
$time_max = strtotime($date_max);
if ($time_max !== false) {
$doc_date_end = $time_max;
}
}
} elseif ($period == 'lastmonth') {
$prev_date_arr = dol_get_prev_month($now_month, $now_year); // get previous month and year if month is january
$doc_date_start = dol_mktime(0, 0, 0, $prev_date_arr['month'], 1, $prev_date_arr['year']); // first day of previous month
$doc_date_end = dol_get_last_day($prev_date_arr['year'], $prev_date_arr['month']); // last day of previous month
} elseif ($period == 'currentmonth') {
$doc_date_start = dol_mktime(0, 0, 0, $now_month, 1, $now_year); // first day of current month
$doc_date_end = dol_get_last_day($now_year, $now_month); // last day of current month
} elseif ($period == 'last3months' || $period == 'last6months') {
if ($period == 'last3months') {
// last 3 months
$nb_prev_month = 3;
} else {
// last 6 months
$nb_prev_month = 6;
}
$prev_month_date_list = array();
$prev_month_date_list[] = dol_get_prev_month($now_month, $now_year); // get previous month for index = 0
for ($i = 1; $i < $nb_prev_month; $i++) {
$prev_month_date_list[] = dol_get_prev_month($prev_month_date_list[$i-1]['month'], $prev_month_date_list[$i-1]['year']); // get i+1 previous month for index=i
}
$doc_date_start = dol_mktime(0, 0, 0, $prev_month_date_list[$nb_prev_month-1]['month'], 1, $prev_month_date_list[$nb_prev_month-1]['year']); // first day of n previous month for index=n-1
$doc_date_end = dol_get_last_day($prev_month_date_list[0]['year'], $prev_month_date_list[0]['month']); // last day of previous month for index = 0
} elseif ($period == 'currentyear' || $period == 'lastyear') {
$period_year = $now_year;
if ($period == 'lastyear') {
$period_year--;
}
$doc_date_start = dol_mktime(0, 0, 0, 1, 1, $period_year); // first day of year
$doc_date_end = dol_mktime(23, 59, 59, 12, 31, $period_year); // last day of year
} elseif ($period == 'fiscalyear' || $period == 'lastfiscalyear' || $period == 'actualandlastfiscalyear') {
// find actual fiscal year
$cur_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf);
$cur_fiscal_date_start = $cur_fiscal_period['date_start'];
$cur_fiscal_date_end = $cur_fiscal_period['date_end'];
if ($period == 'fiscalyear') {
$doc_date_start = $cur_fiscal_date_start;
$doc_date_end = $cur_fiscal_date_end;
} else {
// get one day before current fiscal date start (to find previous fiscal period)
$prev_fiscal_date_search = dol_time_plus_duree($cur_fiscal_date_start, -1, 'd');
// find previous fiscal year from current fiscal year
$prev_fiscal_period = getCurrentPeriodOfFiscalYear($this->db, $conf, $prev_fiscal_date_search);
$prev_fiscal_date_start = $prev_fiscal_period['date_start'];
$prev_fiscal_date_end = $prev_fiscal_period['date_end'];
if ($period == 'lastfiscalyear') {
$doc_date_start = $prev_fiscal_date_start;
$doc_date_end = $prev_fiscal_date_end;
} else {
// period == 'actualandlastfiscalyear'
$doc_date_start = $prev_fiscal_date_start;
$doc_date_end = $cur_fiscal_date_end;
}
}
}
if (is_numeric($doc_date_start)) {
$filter['t.doc_date>='] = $doc_date_start;
}
if (is_numeric($doc_date_end)) {
$filter['t.doc_date<='] = $doc_date_end;
}
$result = $bookkeeping->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $alreadyexport);
if ($result < 0) {
throw new RestException(500, 'Error bookkeeping fetch all : '.$bookkeeping->errorsToString());
} else {
// export files then exit
if (empty($lettering)) {
if (is_array($bookkeeping->lines)) {
foreach ($bookkeeping->lines as $k => $movement) {
unset($bookkeeping->lines[$k]->lettering_code);
unset($bookkeeping->lines[$k]->date_lettering);
}
}
}
$error = 0;
$this->db->begin();
if (empty($notnotifiedasexport)) {
if (is_array($bookkeeping->lines)) {
foreach ($bookkeeping->lines as $movement) {
$now = dol_now();
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
$sql .= " SET date_export = '" . $this->db->idate($now) . "'";
$sql .= " WHERE rowid = " . ((int) $movement->id);
$result = $this->db->query($sql);
if (!$result) {
$accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
$error++;
break;
}
}
}
}
// export and only write file without downloading
if (!$error) {
$result = $accountancyexport->export($bookkeeping->lines, $format_number, 0, 1, 2);
if ($result < 0) {
$error++;
}
}
if ($error) {
$this->db->rollback();
throw new RestException(500, 'Error accountancy export : '.implode(',', $accountancyexport->errors));
} else {
$this->db->commit();
exit();
}
}
}
}

View File

@ -2031,7 +2031,7 @@ class BookKeeping extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$pcgver = $conf->global->CHARTOFACCOUNTS;
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab";
@ -2093,7 +2093,7 @@ class BookKeeping extends CommonObject
public function getRootAccount($account = null)
{
global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS;
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$sql = "SELECT root.rowid, root.account_number, root.label as label,";
$sql .= " parent.rowid as parent_rowid, parent.account_number as parent_account_number, parent.label as parent_label";
@ -2135,7 +2135,7 @@ class BookKeeping extends CommonObject
// phpcs:enable
global $conf;
$pcgver = $conf->global->CHARTOFACCOUNTS;
$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";

View File

@ -75,7 +75,7 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (!isModEnabled('accounting')) {
@ -96,15 +96,15 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('accounting', 'bind', 'write')) {
// Clean database by removing binding done on non existing or no more existing accounts
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
$sql1 = "UPDATE ".$db->prefix()."facturedet as fd";
$sql1 .= " SET fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
$sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture WHERE entity = '.((int) $conf->entity).')';
$sql1 .= ' AND fk_code_ventilation <> 0';
$sql1 .= ' FROM '.$db->prefix().'accounting_account as accnt';
$sql1 .= ' INNER JOIN '.$db->prefix().'accounting_system as syst';
$sql1 .= " ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS'))." AND accnt.entity = ".((int) $conf->entity).")";
$sql1 .= " AND fd.fk_facture IN (SELECT rowid FROM ".$db->prefix()."facture WHERE entity = ".((int) $conf->entity).")";
$sql1 .= " AND fk_code_ventilation <> 0";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
@ -144,23 +144,23 @@ if ($action == 'validatehistory') {
} else {
$sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
}
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " FROM ".$db->prefix()."facture as f";
$sql .= " INNER JOIN ".$db->prefix()."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
$sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; // the main table
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN ".$db->prefix()."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".$db->prefix()."facturedet as l ON f.rowid = l.fk_facture"; // the main table
$sql .= " LEFT JOIN ".$db->prefix()."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
$sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
}
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
$sql .= " AND f.entity IN (".getEntity('invoice', 0).")"; // We don't share object for accountancy

View File

@ -303,7 +303,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

View File

@ -102,7 +102,7 @@ $hookmanager->initHooks(array('accountancycustomerlist'));
$formaccounting = new FormAccounting($db);
$accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (!isModEnabled('accounting')) {
@ -359,7 +359,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

View File

@ -58,7 +58,7 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (!isModEnabled('accounting')) {
@ -85,7 +85,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->hasRight('acc
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity).')';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.((int) getDolGlobalInt('CHARTOFACCOUNTS')).' AND accnt.entity = '.((int) $conf->entity).')';
$sql1 .= ' AND erd.fk_expensereport IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'expensereport WHERE entity = '.((int) $conf->entity).')';
$sql1 .= ' AND fk_code_ventilation <> 0';
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);

View File

@ -234,7 +234,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

View File

@ -95,7 +95,7 @@ $hookmanager->initHooks(array('accountancyexpensereportlist'));
$formaccounting = new FormAccounting($db);
$accounting = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (!isModEnabled('accounting')) {
@ -283,7 +283,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

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2022 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2017-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
@ -147,8 +147,8 @@ if ($date_start && $date_end) {
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
}
// Define begin binding date
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) {
$sql .= " AND b.dateo >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'";
}
// Already in bookkeeping or not
if ($in_bookkeeping == 'already') {
@ -195,13 +195,13 @@ if ($result) {
//print $sql;
// Variables
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
$account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
$account_supplier = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); // NotDefined is a reserved word
$account_customer = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); // NotDefined is a reserved word
$account_employee = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); // NotDefined is a reserved word
$account_pay_vat = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT', 'NotDefined'); // NotDefined is a reserved word
$account_pay_donation = getDolGlobalString('DONATION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word
$account_pay_subscription = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word
$account_transfer = getDolGlobalString('ACCOUNTING_ACCOUNT_TRANSFER_CASH', 'NotDefined'); // NotDefined is a reserved word
$tabcompany = array();
$tabuser = array();
@ -912,7 +912,7 @@ if (!$error && $action == 'writebookkeeping') {
// Export
if ($action == 'exportcsv') { // ISO and not UTF8 !
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
$filename = 'journal';
$type_export = 'journal';
@ -983,13 +983,13 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
if ($tabtype[$key] == 'payment_supplier') {
print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER').'"'.$sep;
} elseif ($tabtype[$key] == 'payment') {
print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep;
} elseif ($tabtype[$key] == 'payment_expensereport') {
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep;
} elseif ($tabtype[$key] == 'payment_salary') {
print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep;
} else {
print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
}
@ -1014,8 +1014,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep;
print '"'.$val["type_payment"].'"'.$sep;
print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print '"'.length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep;
print '"'.length_accounta(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep;
print "".$sep;
print '"'.$reflabel.'"'.$sep;
print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
@ -1088,9 +1088,9 @@ if (empty($action) || $action == 'view') {
// Button to write into Ledger
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') {
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1'
|| getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') {
print ($desc ? '' : '<br>').'<div class="warning">'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
$desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}');
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>', $desc);
@ -1105,8 +1105,8 @@ if (empty($action) || $action == 'view') {
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
}
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1'
|| getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} else {
if ($in_bookkeeping == 'notyet') {

View File

@ -73,7 +73,7 @@ $year_current = $year_start;
// Validate History
$action = GETPOST('action', 'aZ09');
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (!isModEnabled('accounting')) {
@ -94,15 +94,15 @@ if (empty($user->rights->accounting->mouvements->lire)) {
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
// Clean database
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as fd";
$sql1 = "UPDATE ".$db->prefix()."facture_fourn_det as fd";
$sql1 .= " SET fk_code_ventilation = 0";
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN';
$sql1 .= ' (SELECT accnt.rowid ';
$sql1 .= ' FROM '.MAIN_DB_PREFIX.'accounting_account as accnt';
$sql1 .= ' INNER JOIN '.MAIN_DB_PREFIX.'accounting_system as syst';
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid='.$conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity.')';
$sql1 .= ' AND fd.fk_facture_fourn IN (SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE entity = '.$conf->entity.')';
$sql1 .= ' AND fk_code_ventilation <> 0';
$sql1 .= " FROM ".$db->prefix()."accounting_account as accnt";
$sql1 .= " INNER JOIN ".$db->prefix()."accounting_system as syst";
$sql1 .= " ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".getDolGlobalInt('CHARTOFACCOUNTS')." AND accnt.entity = ".((int) $conf->entity).")";
$sql1 .= " AND fd.fk_facture_fourn IN (SELECT rowid FROM ".$db->prefix()."facture_fourn WHERE entity = ".((int) $conf->entity).")";
$sql1 .= " AND fk_code_ventilation <> 0";
dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG);
$resql1 = $db->query($sql1);
@ -142,23 +142,23 @@ if ($action == 'validatehistory') {
} else {
$sql .= " s.accountancy_code_buy as company_code_buy";
}
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " FROM ".$db->prefix()."facture_fourn as f";
$sql .= " INNER JOIN ".$db->prefix()."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
$sql .= " LEFT JOIN " . $db->prefix() . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN ".$db->prefix()."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".$db->prefix()."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN ".$db->prefix()."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
$sql .= " LEFT JOIN " . $db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
}
$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe";
$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
$sql .= " AND f.entity IN (".getEntity('facture_fourn', 0).")"; // We don't share object for accountancy
@ -257,7 +257,7 @@ if ($action == 'validatehistory') {
}
if ($suggestedid > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sqlupdate = "UPDATE ".$db->prefix()."facture_fourn_det";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND product_type <= 2 AND rowid = ".((int) $facture_static_det->id);
@ -357,9 +357,9 @@ for ($i = 1; $i <= 12; $i++) {
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".$db->prefix()."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
// Define begin binding date
@ -489,9 +489,9 @@ for ($i = 1; $i <= 12; $i++) {
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".$db->prefix()."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " LEFT JOIN ".$db->prefix()."accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
// Define begin binding date
@ -525,11 +525,11 @@ if ($resql) {
}
print '</td>';
print '<td class="left">';
print '<td class="tdoverflowmax300"'.(empty($row[1]) ? '' : ' title="'.dol_escape_htmltag($row[1]).'"').'>';
if ($row[0] == 'tobind') {
print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_year='.((int) $y), $langs->transnoentitiesnoconv("ToBind"));
} else {
print $row[1];
print dol_escape_htmltag($row[1]);
}
print '</td>';
@ -583,8 +583,8 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa
$sql .= " SUM(".$db->ifsql("MONTH(ff.datef)=".$j, "ffd.total_ht", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
}
$sql .= " SUM(ffd.total_ht) as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " FROM ".$db->prefix()."facture_fourn_det as ffd";
$sql .= " LEFT JOIN ".$db->prefix()."facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
$sql .= " WHERE ff.datef >= '".$db->idate($search_date_start)."'";
$sql .= " AND ff.datef <= '".$db->idate($search_date_end)."'";
// Define begin binding date

View File

@ -308,7 +308,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

View File

@ -104,7 +104,7 @@ $hookmanager->initHooks(array('accountancysupplierlist'));
$formaccounting = new FormAccounting($db);
$accountingAccount = new AccountingAccount($db);
$chartaccountcode = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
$chartaccountcode = dol_getIdFromCode($db, getDolGlobalInt('CHARTOFACCOUNTS'), 'accounting_system', 'rowid', 'pcg_version');
// Security check
if (!isModEnabled('accounting')) {
@ -363,7 +363,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

View File

@ -19,6 +19,7 @@
*/
// $formatexportset must be defined
// $downloadMode =0 for direct download or =1 to download after writing files or =-1 not to download files
// Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) {
@ -35,7 +36,7 @@ $siren = getDolGlobalString('MAIN_INFO_SIREN');
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
if (empty($withAttachment)) {
if (empty($downloadMode)) {
header('Content-Type: text/csv');
}
@ -70,6 +71,6 @@ if (($accountancyexport->getFormatCode($formatexportset) == 'fec' || $accountanc
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
}
if (empty($withAttachment)) {
if (empty($downloadMode)) {
header('Content-Disposition: attachment;filename=' . $completefilename);
}

View File

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

View File

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

View File

@ -38,6 +38,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonpeople.class.php';
/**
@ -45,6 +46,8 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
*/
class Adherent extends CommonObject
{
use CommonPeople;
/**
* @var string ID to identify managed object
*/
@ -1247,7 +1250,7 @@ class Adherent extends CommonObject
if ($result >= 0) {
$result = $luser->setPassword($user, $this->pass, 0, 0, 1);
if ($result < 0) {
if (is_numeric($result) && $result < 0) {
$this->error = $luser->error;
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
$error++;
@ -3061,7 +3064,7 @@ class Adherent extends CommonObject
$blockingerrormsg = '';
if (empty($conf->adherent->enabled)) { // Should not happen. If module disabled, cron job should not be visible.
if (!isModEnabled('adherent')) { // Should not happen. If module disabled, cron job should not be visible.
$langs->load("agenda");
$this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0;
@ -3303,7 +3306,7 @@ class Adherent extends CommonObject
*/
public function getKanbanView($option = '', $arraydata = null)
{
global $selected;
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';

View File

@ -996,6 +996,8 @@ class AdherentType extends CommonObject
{
global $langs, $user;
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '<div class="box-flex-item box-flex-grow-zero">';
$return .= '<div class="info-box info-box-sm">';
$return .= '<span class="info-box-icon bg-infobox-action">';
@ -1004,7 +1006,6 @@ class AdherentType extends CommonObject
$return .= '<div class="info-box-content">';
$return .= '<span class="info-box-ref">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).'</span>';
//$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
//$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
if ($user->rights->adherent->configurer) {

View File

@ -222,7 +222,7 @@ class Members extends DolibarrApi
}
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent AS t LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call
if ($category > 0) {
$sql .= ", ".MAIN_DB_PREFIX."categorie_member as c";
}

View File

@ -97,7 +97,7 @@ class MembersTypes extends DolibarrApi
}
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type AS t LEFT JOIN ".MAIN_DB_PREFIX."adherent_type_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
$sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Add sql filters

View File

@ -500,7 +500,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);
@ -720,7 +720,7 @@ if (!empty($moreforfilter)) {
}
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields
if ($massactionbutton) {
$selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
}
@ -1068,7 +1068,7 @@ while ($i < $imaxinloop) {
$memberstatic->type = $membertypestatic->label;
$memberstatic->photo = $obj->photo;
// Output Kanban
print $memberstatic->getKanbanView('');
print $memberstatic->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == (min($num, $limit) - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -287,7 +287,7 @@ if (count($arrayjs) && $mode == 'memberbycountry') {
print "\tvar container = document.getElementById('".$mode."');\n";
print "\tvar geomap = new google.visualization.GeoMap(container);\n";
print "\tgeomap.draw(data, options);\n";
print "};\n";
print "}\n";
print "</script>\n";
// print the div tag that will contain the map

View File

@ -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 '</div>';
print '</td></tr>';

View File

@ -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 '</div>';
print '</td></tr>';
@ -456,12 +457,12 @@ if ($action == 'create') {
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
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 '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
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 '</td></tr>';
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&token='.newToken().'&typeid='.$object->id.($morphy ? '&morphy='.urlencode($morphy) : '').'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?rowid='.$object->id).'">'.$langs->trans("AddMember").'</a></div>';
} else {
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoAddMember")).'">'.$langs->trans("AddMember").'</a></div>';
}
@ -581,9 +591,9 @@ if ($rowid > 0) {
$now = dol_now();
$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 '</td>';
}
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre left">';
print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'"></td>';
@ -761,6 +780,7 @@ if ($rowid > 0) {
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
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 '<tr class="oddeven">';
// Actions
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
@ -798,6 +824,12 @@ if ($rowid > 0) {
}
print "</td>";
}
// Ref
print "<td>";
print $adh->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print "</td>\n";
// Lastname
if ($objp->company != '') {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'</a></td>'."\n";
@ -871,10 +903,6 @@ if ($rowid > 0) {
print "</table>\n";
print '</div>';
print '</form>';
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 '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
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 "</td></tr>";
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, empty($conf->fckeditor->enabled) ? false : $conf->fckeditor->enabled, 15, '90%');
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, isModEnabled('fckeditor'), 15, '90%');
$doleditor->Create();
print "</td></tr>";

View File

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

View File

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

View File

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

View File

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

View File

@ -383,7 +383,12 @@ if (!is_array($result) && $result < 0) {
print '</td>';
}
print '<td></td>';
// Multicompany
print '<td>';
if (isModEnabled('multicompany')) {
print dol_escape_htmltag($defaultvalue->entity);
}
print '</td>';
// Actions
print '<td class="center">';

View File

@ -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 '<td colspan="3" class="center">';
if ($action != 'edit') {
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">';
print '<input type="submit" class="button button-add small" name="actionadd" value="'.$langs->trans("Add").'">';
} else {
print '<input type="submit" class="button button-add small disabled" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
@ -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), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '<div class="clearboth"></div>';
}
$filterfound = 0;
foreach ($fieldlist as $field => $value) {
if ($value == 'entity') {
continue;
}
$showfield = 1; // By default
if ($value == 'region_id' || $value == 'country_id') {
$showfield = 0;
}
if ($showfield) {
if ($value == 'country') {
$filterfound++;
} elseif ($value == 'code') {
$filterfound++;
}
}
}
print '<div class="div-table-responsive">';
print '<table class="noborder centpercent">';
// Title line with search input fields
print '<!-- line title to search record -->'."\n";
print '<tr class="liste_titre_filter">';
$filterfound = 0;
// Action button
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
$colspan++;
}
$colspan = 0;
foreach ($fieldlist as $field => $value) {
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 '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
print '</td>';
$filterfound++;
$colspan++;
} elseif ($value == 'code') {
print '<td class="liste_titre">';
print '<input type="text" class="maxwidth100" name="search_code" value="'.dol_escape_htmltag($search_code).'">';
print '</td>';
$filterfound++;
$colspan++;
} else {
print '<td class="liste_titre">';
print '</td>';
$colspan++;
}
}
}
if ($id == 4) {
print '<td></td>';
$colspan++;
print '<td></td>';
$colspan++;
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre right" colspan="2">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
$colspan++;
// Action button
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center">';
if ($filterfound) {
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
print '</td>';
$colspan++;
}
print '</td>';
print '</tr>';
// Title of lines
print '<!-- line title of record -->'."\n";
print '<tr class="liste_titre">';
// 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 '</tr>';
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 '<tr class="oddeven" id="rowid-'.(empty($obj->rowid) ? '' : $obj->rowid).'">';
// Action button
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center maxwidthsearch nowraponall">';
// Modify link
if ($canbemodified) {
print '<a class="reposition editfielda marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
}
// Delete link
if ($iserasable) {
if ($user->admin) {
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
}
print '</td>';
}
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
$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 "</td>";
// Modify link
if ($canbemodified) {
print '<td align="center"><a class="reposition editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
} else {
print '<td>&nbsp;</td>';
}
// Delete link
if ($iserasable) {
print '<td class="center">';
if ($user->admin) {
print '<a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
// Action button
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center maxwidthsearch">';
// Modify link
if ($canbemodified) {
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright editfielda" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a>';
}
// Delete link
if ($iserasable) {
if ($user->admin) {
print '<a class="reposition marginleftonly paddingleft marginrightonly paddingright" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a>';
}
}
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>';
} else {
print '<td>&nbsp;</td>';
}
print "</tr>\n";
}
$i++;
}
} else {
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
}
print '</table>';
@ -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 '<td>';
$fieldname = 'country';
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
$selected = (!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : ''));
if (!GETPOSTISSET('code')) {
$selected = GETPOST('countryidforinsert');
}
print $form->select_country($selected, $value, '', 28, 'minwidth100 maxwidth150 maxwidthonsmartphone');
print '</td>';
} elseif ($value == 'country_id') {
if (!in_array('country', $fieldlist)) { // If there is already a field country, we don't show country_id (avoid duplicate)

View File

@ -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 = '';

View File

@ -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 '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -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 '<input id="" class="button button-save" name="save" value="'.$langs->trans("Save").'" type="submit" />';
echo '<input class="button button-cancel" value="'.$langs->trans("Cancel").'" onclick="javascript:history.go(-1)" type="button" />';
echo '<input class="button button-cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" type="button" />';
} else {
echo '<a class="editfielda marginrightonly paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?action=edit&token='.newToken().'&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
if (!empty($range->ik->id)) {

View File

@ -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')),

View File

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

View File

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

View File

@ -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

View File

@ -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'=>'<span class="small">'.$helpsubstit.'</span>',
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'content'=>'<span class="small">'.$helpsubstit.'</span>',
'content_lines'=>'<span class="small">'.$helpsubstitforlines.'</span>',
'type_template'=>$langs->trans("TemplateForElement"),
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
'position'=>$langs->trans("PositionIntoComboList")
'position'=>$langs->trans("PositionIntoComboList"),
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
'defaultfortype'=>$langs->trans("DefaultForTypeDesc"),
'content'=>'<span class="small">'.$helpsubstit.'</span>',
'content_lines'=>'<span class="small">'.$helpsubstitforlines.'</span>'
);
@ -214,10 +215,10 @@ if (isModEnabled('ficheinter')) {
if (isModEnabled('supplier_proposal')) {
$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 = '&nbsp;';
}
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 '<th class="'.$align.'">';
print '<th class="'.$css.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) {
@ -793,19 +797,19 @@ if ($action == 'create') {
fieldList($fieldlist, $obj, $tabname[$id], 'add');
}
}
// Action column
print '<td class="right">';
print '</td>';
print "</tr>";
print '<tr class="impair nodrag nodrop nohover"><td colspan="9" class="nobottom">';
// 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 '<tr class="impair nodrag nodrop nohover"><td colspan="8" class="nobottom">';
// Topic of email
if ($tmpfieldlist == 'topic') {
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
@ -830,13 +834,14 @@ if ($action == 'create') {
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$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 '</td>';
print '</tr>';
print '<br>';
}
print '</tr>';
print '</table>';
if ($action != 'edit') {
@ -870,7 +875,7 @@ print '<table class="noborder centpercent">';
$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 '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center" width="64">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
foreach ($fieldlist as $field => $value) {
if ($value == 'module') {
print '<td class="liste_titre"><input type="text" name="search_module" class="maxwidth75" value="'.dol_escape_htmltag($search_module).'"></td>';
@ -935,23 +946,29 @@ foreach ($fieldlist as $field => $value) {
print '<td class="liste_titre"></td>';
}
}
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
/*if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
print '<td class="liste_titre"></td>';
}
}*/
// Status
print '<td></td>';
// Action column
print '<td class="liste_titre right" width="64">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="liste_titre center" width="64">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
}
print '</tr>';
// Title of lines
print '<tr class="liste_titre">';
// 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 '</tr>';
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 '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
}
// Show main fields
if (empty($reshook)) {
fieldList($fieldlist, $obj, $tabname[$id], 'edit');
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
}
print "</tr>\n";
print '<td></td><td></td><td></td>';
print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
print '<tr class="oddeven nohover'.(in_array($tmpfieldlist, array('topic', 'joinfiles')) ? ' nobottom' : '').'" id="tr-'.$tmpfieldlist.'-'.$rowid.'">';
print '<td colspan="10">';
$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 '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
print '<td colspan="9">';
if ($tmpfieldlist == 'topic') {
print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
print '<br>'."\n";
}
if ($tmpfieldlist == 'joinfiles') {
print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1);
print '<br>'."\n";
}
if ($tmpfieldlist == 'content') {
@ -1085,6 +1122,7 @@ if ($num) {
print $doleditor->Create(1);
}
if ($tmpfieldlist == 'content_lines') {
print '<br>'."\n";
print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
$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 '</td>';
print '<td></td>';
print '<td></td>';
}
}
print '</td>';
print '<td></td>';
print '<td></td>';
print "</tr>\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 '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
// Action column - Modify link / Delete link
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall" width="64">';
if ($canbemodified) {
print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
}
if ($iserasable) {
print '<a class="marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
}
print '</td>';
}
$tmpaction = 'view';
$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 '<td class="center nowrap">';
if ($canbedisabled) {
@ -1229,16 +1280,18 @@ if ($num) {
}
print "</td>";
// Modify link / Delete link
print '<td class="center nowraponall" width="64">';
if ($canbemodified) {
print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
// Action column - Modify link / Delete link
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print '<td class="center nowraponall" width="64">';
if ($canbemodified) {
print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
}
if ($iserasable) {
print '<a class="marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
}
print '</td>';
}
if ($iserasable) {
print '<a class="marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
}
print '</td>';
print "</tr>\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 '<td></td>';
} elseif ($value == 'fk_user') {
@ -1343,11 +1397,11 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
}
print '</td>';
} elseif ($context == 'add' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue;
//print '<td></td>';
} elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue;
print '<td></td>';
} elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) {
continue;
//print '<td></td>';
} 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 '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
@ -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 '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$value}) ? $obj->{$value}:'').'" name="'. $value .'">';
print '<input type="text" '.$size.'class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->$value) ? $obj->$value : '').'" name="'. $value .'">';
}
print '</td>';
}

View File

@ -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 .= '<br><strong>'.$langs->trans("DependsOn").':</strong> ';
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 .= '<span class="opacitymedium">'.$langs->trans("None").'</span>';
}
$text .= '<br>';
$text .= '<br><strong>'.$langs->trans("RequiredBy").':</strong> ';
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 .= '<span class="opacitymedium">'.$langs->trans("None").'</span>';
}

View File

@ -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 = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>';
$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'));

View File

@ -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 '</tr>';
print '</form>';
// Main currency
print '<tr class="oddeven">';
print '<td>'.$conf->currency;
print ' ('.$langs->getCurrencySymbol($conf->currency).')';
print $form->textwithpicto(' ', $langs->trans("BaseCurrency")).'</td>';
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 '</td>';
print '<td class="right">1</td>';
print '</tr>';
@ -332,7 +346,11 @@ foreach ($TCurrency as &$currency) {
}
print '<tr class="oddeven">';
print '<td>'.$currency->code.' - '.$currency->name.'</td>';
print '<td>'.$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 '</td>';
print '<td class="right">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

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

View File

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

View File

@ -310,7 +310,7 @@ $found = 0;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if ($conf->use_javascript_ajax) {
if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
@ -332,7 +332,7 @@ $found++;
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if (isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
if ($conf->use_javascript_ajax) {
if ($disabled) {
print img_picto($langs->trans("Disabled"), 'off', 'class="opacitymedium"');
@ -381,7 +381,7 @@ if (isModEnabled("reception")) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td class="right">';
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
if (isModEnabled("supplier_order")) {
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 0, 2, 1, '', '', 'reposition');
} else {

View File

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

View File

@ -173,7 +173,7 @@ print '<br>';
print '<strong>'.$langs->trans("XDebug").'</strong>: ';
$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").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php">XDebug admin page</a>';
@ -480,30 +480,57 @@ print load_fiche_titre($langs->trans("Modules"), '', 'folder');
// Module log
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
$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").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
}
print '<br>';
print '<br>';
// Module debugbar
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
$test = empty($conf->debugbar->enabled);
if ($test) {
print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled").' - '.$langs->trans("NotRiskOfLeakWithThis");
$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").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
}
print '<br>';
print '<br>';
// Modules for Payments
$test = isModEnabled('stripe');
if ($test) {
print '<strong>'.$langs->trans("Stripe").'</strong>: ';
if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
} else {
print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Stripe"));
}
print '<br>';
} else {
$test = isModEnabled('paypal');
if ($test) {
print '<strong>'.$langs->trans("Paypal").'</strong>: ';
if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
print img_picto('', 'error').' '.$langs->trans("OptionXShouldBeEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
} else {
print img_picto('', 'tick').' '.$langs->trans("OptionXIsCorrectlyEnabledInModuleY", $langs->transnoentities("SecurityTokenIsUnique"), $langs->transnoentities("Paypal"));
}
print '<br>';
}
}
// APIs

View File

@ -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'
),

View File

@ -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')
{

View File

@ -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

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2023 Romain Neil <contact@romain-neil.fr>
*
* This program is free software you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -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);

View File

@ -544,7 +544,7 @@ if ($action == 'edit') {
print '<datalist id="pcg_type_datalist">';
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 '</td></tr>';
}

View File

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

View File

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

View File

@ -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);

View File

@ -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);

View File

@ -188,7 +188,7 @@ if (!empty($number)) {
} else {
$txt = "Call Asterisk dialer for caller: ".$caller.", called: ".$called." clicktodiallogin: ".$login;
dol_syslog($txt);
print '<body onload="javascript:history.go(-1);">'."\n";
print '<body onload="history.go(-1);">'."\n";
print '<!-- '.$txt.' -->';
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");

View File

@ -550,7 +550,10 @@ if (is_array($blocks)) {
print '</td>';
// Link to source object
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
print '<td class="tdoverflowmax150"'.(preg_match('/<a/', $object_link) ? '' : 'title="'.dol_escape_htmltag(dol_string_nohtmltag($object_link)).'"').'>';
print '<!-- object_link -->'; // $object_link can be a '<a href' link or a text
print $object_link;
print '</td>';
// Amount
print '<td class="right nowraponall">'.price($block->amounts).'</td>';

View File

@ -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');

View File

@ -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 '<div class="box-flex-container kanban">';
}
// Output kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -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

View File

@ -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

View File

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

View File

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

View File

@ -311,7 +311,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
// 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);
@ -641,7 +641,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -311,7 +311,7 @@ $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPri
// 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);
@ -641,7 +641,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container kanban">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -54,6 +54,12 @@ class Bookmark extends CommonObject
*/
public $db;
/**
* Last error code on a local method
* @var int Error number
*/
public $errno;
/**
* @var int ID
*/

View File

@ -172,7 +172,7 @@ if (!$user->admin) {
// 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);
@ -350,7 +350,7 @@ while ($i < $imaxinloop) {
print '<div class="box-flex-container">';
}
// Output Kanban
print $object->getKanbanView('');
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
if ($i == ($imaxinloop - 1)) {
print '</div>';
print '</td></tr>';

View File

@ -141,7 +141,7 @@ class Categories extends DolibarrApi
}
$sql = "SELECT t.rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie as t";
$sql .= " FROM ".MAIN_DB_PREFIX."categorie AS t LEFT JOIN ".MAIN_DB_PREFIX."categories_extrafields AS ef ON (ef.fk_object = t.rowid)"; // Modification VMR Global Solutions to include extrafields as search parameters in the API GET call, so we will be able to filter on extrafields
$sql .= ' WHERE t.entity IN ('.getEntity('category').')';
if (!empty($type)) {
$sql .= ' AND t.type='.array_search($type, Categories::$TYPES);

View File

@ -864,7 +864,12 @@ class Categorie extends CommonObject
$sql .= ", ".MAIN_DB_PREFIX.(empty($this->MAP_OBJ_TABLE[$type]) ? $type : $this->MAP_OBJ_TABLE[$type])." as o";
$sql .= " WHERE o.entity IN (".getEntity($obj->element).")";
$sql .= " AND c.fk_categorie = ".((int) $this->id);
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid";
// Compatibility with actioncomm table which has id instead of rowid
if ($this->MAP_OBJ_TABLE[$type] == "actioncomm" || $type == "actioncomm") {
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.id";
} else {
$sql .= " AND c.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = o.rowid";
}
// Protection for external users
if (($type == 'customer' || $type == 'supplier') && $user->socid > 0) {
$sql .= " AND o.rowid = ".((int) $user->socid);
@ -978,7 +983,7 @@ class Categorie extends CommonObject
$offset = 0;
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
$result = $this->db->query($sql);
$nbtotalofrecords = $this->db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0

View File

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

View File

@ -2101,8 +2101,6 @@ class ActionComm extends CommonObject
dol_syslog(get_class($this)."::build_exportfile select events", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
// Note: Output of sql request is encoded in $conf->file->character_set_client
// This assignment in condition is not a bug. It allows walking the results.
$diff = 0;
while ($obj = $this->db->fetch_object($resql)) {
$qualified = true;

View File

@ -134,7 +134,7 @@ class AgendaEvents extends DolibarrApi
$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."actioncomm as t";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm AS t LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields AS ef ON (ef.fk_object = t.id)"; // 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 (isModEnabled("societe")) {
if ((!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

View File

@ -570,7 +570,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);

View File

@ -101,7 +101,7 @@ $sql .= " GROUP BY year, month, df";
$sql .= " ORDER BY year DESC, month DESC, df DESC";
$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

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