diff --git a/COPYRIGHT b/COPYRIGHT index d43f4d506f1..adf7d38c04b 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -39,7 +39,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes JS libraries: Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea. -ChartJS 2.9.3 MIT License Yes JS library for graph +ChartJS 2.9.4 MIT License Yes JS library for graph jQuery 3.5.1 MIT License Yes JS library jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css diff --git a/ChangeLog b/ChangeLog index 2d0fd358c2b..782528daae8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -31,7 +31,7 @@ NEW: add column payment term into list of supplier invoices NEW: add column quantity in product margin page NEW: add column vat rate in page to define accounting account on product/service NEW: add costprice in fields of products list -NEW: added an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE +NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE NEW: add employee link in expense report binding page NEW: add EORI No. as ProfID5 NEW: add export for various payments @@ -181,10 +181,9 @@ NEW: #15065 Add option to put the product label in bold in the PDF templates if For developers: --------------- NEW: add __MEMBER_TYPE__ substitution key +NEW: add __TYPE__ substitution key NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) -NEW: API get contacts list of a given order -NEW: API endpoint getContacts and Clean results NEW: Add some fields to link website page to an other object NEW: fill ECM src object fields in dol_add_file_process NEW: conf to allow to show the full tree in warehouse popup @@ -194,10 +193,6 @@ NEW: can add event to log into blockedlog module with a constant NEW: add property cssview when declaring fields of an object NEW: Can use dynamic code into the 'enabled' property of DAO fields NEW: allow to edit "demand reason" field though API -NEW: API can update a payment -NEW: API get member by thirdparty -NEW: API get thirdparty by barcode -NEW: API get users by email / login NEW: fetch contact by email with REST API NEW: field ref_ext in llx_commandedet NEW: fields ref_ext for Attributes and Combinations @@ -213,9 +208,17 @@ NEW: Triggers Attributes and Attributes values NEW: added incoterms data into the substitution array NEW: add send context for ticket NEW: add a message in error_log after detection of SQL or script injection -NEW: add __TYPE__ substitution key NEW: add validation of MX domain for emails NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) +NEW: Graphics can be horizontal bars + +APIs +NEW: API get contacts list of a given order +NEW: API endpoint getContacts and Clean results +NEW: API can update a payment +NEW: API get member by thirdparty +NEW: API get thirdparty by barcode +NEW: API get users by email / login HOOKs NEW: Hook on propal card @@ -242,7 +245,7 @@ Following changes may create regressions for some external modules, but were nec * The API addPayment for api_invoice has evolved to accept amount into a foreign currency. You must provide array(amount=>X,mutlicurrency_ammount=>Y) instead of simple amount. * The method select_thirdparty(), deprecated since 3.8, into html.form.class.php has been removed. * Depreciate all methods with name ->valide(). Use instead methods ->validate(). - +* Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used. ***** ChangeLog for 12.0.3 compared to 12.0.2 ***** @@ -379,8 +382,8 @@ FIX: SQL Problem in customer invoice list FIX: SQL Problem in social contribution list FIX: SQL Problem in supplier invoice list FIX: SQL syntax error when editing extrafields -FIX: Sql type -FIX: takepos 12 hook +FIX: SQL type +FIX: TakePOS 12 hook FIX: Update form erased extrafields that were hidden FIX: Update of extrafields date FIX: Update of extrafiels on draft object @@ -394,7 +397,7 @@ For users: NEW: Module MO (Manufacturing Order) is available as stable module. NEW: Receipt printer module moved from 'development' to 'experimental' -NEW: Add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists. +NEW: add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists NEW: add numbering module for TakePOS module NEW: 2 new options when creating an invoice from time spent on a project : by period or by task NEW: Accountancy add column thirdparty on binding page @@ -405,19 +408,19 @@ NEW: Accountancy - Add possibility to manage a short alternative label for accou NEW: Accountancy - General ledger - Add an option to search not reconciled lines NEW: Add accountancy code of thirdparty in contact and supplier export NEW: support webp image format -NEW: Add checkbox "overwrite if exists" into ECM/DMS module +NEW: add checkbox "overwrite if exists" into ECM/DMS module NEW: add a link to notes in members list NEW: add a parameter to group same products in TakePOS NEW: add a parameter to sort product by label in TakePOS -NEW: Add a profil to import contact categories -NEW: Add company extrafields into order export +NEW: add a profil to import contact categories +NEW: add company extrafields into order export NEW: add const CASHDESK_FORCE_DECREASE_STOCK to force batch decrementation NEW: add const TAKEPOS_NUMPAD_USE_PAYMENT_ICON to use icons on payment buttons NEW: add csv separator setup in module admin NEW: add dedicated substitutions keys for extrafields of type date and datetime NEW: add default warehouse for dispatch -NEW: Add due date in feature "Export accounting documents" -NEW: Add duration information for fichinter +NEW: add due date in feature "Export accounting documents" +NEW: add duration information for fichinter NEW: Start support of Dark theme into ELDY theme NEW: Add field author public alias for blog post on website module NEW: Add "finished" field on product list diff --git a/SECURITY.md b/SECURITY.md index 56e1da679ed..77307516f73 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,8 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM ## Reporting a Vulnerability -To report a vulnerability, please send an email to security@dolibarr.org -In most cases, after fixing the security, we make an answer by email to say the issue has been fixed. +To report a vulnerability, please use GitHub security advisory (alternatively send an email to security@dolibarr.org) ## Hunting vulnerabilities on Dolibarr diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 314aaff7177..17a935f6234 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -581,23 +581,36 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`; + # Removed other test files $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`; + + # Removed files installed by the awful composer $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball for official debian, not for the rest - + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/composer`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/doctrine`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/docs`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/.github`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/docs`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/samples`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`; @@ -612,21 +625,17 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; - + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`; - - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`; } # Build package for each target diff --git a/composer.json b/composer.json index 9fede994525..a943fbe0aa3 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "nnnick/chartjs" : "^2.9", "stripe/stripe-php" : "6.43.1", "maximebf/debugbar" : "1.15.1", - "symfony/var-dumper": "3" + "symfony/var-dumper" : "3" }, "require-dev" : { "php-parallel-lint/php-parallel-lint" : "^0", diff --git a/composer.lock b/composer.lock index 5afe0ca34f2..e0462435f5e 100644 --- a/composer.lock +++ b/composer.lock @@ -6,6 +6,53 @@ ], "content-hash": "1dbd2d05cc0836acfca5988f29005cf2", "packages": [ + { + "name": "Psr/log", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", + "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2020-03-23T09:12:05+00:00" + }, { "name": "ckeditor/ckeditor", "version": "4.12.1", @@ -217,16 +264,16 @@ }, { "name": "nnnick/chartjs", - "version": "v2.9.3", + "version": "v2.9.4", "source": { "type": "git", "url": "https://github.com/chartjs/Chart.js.git", - "reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2" + "reference": "9bd4cf82fda9f50a5fb50b72843e06ab88124278" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/chartjs/Chart.js/zipball/06f73dc3590084b2c464bf08189c7aee2b6b92d2", - "reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2", + "url": "https://api.github.com/repos/chartjs/Chart.js/zipball/9bd4cf82fda9f50a5fb50b72843e06ab88124278", + "reference": "9bd4cf82fda9f50a5fb50b72843e06ab88124278", "shasum": "" }, "require": { @@ -254,7 +301,11 @@ "JS", "chart" ], - "time": "2019-11-14T18:37:30+00:00" + "support": { + "issues": "https://github.com/chartjs/Chart.js/issues", + "source": "https://github.com/chartjs/Chart.js/tree/v2.9.4" + }, + "time": "2020-10-19T12:22:11+00:00" }, { "name": "phpoffice/phpexcel", @@ -314,53 +365,6 @@ "abandoned": "phpoffice/phpspreadsheet", "time": "2015-05-01T07:00:55+00:00" }, - { - "name": "psr/log", - "version": "1.1.3", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc", - "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2020-03-23T09:12:05+00:00" - }, { "name": "restler/framework", "version": "3.0.0-RC6", @@ -2037,159 +2041,6 @@ ], "time": "2019-08-06T08:03:45+00:00" }, - { - "name": "symfony/polyfill-php72", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "639447d008615574653fb3bc60d1986d7172eaae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae", - "reference": "639447d008615574653fb3bc60d1986d7172eaae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.18.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981", - "shasum": "" - }, - "require": { - "php": ">=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.18-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-07-14T12:35:20+00:00" - }, { "name": "symfony/yaml", "version": "v3.4.32", @@ -2312,5 +2163,5 @@ "ext-curl": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/dev/examples/zapier/package.json b/dev/examples/zapier/package.json index 5b5827b22b2..4266a6f00b1 100644 --- a/dev/examples/zapier/package.json +++ b/dev/examples/zapier/package.json @@ -15,7 +15,7 @@ "npm": ">=5.6.0" }, "dependencies": { - "zapier-platform-core": "10.1.1" + "zapier-platform-core": "10.1.2" }, "devDependencies": { "mocha": "^5.2.0", diff --git a/dev/translation/erp_comparison_translation.txt b/dev/translation/erp_comparison_translation.txt deleted file mode 100644 index 6cf7c4f7c60..00000000000 --- a/dev/translation/erp_comparison_translation.txt +++ /dev/null @@ -1,25 +0,0 @@ -comparison of terms - - -Dolibarr SAP ERP Odoo -------------------------------------------------------------------------- -Thirdparty Contact partner Partner/Contact (company) -Contact/address Contact person Partner/Contact (individual) - -Financial Finance (FI) Accounting -Accounting - - -Income / Expense ?? Profit / Loss -Balance ?? Net profit -Subledger account Subledger account ?? - -CRM Sales & Distribution Sales -Proposal ?? Quotation - - - -Proposal is ok but proposition looks better (proposal is for a detailed proposition). -We can say also "business proposition or business proposal". -In India they are using "Quotation". - diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index b250459bdce..d0f43cfe3dd 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2017 Florian Henry * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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 @@ -128,8 +128,7 @@ if ($action == "confirm_update") { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - if ($mode != '_tmp') - { + if ($mode != '_tmp') { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } @@ -165,14 +164,14 @@ if ($action == "confirm_update") { $object->label_operation = $label_operation; $object->debit = $debit; $object->credit = $credit; - $object->doc_date = GETPOST('doc_date', 'alpha'); - $object->doc_type = GETPOST('doc_type', 'alpha'); + $object->doc_date = (string) GETPOST('doc_date', 'alpha'); + $object->doc_type = (string) GETPOST('doc_type', 'alpha'); $object->piece_num = $piece_num; - $object->doc_ref = GETPOST('doc_ref', 'alpha'); + $object->doc_ref = (string) GETPOST('doc_ref', 'alpha'); $object->code_journal = $journal_code; $object->journal_label = $journal_label; - $object->fk_doc = (int) GETPOST('fk_doc', 'int'); - $object->fk_docdet = (int) GETPOST('fk_docdet', 'int'); + $object->fk_doc = GETPOSTINT('fk_doc'); + $object->fk_docdet = GETPOSTINT('fk_docdet'); if (floatval($debit) != 0.0) { $object->montant = $debit; // deprecated @@ -190,8 +189,7 @@ if ($action == "confirm_update") { if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } else { - if ($mode != '_tmp') - { + if ($mode != '_tmp') { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index c002abf2a89..a76be081471 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -37,7 +37,7 @@ class AccountingJournal extends CommonObject public $table_element = 'accounting_journal'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Fieldname with ID of parent key if this field has a parent */ public $fk_element = ''; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 20010cc8f5c..834af1ff06a 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2020 Laurent Destailleur * Copyright (C) 2016-2019 Alexandre Spangaro * Copyright (C) 2019 Frédéric France * @@ -103,13 +103,19 @@ if ($conf->accounting->enabled) // STEPS $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'', $s); + print $s; print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'', $s); + print $s; print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'', $s); + print $s; print "
\n"; print "
\n"; @@ -118,60 +124,45 @@ if ($conf->accounting->enabled) print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $s); + print $s; print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n"; + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'', $s); + print $s; print "
\n"; $step++; $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}'); + $s = str_replace('{s}', $textlink, $s); + print $s; print "
\n"; if (!empty($conf->tax->enabled)) { $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}'); + $s = str_replace('{s}', $textlink, $s); + print $s; print "
\n"; } - /*if (! empty($conf->salaries->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, ''.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - // htdocs/admin/salaries.php - print "
\n"; - print "
\n"; - }*/ if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'', $s); + print $s; print "
\n"; } - /* - if (! empty($conf->loan->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, ''.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").' '.$langs->transnoentitiesnoconv("or").' '.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->don->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - } - if (! empty($conf->adherents->enabled)) - { - $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); - print "
\n"; - }*/ $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'', $s); + print $s; print "
\n"; @@ -188,26 +179,34 @@ if ($conf->accounting->enabled) $langs->loadLangs(array('bills', 'trips')); $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'')."\n"; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n"; + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'', $s); + print $s; print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'')."\n"; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n"; + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'', $s); + print $s; print "
\n"; if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."\n"; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n"; + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'', $s); + print $s; print "
\n"; } $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; + print $s; print "
\n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."
\n"; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."
\n"; + print $s; print "
\n"; print '
'; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 0acb4e0bedd..d353041234f 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -7,7 +7,7 @@ * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2017-2018 Frédéric France + * Copyright (C) 2017-2020 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Eric Seigne * @@ -73,15 +73,18 @@ $date_endmonth = GETPOST('date_endmonth', 'int'); $date_endday = GETPOST('date_endday', 'int'); $date_endyear = GETPOST('date_endyear', 'int'); $in_bookkeeping = GETPOST('in_bookkeeping', 'aZ09'); -if ($in_bookkeeping == '') $in_bookkeeping = 'notyet'; +if ($in_bookkeeping == '') { + $in_bookkeeping = 'notyet'; +} $now = dol_now(); $action = GETPOST('action', 'aZ09'); // Security check -if ($user->socid > 0 && empty($id_journal)) +if ($user->socid > 0 && empty($id_journal)) { accessforbidden(); +} /* @@ -93,8 +96,7 @@ $error = 0; $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); -if (empty($date_startmonth) || empty($date_endmonth)) -{ +if (empty($date_startmonth) || empty($date_endmonth)) { // Period by default on transfer $dates = getDefaultDatesForTransfer(); $date_start = $dates['date_start']; @@ -103,8 +105,7 @@ if (empty($date_startmonth) || empty($date_endmonth)) $pastmonth = $dates['pastmonth']; } -if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form -{ +if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); } @@ -124,19 +125,18 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid"; $sql .= " WHERE ba.fk_accountancy_journal=".$id_journal; $sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy -if ($date_start && $date_end) +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)."'"; } // Already in bookkeeping or not -if ($in_bookkeeping == 'already') -{ +if ($in_bookkeeping == 'already') { $sql .= " AND (b.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )"; } -if ($in_bookkeeping == 'notyet') -{ +if ($in_bookkeeping == 'notyet') { $sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )"; } $sql .= " ORDER BY b.datev"; @@ -177,9 +177,9 @@ 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_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 @@ -198,23 +198,28 @@ if ($result) { // one line for bank record = tabbq // one line for thirdparty record = tabtp $i = 0; - while ($i < $num) - { + while ($i < $num) { $obj = $db->fetch_object($result); $lineisapurchase = -1; $lineisasale = -1; // Old method to detect if it's a sale or purchase - if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 1; - if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale = 1; - // Try a more reliable method to detect if record is a supplier payment or a customer payment - if ($lineisapurchase < 0) - { - if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1; + if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') { + $lineisapurchase = 1; } - if ($lineisasale < 0) - { - if ($obj->typeop_payment == 'payment') $lineisasale = 1; + if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') { + $lineisasale = 1; + } + // Try a more reliable method to detect if record is a supplier payment or a customer payment + if ($lineisapurchase < 0) { + if ($obj->typeop_payment_supplier == 'payment_supplier') { + $lineisapurchase = 1; + } + } + if ($lineisasale < 0) { + if ($obj->typeop_payment == 'payment') { + $lineisasale = 1; + } } //var_dump($obj->type_payment); var_dump($obj->type_payment_supplier); //var_dump($lineisapurchase); //var_dump($lineisasale); @@ -224,28 +229,30 @@ if ($result) { // Set accountancy code for thirdparty (example: '411CU...' or '411' if no subledger account defined on customer) $compta_soc = 'NotDefined'; - if ($lineisapurchase > 0) + if ($lineisapurchase > 0) { $compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier); - if ($lineisasale > 0) + } + if ($lineisasale > 0) { $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer); + } $tabcompany[$obj->rowid] = array( - 'id' => $obj->socid, - 'name' => $obj->name, - 'code_compta' => $compta_soc, - 'email' => $obj->email + 'id' => $obj->socid, + 'name' => $obj->name, + 'code_compta' => $compta_soc, + 'email' => $obj->email ); // Set accountancy code for user $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : ''); $tabuser[$obj->rowid] = array( - 'id' => $obj->userid, - 'name' => dolGetFirstLastname($obj->firstname, $obj->lastname), - 'lastname' => $obj->lastname, - 'firstname' => $obj->firstname, - 'email' => $obj->useremail, - 'accountancy_code' => $compta_user + 'id' => $obj->userid, + 'name' => dolGetFirstLastname($obj->firstname, $obj->lastname), + 'lastname' => $obj->lastname, + 'firstname' => $obj->firstname, + 'email' => $obj->useremail, + 'accountancy_code' => $compta_user ); // Variable bookkeeping ($obj->rowid is Bank Id) @@ -264,10 +271,6 @@ if ($result) { // Load of url links to the line into llx_bank $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) - //var_dump($i); - //var_dump($tabpay); - //var_dump($tabcompany); - // By default $tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url. $tabtype[$obj->rowid] = 'unknown'; @@ -277,17 +280,14 @@ if ($result) { if (is_array($links) && count($links) > 0) { // Now loop on each link of record in bank. foreach ($links as $key => $val) { - if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) - { + if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) { // So we excluded 'company' and 'user' here. We want only payment lines // We save tabtype for a future use, to remember what kind of payment it is $tabpay[$obj->rowid]['type'] = $links[$key]['type']; $tabtype[$obj->rowid] = $links[$key]['type']; - } elseif (in_array($links[$key]['type'], array('company', 'user'))) - { - if ($tabpay[$obj->rowid]['type'] == 'unknown') - { + } elseif (in_array($links[$key]['type'], array('company', 'user'))) { + if ($tabpay[$obj->rowid]['type'] == 'unknown') { // We can guess here it is a bank record for a thirdparty company or a user. // But we won't be able to record somewhere else than into a waiting account, because there is no other journal to record the contreparty. } @@ -312,16 +312,23 @@ if ($result) { $societestatic->name = $links[$key]['label']; $societestatic->email = $tabcompany[$obj->rowid]['email']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); - if ($compta_soc) $tabtp[$obj->rowid][$compta_soc] += $obj->amount; + if ($compta_soc) { + $tabtp[$obj->rowid][$compta_soc] += $obj->amount; + } } elseif ($links[$key]['type'] == 'user') { $userstatic->id = $links[$key]['url_id']; $userstatic->name = $links[$key]['label']; $userstatic->email = $tabuser[$obj->rowid]['email']; $userstatic->firstname = $tabuser[$obj->rowid]['firstname']; $userstatic->lastname = $tabuser[$obj->rowid]['lastname']; - if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); - else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. - if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount; + if ($userstatic->id > 0) { + $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); + } else { + $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. + } + if ($compta_user) { + $tabtp[$obj->rowid][$compta_user] += $obj->amount; + } } elseif ($links[$key]['type'] == 'sc') { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; @@ -329,8 +336,9 @@ if ($result) { $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); $reg = array(); if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { - if ($reg[1] == 'socialcontribution') + if ($reg[1] == 'socialcontribution') { $reg[1] = 'SocialContribution'; + } $chargestatic->label = $langs->trans($reg[1]); } else { $chargestatic->label = $links[$key]['label']; @@ -430,20 +438,17 @@ if ($result) { // If no links were found to know the amount on thirdparty, we try to guess it. // This may happens on bank entries without the links lines to 'company'. - if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record - { + if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) { // If we dont find 'company' link because it is an old 'withdraw' record foreach ($links as $key => $val) { if ($links[$key]['type'] == 'payment') { // Get thirdparty $tmppayment->fetch($links[$key]['url_id']); $arrayofamounts = $tmppayment->getAmountsArray(); if (is_array($arrayofamounts)) { - foreach ($arrayofamounts as $invoiceid => $amount) - { + foreach ($arrayofamounts as $invoiceid => $amount) { $tmpinvoice->fetch($invoiceid); $tmpinvoice->fetch_thirdparty(); - if ($tmpinvoice->thirdparty->code_compta) - { + if ($tmpinvoice->thirdparty->code_compta) { $tabtp[$obj->rowid][$tmpinvoice->thirdparty->code_compta] += $amount; } } @@ -453,7 +458,9 @@ if ($result) { } // If no links were found to know the amount on thirdparty, we init it to account 'NotDefined'. - if (empty($tabtp[$obj->rowid])) $tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank]; + if (empty($tabtp[$obj->rowid])) { + $tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank]; + } // Check account number is ok /*if ($action == 'writebookkeeping') // Make test now in such a case @@ -494,8 +501,7 @@ if (!$error && $action == 'writebookkeeping') { $now = dol_now(); $error = 0; - foreach ($tabpay as $key => $val) // $key is rowid into llx_bank - { + foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank $date = dol_print_date($db->jdate($val["date"]), 'day'); $ref = getSourceDocRef($val, $tabtype[$key]); @@ -513,17 +519,18 @@ if (!$error && $action == 'writebookkeeping') { var_dump($tabbq);exit;*/ // Bank - if (!$errorforline && is_array($tabbq[$key])) - { + if (!$errorforline && is_array($tabbq[$key])) { // Line into bank account - foreach ($tabbq[$key] as $k => $mt) - { - if ($mt) - { + foreach ($tabbq[$key] as $k => $mt) { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + if (!empty($val['lib'])) { + $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + } $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); - if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); + if (!empty($val['soclib'])) { + $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); + } $bookkeeping = new BookKeeping($db); $bookkeeping->doc_date = $val["date"]; @@ -556,8 +563,7 @@ if (!$error && $action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists $error++; $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); @@ -572,18 +578,16 @@ if (!$error && $action == 'writebookkeeping') { } // Third party - if (!$errorforline) - { - if (is_array($tabtp[$key])) - { + if (!$errorforline) { + if (is_array($tabtp[$key])) { // Line into thirdparty account foreach ($tabtp[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); - if ($tabtype[$key] == 'banktransfert') - { + if (!empty($val['lib'])) { + $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); + } + if ($tabtype[$key] == 'banktransfert') { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); } else { $reflabel .= dol_string_nohtmltag($val['soclib']); @@ -683,8 +687,7 @@ if (!$error && $action == 'writebookkeeping') { $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; } else { - if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty. - { + if ($tabtype[$key] == 'unknown') { // Unknown transaction, we will use a waiting account for thirdparty. // Temporary account $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; @@ -702,8 +705,7 @@ if (!$error && $action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists $error++; $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); @@ -717,10 +719,11 @@ if (!$error && $action == 'writebookkeeping') { } } else { // If thirdparty unknown, output the waiting account foreach ($tabbq[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + if (!empty($val['lib'])) { + $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + } $reflabel .= dol_string_nohtmltag('WaitingAccount'); $bookkeeping = new BookKeeping($db); @@ -747,8 +750,7 @@ if (!$error && $action == 'writebookkeeping') { $result = $bookkeeping->create($user); if ($result < 0) { - if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists - { + if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists $error++; $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); @@ -763,23 +765,20 @@ if (!$error && $action == 'writebookkeeping') { } } - if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) - { + if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) { $error++; $errorforline++; setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors'); } - if (!$errorforline) - { + if (!$errorforline) { $db->commit(); } else { //print 'KO for line '.$key.' '.$error.'
'; $db->rollback(); $MAXNBERRORS = 5; - if ($error >= $MAXNBERRORS) - { + if ($error >= $MAXNBERRORS) { setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors'); break; // Break in the foreach } @@ -788,8 +787,7 @@ if (!$error && $action == 'writebookkeeping') { if (empty($error) && count($tabpay) > 0) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); - } elseif (count($tabpay) == $error) - { + } elseif (count($tabpay) == $error) { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); } else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); @@ -798,8 +796,7 @@ if (!$error && $action == 'writebookkeeping') { $action = ''; // Must reload data, so we make a redirect - if (count($tabpay) != $error) - { + if (count($tabpay) != $error) { $param = 'id_journal='.$id_journal; $param .= '&date_startday='.$date_startday; $param .= '&date_startmonth='.$date_startmonth; @@ -837,20 +834,22 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep; print "\n"; - foreach ($tabpay as $key => $val) - { + foreach ($tabpay as $key => $val) { $date = dol_print_date($db->jdate($val["date"]), 'day'); $ref = getSourceDocRef($val, $tabtype[$key]); // Bank foreach ($tabbq[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + if (!empty($val['lib'])) { + $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + } $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']); - if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); + if (!empty($val['soclib'])) { + $reflabel .= " - ".dol_string_nohtmltag($val['soclib']); + } print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; @@ -870,12 +869,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! // Third party if (is_array($tabtp[$key])) { foreach ($tabtp[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); - if ($tabtype[$key] == 'banktransfert') - { + if (!empty($val['lib'])) { + $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); + } + if ($tabtype[$key] == 'banktransfert') { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); } else { $reflabel .= dol_string_nohtmltag($val['soclib']); @@ -907,10 +906,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! } } else { // If thirdparty unkown, output the waiting account foreach ($tabbq[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + if (!empty($val['lib'])) { + $reflabel .= dol_string_nohtmltag($val['lib'])." - "; + } $reflabel .= dol_string_nohtmltag('WaitingAccount'); print '"'.$key.'"'.$sep; @@ -967,16 +967,18 @@ if (empty($action) || $action == 'view') { // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) $sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE entity = '.$conf->entity.' AND fk_accountancy_journal IS NULL AND clos=0'; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $obj = $db->fetch_object($resql); - if ($obj->nb > 0) - { + if ($obj->nb > 0) { print '
'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); - print ' : '.$langs->trans("AccountancyAreaDescBank", 9, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").''); + $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 9, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'', $desc); + print $desc; print '
'; } - } else dol_print_error($db); + } else { + dol_print_error($db); + } // Button to write into Ledger @@ -990,14 +992,19 @@ if (empty($action) || $action == 'view') { print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') { + print ''; + } if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; } else { - if ($in_bookkeeping == 'notyet') print ''; - else print ''.$langs->trans("WriteBookKeeping").''; + if ($in_bookkeeping == 'notyet') { + print ''; + } else { + print ''.$langs->trans("WriteBookKeeping").''; + } } print '
'; @@ -1040,21 +1047,22 @@ if (empty($action) || $action == 'view') { $r = ''; - foreach ($tabpay as $key => $val) // $key is rowid in llx_bank - { + foreach ($tabpay as $key => $val) { // $key is rowid in llx_bank $date = dol_print_date($db->jdate($val["date"]), 'day'); $ref = getSourceDocRef($val, $tabtype[$key]); // Bank - foreach ($tabbq[$key] as $k => $mt) - { - if ($mt) - { + foreach ($tabbq[$key] as $k => $mt) { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= $val['lib']." - "; + if (!empty($val['lib'])) { + $reflabel .= $val['lib']." - "; + } $reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref']; - if (!empty($val['soclib'])) $reflabel .= " - ".$val['soclib']; + if (!empty($val['soclib'])) { + $reflabel .= " - ".$val['soclib']; + } //var_dump($tabpay[$key]); print ''; @@ -1064,10 +1072,11 @@ if (empty($action) || $action == 'view') { // Ledger account print ""; $accounttoshow = length_accountg($k); - if (empty($accounttoshow) || $accounttoshow == 'NotDefined') - { + if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { print ''.$langs->trans("BankAccountNotDefined").''; - } else print $accounttoshow; + } else { + print $accounttoshow; + } print ""; // Subledger account print ""; @@ -1091,12 +1100,12 @@ if (empty($action) || $action == 'view') { // Third party if (is_array($tabtp[$key])) { foreach ($tabtp[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : ""); - if ($tabtype[$key] == 'banktransfert') - { + if (!empty($val['lib'])) { + $reflabel .= $val['lib'].($val['soclib'] ? " - " : ""); + } + if ($tabtype[$key] == 'banktransfert') { $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; } else { $reflabel .= $val['soclib']; @@ -1110,21 +1119,32 @@ if (empty($action) || $action == 'view') { print ""; $account_ledger = $k; // Try to force general ledger account depending on type - if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; - if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; - if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; - if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; - if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; - if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"]; + if ($tabtype[$key] == 'payment') { + $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; + } + if ($tabtype[$key] == 'payment_supplier') { + $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; + } + if ($tabtype[$key] == 'payment_expensereport') { + $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + } + if ($tabtype[$key] == 'payment_salary') { + $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + } + if ($tabtype[$key] == 'payment_vat') { + $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; + } + if ($tabtype[$key] == 'member') { + $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; + } + if ($tabtype[$key] == 'payment_various') { + $account_ledger = $tabpay[$key]["account_various"]; + } $accounttoshow = length_accountg($account_ledger); - if (empty($accounttoshow) || $accounttoshow == 'NotDefined') - { - if ($tabtype[$key] == 'unknown') - { + if (empty($accounttoshow) || $accounttoshow == 'NotDefined') { + if ($tabtype[$key] == 'unknown') { // We will accept writing, but into a waiting account - if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') - { + if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') { print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; } else { print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account @@ -1132,32 +1152,42 @@ if (empty($action) || $action == 'view') { } else { // We will refuse writing $errorstring = 'UnknownAccountForThirdpartyBlocking'; - if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined'; - if ($tabtype[$key] == 'payment_supplier') $errorstring = 'MainAccountForSuppliersNotDefined'; - if ($tabtype[$key] == 'payment_expensereport') $errorstring = 'MainAccountForUsersNotDefined'; - if ($tabtype[$key] == 'payment_salary') $errorstring = 'MainAccountForUsersNotDefined'; - if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined'; - if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; + if ($tabtype[$key] == 'payment') { + $errorstring = 'MainAccountForCustomersNotDefined'; + } + if ($tabtype[$key] == 'payment_supplier') { + $errorstring = 'MainAccountForSuppliersNotDefined'; + } + if ($tabtype[$key] == 'payment_expensereport') { + $errorstring = 'MainAccountForUsersNotDefined'; + } + if ($tabtype[$key] == 'payment_salary') { + $errorstring = 'MainAccountForUsersNotDefined'; + } + if ($tabtype[$key] == 'payment_vat') { + $errorstring = 'MainAccountForVatPaymentNotDefined'; + } + if ($tabtype[$key] == 'member') { + $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; + } print ''.$langs->trans($errorstring).''; } - } else print $accounttoshow; + } else { + print $accounttoshow; + } print ""; // Subledger account print ""; - if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) // Type of payment with subledger - { + if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) { // Type of payment with subledger $accounttoshowsubledger = length_accounta($k); - if ($accounttoshow != $accounttoshowsubledger) - { - if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') - { + if ($accounttoshow != $accounttoshowsubledger) { + if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') { /*var_dump($tabpay[$key]); var_dump($tabtype[$key]); var_dump($tabbq[$key]);*/ //print ''.$langs->trans("ThirdpartyAccountNotDefined").''; - if (!empty($tabcompany[$key]['code_compta'])) - { + if (!empty($tabcompany[$key]['code_compta'])) { if (in_array($tabtype[$key], array('payment_various'))) { // For such case, if subledger is not defined, we won't use subledger accounts. print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; @@ -1167,7 +1197,9 @@ if (empty($action) || $action == 'view') { } else { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; } - } else print $accounttoshowsubledger; + } else { + print $accounttoshowsubledger; + } } } print ""; @@ -1180,10 +1212,11 @@ if (empty($action) || $action == 'view') { } } else { // Waiting account foreach ($tabbq[$key] as $k => $mt) { - if ($mt) - { + if ($mt) { $reflabel = ''; - if (!empty($val['lib'])) $reflabel .= $val['lib']." - "; + if (!empty($val['lib'])) { + $reflabel .= $val['lib']." - "; + } $reflabel .= 'WaitingAccount'; print ''; @@ -1267,78 +1300,67 @@ function getSourceDocRef($val, $typerecord) } $sqlmid = ''; - if ($typerecord == 'payment') - { + if ($typerecord == 'payment') { $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"]; $ref = $langs->transnoentitiesnoconv("Invoice"); - } elseif ($typerecord == 'payment_supplier') - { + } elseif ($typerecord == 'payment_supplier') { $sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f"; $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"]; $ref = $langs->transnoentitiesnoconv("SupplierInvoice"); - } elseif ($typerecord == 'payment_expensereport') - { + } elseif ($typerecord == 'payment_expensereport') { $sqlmid = 'SELECT e.rowid as id, e.ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e"; $sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid"; $ref = $langs->transnoentitiesnoconv("ExpenseReport"); - } elseif ($typerecord == 'payment_salary') - { + } elseif ($typerecord == 'payment_salary') { $sqlmid = 'SELECT s.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sqlmid .= " WHERE s.rowid=".$val["paymentsalid"]; $ref = $langs->transnoentitiesnoconv("SalaryPayment"); - } elseif ($typerecord == 'sc') - { + } elseif ($typerecord == 'sc') { $sqlmid = 'SELECT sc.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc"; $sqlmid .= " WHERE sc.rowid=".$val["paymentscid"]; $ref = $langs->transnoentitiesnoconv("SocialContribution"); - } elseif ($typerecord == 'payment_vat') - { + } elseif ($typerecord == 'payment_vat') { $sqlmid = 'SELECT v.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v"; $sqlmid .= " WHERE v.rowid=".$val["paymentvatid"]; $ref = $langs->transnoentitiesnoconv("PaymentVat"); - } elseif ($typerecord == 'payment_donation') - { + } elseif ($typerecord == 'payment_donation') { $sqlmid = 'SELECT payd.fk_donation as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd"; $sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"]; $ref = $langs->transnoentitiesnoconv("Donation"); - } elseif ($typerecord == 'payment_loan') - { + } elseif ($typerecord == 'payment_loan') { $sqlmid = 'SELECT l.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l"; $sqlmid .= " WHERE l.rowid=".$val["paymentloanid"]; $ref = $langs->transnoentitiesnoconv("LoanPayment"); - } elseif ($typerecord == 'payment_various') - { + } elseif ($typerecord == 'payment_various') { $sqlmid = 'SELECT v.rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v"; $sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"]; $ref = $langs->transnoentitiesnoconv("VariousPayment"); } // Add warning - if (empty($sqlmid)) - { + if (empty($sqlmid)) { dol_syslog("Found a typerecord=".$typerecord." not supported", LOG_WARNING); } - if ($sqlmid) - { + if ($sqlmid) { dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); - if ($resultmid) - { - while ($objmid = $db->fetch_object($resultmid)) - { + if ($resultmid) { + while ($objmid = $db->fetch_object($resultmid)) { $ref .= ' '.$objmid->ref; } - } else dol_print_error($db); + } else { + dol_print_error($db); + } } $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300 diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0e57b274258..5df6db52f3d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -103,6 +103,7 @@ class Adherent extends CommonObject * @var int Thirdparty ID */ public $fk_soc; + public $socid; /** * @var string Address @@ -1262,14 +1263,15 @@ class Adherent extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member"; $sql .= " WHERE d.fk_adherent_type = t.rowid"; - if ($rowid) - $sql .= " AND d.rowid=".$rowid; - elseif ($ref || $fk_soc) { + if ($rowid) { + $sql .= " AND d.rowid=".((int) $rowid); + } elseif ($ref || $fk_soc) { $sql .= " AND d.entity IN (".getEntity('adherent').")"; - if ($ref) + if ($ref) { $sql .= " AND d.rowid='".$this->db->escape($ref)."'"; - elseif ($fk_soc > 0) - $sql .= " AND d.fk_soc=".$fk_soc; + } elseif ($fk_soc > 0) { + $sql .= " AND d.fk_soc=".((int) $fk_soc); + } } elseif ($ref_ext) { $sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'"; } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 2ffbf15d7ce..c1f77f4995e 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -292,7 +292,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print $form->textwithpicto('', $htmltooltip, 1, 0); print ''; print ''; - print ''.img_object($langs->trans("Preview"), 'order').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; print ''; print "\n"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 88babe27385..d21ffdb1630 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -391,7 +391,7 @@ foreach ($dirmodels as $reldir) { // Preview print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'bill').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 19ca39c21f3..34c3af89c53 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'bill').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 4fc1ad28da7..63c3350fd9d 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -31,7 +31,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'boxes', 'accountancy')); -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} $rowid = GETPOST('rowid', 'int'); $action = GETPOST('action', 'aZ09'); @@ -46,8 +48,7 @@ $boxes = array(); * Actions */ -if ($action == 'addconst') -{ +if ($action == 'addconst') { dolibarr_set_const($db, "MAIN_BOXES_MAXLINES", $_POST["MAIN_BOXES_MAXLINES"], '', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"], 'chaine', 0, '', $conf->entity); } @@ -59,8 +60,7 @@ if ($action == 'add') { $db->begin(); if (is_array($boxids)) { foreach ($boxids as $boxid) { - if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=... - { + if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) { // 0=Home, 1=... $pos = $boxid['pos']; // Initialize distinct fk_user with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") @@ -72,12 +72,10 @@ if ($action == 'add') { $sql .= " AND entity = ".$conf->entity; dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $num = $db->num_rows($resql); $i = 0; - while ($i < $num) - { + while ($i < $num) { $obj = $db->fetch_object($resql); $distinctfkuser[$obj->fk_user] = $obj->fk_user; $i++; @@ -90,26 +88,28 @@ if ($action == 'add') { $distinctfkuser['0'] = '0'; // Add entry for fk_user = 0. We must use string as key and val - foreach ($distinctfkuser as $fk_user) - { - if (!$error && $fk_user != '') - { + foreach ($distinctfkuser as $fk_user) { + if (!$error && $fk_user != '') { $arrayofexistingboxid = array(); $nbboxonleft = $nbboxonright = 0; $sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes"; $sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; dol_syslog("boxes.php activate box", LOG_DEBUG); $resql = $db->query($sql); - if ($resql) - { - while ($obj = $db->fetch_object($resql)) - { + if ($resql) { + while ($obj = $db->fetch_object($resql)) { $boxorder = $obj->box_order; - if (preg_match('/A/', $boxorder)) $nbboxonleft++; - if (preg_match('/B/', $boxorder)) $nbboxonright++; + if (preg_match('/A/', $boxorder)) { + $nbboxonleft++; + } + if (preg_match('/B/', $boxorder)) { + $nbboxonright++; + } $arrayofexistingboxid[$obj->box_id] = 1; } - } else dol_print_error($db); + } else { + dol_print_error($db); + } if (empty($arrayofexistingboxid[$boxid['value']])) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; @@ -120,8 +120,7 @@ if ($action == 'add') { dol_syslog("boxes.php activate box", LOG_DEBUG); $resql = $db->query($sql); - if (!$resql) - { + if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); $error++; } @@ -133,8 +132,7 @@ if ($action == 'add') { } } } - if (!$error) - { + if (!$error) { $db->commit(); $action = ''; } else { @@ -142,15 +140,13 @@ if ($action == 'add') { } } -if ($action == 'delete') -{ +if ($action == 'delete') { $sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes"; $sql .= " WHERE rowid=".((int) $rowid); $resql = $db->query($sql); $obj = $db->fetch_object($resql); - if (!empty($obj->box_id)) - { + if (!empty($obj->box_id)) { $db->begin(); // Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes) @@ -168,8 +164,7 @@ if ($action == 'delete') } } -if ($action == 'switch') -{ +if ($action == 'switch') { // We switch values of field box_order for the 2 lines of table boxes $db->begin(); @@ -181,12 +176,10 @@ if ($action == 'switch') $resultupdatefrom = 0; $resultupdateto = 0; - if (is_object($objfrom) && is_object($objto)) - { + if (is_object($objfrom) && is_object($objto)) { $newfirst = $objto->box_order; $newsecond = $objfrom->box_order; - if ($newfirst == $newsecond) - { + if ($newfirst == $newsecond) { $newsecondchar = preg_replace('/[0-9]+/', '', $newsecond); $newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond); $newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1); @@ -194,16 +187,19 @@ if ($action == 'switch') $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid); dol_syslog($sql); $resultupdatefrom = $db->query($sql); - if (!$resultupdatefrom) { dol_print_error($db); } + if (!$resultupdatefrom) { + dol_print_error($db); + } $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newsecond)."' WHERE rowid=".((int) $objto->rowid); dol_syslog($sql); $resultupdateto = $db->query($sql); - if (!$resultupdateto) { dol_print_error($db); } + if (!$resultupdateto) { + dol_print_error($db); + } } - if ($resultupdatefrom && $resultupdateto) - { + if ($resultupdatefrom && $resultupdateto) { $db->commit(); } else { $db->rollback(); @@ -240,33 +236,31 @@ $sql .= " ORDER by b.position, b.box_order"; dol_syslog("Search available boxes", LOG_DEBUG); $resql = $db->query($sql); -if ($resql) -{ +if ($resql) { $num = $db->num_rows($resql); // Check record to know if we must recalculate sort order $i = 0; $decalage = 0; - while ($i < $num) - { + while ($i < $num) { $obj = $db->fetch_object($resql); $boxes[$obj->position][$obj->box_id] = 1; $i++; array_push($actives, $obj->box_id); - if ($obj->box_order == '' || $obj->box_order == '0' || $decalage) $decalage++; + if ($obj->box_order == '' || $obj->box_order == '0' || $decalage) { + $decalage++; + } // We renumber the order of the boxes if one of them is in '' // This occurs just after an insert. - if ($decalage) - { + if ($decalage) { $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($decalage)."' WHERE rowid=".$obj->rowid; $db->query($sql); } } - if ($decalage) - { + if ($decalage) { // If we have renumbered, we correct the field box_order // This occurs just after an insert. $sql = "SELECT box_order"; @@ -276,32 +270,24 @@ if ($resql) dol_syslog("Execute requests to renumber box order", LOG_DEBUG); $result = $db->query($sql); - if ($result) - { - while ($record = $db->fetch_array($result)) - { - if (dol_strlen($record['box_order']) == 1) - { - if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) - { + if ($result) { + while ($record = $db->fetch_array($result)) { + if (dol_strlen($record['box_order']) == 1) { + if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) { $box_order = "A0".$record['box_order']; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'"; $resql = $db->query($sql); - } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) - { + } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) { $box_order = "B0".$record['box_order']; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'"; $resql = $db->query($sql); } - } elseif (dol_strlen($record['box_order']) == 2) - { - if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) - { + } elseif (dol_strlen($record['box_order']) == 2) { + if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) { $box_order = "A".$record['box_order']; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'"; $resql = $db->query($sql); - } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) - { + } elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) { $box_order = "B".$record['box_order']; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'"; $resql = $db->query($sql); @@ -336,10 +322,8 @@ print ''.$langs->trans("SourceFile").''; print ''.$langs->trans("ActivateOn").''; print "\n"; -foreach ($boxtoadd as $box) -{ - if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) - { +foreach ($boxtoadd as $box) { + if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) { $logo = $box->boximg; } else { $logo = preg_replace("/^object_/i", "", $box->boximg); @@ -348,14 +332,17 @@ foreach ($boxtoadd as $box) print "\n".''."\n"; print ''."\n"; print ''.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel); - if (!empty($box->class) && preg_match('/graph_/', $box->class)) print ' ('.$langs->trans("Graph").')'; + if (!empty($box->class) && preg_match('/graph_/', $box->class)) { + print ' ('.$langs->trans("Graph").')'; + } print ''."\n"; print ''; - if ($box->note == '(WarningUsingThisBoxSlowDown)') - { + if ($box->note == '(WarningUsingThisBoxSlowDown)') { $langs->load("errors"); print $langs->trans("WarningUsingThisBoxSlowDown"); - } else print ($box->note ? $box->note : ' '); + } else { + print ($box->note ? $box->note : ' '); + } print ''."\n"; print ''.$box->sourcefile.''."\n"; @@ -367,8 +354,7 @@ foreach ($boxtoadd as $box) print ''."\n"; } -if (!count($boxtoadd) && count($boxactivated)) -{ +if (!count($boxtoadd) && count($boxactivated)) { print ''.$langs->trans("AllWidgetsWereEnabled").''; } print ''."\n"; @@ -398,10 +384,8 @@ print ''."\n"; $box_order = 1; $foundrupture = 1; -foreach ($boxactivated as $key => $box) -{ - if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) - { +foreach ($boxactivated as $key => $box) { + if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) { $logo = $box->boximg; } else { $logo = preg_replace("/^object_/i", "", $box->boximg); @@ -410,14 +394,17 @@ foreach ($boxactivated as $key => $box) print "\n".''."\n"; print ''; print ''.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel); - if (!empty($box->class) && preg_match('/graph_/', $box->class)) print ' ('.$langs->trans("Graph").')'; + if (!empty($box->class) && preg_match('/graph_/', $box->class)) { + print ' ('.$langs->trans("Graph").')'; + } print ''; print ''; - if ($box->note == '(WarningUsingThisBoxSlowDown)') - { + if ($box->note == '(WarningUsingThisBoxSlowDown)') { $langs->load("errors"); print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown"); - } else print ($box->note ? $box->note : ' '); + } else { + print ($box->note ? $box->note : ' '); + } print ''; print ''.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).''; $hasnext = ($key < (count($boxactivated) - 1)); @@ -446,6 +433,7 @@ print load_fiche_titre($langs->trans("Other"), '', ''); print '
'; print ''; print ''; +print '
'; print ''; print ''; @@ -471,6 +459,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVA } print '
'; +print '
'; print '
'; print '
'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index daf015f68eb..25a220e8e2d 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -484,7 +484,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'bill').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 75dcb9b179f..51d7f84aae7 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -728,7 +728,7 @@ if ($mysoc->useLocalTax(1)) print '
'; $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."\n" : ""); - print ""; + print '"; if (!isOnlyOneLocalTax(1)) { print '
: '; @@ -751,9 +751,9 @@ if ($mysoc->useLocalTax(1)) } else { if (empty($mysoc->country_code)) { - print ''.$countrynotdefined.''; + print ''.$countrynotdefined.''; } else { - print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).''; + print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).''; } } @@ -773,7 +773,7 @@ if ($mysoc->useLocalTax(2)) print "global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).""; print ''; print '
'; - print ""; + print '"; $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."\n" : ""); if (!isOnlyOneLocalTax(2)) @@ -797,9 +797,9 @@ if ($mysoc->useLocalTax(2)) } else { if (empty($mysoc->country_code)) { - print ''.$countrynotdefined.''; + print ''.$countrynotdefined.''; } else { - print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).''; + print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).''; } } @@ -825,9 +825,9 @@ if ($mysoc->useRevenueStamp()) } else { if (empty($mysoc->country_code)) { - print ''.$countrynotdefined.''; + print ''.$countrynotdefined.''; } else { - print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).''; + print ''.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).''; } } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 517a547cea6..b5e4c0ddf45 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'contract').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 3707c395437..b1606268205 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'sending').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3048625cd5f..d06f8a2ce31 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -682,7 +682,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) { // 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'))) continue; // For some pages, country is not mandatory - if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory + if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory // Discard check of mandatory fiedls for other fields if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index fd3361515fb..9e8b957d541 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -223,21 +223,6 @@ $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électro llxHeader('', 'EmailCollector', $help_url); -// Example : Adding jquery code -print ''; - // Part to create if ($action == 'create') { print load_fiche_titre($langs->trans("NewEmailCollector", $langs->transnoentitiesnoconv("EmailCollector"))); @@ -433,6 +418,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!$connection) { $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; + $morehtml .= '
'.imap_last_error(); + //var_dump(imap_errors()) } else { $morehtml .= imap_num_msg($connection); } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 9e65af2d06c..9a09c62b818 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 8ffd4ab58c0..a93f5c3c608 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'intervention').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 7da8044ee07..00dcb7c3180 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -549,7 +549,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'bill').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 3d9e23cf61c..e3178d946a0 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -467,7 +467,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'intervention').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 9a3845ace5b..eca8319d661 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -426,7 +426,7 @@ foreach ($dirmodels as $reldir) print ''; if ($module->type == 'pdf') { - print ''.img_object($langs->trans("Preview"), 'contract').''; + print ''.img_object($langs->trans("Preview"), 'pdf').''; } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 43c4cc84776..34da6f7d34e 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -100,9 +100,12 @@ if ($action == 'update') $form = new Form($db); -llxHeader(); +$title = $langs->trans("LimitsSetup"); +$help_url = ''; -print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup'); +llxHeader('', $title, $help_url); + +print load_fiche_titre($title, '', 'title_setup'); $aCurrencies = array($conf->currency); // Default currency always first position @@ -125,7 +128,8 @@ if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY if (!empty($aCurrencies) && count($aCurrencies) > 1) { $head = multicurrencyLimitPrepareHead($aCurrencies); - print dol_get_fiche_head($head, $currencycode, '', -1, "multicurrency"); + + print dol_get_fiche_head($head, $currencycode, '', -1, ''); } } @@ -172,6 +176,7 @@ if ($action == 'edit') print ''; print '
'; } else { + print '
'; print ''; print ''; @@ -191,6 +196,7 @@ if ($action == 'edit') print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'
'; + print '
'; print '
'; print ''.$langs->trans("Modify").''; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index de98c42b35a..6538d5c3011 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1074,7 +1074,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; if ($context == 'edit' && !empty($obj->{$fieldlist[$field]}) && !in_array($obj->{$fieldlist[$field]}, array_keys($elementList))) { - // Current tempalte type is an unknown type, so we must keep it as it is. + // Current template type is an unknown type, so we must keep it as it is. print ''; print $obj->{$fieldlist[$field]}; } else { diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index d7e0962239b..e9984316394 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -28,7 +28,9 @@ * \brief Page to activate/disable all modules */ -if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +if (!defined('CSRFCHECK_WITH_TOKEN')) { + define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET +} require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -41,7 +43,9 @@ require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php'; $langs->loadLangs(array("errors", "admin", "modulebuilder")); $mode = GETPOSTISSET('mode') ? GETPOST('mode', 'alpha') : (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : 'common'); -if (empty($mode)) $mode = 'common'; +if (empty($mode)) { + $mode = 'common'; +} $action = GETPOST('action', 'aZ09'); //var_dump($_POST);exit; $value = GETPOST('value', 'alpha'); @@ -62,8 +66,9 @@ $options['search'] = GETPOST('search_keyword', 'alpha'); $dolistore = new Dolistore(false); -if (!$user->admin) +if (!$user->admin) { accessforbidden(); +} $familyinfo = array( 'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")), @@ -81,12 +86,19 @@ $familyinfo = array( ); $param = ''; -if (!GETPOST('buttonreset', 'alpha')) -{ - if ($search_keyword) $param .= '&search_keyword='.urlencode($search_keyword); - if ($search_status && $search_status != '-1') $param .= '&search_status='.urlencode($search_status); - if ($search_nature && $search_nature != '-1') $param .= '&search_nature='.urlencode($search_nature); - if ($search_version && $search_version != '-1') $param .= '&search_version='.urlencode($search_version); +if (!GETPOST('buttonreset', 'alpha')) { + if ($search_keyword) { + $param .= '&search_keyword='.urlencode($search_keyword); + } + if ($search_status && $search_status != '-1') { + $param .= '&search_status='.urlencode($search_status); + } + if ($search_nature && $search_nature != '-1') { + $param .= '&search_nature='.urlencode($search_nature); + } + if ($search_version && $search_version != '-1') { + $param .= '&search_version='.urlencode($search_version); + } } $dirins = DOL_DOCUMENT_ROOT.'/custom'; @@ -104,18 +116,18 @@ $formconfirm = ''; $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks -if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} -if (GETPOST('buttonreset', 'alpha')) -{ +if (GETPOST('buttonreset', 'alpha')) { $search_keyword = ''; $search_status = ''; $search_nature = ''; $search_version = ''; } -if ($action == 'install') -{ +if ($action == 'install') { $error = 0; // $original_file should match format module_modulename-x.y[.z].zip @@ -123,54 +135,45 @@ if ($action == 'install') $original_file = preg_replace('/\(\d+\)\.zip$/i', '.zip', $original_file); $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file; - if (!$original_file) - { + if (!$original_file) { $langs->load("Error"); setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings'); $error++; } else { - if (!$error && !preg_match('/\.zip$/i', $original_file)) - { + if (!$error && !preg_match('/\.zip$/i', $original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors'); $error++; } - if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) - { + if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors'); $error++; } - if (empty($_FILES['fileinstall']['tmp_name'])) - { + if (empty($_FILES['fileinstall']['tmp_name'])) { $langs->load("errors"); setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); $error++; } } - if (!$error) - { - if ($original_file) - { + if (!$error) { + if ($original_file) { @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file); dol_mkdir($conf->admin->dir_temp.'/'.$original_file); } $tmpdir = preg_replace('/\.zip$/i', '', $original_file).'.dir'; - if ($tmpdir) - { + if ($tmpdir) { @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir); dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir); } $result = dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']); - if ($result > 0) - { + if ($result > 0) { $result = dol_uncompress($newfile, $conf->admin->dir_temp.'/'.$tmpdir); - if (!empty($result['error'])) - { + if (!empty($result['error'])) { $langs->load("errors"); setEventMessages($langs->trans($result['error'], $original_file), null, 'errors'); $error++; @@ -181,19 +184,16 @@ if ($action == 'install') // Search dir $modulename $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule - if (!dol_is_dir($modulenamedir)) - { + if (!dol_is_dir($modulenamedir)) { $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule //var_dump($modulenamedir); - if (!dol_is_dir($modulenamedir)) - { + if (!dol_is_dir($modulenamedir)) { setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'
'.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors'); $error++; } } - if (!$error) - { + if (!$error) { // TODO Make more test } @@ -209,18 +209,22 @@ if ($action == 'install') //var_dump($modulenamearrays);exit; foreach ($modulenamearrays as $modulenameval) { - if (strpos($modulenameval, '#') === 0) continue; // Discard comments - if (strpos($modulenameval, '//') === 0) continue; // Discard comments - if (!trim($modulenameval)) continue; + if (strpos($modulenameval, '#') === 0) { + continue; // Discard comments + } + if (strpos($modulenameval, '//') === 0) { + continue; // Discard comments + } + if (!trim($modulenameval)) { + continue; + } // Now we install the module - if (!$error) - { + if (!$error) { @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the zip file dol_syslog("We copy now directory ".$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval." into target dir ".$dirins.'/'.$modulenameval); $result = dolCopyDir($modulenamedir, $dirins.'/'.$modulenameval, '0444', 1); - if ($result <= 0) - { + if ($result <= 0) { dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING); $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulenameval), null, 'errors'); @@ -235,40 +239,39 @@ if ($action == 'install') } } - if (!$error) - { + if (!$error) { setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings'); } } -if ($action == 'set' && $user->admin) -{ +if ($action == 'set' && $user->admin) { $resarray = activateModule($value); - if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); - else { + if (!empty($resarray['errors'])) { + setEventMessages('', $resarray['errors'], 'errors'); + } else { //var_dump($resarray);exit; - if ($resarray['nbperms'] > 0) - { + if ($resarray['nbperms'] > 0) { $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1"; $resqltmp = $db->query($tmpsql); - if ($resqltmp) - { + if ($resqltmp) { $obj = $db->fetch_object($resqltmp); //var_dump($obj->nb);exit; - if ($obj && $obj->nb > 1) - { + if ($obj && $obj->nb > 1) { $msg = $langs->trans('ModuleEnabledAdminMustCheckRights'); setEventMessages($msg, null, 'warnings'); } - } else dol_print_error($db); + } else { + dol_print_error($db); + } } } header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); exit; -} elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') -{ +} elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') { $result = unActivateModule($value); - if ($result) setEventMessages($result, null, 'errors'); + if ($result) { + setEventMessages($result, null, 'errors'); + } header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : '')); exit; } @@ -285,8 +288,7 @@ $morejs = array(); $morecss = array("/admin/dolistore/css/dolistore.css"); // Set dir where external modules are installed -if (!dol_is_dir($dirins)) -{ +if (!dol_is_dir($dirins)) { dol_mkdir($dirins); } $dirins_ok = (dol_is_dir($dirins)); @@ -310,25 +312,19 @@ $i = 0; // is a sequencer of modules found $j = 0; // j is module number. Automatically affected if module number not defined. $modNameLoaded = array(); -foreach ($modulesdir as $dir) -{ +foreach ($modulesdir as $dir) { // Load modules attributes in arrays (name, numero, orders) from dir directory //print $dir."\n
"; dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)"); $handle = @opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle)) !== false) - { + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { //print "$i ".$file."\n
"; - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') - { + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') { $modName = substr($file, 0, dol_strlen($file) - 10); - if ($modName) - { - if (!empty($modNameLoaded[$modName])) // In cache of already loaded modules ? - { + if ($modName) { + if (!empty($modNameLoaded[$modName])) { // In cache of already loaded modules ? $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.
"; setEventMessages($mesg, null, 'warnings'); dol_syslog($mesg, LOG_ERR); @@ -337,14 +333,12 @@ foreach ($modulesdir as $dir) try { $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. - if (class_exists($modName)) - { + if (class_exists($modName)) { try { $objMod = new $modName($db); $modNameLoaded[$modName] = $dir; - if (!$objMod->numero > 0 && $modName != 'modUser') - { - dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR); + if (!$objMod->numero > 0 && $modName != 'modUser') { + dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR); } $j = $objMod->numero; @@ -352,21 +346,26 @@ 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))) $modulequalified = 0; - if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified = 0; - if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified = 0; + if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) { + $modulequalified = 0; + } + if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) { + $modulequalified = 0; + } + if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) { + $modulequalified = 0; + } // We discard modules according to property ->hidden - if (!empty($objMod->hidden)) $modulequalified = 0; + if (!empty($objMod->hidden)) { + $modulequalified = 0; + } - if ($modulequalified > 0) - { + if ($modulequalified > 0) { $publisher = dol_escape_htmltag($objMod->getPublisher()); $external = ($objMod->isCoreOrExternalModule() == 'external'); - if ($external) - { - if ($publisher) - { + if ($external) { + if ($publisher) { $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; } else { $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); @@ -387,25 +386,21 @@ foreach ($modulesdir as $dir) } $moduleposition = ($objMod->module_position ? $objMod->module_position : '50'); - if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) - { + if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) { $moduleposition = '80'; // External modules at end by default } // Add list of warnings to show into arrayofwarnings and arrayofwarningsext - if (!empty($objMod->warnings_activation)) - { + if (!empty($objMod->warnings_activation)) { $arrayofwarnings[$modName] = $objMod->warnings_activation; } - if (!empty($objMod->warnings_activation_ext)) - { + if (!empty($objMod->warnings_activation_ext)) { $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext; } $familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']); $listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other'); - if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) - { + if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) { // If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups). if (is_numeric($familyposition)) { $familyposition = sprintf("%03d", (int) $familyposition + 100); @@ -416,21 +411,26 @@ foreach ($modulesdir as $dir) // Set categ[$i] $specialstring = 'unknown'; - if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring = 'expdev'; - if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories - else $categ[$specialstring] = 1; + if ($objMod->version == 'development' || $objMod->version == 'experimental') { + $specialstring = 'expdev'; + } + if (isset($categ[$specialstring])) { + $categ[$specialstring]++; // Array of all different modules categories + } else { + $categ[$specialstring] = 1; + } $j++; $i++; - } else dol_syslog("Module ".get_class($objMod)." not qualified"); - } catch (Exception $e) - { + } else { + dol_syslog("Module ".get_class($objMod)." not qualified"); + } + } catch (Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } } else { print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; } - } catch (Exception $e) - { + } catch (Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } } @@ -442,12 +442,13 @@ foreach ($modulesdir as $dir) } } -if ($action == 'reset_confirm' && $user->admin) -{ +if ($action == 'reset_confirm' && $user->admin) { if (!empty($modules[$value])) { $objMod = $modules[$value]; - if (!empty($objMod->langfiles)) $langs->loadLangs($objMod->langfiles); + if (!empty($objMod->langfiles)) { + $langs->loadLangs($objMod->langfiles); + } $form = new Form($db); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1); @@ -464,16 +465,27 @@ asort($orders); $nbofactivatedmodules = count($conf->modules); $moreinfo = $langs->trans("TitleNumberOfActivatedModules"); $moreinfo2 = ($nbofactivatedmodules - 1)." / ".count($modules); -if ($nbofactivatedmodules <= 1) $moreinfo2 .= ' '.img_warning($langs->trans("YouMustEnableOneModule")); +if ($nbofactivatedmodules <= 1) { + $moreinfo2 .= ' '.img_warning($langs->trans("YouMustEnableOneModule")); +} print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup'); // Start to show page -if ($mode == 'common') print ''.$langs->trans("ModulesDesc", img_picto('', 'switch_off'))."
\n"; -if ($mode == 'commonkanban') print ''.$langs->trans("ModulesDesc", img_picto('', 'switch_off'))."
\n"; -if ($mode == 'marketplace') print ''.$langs->trans("ModulesMarketPlaceDesc")."
\n"; -if ($mode == 'deploy') print ''.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."
\n"; -if ($mode == 'develop') print ''.$langs->trans("ModulesDevelopDesc")."
\n"; +if ($mode == 'common' || $mode == 'commonkanban') { + $desc = $langs->trans("ModulesDesc", '{picto}'); + $desc = str_replace('{picto}', img_picto('', 'switch_off'), $desc); + print ''.$desc."
\n"; +} +if ($mode == 'marketplace') { + print ''.$langs->trans("ModulesMarketPlaceDesc")."
\n"; +} +if ($mode == 'deploy') { + print ''.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."
\n"; +} +if ($mode == 'develop') { + print ''.$langs->trans("ModulesDevelopDesc")."
\n"; +} $head = modules_prepare_head(); @@ -481,22 +493,20 @@ $head = modules_prepare_head(); print "
\n"; -if ($mode == 'common' || $mode == 'commonkanban') -{ +if ($mode == 'common' || $mode == 'commonkanban') { dol_set_focus('#search_keyword'); print '
'; - if ($optioncss != '') print ''; + if ($optioncss != '') { + print ''; + } print ''; print ''; print ''; print ''; print ''; - $newmode = $mode; - if ($newmode == 'common') $newmode = 'commonkanban'; - - print dol_get_fiche_head($head, $newmode, '', -1); + print dol_get_fiche_head($head, 'modules', '', -1); $moreforfilter = '
'; @@ -514,12 +524,17 @@ if ($mode == 'common' || $mode == 'commonkanban') $moreforfilter .= '
'; $moreforfilter .= $langs->trans('Origin').': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1); $moreforfilter .= '
'; - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) - { + if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable")); - if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated'] = $langs->trans("Deprecated"); - if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental'] = $langs->trans("Experimental"); - if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development'] = $langs->trans("Development"); + if ($conf->global->MAIN_FEATURES_LEVEL < 0) { + $array_version['deprecated'] = $langs->trans("Deprecated"); + } + if ($conf->global->MAIN_FEATURES_LEVEL > 0) { + $array_version['experimental'] = $langs->trans("Experimental"); + } + if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + $array_version['development'] = $langs->trans("Development"); + } $moreforfilter .= '
'; $moreforfilter .= $langs->trans('Version').': '.$form->selectarray('search_version', $array_version, $search_version, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1); $moreforfilter .= '
'; @@ -537,8 +552,7 @@ if ($mode == 'common' || $mode == 'commonkanban') $moreforfilter .= '
'; - if (!empty($moreforfilter)) - { + if (!empty($moreforfilter)) { print $moreforfilter; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook @@ -552,14 +566,15 @@ if ($mode == 'common' || $mode == 'commonkanban') $object = new stdClass(); $parameters = array(); $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } // Show list of modules $oldfamily = ''; $linenum = 0; - foreach ($orders as $key => $value) - { + foreach ($orders as $key => $value) { $linenum++; $tab = explode('_', $value); $familykey = $tab[1]; @@ -569,12 +584,13 @@ if ($mode == 'common' || $mode == 'commonkanban') $objMod = $modules[$modName]; //print $objMod->name." - ".$key." - ".$objMod->version."
"; - if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab + if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') { + continue; // Discard if not for current tab + } - if (!$objMod->getName()) - { + if (!$objMod->getName()) { dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING); - continue; + continue; } $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod))); @@ -587,48 +603,65 @@ if ($mode == 'common' || $mode == 'commonkanban') $moduleauthor = $objMod->getPublisher(); // We discard showing according to filters - if ($search_keyword) - { + if ($search_keyword) { $qualified = 0; if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) - ) $qualified = 1; - if (!$qualified) continue; + ) { + $qualified = 1; + } + if (!$qualified) { + continue; + } } - if ($search_status) - { - if ($search_status == 'active' && empty($conf->global->$const_name)) continue; - if ($search_status == 'disabled' && !empty($conf->global->$const_name)) continue; + if ($search_status) { + if ($search_status == 'active' && empty($conf->global->$const_name)) { + continue; + } + if ($search_status == 'disabled' && !empty($conf->global->$const_name)) { + continue; + } } - if ($search_nature) - { - if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue; + if ($search_nature) { + if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external') { + continue; + } $reg = array(); - if (preg_match('/^external_(.*)$/', $search_nature, $reg)) - { + if (preg_match('/^external_(.*)$/', $search_nature, $reg)) { //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher()); $publisher = dol_escape_htmltag($objMod->getPublisher()); - if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue; - if (!$reg[1] && !empty($publisher)) continue; + if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) { + continue; + } + if (!$reg[1] && !empty($publisher)) { + continue; + } + } + if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') { + continue; } - if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue; } - if ($search_version) - { - if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue; - if ($objMod->version != 'development' && ($search_version == 'development')) continue; - if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue; - if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue; + if ($search_version) { + if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') { + continue; + } + if ($objMod->version != 'development' && ($search_version == 'development')) { + continue; + } + if ($objMod->version != 'experimental' && ($search_version == 'experimental')) { + continue; + } + if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) { + continue; + } } // Load all lang files of module - if (isset($objMod->langfiles) && is_array($objMod->langfiles)) - { - foreach ($objMod->langfiles as $domain) - { + if (isset($objMod->langfiles) && is_array($objMod->langfiles)) { + foreach ($objMod->langfiles as $domain) { $langs->load($domain); } } @@ -655,8 +688,7 @@ if ($mode == 'common' || $mode == 'commonkanban') $atleastoneforfamily++; - if ($familykey != $oldfamily) - { + if ($familykey != $oldfamily) { $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label']; $oldfamily = $familykey; } @@ -664,17 +696,22 @@ if ($mode == 'common' || $mode == 'commonkanban') // Version (with picto warning or not) $version = $objMod->getVersion(0); $versiontrans = ''; - if (preg_match('/development/i', $version)) $versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright'); - if (preg_match('/experimental/i', $version)) $versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright'); - if (preg_match('/deprecated/i', $version)) $versiontrans .= img_warning($langs->trans("Deprecated"), '', 'floatleft paddingright'); + if (preg_match('/development/i', $version)) { + $versiontrans .= img_warning($langs->trans("Development"), '', 'floatleft paddingright'); + } + if (preg_match('/experimental/i', $version)) { + $versiontrans .= img_warning($langs->trans("Experimental"), '', 'floatleft paddingright'); + } + if (preg_match('/deprecated/i', $version)) { + $versiontrans .= img_warning($langs->trans("Deprecated"), '', 'floatleft paddingright'); + } if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { $versiontrans .= $objMod->getVersion(1); } // Define imginfo $imginfo = "info"; - if ($objMod->isCoreOrExternalModule() == 'external') - { + if ($objMod->isCoreOrExternalModule() == 'external') { $imginfo = "info_black"; } @@ -682,25 +719,24 @@ if ($mode == 'common' || $mode == 'commonkanban') $codetoconfig = ''; // Activate/Disable and Setup (2 columns) - if (!empty($conf->global->$const_name)) // If module is already activated - { + if (!empty($conf->global->$const_name)) { // If module is already activated // Set $codeenabledisable $disableSetup = 0; - if (!empty($arrayofwarnings[$modName])) - { + if (!empty($arrayofwarnings[$modName])) { $codeenabledisable .= ''."\n"; } - if (!empty($objMod->disabled)) - { + if (!empty($objMod->disabled)) { $codeenabledisable .= $langs->trans("Disabled"); - } elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) - { - if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) $codeenabledisable .= $langs->trans("Used"); - else { + } elseif (!empty($objMod->always_enabled) || ((!empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) { + if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { + $codeenabledisable .= $langs->trans("Used"); + } else { $codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium valignmiddle'); //print $langs->trans("Required"); } - if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; + if (!empty($conf->multicompany->enabled) && $user->entity) { + $disableSetup++; + } } else { if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { $codeenabledisable .= 'warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; @@ -714,29 +750,32 @@ if ($mode == 'common' || $mode == 'commonkanban') } // Set $codetoconfig - if (!empty($objMod->config_page_url) && !$disableSetup) - { + if (!empty($objMod->config_page_url) && !$disableSetup) { $backtourlparam = ''; - if ($search_keyword != '') $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later - if ($search_nature > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; - if ($search_version > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; - if ($search_status > -1) $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; + if ($search_keyword != '') { + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.$search_keyword; // No urlencode here, done later + } + if ($search_nature > -1) { + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.$search_nature; + } + if ($search_version > -1) { + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.$search_version; + } + if ($search_status > -1) { + $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.$search_status; + } $backtourl = $_SERVER["PHP_SELF"].$backtourlparam; $regs = array(); - if (is_array($objMod->config_page_url)) - { + if (is_array($objMod->config_page_url)) { $i = 0; - foreach ($objMod->config_page_url as $page) - { + foreach ($objMod->config_page_url as $page) { $urlpage = $page; - if ($i++) - { + if ($i++) { $codetoconfig .= ''.img_picto(ucfirst($page), "setup").''; // print ''.ucfirst($page).' '; } else { - if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) - { + if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) { $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } else { @@ -745,8 +784,7 @@ if ($mode == 'common' || $mode == 'commonkanban') } } } - } elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) - { + } elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) { $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } else { $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; @@ -757,42 +795,36 @@ if ($mode == 'common' || $mode == 'commonkanban') } else // Module not yet activated { // Set $codeenabledisable - if (!empty($objMod->always_enabled)) - { + if (!empty($objMod->always_enabled)) { // Should never happened - } elseif (!empty($objMod->disabled)) - { + } elseif (!empty($objMod->disabled)) { $codeenabledisable .= $langs->trans("Disabled"); } else { // Module qualified for activation $warningmessage = ''; - if (!empty($arrayofwarnings[$modName])) - { + if (!empty($arrayofwarnings[$modName])) { $codeenabledisable .= ''."\n"; - foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) - { - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) - { + foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) { + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) { $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); } } } - if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) - { + if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) { $codeenabledisable .= ''."\n"; - foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) - { + foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) { $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule)); - if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on - { - foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) - { - if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) - { + if (in_array($keymodulelowercase, $conf->modules)) { // If module that request warning is on + foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) { + if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) { $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName(); - if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name; - if (!empty($objMod->editor_name)) $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName(); + if (!empty($objMod->editor_name)) { + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name; + } + if (!empty($objMod->editor_name)) { + $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName(); + } } } } @@ -800,7 +832,9 @@ if ($mode == 'common' || $mode == 'commonkanban') } $codeenabledisable .= ''."\n"; $codeenabledisable .= 'trans("Disabled"), 'switch_off'); $codeenabledisable .= "\n"; @@ -815,17 +849,21 @@ if ($mode == 'common' || $mode == 'commonkanban') print $objMod->getKanbanView($codeenabledisable, $codetoconfig); } else { print ''."\n"; - if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print ''.$linenum.''; + if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) { + print ''.$linenum.''; + } // Picto + Name of module print ' '; $alttext = ''; //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); - if (!empty($objMod->picto)) - { - if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1); - else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"'); + if (!empty($objMod->picto)) { + if (preg_match('/^\//i', $objMod->picto)) { + print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1); + } else { + print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"'); + } } else { print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"'); } @@ -873,8 +911,7 @@ if ($mode == 'common' || $mode == 'commonkanban') } } - if ($oldfamily) - { + if ($oldfamily) { if ($mode == 'commonkanban') { print '
'; } else { @@ -893,8 +930,7 @@ if ($mode == 'common' || $mode == 'commonkanban') print ''; } -if ($mode == 'marketplace') -{ +if ($mode == 'marketplace') { print dol_get_fiche_head($head, $mode, '', -1); // Marketplace @@ -920,8 +956,7 @@ if ($mode == 'marketplace') print '
'; - if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) - { + if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) { // $options is array with filter criterias //var_dump($options); $dolistore->getRemoteCategories(); @@ -937,17 +972,17 @@ if ($mode == 'marketplace') print '
'; ?> - -
trans('Keyword') ?>: -
-
-
- - trans('Reset') ?> - -   + +
trans('Keyword') ?>: +
- + + trans('Reset') ?> + +   +
+ '; @@ -958,48 +993,45 @@ if ($mode == 'marketplace') ?> -
-
    - get_categories(); ?> -
-
-
- - - get_products($categorie); ?> - -
-
+
+
    + get_categories(); ?> +
+
+
+ + + get_products($categorie); ?> + +
+
- '.$urldolibarrmodules.''; $message = ''; - if (!empty($allowonlineinstall)) - { - if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) - { + if (!empty($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; } else { - if ($dirins_ok) - { - if (!is_writable(dol_osencode($dirins))) - { + if ($dirins_ok) { + if (!is_writable(dol_osencode($dirins))) { $langs->load("errors"); $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins), 0, 0, '1', 'warning'); $allowfromweb = 0; @@ -1014,8 +1046,7 @@ if ($mode == 'deploy') $allowfromweb = 0; } - if ($allowfromweb < 1) - { + if ($allowfromweb < 1) { print $langs->trans("SomethingMakeInstallFromWebNotPossible"); print $message; //print $langs->trans("SomethingMakeInstallFromWebNotPossible2"); @@ -1024,10 +1055,8 @@ if ($mode == 'deploy') print '
'; - if ($allowfromweb >= 0) - { - if ($allowfromweb == 1) - { + if ($allowfromweb >= 0) { + if ($allowfromweb == 1) { //print $langs->trans("ThisIsProcessToFollow").'
'; } else { print $langs->trans("ThisIsAlternativeProcessToFollow").'
'; @@ -1038,8 +1067,7 @@ if ($mode == 'deploy') print ''.$langs->trans("StepNb", 3).': '; } - if ($allowfromweb == 1) - { + if ($allowfromweb == 1) { print $langs->trans("UnpackPackageInModulesRoot", $dirins).'
'; print '
'; @@ -1053,36 +1081,48 @@ if ($mode == 'deploy') $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb $maxphp = @ini_get('upload_max_filesize'); // In unknown - if (preg_match('/k$/i', $maxphp)) $maxphp = $maxphp * 1; - if (preg_match('/m$/i', $maxphp)) $maxphp = $maxphp * 1024; - if (preg_match('/g$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024; - if (preg_match('/t$/i', $maxphp)) $maxphp = $maxphp * 1024 * 1024 * 1024; + if (preg_match('/k$/i', $maxphp)) { + $maxphp = $maxphp * 1; + } + if (preg_match('/m$/i', $maxphp)) { + $maxphp = $maxphp * 1024; + } + if (preg_match('/g$/i', $maxphp)) { + $maxphp = $maxphp * 1024 * 1024; + } + if (preg_match('/t$/i', $maxphp)) { + $maxphp = $maxphp * 1024 * 1024 * 1024; + } $maxphp2 = @ini_get('post_max_size'); // In unknown - if (preg_match('/k$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1; - if (preg_match('/m$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024; - if (preg_match('/g$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024; - if (preg_match('/t$/i', $maxphp2)) $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + if (preg_match('/k$/i', $maxphp2)) { + $maxphp2 = $maxphp2 * 1; + } + if (preg_match('/m$/i', $maxphp2)) { + $maxphp2 = $maxphp2 * 1024; + } + if (preg_match('/g$/i', $maxphp2)) { + $maxphp2 = $maxphp2 * 1024 * 1024; + } + if (preg_match('/t$/i', $maxphp2)) { + $maxphp2 = $maxphp2 * 1024 * 1024 * 1024; + } // Now $max and $maxphp and $maxphp2 are in Kb $maxmin = $max; $maxphptoshow = $maxphptoshowparam = ''; - if ($maxphp > 0) - { + if ($maxphp > 0) { $maxmin = min($max, $maxphp); $maxphptoshow = $maxphp; $maxphptoshowparam = 'upload_max_filesize'; } - if ($maxphp2 > 0) - { + if ($maxphp2 > 0) { $maxmin = min($max, $maxphp2); - if ($maxphp2 < $maxphp) - { + if ($maxphp2 < $maxphp) { $maxphptoshow = $maxphp2; $maxphptoshowparam = 'post_max_size'; } } - if ($maxmin > 0) - { + if ($maxmin > 0) { print ''; } diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 00db8797a1f..655d501cac3 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -22,6 +22,8 @@ * \brief Library for common paypal functions */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + /** * Define head array for tabs of paypal tools setup pages @@ -54,131 +56,6 @@ function paypaladmin_prepare_head() } - -/** - * Return string with full Url - * - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) - * @param string $ref Ref of object - * @return string Url string - */ -function showPaypalPaymentUrl($type, $ref) -{ - global $conf, $langs; - - $langs->load("paypal"); - $langs->load("paybox"); - $servicename = 'PayPal'; - $out = '

'; - $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'
'; - $url = getPaypalPaymentUrl(0, $type, $ref); - $out .= ''; - $out .= ajax_autoselect("paypalurl", 0); - return $out; -} - - -/** - * Return string with full Url - * - * @param int $mode 0=True url, 1=Url formated with colors - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) - * @param string $ref Ref of object - * @param int $amount Amount - * @param string $freetag Free tag - * @return string Url string - */ -function getPaypalPaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag') -{ - global $conf; - - $ref = str_replace(' ', '', $ref); - - if ($type == 'free') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else $out .= '&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); - } - } - if ($type == 'order') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=order&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'order_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + order_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - if ($type == 'invoice') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=invoice&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'invoice_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - if ($type == 'contractline') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=contractline&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'contractline_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - if ($type == 'membersubscription') - { - $out = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?source=membersubscription&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'member_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - if (!empty($conf->global->PAYPAL_SECURITY_TOKEN)) - { - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYPAL_SECURITY_TOKEN; - else { - $out .= '&securekey='.($mode ? '' : ''); - if ($mode == 1) $out .= "hash('".$conf->global->PAYPAL_SECURITY_TOKEN."' + '".$type."' + member_ref)"; - if ($mode == 0) $out .= dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.$type.$ref, 2); - $out .= ($mode ? '' : ''); - } - } - } - - // For multicompany - $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities - - return $out; -} - - /** * Send redirect to paypal to browser * diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ea0bc19eecb..0e2429df730 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1214,7 +1214,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1); - print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } @@ -1666,7 +1666,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $arrayselected[] = $cat->id; } } - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 8fd41228b83..1a1799a435d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -56,14 +56,22 @@ class Product extends CommonObject public $table_element = 'product'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_product'; /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables = array('supplier_proposaldet', 'propaldet', 'commandedet', 'facturedet', 'contratdet', 'facture_fourn_det', 'commande_fournisseurdet'); + protected $childtables = array( + 'supplier_proposaldet', + 'propaldet', + 'commandedet', + 'facturedet', + 'contratdet', + 'facture_fourn_det', + 'commande_fournisseurdet' + ); /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -828,7 +836,8 @@ class Product extends CommonObject $error = 0; // Check parameters - if (!$this->label) { $this->label = 'MISSING LABEL'; + if (!$this->label) { + $this->label = 'MISSING LABEL'; } // Clean parameters @@ -846,6 +855,11 @@ class Product extends CommonObject $this->width_units = trim($this->width_units); $this->height = price2num($this->height); $this->height_units = trim($this->height_units); + $this->surface = price2num($this->surface); + $this->surface_units = trim($this->surface_units); + $this->volume = price2num($this->volume); + $this->volume_units = trim($this->volume_units); + // set unit not defined if (is_numeric($this->length_units)) { $this->width_units = $this->length_units; // Not used yet @@ -853,20 +867,17 @@ class Product extends CommonObject if (is_numeric($this->length_units)) { $this->height_units = $this->length_units; // Not used yet } + // Automated compute surface and volume if not filled if (empty($this->surface) && !empty($this->length) && !empty($this->width) && $this->length_units == $this->width_units) { $this->surface = $this->length * $this->width; $this->surface_units = measuring_units_squared($this->length_units); } - if (empty($this->volume) && !empty($this->surface_units) && !empty($this->height) && $this->length_units == $this->height_units) { + if (empty($this->volume) && !empty($this->surface) && !empty($this->height) && $this->length_units == $this->height_units) { $this->volume = $this->surface * $this->height; $this->volume_units = measuring_units_cubed($this->height_units); } - $this->surface = price2num($this->surface); - $this->surface_units = trim($this->surface_units); - $this->volume = price2num($this->volume); - $this->volume_units = trim($this->volume_units); if (empty($this->tva_tx)) { $this->tva_tx = 0; } @@ -913,10 +924,13 @@ class Product extends CommonObject $this->db->begin(); - // Check name is required and codes are ok or unique. - // If error, this->errors[] is filled + $result = 0; + // Check name is required and codes are ok or unique. If error, this->errors[] is filled if ($action != 'add') { $result = $this->verify(); // We don't check when update called during a create because verify was already done + } else { + // we can continue + $result = 0; } if ($result >= 0) { @@ -1089,7 +1103,7 @@ class Product extends CommonObject } if (!$error) { - if ($conf->variants->enabled) { + if (!empty($conf->variants->enabled)) { include_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; $comb = new ProductCombination($this->db); @@ -2184,14 +2198,14 @@ class Product extends CommonObject if ($resql) { $result = $this->db->fetch_array($resql); - $this->multiprices[$i] = $result["price"]; - $this->multiprices_ttc[$i] = $result["price_ttc"]; - $this->multiprices_min[$i] = $result["price_min"]; - $this->multiprices_min_ttc[$i] = $result["price_min_ttc"]; - $this->multiprices_base_type[$i] = $result["price_base_type"]; + $this->multiprices[$i] = $result ? $result["price"] : null; + $this->multiprices_ttc[$i] = $result ? $result["price_ttc"] : null; + $this->multiprices_min[$i] = $result ? $result["price_min"] : null; + $this->multiprices_min_ttc[$i] = $result ? $result["price_min_ttc"] : null; + $this->multiprices_base_type[$i] = $result ? $result["price_base_type"] : null; // Next two fields are used only if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on - $this->multiprices_tva_tx[$i] = $result["tva_tx"]; // TODO Add ' ('.$result['default_vat_code'].')' - $this->multiprices_recuperableonly[$i] = $result["recuperableonly"]; + $this->multiprices_tva_tx[$i] = $result ? $result["tva_tx"].($result ? ' ('.$result['default_vat_code'].')' : '') : null; + $this->multiprices_recuperableonly[$i] = $result ? $result["recuperableonly"] : null; // Price by quantity /* diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 4853d04f120..edd7622d82b 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -980,8 +980,7 @@ END; } // Supplier ref - if ($usercancreate) // change required right here - { + if ($usercancreate) { // change required right here print ''.$productfourn->getNomUrl().''; } else { print ''.$productfourn->fourn_ref.''; @@ -1138,7 +1137,7 @@ END; if ($usercancreate) { - print ''.img_edit().""; + print ''.img_edit().""; print '   '; print ''.img_picto($langs->trans("Remove"), 'delete').''; } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index cb9da997d18..47d9425530f 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -170,6 +170,9 @@ class Inventory extends CommonObject */ public $fk_user_valid; + /** + * @var string import key + */ public $import_key; // END MODULEBUILDER PROPERTIES @@ -178,17 +181,17 @@ class Inventory extends CommonObject // If this object has a subtable with lines /** - * @var int Name of subtable line + * @var string Name of subtable line */ public $table_element_line = 'inventorydet'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_inventory'; /** - * @var int Name of subtable class that manage subtable lines + * @var string Name of subtable class that manage subtable lines */ public $class_element_line = 'Inventoryline'; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 535da42eeba..ffd7add3c20 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -319,7 +319,7 @@ if ($action == 'create') // Categories print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_WAREHOUSE, '', 'parent', 64, 0, 1); - print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } print ''; @@ -767,7 +767,7 @@ if ($action == 'create') foreach ($cats as $cat) { $arrayselected[] = $cat->id; } - print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index f3442d759ed..4185d21d653 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -45,17 +45,17 @@ class Project extends CommonObject public $table_element = 'projet'; /** - * @var int Name of subtable line + * @var string Name of subtable line */ public $table_element_line = 'projet_task'; /** - * @var int Name of field date + * @var string Name of field date */ public $table_element_date; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_projet'; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index d71ac0852bc..a51e68c095e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -45,7 +45,7 @@ class Task extends CommonObject public $table_element = 'projet_task'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_task'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 586d78ae7b3..16c56ee7dc0 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -144,7 +144,7 @@ $fieldstosearchall['s.nom'] = "ThirdPartyName"; $arrayfields = array(); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); + if (!empty($val['visible'])) $arrayfields['p.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); } // Add none object fields to fields for list diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index e076bee598d..c18ec6e4434 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -897,7 +897,6 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($id) $param .= '&id='.urlencode($id); if ($projectid) $param .= '&projectid='.urlencode($projectid); if ($withproject) $param .= '&withproject='.urlencode($withproject); - if ($page) $param .= '&page='.urlencode($page); print ''; if ($optioncss != '') print ''; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 07e32b64432..ef12d844ddc 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -46,7 +46,14 @@ class Reception extends CommonObject { use CommonIncoterm; + /** + * @var string element name + */ public $element = "reception"; + + /** + * @var string Fieldname with ID of parent key if this field has a parent + */ public $fk_element = "fk_reception"; public $table_element = "reception"; public $table_element_line = "commande_fournisseur_dispatch"; diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 6c61ae55a1a..5dad53212c6 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -153,42 +153,6 @@ class RecruitmentCandidature extends CommonObject // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - //public $table_element_line = 'recruitment_recruitmentcandidatureline'; - - /** - * @var int Field with ID of parent key if this object has a parent - */ - //public $fk_element = 'fk_recruitmentcandidature'; - - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'RecruitmentCandidatureline'; - - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables = array(); - - /** - * @var array List of child tables. To know object to delete on cascade. - * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - */ - //protected $childtablesoncascade = array('recruitment_recruitmentcandidaturedet'); - - /** - * @var RecruitmentCandidatureLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index a75e915baee..2421f87ce50 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -168,40 +168,6 @@ class RecruitmentJobPosition extends CommonObject // END MODULEBUILDER PROPERTIES - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - //public $table_element_line = 'recruitment_recruitmentjobpositionline'; - - /** - * @var int Field with ID of parent key if this field has a parent - */ - //public $fk_element = 'fk_recruitmentjobposition'; - - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'RecruitmentJobPositionline'; - - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables=array(); - - /** - * @var array List of child tables. To know object to delete on cascade. - */ - //protected $childtablesoncascade=array('recruitment_recruitmentjobpositiondet'); - - /** - * @var RecruitmentJobPositionLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 135e2f53080..26477900be2 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -266,7 +266,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), - 'buildsepa'=>$langs->trans("BuildSepa"), + //'buildsepa'=>$langs->trans("BuildSepa"), // TODO ); //if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 1edd5492a81..7d7dcbe86c3 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -97,6 +97,16 @@ if (!empty($canvas)) // Security check $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); +/* +if ($object->id > 0) { + if ($object->client == 0 && $object->fournisseur > 0) { + if (!empty($user->rights->fournisseur->lire)) { + accessforbidden(); + } + } +} +*/ + $permissiontoread = $user->rights->societe->lire; $permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->societe->delete || ($permissiontoadd && isset($object->status) && $object->status == 0); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index ce2689a990e..7a793b04a8c 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1762,6 +1762,11 @@ class Thirdparties extends DolibarrApi unset($object->fk_delivery_address); // deprecated feature + unset($object->skype); + unset($object->twitter); + unset($object->facebook); + unset($object->linkedin); + return $object; } diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index ec6a3e77363..e88ea0e4f7c 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -199,15 +199,15 @@ class CompanyPaymentMode extends CommonObject // If this object has a subtable with lines /** - * @var int Name of subtable line + * @var string Name of subtable line */ //public $table_element_line = 'companypaymentmodedet'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ //public $fk_element = 'fk_companypaymentmode'; /** - * @var int Name of subtable class that manage subtable lines + * @var string Name of subtable class that manage subtable lines */ //public $class_element_line = 'CompanyPaymentModeline'; /** diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 73c41aeb782..f18a6e1b9a8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -59,7 +59,7 @@ class Societe extends CommonObject public $table_element = 'societe'; /** - * @var int Field with ID of parent key if this field has a parent or for child tables + * @var string Field with ID of parent key if this field has a parent or for child tables */ public $fk_element = 'fk_soc'; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index fe67c87674e..a315044683b 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -161,33 +161,6 @@ class SocieteAccount extends CommonObject // END MODULEBUILDER PROPERTIES - - - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - //public $table_element_line = 'societe_accountdet'; - /** - * @var int Field with ID of parent key if this field has a parent - */ - //public $fk_element = 'fk_societe_account'; - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'societeAccountline'; - /** - * @var array List of child tables. To test if we can delete object. - */ - //protected $childtables=array(); - /** - * @var societeAccountLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 26d540e4093..c304a00ce3f 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -169,6 +169,7 @@ print ''.$langs->trans("StripeDesc")."
\n" print '
'; +print '
'; print ''; print ''; print ''; @@ -177,7 +178,7 @@ print ''; print "\n"; print ''; -print '
'.$langs->trans("AccountParameter").'
'; +print ''; print $langs->trans("StripeLiveEnabled").''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('STRIPE_LIVE'); @@ -209,9 +210,9 @@ if (empty($conf->stripeconnect->enabled)) } print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForTestWebhook").' '; + $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForTestWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php?test', 3); - $out .= ''; + $out .= ''; $out .= ajax_autoselect("onlinetestwebhookurl", 0); print '
'.$out; print '
'; @@ -278,9 +279,9 @@ if (empty($conf->stripeconnect->enabled)) } print ''; print '   '.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx'; - $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; + $out = img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForLiveWebhook").' '; $url = dol_buildpath('/public/stripe/ipn.php', 3); - $out .= ''; + $out .= ''; $out .= ajax_autoselect("onlinelivewebhookurl", 0); print '
'.$out; print '
'; @@ -321,13 +322,15 @@ if (empty($conf->stripeconnect->enabled)) print '
'; +print '
'; print '
'; +print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -339,11 +342,12 @@ print ''; print ''; print ''; @@ -437,6 +441,19 @@ print ''.$langs->trans("Example").': myemail@myserver.com, Payment service <myemail2@myserver2.com>'; print ''; +print '
'.$langs->trans("UsageParameter").''.$langs->trans("UsageParameter").''.$langs->trans("Value").'
'; print $langs->trans("StripeUserAccountForActions").''; -print $form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); +print img_picto('', 'user').$form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); print '
'; print $langs->trans("BankAccount").''; +print img_picto('', 'bank_account').' '; $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); print '
'; +print '
'; + +print '
'; + +print '
'; +print ''; + +print ''; +print ''; +print ''; +print "\n"; + // Payment token for URL print ''; print '
'.$langs->trans("UrlGenerationParameters").''.$langs->trans("Value").'
'; print $langs->trans("SecurityToken").''; @@ -461,6 +478,7 @@ if ($conf->use_javascript_ajax) { print '
'; +print '
'; print dol_get_fiche_end(); @@ -481,12 +499,14 @@ if (!empty($conf->use_javascript_ajax)) { print "\n".''; } diff --git a/htdocs/stripe/lib/stripe.lib.php b/htdocs/stripe/lib/stripe.lib.php index bdd05fb47d9..f1d03ae39be 100644 --- a/htdocs/stripe/lib/stripe.lib.php +++ b/htdocs/stripe/lib/stripe.lib.php @@ -21,6 +21,8 @@ * \brief Library for common stripe functions */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; + /** * Define head array for tabs of stripe tools setup pages * @@ -52,87 +54,6 @@ function stripeadmin_prepare_head() } - -/** - * Return string with full Url - * - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) - * @param string $ref Ref of object - * @return string Url string - */ -function showStripePaymentUrl($type, $ref) -{ - global $conf, $langs; - - $langs->load("paypal"); - $langs->load("paybox"); - $langs->load("stripe"); - - $servicename = 'Stripe'; - $out = '

'; - $out .= img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $servicename).'
'; - $url = getStripePaymentUrl(0, $type, $ref); - $out .= '
'; - $out .= ajax_autoselect("stripeurl", 0); - return $out; -} - -/** - * Return string with full Url - * - * @param int $mode 0=True url, 1=Url formated with colors - * @param string $type Type of URL ('free', 'order', 'invoice', 'contractline', 'membersubscription' ...) - * @param string $ref Ref of object - * @param int $amount Amount - * @param string $freetag Free tag - * @return string Url string - */ -function getStripePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag') -{ - global $conf; - - $ref = str_replace(' ', '', $ref); - - if ($type == 'free') - { - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?amount='.($mode ? '' : '').$amount.($mode ? '' : '').'&tag='.($mode ? '' : '').$freetag.($mode ? '' : ''); - } - if ($type == 'order') - { - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=order&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'order_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - } - if ($type == 'invoice') - { - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=invoice&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'invoice_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - } - if ($type == 'contractline') - { - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=contractline&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'contractline_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - } - if ($type == 'membersubscription') - { - $out = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?source=membersubscription&ref='.($mode ? '' : ''); - if ($mode == 1) $out .= 'member_ref'; - if ($mode == 0) $out .= urlencode($ref); - $out .= ($mode ? '' : ''); - } - - // For multicompany - $out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities - - return $out; -} - - /** * Show footer of company in HTML pages * diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index ade660ef1b4..ae40784aa68 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -545,14 +545,13 @@ if (empty($reshook)) $date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year')); $ref_supplier = GETPOST('fourn_ref', 'alpha'); $prod_entry_mode = GETPOST('prod_entry_mode'); - if ($prod_entry_mode == 'free') - { + if ($prod_entry_mode == 'free') { $idprod = 0; $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod = GETPOST('idprod', 'int'); - $price_ht = ''; + $price_ht = GETPOST('price_ht'); $tva_tx = ''; } @@ -586,8 +585,8 @@ if (empty($reshook)) $error++; } if (!$error && ($qty >= 0)) { - $pu_ht = 0; - $pu_ttc = 0; + $pu_ht = price2num($price_ht, 'MU'); + $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $price_min = 0; $price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT'); @@ -652,12 +651,12 @@ if (empty($reshook)) $localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - $pu_ht = $productsupplier->fourn_pu; if (empty($pu_ht)) $pu_ht = 0; // If pu is '' or null, we force to have a numeric value // If GETPOST('idprodfournprice') is a numeric, we can use it. If it is empty or if it is 'idprod_123', we should use -1 (not used) $fournprice = (is_numeric(GETPOST('idprodfournprice', 'alpha')) ? GETPOST('idprodfournprice', 'alpha') : -1); $buyingprice = 0; + $pu_ht_devise = price2num($price_ht_devise, 'MU'); $result = $object->addline( $desc, @@ -683,7 +682,7 @@ if (empty($reshook)) $productsupplier->fk_unit, '', 0, - $productsupplier->fourn_multicurrency_unitprice, + $pu_ht_devise, $date_start, $date_end ); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index b46ed476629..ad4f47389d5 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -61,12 +61,12 @@ class SupplierProposal extends CommonObject public $table_element = 'supplier_proposal'; /** - * @var int Name of subtable line + * @var string Name of subtable line */ public $table_element_line = 'supplier_proposaldet'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_supplier_proposal'; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 88911f10b7d..84efe32839e 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -232,6 +232,8 @@ foreach ($dirmodels as $reldir) } print "
\n"; +print '
'; + // Mode print ''; print ''; @@ -241,7 +243,7 @@ print '
'; print ''; print ''; -print ''; +print ''; print "\n"; // Terminals @@ -301,11 +303,12 @@ print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS print "\n"; // Numpad use payment icons -print '\n"; +*/ // Direct Payment print ''; $htmlforlines .= ''; $htmlforlines .= ''; $htmlforlines .= '
'.$langs->trans("Parameters").''.$langs->trans("Value").''.$langs->trans("Parameters").''.$langs->trans("Value").'
'; +/*print '
'; print $langs->trans('TakeposNumpadUsePaymentIcon'); print ''; print ajax_constantonoff("TAKEPOS_NUMPAD_USE_PAYMENT_ICON", array(), $conf->entity, 0, 0, 1, 0); print "
'; diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php index 416980633ca..6cd6073eb48 100644 --- a/htdocs/takepos/css/pos.css.php +++ b/htdocs/takepos/css/pos.css.php @@ -125,6 +125,10 @@ button.calcbutton2 { border-radius: 3px; } +button.calcbutton2 .iconwithlabel { + padding-bottom: 10px; +} + button.calcbutton3 { display: inline-block; position: relative; @@ -463,7 +467,7 @@ div.description_content { .header{ margin: 0 auto; width: 100%; - height: 50px; + height: 52px; background: rgb(60,70,100); } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index f76f46fa579..a2293786924 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -813,7 +813,9 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { multicurrency->enabled)) { - print ''.$langs->trans("Currency").''; + print ''; + print ''.$langs->trans("Currency").''; + print ''; } ?> @@ -830,7 +832,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { dol_use_jmobile)) { ?> - +   '; + if ($_SESSION["basiclayout"] == 1) { + $htmlforlines .= '  '; + } if ($_SESSION["basiclayout"] != 1) { $moreinfo = ''; @@ -1318,32 +1328,40 @@ if ($placeid > 0) $moreinfo .= '
'.$langs->transcountry("TotalLT2", $mysoc->country_code).': '.price($line->total_localtax2); $moreinfo .= '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).': '.price($line->total_ttc); //$moreinfo .= $langs->trans("TotalHT").': '.$line->total_ht; - if ($line->date_start || $line->date_end) $htmlforlines .= '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + if ($line->date_start || $line->date_end) $htmlforlines .= '
'.get_date_range($line->date_start, $line->date_end).'
'; $htmlforlines .= '
'.vatrate($line->remise_percent, true).''; if (!empty($conf->stock->enabled) && !empty($user->rights->stock->mouvement->lire)) { $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; - $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; - $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; - $sql .= " ".MAIN_DB_PREFIX."product_stock as ps"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; - $sql .= " WHERE ps.reel != 0"; - $sql .= " AND ps.fk_entrepot = ".$conf->global->$constantforkey; - $sql .= " AND e.entity IN (".getEntity('stock').")"; - $sql .= " AND ps.fk_product = ".$line->fk_product; - $resql = $db->query($sql); - if ($resql) { - $obj = $db->fetch_object($resql); - $stock_real = price2num($obj->reel, 'MS'); + if (!empty($conf->global->$constantforkey) && $line->fk_product > 0) { + $sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp"; + $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,"; + $sql .= " ".MAIN_DB_PREFIX."product_stock as ps"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; + $sql .= " WHERE ps.reel != 0"; + $sql .= " AND ps.fk_entrepot = ".$conf->global->$constantforkey; + $sql .= " AND e.entity IN (".getEntity('stock').")"; + $sql .= " AND ps.fk_product = ".$line->fk_product; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $stock_real = price2num($obj->reel, 'MS'); + $htmlforlines .= $line->qty; + if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ''; + $htmlforlines .= ' ('.$langs->trans("Stock").' '.$stock_real.')'; + if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ""; + } else { + dol_print_error($db); + } + } else { $htmlforlines .= $line->qty; - if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ''; - $htmlforlines .= ' ('.$langs->trans("Stock").' '.$stock_real.')'; - if ($line->qty && $line->qty > $stock_real) $htmlforlines .= ""; } + } else { + $htmlforlines .= $line->qty; } - else $htmlforlines .= $line->qty; + $htmlforlines .= ''; $htmlforlines .= price($line->total_ttc, 1, '', 1, -1, -1, $conf->currency); @@ -1382,4 +1400,4 @@ if ($action == "search") '; } -print ''; \ No newline at end of file +print ''; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b0e745e2211..c1683073371 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -192,8 +192,14 @@ else print "var received=0;"; } console.log("We click on the payment mode to pay amount = "+amountpayed); parent.$("#poslines").load("invoice.php?place=&action=valid&pay="+payment+"&amount="+amountpayed+"&excess="+excess+"&invoiceid="+invoiceid+"&accountid="+accountid, function() { - if (amountpayed > || amountpayed == || amountpayed==0 ) parent.$.colorbox.close(); - else location.reload(); + if (amountpayed > || amountpayed == || amountpayed==0 ) { + console.log("Close popup"); + parent.$.colorbox.close(); + } + else { + console.log("Amount is not comple, so we do NOT close popup and reload it."); + location.reload(); + } }); } @@ -288,16 +294,16 @@ print ''; + print ''; } else { print ''; } @@ -311,16 +317,16 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -335,16 +341,16 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index fa458d96318..dd808d9a19d 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -74,9 +74,9 @@ top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss); $langs->loadLangs(array('main', 'bills', 'cashdesk')); -if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { +if (!isset($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON) || !empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) { $htmlReductionPercent = ''; - $htmlReductionAmount = ''; + $htmlReductionAmount = '
'.$langs->trans('Amount'); } else { $htmlReductionPercent = $langs->trans('ReductionShort').'
%'; $htmlReductionAmount = $langs->trans('ReductionShort').'
'.$langs->trans('Amount'); diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a3e71882264..3a849c33b3a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2078,7 +2078,7 @@ a.tmenudisabled:link, a.tmenudisabled:visited, a.tmenudisabled:hover, a.tmenudis } a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active { - padding: 0px 4px 0px 4px; + padding: 0px 2px 0px 2px; white-space: nowrap; color: var(--colortextbackhmenu); text-decoration: none; @@ -2530,11 +2530,13 @@ img.login, img.printer, img.entity { font-weight: bold; } .userimg.atoplogin img.userphoto, .userimgatoplogin img.userphoto { /* size for user photo in login bar */ - width: px; - height: px; + width: px; + height: px; border-radius: 50%; background-size: contain; background-size: contain; + border: 1px solid; + border-color: rgba(255, 255, 255, 0.2); } img.userphoto { /* size for user photo in lists */ border-radius: 0.72em; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9d8c2b26017..319789b6fde 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -199,7 +199,7 @@ if ($conf->browser->layout == 'phone') $nbtopmenuentries = max($nbtopmenuentries $minwidthtmenu = 66; /* minimum width for one top menu entry */ -$heightmenu = 48; /* height of top menu, part with image */ +$heightmenu = 50; /* height of top menu, part with image */ $heightmenu2 = 49; /* height of top menu, part with login */ $disableimages = 0; $maxwidthloginblock = 180; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index ba7cd546d54..4a22b211c5f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -204,6 +204,7 @@ if (empty($reshook)) { } if (!$error) { + $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); $object->login = GETPOST("login", 'alphanohtml'); @@ -366,6 +367,7 @@ if (empty($reshook)) { $db->begin(); + $object->civility_code = GETPOST("civility_code", 'aZ09'); $object->lastname = GETPOST("lastname", 'alphanohtml'); $object->firstname = GETPOST("firstname", 'alphanohtml'); $object->login = GETPOST("login", 'alphanohtml'); @@ -737,10 +739,12 @@ if ($action == 'create' || $action == 'adduserldap') $label = ''; foreach ($required_fields as $value) { - if ($value) - { - $label .= $value."=".$ldapuser[$value]." "; - } + if ($value === $conf->global->LDAP_FIELD_PASSWORD || $value === $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) + { + $label .= $value."=******* "; + } elseif ($value) { + $label .= $value."=".$ldapuser[$value]." "; + } } $liste[$key] = $label; } @@ -789,6 +793,11 @@ if ($action == 'create' || $action == 'adduserldap') print ''; + // Civility + print ''; + // Lastname print ''; print ''; @@ -930,12 +939,6 @@ if ($action == 'create' || $action == 'adduserldap') print "\n"; } - // Type - print ''; - print ''; - // Gender print ''; print '\n"; } + // External user + print ''; + print ''; print '
'; + print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code'); + print '
'.$langs->trans("Lastname").'
'.$langs->trans("Type").''; - print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2); - print '
'.$langs->trans("Gender").''; @@ -983,6 +986,11 @@ if ($action == 'create' || $action == 'adduserldap') print "
'.$langs->trans("ExternalUser").' ?'; + print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help', '', 0, 2); + print '

'; @@ -1840,8 +1848,7 @@ if ($action == 'create' || $action == 'adduserldap') if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) - { + if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { print ''; } else { print ''; @@ -2037,6 +2044,11 @@ if ($action == 'create' || $action == 'adduserldap') print ''; } + // Civility + print ''; + // Lastname print ""; print ''; @@ -2197,36 +2209,6 @@ if ($action == 'create' || $action == 'adduserldap') print ''; } - // Type - print ''; - print ''; - // Gender print ''; print '\n"; } + // External user ? + print ''; + print ''; print '
'; + print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'aZ09') : $object->civility_code, 'civility_code'); + print '
'.$langs->trans("Lastname").'
'.$langs->trans("Type").''; - if ($user->id == $object->id || !$user->admin) - { - // Read mode - $type = $langs->trans("Internal"); - if ($object->socid) $type = $langs->trans("External"); - print $form->textwithpicto($type, $langs->trans("InternalExternalDesc")); - if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; - } else { - // Select mode - $type = 0; - if ($object->contact_id) $type = $object->contact_id; - - if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact - print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); - print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); - if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; - } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1); - if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; - } else { // $object->socid is not > 0 here - print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); - } - } - print '
'.$langs->trans("Gender").''; @@ -2307,6 +2289,35 @@ if ($action == 'create' || $action == 'adduserldap') print "
'.$langs->trans("ExternalUser").' ?'; + if ($user->id == $object->id || !$user->admin) + { + // Read mode + $type = $langs->trans("Internal"); + if ($object->socid) $type = $langs->trans("External"); + print $form->textwithpicto($type, $langs->trans("InternalExternalDesc")); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; + } else { + // Select mode + $type = 0; + if ($object->contact_id) $type = $object->contact_id; + + if ($object->socid > 0 && !($object->contact_id > 0)) { // external user but no link to a contact + print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); + print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; + } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact + print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set + print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; + } else { // $object->socid is not > 0 here + print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set + print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); + } + } + print '

'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3288571d2a7..eb92bd51eb9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -54,7 +54,7 @@ class User extends CommonObject public $table_element = 'user'; /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_user'; @@ -74,6 +74,7 @@ class User extends CommonObject public $ldap_sid; public $search_sid; public $employee; + public $civility_code; /** * @var string gender @@ -400,7 +401,7 @@ class User extends CommonObject $login = trim($login); // Get user - $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.birth, u.email, u.personal_email, u.job,"; + $sql = "SELECT u.rowid, u.lastname, u.firstname, u.employee, u.gender, u.civility as civility_code, u.birth, u.email, u.personal_email, u.job,"; $sql .= " u.socialnetworks,"; $sql .= " u.signature, u.office_phone, u.office_fax, u.user_mobile, u.personal_mobile,"; $sql .= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; @@ -470,6 +471,7 @@ class User extends CommonObject $this->ref_ext = $obj->ref_ext; $this->ldap_sid = $obj->ldap_sid; + $this->civility_code = $obj->civility_code; $this->lastname = $obj->lastname; $this->firstname = $obj->firstname; @@ -1293,6 +1295,8 @@ class User extends CommonObject // Clean parameters $this->setUpperOrLowerCase(); + + $this->civility_code = trim($this->civility_code); $this->login = trim($this->login); if (!isset($this->entity)) { $this->entity = $conf->entity; // If not defined, we use default value @@ -1419,6 +1423,7 @@ class User extends CommonObject // Define parameters $this->admin = 0; + $this->civility_code = $contact->civility_code; $this->lastname = $contact->lastname; $this->firstname = $contact->firstname; $this->gender = $contact->gender; @@ -1447,6 +1452,7 @@ class User extends CommonObject if ($result > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."user"; $sql .= " SET fk_socpeople=".$contact->id; + $sql .= ", civility=".$contact->civility_code; if ($contact->socid) { $sql .= ", fk_soc=".$contact->socid; } @@ -1497,6 +1503,7 @@ class User extends CommonObject // Set properties on new user $this->admin = 0; + $this->civility_code = $member->civility_id; $this->lastname = $member->lastname; $this->firstname = $member->firstname; $this->gender = $member->gender; @@ -1632,6 +1639,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); // Clean parameters + $this->civility_code = trim($this->civility_code); $this->lastname = trim($this->lastname); $this->firstname = trim($this->firstname); $this->employee = $this->employee ? $this->employee : 0; @@ -1686,7 +1694,8 @@ class User extends CommonObject // Update datas $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; - $sql .= " lastname = '".$this->db->escape($this->lastname)."'"; + $sql .= " civility = '".$this->db->escape($this->civility_code)."'"; + $sql .= ", lastname = '".$this->db->escape($this->lastname)."'"; $sql .= ", firstname = '".$this->db->escape($this->firstname)."'"; $sql .= ", employee = ".(int) $this->employee; $sql .= ", login = '".$this->db->escape($this->login)."'"; @@ -1788,6 +1797,7 @@ class User extends CommonObject $result = $adh->fetch($this->fk_member); if ($result > 0) { + $adh->civility_code = $this->civility_code; $adh->firstname = $this->firstname; $adh->lastname = $this->lastname; $adh->login = $this->login; @@ -1838,6 +1848,7 @@ class User extends CommonObject $result = $tmpobj->fetch($this->contact_id); if ($result >= 0) { + $tmpobj->civility_code = $this->civility_code; $tmpobj->firstname = $this->firstname; $tmpobj->lastname = $this->lastname; $tmpobj->login = $this->login; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 882d33bd562..5ba6b5553af 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -90,7 +90,10 @@ class UserGroup extends CommonObject */ public $datem; - public $note; // Description + /** + * @var string Description + */ + public $note; public $members = array(); // Array of users @@ -111,7 +114,7 @@ class UserGroup extends CommonObject ); /** - * @var int Field with ID of parent key if this field has a parent + * @var string Field with ID of parent key if this field has a parent */ public $fk_element = 'fk_usergroup'; diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php index ada3a992f44..6cdcd04417f 100644 --- a/htdocs/user/vcard.php +++ b/htdocs/user/vcard.php @@ -61,7 +61,7 @@ $v = new vCard(); $v->setProdId('Dolibarr '.DOL_VERSION); $v->setUid('DOLIBARR-USERID-'.$user2->id); -$v->setName($user2->lastname, $user2->firstname, "", $user2->civility, ""); +$v->setName($user2->lastname, $user2->firstname, "", $user2->civility_code, ""); $v->setFormattedName($user2->getFullName($langs, 1)); $v->setPhoneNumber($user2->phone_pro, "TYPE=WORK;VOICE"); diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index ff072827423..30961013806 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -181,19 +181,19 @@ class WebsitePage extends CommonObject // If this object has a subtable with lines - /** - * @var int Name of subtable line - */ + // /** + // * @var string Name of subtable line + // */ //public $table_element_line = 'mymodule_myobjectline'; /** - * @var int Field with ID of parent key if this field has a parent or for child tables + * @var string Field with ID of parent key if this field has a parent or for child tables */ public $fk_element = 'fk_website_page'; - /** - * @var int Name of subtable class that manage subtable lines - */ + // /** + // * @var string Name of subtable class that manage subtable lines + // */ //public $class_element_line = 'MyObjectline'; /** @@ -682,6 +682,7 @@ class WebsitePage extends CommonObject $object->author_alias = ''; $object->date_creation = $now; $object->title = ($newtitle == '1' ? $object->title : ($newtitle ? $newtitle : $object->title)); + $object->description = $object->title; if (!empty($newlang)) $object->lang = $newlang; if ($istranslation) $object->fk_page = $fromid; else $object->fk_page = 0; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3a8e8bda794..b6f274c375d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1824,8 +1824,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf // Protection if it is a translation page if ($istranslation) { - if (GETPOST('newlang', 'aZ09') == $objectpage->lang) - { + if (GETPOST('newlang', 'aZ09') == $objectpage->lang || !GETPOST('newlang', 'aZ09')) { $error++; setEventMessages($langs->trans("LanguageMustNotBeSameThanClonedPage"), null, 'errors'); $action = 'preview'; @@ -2631,24 +2630,28 @@ if (!GETPOST('hide_websitemenu')) $onlylang = array(); if ($website->otherlang) { if (!empty($website->lang)) { - $onlylang[$website->lang] = $website->lang; + $onlylang[$website->lang] = $website->lang.' ('.$langs->trans("Default").')'; } foreach (explode(',', $website->otherlang) as $langkey) { $onlylang[$langkey] = $langkey; } - $textifempty = 1; + $textifempty = $langs->trans("Default"); } else { - $onlylang['none'] = ''; + $onlylang['none'] = 'none'; + $textifempty = $langs->trans("Default"); } - $textifempty = 1; $formquestion = array( array('type' => 'hidden', 'name' => 'sourcepageurl', 'value'=> $objectpage->pageurl), array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'newwebsite', 'label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)), - array('type' => 'text', 'tdclass'=>'maxwidth200 fieldrequired', 'name' => 'newtitle', 'label'=> $langs->trans("WEBSITE_TITLE"), 'value'=> $langs->trans("CopyOf").' '.$objectpage->title), - array('type' => 'text', 'tdclass'=>'maxwidth200', 'name' => 'newpageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME"), 'value'=> ''), - array('type' => 'checkbox', 'tdclass'=>'maxwidth200', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0, 'morecss'=>'margintoponly'), - array('type' => 'other', 'name' => 'newlang', 'label' => $form->textwithpicto($langs->trans("Language"), $langs->trans("DefineListOfAltLanguagesInWebsiteProperties")), 'value' => $formadmin->select_language($preselectedlanguage, 'newlang', 0, null, $textifempty, 0, 0, 'minwidth200', 0, 1, 0, $onlylang, 1)), - ); + array('type' => 'text', 'tdclass'=>'maxwidth200 fieldrequired', 'moreattr'=>'autofocus="autofocus"', 'name' => 'newtitle', 'label'=> $langs->trans("WEBSITE_TITLE"), 'value'=> $langs->trans("CopyOf").' '.$objectpage->title), + array('type' => 'text', 'tdclass'=>'maxwidth200', 'name' => 'newpageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME"), 'value'=> '') + ); + if (count($onlylang) > 1) { + $formquestion[] = array('type' => 'checkbox', 'tdclass'=>'maxwidth200', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0, 'morecss'=>'margintoponly'); + } + + $value= $formadmin->select_language($preselectedlanguage, 'newlang', 0, null, $textifempty, 0, 0, 'minwidth200', 1, 0, 0, $onlylang, 1); + $formquestion[] = array('type' => 'other', 'name' => 'newlang', 'label' => $form->textwithpicto($langs->trans("Language"), $langs->trans("DefineListOfAltLanguagesInWebsiteProperties")), 'value' => $value); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$pageid, $langs->trans('ClonePage'), '', 'confirm_createpagefromclone', $formquestion, 0, 1, 300, 550); @@ -3574,7 +3577,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') // Edit properties of } print '"; } diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 5d5a9c84eda..b71c5aec1d7 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -252,35 +252,6 @@ class Hook extends CommonObject public $import_key; - // If this object has a subtable with lines - - /** - * @var int Name of subtable line - */ - //public $table_element_line = 'hookdet'; - - /** - * @var int Field with ID of parent key if this field has a parent - */ - //public $fk_element = 'fk_hook'; - - /** - * @var int Name of subtable class that manage subtable lines - */ - //public $class_element_line = 'MyObjectline'; - - /** - * @var array Array of child tables (child tables to delete before deleting a record) - */ - //protected $childtables=array('hookdet'); - - /** - * @var MyObjectLine[] Array of subtable lines - */ - //public $lines = array(); - - - /** * Constructor * diff --git a/package.json b/package.json index 01d3a4300ee..56f8ced1d4b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "test:e2e": "node_modules/cucumber/bin/cucumber-js --require test/acceptance/index.js --require test/acceptance/setup.js --require test/acceptance/stepDefinitions -f node_modules/cucumber-pretty" }, "dependencies": { + "chart.js": "^2.9.4", "cucumber-pretty": "^6.0.0", "node-fetch": "^2.6.1" } diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index b4354e086b5..fab2452c2b8 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -61,6 +61,12 @@ require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php"; $version = DOL_VERSION; $error = 0; +if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) +{ + $conf->global->MAILING_LIMIT_SENDBYCLI = 0; +} + + /* * Main */ diff --git a/scripts/emailings/reset-invalid-emails.php b/scripts/emailings/reset-invalid-emails.php index 59c7e5372dd..bc35f0f4240 100755 --- a/scripts/emailings/reset-invalid-emails.php +++ b/scripts/emailings/reset-invalid-emails.php @@ -35,14 +35,15 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit(-1); } -if (!isset($argv[2]) || !$argv[2]) { - print "Usage: ".$script_file." inputfile-with-invalid-emails type\n"; +if (!isset($argv[3]) || !$argv[3]) { + print "Usage: ".$script_file." inputfile-with-invalid-emails type [test|confirm]\n"; print "- inputfile-with-invalid-emails is a file with list of invalid email\n"; print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n"; exit(-1); } $fileofinvalidemail = $argv[1]; $type = $argv[2]; +$mode = $argv[3]; require_once $path."../../htdocs/master.inc.php"; require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php"; @@ -56,15 +57,15 @@ $error = 0; * Main */ +$user = new User($db); + @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; - -$user = new User($db); -// for signature, we use user send as parameter -if (!empty($login)) - $user->fetch('', $login); - +if (!in_array($type, array('thirdparties', 'contacts', 'users', 'members'))) { + print "Bad value for parameter type.\n"; + exit(-1); +} $db->begin(); @@ -77,6 +78,9 @@ if (!$myfile) } $tmp = 1; +$counter = 1; +$numerasedtotal = 0; + while ($tmp != null) { $groupofemails = array(); @@ -90,49 +94,82 @@ while ($tmp != null) $groupofemails[$i] = trim($tmp, "\n"); } + // Generate the string tp allow a mass update (with a limit of MAXEMAILS per request). + $emailsin = ''; + foreach ($groupofemails as $email) { + $emailsin .= ($emailsin ? ", " : "")."'".$db->escape($email)."'"; + } + // For each groupofemail, we update tables to set email field to empty + $nbingroup = count($groupofemails); + + print "Process group of ".$nbingroup." emails (".$counter." - ".($counter + $nbingroup - 1)."), type = ".$type."\n"; + + $numerased = 0; $sql_base = "UPDATE ".MAIN_DB_PREFIX; - foreach ($groupofemails as $email) + + if ($type == 'all' || $type == 'users') { - if ($type == 'all' || $type == 'thirdparty') - { - // Loop on each record and update the email to null if email into $groupofemails - - $sql = $sql_base."societe as s SET s.email = NULL WHERE s.email = '".$db->escape($email)."';"; - $db->query($sql); + // Loop on each record and update the email to null if email into $groupofemails + $sql = $sql_base."user as u SET u.email = NULL WHERE u.email IN (".$emailsin.");"; + print "Try to update users, "; + $resql = $db->query($sql); + if (!$resql) { + dol_print_error($db); } - - if ($type == 'all' || $type == 'contact') - { - // Loop on each record and update the email to null if email into $groupofemails - - $sql = $sql_base."socpeople as s SET s.email = NULL WHERE s.email = '".$db->escape($email)."';"; - $db->query($sql); - } - - if ($type == 'all' || $type == 'user') - { - // Loop on each record and update the email to null if email into $groupofemails - - $sql = $sql_base."user as u SET u.email = NULL WHERE u.email = '".$db->escape($email)."';"; - $db->query($sql); - } - - if ($type == 'all' || $type == 'member') - { - // Loop on each record and update the email to null if email into $groupofemails - - $sql = $sql_base."adherent as a SET a.email = NULL WHERE a.email = '".$db->escape($email)."';"; - $resql = $db->query($sql); - } - echo $email; + $numerased += $db->affected_rows($resql); } + + if ($type == 'all' || $type == 'thirdparties') + { + // Loop on each record and update the email to null if email into $groupofemails + $sql = $sql_base."societe as s SET s.email = NULL WHERE s.email IN (".$emailsin.");"; + print "Try to update thirdparties, "; + $resql = $db->query($sql); + if (!$resql) { + dol_print_error($db); + } + $numerased += $db->affected_rows($resql); + } + + if ($type == 'all' || $type == 'contacts') + { + // Loop on each record and update the email to null if email into $groupofemails + + $sql = $sql_base."socpeople as s SET s.email = NULL WHERE s.email IN (".$emailsin.");"; + print "Try to update contacts, "; + $resql = $db->query($sql); + if (!$resql) { + dol_print_error($db); + } + $numerased += $db->affected_rows($resql); + } + + if ($type == 'all' || $type == 'members') + { + // Loop on each record and update the email to null if email into $groupofemails + + $sql = $sql_base."adherent as a SET a.email = NULL WHERE a.email IN (".$emailsin.");"; + print "Try to update members, "; + $resql = $db->query($sql); + if (!$resql) { + dol_print_error($db); + } + $numerased += $db->affected_rows($resql); + } + + $numerasedtotal += $numerased; + + print $numerased." emails cleared.\n"; + $counter = $counter + $nbingroup; } -if (!$error) { +if (!$error && $mode == 'confirm') { + print "Commit - ".$numerasedtotal." operations validated.\n"; $db->commit(); } else { + print "Rollback - ".$numerasedtotal." Operations canceled.\n"; $db->rollback(); } diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 09c075c1083..163bf320075 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -242,11 +242,6 @@ class AllTests require_once dirname(__FILE__).'/ScriptsTest.php'; $suite->addTestSuite('ScriptsTest'); - require_once dirname(__FILE__).'/FormAdminTest.php'; - $suite->addTestSuite('FormAdminTest'); - require_once dirname(__FILE__).'/FormTest.php'; - $suite->addTestSuite('FormTest'); - require_once dirname(__FILE__).'/ModulesTest.php'; // At end because it's the longer $suite->addTestSuite('ModulesTest'); @@ -254,10 +249,15 @@ class AllTests // GUI require_once dirname(__FILE__).'/FormAdminTest.php'; $suite->addTestSuite('FormAdminTest'); + require_once dirname(__FILE__).'/FormTest.php'; + $suite->addTestSuite('FormTest'); + // Payment services require_once dirname(__FILE__).'/PaypalTest.php'; $suite->addTestSuite('PaypalTest'); + require_once dirname(__FILE__).'/StripeTest.php'; + $suite->addTestSuite('StripeTest'); return $suite; } diff --git a/test/phpunit/ContactTest.php b/test/phpunit/ContactTest.php index 0c5687e67c9..7d7e2740bc1 100755 --- a/test/phpunit/ContactTest.php +++ b/test/phpunit/ContactTest.php @@ -334,25 +334,6 @@ class ContactTest extends PHPUnit\Framework\TestCase return $result; } - /** - * testContactStatic - * - * @return void - */ - public function testContactStatic() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $localobject=new Contact($db); - - - return; - } - /** * testContactGetFullAddress * diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 2a3cb079baf..0f5b0bd82e3 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -149,7 +149,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $file = "export_".$model.".modules.php"; $classname = "Export".$model; require_once $dir.$file; - $objmodel = new $classname($this->db); + $objmodel = new $classname($db); // First test without option USE_STRICT_CSV_RULES unset($conf->global->USE_STRICT_CSV_RULES); @@ -364,7 +364,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $sql = ""; $result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql); $expectedresult = 1; - $this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed'); + $this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed: '.$objexport->error); $result=dol_is_file($exportfile); $this->assertTrue($result, 'File '.$exportfile.' not found'); } diff --git a/test/phpunit/FormTest.php b/test/phpunit/FormTest.php index bec23048e9f..76e7c4e69a8 100644 --- a/test/phpunit/FormTest.php +++ b/test/phpunit/FormTest.php @@ -143,14 +143,14 @@ class FormTest extends PHPUnit\Framework\TestCase $result=$localobject->select_produits_list('', 'productid', '', 5, 0, '', 1, 2, 1); $this->assertEquals(count($result), 5); - print __METHOD__." result=".$result."\n"; + print __METHOD__." count result=".count($result)."\n"; $conf->global->ENTREPOT_EXTRA_STATUS = 1; // Exclude stock in warehouseinternal $result=$localobject->select_produits_list('', 'productid', '', 5, 0, '', 1, 2, 1, 0, '1', 0, '', 0, 'warehouseclosed,warehouseopen'); $this->assertEquals(count($result), 5); - print __METHOD__." result=".$result."\n"; + print __METHOD__." count result=".count($result)."\n"; return $result; } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 4031ad60951..7cbb6af5955 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1267,9 +1267,9 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $this->assertEquals(1234, price2num('1.234', '', 2), 'Test 1.234 give 1234 with spanish language if user input'); $this->assertEquals(1.234, price2num('1,234', '', 2), 'Test 1,234 give 1234 with spanish language if user input'); $this->assertEquals(1234, price2num('1 234', '', 2), 'Test 1 234 give 1234 with spanish language if user input'); - $this->assertEquals(1.234, price2num('1.234'), 'Test 1.234 give 1.234 with spanish language'); - $this->assertEquals(1.234, price2num('1,234'), 'Test 1,234 give 1234 with spanish language'); - $this->assertEquals(1234, price2num('1 234'), 'Test 1 234 give 1234 with spanish language'); + $this->assertEquals(-1.234, price2num('-1.234'), 'Test 1.234 give 1.234 with spanish language'); + $this->assertEquals(-1.234, price2num('-1,234'), 'Test 1,234 give 1234 with spanish language'); + $this->assertEquals(-1234, price2num('-1 234'), 'Test 1 234 give 1234 with spanish language'); $this->assertEquals(21500123, price2num('21.500.123'), 'Test 21.500.123 give 21500123 with spanish language'); $this->assertEquals(21500123, price2num('21500.123', 0, 2), 'Test 21500.123 give 21500123 with spanish language if user input'); $this->assertEquals(21500.123, price2num('21500.123'), 'Test 21500.123 give 21500123 with spanish language'); diff --git a/test/phpunit/ImportTest.php b/test/phpunit/ImportTest.php index ce689fda4a4..e9bf019740c 100644 --- a/test/phpunit/ImportTest.php +++ b/test/phpunit/ImportTest.php @@ -140,7 +140,7 @@ class ImportTest extends PHPUnit\Framework\TestCase // TODO // Run import on file and check the record with field "auto" are filled // according to option - + $this->assertEquals(0, 0); return true; } diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php index 19774a11c09..7a2e31cbdad 100644 --- a/test/phpunit/PaypalTest.php +++ b/test/phpunit/PaypalTest.php @@ -131,7 +131,7 @@ class PaypalTest extends PHPUnit\Framework\TestCase } /** - * testProductCreate + * testPaypalOk * * @return void */ @@ -143,13 +143,13 @@ class PaypalTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - $urltotest=getPaypalPaymentUrl(0, 'free'); + $urltotest=getOnlinePaymentUrl(0, 'free'); print "urltotest=".$urltotest."\n"; $result=getURLContent($urltotest, 'GET', '', 1, array(), array('http', 'https'), 2); - print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + print __METHOD__." result=".$result['http_code']."\n"; + $this->assertEquals(200, $result['http_code']); return $result; } diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 650d8a93e37..e574d3e1d20 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -147,7 +147,7 @@ class ProductTest extends PHPUnit\Framework\TestCase $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertLessThanOrEqual($result, 0, "Creation of product"); return $result; } @@ -177,31 +177,6 @@ class ProductTest extends PHPUnit\Framework\TestCase return $localobject; } - /** - * testProductGetArboEachProd - * - * @return void - */ - public function testProductGetArboEachProd() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - /* - $localobject=new Product($db); - $localobject->fetch(208); - $localobject->get_sousproduits_arbo(); - $localobject->get_arbo_each_prod(); - - var_dump($localobject->res); print (json_encode($localobject->res)); exit; - */ - - return; - } - /** * testProductUpdate * @@ -219,7 +194,8 @@ class ProductTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - $localobject->note='New note after update'; + $localobject->note_public = 'New public note after update'; + $localobject->note_private = 'New private note after update'; $result=$localobject->update($localobject->id, $user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; $this->assertLessThan($result, 0); @@ -244,6 +220,7 @@ class ProductTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; + $this->assertEquals(0, 0); return $localobject->id; } @@ -274,23 +251,4 @@ class ProductTest extends PHPUnit\Framework\TestCase return $result; } - - /** - * testProductStatic - * - * @return void - */ - public function testProductStatic() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $localobject=new Product($db); - - - return; - } } diff --git a/test/phpunit/PropalTest.php b/test/phpunit/PropalTest.php index 068fb53b052..ea678e8df34 100644 --- a/test/phpunit/PropalTest.php +++ b/test/phpunit/PropalTest.php @@ -190,11 +190,11 @@ class PropalTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; - $localobject->note_private='New note private after update'; - $result=$localobject->update($user); + $localobject->note_private = 'New note private after update'; + $result = $localobject->update($user); $this->assertLessThan($result, 0); - print __METHOD__." id=".$id." result=".$result."\n"; + print __METHOD__." id=".$localobject->id." result=".$result."\n"; return $localobject; } diff --git a/test/phpunit/ScriptsTest.php b/test/phpunit/ScriptsTest.php index 16884214418..82d1ee28e39 100644 --- a/test/phpunit/ScriptsTest.php +++ b/test/phpunit/ScriptsTest.php @@ -68,7 +68,7 @@ class ScriptsTest extends PHPUnit\Framework\TestCase * Constructor * We save global variables into local variables * - * @return SecurityTest + * @return ScriptsTest */ public function __construct() { @@ -152,6 +152,10 @@ class ScriptsTest extends PHPUnit\Framework\TestCase $db=$this->savdb; $script=dirname(__FILE__).'/../../scripts/bank/export-bank-receipts.php BANKDUMMY RECEIPTDUMMY excel2007 lang=fr_FR'; + + $returnvar = 0; + $output = array(); + $result=exec($script, $output, $returnvar); print __METHOD__." result=".$result."\n"; @@ -187,6 +191,8 @@ class ScriptsTest extends PHPUnit\Framework\TestCase $this->assertEquals($result,'Failed to find bank account with ref BANKDUMMY.'); $this->assertEquals($returnvar,255); */ + $this->assertEquals(0, 0); + return ''; } @@ -204,6 +210,9 @@ class ScriptsTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; + $returnvar = 0; + $output = array(); + $script=dirname(__FILE__).'/../../scripts/contracts/email_expire_services_to_customers.php test thirdparties'; $result=exec($script, $output, $returnvar); print __METHOD__." result=".$result."\n"; @@ -242,6 +251,9 @@ class ScriptsTest extends PHPUnit\Framework\TestCase $langs=$this->savlangs; $db=$this->savdb; + $returnvar = 0; + $output = array(); + $script=dirname(__FILE__).'/../../scripts/invoices/email_unpaid_invoices_to_customers.php test thirdparties'; $result=exec($script, $output, $returnvar); print __METHOD__." result=".$result."\n"; diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 008a2dcafd1..4d642c733b4 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -34,6 +34,7 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session) +if (! defined("NOSESSION")) define("NOSESSION", '1'); require_once dirname(__FILE__).'/../../htdocs/main.inc.php'; require_once dirname(__FILE__).'/../../htdocs/core/lib/security.lib.php'; @@ -284,9 +285,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase $_POST["param6"]="">objnotdefined\''; - // Test int - $result=GETPOST('id', 'int'); // Must return nothing + $result=GETPOST('id', 'int'); // Must return nothing print __METHOD__." result=".$result."\n"; $this->assertEquals($result, ''); @@ -346,6 +348,14 @@ class SecurityTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals("HackerassertEquals($_POST["param9"], $result); + + $result=GETPOST("param10", 'alphanohtml'); + print __METHOD__." result=".$result."\n"; + $this->assertEquals($_POST["param9"], $result, 'We should get param9 after processing param10'); + return $result; } diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php index 4ed0771d668..0ca6cc8792b 100755 --- a/test/phpunit/SocieteTest.php +++ b/test/phpunit/SocieteTest.php @@ -382,25 +382,6 @@ class SocieteTest extends PHPUnit\Framework\TestCase return $result; } - /** - * testSocieteStatic - * - * @return void - */ - public function testSocieteStatic() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $localobject=new Societe($db); - - - return; - } - /** * testSocieteGetFullAddress diff --git a/test/phpunit/StripeTest.php b/test/phpunit/StripeTest.php new file mode 100644 index 00000000000..72d4722b34e --- /dev/null +++ b/test/phpunit/StripeTest.php @@ -0,0 +1,156 @@ + + * + * 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 . + * or see https://www.gnu.org/ + */ + +/** + * \file test/phpunit/StripeTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/core/lib/geturl.lib.php'; +require_once dirname(__FILE__).'/../../htdocs/stripe/lib/stripe.lib.php'; + +if (empty($user->id)) +{ + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class StripeTest extends PHPUnit\Framework\TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return ProductTest + */ + public function __construct() + { + parent::__construct(); + + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + /** + * setUpBeforeClass + * + * @return void + */ + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + + if (empty($conf->stripe->enabled)) { print __METHOD__." Module Stripe must be enabled.\n"; die(); } + + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + /** + * tearDownAfterClass + * + * @return void + */ + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + } + + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testStripeOk + * + * @return void + */ + public function testStripeOk() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $urltotest=getOnlinePaymentUrl(0, 'free'); + print "urltotest=".$urltotest."\n"; + + $result=getURLContent($urltotest, 'GET', '', 1, array(), array('http', 'https'), 2); + + print __METHOD__." result=".$result['http_code']."\n"; + $this->assertEquals(200, $result['http_code']); + + return $result; + } +} diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml index d648edb6814..7e903daa16d 100644 --- a/test/phpunit/phpunittest.xml +++ b/test/phpunit/phpunittest.xml @@ -17,20 +17,6 @@ - - ../../build/ - ../../dev/ - ../../doc/ - ../../test/ - ../../documents/ - ../../htdocs/custom/ - ../../htdocs/documents/custom/ - ../../htdocs/nltechno/ - ../../htdocs/products/canvas/ - ../../htdocs/contact/canvas/ - ../../htdocs/societe/canvas/ - ../../htdocs/includes/ - ../../htdocs/ ../../htdocs/ @@ -54,8 +40,21 @@ ../../htdocs/contact/canvas/ ../../htdocs/societe/canvas/ ../../htdocs/includes/ - ../../htdocs/holiday/common.inc.php + + ../../build/ + ../../dev/ + ../../doc/ + ../../test/ + ../../documents/ + ../../htdocs/custom/ + ../../htdocs/documents/custom/ + ../../htdocs/nltechno/ + ../../htdocs/products/canvas/ + ../../htdocs/contact/canvas/ + ../../htdocs/societe/canvas/ + ../../htdocs/includes/ +
'.$form->editfieldkey('Categories', 'categories', '', $objectpage, 0).''; - print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('categories', $cate_arbo, (GETPOSTISSET('categories') ? GETPOST('categories', 'array') : $arrayselected), null, null, null, null, "90%"); + print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('categories', $cate_arbo, (GETPOSTISSET('categories') ? GETPOST('categories', 'array') : $arrayselected), null, null, 'quatrevingtpercent widthcentpercentminusx'); print "