Merge branch 'develop' into develop#2

This commit is contained in:
Hystepik 2020-12-08 09:01:20 +01:00 committed by GitHub
commit 3d674abfae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
243 changed files with 3964 additions and 6262 deletions

View File

@ -39,7 +39,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes
JS libraries: JS libraries:
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea. 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 3.5.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css

View File

@ -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 quantity in product margin page
NEW: add column vat rate in page to define accounting account on product/service NEW: add column vat rate in page to define accounting account on product/service
NEW: add costprice in fields of products list 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 employee link in expense report binding page
NEW: add EORI No. as ProfID5 NEW: add EORI No. as ProfID5
NEW: add export for various payments 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: For developers:
--------------- ---------------
NEW: add __MEMBER_TYPE__ substitution key 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: 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: 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: Add some fields to link website page to an other object
NEW: fill ECM src object fields in dol_add_file_process NEW: fill ECM src object fields in dol_add_file_process
NEW: conf to allow to show the full tree in warehouse popup 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: add property cssview when declaring fields of an object
NEW: Can use dynamic code into the 'enabled' property of DAO fields NEW: Can use dynamic code into the 'enabled' property of DAO fields
NEW: allow to edit "demand reason" field though API 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: fetch contact by email with REST API
NEW: field ref_ext in llx_commandedet NEW: field ref_ext in llx_commandedet
NEW: fields ref_ext for Attributes and Combinations 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: added incoterms data into the substitution array
NEW: add send context for ticket NEW: add send context for ticket
NEW: add a message in error_log after detection of SQL or script injection 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: add validation of MX domain for emails
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) 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 HOOKs
NEW: Hook on propal card 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 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. * 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(). * 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 ***** ***** 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 social contribution list
FIX: SQL Problem in supplier invoice list FIX: SQL Problem in supplier invoice list
FIX: SQL syntax error when editing extrafields FIX: SQL syntax error when editing extrafields
FIX: Sql type FIX: SQL type
FIX: takepos 12 hook FIX: TakePOS 12 hook
FIX: Update form erased extrafields that were hidden FIX: Update form erased extrafields that were hidden
FIX: Update of extrafields date FIX: Update of extrafields date
FIX: Update of extrafiels on draft object FIX: Update of extrafiels on draft object
@ -394,7 +397,7 @@ For users:
NEW: Module MO (Manufacturing Order) is available as stable module. NEW: Module MO (Manufacturing Order) is available as stable module.
NEW: Receipt printer module moved from 'development' to 'experimental' 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: 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: 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 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: Accountancy - General ledger - Add an option to search not reconciled lines
NEW: Add accountancy code of thirdparty in contact and supplier export NEW: Add accountancy code of thirdparty in contact and supplier export
NEW: support webp image format 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 link to notes in members list
NEW: add a parameter to group same products in TakePOS NEW: add a parameter to group same products in TakePOS
NEW: add a parameter to sort product by label in TakePOS NEW: add a parameter to sort product by label in TakePOS
NEW: Add a profil to import contact categories NEW: add a profil to import contact categories
NEW: Add company extrafields into order export NEW: add company extrafields into order export
NEW: add const CASHDESK_FORCE_DECREASE_STOCK to force batch decrementation 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 const TAKEPOS_NUMPAD_USE_PAYMENT_ICON to use icons on payment buttons
NEW: add csv separator setup in module admin NEW: add csv separator setup in module admin
NEW: add dedicated substitutions keys for extrafields of type date and datetime NEW: add dedicated substitutions keys for extrafields of type date and datetime
NEW: add default warehouse for dispatch NEW: add default warehouse for dispatch
NEW: Add due date in feature "Export accounting documents" NEW: add due date in feature "Export accounting documents"
NEW: Add duration information for fichinter NEW: add duration information for fichinter
NEW: Start support of Dark theme into ELDY theme NEW: Start support of Dark theme into ELDY theme
NEW: Add field author public alias for blog post on website module NEW: Add field author public alias for blog post on website module
NEW: Add "finished" field on product list NEW: Add "finished" field on product list

View File

@ -12,8 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
## Reporting a Vulnerability ## Reporting a Vulnerability
To report a vulnerability, please send an email to security@dolibarr.org To report a vulnerability, please use GitHub security advisory (alternatively 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.
## Hunting vulnerabilities on Dolibarr ## Hunting vulnerabilities on Dolibarr

View File

@ -581,23 +581,36 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
# Removed other test files # Removed other test files
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/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 -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/.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`; $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/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/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/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 -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/multiselect/MIT-LICENSE.txt`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`; $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/doc`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`; $ret=`rm -f $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/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`; $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/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`; $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/sabre/sabre/*/tests`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/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/stripe/LICENSE`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`;
$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 -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`; $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/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $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/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $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/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/includes/autoload.php`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
} }
# Build package for each target # Build package for each target

View File

@ -35,7 +35,7 @@
"nnnick/chartjs" : "^2.9", "nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1", "stripe/stripe-php" : "6.43.1",
"maximebf/debugbar" : "1.15.1", "maximebf/debugbar" : "1.15.1",
"symfony/var-dumper": "3" "symfony/var-dumper" : "3"
}, },
"require-dev" : { "require-dev" : {
"php-parallel-lint/php-parallel-lint" : "^0", "php-parallel-lint/php-parallel-lint" : "^0",

263
composer.lock generated
View File

@ -6,6 +6,53 @@
], ],
"content-hash": "1dbd2d05cc0836acfca5988f29005cf2", "content-hash": "1dbd2d05cc0836acfca5988f29005cf2",
"packages": [ "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", "name": "ckeditor/ckeditor",
"version": "4.12.1", "version": "4.12.1",
@ -217,16 +264,16 @@
}, },
{ {
"name": "nnnick/chartjs", "name": "nnnick/chartjs",
"version": "v2.9.3", "version": "v2.9.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/chartjs/Chart.js.git", "url": "https://github.com/chartjs/Chart.js.git",
"reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2" "reference": "9bd4cf82fda9f50a5fb50b72843e06ab88124278"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/chartjs/Chart.js/zipball/06f73dc3590084b2c464bf08189c7aee2b6b92d2", "url": "https://api.github.com/repos/chartjs/Chart.js/zipball/9bd4cf82fda9f50a5fb50b72843e06ab88124278",
"reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2", "reference": "9bd4cf82fda9f50a5fb50b72843e06ab88124278",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -254,7 +301,11 @@
"JS", "JS",
"chart" "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", "name": "phpoffice/phpexcel",
@ -314,53 +365,6 @@
"abandoned": "phpoffice/phpspreadsheet", "abandoned": "phpoffice/phpspreadsheet",
"time": "2015-05-01T07:00:55+00:00" "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", "name": "restler/framework",
"version": "3.0.0-RC6", "version": "3.0.0-RC6",
@ -2037,159 +2041,6 @@
], ],
"time": "2019-08-06T08:03:45+00:00" "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", "name": "symfony/yaml",
"version": "v3.4.32", "version": "v3.4.32",
@ -2312,5 +2163,5 @@
"ext-curl": "*" "ext-curl": "*"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "1.1.0" "plugin-api-version": "2.0.0"
} }

View File

@ -15,7 +15,7 @@
"npm": ">=5.6.0" "npm": ">=5.6.0"
}, },
"dependencies": { "dependencies": {
"zapier-platform-core": "10.1.1" "zapier-platform-core": "10.1.2"
}, },
"devDependencies": { "devDependencies": {
"mocha": "^5.2.0", "mocha": "^5.2.0",

View File

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

View File

@ -3,7 +3,7 @@
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -128,8 +128,7 @@ if ($action == "confirm_update") {
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
if ($mode != '_tmp') if ($mode != '_tmp') {
{
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }
@ -165,14 +164,14 @@ if ($action == "confirm_update") {
$object->label_operation = $label_operation; $object->label_operation = $label_operation;
$object->debit = $debit; $object->debit = $debit;
$object->credit = $credit; $object->credit = $credit;
$object->doc_date = GETPOST('doc_date', 'alpha'); $object->doc_date = (string) GETPOST('doc_date', 'alpha');
$object->doc_type = GETPOST('doc_type', 'alpha'); $object->doc_type = (string) GETPOST('doc_type', 'alpha');
$object->piece_num = $piece_num; $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->code_journal = $journal_code;
$object->journal_label = $journal_label; $object->journal_label = $journal_label;
$object->fk_doc = (int) GETPOST('fk_doc', 'int'); $object->fk_doc = GETPOSTINT('fk_doc');
$object->fk_docdet = (int) GETPOST('fk_docdet', 'int'); $object->fk_docdet = GETPOSTINT('fk_docdet');
if (floatval($debit) != 0.0) { if (floatval($debit) != 0.0) {
$object->montant = $debit; // deprecated $object->montant = $debit; // deprecated
@ -190,8 +189,7 @@ if ($action == "confirm_update") {
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
if ($mode != '_tmp') if ($mode != '_tmp') {
{
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} }

View File

@ -37,7 +37,7 @@ class AccountingJournal extends CommonObject
public $table_element = 'accounting_journal'; 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 = ''; public $fk_element = '';

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2016-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
@ -103,13 +103,19 @@ if ($conf->accounting->enabled)
// STEPS // STEPS
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -118,60 +124,45 @@ if ($conf->accounting->enabled)
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>')."\n"; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
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 "<br>\n"; print "<br>\n";
if (!empty($conf->tax->enabled)) if (!empty($conf->tax->enabled))
{ {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
$step++; $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 "<br>\n"; print "<br>\n";
} }
/*if (! empty($conf->salaries->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php
print "<br>\n";
print "<br>\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. 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++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
} }
/*
if (! empty($conf->loan->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->don->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}
if (! empty($conf->adherents->enabled))
{
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
}*/
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>'); $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
@ -188,26 +179,34 @@ if ($conf->accounting->enabled)
$langs->loadLangs(array('bills', 'trips')); $langs->loadLangs(array('bills', 'trips'));
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>')."\n"; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>')."\n"; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>')."\n"; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
$s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
print $s;
print "<br>\n"; print "<br>\n";
} }
$step++; $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 "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n"; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
print $s;
print "<br>\n"; print "<br>\n";
print '<br>'; print '<br>';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr> * Copyright (C) 2018 Eric Seigne <eric.seigne@cap-rel.fr>
* *
@ -73,15 +73,18 @@ $date_endmonth = GETPOST('date_endmonth', 'int');
$date_endday = GETPOST('date_endday', 'int'); $date_endday = GETPOST('date_endday', 'int');
$date_endyear = GETPOST('date_endyear', 'int'); $date_endyear = GETPOST('date_endyear', 'int');
$in_bookkeeping = GETPOST('in_bookkeeping', 'aZ09'); $in_bookkeeping = GETPOST('in_bookkeeping', 'aZ09');
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet'; if ($in_bookkeeping == '') {
$in_bookkeeping = 'notyet';
}
$now = dol_now(); $now = dol_now();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
// Security check // Security check
if ($user->socid > 0 && empty($id_journal)) if ($user->socid > 0 && empty($id_journal)) {
accessforbidden(); accessforbidden();
}
/* /*
@ -93,8 +96,7 @@ $error = 0;
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); $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); $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 // Period by default on transfer
$dates = getDefaultDatesForTransfer(); $dates = getDefaultDatesForTransfer();
$date_start = $dates['date_start']; $date_start = $dates['date_start'];
@ -103,8 +105,7 @@ if (empty($date_startmonth) || empty($date_endmonth))
$pastmonth = $dates['pastmonth']; $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_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
$date_end = dol_get_last_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 .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
$sql .= " WHERE ba.fk_accountancy_journal=".$id_journal; $sql .= " WHERE ba.fk_accountancy_journal=".$id_journal;
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy $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)."'"; $sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
}
// Define begin binding date // Define begin binding date
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; $sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
} }
// Already in bookkeeping or not // 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') )"; $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 .= " 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"; $sql .= " ORDER BY b.datev";
@ -177,9 +177,9 @@ if ($result) {
//print $sql; //print $sql;
// Variables // Variables
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : '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_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_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_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_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word $account_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 bank record = tabbq
// one line for thirdparty record = tabtp // one line for thirdparty record = tabtp
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$lineisapurchase = -1; $lineisapurchase = -1;
$lineisasale = -1; $lineisasale = -1;
// Old method to detect if it's a sale or purchase // Old method to detect if it's a sale or purchase
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 1; if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') {
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale = 1; $lineisapurchase = 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->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') {
{ $lineisasale = 1;
if ($obj->typeop_payment == 'payment') $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($obj->type_payment); var_dump($obj->type_payment_supplier);
//var_dump($lineisapurchase); //var_dump($lineisasale); //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) // Set accountancy code for thirdparty (example: '411CU...' or '411' if no subledger account defined on customer)
$compta_soc = 'NotDefined'; $compta_soc = 'NotDefined';
if ($lineisapurchase > 0) if ($lineisapurchase > 0) {
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier); $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); $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer);
}
$tabcompany[$obj->rowid] = array( $tabcompany[$obj->rowid] = array(
'id' => $obj->socid, 'id' => $obj->socid,
'name' => $obj->name, 'name' => $obj->name,
'code_compta' => $compta_soc, 'code_compta' => $compta_soc,
'email' => $obj->email 'email' => $obj->email
); );
// Set accountancy code for user // Set accountancy code for user
$compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : ''); $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : '');
$tabuser[$obj->rowid] = array( $tabuser[$obj->rowid] = array(
'id' => $obj->userid, 'id' => $obj->userid,
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname), 'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
'lastname' => $obj->lastname, 'lastname' => $obj->lastname,
'firstname' => $obj->firstname, 'firstname' => $obj->firstname,
'email' => $obj->useremail, 'email' => $obj->useremail,
'accountancy_code' => $compta_user 'accountancy_code' => $compta_user
); );
// Variable bookkeeping ($obj->rowid is Bank Id) // Variable bookkeeping ($obj->rowid is Bank Id)
@ -264,10 +271,6 @@ if ($result) {
// Load of url links to the line into llx_bank // 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'=> ) $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 // 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. $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'; $tabtype[$obj->rowid] = 'unknown';
@ -277,17 +280,14 @@ if ($result) {
if (is_array($links) && count($links) > 0) { if (is_array($links) && count($links) > 0) {
// Now loop on each link of record in bank. // Now loop on each link of record in bank.
foreach ($links as $key => $val) { 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 // 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 // We save tabtype for a future use, to remember what kind of payment it is
$tabpay[$obj->rowid]['type'] = $links[$key]['type']; $tabpay[$obj->rowid]['type'] = $links[$key]['type'];
$tabtype[$obj->rowid] = $links[$key]['type']; $tabtype[$obj->rowid] = $links[$key]['type'];
} elseif (in_array($links[$key]['type'], array('company', 'user'))) } elseif (in_array($links[$key]['type'], array('company', 'user'))) {
{ if ($tabpay[$obj->rowid]['type'] == 'unknown') {
if ($tabpay[$obj->rowid]['type'] == 'unknown')
{
// We can guess here it is a bank record for a thirdparty company or a user. // 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. // 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->name = $links[$key]['label'];
$societestatic->email = $tabcompany[$obj->rowid]['email']; $societestatic->email = $tabcompany[$obj->rowid]['email'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); $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') { } elseif ($links[$key]['type'] == 'user') {
$userstatic->id = $links[$key]['url_id']; $userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label']; $userstatic->name = $links[$key]['label'];
$userstatic->email = $tabuser[$obj->rowid]['email']; $userstatic->email = $tabuser[$obj->rowid]['email'];
$userstatic->firstname = $tabuser[$obj->rowid]['firstname']; $userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
$userstatic->lastname = $tabuser[$obj->rowid]['lastname']; $userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); if ($userstatic->id > 0) {
else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount; } 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') { } elseif ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id']; $chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id'];
@ -329,8 +336,9 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2); $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
$reg = array(); $reg = array();
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) { if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution') if ($reg[1] == 'socialcontribution') {
$reg[1] = 'SocialContribution'; $reg[1] = 'SocialContribution';
}
$chargestatic->label = $langs->trans($reg[1]); $chargestatic->label = $langs->trans($reg[1]);
} else { } else {
$chargestatic->label = $links[$key]['label']; $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. // 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'. // 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) { foreach ($links as $key => $val) {
if ($links[$key]['type'] == 'payment') { if ($links[$key]['type'] == 'payment') {
// Get thirdparty // Get thirdparty
$tmppayment->fetch($links[$key]['url_id']); $tmppayment->fetch($links[$key]['url_id']);
$arrayofamounts = $tmppayment->getAmountsArray(); $arrayofamounts = $tmppayment->getAmountsArray();
if (is_array($arrayofamounts)) { if (is_array($arrayofamounts)) {
foreach ($arrayofamounts as $invoiceid => $amount) foreach ($arrayofamounts as $invoiceid => $amount) {
{
$tmpinvoice->fetch($invoiceid); $tmpinvoice->fetch($invoiceid);
$tmpinvoice->fetch_thirdparty(); $tmpinvoice->fetch_thirdparty();
if ($tmpinvoice->thirdparty->code_compta) if ($tmpinvoice->thirdparty->code_compta) {
{
$tabtp[$obj->rowid][$tmpinvoice->thirdparty->code_compta] += $amount; $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 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 // Check account number is ok
/*if ($action == 'writebookkeeping') // Make test now in such a case /*if ($action == 'writebookkeeping') // Make test now in such a case
@ -494,8 +501,7 @@ if (!$error && $action == 'writebookkeeping') {
$now = dol_now(); $now = dol_now();
$error = 0; $error = 0;
foreach ($tabpay as $key => $val) // $key is rowid into llx_bank foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank
{
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]); $ref = getSourceDocRef($val, $tabtype[$key]);
@ -513,17 +519,18 @@ if (!$error && $action == 'writebookkeeping') {
var_dump($tabbq);exit;*/ var_dump($tabbq);exit;*/
// Bank // Bank
if (!$errorforline && is_array($tabbq[$key])) if (!$errorforline && is_array($tabbq[$key])) {
{
// Line into bank account // Line into bank account
foreach ($tabbq[$key] as $k => $mt) foreach ($tabbq[$key] as $k => $mt) {
{ if ($mt) {
if ($mt)
{
$reflabel = ''; $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']); $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 = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
@ -556,8 +563,7 @@ if (!$error && $action == 'writebookkeeping') {
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
if ($result < 0) { if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); 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 // Third party
if (!$errorforline) if (!$errorforline) {
{ if (is_array($tabtp[$key])) {
if (is_array($tabtp[$key]))
{
// Line into thirdparty account // Line into thirdparty account
foreach ($tabtp[$key] as $k => $mt) { foreach ($tabtp[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $reflabel = '';
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); if (!empty($val['lib'])) {
if ($tabtype[$key] == 'banktransfert') $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
{ }
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
} else { } else {
$reflabel .= dol_string_nohtmltag($val['soclib']); $reflabel .= dol_string_nohtmltag($val['soclib']);
@ -683,8 +687,7 @@ if (!$error && $action == 'writebookkeeping') {
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
} else { } else {
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty. if ($tabtype[$key] == 'unknown') { // Unknown transaction, we will use a waiting account for thirdparty.
{
// Temporary account // Temporary account
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
@ -702,8 +705,7 @@ if (!$error && $action == 'writebookkeeping') {
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
if ($result < 0) { if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); 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 } else { // If thirdparty unknown, output the waiting account
foreach ($tabbq[$key] as $k => $mt) { foreach ($tabbq[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $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'); $reflabel .= dol_string_nohtmltag('WaitingAccount');
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
@ -747,8 +750,7 @@ if (!$error && $action == 'writebookkeeping') {
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
if ($result < 0) { if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); 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++; $error++;
$errorforline++; $errorforline++;
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors'); setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
} }
if (!$errorforline) if (!$errorforline) {
{
$db->commit(); $db->commit();
} else { } else {
//print 'KO for line '.$key.' '.$error.'<br>'; //print 'KO for line '.$key.' '.$error.'<br>';
$db->rollback(); $db->rollback();
$MAXNBERRORS = 5; $MAXNBERRORS = 5;
if ($error >= $MAXNBERRORS) if ($error >= $MAXNBERRORS) {
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors'); setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
break; // Break in the foreach break; // Break in the foreach
} }
@ -788,8 +787,7 @@ if (!$error && $action == 'writebookkeeping') {
if (empty($error) && count($tabpay) > 0) { if (empty($error) && count($tabpay) > 0) {
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
} elseif (count($tabpay) == $error) } elseif (count($tabpay) == $error) {
{
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
} else { } else {
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
@ -798,8 +796,7 @@ if (!$error && $action == 'writebookkeeping') {
$action = ''; $action = '';
// Must reload data, so we make a redirect // Must reload data, so we make a redirect
if (count($tabpay) != $error) if (count($tabpay) != $error) {
{
$param = 'id_journal='.$id_journal; $param = 'id_journal='.$id_journal;
$param .= '&date_startday='.$date_startday; $param .= '&date_startday='.$date_startday;
$param .= '&date_startmonth='.$date_startmonth; $param .= '&date_startmonth='.$date_startmonth;
@ -837,20 +834,22 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep; print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
print "\n"; print "\n";
foreach ($tabpay as $key => $val) foreach ($tabpay as $key => $val) {
{
$date = dol_print_date($db->jdate($val["date"]), 'day'); $date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]); $ref = getSourceDocRef($val, $tabtype[$key]);
// Bank // Bank
foreach ($tabbq[$key] as $k => $mt) { foreach ($tabbq[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $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']); $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 '"'.$key.'"'.$sep;
print '"'.$date.'"'.$sep; print '"'.$date.'"'.$sep;
@ -870,12 +869,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
// Third party // Third party
if (is_array($tabtp[$key])) { if (is_array($tabtp[$key])) {
foreach ($tabtp[$key] as $k => $mt) { foreach ($tabtp[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $reflabel = '';
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : ""); if (!empty($val['lib'])) {
if ($tabtype[$key] == 'banktransfert') $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
{ }
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
} else { } else {
$reflabel .= dol_string_nohtmltag($val['soclib']); $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 } else { // If thirdparty unkown, output the waiting account
foreach ($tabbq[$key] as $k => $mt) { foreach ($tabbq[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $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'); $reflabel .= dol_string_nohtmltag('WaitingAccount');
print '"'.$key.'"'.$sep; 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) // 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'; $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); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj->nb > 0) if ($obj->nb > 0) {
{
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>'); $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 9, '{link}');
$desc = str_replace('{link}', '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>', $desc);
print $desc;
print '</div>'; print '</div>';
} }
} else dol_print_error($db); } else {
dol_print_error($db);
}
// Button to write into Ledger // Button to write into Ledger
@ -990,14 +992,19 @@ if (empty($action) || $action == 'view') {
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />'; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') {
print '<input type="button" class="butAction" name="exportcsv" value="'.$langs->trans("ExportDraftJournal").'" onclick="launch_export();" />';
}
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="'.$langs->trans("WriteBookKeeping").'" />';
} else { } else {
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />'; if ($in_bookkeeping == 'notyet') {
else print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>'; print '<input type="button" class="butAction" name="writebookkeeping" value="'.$langs->trans("WriteBookKeeping").'" onclick="writebookkeeping();" />';
} else {
print '<a class="butActionRefused classfortooltip" name="writebookkeeping">'.$langs->trans("WriteBookKeeping").'</a>';
}
} }
print '</div>'; print '</div>';
@ -1040,21 +1047,22 @@ if (empty($action) || $action == 'view') {
$r = ''; $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'); $date = dol_print_date($db->jdate($val["date"]), 'day');
$ref = getSourceDocRef($val, $tabtype[$key]); $ref = getSourceDocRef($val, $tabtype[$key]);
// Bank // Bank
foreach ($tabbq[$key] as $k => $mt) foreach ($tabbq[$key] as $k => $mt) {
{ if ($mt) {
if ($mt)
{
$reflabel = ''; $reflabel = '';
if (!empty($val['lib'])) $reflabel .= $val['lib']." - "; if (!empty($val['lib'])) {
$reflabel .= $val['lib']." - ";
}
$reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref']; $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]); //var_dump($tabpay[$key]);
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->'; print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
@ -1064,10 +1072,11 @@ if (empty($action) || $action == 'view') {
// Ledger account // Ledger account
print "<td>"; print "<td>";
$accounttoshow = length_accountg($k); $accounttoshow = length_accountg($k);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
{
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>'; print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
} else print $accounttoshow; } else {
print $accounttoshow;
}
print "</td>"; print "</td>";
// Subledger account // Subledger account
print "<td>"; print "<td>";
@ -1091,12 +1100,12 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
if (is_array($tabtp[$key])) { if (is_array($tabtp[$key])) {
foreach ($tabtp[$key] as $k => $mt) { foreach ($tabtp[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $reflabel = '';
if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : ""); if (!empty($val['lib'])) {
if ($tabtype[$key] == 'banktransfert') $reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
{ }
if ($tabtype[$key] == 'banktransfert') {
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
} else { } else {
$reflabel .= $val['soclib']; $reflabel .= $val['soclib'];
@ -1110,21 +1119,32 @@ if (empty($action) || $action == 'view') {
print "<td>"; print "<td>";
$account_ledger = $k; $account_ledger = $k;
// Try to force general ledger account depending on type // Try to force general ledger account depending on type
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; if ($tabtype[$key] == 'payment') {
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
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_supplier') {
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
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_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); $accounttoshow = length_accountg($account_ledger);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
{ if ($tabtype[$key] == 'unknown') {
if ($tabtype[$key] == 'unknown')
{
// We will accept writing, but into a waiting account // 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 '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>'; print '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
} else { } else {
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
@ -1132,32 +1152,42 @@ if (empty($action) || $action == 'view') {
} else { } else {
// We will refuse writing // We will refuse writing
$errorstring = 'UnknownAccountForThirdpartyBlocking'; $errorstring = 'UnknownAccountForThirdpartyBlocking';
if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined'; if ($tabtype[$key] == 'payment') {
if ($tabtype[$key] == 'payment_supplier') $errorstring = 'MainAccountForSuppliersNotDefined'; $errorstring = 'MainAccountForCustomersNotDefined';
if ($tabtype[$key] == 'payment_expensereport') $errorstring = 'MainAccountForUsersNotDefined'; }
if ($tabtype[$key] == 'payment_salary') $errorstring = 'MainAccountForUsersNotDefined'; if ($tabtype[$key] == 'payment_supplier') {
if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined'; $errorstring = 'MainAccountForSuppliersNotDefined';
if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined'; }
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 '<span class="error">'.$langs->trans($errorstring).'</span>'; print '<span class="error">'.$langs->trans($errorstring).'</span>';
} }
} else print $accounttoshow; } else {
print $accounttoshow;
}
print "</td>"; print "</td>";
// Subledger account // Subledger account
print "<td>"; print "<td>";
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); $accounttoshowsubledger = length_accounta($k);
if ($accounttoshow != $accounttoshowsubledger) if ($accounttoshow != $accounttoshowsubledger) {
{ if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
{
/*var_dump($tabpay[$key]); /*var_dump($tabpay[$key]);
var_dump($tabtype[$key]); var_dump($tabtype[$key]);
var_dump($tabbq[$key]);*/ var_dump($tabbq[$key]);*/
//print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; //print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
if (!empty($tabcompany[$key]['code_compta'])) if (!empty($tabcompany[$key]['code_compta'])) {
{
if (in_array($tabtype[$key], array('payment_various'))) { if (in_array($tabtype[$key], array('payment_various'))) {
// For such case, if subledger is not defined, we won't use subledger accounts. // For such case, if subledger is not defined, we won't use subledger accounts.
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>'; print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
@ -1167,7 +1197,9 @@ if (empty($action) || $action == 'view') {
} else { } else {
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>'; print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
} }
} else print $accounttoshowsubledger; } else {
print $accounttoshowsubledger;
}
} }
} }
print "</td>"; print "</td>";
@ -1180,10 +1212,11 @@ if (empty($action) || $action == 'view') {
} }
} else { // Waiting account } else { // Waiting account
foreach ($tabbq[$key] as $k => $mt) { foreach ($tabbq[$key] as $k => $mt) {
if ($mt) if ($mt) {
{
$reflabel = ''; $reflabel = '';
if (!empty($val['lib'])) $reflabel .= $val['lib']." - "; if (!empty($val['lib'])) {
$reflabel .= $val['lib']." - ";
}
$reflabel .= 'WaitingAccount'; $reflabel .= 'WaitingAccount';
print '<!-- Wait bank.rowid='.$key.' -->'; print '<!-- Wait bank.rowid='.$key.' -->';
@ -1267,78 +1300,67 @@ function getSourceDocRef($val, $typerecord)
} }
$sqlmid = ''; $sqlmid = '';
if ($typerecord == 'payment') if ($typerecord == 'payment') {
{
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref'; $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 .= " 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"]; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
$ref = $langs->transnoentitiesnoconv("Invoice"); $ref = $langs->transnoentitiesnoconv("Invoice");
} elseif ($typerecord == 'payment_supplier') } elseif ($typerecord == 'payment_supplier') {
{
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref'; $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 .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"]; $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
$ref = $langs->transnoentitiesnoconv("SupplierInvoice"); $ref = $langs->transnoentitiesnoconv("SupplierInvoice");
} elseif ($typerecord == 'payment_expensereport') } elseif ($typerecord == 'payment_expensereport') {
{
$sqlmid = 'SELECT e.rowid as id, e.ref'; $sqlmid = 'SELECT e.rowid as id, e.ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
$sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid"; $sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
$ref = $langs->transnoentitiesnoconv("ExpenseReport"); $ref = $langs->transnoentitiesnoconv("ExpenseReport");
} elseif ($typerecord == 'payment_salary') } elseif ($typerecord == 'payment_salary') {
{
$sqlmid = 'SELECT s.rowid as ref'; $sqlmid = 'SELECT s.rowid as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sqlmid .= " WHERE s.rowid=".$val["paymentsalid"]; $sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
$ref = $langs->transnoentitiesnoconv("SalaryPayment"); $ref = $langs->transnoentitiesnoconv("SalaryPayment");
} elseif ($typerecord == 'sc') } elseif ($typerecord == 'sc') {
{
$sqlmid = 'SELECT sc.rowid as ref'; $sqlmid = 'SELECT sc.rowid as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
$sqlmid .= " WHERE sc.rowid=".$val["paymentscid"]; $sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
$ref = $langs->transnoentitiesnoconv("SocialContribution"); $ref = $langs->transnoentitiesnoconv("SocialContribution");
} elseif ($typerecord == 'payment_vat') } elseif ($typerecord == 'payment_vat') {
{
$sqlmid = 'SELECT v.rowid as ref'; $sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
$sqlmid .= " WHERE v.rowid=".$val["paymentvatid"]; $sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
$ref = $langs->transnoentitiesnoconv("PaymentVat"); $ref = $langs->transnoentitiesnoconv("PaymentVat");
} elseif ($typerecord == 'payment_donation') } elseif ($typerecord == 'payment_donation') {
{
$sqlmid = 'SELECT payd.fk_donation as ref'; $sqlmid = 'SELECT payd.fk_donation as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
$sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"]; $sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
$ref = $langs->transnoentitiesnoconv("Donation"); $ref = $langs->transnoentitiesnoconv("Donation");
} elseif ($typerecord == 'payment_loan') } elseif ($typerecord == 'payment_loan') {
{
$sqlmid = 'SELECT l.rowid as ref'; $sqlmid = 'SELECT l.rowid as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
$sqlmid .= " WHERE l.rowid=".$val["paymentloanid"]; $sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
$ref = $langs->transnoentitiesnoconv("LoanPayment"); $ref = $langs->transnoentitiesnoconv("LoanPayment");
} elseif ($typerecord == 'payment_various') } elseif ($typerecord == 'payment_various') {
{
$sqlmid = 'SELECT v.rowid as ref'; $sqlmid = 'SELECT v.rowid as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"]; $sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
$ref = $langs->transnoentitiesnoconv("VariousPayment"); $ref = $langs->transnoentitiesnoconv("VariousPayment");
} }
// Add warning // Add warning
if (empty($sqlmid)) if (empty($sqlmid)) {
{
dol_syslog("Found a typerecord=".$typerecord." not supported", LOG_WARNING); dol_syslog("Found a typerecord=".$typerecord." not supported", LOG_WARNING);
} }
if ($sqlmid) if ($sqlmid) {
{
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) if ($resultmid) {
{ while ($objmid = $db->fetch_object($resultmid)) {
while ($objmid = $db->fetch_object($resultmid))
{
$ref .= ' '.$objmid->ref; $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 $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300

View File

@ -103,6 +103,7 @@ class Adherent extends CommonObject
* @var int Thirdparty ID * @var int Thirdparty ID
*/ */
public $fk_soc; public $fk_soc;
public $socid;
/** /**
* @var string Address * @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."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 .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
$sql .= " WHERE d.fk_adherent_type = t.rowid"; $sql .= " WHERE d.fk_adherent_type = t.rowid";
if ($rowid) if ($rowid) {
$sql .= " AND d.rowid=".$rowid; $sql .= " AND d.rowid=".((int) $rowid);
elseif ($ref || $fk_soc) { } elseif ($ref || $fk_soc) {
$sql .= " AND d.entity IN (".getEntity('adherent').")"; $sql .= " AND d.entity IN (".getEntity('adherent').")";
if ($ref) if ($ref) {
$sql .= " AND d.rowid='".$this->db->escape($ref)."'"; $sql .= " AND d.rowid='".$this->db->escape($ref)."'";
elseif ($fk_soc > 0) } elseif ($fk_soc > 0) {
$sql .= " AND d.fk_soc=".$fk_soc; $sql .= " AND d.fk_soc=".((int) $fk_soc);
}
} elseif ($ref_ext) { } elseif ($ref_ext) {
$sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'"; $sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'";
} }

View File

@ -292,7 +292,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -391,7 +391,7 @@ foreach ($dirmodels as $reldir) {
// Preview // Preview
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') { if ($module->type == 'pdf') {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -31,7 +31,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('admin', 'boxes', 'accountancy')); $langs->loadLangs(array('admin', 'boxes', 'accountancy'));
if (!$user->admin) accessforbidden(); if (!$user->admin) {
accessforbidden();
}
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -46,8 +48,7 @@ $boxes = array();
* Actions * 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_BOXES_MAXLINES", $_POST["MAIN_BOXES_MAXLINES"], '', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"], 'chaine', 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(); $db->begin();
if (is_array($boxids)) { if (is_array($boxids)) {
foreach ($boxids as $boxid) { 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']; $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") // 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; $sql .= " AND entity = ".$conf->entity;
dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$distinctfkuser[$obj->fk_user] = $obj->fk_user; $distinctfkuser[$obj->fk_user] = $obj->fk_user;
$i++; $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 $distinctfkuser['0'] = '0'; // Add entry for fk_user = 0. We must use string as key and val
foreach ($distinctfkuser as $fk_user) foreach ($distinctfkuser as $fk_user) {
{ if (!$error && $fk_user != '') {
if (!$error && $fk_user != '')
{
$arrayofexistingboxid = array(); $arrayofexistingboxid = array();
$nbboxonleft = $nbboxonright = 0; $nbboxonleft = $nbboxonright = 0;
$sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes"; $sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; $sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
dol_syslog("boxes.php activate box", LOG_DEBUG); dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{ while ($obj = $db->fetch_object($resql)) {
while ($obj = $db->fetch_object($resql))
{
$boxorder = $obj->box_order; $boxorder = $obj->box_order;
if (preg_match('/A/', $boxorder)) $nbboxonleft++; if (preg_match('/A/', $boxorder)) {
if (preg_match('/B/', $boxorder)) $nbboxonright++; $nbboxonleft++;
}
if (preg_match('/B/', $boxorder)) {
$nbboxonright++;
}
$arrayofexistingboxid[$obj->box_id] = 1; $arrayofexistingboxid[$obj->box_id] = 1;
} }
} else dol_print_error($db); } else {
dol_print_error($db);
}
if (empty($arrayofexistingboxid[$boxid['value']])) { if (empty($arrayofexistingboxid[$boxid['value']])) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
@ -120,8 +120,7 @@ if ($action == 'add') {
dol_syslog("boxes.php activate box", LOG_DEBUG); dol_syslog("boxes.php activate box", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if (!$resql) if (!$resql) {
{
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
$error++; $error++;
} }
@ -133,8 +132,7 @@ if ($action == 'add') {
} }
} }
} }
if (!$error) if (!$error) {
{
$db->commit(); $db->commit();
$action = ''; $action = '';
} else { } else {
@ -142,15 +140,13 @@ if ($action == 'add') {
} }
} }
if ($action == 'delete') if ($action == 'delete') {
{
$sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes"; $sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes";
$sql .= " WHERE rowid=".((int) $rowid); $sql .= " WHERE rowid=".((int) $rowid);
$resql = $db->query($sql); $resql = $db->query($sql);
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (!empty($obj->box_id)) if (!empty($obj->box_id)) {
{
$db->begin(); $db->begin();
// Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes) // 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 // We switch values of field box_order for the 2 lines of table boxes
$db->begin(); $db->begin();
@ -181,12 +176,10 @@ if ($action == 'switch')
$resultupdatefrom = 0; $resultupdatefrom = 0;
$resultupdateto = 0; $resultupdateto = 0;
if (is_object($objfrom) && is_object($objto)) if (is_object($objfrom) && is_object($objto)) {
{
$newfirst = $objto->box_order; $newfirst = $objto->box_order;
$newsecond = $objfrom->box_order; $newsecond = $objfrom->box_order;
if ($newfirst == $newsecond) if ($newfirst == $newsecond) {
{
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond); $newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond); $newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1); $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); $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
dol_syslog($sql); dol_syslog($sql);
$resultupdatefrom = $db->query($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); $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newsecond)."' WHERE rowid=".((int) $objto->rowid);
dol_syslog($sql); dol_syslog($sql);
$resultupdateto = $db->query($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(); $db->commit();
} else { } else {
$db->rollback(); $db->rollback();
@ -240,33 +236,31 @@ $sql .= " ORDER by b.position, b.box_order";
dol_syslog("Search available boxes", LOG_DEBUG); dol_syslog("Search available boxes", LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
// Check record to know if we must recalculate sort order // Check record to know if we must recalculate sort order
$i = 0; $i = 0;
$decalage = 0; $decalage = 0;
while ($i < $num) while ($i < $num) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$boxes[$obj->position][$obj->box_id] = 1; $boxes[$obj->position][$obj->box_id] = 1;
$i++; $i++;
array_push($actives, $obj->box_id); 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 '' // We renumber the order of the boxes if one of them is in ''
// This occurs just after an insert. // 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; $sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($decalage)."' WHERE rowid=".$obj->rowid;
$db->query($sql); $db->query($sql);
} }
} }
if ($decalage) if ($decalage) {
{
// If we have renumbered, we correct the field box_order // If we have renumbered, we correct the field box_order
// This occurs just after an insert. // This occurs just after an insert.
$sql = "SELECT box_order"; $sql = "SELECT box_order";
@ -276,32 +270,24 @@ if ($resql)
dol_syslog("Execute requests to renumber box order", LOG_DEBUG); dol_syslog("Execute requests to renumber box order", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result) {
{ while ($record = $db->fetch_array($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 (dol_strlen($record['box_order']) == 1)
{
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1)))
{
$box_order = "A0".$record['box_order']; $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'])."'"; $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); $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']; $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'])."'"; $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); $resql = $db->query($sql);
} }
} elseif (dol_strlen($record['box_order']) == 2) } elseif (dol_strlen($record['box_order']) == 2) {
{ if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) {
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1)))
{
$box_order = "A".$record['box_order']; $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'])."'"; $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); $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']; $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'])."'"; $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); $resql = $db->query($sql);
@ -336,10 +322,8 @@ print '<td>'.$langs->trans("SourceFile").'</td>';
print '<td width="160" class="center">'.$langs->trans("ActivateOn").'</td>'; print '<td width="160" class="center">'.$langs->trans("ActivateOn").'</td>';
print "</tr>\n"; print "</tr>\n";
foreach ($boxtoadd as $box) foreach ($boxtoadd as $box) {
{ if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
{
$logo = $box->boximg; $logo = $box->boximg;
} else { } else {
$logo = preg_replace("/^object_/i", "", $box->boximg); $logo = preg_replace("/^object_/i", "", $box->boximg);
@ -348,14 +332,17 @@ foreach ($boxtoadd as $box)
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n"; print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel); print '<td>'.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 '</td>'."\n"; print '</td>'."\n";
print '<td>'; print '<td>';
if ($box->note == '(WarningUsingThisBoxSlowDown)') if ($box->note == '(WarningUsingThisBoxSlowDown)') {
{
$langs->load("errors"); $langs->load("errors");
print $langs->trans("WarningUsingThisBoxSlowDown"); print $langs->trans("WarningUsingThisBoxSlowDown");
} else print ($box->note ? $box->note : '&nbsp;'); } else {
print ($box->note ? $box->note : '&nbsp;');
}
print '</td>'."\n"; print '</td>'."\n";
print '<td>'.$box->sourcefile.'</td>'."\n"; print '<td>'.$box->sourcefile.'</td>'."\n";
@ -367,8 +354,7 @@ foreach ($boxtoadd as $box)
print '</tr>'."\n"; print '</tr>'."\n";
} }
if (!count($boxtoadd) && count($boxactivated)) if (!count($boxtoadd) && count($boxactivated)) {
{
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("AllWidgetsWereEnabled").'</td></tr>'; print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("AllWidgetsWereEnabled").'</td></tr>';
} }
print '</table>'."\n"; print '</table>'."\n";
@ -398,10 +384,8 @@ print '</tr>'."\n";
$box_order = 1; $box_order = 1;
$foundrupture = 1; $foundrupture = 1;
foreach ($boxactivated as $key => $box) foreach ($boxactivated as $key => $box) {
{ if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
{
$logo = $box->boximg; $logo = $box->boximg;
} else { } else {
$logo = preg_replace("/^object_/i", "", $box->boximg); $logo = preg_replace("/^object_/i", "", $box->boximg);
@ -410,14 +394,17 @@ foreach ($boxactivated as $key => $box)
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n"; print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.img_object("", $logo, 'height="14px"').' '.$langs->transnoentitiesnoconv($box->boxlabel); print '<td>'.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 '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($box->note == '(WarningUsingThisBoxSlowDown)') if ($box->note == '(WarningUsingThisBoxSlowDown)') {
{
$langs->load("errors"); $langs->load("errors");
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown"); print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
} else print ($box->note ? $box->note : '&nbsp;'); } else {
print ($box->note ? $box->note : '&nbsp;');
}
print '</td>'; print '</td>';
print '<td class="center">'.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).'</td>'; print '<td class="center">'.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).'</td>';
$hasnext = ($key < (count($boxactivated) - 1)); $hasnext = ($key < (count($boxactivated) - 1));
@ -446,6 +433,7 @@ print load_fiche_titre($langs->trans("Other"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="addconst">'; print '<input type="hidden" name="action" value="addconst">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -471,6 +459,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVA
} }
print '</table>'; print '</table>';
print '</div>';
print '<br>'; print '<br>';
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'" name="Button"></div>'; print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'" name="Button"></div>';

View File

@ -484,7 +484,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -728,7 +728,7 @@ if ($mysoc->useLocalTax(1))
print '<div class="nobordernopadding">'; print '<div class="nobordernopadding">';
$tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code); $tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : ""); $tooltiphelp = ($tooltiphelp != "LocalTax1IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code)."</i>\n" : "");
print "<label for=\"lt1\">".$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>"; print '<label for="lt1">'.$form->textwithpicto($langs->transcountry("LocalTax1IsUsedDesc", $mysoc->country_code), $tooltiphelp)."</label>";
if (!isOnlyOneLocalTax(1)) if (!isOnlyOneLocalTax(1))
{ {
print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: '; print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
@ -751,9 +751,9 @@ if ($mysoc->useLocalTax(1))
} else { } else {
if (empty($mysoc->country_code)) if (empty($mysoc->country_code))
{ {
print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>'; print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else { } else {
print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>'; print '<tr class="oddeven nohover"><td class="" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax1Management")).'</td></tr>';
} }
} }
@ -773,7 +773,7 @@ if ($mysoc->useLocalTax(2))
print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>"; print "<tr class=\"oddeven\"><td><input type=\"radio\" name=\"optionlocaltax2\" id=\"lt2\" value=\"localtax2on\"".(($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on") ? " checked" : "")."> ".$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code)."</td>";
print '<td colspan="2">'; print '<td colspan="2">';
print '<div class="nobordernopadding">'; print '<div class="nobordernopadding">';
print "<label for=\"lt2\">".$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>"; print '<label for="lt2">'.$langs->transcountry("LocalTax2IsUsedDesc", $mysoc->country_code)."</label>";
$tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code); $tooltiphelp = $langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code);
$tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : ""); $tooltiphelp = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
if (!isOnlyOneLocalTax(2)) if (!isOnlyOneLocalTax(2))
@ -797,9 +797,9 @@ if ($mysoc->useLocalTax(2))
} else { } else {
if (empty($mysoc->country_code)) if (empty($mysoc->country_code))
{ {
print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>'; print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else { } else {
print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>'; print '<tr class="oddeven nohover"><td class="" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryVAT"), $langs->transnoentitiesnoconv("LocalTax2Management")).'</td></tr>';
} }
} }
@ -825,9 +825,9 @@ if ($mysoc->useRevenueStamp())
} else { } else {
if (empty($mysoc->country_code)) if (empty($mysoc->country_code))
{ {
print '<tr class="oddeven nohover"><td class="opacitymedium">'.$countrynotdefined.'</td><td></td><td></td></tr>'; print '<tr class="oddeven nohover"><td class="">'.$countrynotdefined.'</td><td></td><td></td></tr>';
} else { } else {
print '<tr class="oddeven nohover"><td class="opacitymedium" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>'; print '<tr class="oddeven nohover"><td class="" colspan="3">'.$langs->trans("NoLocalTaxXForThisCountry", $langs->transnoentitiesnoconv("Setup"), $langs->transnoentitiesnoconv("Dictionaries"), $langs->transnoentitiesnoconv("DictionaryRevenueStamp"), $langs->transnoentitiesnoconv("RevenueStamp")).'</td></tr>';
} }
} }

View File

@ -414,7 +414,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'sending').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -682,7 +682,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
{ {
// Discard check of mandatory fields for country for some tables // 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_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 // Discard check of mandatory fiedls for other fields
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue; if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue; if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;

View File

@ -223,21 +223,6 @@ $help_url = "EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électro
llxHeader('', 'EmailCollector', $help_url); llxHeader('', 'EmailCollector', $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
// Part to create // Part to create
if ($action == 'create') { if ($action == 'create') {
print load_fiche_titre($langs->trans("NewEmailCollector", $langs->transnoentitiesnoconv("EmailCollector"))); 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) if (!$connection)
{ {
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource; $morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
$morehtml .= '<br>'.imap_last_error();
//var_dump(imap_errors())
} else { } else {
$morehtml .= imap_num_msg($connection); $morehtml .= imap_num_msg($connection);
} }

View File

@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -411,7 +411,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -549,7 +549,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -467,7 +467,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'intervention').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -426,7 +426,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -100,9 +100,12 @@ if ($action == 'update')
$form = new Form($db); $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 $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) if (!empty($aCurrencies) && count($aCurrencies) > 1)
{ {
$head = multicurrencyLimitPrepareHead($aCurrencies); $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 '</form>'; print '</form>';
print '<br>'; print '<br>';
} else { } else {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -191,6 +196,7 @@ if ($action == 'edit')
print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>'; print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot) ? $conf->global->$mainroundingruletot : $conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>';
print '</table>'; print '</table>';
print '</div>';
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '&currencycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';

View File

@ -1074,7 +1074,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td class="center">'; print '<td class="center">';
if ($context == 'edit' && !empty($obj->{$fieldlist[$field]}) && !in_array($obj->{$fieldlist[$field]}, array_keys($elementList))) 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 '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">'; print '<input type="hidden" name="type_template" value="'.$obj->{$fieldlist[$field]}.'">';
print $obj->{$fieldlist[$field]}; print $obj->{$fieldlist[$field]};
} else { } else {

File diff suppressed because it is too large Load Diff

View File

@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -340,7 +340,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} }
else else
{ {

View File

@ -347,7 +347,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} }
else else
{ {

View File

@ -444,7 +444,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -424,7 +424,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -30,15 +31,16 @@ $langs->loadLangs(array("companies", "admin", "products", "sms", "other", "error
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
if (!$user->admin) if (!$user->admin) {
accessforbidden(); accessforbidden();
}
$substitutionarrayfortest = array( $substitutionarrayfortest = array(
'__ID__' => 'TESTIdRecord', '__ID__' => 'TESTIdRecord',
'__PHONEFROM__' => 'TESTPhoneFrom', '__PHONEFROM__' => 'TESTPhoneFrom',
'__PHONETO__' => 'TESTPhoneTo', '__PHONETO__' => 'TESTPhoneTo',
'__LASTNAME__' => 'TESTLastname', '__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname' '__FIRSTNAME__' => 'TESTFirstname'
); );
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -48,8 +50,7 @@ $action = GETPOST('action', 'aZ09');
* Actions * Actions
*/ */
if ($action == 'update' && !$cancel) if ($action == 'update' && !$cancel) {
{
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", GETPOST("MAIN_DISABLE_ALL_SMS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", GETPOST("MAIN_DISABLE_ALL_SMS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphanohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
@ -64,13 +65,16 @@ if ($action == 'update' && !$cancel)
/* /*
* Send sms * Send sms
*/ */
if ($action == 'send' && !$_POST['cancel']) if ($action == 'send' && !$_POST['cancel']) {
{
$error = 0; $error = 0;
$smsfrom = ''; $smsfrom = '';
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms", 'alphanohtml'); if (!empty($_POST["fromsms"])) {
if (empty($smsfrom)) $smsfrom = GETPOST("fromname", 'alphanohtml'); $smsfrom = GETPOST("fromsms", 'alphanohtml');
}
if (empty($smsfrom)) {
$smsfrom = GETPOST("fromname", 'alphanohtml');
}
$sendto = GETPOST("sendto", 'alphanohtml'); $sendto = GETPOST("sendto", 'alphanohtml');
$body = GETPOST('message', 'alphanohtml'); $body = GETPOST('message', 'alphanohtml');
$deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml'); $deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml');
@ -83,32 +87,27 @@ if ($action == 'send' && !$_POST['cancel'])
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
$formsms = new FormSms($db); $formsms = new FormSms($db);
if (!empty($formsms->error)) if (!empty($formsms->error)) {
{
setEventMessages($formsms->error, $formsms->errors, 'errors'); setEventMessages($formsms->error, $formsms->errors, 'errors');
$action = 'test'; $action = 'test';
$error++; $error++;
} }
if (empty($body)) if (empty($body)) {
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
$action = 'test'; $action = 'test';
$error++; $error++;
} }
if (empty($smsfrom) || !str_replace('+', '', $smsfrom)) if (empty($smsfrom) || !str_replace('+', '', $smsfrom)) {
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")), null, 'errors');
$action = 'test'; $action = 'test';
$error++; $error++;
} }
if (empty($sendto) || !str_replace('+', '', $sendto)) if (empty($sendto) || !str_replace('+', '', $sendto)) {
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")), null, 'errors');
$action = 'test'; $action = 'test';
$error++; $error++;
} }
if (!$error) if (!$error) {
{
// Make substitutions into message // Make substitutions into message
complete_substitutions_array($substitutionarrayfortest, $langs); complete_substitutions_array($substitutionarrayfortest, $langs);
$body = make_substitutions($body, $substitutionarrayfortest); $body = make_substitutions($body, $substitutionarrayfortest);
@ -118,8 +117,7 @@ if ($action == 'send' && !$_POST['cancel'])
$smsfile = new CSMSFile($sendto, $smsfrom, $body, $deliveryreceipt, $deferred, $priority, $class); // This define OvhSms->login, pass, session and account $smsfile = new CSMSFile($sendto, $smsfrom, $body, $deliveryreceipt, $deferred, $priority, $class); // This define OvhSms->login, pass, session and account
$result = $smsfile->sendfile(); // This send SMS $result = $smsfile->sendfile(); // This send SMS
if ($result) if ($result) {
{
setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs'); setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs');
setEventMessages($smsfile->error, $smsfile->errors, 'mesgs'); setEventMessages($smsfile->error, $smsfile->errors, 'mesgs');
} else { } else {
@ -138,8 +136,12 @@ if ($action == 'send' && !$_POST['cancel'])
*/ */
$linuxlike = 1; $linuxlike = 1;
if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0; if (preg_match('/^win/i', PHP_OS)) {
if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0; $linuxlike = 0;
}
if (preg_match('/^mac/i', PHP_OS)) {
$linuxlike = 0;
}
$wikihelp = 'EN:Setup Sms|FR:Paramétrage Sms|ES:Configuración Sms'; $wikihelp = 'EN:Setup Sms|FR:Paramétrage Sms|ES:Configuración Sms';
llxHeader('', $langs->trans("Setup"), $wikihelp); llxHeader('', $langs->trans("Setup"), $wikihelp);
@ -153,11 +155,14 @@ print "<br>\n";
$listofmethods = (is_array($conf->modules_parts['sms']) ? $conf->modules_parts['sms'] : array()); $listofmethods = (is_array($conf->modules_parts['sms']) ? $conf->modules_parts['sms'] : array());
asort($listofmethods); asort($listofmethods);
if ($action == 'edit') if (!count($listofmethods)) {
{ $descnosms = $langs->trans("NoSmsEngine", '{Dolistore}');
$form = new Form($db); $descnosms = str_replace('{Dolistore}', '<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>', $descnosms);
print '<div class="warning">'.$descnosms.'</div>';
}
if (!count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine", '<a href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>'; if ($action == 'edit') {
$form = new Form($db);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@ -178,8 +183,11 @@ if ($action == 'edit')
// Method // Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
if (count($listofmethods)) print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, $conf->global->MAIN_SMS_SENDMODE, 1); if (count($listofmethods)) {
else print '<font class="error">'.$langs->trans("None").'</font>'; print $form->selectarray('MAIN_SMS_SENDMODE', $listofmethods, $conf->global->MAIN_SMS_SENDMODE, 1);
} else {
print '<font class="error">'.$langs->trans("None").'</font>';
}
print '</td></tr>'; print '</td></tr>';
// From // From
@ -204,8 +212,6 @@ if ($action == 'edit')
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} else { } else {
if (!count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine", '<a target="_blank" href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -218,14 +224,18 @@ if ($action == 'edit')
// Method // Method
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
$text = $listofmethods[$conf->global->MAIN_SMS_SENDMODE]; $text = $listofmethods[$conf->global->MAIN_SMS_SENDMODE];
if (empty($text)) $text = $langs->trans("Undefined").' '.img_warning(); if (empty($text)) {
$text = $langs->trans("Undefined").' '.img_warning();
}
print $text; print $text;
print '</td></tr>'; print '</td></tr>';
// From // From
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>';
print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM; print '<td>'.$conf->global->MAIN_MAIL_SMS_FROM;
if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && !isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) print ' '.img_warning($langs->trans("ErrorBadPhone")); if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && !isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) {
print ' '.img_warning($langs->trans("ErrorBadPhone"));
}
print '</td></tr>'; print '</td></tr>';
// Autocopy to // Autocopy to
@ -234,7 +244,7 @@ if ($action == 'edit')
print '<td>'.$conf->global->MAIN_MAIL_AUTOCOPY_TO; print '<td>'.$conf->global->MAIN_MAIL_AUTOCOPY_TO;
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>'; print '</td></tr>';
*/ */
print '</table>'; print '</table>';
@ -257,8 +267,7 @@ if ($action == 'edit')
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
}*/ }*/
if (count($listofmethods) && !empty($conf->global->MAIN_SMS_SENDMODE)) if (count($listofmethods) && !empty($conf->global->MAIN_SMS_SENDMODE)) {
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';
@ -290,8 +299,7 @@ if ($action == 'edit')
}*/ }*/
// Affichage formulaire de TEST simple // Affichage formulaire de TEST simple
if ($action == 'test') if ($action == 'test') {
{
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("DoTestSend")); print load_fiche_titre($langs->trans("DoTestSend"));

View File

@ -638,7 +638,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -426,7 +426,7 @@ foreach ($dirmodels as $reldir)
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -439,7 +439,7 @@ foreach ($dirmodels as $reldir)
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -412,7 +412,7 @@ foreach ($dirmodels as $reldir)
print $form->textwithpicto('', $htmltooltip, 1, 0); print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'order').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&amp;module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -437,7 +437,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -85,31 +85,37 @@ if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE)); if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, $conf->global->MAIN_VERSION_LAST_UPGRADE));
} }
$version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
$newversion = '';
if (function_exists('curl_init')) if (function_exists('curl_init'))
{ {
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10; $conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
print ' &nbsp; &nbsp; - &nbsp; &nbsp; '; print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
if ($action == 'getlastversion') if ($action == 'getlastversion') {
{ if ($sfurl) {
if ($sfurl) $i = 0;
{ while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) {
while (!empty($sfurl->channel[0]->item[$i]->title) && $i < 10000) $title = $sfurl->channel[0]->item[$i]->title;
{ $reg = array();
$title = $sfurl->channel[0]->item[$i]->title; if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) {
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg)) $newversion = $reg[1];
{ $newversionarray = explode('.', $newversion);
$newversion = $reg[1]; $versionarray = explode('.', $version);
$newversionarray = explode('.', $newversion); //var_dump($newversionarray);var_dump($versionarray);
$versionarray = explode('.', $version); if (versioncompare($newversionarray, $versionarray) > 0) $version = $newversion;
//var_dump($newversionarray);var_dump($versionarray); }
if (versioncompare($newversionarray, $versionarray) > 0) $version = $newversion; $i++;
} }
$i++;
}
// Show version // Show version
print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>'; print $langs->trans("LastStableVersion").' : <b>'.(($version != '0.0') ? $version : $langs->trans("Unknown")).'</b>';
} else { if ($version != '0.0') {
print ' &nbsp; <a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
}
} else {
print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>'; print $langs->trans("LastStableVersion").' : <b>'.$langs->trans("UpdateServerOffline").'</b>';
} }
} else { } else {
@ -118,12 +124,11 @@ if (function_exists('curl_init'))
} }
// Now show link to the changelog // Now show link to the changelog
print ' &nbsp; &nbsp; - &nbsp; &nbsp; '; //print ' &nbsp; &nbsp; - &nbsp; &nbsp; ';
$version = DOL_VERSION; $version = DOL_VERSION;
if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log. if (preg_match('/[a-z]+/i', $version)) $version = 'develop'; // If version contains text, it is not an official tagged version, so we use the full change log.
print '<a href="https://raw.githubusercontent.com/Dolibarr/dolibarr/'.$version.'/ChangeLog" target="_blank">'.$langs->trans("SeeChangeLog").'</a>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n"; print '<tr class="oddeven"><td>'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";

View File

@ -90,18 +90,18 @@ print '<table class="border centpercent">';
print '<tr class="border"><td style="padding: 4px">'; print '<tr class="border"><td style="padding: 4px">';
if (!empty($conf->syslog->enabled)) if (!empty($conf->syslog->enabled)) {
{
print '<input type="radio" name="choice" value="logfile"'; print '<input type="radio" name="choice" value="logfile"';
print ($choice && $choice == 'logfile') ? ' checked' : ''; print ($choice && $choice == 'logfile') ? ' checked' : '';
$filelogparam = $filelog; $filelogparam = $filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) {
{
$filelogparam = '<a class="wordbreak" href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='; $filelogparam = '<a class="wordbreak" href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam .= basename($filelog); $filelogparam .= basename($filelog);
$filelogparam .= '">'.$filelog.'</a>'; $filelogparam .= '">'.$filelog.'</a>';
} }
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam); $desc = $langs->trans("PurgeDeleteLogFile", '{filelogparam}');
$desc = str_replace('{filelogparam}', $filelogparam, $desc);
print '> '.$desc;
print '<br><br>'; print '<br><br>';
} }
@ -123,8 +123,7 @@ print '</td></tr></table>';
print '</form>'; print '</form>';
if (preg_match('/^confirm/i', $choice)) if (preg_match('/^confirm/i', $choice)) {
{
print '<br>'; print '<br>';
$formquestion = array(); $formquestion = array();
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2); print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2);

View File

@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -241,7 +241,7 @@ foreach ($dirmodels as $reldir)
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'contract').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
} else { } else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic'); print img_object($langs->trans("PreviewNotAvailable"), 'generic');
} }

View File

@ -160,7 +160,8 @@ if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/e
$url = DOL_MAIN_URL_ROOT.'/api/index.php/explorer'; $url = DOL_MAIN_URL_ROOT.'/api/index.php/explorer';
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n"; print img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
} else { } else {
print $langs->trans("NotAvailableWithThisDistribution"); $langs->load("errors");
print info_admin($langs->trans("ErrorNotAvailableWithThisDistribution"), 0, 0, 'error');
} }
llxFooter(); llxFooter();

View File

@ -113,6 +113,7 @@ class DolibarrApi
unset($object->error); unset($object->error);
unset($object->errors); unset($object->errors);
unset($object->errorhidden);
unset($object->ref_previous); unset($object->ref_previous);
unset($object->ref_next); unset($object->ref_next);

View File

@ -1608,6 +1608,14 @@ class Setup extends DolibarrApi
{ {
global $mysoc; global $mysoc;
unset($mysoc->skype);
unset($mysoc->twitter);
unset($mysoc->facebook);
unset($mysoc->linkedin);
unset($mysoc->note);
unset($mysoc->lines);
return $this->_cleanObjectDatas($mysoc); return $this->_cleanObjectDatas($mysoc);
} }

View File

@ -158,28 +158,6 @@ class Asset extends CommonObject
*/ */
public $status; public $status;
// If this object has a subtable with lines
/**
* @var int Name of subtable line
*/
//public $table_element_line = 'assetdet';
/**
* @var int Field with ID of parent key if this field has a parent
*/
//public $fk_element = 'fk_asset';
/**
* @var int Name of subtable class that manage subtable lines
*/
//public $class_element_line = 'Assetline';
/**
* @var array List of child tables. To test if we can delete object.
*/
//protected $childtables=array();
/**
* @var AssetLine[] Array of subtable lines
*/
//public $lines = array();
/** /**
* Constructor * Constructor

View File

@ -39,6 +39,8 @@ $block = new BlockedLog($db);
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden(); if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
$langs->loadLangs(array("admin"));
/* /*
* View * View

View File

@ -183,19 +183,19 @@ class BOM extends CommonObject
public $table_element_line = 'bom_bomline'; public $table_element_line = 'bom_bomline';
/** /**
* @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 = 'fk_bom'; public $fk_element = 'fk_bom';
/** /**
* @var int Name of subtable class that manage subtable lines * @var string Name of subtable class that manage subtable lines
*/ */
public $class_element_line = 'BOMLine'; public $class_element_line = 'BOMLine';
/** // /**
* @var array List of child tables. To test if we can delete object. // * @var array List of child tables. To test if we can delete object.
*/ // */
//protected $childtables=array(); // protected $childtables=array();
/** /**
* @var array List of child tables. To know object to delete on cascade. * @var array List of child tables. To know object to delete on cascade.

View File

@ -1104,7 +1104,7 @@ if ($action == 'create')
// Categories // Categories
print '<tr><td>'.$langs->trans("Categories").'</td><td>'; print '<tr><td>'.$langs->trans("Categories").'</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent', 0, 0); print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'minwidth300 quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>"; print "</td></tr>";
} }
@ -1578,7 +1578,7 @@ if ($id > 0)
foreach ($cats as $cat) { foreach ($cats as $cat) {
$arrayselected[] = $cat->id; $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 "</td></tr>"; print "</td></tr>";
} }

View File

@ -1492,19 +1492,19 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if ($nonew <= 0) if ($nonew <= 0)
{ {
print '<div class="tagtr"><div class="nowrap tagtd">'; print '<div class="tagtr"><div class="nowrap tagtd"><div class="left inline-block">';
print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">'; print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">';
if ($showinfo) print dol_print_date($curtime, 'daytextshort'); if ($showinfo) print dol_print_date($curtime, 'daytextshort');
else print dol_print_date($curtime, '%d'); else print dol_print_date($curtime, '%d');
print '</a>'; print '</a>';
print '</div><div class="nowrap tagtd right">'; print '</div><div class="nowrap floatright inline-block marginrightonly">';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{ {
print '<a class="cursoradd" href="'.$urltocreate.'">'; // Explicit link, usefull for nojs interfaces print '<a class="cursoradd" href="'.$urltocreate.'">'; // Explicit link, usefull for nojs interfaces
print img_picto($langs->trans("NewAction"), 'edit_add.png'); print img_picto($langs->trans("NewAction"), 'edit_add.png');
print '</a>'; print '</a>';
} }
print '</div></div>'."\n"; print '</div></div></div>'."\n";
} }
if ($nonew < 0) if ($nonew < 0)

View File

@ -86,6 +86,15 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartycomm', 'globalcard')); $hookmanager->initHooks(array('thirdpartycomm', 'globalcard'));
// Security check
$result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
if ($object->id > 0) {
if (!($object->client > 0) || empty($user->rights->societe->lire)) {
accessforbidden();
}
}
$now = dol_now(); $now = dol_now();

View File

@ -800,8 +800,7 @@ if ($action == 'create')
setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings');
if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
$_GET["action"] = ''; $_GET["action"] = '';
} elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) } elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) {
{
if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings');
if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
@ -818,7 +817,7 @@ if ($action == 'create')
if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings');
$text = ''; $text = '';
if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
{ {
$text .= $langs->trans("MailingNeedCommand"); $text .= $langs->trans("MailingNeedCommand");
$text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>'; $text .= '<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';
@ -826,7 +825,7 @@ if ($action == 'create')
} }
$text .= $langs->trans('ConfirmSendingEmailing').'<br>'; $text .= $langs->trans('ConfirmSendingEmailing').'<br>';
$text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB);
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', $formquestion, '', 1, 330, 600); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('SendMailing'), $text, 'sendallconfirmed', '', '', 1, 330, 600);
} }
} }

View File

@ -54,7 +54,7 @@ class AdvanceTargetingMailing extends CommonObject
public $name; public $name;
/** /**
* @var int element id * @var int element id (it's not the name of a field)
*/ */
public $fk_element; public $fk_element;

View File

@ -66,7 +66,7 @@ class Propal extends CommonObject
public $table_element_line = 'propaldet'; public $table_element_line = 'propaldet';
/** /**
* @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 = 'fk_propal'; public $fk_element = 'fk_propal';
@ -1099,7 +1099,7 @@ class Propal extends CommonObject
if ($this->id) if ($this->id)
{ {
$this->ref = '(PROV'.$this->id.')'; $this->ref = '(PROV'.$this->id.')';
$sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX."propal SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".((int) $this->id);
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1111,7 +1111,7 @@ class Propal extends CommonObject
} }
// Add object linked // Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects))
{ {
foreach ($this->linked_objects as $origin => $tmp_origin_id) foreach ($this->linked_objects as $origin => $tmp_origin_id)
{ {
@ -3753,7 +3753,10 @@ class PropaleLigne extends CommonObjectLine
public $product_type = Product::TYPE_PRODUCT; public $product_type = Product::TYPE_PRODUCT;
public $qty; public $qty;
public $tva_tx; public $tva_tx;
public $vat_src_code;
public $subprice; public $subprice;
public $remise_percent; public $remise_percent;
public $fk_remise_except; public $fk_remise_except;
@ -3805,6 +3808,11 @@ class PropaleLigne extends CommonObjectLine
* @see $product_label * @see $product_label
*/ */
public $libelle; public $libelle;
/**
* @deprecated
* @see $product_label
*/
public $label;
/** /**
* Product label * Product label
* @var string * @var string

View File

@ -919,6 +919,7 @@ if (empty($reshook))
if ($result > 0) { if ($result > 0) {
$ret = $object->fetch($object->id); // Reload to get new records $ret = $object->fetch($object->id); // Reload to get new records
$object->fetch_thirdparty();
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
// Define output language // Define output language

View File

@ -3273,6 +3273,7 @@ class Commande extends CommonOrder
$sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").","; $sql .= " fk_cond_reglement=".(isset($this->cond_reglement_id) ? $this->cond_reglement_id : "null").",";
$sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").","; $sql .= " fk_mode_reglement=".(isset($this->mode_reglement_id) ? $this->mode_reglement_id : "null").",";
$sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").","; $sql .= " fk_account=".($this->fk_account > 0 ? $this->fk_account : "null").",";
$sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").","; $sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";

View File

@ -109,7 +109,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -407,7 +407,7 @@ if ($action == 'create')
$arrayselected[] = $cat->id; $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 "</td></tr>"; print "</td></tr>";
} }
@ -904,7 +904,7 @@ if ($action == 'create')
$arrayselected[] = $cat->id; $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 "</td></tr>"; print "</td></tr>";
} }

View File

@ -43,12 +43,12 @@ class Deplacement extends CommonObject
public $table_element = 'deplacement'; public $table_element = 'deplacement';
/** /**
* @var int Name of subtable line * @var string Name of subtable line
*/ */
public $table_element_line = ''; public $table_element_line = '';
/** /**
* @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 = ''; public $fk_element = '';

View File

@ -3551,7 +3551,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Lines from source (TODO Show them also when creating invoice from tempalte invoice) // Lines from source (TODO Show them also when creating invoice from template invoice)
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) if (!empty($origin) && !empty($originid) && is_object($objectsrc))
{ {
// TODO for compatibility // TODO for compatibility

View File

@ -50,12 +50,12 @@ class FactureRec extends CommonInvoice
public $table_element = 'facture_rec'; public $table_element = 'facture_rec';
/** /**
* @var int Name of subtable line * @var string Name of subtable line
*/ */
public $table_element_line = 'facturedet_rec'; public $table_element_line = 'facturedet_rec';
/** /**
* @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_facture'; public $fk_element = 'fk_facture';

View File

@ -64,12 +64,12 @@ class Facture extends CommonInvoice
public $table_element = 'facture'; public $table_element = 'facture';
/** /**
* @var int Name of subtable line * @var string Name of subtable line
*/ */
public $table_element_line = 'facturedet'; public $table_element_line = 'facturedet';
/** /**
* @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 = 'fk_facture'; public $fk_element = 'fk_facture';
@ -3126,8 +3126,8 @@ class Facture extends CommonInvoice
$this->line->tva_tx = $txtva; $this->line->tva_tx = $txtva;
$this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0); $this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0);
$this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0); $this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0);
$this->line->localtax1_type = $localtaxes_type[0]; $this->line->localtax1_type = isset($localtaxes_type[0]) ? $localtaxes_type[0] : '';
$this->line->localtax2_type = $localtaxes_type[2]; $this->line->localtax2_type = isset($localtaxes_type[2]) ? $localtaxes_type[2] : '';
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative $this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative $this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative

View File

@ -192,10 +192,10 @@ function getPieChart($socid = 0)
{ {
$dolgraph = new DolGraph(); $dolgraph = new DolGraph();
$dolgraph->SetData($dataseries); $dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1); $dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1); $dolgraph->setShowPercent(1);
$dolgraph->SetType(['pie']); $dolgraph->SetType(['pie']);
$dolgraph->setWidth('100%'); $dolgraph->setHeight('200');
$dolgraph->draw('idgraphthirdparties'); $dolgraph->draw('idgraphthirdparties');
$result .= '<tr>'; $result .= '<tr>';

View File

@ -128,7 +128,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
$offset = $limit * $page; $offset = $limit * $page;
if (!$sortorder && !empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (!$sortorder && !empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder = $conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER;
if (!$sortorder) $sortorder = 'DESC'; if (!$sortorder) $sortorder = 'DESC';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2017 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -122,7 +122,9 @@ if ($modecompta == "CREANCES-DETTES")
$name = $langs->trans("Turnover"); $name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeDebt"); $calcmode = $langs->trans("CalcModeDebt");
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=BOOKKEEPING">', '</a>').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInBookkeepingMode", '{links1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=BOOKKEEPING">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
$description = $langs->trans("RulesCADue"); $description = $langs->trans("RulesCADue");
@ -146,7 +148,9 @@ if ($modecompta == "CREANCES-DETTES")
{ {
$name = $langs->trans("Turnover"); $name = $langs->trans("Turnover");
$calcmode = $langs->trans("CalcModeBookkeeping"); $calcmode = $langs->trans("CalcModeBookkeeping");
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=CREANCES-DETTES">', '</a>').')'; $calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{link1}', '{link2}').')';
$calcmode = str_replace('{link1}', '<a class="bold" href="'.$_SERVER["PHP_SELF"].'?'.($param ? $param : 'year_start='.$year_start).'&modecompta=CREANCES-DETTES">', $calcmode);
$calcmode = str_replace('{link2}', '</a>', $calcmode);
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')'; //$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : ""); $periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");

View File

@ -805,19 +805,16 @@ class Contact extends CommonObject
} }
// Mis a jour alerte birthday // Mis a jour alerte birthday
if ($this->birthday_alert) if (!empty($this->birthday_alert)) {
{
//check existing //check existing
$sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $sql_check = "SELECT rowid FROM ".MAIN_DB_PREFIX."user_alert WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$result_check = $this->db->query($sql_check); $result_check = $this->db->query($sql_check);
if (!$result_check || ($this->db->num_rows($result_check) < 1)) if (!$result_check || ($this->db->num_rows($result_check) < 1)) {
{
//insert //insert
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) ";
$sql .= "VALUES (1,".$this->db->escape($id).",".$user->id.")"; $sql .= "VALUES (1,".$this->db->escape($id).",".$user->id.")";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if (!$result) if (!$result) {
{
$error++; $error++;
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
} }
@ -828,23 +825,20 @@ class Contact extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert ";
$sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
$result = $this->db->query($sql); $result = $this->db->query($sql);
if (!$result) if (!$result) {
{
$error++; $error++;
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
} }
} }
if (!$error && !$notrigger) if (!$error && !$notrigger) {
{
// Call trigger // Call trigger
$result = $this->call_trigger('CONTACT_MODIFY', $user); $result = $this->call_trigger('CONTACT_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
if (!$error) if (!$error) {
{
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
@ -1342,9 +1336,10 @@ class Contact extends CommonObject
if (!empty($this->poste)) $label .= '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste; if (!empty($this->poste)) $label .= '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste;
$label .= '<br><b>'.$langs->trans("EMail").':</b> '.$this->email; $label .= '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
$phonelist = array(); $phonelist = array();
if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $this->country_code, $this->id, 0, '', '&nbsp;', 'phone'); $country_code = empty($this->country_code) ? '': $this->country_code;
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $this->country_code, $this->id, 0, '', '&nbsp;', 'mobile'); if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', '&nbsp;', 'phone');
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $this->country_code, $this->id, 0, '', '&nbsp;', 'phone'); if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', '&nbsp;', 'mobile');
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', '&nbsp;', 'phone');
$label .= '<br><b>'.$langs->trans("Phone").':</b> '.implode('&nbsp;', $phonelist); $label .= '<br><b>'.$langs->trans("Phone").':</b> '.implode('&nbsp;', $phonelist);
$label .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs); $label .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);

View File

@ -53,12 +53,12 @@ class Contrat extends CommonObject
public $table_element = 'contrat'; public $table_element = 'contrat';
/** /**
* @var int Name of subtable line * @var string Name of subtable line
*/ */
public $table_element_line = 'contratdet'; public $table_element_line = 'contratdet';
/** /**
* @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 = 'fk_contrat'; public $fk_element = 'fk_contrat';
@ -1032,21 +1032,19 @@ class Contrat extends CommonObject
} }
// Insert business contacts ('SALESREPFOLL','contrat') // Insert business contacts ('SALESREPFOLL','contrat')
if (!$error) if (!$error) {
{
$result = $this->add_contact($this->commercial_suivi_id, 'SALESREPFOLL', 'internal'); $result = $this->add_contact($this->commercial_suivi_id, 'SALESREPFOLL', 'internal');
if ($result < 0) $error++; if ($result < 0) $error++;
} }
if (!$error) if (!$error) {
{
if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects if (!empty($this->linkedObjectsIds) && empty($this->linked_objects)) // To use new linkedObjectsIds instead of old linked_objects
{ {
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds $this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
} }
// Add object linked // Add object linked
if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects))
{ {
foreach ($this->linked_objects as $origin => $tmp_origin_id) foreach ($this->linked_objects as $origin => $tmp_origin_id)
{ {
@ -1144,10 +1142,10 @@ class Contrat extends CommonObject
/** /**
* Supprime l'objet de la base * Delete object
* *
* @param User $user Utilisateur qui supprime * @param User $user User that deletes
* @return int < 0 si erreur, > 0 si ok * @return int < 0 if KO, > 0 if OK
*/ */
public function delete($user) public function delete($user)
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2011-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2011-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -356,6 +356,9 @@ if ($action == 'update')
$visibility = GETPOST('list', 'alpha'); $visibility = GETPOST('list', 'alpha');
if ($type == 'separate') $visibility = 3; if ($type == 'separate') $visibility = 3;
// Example: is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : 'objnotdefined'
$computedvalue = GETPOST('computed_value', 'nohtml');
$result = $extrafields->update( $result = $extrafields->update(
GETPOST('attrname', 'aZ09'), GETPOST('attrname', 'aZ09'),
GETPOST('label', 'alpha'), GETPOST('label', 'alpha'),
@ -371,7 +374,7 @@ if ($action == 'update')
$visibility, $visibility,
GETPOST('help', 'alpha'), GETPOST('help', 'alpha'),
GETPOST('default_value', 'alpha'), GETPOST('default_value', 'alpha'),
GETPOST('computed_value', 'alpha'), $computedvalue,
(GETPOST('entitycurrentorall', 'alpha') ? 0 : ''), (GETPOST('entitycurrentorall', 'alpha') ? 0 : ''),
GETPOST('langfile'), GETPOST('langfile'),
GETPOST('enabled', 'alpha'), GETPOST('enabled', 'alpha'),

View File

@ -0,0 +1,268 @@
<?php
/* Copyright (C) 2012-2014 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juan José Menent <jmenent@2byte.es>
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_funnel_of_prospection.php
* \ingroup projet
* \brief Module to show the funnel of prospection
*/
include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
/**
* Class to manage the box to show last projet
*/
class box_funnel_of_prospection extends ModeleBoxes
{
public $boxcode = "FunnelOfProspection";
public $boximg = "object_projectpub";
public $boxlabel = "BoxTitleFunnelOfProspection";
public $depends = array("projet");
/**
* @var DoliDB Database handler.
*/
public $db;
public $param;
public $info_box_head = array();
public $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
public function __construct($db, $param = '')
{
global $user, $langs, $conf;
// Load translation files required by the page
$langs->loadLangs(array('boxes', 'projects'));
$this->db = $db;
$this->hidden = !($user->rights->projet->lire);
}
/**
* Load data for box to show them later
*
* @param int $max Maximum number of records to load
* @return void
*/
public function loadBox($max = 5)
{
global $conf;
include DOL_DOCUMENT_ROOT . '/theme/' . $conf->theme . '/theme_vars.inc.php';
$listofoppstatus = array();
$listofopplabel = array();
$listofoppcode = array();
$colorseriesstat = array();
$sql = "SELECT cls.rowid, cls.code, cls.percent, cls.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_lead_status as cls";
$sql .= " WHERE active=1";
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($resql);
$listofoppstatus[$objp->rowid] = $objp->percent;
$listofopplabel[$objp->rowid] = $objp->label;
$listofoppcode[$objp->rowid] = $objp->code;
switch ($objp->code) {
case 'PROSP':
$colorseriesstat[$objp->rowid] = "-" . $badgeStatus0;
break;
case 'QUAL':
$colorseriesstat[$objp->rowid] = "-" . $badgeStatus1;
break;
case 'PROPO':
$colorseriesstat[$objp->rowid] = $badgeStatus1;
break;
case 'NEGO':
$colorseriesstat[$objp->rowid] = $badgeStatus4;
break;
case 'WON':
$colorseriesstat[$objp->rowid] = $badgeStatus6;
break;
default:
$colorseriesstat[$objp->rowid] = $badgeStatus2;
break;
}
$i++;
}
} else dol_print_error($this->db);
global $conf, $user, $langs;
$this->max = $max;
$this->info_box_head = array(
'text' => $langs->trans("Statistics") . ' - ' . $langs->trans("OpportunitiesStatusForOpenedProjects"),
$max
);
if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p, " . MAIN_DB_PREFIX . "c_lead_status as cls";
$sql .= " WHERE p.entity IN (" . getEntity('project') . ")";
$sql .= " AND p.fk_opp_status = cls.rowid";
$sql .= " AND p.fk_statut = 1"; // Opend projects only
$sql .= " AND cls.code NOT IN ('LOST')";
$sql .= " GROUP BY p.fk_opp_status, cls.code";
$resql = $this->db->query($sql);
$form = new Form($ths->db);
if ($resql) {
$num = $this->db->num_rows($resql);
$i = 0;
$totalnb = 0;
$totaloppnb = 0;
$totalamount = 0;
$ponderated_opp_amount = 0;
$valsnb = array();
$valsamount = array();
$dataseries = array();
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
if ($obj) {
$valsnb[$obj->opp_status] = $obj->nb;
$valsamount[$obj->opp_status] = $obj->opp_amount;
$totalnb += $obj->nb;
if ($obj->opp_status) $totaloppnb += $obj->nb;
if (!in_array($obj->code, array('WON', 'LOST'))) {
$totalamount += $obj->opp_amount;
$ponderated_opp_amount += $obj->ponderated_opp_amount;
}
}
$i++;
}
$this->db->free($resql);
$ponderated_opp_amount = $ponderated_opp_amount / 100;
$stringtoprint = '';
$stringtoprint .= '<div class="div-table-responsive-no-min ">';
$listofstatus = array_keys($listofoppstatus);
foreach ($listofstatus as $status) {
$labelStatus = '';
if ($status != 7) {
$code = dol_getIdFromCode($this->db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) $labelStatus = $langs->transnoentitiesnoconv("OppStatus" . $code);
if (empty($labelStatus)) $labelStatus = $listofopplabel[$status];
$dataseries[] = array($labelStatus,(isset($valsamount[$status]) ? (float) $valsamount[$status] : 0));
if (!$conf->use_javascript_ajax) {
$stringtoprint .= '<tr class="oddeven">';
$stringtoprint .= '<td>' . $labelStatus . '</td>';
$stringtoprint .= '<td class="right"><a href="list.php?statut=' . $status . '">' . price((isset($valsamount[$status]) ? (float) $valsamount[$status] : 0), 0, '', 1, -1, -1, $conf->currency) . '</a></td>';
$stringtoprint .= "</tr>\n";
}
}
}
if ($conf->use_javascript_ajax) {
include_once DOL_DOCUMENT_ROOT . '/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->SetDataColor(array_values($colorseriesstat));
//$dolgraph->SetLegend(array('PROSP',$dataseries['PROSP']));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->SetHeight('200');
$dolgraph->draw('idgraphstatus');
$stringtoprint .= $dolgraph->show($totaloppnb ? 0 : 1);
}
$stringtoprint .= '</div>';
$line = 0;
$this->info_box_contents[$line][] = array(
'tr' => 'class="nohover left "',
'text' => ''
);
$this->info_box_contents[$line][] = array(
'tr' => 'class="nohover left "',
'text' => ''
);
$line++;
$this->info_box_contents[$line][] = array(
'tr' => '',
'td' => 'class="center nopaddingleftimp nopaddingrightimp" colspan="2"',
'text' => $stringtoprint
);
$line++;
$this->info_box_contents[$line][] = array(
'tr' => 'class="oddeven"',
'td' => 'class="left "',
'maxlength' => 500,
'text' => $langs->trans("OpportunityTotalAmount") . ' (' . $langs->trans("WonLostExcluded") . ')'
);
$this->info_box_contents[$line][] = array(
'tr' => 'class="oddeven"',
'td' => 'class="right "',
'maxlength' => 500,
'text' => price($totalamount, 0, '', 1, -1, -1, $conf->currency)
);
$line++;
$this->info_box_contents[$line][] = array(
'tr' => 'class="oddeven"',
'td' => 'class="left "',
'maxlength' => 500,
'text' => $form->textwithpicto($langs->trans("OpportunityPonderatedAmount") . ' (' . $langs->trans("WonLostExcluded") . ')', $langs->trans("OpportunityPonderatedAmountDesc"), 1)
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right "',
'maxlength' => 500,
'text' => price(price2num($ponderated_opp_amount, 'MT'), 0, '', 1, -1, -1, $conf->currency)
);
} else {
$this->info_box_contents[0][0] = array(
'td' => 'class="center opacitymedium"',
'text' => $langs->trans("NoRecordedCustomers")
);
}
} else {
$this->info_box_contents[0][0] = array(
'td' => '',
'text' => $langs->trans("ReadPermissionNotAllowed")
);
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @param int $nooutput No $stringtoprint .=, only return string
* @return string
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr> /* Copyright (C) 2012 Charles-François BENKE <charles.fr@benke.fr>
* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014-2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2014-2020 Frederic France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -107,7 +107,7 @@ class box_lastlogin extends ModeleBoxes
* @param array $head Array with properties of box title * @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines * @param array $contents Array with properties of box lines
* @param int $nooutput No print, only return string * @param int $nooutput No print, only return string
* @return void * @return string
*/ */
public function showBox($head = null, $contents = null, $nooutput = 0) public function showBox($head = null, $contents = null, $nooutput = 0)
{ {

View File

@ -84,16 +84,25 @@ class box_produits extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts", $max)); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts", $max));
if ($user->rights->produit->lire || $user->rights->service->lire) if ($user->rights->produit->lire || $user->rights->service->lire) {
{
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity"; $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql .= ", p.accountancy_code_sell";
$sql .= ", p.accountancy_code_sell_intra";
$sql .= ", p.accountancy_code_sell_export";
$sql .= ", p.accountancy_code_buy";
$sql .= ", p.accountancy_code_buy_intra";
$sql .= ", p.accountancy_code_buy_export";
$sql .= ', p.barcode';
$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')'; $sql .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
if (empty($user->rights->produit->lire)) $sql .= ' AND p.fk_product_type != 0'; if (empty($user->rights->produit->lire)) {
if (empty($user->rights->service->lire)) $sql .= ' AND p.fk_product_type != 1'; $sql .= ' AND p.fk_product_type != 0';
}
if (empty($user->rights->service->lire)) {
$sql .= ' AND p.fk_product_type != 1';
}
// Add where from hooks // Add where from hooks
if (is_object($hookmanager)) if (is_object($hookmanager)) {
{
$parameters = array('boxproductlist'=>1); $parameters = array('boxproductlist'=>1);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint; $sql .= $hookmanager->resPrint;
@ -102,18 +111,15 @@ class box_produits extends ModeleBoxes
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result) {
{
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$line = 0; $line = 0;
while ($line < $num) while ($line < $num) {
{
$objp = $this->db->fetch_object($result); $objp = $this->db->fetch_object($result);
$datem = $this->db->jdate($objp->tms); $datem = $this->db->jdate($objp->tms);
// Multilangs // Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) // si l'option est active if (!empty($conf->global->MAIN_MULTILANGS)) { // si l'option est active
{
$sqld = "SELECT label"; $sqld = "SELECT label";
$sqld .= " FROM ".MAIN_DB_PREFIX."product_lang"; $sqld .= " FROM ".MAIN_DB_PREFIX."product_lang";
$sqld .= " WHERE fk_product=".$objp->rowid; $sqld .= " WHERE fk_product=".$objp->rowid;
@ -121,11 +127,11 @@ class box_produits extends ModeleBoxes
$sqld .= " LIMIT 1"; $sqld .= " LIMIT 1";
$resultd = $this->db->query($sqld); $resultd = $this->db->query($sqld);
if ($resultd) if ($resultd) {
{
$objtp = $this->db->fetch_object($resultd); $objtp = $this->db->fetch_object($resultd);
if (isset($objtp->label) && $objtp->label != '') if (isset($objtp->label) && $objtp->label != '') {
$objp->label = $objtp->label; $objp->label = $objtp->label;
}
} }
} }
$productstatic->id = $objp->rowid; $productstatic->id = $objp->rowid;
@ -133,6 +139,15 @@ class box_produits extends ModeleBoxes
$productstatic->type = $objp->fk_product_type; $productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label; $productstatic->label = $objp->label;
$productstatic->entity = $objp->entity; $productstatic->entity = $objp->entity;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
$productstatic->barcode = $objp->barcode;
$productstatic->accountancy_code_sell = $objp->accountancy_code_sell;
$productstatic->accountancy_code_sell_intra = $objp->accountancy_code_sell_intra;
$productstatic->accountancy_code_sell_export = $objp->accountancy_code_sell_export;
$productstatic->accountancy_code_buy = $objp->accountancy_code_buy;
$productstatic->accountancy_code_buy_intra = $objp->accountancy_code_buy_intra;
$productstatic->accountancy_code_buy_export = $objp->accountancy_code_buy_export;
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
@ -149,14 +164,13 @@ class box_produits extends ModeleBoxes
if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) { if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) {
$price_base_type = $langs->trans($objp->price_base_type); $price_base_type = $langs->trans($objp->price_base_type);
$price = ($objp->price_base_type == 'HT') ?price($objp->price) : $price = price($objp->price_ttc); $price = ($objp->price_base_type == 'HT') ?price($objp->price) : $price = price($objp->price_ttc);
} else //Parse the dynamic price } else {
{ //Parse the dynamic price
$productstatic->fetch($objp->rowid, '', '', 1); $productstatic->fetch($objp->rowid, '', '', 1);
$priceparser = new PriceParser($this->db); $priceparser = new PriceParser($this->db);
$price_result = $priceparser->parseProduct($productstatic); $price_result = $priceparser->parseProduct($productstatic);
if ($price_result >= 0) { if ($price_result >= 0) {
if ($objp->price_base_type == 'HT') if ($objp->price_base_type == 'HT') {
{
$price_base_type = $langs->trans("HT"); $price_base_type = $langs->trans("HT");
} else { } else {
$price_result = $price_result * (1 + ($productstatic->tva_tx / 100)); $price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
@ -164,7 +178,7 @@ class box_produits extends ModeleBoxes
} }
$price = price($price_result); $price = price($price_result);
} }
} }
$this->info_box_contents[$line][] = array( $this->info_box_contents[$line][] = array(
'td' => 'class="right"', 'td' => 'class="right"',
'text' => $price, 'text' => $price,
@ -194,11 +208,12 @@ class box_produits extends ModeleBoxes
$line++; $line++;
} }
if ($num == 0) if ($num == 0) {
$this->info_box_contents[$line][0] = array( $this->info_box_contents[$line][0] = array(
'td' => 'class="center"', 'td' => 'class="center"',
'text'=>$langs->trans("NoRecordedProducts"), 'text'=>$langs->trans("NoRecordedProducts"),
); );
}
$this->db->free($result); $this->db->free($result);
} else { } else {

View File

@ -242,6 +242,7 @@ class CMailFile
{ {
$this->html = $msg; $this->html = $msg;
$findimg = 0;
if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS))
{ {
$findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias'); $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');

View File

@ -32,10 +32,13 @@ class Comment extends CommonObject
public $table_element = 'comment'; public $table_element = 'comment';
/** /**
* @var int Field with ID of parent key if this field has a parent * @var int ID of parent key (it's not the name of a field)
*/ */
public $fk_element = ''; public $fk_element;
/**
* @var string element type
*/
public $element_type; public $element_type;
/** /**
@ -72,10 +75,16 @@ class Comment extends CommonObject
*/ */
public $entity; public $entity;
/**
* @var string import key
*/
public $import_key; public $import_key;
public $comments = array(); public $comments = array();
/**
* @var Comment Object oldcopy
*/
public $oldcopy; public $oldcopy;
@ -131,26 +140,26 @@ class Comment extends CommonObject
dol_syslog(get_class($this)."::create", LOG_DEBUG); dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) if (!$error) {
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
if (!$notrigger) if (!$notrigger) {
{
// Call trigger // Call trigger
$result = $this->call_trigger('TASK_COMMENT_CREATE', $user); $result = $this->call_trigger('TASK_COMMENT_CREATE', $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
} }
} }
// Commit or rollback // Commit or rollback
if ($error) if ($error) {
{ foreach ($this->errors as $errmsg) {
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
@ -190,12 +199,10 @@ class Comment extends CommonObject
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$num_rows = $this->db->num_rows($resql); $num_rows = $this->db->num_rows($resql);
if ($num_rows) if ($num_rows) {
{
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
@ -212,8 +219,11 @@ class Comment extends CommonObject
$this->db->free($resql); $this->db->free($resql);
if ($num_rows) return 1; if ($num_rows) {
else return 0; return 1;
} else {
return 0;
}
} else { } else {
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
return -1; return -1;
@ -234,8 +244,12 @@ class Comment extends CommonObject
$error = 0; $error = 0;
// Clean parameters // Clean parameters
if (isset($this->fk_element)) $this->fk_project = (int) trim($this->fk_element); if (isset($this->fk_element)) {
if (isset($this->description)) $this->description = trim($this->description); $this->fk_project = (int) trim($this->fk_element);
}
if (isset($this->description)) {
$this->description = trim($this->description);
}
// Update request // Update request
@ -253,24 +267,24 @@ class Comment extends CommonObject
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) if (!$error) {
{ if (!$notrigger) {
if (!$notrigger)
{
// Call trigger // Call trigger
$result = $this->call_trigger('TASK_COMMENT_MODIFY', $user); $result = $this->call_trigger('TASK_COMMENT_MODIFY', $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
} }
} }
// Commit or rollback // Commit or rollback
if ($error) if ($error) {
{ foreach ($this->errors as $errmsg) {
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
@ -303,24 +317,24 @@ class Comment extends CommonObject
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } if (!$resql) {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
if (!$error) if (!$error) {
{ if (!$notrigger) {
if (!$notrigger)
{
// Call trigger // Call trigger
$result = $this->call_trigger('TASK_COMMENT_DELETE', $user); $result = $this->call_trigger('TASK_COMMENT_DELETE', $user);
if ($result < 0) { $error++; } if ($result < 0) {
$error++;
}
// End call triggers // End call triggers
} }
} }
// Commit or rollback // Commit or rollback
if ($error) if ($error) {
{ foreach ($this->errors as $errmsg) {
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg); $this->error .= ($this->error ? ', '.$errmsg : $errmsg);
} }
@ -355,13 +369,10 @@ class Comment extends CommonObject
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG); dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql) {
{
$num_rows = $this->db->num_rows($resql); $num_rows = $this->db->num_rows($resql);
if ($num_rows > 0) if ($num_rows > 0) {
{ while ($obj = $this->db->fetch_object($resql)) {
while ($obj = $this->db->fetch_object($resql))
{
$comment = new self($db); $comment = new self($db);
$comment->fetch($obj->rowid); $comment->fetch($obj->rowid);
$this->comments[] = $comment; $this->comments[] = $comment;

View File

@ -743,6 +743,12 @@ abstract class CommonDocGenerator
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
} }
// Add infor from $object->xxx where xxx has been loaded by fetch_origin() of shipment
if (!empty($object->commande) && is_object($object->commande)) {
$array_shipment['order_ref'] = $object->commande->ref;
$array_shipment['order_ref_customer'] = $object->commande->ref_customer;
}
return $array_shipment; return $array_shipment;
} }

View File

@ -3161,7 +3161,7 @@ abstract class CommonObject
$this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0; $this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0;
// Situations totals // Situations totals
if ($this->situation_cycle_ref && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits') && $this->type != $this::TYPE_CREDIT_NOTE) if (!empty($this->situation_cycle_ref) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits') && $this->type != $this::TYPE_CREDIT_NOTE)
{ {
$prev_sits = $this->get_prev_sits(); $prev_sits = $this->get_prev_sits();

View File

@ -537,6 +537,8 @@ class Conf
if (!empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM; if (!empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from = $this->global->MAILING_EMAIL_FROM;
if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1; if (!isset($this->global->MAIN_EMAIL_ADD_TRACK_ID)) $this->global->MAIN_EMAIL_ADD_TRACK_ID = 1;
if (!isset($this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP)) $this->global->MAIN_HIDE_WARNING_TO_ENCOURAGE_SMTP_SETUP = 1;
// Format for date (used by default when not found or not searched in lang) // Format for date (used by default when not found or not searched in lang)
$this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) $this->format_date_short = "%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions)
$this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags $this->format_date_short_java = "dd/MM/yyyy"; // Format of day with Java tags

View File

@ -39,9 +39,9 @@
*/ */
class DolGraph class DolGraph
{ {
public $type = array(); // Array with type of each series. Example: array('bars', 'lines', ...) public $type = array(); // Array with type of each series. Example: array('bars', 'horizontalbars', 'lines', 'pies', 'piesemicircle', 'polar'...)
public $mode = 'side'; // Mode bars graph: side, depth public $mode = 'side'; // Mode bars graph: side, depth
private $_library = 'jflot'; // Graphic library to use (jflot, artichow) private $_library = 'chart'; // Graphic library to use (jflot, chart, artichow)
//! Array of data //! Array of data
public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
@ -115,7 +115,7 @@ class DolGraph
$this->_library = $library; $this->_library = $library;
if ($this->_library == 'auto') { if ($this->_library == 'auto') {
$this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'jflot' : $conf->global->MAIN_JS_GRAPH); $this->_library = (empty($conf->global->MAIN_JS_GRAPH) ? 'chart' : $conf->global->MAIN_JS_GRAPH);
} }
} }
@ -261,7 +261,7 @@ class DolGraph
* Set type * Set type
* *
* @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be: * @param array $type Array with type for each serie. Example: array('type1', 'type2', ...) where type can be:
* 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', ... * 'pie', 'piesemicircle', 'polar', 'lines', 'linesnopoint', 'bars', 'horirontalbars'...
* @return void * @return void
*/ */
public function SetType($type) public function SetType($type)
@ -1156,6 +1156,7 @@ class DolGraph
else { else {
$type = 'bar'; $type = 'bar';
if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar'; if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') $type = 'bar';
if (isset($this->type[$firstlot]) && $this->type[$firstlot] == 'horizontalbars') $type = 'horizontalBar';
if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line'; if (isset($this->type[$firstlot]) && ($this->type[$firstlot] == 'lines' || $this->type[$firstlot] == 'linesnopoint')) $type = 'line';
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, '; $this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';

View File

@ -125,7 +125,6 @@ class EmailSenderProfile extends CommonObject
*/ */
public $date_creation; public $date_creation;
public $tms; public $tms;
public $private; public $private;
public $signature; public $signature;
@ -134,32 +133,6 @@ class EmailSenderProfile extends CommonObject
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
// If this object has a subtable with lines
/**
* @var int Name of subtable line
*/
//public $table_element_line = 'emailsenderprofiledet';
/**
* @var int Field with ID of parent key if this field has a parent
*/
//public $fk_element = 'fk_emailsenderprofile';
/**
* @var int Name of subtable class that manage subtable lines
*/
//public $class_element_line = 'EmailSenderProfileline';
/**
* @var array List of child tables. To test if we can delete object.
*/
//protected $childtables=array();
/**
* @var EmailSenderProfileLine[] Array of subtable lines
*/
//public $lines = array();
/** /**
* Constructor * Constructor
* *

View File

@ -1937,10 +1937,10 @@ class ExtraFields
$out .= '<script type="text/javascript">'; $out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function(){'; $out .= 'jQuery(document).ready(function(){';
if ($collapse_display === false) { if ($collapse_display === false) {
$out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer fa fa-plus-square\"></span>&nbsp;");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer far fa-plus-square\"></span>&nbsp;");'."\n";
$out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n"; $out .= ' jQuery(".trextrafields_collapse'.$extrafields_collapse_num.'").hide();'."\n";
} else { } else {
$out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer fa fa-minus-square\"></span>&nbsp;");'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.' td").prepend("<span class=\"cursorpointer far fa-minus-square\"></span>&nbsp;");'."\n";
$out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n"; $out .= ' document.cookie = "DOLCOLLAPSE_'.$object->table_element.'_extrafields_'.$key.'=1; path='.$_SERVER["PHP_SELF"].'"'."\n";
} }
$out .= ' jQuery("#trextrafieldseparator'.$key.'").click(function(){'."\n"; $out .= ' jQuery("#trextrafieldseparator'.$key.'").click(function(){'."\n";

View File

@ -35,6 +35,9 @@ class Fiscalyear extends CommonObject
*/ */
public $element = 'fiscalyear'; public $element = 'fiscalyear';
/**
* @var string picto
*/
public $picto = 'technic'; public $picto = 'technic';
/** /**
@ -43,12 +46,12 @@ class Fiscalyear extends CommonObject
public $table_element = 'accounting_fiscalyear'; public $table_element = 'accounting_fiscalyear';
/** /**
* @var int Name of subtable line * @var string Name of subtable line
*/ */
public $table_element_line = ''; public $table_element_line = '';
/** /**
* @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 = ''; public $fk_element = '';

View File

@ -1447,9 +1447,10 @@ class Form
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param string $htmlid Html id to use instead of htmlname * @param string $htmlid Html id to use instead of htmlname
* @param bool $multiple add [] in the name of element and add 'multiple' attribut * @param bool $multiple add [] in the name of element and add 'multiple' attribut
* @param integer $disableifempty Set tag 'disabled' on select if there is no choice
* @return int <0 if KO, Nb of contact in list if OK * @return int <0 if KO, Nb of contact in list if OK
*/ */
public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false) public function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0)
{ {
global $conf, $langs, $hookmanager, $action; global $conf, $langs, $hookmanager, $action;
@ -1490,7 +1491,10 @@ class Form
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT); $out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
} }
if ($htmlname != 'none' && !$options_only) $out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'"'.($num ? '' : ' disabled').' id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>'; if ($htmlname != 'none' && !$options_only) {
$out .= '<select class="flat'.($moreclass ? ' '.$moreclass : '').'" id="'.$htmlid.'" name="'.$htmlname.(($num || empty($disableifempty)) ? '' : ' disabled').($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
}
if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>'; if (($showempty == 1 || ($showempty == 3 && $num > 1)) && !$multiple) $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>&nbsp;</option>';
if ($showempty == 2) $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>'; if ($showempty == 2) $out .= '<option value="0"'.(in_array(0, $selected) ? ' selected' : '').'>-- '.$langs->trans("Internal").' --</option>';
@ -1724,7 +1728,7 @@ class Form
$out .= ajax_combobox($htmlname); $out .= ajax_combobox($htmlname);
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined // do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
$out .= '<select class="flat'.($morecss ? ' minwidth100imp '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>'; $out .= '<select class="flat'.($morecss ? ' '.$morecss : ' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled ? ' disabled' : '').'>';
if ($show_empty && !$multiple) $out .= '<option value="-1"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>&nbsp;</option>'."\n"; if ($show_empty && !$multiple) $out .= '<option value="-1"'.((empty($selected) || in_array(-1, $selected)) ? ' selected' : '').'>&nbsp;</option>'."\n";
if ($show_every) $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n"; if ($show_every) $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
@ -4217,7 +4221,7 @@ class Form
* @param string $title Title * @param string $title Title
* @param string $question Question * @param string $question Question
* @param string $action Action * @param string $action Action
* @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , )) * @param array|string $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , 'size'=>, 'morecss'=>, 'moreattr'=>))
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ... * type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0' * @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
* @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx * @param int|string $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx

View File

@ -51,14 +51,14 @@ class FormAdmin
* @param string $htmlname Name of HTML select * @param string $htmlname Name of HTML select
* @param int $showauto Show 'auto' choice * @param int $showauto Show 'auto' choice
* @param array $filter Array of keys to exclude in list (opposite of $onlykeys) * @param array $filter Array of keys to exclude in list (opposite of $onlykeys)
* @param string $showempty '1'=Add empty value or string to show * @param string $showempty '1'=Add empty value or 'string to show'
* @param int $showwarning Show a warning if language is not complete * @param int $showwarning Show a warning if language is not complete
* @param int $disabled Disable edit of select * @param int $disabled Disable edit of select
* @param string $morecss Add more css styles * @param string $morecss Add more css styles
* @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end * @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end
* @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @param int $forcecombo Force to use combo box (so no ajax beautify effect)
* @param int $multiselect Make the combo a multiselect * @param int $multiselect Make the combo a multiselect
* @param array $onlykeys Show only the following keys (opposite of $filter). Example array('fr', 'es', ...) * @param array $onlykeys Array of language keys to restrict list with the following keys (opposite of $filter). Example array('fr', 'es', ...)
* @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...) * @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...)
* @return string Return HTML select string with list of languages * @return string Return HTML select string with list of languages
*/ */
@ -95,9 +95,12 @@ class FormAdmin
foreach ($langs_available as $key => $value) foreach ($langs_available as $key => $value)
{ {
$valuetoshow = $value; $valuetoshow = $value;
if ($showcode == 1) $valuetoshow = $key.' - '.$value; if ($showcode == 1) {
if ($mainlangonly) $valuetoshow = '<span class="opacitymedium">'.preg_replace('/[_-].*$/', '', $key).'</span> - '.$value;
else $valuetoshow = '<span class="opacitymedium">'.$key.'</span> - '.$value;
}
if ($showcode == 2) { if ($showcode == 2) {
if ($mainlangonly) $valuetoshow = $value.' ('.preg_replace('/[_-].*$/', '', $key).')'; if ($mainlangonly) $valuetoshow = $value.' <span class="opacitymedium">('.preg_replace('/[_-].*$/', '', $key).')</span>';
else $valuetoshow = $value.' <span class="opacitymedium">('.$key.')</span>'; else $valuetoshow = $value.' <span class="opacitymedium">('.$key.')</span>';
} }

View File

@ -918,9 +918,10 @@ class FormOther
* @param int $useempty Show empty in list * @param int $useempty Show empty in list
* @param int $longlabel Show long label * @param int $longlabel Show long label
* @param string $morecss More Css * @param string $morecss More Css
* @param bool $addjscombo Add js combo
* @return string * @return string
*/ */
public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'maxwidth50imp valignmiddle') public function select_month($selected = '', $htmlname = 'monthid', $useempty = 0, $longlabel = 0, $morecss = 'minwidth50 maxwidth75imp valignmiddle', $addjscombo = false)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -947,6 +948,15 @@ class FormOther
$select_month .= '</option>'; $select_month .= '</option>';
} }
$select_month .= '</select>'; $select_month .= '</select>';
// Add code for jquery to use multiselect
if ($addjscombo)
{
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$select_month .= ajax_combobox($htmlname);
}
return $select_month; return $select_month;
} }
@ -986,18 +996,10 @@ class FormOther
* @param bool $addjscombo Add js combo * @param bool $addjscombo Add js combo
* @return string * @return string
*/ */
public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp', $addjscombo = false) public function selectyear($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle width75', $addjscombo = false)
{ {
$out = ''; $out = '';
// Add code for jquery to use multiselect
if ($addjscombo)
{
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
$currentyear = date("Y") + $offset; $currentyear = date("Y") + $offset;
$max_year = $currentyear + $max_year; $max_year = $currentyear + $max_year;
$min_year = $currentyear - $min_year; $min_year = $currentyear - $min_year;
@ -1028,6 +1030,14 @@ class FormOther
} }
$out .= "</select>\n"; $out .= "</select>\n";
// Add code for jquery to use multiselect
if ($addjscombo)
{
// Enhance with select2
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
}
return $out; return $out;
} }

View File

@ -624,7 +624,7 @@ class Translate
// we want to keep '"' '<b>' '</b>' '<strong' '</strong>' '<a ' '</a>' '<br>' '< ' '<span' '</span>' that are reliable HTML tags inside translation strings. // we want to keep '"' '<b>' '</b>' '<strong' '</strong>' '<a ' '</a>' '<br>' '< ' '<span' '</span>' that are reliable HTML tags inside translation strings.
$str = str_replace( $str = str_replace(
array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<strong>', '</strong>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '>'), // We accept '< ' but not '<'. We can accept however '>' array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<strong>', '</strong>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '>'), // We accept '< ' but not '<'. We can accept however '>'
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__tagb__', '__tagbend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__lt__', '__gt__'), array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__tagb__', '__tagbend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__ltspace__', '__gt__'),
$str $str
); );
@ -638,8 +638,8 @@ class Translate
// Restore reliable HTML tags into original translation string // Restore reliable HTML tags into original translation string
$str = str_replace( $str = str_replace(
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__lt__', '__gt__'), array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__ltspace__', '__gt__'),
array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '> '), array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '>'),
$str $str
); );
@ -794,29 +794,33 @@ class Translate
if ($mainlangonly) { if ($mainlangonly) {
$arrayofspecialmainlanguages = array( $arrayofspecialmainlanguages = array(
'en'=>'en_US', 'en'=>'en_US',
'sq'=>'sq_AL', 'am'=>'am_ET',
'ar'=>'ar_SA', 'ar'=>'ar_SA',
'eu'=>'eu_ES',
'bn'=>'bn_DB', 'bn'=>'bn_DB',
'bs'=>'bs_BA', 'bs'=>'bs_BA',
'ca'=>'ca_ES', 'ca'=>'ca_ES',
'zh'=>'zh_TW',
'cs'=>'cs_CZ', 'cs'=>'cs_CZ',
'da'=>'da_DK', 'da'=>'da_DK',
'et'=>'et_EE', 'et'=>'et_EE',
'ka'=>'ka_GE',
'el'=>'el_GR', 'el'=>'el_GR',
'eu'=>'eu_ES',
'fa'=>'fa_IR',
'he'=>'he_IL', 'he'=>'he_IL',
'kn'=>'kn_IN', 'ka'=>'ka_GE',
'km'=>'km_KH', 'km'=>'km_KH',
'kn'=>'kn_IN',
'ko'=>'ko_KR', 'ko'=>'ko_KR',
'ja'=>'ja_JP',
'lo'=>'lo_LA', 'lo'=>'lo_LA',
'nb'=>'nb_NO', 'nb'=>'nb_NO',
'fa'=>'fa_IR', 'fa'=>'fa_IR',
'sq'=>'sq_AL',
'sr'=>'sr_RS', 'sr'=>'sr_RS',
'sv'=>'sv_SE',
'sl'=>'sl_SI', 'sl'=>'sl_SI',
'uk'=>'uk_UA', 'uk'=>'uk_UA',
'vi'=>'vi_VN' 'vi'=>'vi_VN',
'zh'=>'zh_CN'
); );
if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages)) continue; if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages)) continue;
} }

File diff suppressed because it is too large Load Diff

View File

@ -597,10 +597,25 @@ function dol_get_first_day_week($day, $month, $year, $gm = false)
return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day); return array('year' => $year, 'month' => $month, 'week' => $week, 'first_day' => $tmpday, 'first_month' => $tmpmonth, 'first_year' => $tmpyear, 'prev_year' => $prev_year, 'prev_month' => $prev_month, 'prev_day' => $prev_day);
} }
/**
* Return the easter day in GMT time.
* This function replaces easter_date() that returns a date in local TZ.
*
* @param int $year Year
* @return int GMT Date of easter day
*/
function getGMTEasterDatetime($year)
{
$base = new DateTime("$year-03-21");
$days = easter_days($year); // Return number of days between 21 march and easter day.
$tmp = $base->add(new DateInterval("P{$days}D"));
return $tmp->getTimestamp();
}
/** /**
* Return the number of non working days including saturday and sunday (or not) between 2 dates in timestamp. * Return the number of non working days including saturday and sunday (or not) between 2 dates in timestamp.
* Dates must be UTC with hour, day, min to 0. * Dates must be UTC with hour, day, min to 0.
* Called by function num_open_day * Called by function num_open_day()
* *
* @param int $timestampStart Timestamp de debut * @param int $timestampStart Timestamp de debut
* @param int $timestampEnd Timestamp de fin * @param int $timestampEnd Timestamp de fin
@ -616,7 +631,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
global $db, $conf, $mysoc; global $db, $conf, $mysoc;
$nbFerie = 0; $nbFerie = 0;
$specialdayrule = array();
// Check to ensure we use correct parameters // Check to ensure we use correct parameters
if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'Error Dates must use same hours and must be GMT dates'; if ((($timestampEnd - $timestampStart) % 86400) != 0) return 'Error Dates must use same hours and must be GMT dates';
@ -626,20 +640,23 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
if ($includesaturday < 0) $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1); if ($includesaturday < 0) $includesaturday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY : 1);
if ($includesunday < 0) $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1); if ($includesunday < 0) $includesunday = (isset($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY) ? $conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY : 1);
$country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid');
$i = 0; $i = 0;
while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd)) while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd))
&& ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop) && ($i < 50000)) // Loop end when equals (Test on i is a security loop to avoid infinite loop)
{ {
$ferie = false; $ferie = false;
$specialdayrule = array();
$jour = date("d", $timestampStart); $jour = gmdate("d", $timestampStart);
$mois = date("m", $timestampStart); $mois = gmdate("m", $timestampStart);
$annee = date("Y", $timestampStart); $annee = gmdate("Y", $timestampStart);
$country_id = dol_getIdFromCode($db, $country_code, 'c_country', 'code', 'rowid'); //print "jour=".$jour." month=".$mois." year=".$annee." includesaturday=".$includesaturday." includesunday=".$includesunday."\n";
// Loop on public holiday defined into hrm_public_holiday // Loop on public holiday defined into hrm_public_holiday for the day, month and year analyzed
// TODO Execute this request first and store results into an array, then reuse this array.
$sql = "SELECT code, entity, fk_country, dayrule, year, month, day, active"; $sql = "SELECT code, entity, fk_country, dayrule, year, month, day, active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday"; $sql .= " FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday";
$sql .= " WHERE active = 1 and fk_country IN (0".($country_id > 0 ? ", ".$country_id : 0).")"; $sql .= " WHERE active = 1 and fk_country IN (0".($country_id > 0 ? ", ".$country_id : 0).")";
@ -671,139 +688,147 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
dol_syslog($db->lasterror(), LOG_ERR); dol_syslog($db->lasterror(), LOG_ERR);
return 'Error sql '.$db->lasterror(); return 'Error sql '.$db->lasterror();
} }
//var_dump($specialdayrule)."\n";
//print "ferie=".$ferie."\n";
// Special dayrules if (!$ferie) {
if (in_array('easter', $specialdayrule)) // Special dayrules
{ if (in_array('easter', $specialdayrule))
// Calculation for easter date {
$date_paques = easter_date($annee); // Calculation for easter date
$jour_paques = date("d", $date_paques); $date_paques = getGMTEasterDatetime($annee);
$mois_paques = date("m", $date_paques); $jour_paques = gmdate("d", $date_paques);
if ($jour_paques == $jour && $mois_paques == $mois) $ferie = true; $mois_paques = gmdate("m", $date_paques);
// Easter (sunday) if ($jour_paques == $jour && $mois_paques == $mois) $ferie = true;
} // Easter (sunday)
}
if (in_array('eastermonday', $specialdayrule)) if (in_array('eastermonday', $specialdayrule))
{ {
// Calculation for the monday of easter date // Calculation for the monday of easter date
$date_paques = easter_date($annee); $date_paques = getGMTEasterDatetime($annee);
$date_lundi_paques = mktime( $date_lundi_paques = mktime(
date("H", $date_paques), gmdate("H", $date_paques),
date("i", $date_paques), gmdate("i", $date_paques),
date("s", $date_paques), gmdate("s", $date_paques),
date("m", $date_paques), gmdate("m", $date_paques),
date("d", $date_paques) + 1, gmdate("d", $date_paques) + 1,
date("Y", $date_paques) gmdate("Y", $date_paques)
);
$jour_lundi_ascension = date("d", $date_lundi_paques);
$mois_lundi_ascension = date("m", $date_lundi_paques);
if ($jour_lundi_ascension == $jour && $mois_lundi_ascension == $mois) $ferie = true;
// Easter (monday)
}
if (in_array('ascension', $specialdayrule))
{
// Calcul du jour de l'ascension (39 days after easter day)
$date_paques = easter_date($annee);
$date_ascension = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 39,
date("Y", $date_paques)
);
$jour_ascension = date("d", $date_ascension);
$mois_ascension = date("m", $date_ascension);
if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true;
// Ascension (thursday)
}
if (in_array('pentecote', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = easter_date($annee);
$date_pentecote = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 49,
date("Y", $date_paques)
);
$jour_pentecote = date("d", $date_pentecote);
$mois_pentecote = date("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (sunday)
}
if (in_array('pentecotemonday', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = easter_date($annee);
$date_pentecote = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 50,
date("Y", $date_paques)
); );
$jour_pentecote = date("d", $date_pentecote); $jour_lundi_paques = gmdate("d", $date_lundi_paques);
$mois_pentecote = date("m", $date_pentecote); $mois_lundi_paques = gmdate("m", $date_lundi_paques);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true; if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) $ferie = true;
// "Pentecote" (monday) // Easter (monday)
} }
if (in_array('viernessanto', $specialdayrule)) if (in_array('ascension', $specialdayrule))
{ {
// Viernes Santo // Calcul du jour de l'ascension (39 days after easter day)
$date_paques = easter_date($annee); $date_paques = getGMTEasterDatetime($annee);
$date_viernes = mktime( $date_ascension = mktime(
date("H", $date_paques), gmdate("H", $date_paques),
date("i", $date_paques), gmdate("i", $date_paques),
date("s", $date_paques), gmdate("s", $date_paques),
date("m", $date_paques), gmdate("m", $date_paques),
date("d", $date_paques) - 2, gmdate("d", $date_paques) + 39,
date("Y", $date_paques) gmdate("Y", $date_paques)
);
$jour_viernes = date("d", $date_viernes);
$mois_viernes = date("m", $date_viernes);
if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true;
//Viernes Santo
}
if (in_array('fronleichnam', $specialdayrule))
{
// Fronleichnam (60 days after easter sunday)
$date_paques = easter_date($annee);
$date_fronleichnam = mktime(
date("H", $date_paques),
date("i", $date_paques),
date("s", $date_paques),
date("m", $date_paques),
date("d", $date_paques) + 60,
date("Y", $date_paques)
); );
$jour_fronleichnam = date("d", $date_fronleichnam); $jour_ascension = gmdate("d", $date_ascension);
$mois_fronleichnam = date("m", $date_fronleichnam); $mois_ascension = gmdate("m", $date_ascension);
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true; if ($jour_ascension == $jour && $mois_ascension == $mois) $ferie = true;
// Fronleichnam // Ascension (thursday)
}
if (in_array('pentecote', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 49,
gmdate("Y", $date_paques)
);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (sunday)
}
if (in_array('pentecotemonday', $specialdayrule))
{
// Calculation of "Pentecote" (49 days after easter day)
$date_paques = getGMTEasterDatetime($annee);
$date_pentecote = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 50,
gmdate("Y", $date_paques)
);
$jour_pentecote = gmdate("d", $date_pentecote);
$mois_pentecote = gmdate("m", $date_pentecote);
if ($jour_pentecote == $jour && $mois_pentecote == $mois) $ferie = true;
// "Pentecote" (monday)
}
if (in_array('viernessanto', $specialdayrule))
{
// Viernes Santo
$date_paques = getGMTEasterDatetime($annee);
$date_viernes = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) - 2,
gmdate("Y", $date_paques)
);
$jour_viernes = gmdate("d", $date_viernes);
$mois_viernes = gmdate("m", $date_viernes);
if ($jour_viernes == $jour && $mois_viernes == $mois) $ferie = true;
//Viernes Santo
}
if (in_array('fronleichnam', $specialdayrule))
{
// Fronleichnam (60 days after easter sunday)
$date_paques = getGMTEasterDatetime($annee);
$date_fronleichnam = mktime(
gmdate("H", $date_paques),
gmdate("i", $date_paques),
gmdate("s", $date_paques),
gmdate("m", $date_paques),
gmdate("d", $date_paques) + 60,
gmdate("Y", $date_paques)
);
$jour_fronleichnam = gmdate("d", $date_fronleichnam);
$mois_fronleichnam = gmdate("m", $date_fronleichnam);
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true;
// Fronleichnam
}
} }
//print "ferie=".$ferie."\n";
// If we have to include saturday and sunday // If we have to include saturday and sunday
if ($includesaturday || $includesunday) if (!$ferie) {
{ if ($includesaturday || $includesunday)
$jour_julien = unixtojd($timestampStart);
$jour_semaine = jddayofweek($jour_julien, 0);
if ($includesaturday) //Saturday (6) and Sunday (0)
{ {
if ($jour_semaine == 6) $ferie = true; $jour_julien = unixtojd($timestampStart);
} $jour_semaine = jddayofweek($jour_julien, 0);
if ($includesunday) //Saturday (6) and Sunday (0) if ($includesaturday) //Saturday (6) and Sunday (0)
{ {
if ($jour_semaine == 0) $ferie = true; if ($jour_semaine == 6) $ferie = true;
}
if ($includesunday) //Saturday (6) and Sunday (0)
{
if ($jour_semaine == 0) $ferie = true;
}
} }
} }
//print "ferie=".$ferie."\n";
// We increase the counter of non working day // We increase the counter of non working day
if ($ferie) $nbFerie++; if ($ferie) $nbFerie++;
@ -815,6 +840,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
$i++; $i++;
} }
//print "nbFerie=".$nbFerie."\n";
return $nbFerie; return $nbFerie;
} }

View File

@ -154,6 +154,8 @@ function getBrowserInfo($user_agent)
$os = 'unknown'; $os = 'unknown';
$phone = ''; $phone = '';
$user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent
$detectmobile = new Mobile_Detect(null, $user_agent); $detectmobile = new Mobile_Detect(null, $user_agent);
$tablet = $detectmobile->isTablet(); $tablet = $detectmobile->isTablet();
@ -709,11 +711,11 @@ if (!function_exists('dol_getprefix'))
*/ */
function dol_getprefix($mode = '') function dol_getprefix($mode = '')
{ {
global $conf; // If prefix is for email (we need to have $conf alreayd loaded for this case)
// If prefix is for email
if ($mode == 'email') if ($mode == 'email')
{ {
global $conf;
if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) if (!empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended)
{ {
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID; if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
@ -727,12 +729,17 @@ if (!function_exists('dol_getprefix'))
return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
} }
// If prefix is for session (no need to have $conf loaded)
global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php
$tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
// The recommended value (may be not defined for old versions) // The recommended value (may be not defined for old versions)
if (!empty($conf->file->instance_unique_id)) return $conf->file->instance_unique_id; if (!empty($tmp_instance_unique_id)) {
return $tmp_instance_unique_id;
}
// For backward compatibility // For backward compatibility
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
{
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3'); return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT, '3');
} }
@ -1881,54 +1888,44 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address); $ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address);
} }
// Zip/Town/State // Zip/Town/State
if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) // US: title firstname name \n address lines \n town, state, zip \n country if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country
{
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town; $ret .= ($ret ? $sep : '').$town;
if ($object->state) if (!empty($object->state)) {
{
$ret .= ($ret ? ", " : '').$object->state; $ret .= ($ret ? ", " : '').$object->state;
} }
if ($object->zip) $ret .= ($ret ? ", " : '').$object->zip; if ($object->zip) $ret .= ($ret ? ", " : '').$object->zip;
} elseif (in_array($object->country_code, array('GB', 'UK'))) // UK: title firstname name \n address lines \n town state \n zip \n country } elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
{
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($ret ? $sep : '').$town; $ret .= ($ret ? $sep : '').$town;
if ($object->state) if (!empty($object->state)) {
{
$ret .= ($ret ? ", " : '').$object->state; $ret .= ($ret ? ", " : '').$object->state;
} }
if ($object->zip) $ret .= ($ret ? $sep : '').$object->zip; if ($object->zip) $ret .= ($ret ? $sep : '').$object->zip;
} elseif (in_array($object->country_code, array('ES', 'TR'))) // ES: title firstname name \n address lines \n zip town \n state \n country } elseif (isset($object->country_code) && in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
{
$ret .= ($ret ? $sep : '').$object->zip; $ret .= ($ret ? $sep : '').$object->zip;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
if ($object->state) if (!empty($object->state)) {
{
$ret .= "\n".$object->state; $ret .= "\n".$object->state;
} }
} elseif (in_array($object->country_code, array('IT'))) // IT: tile firstname name\n address lines \n zip (Code Departement) \n country } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
{
$ret .= ($ret ? $sep : '').$object->zip; $ret .= ($ret ? $sep : '').$object->zip;
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
$ret .= ($object->state_code ? (' '.($object->state_code)) : ''); $ret .= (empty($object->state_code) ? '' : (' '.$object->state_code));
} else // Other: title firstname name \n address lines \n zip town \n country } else { // Other: title firstname name \n address lines \n zip town \n country
{
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
$ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : ''; $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
$ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : ''); $ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : '');
if ($object->state && in_array($object->country_code, $countriesusingstate)) if (!empty($object->state) && in_array($object->country_code, $countriesusingstate)) {
{
$ret .= ($ret ? ", " : '').$object->state; $ret .= ($ret ? ", " : '').$object->state;
} }
} }
if (!is_object($outputlangs)) $outputlangs = $langs; if (!is_object($outputlangs)) $outputlangs = $langs;
if ($withcountry) if ($withcountry) {
{
$langs->load("dict"); $langs->load("dict");
$ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : ''); $ret .= (empty($object->country_code) ? '' : ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)));
} }
return $ret; return $ret;
@ -3189,9 +3186,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
// We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto // We forge fullpathpicto for image to $path/img/$picto. By default, we take DOL_URL_ROOT/theme/$conf->theme/img/$picto
$url = DOL_URL_ROOT; $url = DOL_URL_ROOT;
$theme = $conf->theme; $theme = isset($conf->theme) ? $conf->theme : null;
$path = 'theme/'.$theme; $path = 'theme/'.$theme;
// Define fullpathpicto to use into src // Define fullpathpicto to use into src
if ($pictoisfullpath) { if ($pictoisfullpath) {
// Clean parameters // Clean parameters
@ -3221,14 +3217,15 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice',
'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label', 'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_label',
'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', 'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment',
'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_lot', 'object_mrp', 'object_other',
'object_other', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_payment', 'object_pdf', 'object_product', 'object_propal',
'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
'object_recruitmentjobposition', 'object_recruitmentcandidature', 'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website',
'off', 'on', 'order', 'off', 'on', 'order',
'paiment', 'play', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip', 'paiment', 'play', 'pdf', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
@ -3240,18 +3237,18 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda' 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda'
) )
)) { )) {
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
$fakey = $pictowithouttext; $fakey = $pictowithouttext;
$facolor = ''; $fasize = ''; $facolor = ''; $fasize = '';
$fa = 'fas'; $fa = 'fas';
if (in_array($pictowithouttext, array('clock', 'object_generic', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) { if (in_array($pictowithouttext, array('clock', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) {
$fa = 'far'; $fa = 'far';
} }
if (in_array($pictowithouttext, array('black-tie', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) { if (in_array($pictowithouttext, array('black-tie', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'stripe-s', 'youtube', 'google-plus-g', 'whatsapp'))) {
$fa = 'fab'; $fa = 'fab';
} }
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
$arrayconvpictotofa = array( $arrayconvpictotofa = array(
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book', 'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book',
'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes', 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'supplier_invoicea'=>'file-excel', 'billd'=>'file-medical', 'supplier_invoiced'=>'file-medical', 'bom'=>'cubes',
@ -3271,10 +3268,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square', 'other'=>'square',
'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature', 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'refresh'=>'redo', 'resource'=>'laptop-house', 'refresh'=>'redo', 'resource'=>'laptop-house',
'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
@ -4803,7 +4800,7 @@ function price2num($amount, $rounding = '', $option = 0)
if ($option != 1) { // If not a PHP number or unknown, we change or clean format if ($option != 1) { // If not a PHP number or unknown, we change or clean format
//print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>'; //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>';
if (!is_numeric($amount)) { if (!is_numeric($amount)) {
$amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\-]/', '', $amount); $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>]/', '', $amount);
} }
if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123 if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come frominput data, so 1.123 is 1123
@ -5152,17 +5149,17 @@ function getTaxesFromId($vatrate, $buyer = null, $seller = null, $firstparamisid
/** /**
* Get type and rate of localtaxes for a particular vat rate/country of a thirdparty. * Get type and rate of localtaxes for a particular vat rate/country of a thirdparty.
* This does not take into account the seller setup if subject to vat or not, only country. * This does not take into account the seller setup if subject to vat or not, only country.
* TODO *
* This function is ALSO called to retrieve type for building PDF. Such call of function must be removed. * TODO This function is ALSO called to retrieve type for building PDF. Such call of function must be removed.
* Instead this function must be called when adding a line to get the array of localtax and type, and then * Instead this function must be called when adding a line to get the array of possible values for localtax and type, and then
* provide it to the function calcul_price_total. * provide the selected value to the function calcul_price_total.
* *
* @param int|string $vatrate VAT ID or Rate+Code. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123. * @param int|string $vatrate VAT ID or Rate+Code. Value can be value or the string with code into parenthesis or rowid if $firstparamisid is 1. Example: '8.5' or '8.5 (8.5NPR)' or 123.
* @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2) * @param int $local Number of localtax (1 or 2, or 0 to return 1 & 2)
* @param Societe $buyer Company object * @param Societe $buyer Company object
* @param Societe $seller Company object * @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can) * @param int $firstparamisid 1 if first param is ID into table instead of Rate+code (use this if you can)
* @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp) * @return array array(localtax_type1(1-6 or 0 if not found), rate localtax1, localtax_type2, rate localtax2, accountancycodecust, accountancycodesupp)
* @see getTaxesFromId() * @see getTaxesFromId()
*/ */
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0) function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0)
@ -5174,13 +5171,13 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
// Search local taxes // Search local taxes
$sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
if ($firstparamisid) $sql .= " WHERE t.rowid = ".(int) $vatrate; if ($firstparamisid) {
else { $sql .= " WHERE t.rowid = ".(int) $vatrate;
} else {
$vatratecleaned = $vatrate; $vatratecleaned = $vatrate;
$vatratecode = ''; $vatratecode = '';
$reg = array(); $reg = array();
if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "x.x (yy)" if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "x.x (yy)"
{
$vatratecleaned = $reg[1]; $vatratecleaned = $reg[1];
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
@ -5193,20 +5190,19 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
} }
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$vateratestring = $obj->rate.($obj->code ? ' ('.$obj->code.')' : ''); if ($obj) {
$vateratestring = $obj->rate.($obj->code ? ' ('.$obj->code.')' : '');
if ($local == 1) if ($local == 1) {
{ return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); } elseif ($local == 2) {
} elseif ($local == 2) return array($obj->localtax2_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
{ } else {
return array($obj->localtax2_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy); return array($obj->localtax1_type, get_localtax($vateratestring, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vateratestring, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} else { }
return array($obj->localtax1_type, get_localtax($vateratestring, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vateratestring, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
} }
@ -5703,9 +5699,11 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean); if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $stringtoclean);
$temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean); $temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
// We remove entities BEFORE stripping (in case of a separator char is encoded and not the other, the strip will fails) // We remove entities BEFORE stripping (in case of an open separator char that is entity encoded and not the closing other, the strip will fails)
$temp = dol_html_entity_decode($temp, ENT_COMPAT | ENT_HTML5, $pagecodeto); $temp = dol_html_entity_decode($temp, ENT_COMPAT | ENT_HTML5, $pagecodeto);
$temp = str_replace('< ', '__ltspace__', $temp);
if ($strip_tags) { if ($strip_tags) {
$temp = strip_tags($temp); $temp = strip_tags($temp);
} else { } else {
@ -5729,16 +5727,19 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
} }
} }
$temp = str_replace('__ltspace__', '< ', $temp);
return trim($temp); return trim($temp);
} }
/** /**
* Clean a string to keep only desirable HTML tags. * Clean a string to keep only desirable HTML tags.
* WARNING: This also clean HTML comments (used to obfuscate tag name).
* *
* @param string $stringtoclean String to clean * @param string $stringtoclean String to clean
* @param int $cleanalsosomestyles Remove absolute/fixed positioning from inline styles * @param int $cleanalsosomestyles Remove absolute/fixed positioning from inline styles
* @param int $removeclassattribute Remove the class attribute from tags * @param int $removeclassattribute Remove the class attribute from tags
* @param int $cleanalsojavascript Remove also occurence of (javascript:' * @param int $cleanalsojavascript Remove also occurence of 'javascript:'.
* @return string String cleaned * @return string String cleaned
* *
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags() * @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags()
@ -5756,16 +5757,21 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
$stringtoclean = dol_string_nounprintableascii($stringtoclean, 0); $stringtoclean = dol_string_nounprintableascii($stringtoclean, 0);
$stringtoclean = preg_replace('/&colon;/i', ':', $stringtoclean); $stringtoclean = preg_replace('/&colon;/i', ':', $stringtoclean);
$stringtoclean = preg_replace('/<!--[^>]*-->/', '', $stringtoclean);
$stringtoclean = preg_replace('/&#58;|&#0000058|&#x3A/i', '', $stringtoclean); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
$stringtoclean = preg_replace('/javascript\s*:/i', '', $stringtoclean);
$temp = strip_tags($stringtoclean, $allowed_tags_string); $temp = strip_tags($stringtoclean, $allowed_tags_string);
if ($cleanalsosomestyles) { // Clean for remaining html tags if ($cleanalsosomestyles) { // Clean for remaining html tags
$stringtoclean = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless $temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
} }
if ($removeclassattribute) { // Clean for remaining html tags if ($removeclassattribute) { // Clean for remaining html tags
$stringtoclean = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $temp); $temp = preg_replace('/(<[^>]+)\s+class=((["\']).*?\\3|\\w*)/i', '\\1', $temp);
} }
// Remove 'javascript:' that we should not find into a text with // Remove 'javascript:' that we should not find into a text with
// Warning: This is not reliable to fight against obfuscated javascript, there is a lot of other solution to include js into a common html tag (only filtered by the GETPOST).
if ($cleanalsojavascript) { if ($cleanalsojavascript) {
$temp = preg_replace('/javascript\s*:/i', '', $temp); $temp = preg_replace('/javascript\s*:/i', '', $temp);
} }

View File

@ -19,7 +19,7 @@
/** /**
* \file htdocs/core/lib/phpsessionindb.lib.php * \file htdocs/core/lib/phpsessionindb.lib.php
* \ingroup core * \ingroup core
* \brief Set function handlers for PHP session management in DB * \brief Set function handlers for PHP session management in DB.
*/ */
// The session handler file must be included just after the call of the master.inc.php into main.inc.php // The session handler file must be included just after the call of the master.inc.php into main.inc.php

View File

@ -129,14 +129,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$localtax1_type = 0; $localtax1_type = 0;
$localtax2_type = 0; $localtax2_type = 0;
if (is_array($localtaxes_array)) if (is_array($localtaxes_array)) {
{
$localtax1_type = $localtaxes_array[0]; $localtax1_type = $localtaxes_array[0];
$localtax1_rate = $localtaxes_array[1]; $localtax1_rate = $localtaxes_array[1];
$localtax2_type = $localtaxes_array[2]; $localtax2_type = $localtaxes_array[2];
$localtax2_rate = $localtaxes_array[3]; $localtax2_rate = $localtaxes_array[3];
} else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code) } else {
{ // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code)
// also, with this method, we may get several possible values (for example with localtax2 in spain), so we take the first one.
dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING); dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING);
$sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type"; $sql = "SELECT taux, localtax1, localtax2, localtax1_type, localtax2_type";
@ -149,11 +149,11 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) if ($obj)
{ {
$localtax1_rate = $obj->localtax1; $localtax1_rate = (float) $obj->localtax1; // Use float to force to get first numeric value when value is x:y:z
$localtax2_rate = $obj->localtax2; $localtax2_rate = (float) $obj->localtax2; // Use float to force to get first numeric value when value is -19:-15:-9
$localtax1_type = $obj->localtax1_type; $localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type; $localtax2_type = $obj->localtax2_type;
//var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);exit; //var_dump($localtax1_rate.' '.$localtax2_rate.' '.$localtax1_type.' '.$localtax2_type);
} }
} else dol_print_error($db); } else dol_print_error($db);
} }
@ -417,7 +417,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// initialize result array // initialize result array
//for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i]; //for ($i=0; $i <= 18; $i++) $result[$i] = (float) $result[$i];
dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.$conf->global->MAIN_ROUNDING_RULE_TOT.' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]); dol_syslog('Price.lib::calcul_price_total MAIN_ROUNDING_RULE_TOT='.(empty($conf->global->MAIN_ROUNDING_RULE_TOT)?'':$conf->global->MAIN_ROUNDING_RULE_TOT).' pu='.$pu.' qty='.$qty.' price_base_type='.$price_base_type.' total_ht='.$result[0].'-total_vat='.$result[1].'-total_ttc='.$result[2]);
return $result; return $result;
} }

View File

@ -639,7 +639,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
* @param int $printheader Show header before * @param int $printheader Show header before
* @param int $printfooter Show footer after * @param int $printfooter Show footer after
* @param int $showonlymessage Show only message parameter. Otherwise add more information. * @param int $showonlymessage Show only message parameter. Otherwise add more information.
* @param array|null $params Send params * @param array|null $params More parameters provided to hook
* @return void * @return void
*/ */
function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null) function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null)

View File

@ -442,7 +442,7 @@ function dolSaveReadme($file, $content)
/** /**
* Show list of themes. Show all thumbs of themes/skins * Show list of themes. Show all thumbs of themes/skins
* *
* @param Website $website Object website to load the tempalte into * @param Website $website Object website to load the template into
* @return void * @return void
*/ */
function showWebsiteTemplates(Website $website) function showWebsiteTemplates(Website $website)

File diff suppressed because it is too large Load Diff

View File

@ -67,12 +67,15 @@ class MenuManager
global $conf, $user, $langs; global $conf, $user, $langs;
// We save into session the main menu selected // We save into session the main menu selected
if (GETPOSTISSET("mainmenu")) $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09'); if (GETPOSTISSET("mainmenu")) {
if (GETPOSTISSET("idmenu")) $_SESSION["idmenu"] = GETPOST("idmenu", 'int'); $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09');
}
if (GETPOSTISSET("idmenu")) {
$_SESSION["idmenu"] = GETPOST("idmenu", 'int');
}
// Read now mainmenu and leftmenu that define which menu to show // Read now mainmenu and leftmenu that define which menu to show
if (GETPOSTISSET("mainmenu")) if (GETPOSTISSET("mainmenu")) {
{
// On sauve en session le menu principal choisi // On sauve en session le menu principal choisi
$mainmenu = GETPOST("mainmenu", 'aZ09'); $mainmenu = GETPOST("mainmenu", 'aZ09');
$_SESSION["mainmenu"] = $mainmenu; $_SESSION["mainmenu"] = $mainmenu;
@ -81,16 +84,16 @@ class MenuManager
// On va le chercher en session si non defini par le lien // On va le chercher en session si non defini par le lien
$mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : ''; $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : '';
} }
if (!empty($forcemainmenu)) $mainmenu = $forcemainmenu; if (!empty($forcemainmenu)) {
$mainmenu = $forcemainmenu;
}
if (GETPOSTISSET("leftmenu")) if (GETPOSTISSET("leftmenu")) {
{
// On sauve en session le menu principal choisi // On sauve en session le menu principal choisi
$leftmenu = GETPOST("leftmenu", 'aZ09'); $leftmenu = GETPOST("leftmenu", 'aZ09');
$_SESSION["leftmenu"] = $leftmenu; $_SESSION["leftmenu"] = $leftmenu;
if ($_SESSION["leftmenuopened"] == $leftmenu) // To collapse if ($_SESSION["leftmenuopened"] == $leftmenu) { // To collapse
{
//$leftmenu=""; //$leftmenu="";
$_SESSION["leftmenuopened"] = ""; $_SESSION["leftmenuopened"] = "";
} else { } else {
@ -100,7 +103,9 @@ class MenuManager
// On va le chercher en session si non defini par le lien // On va le chercher en session si non defini par le lien
$leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : ''; $leftmenu = isset($_SESSION["leftmenu"]) ? $_SESSION["leftmenu"] : '';
} }
if (!empty($forceleftmenu)) $leftmenu = $forceleftmenu; if (!empty($forceleftmenu)) {
$leftmenu = $forceleftmenu;
}
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
$tabMenu = array(); $tabMenu = array();
@ -129,8 +134,7 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
if ($this->type_user == 1) if ($this->type_user == 1) {
{
$conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1; $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
$conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1; $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
} }
@ -138,36 +142,39 @@ class MenuManager
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
$this->menu = new Menu(); $this->menu = new Menu();
if (empty($conf->global->MAIN_MENU_INVERT)) if (empty($conf->global->MAIN_MENU_INVERT)) {
{ if ($mode == 'top') {
if ($mode == 'top') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
if ($mode == 'left') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); }
if ($mode == 'left') {
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata, $this->type_user);
}
} else { } else {
$conf->global->MAIN_SHOW_LOGO = 0; $conf->global->MAIN_SHOW_LOGO = 0;
if ($mode == 'top') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); if ($mode == 'top') {
if ($mode == 'left') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata, $this->type_user);
}
if ($mode == 'left') {
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
}
} }
if ($mode == 'topnb') if ($mode == 'topnb') {
{
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // no output print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // no output
return $this->menu->getNbOfVisibleMenuEntries(); return $this->menu->getNbOfVisibleMenuEntries();
} }
if ($mode == 'jmobile') // Used to get menu in xml ul/li if ($mode == 'jmobile') { // Used to get menu in xml ul/li
{
print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // Fill this->menu that is empty with top menu print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // Fill this->menu that is empty with top menu
// $this->menu->liste is top menu // $this->menu->liste is top menu
//var_dump($this->menu->liste);exit; //var_dump($this->menu->liste);exit;
$lastlevel = array(); $lastlevel = array();
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n"; print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach ($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
print '<ul class="ulmenu" data-inset="true">'; print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">'; print '<li class="lilevel0">';
if ($val['enabled'] == 1) if ($val['enabled'] == 1) {
{
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray['__USERID__'] = $user->id; // For backward compatibility $substitarray['__USERID__'] = $user->id; // For backward compatibility
$val['url'] = make_substitutions($val['url'], $substitarray); $val['url'] = make_substitutions($val['url'], $substitarray);
@ -178,7 +185,9 @@ class MenuManager
print '<a class="alilevel0" href="#">'; print '<a class="alilevel0" href="#">';
// Add font-awesome // Add font-awesome
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>'; if ($val['level'] == 0 && $val['mainmenu'] == 'home') {
print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
}
print $val['titre']; print $val['titre'];
print '</a>'."\n"; print '</a>'."\n";
@ -187,7 +196,7 @@ class MenuManager
$tmpmainmenu = $val['mainmenu']; $tmpmainmenu = $val['mainmenu'];
$tmpleftmenu = 'all'; $tmpleftmenu = 'all';
$submenu = new Menu(); $submenu = new Menu();
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home) print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu, null, $this->type_user); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
// Note: $submenu contains menu entry with substitution not yet done // Note: $submenu contains menu entry with substitution not yet done
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; } //if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; } //if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
@ -199,27 +208,27 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools'))) if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) || (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
{
// We add sub entry // We add sub entry
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">'; print '<a href="'.$relurl.'">';
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") { // No translation
{ if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) {
if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) print $langs->trans("Access"); print $langs->trans("Access");
else print $langs->trans("Dashboard"); } else {
} else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); print $langs->trans("Dashboard");
}
} else {
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
}
print '</a>'; print '</a>';
print '</li>'."\n"; print '</li>'."\n";
} }
if ($val['level'] == 0) if ($val['level'] == 0) {
{ if ($val['enabled']) {
if ($val['enabled'])
{
$lastlevel[0] = 'enabled'; $lastlevel[0] = 'enabled';
} elseif ($showmenu) // Not enabled but visible (so greyed) } elseif ($showmenu) { // Not enabled but visible (so greyed)
{
$lastlevel[0] = 'greyed'; $lastlevel[0] = 'greyed';
} else { } else {
$lastlevel[0] = 'hidden'; $lastlevel[0] = 'hidden';
@ -227,52 +236,52 @@ class MenuManager
} }
$lastlevel2 = array(); $lastlevel2 = array();
foreach ($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
$showmenu = true; $showmenu = true;
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu = false; if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) {
$showmenu = false;
}
// If at least one parent is not enabled, we do not show any menu of all children // If at least one parent is not enabled, we do not show any menu of all children
if ($val2['level'] > 0) if ($val2['level'] > 0) {
{
$levelcursor = $val2['level'] - 1; $levelcursor = $val2['level'] - 1;
while ($levelcursor >= 0) while ($levelcursor >= 0) {
{ if ($lastlevel2[$levelcursor] != 'enabled') {
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu = false; $showmenu = false;
}
$levelcursor--; $levelcursor--;
} }
} }
if ($showmenu) // Visible (option to hide when not allowed is off or allowed) if ($showmenu) { // Visible (option to hide when not allowed is off or allowed)
{ $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user); $substitarray['__USERID__'] = $user->id; // For backward compatibility
$substitarray['__USERID__'] = $user->id; // For backward compatibility $val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url'])) if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url'])) {
{ $relurl2 = dol_buildpath($val2['url'], 1);
$relurl2 = dol_buildpath($val2['url'], 1); } else {
} else { $relurl2 = $val2['url'];
$relurl2 = $val2['url']; }
}
$canonurl2 = preg_replace('/\?.*$/', '', $val2['url']); $canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) $relurl2 = ''; if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) {
$relurl2 = '';
}
$disabled = ''; $disabled = '';
if (!$val2['enabled']) if (!$val2['enabled']) {
{
$disabled = " vsmenudisabled"; $disabled = " vsmenudisabled";
} }
print str_pad('', $val2['level'] + 1); print str_pad('', $val2['level'] + 1);
print '<li class="lilevel'.($val2['level'] + 1); print '<li class="lilevel'.($val2['level'] + 1);
if ($val2['level'] == 0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic if ($val2['level'] == 0) {
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
}
print $disabled.'">'; // ui-btn to highlight on clic print $disabled.'">'; // ui-btn to highlight on clic
if ($relurl2) if ($relurl2) {
{ if ($val2['enabled']) { // Allowed
if ($val2['enabled']) // Allowed
{
print '<a href="'.$relurl2.'"'; print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"'; //print ' data-ajax="false"';
print '>'; print '>';
@ -283,28 +292,27 @@ class MenuManager
$lastlevel2[$val2['level']] = 'greyed'; $lastlevel2[$val2['level']] = 'greyed';
} }
} else { } else {
if ($val2['enabled']) // Allowed if ($val2['enabled']) { // Allowed
{
$lastlevel2[$val2['level']] = 'enabled'; $lastlevel2[$val2['level']] = 'enabled';
} else { } else {
$lastlevel2[$val2['level']] = 'greyed'; $lastlevel2[$val2['level']] = 'greyed';
} }
} }
print $val2['titre']; print $val2['titre'];
if ($relurl2) if ($relurl2) {
{ if ($val2['enabled']) { // Allowed
if ($val2['enabled']) // Allowed
print '</a>'; print '</a>';
else print '</a>'; } else {
print '</a>';
}
} }
print '</li>'."\n"; print '</li>'."\n";
} }
} }
//var_dump($submenu); //var_dump($submenu);
print '</ul>'; print '</ul>';
} }
if ($val['enabled'] == 2) if ($val['enabled'] == 2) {
{
print '<font class="vsmenudisabled">'.$val['titre'].'</font>'; print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
} }
print '</li>'; print '</li>';

View File

@ -32,10 +32,13 @@ class MenuManager
public $type_user = 0; // Put 0 for internal users, 1 for external users public $type_user = 0; // Put 0 for internal users, 1 for external users
public $atarget = ""; // To store default target to use onto links public $atarget = ""; // To store default target to use onto links
public $name = "empty";
public $menu; public $menu;
public $menu_array_after; public $menu_array_after;
public $tabMenu;
/** /**
* Constructor * Constructor
@ -60,6 +63,7 @@ class MenuManager
public function loadMenu($forcemainmenu = '', $forceleftmenu = '') public function loadMenu($forcemainmenu = '', $forceleftmenu = '')
{ {
// Do nothing // Do nothing
$this->tabMenu = array();
} }
@ -84,20 +88,19 @@ class MenuManager
$noout = 0; $noout = 0;
//if ($mode == 'jmobile') $noout=1; //if ($mode == 'jmobile') $noout=1;
if ($mode == 'topnb') if ($mode == 'topnb') {
{
return 1; return 1;
} }
if ($mode == 'top') if ($mode == 'top') {
{ if (empty($noout)) {
if (empty($noout)) print_start_menu_array_empty(); print_start_menu_array_empty();
}
$usemenuhider = 1; $usemenuhider = 1;
// Show/Hide vertical menu // Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
{
$showmode = 1; $showmode = 1;
$classname = 'class="tmenu menuhider"'; $classname = 'class="tmenu menuhider"';
$idsel = 'menu'; $idsel = 'menu';
@ -117,28 +120,37 @@ class MenuManager
$this->menu->liste = dol_sort_array($this->menu->liste, 'position'); $this->menu->liste = dol_sort_array($this->menu->liste, 'position');
// Output menu entries // Output menu entries
foreach ($this->menu->liste as $menkey => $menuval) foreach ($this->menu->liste as $menkey => $menuval) {
{ if (empty($noout)) {
if (empty($noout)) print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']); print_start_menu_entry_empty($menuval['idsel'], $menuval['classname'], $menuval['enabled']);
if (empty($noout)) print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget)); }
if (empty($noout)) print_end_menu_entry_empty($menuval['enabled']); if (empty($noout)) {
print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url'] != '#' ?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target'] ? $menuval['target'] : $atarget));
}
if (empty($noout)) {
print_end_menu_entry_empty($menuval['enabled']);
}
} }
$showmode = 1; $showmode = 1;
if (empty($noout)) print_start_menu_entry_empty('', 'class="tmenuend"', $showmode); if (empty($noout)) {
if (empty($noout)) print_end_menu_entry_empty($showmode); print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
}
if (empty($noout)) {
print_end_menu_entry_empty($showmode);
}
if (empty($noout)) print_end_menu_array_empty(); if (empty($noout)) {
print_end_menu_array_empty();
}
if ($mode == 'jmobile') if ($mode == 'jmobile') {
{
$this->topmenu = clone $this->menu; $this->topmenu = clone $this->menu;
unset($this->menu->liste); unset($this->menu->liste);
} }
} }
if ($mode == 'jmobile') // Used to get menu in xml ul/li if ($mode == 'jmobile') { // Used to get menu in xml ul/li
{
// Home // Home
$showmode = 1; $showmode = 1;
$classname = 'class="tmenusel"'; $classname = 'class="tmenusel"';
@ -152,22 +164,22 @@ class MenuManager
//var_dump($this->menu->liste);exit; //var_dump($this->menu->liste);exit;
$lastlevel = array(); $lastlevel = array();
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n"; print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach ($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
print '<ul class="ulmenu" data-inset="true">'; print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">'; print '<li class="lilevel0">';
$val['url'] = make_substitutions($val['url'], $substitarray); $val['url'] = make_substitutions($val['url'], $substitarray);
if ($val['enabled'] == 1) if ($val['enabled'] == 1) {
{
$relurl = dol_buildpath($val['url'], 1); $relurl = dol_buildpath($val['url'], 1);
$canonurl = preg_replace('/\?.*$/', '', $val['url']); $canonurl = preg_replace('/\?.*$/', '', $val['url']);
print '<a class="alilevel0" href="#">'; print '<a class="alilevel0" href="#">';
// Add font-awesome // Add font-awesome
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>'; if ($val['level'] == 0 && $val['mainmenu'] == 'home') {
print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
}
print $val['titre']; print $val['titre'];
print '</a>'."\n"; print '</a>'."\n";
@ -206,27 +218,27 @@ class MenuManager
//var_dump($canonnexturl); //var_dump($canonnexturl);
print '<ul>'."\n"; print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools'))) if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) || (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
{
// We add sub entry // We add sub entry
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">'; print '<a href="'.$relurl.'">';
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") { // No translation
{ if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) {
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access"); print $langs->trans("Access");
else print $langs->trans("Dashboard"); } else {
} else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard"); print $langs->trans("Dashboard");
}
} else {
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
}
print '</a>'; print '</a>';
print '</li>'."\n"; print '</li>'."\n";
} }
if ($val['level'] == 0) if ($val['level'] == 0) {
{ if ($val['enabled']) {
if ($val['enabled'])
{
$lastlevel[0] = 'enabled'; $lastlevel[0] = 'enabled';
} elseif ($showmenu) // Not enabled but visible (so greyed) } elseif ($showmenu) { // Not enabled but visible (so greyed)
{
$lastlevel[0] = 'greyed'; $lastlevel[0] = 'greyed';
} else { } else {
$lastlevel[0] = 'hidden'; $lastlevel[0] = 'hidden';
@ -234,45 +246,46 @@ class MenuManager
} }
$lastlevel2 = array(); $lastlevel2 = array();
foreach ($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
$showmenu = true; $showmenu = true;
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu = false; if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) {
$showmenu = false;
}
// If at least one parent is not enabled, we do not show any menu of all children // If at least one parent is not enabled, we do not show any menu of all children
if ($val2['level'] > 0) if ($val2['level'] > 0) {
{
$levelcursor = $val2['level'] - 1; $levelcursor = $val2['level'] - 1;
while ($levelcursor >= 0) while ($levelcursor >= 0) {
{ if ($lastlevel2[$levelcursor] != 'enabled') {
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu = false; $showmenu = false;
}
$levelcursor--; $levelcursor--;
} }
} }
if ($showmenu) // Visible (option to hide when not allowed is off or allowed) if ($showmenu) { // Visible (option to hide when not allowed is off or allowed)
{
$val2['url'] = make_substitutions($val2['url'], $substitarray); $val2['url'] = make_substitutions($val2['url'], $substitarray);
$relurl2 = dol_buildpath($val2['url'], 1); $relurl2 = dol_buildpath($val2['url'], 1);
$canonurl2 = preg_replace('/\?.*$/', '', $val2['url']); $canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']); //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) $relurl2 = ''; if (in_array($canonurl2, array('/admin/index.php', '/admin/tools/index.php', '/core/tools.php'))) {
$relurl2 = '';
}
$disabled = ''; $disabled = '';
if (!$val2['enabled']) if (!$val2['enabled']) {
{
$disabled = " vsmenudisabled"; $disabled = " vsmenudisabled";
} }
print str_pad('', $val2['level'] + 1); print str_pad('', $val2['level'] + 1);
print '<li class="lilevel'.($val2['level'] + 1); print '<li class="lilevel'.($val2['level'] + 1);
if ($val2['level'] == 0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic if ($val2['level'] == 0) {
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
}
print $disabled.'">'; // ui-btn to highlight on clic print $disabled.'">'; // ui-btn to highlight on clic
if ($relurl2) if ($relurl2) {
{ if ($val2['enabled']) { // Allowed
if ($val2['enabled']) // Allowed
{
print '<a href="'.$relurl2.'"'; print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"'; //print ' data-ajax="false"';
print '>'; print '>';
@ -283,8 +296,7 @@ class MenuManager
$lastlevel2[$val2['level']] = 'greyed'; $lastlevel2[$val2['level']] = 'greyed';
} }
} else { } else {
if ($val2['enabled']) // Allowed if ($val2['enabled']) { // Allowed
{
$lastlevel2[$val2['level']] = 'enabled'; $lastlevel2[$val2['level']] = 'enabled';
} else { } else {
$lastlevel2[$val2['level']] = 'greyed'; $lastlevel2[$val2['level']] = 'greyed';
@ -293,8 +305,7 @@ class MenuManager
//var_dump($val2['level']); //var_dump($val2['level']);
//var_dump($lastlevel2); //var_dump($lastlevel2);
print $val2['titre']; print $val2['titre'];
if ($relurl2) if ($relurl2) {
{
if ($val2['enabled']) { if ($val2['enabled']) {
// Allowed // Allowed
print '</a>'; print '</a>';
@ -308,8 +319,7 @@ class MenuManager
//var_dump($submenu); //var_dump($submenu);
print '</ul>'; print '</ul>';
} }
if ($val['enabled'] == 2) if ($val['enabled'] == 2) {
{
print '<font class="vsmenudisabled">'.$val['titre'].'</font>'; print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
} }
print '</li>'; print '</li>';
@ -317,8 +327,7 @@ class MenuManager
} }
} }
if ($mode == 'left') if ($mode == 'left') {
{
// Put here left menu entries // Put here left menu entries
// ***** START ***** // ***** START *****
@ -343,28 +352,40 @@ class MenuManager
// ***** END ***** // ***** END *****
$menu_array_before = array();
$menu_array_after = array();
// do not change code after this // do not change code after this
if (empty($noout)) $menu_array = $this->menu->liste;
{ if (is_array($menu_array_before)) {
$menu_array = array_merge($menu_array_before, $menu_array);
}
if (is_array($menu_array_after)) {
$menu_array = array_merge($menu_array, $menu_array_after);
}
//var_dump($menu_array);exit;
if (!is_array($menu_array)) {
return 0;
}
if (empty($noout)) {
$alt = 0; $altok = 0; $blockvmenuopened = false; $alt = 0; $altok = 0; $blockvmenuopened = false;
$num = count($this->menu->liste); $num = count($menu_array);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++) {
{
$alt++; $alt++;
if (empty($this->menu->liste[$i]['level'])) if (empty($menu_array[$i]['level'])) {
{
$altok++; $altok++;
$blockvmenuopened = true; $blockvmenuopened = true;
$lastopened = true; $lastopened = true;
for ($j = ($i + 1); $j < $num; $j++) for ($j = ($i + 1); $j < $num; $j++) {
{ if (empty($menu_array[$j]['level'])) {
if (empty($menu_array[$j]['level'])) $lastopened = false; $lastopened = false;
}
} }
$alt = 0; // For menu manager "empty", we force to not have blockvmenufirst defined $alt = 0; // For menu manager "empty", we force to not have blockvmenufirst defined
$lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined $lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
if (($alt % 2 == 0)) if (($alt % 2 == 0)) {
{
print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n"; print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n";
} else { } else {
print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n"; print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n";
@ -373,122 +394,70 @@ class MenuManager
// Add tabulation // Add tabulation
$tabstring = ''; $tabstring = '';
$tabul = ($this->menu->liste[$i]['level'] - 1); $tabul = ($menu_array[$i]['level'] - 1);
if ($tabul > 0) if ($tabul > 0) {
{ for ($j = 0; $j < $tabul; $j++) {
for ($j = 0; $j < $tabul; $j++)
{
$tabstring .= '&nbsp; &nbsp;'; $tabstring .= '&nbsp; &nbsp;';
} }
} }
if ($this->menu->liste[$i]['level'] == 0) { if ($menu_array[$i]['level'] == 0) {
if ($this->menu->liste[$i]['enabled']) if ($menu_array[$i]['enabled']) {
{ print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($menu_array[$i]['url'], 1).'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>'.$menu_array[$i]['titre'].'</a></div>'."\n";
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>'.$this->menu->liste[$i]['titre'].'</a></div>'."\n";
} else { } else {
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu->liste[$i]['titre'].'</font></div>'."\n"; print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'."\n";
} }
print '<div class="menu_top"></div>'."\n"; print '<div class="menu_top"></div>'."\n";
} }
if ($this->menu->liste[$i]['level'] > 0) if ($menu_array[$i]['level'] > 0) {
{
$cssmenu = ''; $cssmenu = '';
if ($this->menu->liste[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $this->menu->liste[$i]['url'])); if ($menu_array[$i]['url']) {
$cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url']));
}
print '<div class="menu_contenu'.$cssmenu.'">'; print '<div class="menu_contenu'.$cssmenu.'">';
if ($this->menu->liste[$i]['enabled']) if ($menu_array[$i]['enabled']) {
{
print $tabstring; print $tabstring;
if ($this->menu->liste[$i]['url']) print '<a class="vsmenu" itle="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'" href="'.dol_buildpath($this->menu->liste[$i]['url'], 1).'"'.($this->menu->liste[$i]['target'] ? ' target="'.$this->menu->liste[$i]['target'].'"' : '').'>'; if ($menu_array[$i]['url']) {
else print '<span class="vsmenu" title="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'">'; print '<a class="vsmenu" itle="'.dol_escape_htmltag($menu_array[$i]['titre']).'" href="'.dol_buildpath($menu_array[$i]['url'], 1).'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
if ($this->menu->liste[$i]['url']) print $this->menu->liste[$i]['titre'].'</a>'; } else {
else print '</span>'; print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
}
if ($menu_array[$i]['url']) {
print $menu_array[$i]['titre'].'</a>';
} else {
print '</span>';
}
} else { } else {
print $tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$this->menu->liste[$i]['titre'].'</font>'; print $tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font>';
} }
// If title is not pure text and contains a table, no carriage return added // If title is not pure text and contains a table, no carriage return added
if (!strstr($this->menu->liste[$i]['titre'], '<table')) print '<br>'; if (!strstr($menu_array[$i]['titre'], '<table')) {
print '<br>';
}
print '</div>'."\n"; print '</div>'."\n";
} }
// If next is a new block or end // If next is a new block or end
if (empty($this->menu->liste[$i + 1]['level'])) if (empty($menu_array[$i + 1]['level'])) {
{
print '<div class="menu_end"></div>'."\n"; print '<div class="menu_end"></div>'."\n";
print "</div>\n"; print "</div>\n";
} }
} }
if ($altok) print '<div class="blockvmenuend"></div>'; if ($altok) {
print '<div class="blockvmenuend"></div>';
}
} }
if ($mode == 'jmobile') if ($mode == 'jmobile') {
{
$this->leftmenu = clone $this->menu; $this->leftmenu = clone $this->menu;
unset($this->menu->liste); unset($menu_array);
} }
} }
/*
if ($mode == 'jmobile')
{
$substitarray = getCommonSubstitutionArray($langs, 0, null, null);
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">';
$val['url'] = make_substitutions($val['url'], $substitarray);
if ($val['enabled'] == 1)
{
$relurl=dol_buildpath($val['url'],1);
print '<a href="#">'.$val['titre'].'</a>'."\n";
// Search submenu fot this entry
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
//$submenu=new Menu();
//$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
//$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$submenu=$this->leftmenu;
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
$canonnexturl=preg_replace('/\?.*$/','',$nexturl);
//var_dump($canonrelurl);
//var_dump($canonnexturl);
print '<ul>';
if ($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('home','tools')))
{
// We add sub entry
print '<li><a href="'.$relurl.'">'.$langs->trans("MainArea").'-'.$val['titre'].'</a></li>'."\n";
}
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
$val2['url'] = make_substitutions($val2['url'], $substitarray);
$relurl2=dol_buildpath($val2['url'],1);
//var_dump($val2);
print '<li><a href="'.$relurl2.'">'.$val2['titre'].'</a></li>'."\n";
}
//var_dump($submenu);
print '</ul>';
}
if ($val['enabled'] == 2)
{
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
}
print '</li>';
print '</ul>'."\n";
break; // Only first menu entry (so home)
}
}
*/
unset($this->menu); unset($this->menu);
return $res; return $res;
@ -519,8 +488,7 @@ function print_start_menu_array_empty()
*/ */
function print_start_menu_entry_empty($idsel, $classname, $showmode) function print_start_menu_entry_empty($idsel, $classname, $showmode)
{ {
if ($showmode) if ($showmode) {
{
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">'; print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
//print '<div class="tmenuleft tmenusep"></div>'; //print '<div class="tmenuleft tmenusep"></div>';
print '<div class="tmenucenter">'; print '<div class="tmenucenter">';
@ -543,8 +511,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
{ {
global $conf, $langs; global $conf, $langs;
if ($showmode == 1) if ($showmode == 1) {
{
print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>'; print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>'; print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>'; print '</a>';
@ -554,8 +521,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
print '</span>'; print '</span>';
print '</a>'; print '</a>';
} }
if ($showmode == 2) if ($showmode == 2) {
{
print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>'; print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'; print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
} }
@ -569,8 +535,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
*/ */
function print_end_menu_entry_empty($showmode) function print_end_menu_entry_empty($showmode)
{ {
if ($showmode) if ($showmode) {
{
print '</div></li>'; print '</div></li>';
print "\n"; print "\n";
} }

View File

@ -1250,12 +1250,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
//print "Remove box ".$file.'<br>'; //print "Remove box ".$file.'<br>';
if ($file == 'box_graph_product_distribution.php') { if ($file == 'box_graph_product_distribution.php') {
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
dol_syslog("We discard disabling of module ".$file." because another module still active require it."); dol_syslog("We discard deleting module ".$file." because another module still active requires it.");
continue; continue;
} }
} }
if (empty($file)) { $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : ''; // For backward compatibility if (empty($file)) {
$file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : ''; // For backward compatibility
} }
if ($this->db->type == 'sqlite3') { if ($this->db->type == 'sqlite3') {
@ -1284,7 +1285,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
$sql .= " WHERE file = '".$this->db->escape($file)."'"; $sql .= " WHERE file = '".$this->db->escape($file)."'";
$sql .= " AND entity = ".$conf->entity; $sql .= " AND entity = ".$conf->entity; // Do not use getEntity here, we want to delete only in current company
dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG); dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@ -454,6 +454,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
// Replace tags of object + external modules // Replace tags of object + external modules
$tmparray = $this->get_substitutionarray_shipment($object, $outputlangs); $tmparray = $this->get_substitutionarray_shipment($object, $outputlangs);
complete_substitutions_array($tmparray, $outputlangs, $object); complete_substitutions_array($tmparray, $outputlangs, $object);
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);

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