Merge remote-tracking branch 'upstream/develop' into 14a5
This commit is contained in:
commit
78dc1eaa83
10
.github/CONTRIBUTING.md
vendored
10
.github/CONTRIBUTING.md
vendored
@ -4,13 +4,14 @@ How to contribute to Dolibarr
|
||||
Bug reports and feature requests
|
||||
--------------------------------
|
||||
|
||||
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum).
|
||||
<a name="not-a-support-forum"></a>*Note*: Issues are not a support forum. If you need help using the software, please use [the forums](https://www.dolibarr.org/forum.php). Forums exist in different languages.
|
||||
|
||||
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
|
||||
Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
|
||||
Default language here is english. So please prepare your contributions in english.
|
||||
|
||||
1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem.
|
||||
2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request.
|
||||
4. Tell us the version you are using!
|
||||
4. Tell us the version you are using! (look at /htdocs/admin/system/dolibarr.php? and check if you are using the latest version)
|
||||
3. Write a report with as much detail as possible (Use [screenshots](https://help.github.com/articles/issue-attachments) or even screencasts and provide logging and debugging informations whenever possible).
|
||||
|
||||
|
||||
@ -26,7 +27,8 @@ Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues).
|
||||
4. Commit and push your changes.
|
||||
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
|
||||
|
||||
### <a name="branches"></a>Branches
|
||||
<span id="branches" name="branches"></span>
|
||||
### Branches
|
||||
|
||||
Unless you're fixing a bug, all pull requests should be made against the *develop* branch.
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
ChartJS 2.9.3 MIT License Yes JS library for graph
|
||||
ChartJS 2.9.4 MIT License Yes JS library for graph
|
||||
jQuery 3.5.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect. Warning: 4.0.6+ create troubles without patching css
|
||||
|
||||
37
ChangeLog
37
ChangeLog
@ -31,7 +31,7 @@ NEW: add column payment term into list of supplier invoices
|
||||
NEW: add column quantity in product margin page
|
||||
NEW: add column vat rate in page to define accounting account on product/service
|
||||
NEW: add costprice in fields of products list
|
||||
NEW: added an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
|
||||
NEW: add an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE
|
||||
NEW: add employee link in expense report binding page
|
||||
NEW: add EORI No. as ProfID5
|
||||
NEW: add export for various payments
|
||||
@ -181,10 +181,9 @@ NEW: #15065 Add option to put the product label in bold in the PDF templates if
|
||||
For developers:
|
||||
---------------
|
||||
NEW: add __MEMBER_TYPE__ substitution key
|
||||
NEW: add __TYPE__ substitution key
|
||||
NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open page into a popup
|
||||
NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
|
||||
NEW: API get contacts list of a given order
|
||||
NEW: API endpoint getContacts and Clean results
|
||||
NEW: Add some fields to link website page to an other object
|
||||
NEW: fill ECM src object fields in dol_add_file_process
|
||||
NEW: conf to allow to show the full tree in warehouse popup
|
||||
@ -194,10 +193,6 @@ NEW: can add event to log into blockedlog module with a constant
|
||||
NEW: add property cssview when declaring fields of an object
|
||||
NEW: Can use dynamic code into the 'enabled' property of DAO fields
|
||||
NEW: allow to edit "demand reason" field though API
|
||||
NEW: API can update a payment
|
||||
NEW: API get member by thirdparty
|
||||
NEW: API get thirdparty by barcode
|
||||
NEW: API get users by email / login
|
||||
NEW: fetch contact by email with REST API
|
||||
NEW: field ref_ext in llx_commandedet
|
||||
NEW: fields ref_ext for Attributes and Combinations
|
||||
@ -213,9 +208,17 @@ NEW: Triggers Attributes and Attributes values
|
||||
NEW: added incoterms data into the substitution array
|
||||
NEW: add send context for ticket
|
||||
NEW: add a message in error_log after detection of SQL or script injection
|
||||
NEW: add __TYPE__ substitution key
|
||||
NEW: add validation of MX domain for emails
|
||||
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
|
||||
NEW: Graphics can be horizontal bars
|
||||
|
||||
APIs
|
||||
NEW: API get contacts list of a given order
|
||||
NEW: API endpoint getContacts and Clean results
|
||||
NEW: API can update a payment
|
||||
NEW: API get member by thirdparty
|
||||
NEW: API get thirdparty by barcode
|
||||
NEW: API get users by email / login
|
||||
|
||||
HOOKs
|
||||
NEW: Hook on propal card
|
||||
@ -242,7 +245,7 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The API addPayment for api_invoice has evolved to accept amount into a foreign currency. You must provide array(amount=>X,mutlicurrency_ammount=>Y) instead of simple amount.
|
||||
* The method select_thirdparty(), deprecated since 3.8, into html.form.class.php has been removed.
|
||||
* Depreciate all methods with name ->valide(). Use instead methods ->validate().
|
||||
|
||||
* Function showStripePaymentUrl, getStripePaymentUrl, showPaypalPaymentUrl and getPaypalPaymentUrl has been removed. The generic one showOnlinePaymentUrl and getOnlinePaymentUrl are always used.
|
||||
|
||||
|
||||
***** ChangeLog for 12.0.3 compared to 12.0.2 *****
|
||||
@ -379,8 +382,8 @@ FIX: SQL Problem in customer invoice list
|
||||
FIX: SQL Problem in social contribution list
|
||||
FIX: SQL Problem in supplier invoice list
|
||||
FIX: SQL syntax error when editing extrafields
|
||||
FIX: Sql type
|
||||
FIX: takepos 12 hook
|
||||
FIX: SQL type
|
||||
FIX: TakePOS 12 hook
|
||||
FIX: Update form erased extrafields that were hidden
|
||||
FIX: Update of extrafields date
|
||||
FIX: Update of extrafiels on draft object
|
||||
@ -394,7 +397,7 @@ For users:
|
||||
|
||||
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||
NEW: Receipt printer module moved from 'development' to 'experimental'
|
||||
NEW: Add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists.
|
||||
NEW: add option MAIN_VIEW_LINE_NUMBER_IN_LIST for some lists
|
||||
NEW: add numbering module for TakePOS module
|
||||
NEW: 2 new options when creating an invoice from time spent on a project : by period or by task
|
||||
NEW: Accountancy add column thirdparty on binding page
|
||||
@ -405,19 +408,19 @@ NEW: Accountancy - Add possibility to manage a short alternative label for accou
|
||||
NEW: Accountancy - General ledger - Add an option to search not reconciled lines
|
||||
NEW: Add accountancy code of thirdparty in contact and supplier export
|
||||
NEW: support webp image format
|
||||
NEW: Add checkbox "overwrite if exists" into ECM/DMS module
|
||||
NEW: add checkbox "overwrite if exists" into ECM/DMS module
|
||||
NEW: add a link to notes in members list
|
||||
NEW: add a parameter to group same products in TakePOS
|
||||
NEW: add a parameter to sort product by label in TakePOS
|
||||
NEW: Add a profil to import contact categories
|
||||
NEW: Add company extrafields into order export
|
||||
NEW: add a profil to import contact categories
|
||||
NEW: add company extrafields into order export
|
||||
NEW: add const CASHDESK_FORCE_DECREASE_STOCK to force batch decrementation
|
||||
NEW: add const TAKEPOS_NUMPAD_USE_PAYMENT_ICON to use icons on payment buttons
|
||||
NEW: add csv separator setup in module admin
|
||||
NEW: add dedicated substitutions keys for extrafields of type date and datetime
|
||||
NEW: add default warehouse for dispatch
|
||||
NEW: Add due date in feature "Export accounting documents"
|
||||
NEW: Add duration information for fichinter
|
||||
NEW: add due date in feature "Export accounting documents"
|
||||
NEW: add duration information for fichinter
|
||||
NEW: Start support of Dark theme into ELDY theme
|
||||
NEW: Add field author public alias for blog post on website module
|
||||
NEW: Add "finished" field on product list
|
||||
|
||||
16
README.md
16
README.md
@ -71,6 +71,7 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
|
||||
|
||||
- Follow the installer instructions
|
||||
|
||||
|
||||
### Saas/Cloud setup
|
||||
|
||||
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
|
||||
@ -86,6 +87,7 @@ Dolibarr supports upgrading usually wihtout the need for any (commercial) suppor
|
||||
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
|
||||
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
|
||||
|
||||
|
||||
## WHAT'S NEW
|
||||
|
||||
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
|
||||
@ -164,15 +166,18 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Flexible PDF & ODT generation for invoices, proposals, orders...
|
||||
- …
|
||||
|
||||
|
||||
### System Environment / Requirements
|
||||
|
||||
- Works with PHP 5.6+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
|
||||
- Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites.
|
||||
|
||||
|
||||
### Extending
|
||||
|
||||
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
|
||||
|
||||
|
||||
## WHAT DOLIBARR CAN'T DO YET
|
||||
|
||||
These are features that Dolibarr does **not** yet fully support:
|
||||
@ -182,22 +187,29 @@ These are features that Dolibarr does **not** yet fully support:
|
||||
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
|
||||
- Dolibarr can't do coffee (yet)
|
||||
|
||||
|
||||
## DOCUMENTATION
|
||||
|
||||
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
|
||||
|
||||
|
||||
## CONTRIBUTING
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
|
||||
This project exists thanks to all the people who contribute.
|
||||
Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
|
||||
|
||||
A view on Contributors:
|
||||
|
||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
|
||||
## CREDITS
|
||||
|
||||
Dolibarr is the work of many contributors over the years and uses some fine PHP libraries.
|
||||
|
||||
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
|
||||
|
||||
|
||||
## NEWS AND SOCIAL NETWORKS
|
||||
|
||||
Follow Dolibarr project on:
|
||||
@ -208,6 +220,8 @@ Follow Dolibarr project on:
|
||||
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
|
||||
- [GitHub](https://github.com/Dolibarr/dolibarr)
|
||||
|
||||
|
||||
### Sponsors
|
||||
|
||||
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]
|
||||
|
||||
|
||||
@ -12,8 +12,7 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a vulnerability, please send an email to security@dolibarr.org
|
||||
In most cases, after fixing the security, we make an answer by email to say the issue has been fixed.
|
||||
To report a vulnerability, please use GitHub security advisory (alternatively send an email to security@dolibarr.org)
|
||||
|
||||
|
||||
## Hunting vulnerabilities on Dolibarr
|
||||
|
||||
@ -581,23 +581,36 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||
|
||||
# Removed other test files
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/.gitignore $BUILDROOT/$PROJECT/*/.gitignore $BUILDROOT/$PROJECT/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/.gitignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.gitignore`;
|
||||
|
||||
# Removed files installed by the awful composer
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/geoip/sample*.*`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/bin`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/adapters`; # Keep this removal in case we embed libraries
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/ckeditor/samples`; # Keep this removal in case we embed libraries
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/ckeditor/_source`; # _source must be kept into tarball for official debian, not for the rest
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/composer`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/doctrine`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/select2/release.sh`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/.github`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/docs`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`;
|
||||
@ -612,21 +625,17 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/ae_fonts_*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/utils`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/LICENSE.TXT`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/examples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||
}
|
||||
|
||||
# Build package for each target
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
"nnnick/chartjs" : "^2.9",
|
||||
"stripe/stripe-php" : "6.43.1",
|
||||
"maximebf/debugbar" : "1.15.1",
|
||||
"symfony/var-dumper": "3"
|
||||
"symfony/var-dumper" : "3"
|
||||
},
|
||||
"require-dev" : {
|
||||
"php-parallel-lint/php-parallel-lint" : "^0",
|
||||
|
||||
263
composer.lock
generated
263
composer.lock
generated
@ -6,6 +6,53 @@
|
||||
],
|
||||
"content-hash": "1dbd2d05cc0836acfca5988f29005cf2",
|
||||
"packages": [
|
||||
{
|
||||
"name": "Psr/log",
|
||||
"version": "1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
|
||||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2020-03-23T09:12:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ckeditor/ckeditor",
|
||||
"version": "4.12.1",
|
||||
@ -217,16 +264,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nnnick/chartjs",
|
||||
"version": "v2.9.3",
|
||||
"version": "v2.9.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chartjs/Chart.js.git",
|
||||
"reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2"
|
||||
"reference": "9bd4cf82fda9f50a5fb50b72843e06ab88124278"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chartjs/Chart.js/zipball/06f73dc3590084b2c464bf08189c7aee2b6b92d2",
|
||||
"reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2",
|
||||
"url": "https://api.github.com/repos/chartjs/Chart.js/zipball/9bd4cf82fda9f50a5fb50b72843e06ab88124278",
|
||||
"reference": "9bd4cf82fda9f50a5fb50b72843e06ab88124278",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -254,7 +301,11 @@
|
||||
"JS",
|
||||
"chart"
|
||||
],
|
||||
"time": "2019-11-14T18:37:30+00:00"
|
||||
"support": {
|
||||
"issues": "https://github.com/chartjs/Chart.js/issues",
|
||||
"source": "https://github.com/chartjs/Chart.js/tree/v2.9.4"
|
||||
},
|
||||
"time": "2020-10-19T12:22:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
@ -314,53 +365,6 @@
|
||||
"abandoned": "phpoffice/phpspreadsheet",
|
||||
"time": "2015-05-01T07:00:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
|
||||
"reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2020-03-23T09:12:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "restler/framework",
|
||||
"version": "3.0.0-RC6",
|
||||
@ -2037,159 +2041,6 @@
|
||||
],
|
||||
"time": "2019-08-06T08:03:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php72",
|
||||
"version": "v1.18.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php72.git",
|
||||
"reference": "639447d008615574653fb3bc60d1986d7172eaae"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/639447d008615574653fb3bc60d1986d7172eaae",
|
||||
"reference": "639447d008615574653fb3bc60d1986d7172eaae",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php72\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.18.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981",
|
||||
"reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php80\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-14T12:35:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v3.4.32",
|
||||
@ -2312,5 +2163,5 @@
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "1.1.0"
|
||||
"plugin-api-version": "2.0.0"
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
"npm": ">=5.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"zapier-platform-core": "10.1.1"
|
||||
"zapier-platform-core": "10.1.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "^5.2.0",
|
||||
|
||||
@ -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".
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2013-2017 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -128,8 +128,7 @@ if ($action == "confirm_update") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
if ($mode != '_tmp') {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
@ -165,14 +164,14 @@ if ($action == "confirm_update") {
|
||||
$object->label_operation = $label_operation;
|
||||
$object->debit = $debit;
|
||||
$object->credit = $credit;
|
||||
$object->doc_date = GETPOST('doc_date', 'alpha');
|
||||
$object->doc_type = GETPOST('doc_type', 'alpha');
|
||||
$object->doc_date = (string) GETPOST('doc_date', 'alpha');
|
||||
$object->doc_type = (string) GETPOST('doc_type', 'alpha');
|
||||
$object->piece_num = $piece_num;
|
||||
$object->doc_ref = GETPOST('doc_ref', 'alpha');
|
||||
$object->doc_ref = (string) GETPOST('doc_ref', 'alpha');
|
||||
$object->code_journal = $journal_code;
|
||||
$object->journal_label = $journal_label;
|
||||
$object->fk_doc = (int) GETPOST('fk_doc', 'int');
|
||||
$object->fk_docdet = (int) GETPOST('fk_docdet', 'int');
|
||||
$object->fk_doc = GETPOSTINT('fk_doc');
|
||||
$object->fk_docdet = GETPOSTINT('fk_docdet');
|
||||
|
||||
if (floatval($debit) != 0.0) {
|
||||
$object->montant = $debit; // deprecated
|
||||
@ -190,8 +189,7 @@ if ($action == "confirm_update") {
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
if ($mode != '_tmp')
|
||||
{
|
||||
if ($mode != '_tmp') {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class AccountingJournal extends CommonObject
|
||||
public $table_element = 'accounting_journal';
|
||||
|
||||
/**
|
||||
* @var int Field with ID of parent key if this field has a parent
|
||||
* @var string Fieldname with ID of parent key if this field has a parent
|
||||
*/
|
||||
public $fk_element = '';
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
@ -103,13 +103,19 @@ if ($conf->accounting->enabled)
|
||||
|
||||
// STEPS
|
||||
$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";
|
||||
$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";
|
||||
$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";
|
||||
@ -118,60 +124,45 @@ if ($conf->accounting->enabled)
|
||||
print "<br>\n";
|
||||
|
||||
$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";
|
||||
|
||||
$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";
|
||||
|
||||
$step++;
|
||||
$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";
|
||||
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>';
|
||||
$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";
|
||||
}
|
||||
/*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.
|
||||
{
|
||||
$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";
|
||||
}
|
||||
/*
|
||||
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++;
|
||||
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";
|
||||
|
||||
|
||||
@ -188,26 +179,34 @@ if ($conf->accounting->enabled)
|
||||
$langs->loadLangs(array('bills', 'trips'));
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '<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";
|
||||
|
||||
$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";
|
||||
|
||||
if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
|
||||
{
|
||||
$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";
|
||||
}
|
||||
|
||||
$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";
|
||||
|
||||
$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>';
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* 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 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 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
*
|
||||
@ -73,15 +73,18 @@ $date_endmonth = GETPOST('date_endmonth', 'int');
|
||||
$date_endday = GETPOST('date_endday', 'int');
|
||||
$date_endyear = GETPOST('date_endyear', 'int');
|
||||
$in_bookkeeping = GETPOST('in_bookkeeping', 'aZ09');
|
||||
if ($in_bookkeeping == '') $in_bookkeeping = 'notyet';
|
||||
if ($in_bookkeeping == '') {
|
||||
$in_bookkeeping = 'notyet';
|
||||
}
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0 && empty($id_journal))
|
||||
if ($user->socid > 0 && empty($id_journal)) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -93,8 +96,7 @@ $error = 0;
|
||||
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
|
||||
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
if (empty($date_startmonth) || empty($date_endmonth))
|
||||
{
|
||||
if (empty($date_startmonth) || empty($date_endmonth)) {
|
||||
// Period by default on transfer
|
||||
$dates = getDefaultDatesForTransfer();
|
||||
$date_start = $dates['date_start'];
|
||||
@ -103,8 +105,7 @@ if (empty($date_startmonth) || empty($date_endmonth))
|
||||
$pastmonth = $dates['pastmonth'];
|
||||
}
|
||||
|
||||
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
|
||||
{
|
||||
if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) { // We define date_start and date_end, only if we did not submit the form
|
||||
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
|
||||
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
@ -124,19 +125,18 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
|
||||
$sql .= " WHERE ba.fk_accountancy_journal=".$id_journal;
|
||||
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
|
||||
if ($date_start && $date_end)
|
||||
if ($date_start && $date_end) {
|
||||
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
// Define begin binding date
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
if ($in_bookkeeping == 'already')
|
||||
{
|
||||
if ($in_bookkeeping == 'already') {
|
||||
$sql .= " AND (b.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||
}
|
||||
if ($in_bookkeeping == 'notyet')
|
||||
{
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
|
||||
}
|
||||
$sql .= " ORDER BY b.datev";
|
||||
@ -177,9 +177,9 @@ if ($result) {
|
||||
//print $sql;
|
||||
|
||||
// Variables
|
||||
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
@ -198,23 +198,28 @@ if ($result) {
|
||||
// one line for bank record = tabbq
|
||||
// one line for thirdparty record = tabtp
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$lineisapurchase = -1;
|
||||
$lineisasale = -1;
|
||||
// Old method to detect if it's a sale or purchase
|
||||
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 1;
|
||||
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale = 1;
|
||||
// Try a more reliable method to detect if record is a supplier payment or a customer payment
|
||||
if ($lineisapurchase < 0)
|
||||
{
|
||||
if ($obj->typeop_payment_supplier == 'payment_supplier') $lineisapurchase = 1;
|
||||
if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') {
|
||||
$lineisapurchase = 1;
|
||||
}
|
||||
if ($lineisasale < 0)
|
||||
{
|
||||
if ($obj->typeop_payment == 'payment') $lineisasale = 1;
|
||||
if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') {
|
||||
$lineisasale = 1;
|
||||
}
|
||||
// Try a more reliable method to detect if record is a supplier payment or a customer payment
|
||||
if ($lineisapurchase < 0) {
|
||||
if ($obj->typeop_payment_supplier == 'payment_supplier') {
|
||||
$lineisapurchase = 1;
|
||||
}
|
||||
}
|
||||
if ($lineisasale < 0) {
|
||||
if ($obj->typeop_payment == 'payment') {
|
||||
$lineisasale = 1;
|
||||
}
|
||||
}
|
||||
//var_dump($obj->type_payment); var_dump($obj->type_payment_supplier);
|
||||
//var_dump($lineisapurchase); //var_dump($lineisasale);
|
||||
@ -224,28 +229,30 @@ if ($result) {
|
||||
|
||||
// Set accountancy code for thirdparty (example: '411CU...' or '411' if no subledger account defined on customer)
|
||||
$compta_soc = 'NotDefined';
|
||||
if ($lineisapurchase > 0)
|
||||
if ($lineisapurchase > 0) {
|
||||
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
|
||||
if ($lineisasale > 0)
|
||||
}
|
||||
if ($lineisasale > 0) {
|
||||
$compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer);
|
||||
}
|
||||
|
||||
$tabcompany[$obj->rowid] = array(
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_compta' => $compta_soc,
|
||||
'email' => $obj->email
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_compta' => $compta_soc,
|
||||
'email' => $obj->email
|
||||
);
|
||||
|
||||
// Set accountancy code for user
|
||||
$compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : '');
|
||||
|
||||
$tabuser[$obj->rowid] = array(
|
||||
'id' => $obj->userid,
|
||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||
'lastname' => $obj->lastname,
|
||||
'firstname' => $obj->firstname,
|
||||
'email' => $obj->useremail,
|
||||
'accountancy_code' => $compta_user
|
||||
'id' => $obj->userid,
|
||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||
'lastname' => $obj->lastname,
|
||||
'firstname' => $obj->firstname,
|
||||
'email' => $obj->useremail,
|
||||
'accountancy_code' => $compta_user
|
||||
);
|
||||
|
||||
// Variable bookkeeping ($obj->rowid is Bank Id)
|
||||
@ -264,10 +271,6 @@ if ($result) {
|
||||
// Load of url links to the line into llx_bank
|
||||
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
||||
|
||||
//var_dump($i);
|
||||
//var_dump($tabpay);
|
||||
//var_dump($tabcompany);
|
||||
|
||||
// By default
|
||||
$tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
|
||||
$tabtype[$obj->rowid] = 'unknown';
|
||||
@ -277,17 +280,14 @@ if ($result) {
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
// Now loop on each link of record in bank.
|
||||
foreach ($links as $key => $val) {
|
||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various')))
|
||||
{
|
||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various'))) {
|
||||
// So we excluded 'company' and 'user' here. We want only payment lines
|
||||
|
||||
// We save tabtype for a future use, to remember what kind of payment it is
|
||||
$tabpay[$obj->rowid]['type'] = $links[$key]['type'];
|
||||
$tabtype[$obj->rowid] = $links[$key]['type'];
|
||||
} elseif (in_array($links[$key]['type'], array('company', 'user')))
|
||||
{
|
||||
if ($tabpay[$obj->rowid]['type'] == 'unknown')
|
||||
{
|
||||
} elseif (in_array($links[$key]['type'], array('company', 'user'))) {
|
||||
if ($tabpay[$obj->rowid]['type'] == 'unknown') {
|
||||
// We can guess here it is a bank record for a thirdparty company or a user.
|
||||
// But we won't be able to record somewhere else than into a waiting account, because there is no other journal to record the contreparty.
|
||||
}
|
||||
@ -312,16 +312,23 @@ if ($result) {
|
||||
$societestatic->name = $links[$key]['label'];
|
||||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||
if ($compta_soc) $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
if ($compta_soc) {
|
||||
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'user') {
|
||||
$userstatic->id = $links[$key]['url_id'];
|
||||
$userstatic->name = $links[$key]['label'];
|
||||
$userstatic->email = $tabuser[$obj->rowid]['email'];
|
||||
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
|
||||
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
|
||||
if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
||||
else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||
if ($userstatic->id > 0) {
|
||||
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
||||
} else {
|
||||
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||
}
|
||||
if ($compta_user) {
|
||||
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||
}
|
||||
} elseif ($links[$key]['type'] == 'sc') {
|
||||
$chargestatic->id = $links[$key]['url_id'];
|
||||
$chargestatic->ref = $links[$key]['url_id'];
|
||||
@ -329,8 +336,9 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
|
||||
$reg = array();
|
||||
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
|
||||
if ($reg[1] == 'socialcontribution')
|
||||
if ($reg[1] == 'socialcontribution') {
|
||||
$reg[1] = 'SocialContribution';
|
||||
}
|
||||
$chargestatic->label = $langs->trans($reg[1]);
|
||||
} else {
|
||||
$chargestatic->label = $links[$key]['label'];
|
||||
@ -430,20 +438,17 @@ if ($result) {
|
||||
|
||||
// If no links were found to know the amount on thirdparty, we try to guess it.
|
||||
// This may happens on bank entries without the links lines to 'company'.
|
||||
if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record
|
||||
{
|
||||
if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) { // If we dont find 'company' link because it is an old 'withdraw' record
|
||||
foreach ($links as $key => $val) {
|
||||
if ($links[$key]['type'] == 'payment') {
|
||||
// Get thirdparty
|
||||
$tmppayment->fetch($links[$key]['url_id']);
|
||||
$arrayofamounts = $tmppayment->getAmountsArray();
|
||||
if (is_array($arrayofamounts)) {
|
||||
foreach ($arrayofamounts as $invoiceid => $amount)
|
||||
{
|
||||
foreach ($arrayofamounts as $invoiceid => $amount) {
|
||||
$tmpinvoice->fetch($invoiceid);
|
||||
$tmpinvoice->fetch_thirdparty();
|
||||
if ($tmpinvoice->thirdparty->code_compta)
|
||||
{
|
||||
if ($tmpinvoice->thirdparty->code_compta) {
|
||||
$tabtp[$obj->rowid][$tmpinvoice->thirdparty->code_compta] += $amount;
|
||||
}
|
||||
}
|
||||
@ -453,7 +458,9 @@ if ($result) {
|
||||
}
|
||||
|
||||
// If no links were found to know the amount on thirdparty, we init it to account 'NotDefined'.
|
||||
if (empty($tabtp[$obj->rowid])) $tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank];
|
||||
if (empty($tabtp[$obj->rowid])) {
|
||||
$tabtp[$obj->rowid]['NotDefined'] = $tabbq[$obj->rowid][$compta_bank];
|
||||
}
|
||||
|
||||
// Check account number is ok
|
||||
/*if ($action == 'writebookkeeping') // Make test now in such a case
|
||||
@ -494,8 +501,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$now = dol_now();
|
||||
|
||||
$error = 0;
|
||||
foreach ($tabpay as $key => $val) // $key is rowid into llx_bank
|
||||
{
|
||||
foreach ($tabpay as $key => $val) { // $key is rowid into llx_bank
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
@ -513,17 +519,18 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
var_dump($tabbq);exit;*/
|
||||
|
||||
// Bank
|
||||
if (!$errorforline && is_array($tabbq[$key]))
|
||||
{
|
||||
if (!$errorforline && is_array($tabbq[$key])) {
|
||||
// Line into bank account
|
||||
foreach ($tabbq[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
}
|
||||
$reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
|
||||
if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
|
||||
if (!empty($val['soclib'])) {
|
||||
$reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
|
||||
}
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
$bookkeeping->doc_date = $val["date"];
|
||||
@ -556,8 +563,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
@ -572,18 +578,16 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
}
|
||||
|
||||
// Third party
|
||||
if (!$errorforline)
|
||||
{
|
||||
if (is_array($tabtp[$key]))
|
||||
{
|
||||
if (!$errorforline) {
|
||||
if (is_array($tabtp[$key])) {
|
||||
// Line into thirdparty account
|
||||
foreach ($tabtp[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
|
||||
if ($tabtype[$key] == 'banktransfert')
|
||||
{
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
|
||||
}
|
||||
if ($tabtype[$key] == 'banktransfert') {
|
||||
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
||||
} else {
|
||||
$reflabel .= dol_string_nohtmltag($val['soclib']);
|
||||
@ -683,8 +687,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} else {
|
||||
if ($tabtype[$key] == 'unknown') // Unknown transaction, we will use a waiting account for thirdparty.
|
||||
{
|
||||
if ($tabtype[$key] == 'unknown') { // Unknown transaction, we will use a waiting account for thirdparty.
|
||||
// Temporary account
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
@ -702,8 +705,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
|
||||
$result = $bookkeeping->create($user);
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
@ -717,10 +719,11 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
}
|
||||
} else { // If thirdparty unknown, output the waiting account
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
}
|
||||
$reflabel .= dol_string_nohtmltag('WaitingAccount');
|
||||
|
||||
$bookkeeping = new BookKeeping($db);
|
||||
@ -747,8 +750,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$result = $bookkeeping->create($user);
|
||||
|
||||
if ($result < 0) {
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
|
||||
{
|
||||
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') { // Already exists
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
|
||||
@ -763,23 +765,20 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
}
|
||||
}
|
||||
|
||||
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))
|
||||
{
|
||||
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) {
|
||||
$error++;
|
||||
$errorforline++;
|
||||
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
|
||||
}
|
||||
|
||||
if (!$errorforline)
|
||||
{
|
||||
if (!$errorforline) {
|
||||
$db->commit();
|
||||
} else {
|
||||
//print 'KO for line '.$key.' '.$error.'<br>';
|
||||
$db->rollback();
|
||||
|
||||
$MAXNBERRORS = 5;
|
||||
if ($error >= $MAXNBERRORS)
|
||||
{
|
||||
if ($error >= $MAXNBERRORS) {
|
||||
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
|
||||
break; // Break in the foreach
|
||||
}
|
||||
@ -788,8 +787,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
|
||||
if (empty($error) && count($tabpay) > 0) {
|
||||
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
|
||||
} elseif (count($tabpay) == $error)
|
||||
{
|
||||
} elseif (count($tabpay) == $error) {
|
||||
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
|
||||
@ -798,8 +796,7 @@ if (!$error && $action == 'writebookkeeping') {
|
||||
$action = '';
|
||||
|
||||
// Must reload data, so we make a redirect
|
||||
if (count($tabpay) != $error)
|
||||
{
|
||||
if (count($tabpay) != $error) {
|
||||
$param = 'id_journal='.$id_journal;
|
||||
$param .= '&date_startday='.$date_startday;
|
||||
$param .= '&date_startmonth='.$date_startmonth;
|
||||
@ -837,20 +834,22 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
|
||||
print "\n";
|
||||
|
||||
foreach ($tabpay as $key => $val)
|
||||
{
|
||||
foreach ($tabpay as $key => $val) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
// Bank
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
}
|
||||
$reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
|
||||
if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
|
||||
if (!empty($val['soclib'])) {
|
||||
$reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
|
||||
}
|
||||
|
||||
print '"'.$key.'"'.$sep;
|
||||
print '"'.$date.'"'.$sep;
|
||||
@ -870,12 +869,12 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ($tabtp[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
|
||||
if ($tabtype[$key] == 'banktransfert')
|
||||
{
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
|
||||
}
|
||||
if ($tabtype[$key] == 'banktransfert') {
|
||||
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
|
||||
} else {
|
||||
$reflabel .= dol_string_nohtmltag($val['soclib']);
|
||||
@ -907,10 +906,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
}
|
||||
} else { // If thirdparty unkown, output the waiting account
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= dol_string_nohtmltag($val['lib'])." - ";
|
||||
}
|
||||
$reflabel .= dol_string_nohtmltag('WaitingAccount');
|
||||
|
||||
print '"'.$key.'"'.$sep;
|
||||
@ -967,16 +967,18 @@ if (empty($action) || $action == 'view') {
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE entity = '.$conf->entity.' AND fk_accountancy_journal IS NULL AND clos=0';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
if ($obj->nb > 0) {
|
||||
print '<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>';
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
// Button to write into Ledger
|
||||
@ -990,14 +992,19 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
print '<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'
|
||||
|| ($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").'" />';
|
||||
} else {
|
||||
if ($in_bookkeeping == 'notyet') 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>';
|
||||
if ($in_bookkeeping == 'notyet') {
|
||||
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>';
|
||||
@ -1040,21 +1047,22 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$r = '';
|
||||
|
||||
foreach ($tabpay as $key => $val) // $key is rowid in llx_bank
|
||||
{
|
||||
foreach ($tabpay as $key => $val) { // $key is rowid in llx_bank
|
||||
$date = dol_print_date($db->jdate($val["date"]), 'day');
|
||||
|
||||
$ref = getSourceDocRef($val, $tabtype[$key]);
|
||||
|
||||
// Bank
|
||||
foreach ($tabbq[$key] as $k => $mt)
|
||||
{
|
||||
if ($mt)
|
||||
{
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= $val['lib']." - ";
|
||||
}
|
||||
$reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref'];
|
||||
if (!empty($val['soclib'])) $reflabel .= " - ".$val['soclib'];
|
||||
if (!empty($val['soclib'])) {
|
||||
$reflabel .= " - ".$val['soclib'];
|
||||
}
|
||||
|
||||
//var_dump($tabpay[$key]);
|
||||
print '<!-- Bank bank.rowid='.$key.' type='.$tabpay[$key]['type'].' ref='.$tabpay[$key]['ref'].'-->';
|
||||
@ -1064,10 +1072,11 @@ if (empty($action) || $action == 'view') {
|
||||
// Ledger account
|
||||
print "<td>";
|
||||
$accounttoshow = length_accountg($k);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
|
||||
print '<span class="error">'.$langs->trans("BankAccountNotDefined").'</span>';
|
||||
} else print $accounttoshow;
|
||||
} else {
|
||||
print $accounttoshow;
|
||||
}
|
||||
print "</td>";
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
@ -1091,12 +1100,12 @@ if (empty($action) || $action == 'view') {
|
||||
// Third party
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ($tabtp[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
|
||||
if ($tabtype[$key] == 'banktransfert')
|
||||
{
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
|
||||
}
|
||||
if ($tabtype[$key] == 'banktransfert') {
|
||||
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
|
||||
} else {
|
||||
$reflabel .= $val['soclib'];
|
||||
@ -1110,21 +1119,32 @@ if (empty($action) || $action == 'view') {
|
||||
print "<td>";
|
||||
$account_ledger = $k;
|
||||
// Try to force general ledger account depending on type
|
||||
if ($tabtype[$key] == 'payment') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
if ($tabtype[$key] == 'payment_supplier') $account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
if ($tabtype[$key] == 'payment_expensereport') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
||||
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
||||
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"];
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_salary') {
|
||||
$account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_vat') {
|
||||
$account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
||||
}
|
||||
if ($tabtype[$key] == 'member') {
|
||||
$account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_various') {
|
||||
$account_ledger = $tabpay[$key]["account_various"];
|
||||
}
|
||||
$accounttoshow = length_accountg($account_ledger);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
if ($tabtype[$key] == 'unknown')
|
||||
{
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') {
|
||||
if ($tabtype[$key] == 'unknown') {
|
||||
// We will accept writing, but into a waiting account
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1')
|
||||
{
|
||||
if (empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) || $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE == '-1') {
|
||||
print '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
|
||||
} else {
|
||||
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 {
|
||||
// We will refuse writing
|
||||
$errorstring = 'UnknownAccountForThirdpartyBlocking';
|
||||
if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined';
|
||||
if ($tabtype[$key] == 'payment_supplier') $errorstring = 'MainAccountForSuppliersNotDefined';
|
||||
if ($tabtype[$key] == 'payment_expensereport') $errorstring = 'MainAccountForUsersNotDefined';
|
||||
if ($tabtype[$key] == 'payment_salary') $errorstring = 'MainAccountForUsersNotDefined';
|
||||
if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined';
|
||||
if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
$errorstring = 'MainAccountForCustomersNotDefined';
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_supplier') {
|
||||
$errorstring = 'MainAccountForSuppliersNotDefined';
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_expensereport') {
|
||||
$errorstring = 'MainAccountForUsersNotDefined';
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_salary') {
|
||||
$errorstring = 'MainAccountForUsersNotDefined';
|
||||
}
|
||||
if ($tabtype[$key] == 'payment_vat') {
|
||||
$errorstring = 'MainAccountForVatPaymentNotDefined';
|
||||
}
|
||||
if ($tabtype[$key] == 'member') {
|
||||
$errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
|
||||
}
|
||||
print '<span class="error">'.$langs->trans($errorstring).'</span>';
|
||||
}
|
||||
} else print $accounttoshow;
|
||||
} else {
|
||||
print $accounttoshow;
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
// Subledger account
|
||||
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);
|
||||
if ($accounttoshow != $accounttoshowsubledger)
|
||||
{
|
||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined')
|
||||
{
|
||||
if ($accounttoshow != $accounttoshowsubledger) {
|
||||
if (empty($accounttoshowsubledger) || $accounttoshowsubledger == 'NotDefined') {
|
||||
/*var_dump($tabpay[$key]);
|
||||
var_dump($tabtype[$key]);
|
||||
var_dump($tabbq[$key]);*/
|
||||
//print '<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'))) {
|
||||
// For such case, if subledger is not defined, we won't use subledger accounts.
|
||||
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").'</span>';
|
||||
@ -1167,7 +1197,9 @@ if (empty($action) || $action == 'view') {
|
||||
} else {
|
||||
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
|
||||
}
|
||||
} else print $accounttoshowsubledger;
|
||||
} else {
|
||||
print $accounttoshowsubledger;
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
@ -1180,10 +1212,11 @@ if (empty($action) || $action == 'view') {
|
||||
}
|
||||
} else { // Waiting account
|
||||
foreach ($tabbq[$key] as $k => $mt) {
|
||||
if ($mt)
|
||||
{
|
||||
if ($mt) {
|
||||
$reflabel = '';
|
||||
if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
|
||||
if (!empty($val['lib'])) {
|
||||
$reflabel .= $val['lib']." - ";
|
||||
}
|
||||
$reflabel .= 'WaitingAccount';
|
||||
|
||||
print '<!-- Wait bank.rowid='.$key.' -->';
|
||||
@ -1267,78 +1300,67 @@ function getSourceDocRef($val, $typerecord)
|
||||
}
|
||||
|
||||
$sqlmid = '';
|
||||
if ($typerecord == 'payment')
|
||||
{
|
||||
if ($typerecord == 'payment') {
|
||||
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
|
||||
$ref = $langs->transnoentitiesnoconv("Invoice");
|
||||
} elseif ($typerecord == 'payment_supplier')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_supplier') {
|
||||
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
|
||||
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
|
||||
} elseif ($typerecord == 'payment_expensereport')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_expensereport') {
|
||||
$sqlmid = 'SELECT e.rowid as id, e.ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
|
||||
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
|
||||
} elseif ($typerecord == 'payment_salary')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_salary') {
|
||||
$sqlmid = 'SELECT s.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
|
||||
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
|
||||
} elseif ($typerecord == 'sc')
|
||||
{
|
||||
} elseif ($typerecord == 'sc') {
|
||||
$sqlmid = 'SELECT sc.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
|
||||
$sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
|
||||
$ref = $langs->transnoentitiesnoconv("SocialContribution");
|
||||
} elseif ($typerecord == 'payment_vat')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_vat') {
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
|
||||
$sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
|
||||
$ref = $langs->transnoentitiesnoconv("PaymentVat");
|
||||
} elseif ($typerecord == 'payment_donation')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_donation') {
|
||||
$sqlmid = 'SELECT payd.fk_donation as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
|
||||
$sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
|
||||
$ref = $langs->transnoentitiesnoconv("Donation");
|
||||
} elseif ($typerecord == 'payment_loan')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_loan') {
|
||||
$sqlmid = 'SELECT l.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
|
||||
$sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
|
||||
$ref = $langs->transnoentitiesnoconv("LoanPayment");
|
||||
} elseif ($typerecord == 'payment_various')
|
||||
{
|
||||
} elseif ($typerecord == 'payment_various') {
|
||||
$sqlmid = 'SELECT v.rowid as ref';
|
||||
$sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||
$sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
|
||||
$ref = $langs->transnoentitiesnoconv("VariousPayment");
|
||||
}
|
||||
// Add warning
|
||||
if (empty($sqlmid))
|
||||
{
|
||||
if (empty($sqlmid)) {
|
||||
dol_syslog("Found a typerecord=".$typerecord." not supported", LOG_WARNING);
|
||||
}
|
||||
|
||||
if ($sqlmid)
|
||||
{
|
||||
if ($sqlmid) {
|
||||
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG);
|
||||
$resultmid = $db->query($sqlmid);
|
||||
if ($resultmid)
|
||||
{
|
||||
while ($objmid = $db->fetch_object($resultmid))
|
||||
{
|
||||
if ($resultmid) {
|
||||
while ($objmid = $db->fetch_object($resultmid)) {
|
||||
$ref .= ' '.$objmid->ref;
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
$ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
|
||||
|
||||
@ -103,6 +103,7 @@ class Adherent extends CommonObject
|
||||
* @var int Thirdparty ID
|
||||
*/
|
||||
public $fk_soc;
|
||||
public $socid;
|
||||
|
||||
/**
|
||||
* @var string Address
|
||||
@ -1262,14 +1263,15 @@ class Adherent extends CommonObject
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid";
|
||||
if ($rowid)
|
||||
$sql .= " AND d.rowid=".$rowid;
|
||||
elseif ($ref || $fk_soc) {
|
||||
if ($rowid) {
|
||||
$sql .= " AND d.rowid=".((int) $rowid);
|
||||
} elseif ($ref || $fk_soc) {
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if ($ref)
|
||||
if ($ref) {
|
||||
$sql .= " AND d.rowid='".$this->db->escape($ref)."'";
|
||||
elseif ($fk_soc > 0)
|
||||
$sql .= " AND d.fk_soc=".$fk_soc;
|
||||
} elseif ($fk_soc > 0) {
|
||||
$sql .= " AND d.fk_soc=".((int) $fk_soc);
|
||||
}
|
||||
} elseif ($ref_ext) {
|
||||
$sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
}
|
||||
|
||||
@ -31,7 +31,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'boxes', 'accountancy'));
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -46,8 +48,7 @@ $boxes = array();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'addconst')
|
||||
{
|
||||
if ($action == 'addconst') {
|
||||
dolibarr_set_const($db, "MAIN_BOXES_MAXLINES", $_POST["MAIN_BOXES_MAXLINES"], '', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_ACTIVATE_FILECACHE", $_POST["MAIN_ACTIVATE_FILECACHE"], 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
@ -59,8 +60,7 @@ if ($action == 'add') {
|
||||
$db->begin();
|
||||
if (is_array($boxids)) {
|
||||
foreach ($boxids as $boxid) {
|
||||
if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) // 0=Home, 1=...
|
||||
{
|
||||
if (is_numeric($boxid['pos']) && $boxid['pos'] >= 0) { // 0=Home, 1=...
|
||||
$pos = $boxid['pos'];
|
||||
|
||||
// Initialize distinct fk_user with all already existing values of fk_user (user that use a personalized view of boxes for page "pos")
|
||||
@ -72,12 +72,10 @@ if ($action == 'add') {
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$distinctfkuser[$obj->fk_user] = $obj->fk_user;
|
||||
$i++;
|
||||
@ -90,26 +88,28 @@ if ($action == 'add') {
|
||||
|
||||
$distinctfkuser['0'] = '0'; // Add entry for fk_user = 0. We must use string as key and val
|
||||
|
||||
foreach ($distinctfkuser as $fk_user)
|
||||
{
|
||||
if (!$error && $fk_user != '')
|
||||
{
|
||||
foreach ($distinctfkuser as $fk_user) {
|
||||
if (!$error && $fk_user != '') {
|
||||
$arrayofexistingboxid = array();
|
||||
$nbboxonleft = $nbboxonright = 0;
|
||||
$sql = "SELECT box_id, box_order FROM ".MAIN_DB_PREFIX."boxes";
|
||||
$sql .= " WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity;
|
||||
dol_syslog("boxes.php activate box", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
if ($resql) {
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$boxorder = $obj->box_order;
|
||||
if (preg_match('/A/', $boxorder)) $nbboxonleft++;
|
||||
if (preg_match('/B/', $boxorder)) $nbboxonright++;
|
||||
if (preg_match('/A/', $boxorder)) {
|
||||
$nbboxonleft++;
|
||||
}
|
||||
if (preg_match('/B/', $boxorder)) {
|
||||
$nbboxonright++;
|
||||
}
|
||||
$arrayofexistingboxid[$obj->box_id] = 1;
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if (empty($arrayofexistingboxid[$boxid['value']])) {
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
|
||||
@ -120,8 +120,7 @@ if ($action == 'add') {
|
||||
|
||||
dol_syslog("boxes.php activate box", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
if (!$resql) {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
@ -133,8 +132,7 @@ if ($action == 'add') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
$action = '';
|
||||
} else {
|
||||
@ -142,15 +140,13 @@ if ($action == 'add') {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
if ($action == 'delete') {
|
||||
$sql = "SELECT box_id FROM ".MAIN_DB_PREFIX."boxes";
|
||||
$sql .= " WHERE rowid=".((int) $rowid);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (!empty($obj->box_id))
|
||||
{
|
||||
if (!empty($obj->box_id)) {
|
||||
$db->begin();
|
||||
|
||||
// Remove all personalized setup when a box is activated or disabled (why removing all ? We removed only removed boxes)
|
||||
@ -168,8 +164,7 @@ if ($action == 'delete')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'switch')
|
||||
{
|
||||
if ($action == 'switch') {
|
||||
// We switch values of field box_order for the 2 lines of table boxes
|
||||
$db->begin();
|
||||
|
||||
@ -181,12 +176,10 @@ if ($action == 'switch')
|
||||
|
||||
$resultupdatefrom = 0;
|
||||
$resultupdateto = 0;
|
||||
if (is_object($objfrom) && is_object($objto))
|
||||
{
|
||||
if (is_object($objfrom) && is_object($objto)) {
|
||||
$newfirst = $objto->box_order;
|
||||
$newsecond = $objfrom->box_order;
|
||||
if ($newfirst == $newsecond)
|
||||
{
|
||||
if ($newfirst == $newsecond) {
|
||||
$newsecondchar = preg_replace('/[0-9]+/', '', $newsecond);
|
||||
$newsecondnum = preg_replace('/[a-zA-Z]+/', '', $newsecond);
|
||||
$newsecond = sprintf("%s%02d", $newsecondchar ? $newsecondchar : 'A', $newsecondnum + 1);
|
||||
@ -194,16 +187,19 @@ if ($action == 'switch')
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newfirst)."' WHERE rowid=".((int) $objfrom->rowid);
|
||||
dol_syslog($sql);
|
||||
$resultupdatefrom = $db->query($sql);
|
||||
if (!$resultupdatefrom) { dol_print_error($db); }
|
||||
if (!$resultupdatefrom) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($newsecond)."' WHERE rowid=".((int) $objto->rowid);
|
||||
dol_syslog($sql);
|
||||
$resultupdateto = $db->query($sql);
|
||||
if (!$resultupdateto) { dol_print_error($db); }
|
||||
if (!$resultupdateto) {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($resultupdatefrom && $resultupdateto)
|
||||
{
|
||||
if ($resultupdatefrom && $resultupdateto) {
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
@ -240,33 +236,31 @@ $sql .= " ORDER by b.position, b.box_order";
|
||||
|
||||
dol_syslog("Search available boxes", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
// Check record to know if we must recalculate sort order
|
||||
$i = 0;
|
||||
$decalage = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$boxes[$obj->position][$obj->box_id] = 1;
|
||||
$i++;
|
||||
|
||||
array_push($actives, $obj->box_id);
|
||||
|
||||
if ($obj->box_order == '' || $obj->box_order == '0' || $decalage) $decalage++;
|
||||
if ($obj->box_order == '' || $obj->box_order == '0' || $decalage) {
|
||||
$decalage++;
|
||||
}
|
||||
// We renumber the order of the boxes if one of them is in ''
|
||||
// This occurs just after an insert.
|
||||
if ($decalage)
|
||||
{
|
||||
if ($decalage) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order='".$db->escape($decalage)."' WHERE rowid=".$obj->rowid;
|
||||
$db->query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
if ($decalage)
|
||||
{
|
||||
if ($decalage) {
|
||||
// If we have renumbered, we correct the field box_order
|
||||
// This occurs just after an insert.
|
||||
$sql = "SELECT box_order";
|
||||
@ -276,32 +270,24 @@ if ($resql)
|
||||
|
||||
dol_syslog("Execute requests to renumber box order", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
while ($record = $db->fetch_array($result))
|
||||
{
|
||||
if (dol_strlen($record['box_order']) == 1)
|
||||
{
|
||||
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1)))
|
||||
{
|
||||
if ($result) {
|
||||
while ($record = $db->fetch_array($result)) {
|
||||
if (dol_strlen($record['box_order']) == 1) {
|
||||
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) {
|
||||
$box_order = "A0".$record['box_order'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
|
||||
$resql = $db->query($sql);
|
||||
} elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1)))
|
||||
{
|
||||
} elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) {
|
||||
$box_order = "B0".$record['box_order'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
|
||||
$resql = $db->query($sql);
|
||||
}
|
||||
} elseif (dol_strlen($record['box_order']) == 2)
|
||||
{
|
||||
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1)))
|
||||
{
|
||||
} elseif (dol_strlen($record['box_order']) == 2) {
|
||||
if (preg_match("/[13579]{1}/", substr($record['box_order'], -1))) {
|
||||
$box_order = "A".$record['box_order'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
|
||||
$resql = $db->query($sql);
|
||||
} elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1)))
|
||||
{
|
||||
} elseif (preg_match("/[02468]{1}/", substr($record['box_order'], -1))) {
|
||||
$box_order = "B".$record['box_order'];
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$db->escape($box_order)."' WHERE entity = ".$conf->entity." AND box_order = '".$db->escape($record['box_order'])."'";
|
||||
$resql = $db->query($sql);
|
||||
@ -336,10 +322,8 @@ print '<td>'.$langs->trans("SourceFile").'</td>';
|
||||
print '<td width="160" class="center">'.$langs->trans("ActivateOn").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($boxtoadd as $box)
|
||||
{
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
|
||||
{
|
||||
foreach ($boxtoadd as $box) {
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
|
||||
$logo = $box->boximg;
|
||||
} else {
|
||||
$logo = preg_replace("/^object_/i", "", $box->boximg);
|
||||
@ -348,14 +332,17 @@ foreach ($boxtoadd as $box)
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr class="oddeven">'."\n";
|
||||
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>';
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)')
|
||||
{
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("WarningUsingThisBoxSlowDown");
|
||||
} else print ($box->note ? $box->note : ' ');
|
||||
} else {
|
||||
print ($box->note ? $box->note : ' ');
|
||||
}
|
||||
print '</td>'."\n";
|
||||
print '<td>'.$box->sourcefile.'</td>'."\n";
|
||||
|
||||
@ -367,8 +354,7 @@ foreach ($boxtoadd as $box)
|
||||
|
||||
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 '</table>'."\n";
|
||||
@ -398,10 +384,8 @@ print '</tr>'."\n";
|
||||
|
||||
$box_order = 1;
|
||||
$foundrupture = 1;
|
||||
foreach ($boxactivated as $key => $box)
|
||||
{
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg))
|
||||
{
|
||||
foreach ($boxactivated as $key => $box) {
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i', $box->boximg)) {
|
||||
$logo = $box->boximg;
|
||||
} else {
|
||||
$logo = preg_replace("/^object_/i", "", $box->boximg);
|
||||
@ -410,14 +394,17 @@ foreach ($boxactivated as $key => $box)
|
||||
print "\n".'<!-- Box '.$box->boxcode.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
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>';
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)')
|
||||
{
|
||||
if ($box->note == '(WarningUsingThisBoxSlowDown)') {
|
||||
$langs->load("errors");
|
||||
print img_warning('', 0).' '.$langs->trans("WarningUsingThisBoxSlowDown");
|
||||
} else print ($box->note ? $box->note : ' ');
|
||||
} else {
|
||||
print ($box->note ? $box->note : ' ');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center">'.(empty($pos_name[$box->position]) ? '' : $langs->trans($pos_name[$box->position])).'</td>';
|
||||
$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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="addconst">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -471,6 +459,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL == 2 || !empty($conf->global->MAIN_ACTIVA
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center"><input type="submit" class="button button-save" value="'.$langs->trans("Save").'" name="Button"></div>';
|
||||
|
||||
@ -728,7 +728,7 @@ if ($mysoc->useLocalTax(1))
|
||||
print '<div class="nobordernopadding">';
|
||||
$tooltiphelp = $langs->transcountry("LocalTax1IsUsedExample", $mysoc->country_code);
|
||||
$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))
|
||||
{
|
||||
print '<br><label for="lt1">'.$langs->trans("LTRate").'</label>: ';
|
||||
@ -751,9 +751,9 @@ if ($mysoc->useLocalTax(1))
|
||||
} else {
|
||||
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 {
|
||||
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 '<td colspan="2">';
|
||||
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 = ($tooltiphelp != "LocalTax2IsUsedExample" ? "<i>".$langs->trans("Example").': '.$langs->transcountry("LocalTax2IsUsedExample", $mysoc->country_code)."</i>\n" : "");
|
||||
if (!isOnlyOneLocalTax(2))
|
||||
@ -797,9 +797,9 @@ if ($mysoc->useLocalTax(2))
|
||||
} else {
|
||||
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 {
|
||||
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 {
|
||||
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 {
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -682,7 +682,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
{
|
||||
// Discard check of mandatory fields for country for some tables
|
||||
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryVAT', 'DictionaryRegion', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp', 'DictionaryAccountancysystem', 'DictionaryAccountancyCategory'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id], array('DictionaryPublicHolidays', 'DictionaryCanton', 'DictionaryCompanyType', 'DictionaryHolidayTypes', 'DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
// Discard check of mandatory fiedls for other fields
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
|
||||
@ -100,9 +100,12 @@ if ($action == 'update')
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader();
|
||||
$title = $langs->trans("LimitsSetup");
|
||||
$help_url = '';
|
||||
|
||||
print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup');
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
print load_fiche_titre($title, '', 'title_setup');
|
||||
|
||||
$aCurrencies = array($conf->currency); // Default currency always first position
|
||||
|
||||
@ -125,7 +128,8 @@ if (!empty($conf->multicurrency->enabled) && !empty($conf->global->MULTICURRENCY
|
||||
if (!empty($aCurrencies) && count($aCurrencies) > 1)
|
||||
{
|
||||
$head = multicurrencyLimitPrepareHead($aCurrencies);
|
||||
print dol_get_fiche_head($head, $currencycode, '', -1, "multicurrency");
|
||||
|
||||
print dol_get_fiche_head($head, $currencycode, '', -1, '');
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,6 +176,7 @@ if ($action == 'edit')
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
} else {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
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 '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(!empty($currencycode) ? '¤cycode='.$currencycode : '').'">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
@ -1074,7 +1074,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '<td class="center">';
|
||||
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 $obj->{$fieldlist[$field]};
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* 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
|
||||
* 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
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
$substitutionarrayfortest = array(
|
||||
'__ID__' => 'TESTIdRecord',
|
||||
'__PHONEFROM__' => 'TESTPhoneFrom',
|
||||
'__PHONETO__' => 'TESTPhoneTo',
|
||||
'__LASTNAME__' => 'TESTLastname',
|
||||
'__FIRSTNAME__' => 'TESTFirstname'
|
||||
'__ID__' => 'TESTIdRecord',
|
||||
'__PHONEFROM__' => 'TESTPhoneFrom',
|
||||
'__PHONETO__' => 'TESTPhoneTo',
|
||||
'__LASTNAME__' => 'TESTLastname',
|
||||
'__FIRSTNAME__' => 'TESTFirstname'
|
||||
);
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -48,8 +50,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
* 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_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
@ -64,13 +65,16 @@ if ($action == 'update' && !$cancel)
|
||||
/*
|
||||
* Send sms
|
||||
*/
|
||||
if ($action == 'send' && !$_POST['cancel'])
|
||||
{
|
||||
if ($action == 'send' && !$_POST['cancel']) {
|
||||
$error = 0;
|
||||
|
||||
$smsfrom = '';
|
||||
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms", 'alphanohtml');
|
||||
if (empty($smsfrom)) $smsfrom = GETPOST("fromname", 'alphanohtml');
|
||||
if (!empty($_POST["fromsms"])) {
|
||||
$smsfrom = GETPOST("fromsms", 'alphanohtml');
|
||||
}
|
||||
if (empty($smsfrom)) {
|
||||
$smsfrom = GETPOST("fromname", 'alphanohtml');
|
||||
}
|
||||
$sendto = GETPOST("sendto", 'alphanohtml');
|
||||
$body = GETPOST('message', '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';
|
||||
$formsms = new FormSms($db);
|
||||
|
||||
if (!empty($formsms->error))
|
||||
{
|
||||
if (!empty($formsms->error)) {
|
||||
setEventMessages($formsms->error, $formsms->errors, 'errors');
|
||||
$action = 'test';
|
||||
$error++;
|
||||
}
|
||||
if (empty($body))
|
||||
{
|
||||
if (empty($body)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
|
||||
$action = 'test';
|
||||
$error++;
|
||||
}
|
||||
if (empty($smsfrom) || !str_replace('+', '', $smsfrom))
|
||||
{
|
||||
if (empty($smsfrom) || !str_replace('+', '', $smsfrom)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")), null, 'errors');
|
||||
$action = 'test';
|
||||
$error++;
|
||||
}
|
||||
if (empty($sendto) || !str_replace('+', '', $sendto))
|
||||
{
|
||||
if (empty($sendto) || !str_replace('+', '', $sendto)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")), null, 'errors');
|
||||
$action = 'test';
|
||||
$error++;
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
// Make substitutions into message
|
||||
complete_substitutions_array($substitutionarrayfortest, $langs);
|
||||
$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
|
||||
$result = $smsfile->sendfile(); // This send SMS
|
||||
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs');
|
||||
setEventMessages($smsfile->error, $smsfile->errors, 'mesgs');
|
||||
} else {
|
||||
@ -138,8 +136,12 @@ if ($action == 'send' && !$_POST['cancel'])
|
||||
*/
|
||||
|
||||
$linuxlike = 1;
|
||||
if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0;
|
||||
if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0;
|
||||
if (preg_match('/^win/i', PHP_OS)) {
|
||||
$linuxlike = 0;
|
||||
}
|
||||
if (preg_match('/^mac/i', PHP_OS)) {
|
||||
$linuxlike = 0;
|
||||
}
|
||||
|
||||
$wikihelp = 'EN:Setup Sms|FR:Paramétrage Sms|ES:Configuración Sms';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
@ -153,11 +155,14 @@ print "<br>\n";
|
||||
$listofmethods = (is_array($conf->modules_parts['sms']) ? $conf->modules_parts['sms'] : array());
|
||||
asort($listofmethods);
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$form = new Form($db);
|
||||
if (!count($listofmethods)) {
|
||||
$descnosms = $langs->trans("NoSmsEngine", '{Dolistore}');
|
||||
$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 '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -178,8 +183,11 @@ if ($action == 'edit')
|
||||
|
||||
// Method
|
||||
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);
|
||||
else print '<font class="error">'.$langs->trans("None").'</font>';
|
||||
if (count($listofmethods)) {
|
||||
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>';
|
||||
|
||||
// From
|
||||
@ -204,8 +212,6 @@ if ($action == 'edit')
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
} 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 '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
@ -218,14 +224,18 @@ if ($action == 'edit')
|
||||
// Method
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_SMS_SENDMODE").'</td><td>';
|
||||
$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 '</td></tr>';
|
||||
|
||||
// From
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMS_FROM", $langs->transnoentities("Undefined")).'</td>';
|
||||
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>';
|
||||
|
||||
// Autocopy to
|
||||
@ -234,7 +244,7 @@ if ($action == 'edit')
|
||||
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"));
|
||||
print '</td></tr>';
|
||||
*/
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
|
||||
@ -257,8 +267,7 @@ if ($action == 'edit')
|
||||
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&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';
|
||||
@ -290,8 +299,7 @@ if ($action == 'edit')
|
||||
}*/
|
||||
|
||||
// Affichage formulaire de TEST simple
|
||||
if ($action == 'test')
|
||||
{
|
||||
if ($action == 'test') {
|
||||
print '<br>';
|
||||
print load_fiche_titre($langs->trans("DoTestSend"));
|
||||
|
||||
|
||||
@ -90,18 +90,18 @@ print '<table class="border centpercent">';
|
||||
|
||||
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 ($choice && $choice == 'logfile') ? ' checked' : '';
|
||||
$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 .= basename($filelog);
|
||||
$filelogparam .= '">'.$filelog.'</a>';
|
||||
}
|
||||
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
|
||||
$desc = $langs->trans("PurgeDeleteLogFile", '{filelogparam}');
|
||||
$desc = str_replace('{filelogparam}', $filelogparam, $desc);
|
||||
print '> '.$desc;
|
||||
print '<br><br>';
|
||||
}
|
||||
|
||||
@ -123,8 +123,7 @@ print '</td></tr></table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
if (preg_match('/^confirm/i', $choice))
|
||||
{
|
||||
if (preg_match('/^confirm/i', $choice)) {
|
||||
print '<br>';
|
||||
$formquestion = array();
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?choice=allfiles', $langs->trans('Purge'), $langs->trans('ConfirmPurge').img_warning().' ', 'purge', $formquestion, 'no', 2);
|
||||
|
||||
@ -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';
|
||||
print img_picto('', 'globe').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
} else {
|
||||
print $langs->trans("NotAvailableWithThisDistribution");
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("ErrorNotAvailableWithThisDistribution"), 0, 0, 'error');
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
|
||||
@ -113,6 +113,7 @@ class DolibarrApi
|
||||
|
||||
unset($object->error);
|
||||
unset($object->errors);
|
||||
unset($object->errorhidden);
|
||||
|
||||
unset($object->ref_previous);
|
||||
unset($object->ref_next);
|
||||
|
||||
@ -1608,6 +1608,14 @@ class Setup extends DolibarrApi
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
unset($mysoc->skype);
|
||||
unset($mysoc->twitter);
|
||||
unset($mysoc->facebook);
|
||||
unset($mysoc->linkedin);
|
||||
|
||||
unset($mysoc->note);
|
||||
unset($mysoc->lines);
|
||||
|
||||
return $this->_cleanObjectDatas($mysoc);
|
||||
}
|
||||
|
||||
|
||||
@ -158,28 +158,6 @@ class Asset extends CommonObject
|
||||
*/
|
||||
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
|
||||
|
||||
@ -39,6 +39,8 @@ $block = new BlockedLog($db);
|
||||
|
||||
if ((!$user->admin && !$user->rights->blockedlog->read) || empty($conf->blockedlog->enabled)) accessforbidden();
|
||||
|
||||
$langs->loadLangs(array("admin"));
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
|
||||
@ -183,19 +183,19 @@ class BOM extends CommonObject
|
||||
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';
|
||||
|
||||
/**
|
||||
* @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';
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To test if we can delete object.
|
||||
*/
|
||||
//protected $childtables=array();
|
||||
// /**
|
||||
// * @var array List of child tables. To test if we can delete object.
|
||||
// */
|
||||
// protected $childtables=array();
|
||||
|
||||
/**
|
||||
* @var array List of child tables. To know object to delete on cascade.
|
||||
|
||||
@ -800,8 +800,7 @@ if ($action == 'create')
|
||||
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');
|
||||
$_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_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');
|
||||
|
||||
$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 .= '<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('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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ class AdvanceTargetingMailing extends CommonObject
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var int element id
|
||||
* @var int element id (it's not the name of a field)
|
||||
*/
|
||||
public $fk_element;
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ class Propal extends CommonObject
|
||||
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';
|
||||
|
||||
@ -1099,7 +1099,7 @@ class Propal extends CommonObject
|
||||
if ($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);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1111,7 +1111,7 @@ class Propal extends CommonObject
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
@ -3753,7 +3753,10 @@ class PropaleLigne extends CommonObjectLine
|
||||
public $product_type = Product::TYPE_PRODUCT;
|
||||
|
||||
public $qty;
|
||||
|
||||
public $tva_tx;
|
||||
public $vat_src_code;
|
||||
|
||||
public $subprice;
|
||||
public $remise_percent;
|
||||
public $fk_remise_except;
|
||||
@ -3805,6 +3808,11 @@ class PropaleLigne extends CommonObjectLine
|
||||
* @see $product_label
|
||||
*/
|
||||
public $libelle;
|
||||
/**
|
||||
* @deprecated
|
||||
* @see $product_label
|
||||
*/
|
||||
public $label;
|
||||
/**
|
||||
* Product label
|
||||
* @var string
|
||||
|
||||
@ -3273,6 +3273,7 @@ class Commande extends CommonOrder
|
||||
$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_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_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
|
||||
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").",";
|
||||
|
||||
@ -43,12 +43,12 @@ class Deplacement extends CommonObject
|
||||
public $table_element = 'deplacement';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable 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 = '';
|
||||
|
||||
|
||||
@ -3551,7 +3551,7 @@ if ($action == 'create')
|
||||
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))
|
||||
{
|
||||
// TODO for compatibility
|
||||
|
||||
@ -50,12 +50,12 @@ class FactureRec extends CommonInvoice
|
||||
public $table_element = 'facture_rec';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
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';
|
||||
|
||||
|
||||
@ -64,12 +64,12 @@ class Facture extends CommonInvoice
|
||||
public $table_element = 'facture';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
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';
|
||||
|
||||
@ -3126,8 +3126,8 @@ class Facture extends CommonInvoice
|
||||
$this->line->tva_tx = $txtva;
|
||||
$this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0);
|
||||
$this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0);
|
||||
$this->line->localtax1_type = $localtaxes_type[0];
|
||||
$this->line->localtax2_type = $localtaxes_type[2];
|
||||
$this->line->localtax1_type = isset($localtaxes_type[0]) ? $localtaxes_type[0] : '';
|
||||
$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_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
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.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
|
||||
* 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");
|
||||
$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("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);
|
||||
$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");
|
||||
@ -146,7 +148,9 @@ if ($modecompta == "CREANCES-DETTES")
|
||||
{
|
||||
$name = $langs->trans("Turnover");
|
||||
$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>').')';
|
||||
$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>" : "");
|
||||
|
||||
@ -805,19 +805,16 @@ class Contact extends CommonObject
|
||||
}
|
||||
|
||||
// Mis a jour alerte birthday
|
||||
if ($this->birthday_alert)
|
||||
{
|
||||
if (!empty($this->birthday_alert)) {
|
||||
//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;
|
||||
$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
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."user_alert(type,fk_contact,fk_user) ";
|
||||
$sql .= "VALUES (1,".$this->db->escape($id).",".$user->id.")";
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
@ -828,23 +825,20 @@ class Contact extends CommonObject
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert ";
|
||||
$sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id;
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CONTACT_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
@ -1342,9 +1336,10 @@ class Contact extends CommonObject
|
||||
if (!empty($this->poste)) $label .= '<br><b>'.$langs->trans("Poste").':</b> '.$this->poste;
|
||||
$label .= '<br><b>'.$langs->trans("EMail").':</b> '.$this->email;
|
||||
$phonelist = array();
|
||||
if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $this->country_code, $this->id, 0, '', ' ', 'phone');
|
||||
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $this->country_code, $this->id, 0, '', ' ', 'mobile');
|
||||
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $this->country_code, $this->id, 0, '', ' ', 'phone');
|
||||
$country_code = empty($this->country_code) ? '': $this->country_code;
|
||||
if ($this->phone_pro) $phonelist[] = dol_print_phone($this->phone_pro, $country_code, $this->id, 0, '', ' ', 'phone');
|
||||
if ($this->phone_mobile) $phonelist[] = dol_print_phone($this->phone_mobile, $country_code, $this->id, 0, '', ' ', 'mobile');
|
||||
if ($this->phone_perso) $phonelist[] = dol_print_phone($this->phone_perso, $country_code, $this->id, 0, '', ' ', 'phone');
|
||||
$label .= '<br><b>'.$langs->trans("Phone").':</b> '.implode(' ', $phonelist);
|
||||
$label .= '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs);
|
||||
|
||||
|
||||
@ -53,12 +53,12 @@ class Contrat extends CommonObject
|
||||
public $table_element = 'contrat';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
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';
|
||||
|
||||
@ -1032,21 +1032,19 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
// Insert business contacts ('SALESREPFOLL','contrat')
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error) {
|
||||
$result = $this->add_contact($this->commercial_suivi_id, 'SALESREPFOLL', 'internal');
|
||||
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
|
||||
{
|
||||
$this->linked_objects = $this->linkedObjectsIds; // TODO Replace linked_objects with linkedObjectsIds
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
@ -1144,10 +1142,10 @@ class Contrat extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Supprime l'objet de la base
|
||||
* Delete object
|
||||
*
|
||||
* @param User $user Utilisateur qui supprime
|
||||
* @return int < 0 si erreur, > 0 si ok
|
||||
* @param User $user User that deletes
|
||||
* @return int < 0 if KO, > 0 if OK
|
||||
*/
|
||||
public function delete($user)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -356,6 +356,9 @@ if ($action == 'update')
|
||||
$visibility = GETPOST('list', 'alpha');
|
||||
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(
|
||||
GETPOST('attrname', 'aZ09'),
|
||||
GETPOST('label', 'alpha'),
|
||||
@ -371,7 +374,7 @@ if ($action == 'update')
|
||||
$visibility,
|
||||
GETPOST('help', 'alpha'),
|
||||
GETPOST('default_value', 'alpha'),
|
||||
GETPOST('computed_value', 'alpha'),
|
||||
$computedvalue,
|
||||
(GETPOST('entitycurrentorall', 'alpha') ? 0 : ''),
|
||||
GETPOST('langfile'),
|
||||
GETPOST('enabled', 'alpha'),
|
||||
|
||||
268
htdocs/core/boxes/box_funnel_of_prospection.php
Normal file
268
htdocs/core/boxes/box_funnel_of_prospection.php
Normal 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);
|
||||
}
|
||||
}
|
||||
@ -84,21 +84,25 @@ class box_produits extends ModeleBoxes
|
||||
|
||||
$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 .= ", 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 .= ' WHERE p.entity IN ('.getEntity($productstatic->element).')';
|
||||
if (empty($user->rights->produit->lire)) $sql .= ' AND p.fk_product_type != 0';
|
||||
if (empty($user->rights->service->lire)) $sql .= ' AND p.fk_product_type != 1';
|
||||
if (empty($user->rights->produit->lire)) {
|
||||
$sql .= ' AND p.fk_product_type != 0';
|
||||
}
|
||||
if (empty($user->rights->service->lire)) {
|
||||
$sql .= ' AND p.fk_product_type != 1';
|
||||
}
|
||||
// Add where from hooks
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
if (is_object($hookmanager)) {
|
||||
$parameters = array('boxproductlist'=>1);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
@ -107,18 +111,15 @@ class box_produits extends ModeleBoxes
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$line = 0;
|
||||
while ($line < $num)
|
||||
{
|
||||
while ($line < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
$datem = $this->db->jdate($objp->tms);
|
||||
|
||||
// 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 .= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sqld .= " WHERE fk_product=".$objp->rowid;
|
||||
@ -126,11 +127,11 @@ class box_produits extends ModeleBoxes
|
||||
$sqld .= " LIMIT 1";
|
||||
|
||||
$resultd = $this->db->query($sqld);
|
||||
if ($resultd)
|
||||
{
|
||||
if ($resultd) {
|
||||
$objtp = $this->db->fetch_object($resultd);
|
||||
if (isset($objtp->label) && $objtp->label != '')
|
||||
if (isset($objtp->label) && $objtp->label != '') {
|
||||
$objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
$productstatic->id = $objp->rowid;
|
||||
@ -145,6 +146,8 @@ class box_produits extends ModeleBoxes
|
||||
$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(
|
||||
'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"',
|
||||
@ -161,14 +164,13 @@ class box_produits extends ModeleBoxes
|
||||
if (empty($conf->dynamicprices->enabled) || empty($objp->fk_price_expression)) {
|
||||
$price_base_type = $langs->trans($objp->price_base_type);
|
||||
$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);
|
||||
$priceparser = new PriceParser($this->db);
|
||||
$price_result = $priceparser->parseProduct($productstatic);
|
||||
if ($price_result >= 0) {
|
||||
if ($objp->price_base_type == 'HT')
|
||||
{
|
||||
if ($objp->price_base_type == 'HT') {
|
||||
$price_base_type = $langs->trans("HT");
|
||||
} else {
|
||||
$price_result = $price_result * (1 + ($productstatic->tva_tx / 100));
|
||||
@ -176,7 +178,7 @@ class box_produits extends ModeleBoxes
|
||||
}
|
||||
$price = price($price_result);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $price,
|
||||
@ -206,11 +208,12 @@ class box_produits extends ModeleBoxes
|
||||
|
||||
$line++;
|
||||
}
|
||||
if ($num == 0)
|
||||
if ($num == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedProducts"),
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
|
||||
@ -242,6 +242,7 @@ class CMailFile
|
||||
{
|
||||
$this->html = $msg;
|
||||
|
||||
$findimg = 0;
|
||||
if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS))
|
||||
{
|
||||
$findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias');
|
||||
|
||||
@ -32,10 +32,13 @@ class Comment extends CommonObject
|
||||
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;
|
||||
|
||||
/**
|
||||
@ -72,10 +75,16 @@ class Comment extends CommonObject
|
||||
*/
|
||||
public $entity;
|
||||
|
||||
/**
|
||||
* @var string import key
|
||||
*/
|
||||
public $import_key;
|
||||
|
||||
public $comments = array();
|
||||
|
||||
/**
|
||||
* @var Comment Object oldcopy
|
||||
*/
|
||||
public $oldcopy;
|
||||
|
||||
|
||||
@ -131,26 +140,26 @@ class Comment extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$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);
|
||||
|
||||
if (!$notrigger)
|
||||
{
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('TASK_COMMENT_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
@ -190,12 +199,10 @@ class Comment extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
|
||||
if ($num_rows)
|
||||
{
|
||||
if ($num_rows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
@ -212,8 +219,11 @@ class Comment extends CommonObject
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($num_rows) return 1;
|
||||
else return 0;
|
||||
if ($num_rows) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
@ -234,8 +244,12 @@ class Comment extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->fk_element)) $this->fk_project = (int) trim($this->fk_element);
|
||||
if (isset($this->description)) $this->description = trim($this->description);
|
||||
if (isset($this->fk_element)) {
|
||||
$this->fk_project = (int) trim($this->fk_element);
|
||||
}
|
||||
if (isset($this->description)) {
|
||||
$this->description = trim($this->description);
|
||||
}
|
||||
|
||||
|
||||
// Update request
|
||||
@ -253,24 +267,24 @@ class Comment extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$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 (!$notrigger)
|
||||
{
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('TASK_COMMENT_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
@ -303,24 +317,24 @@ class Comment extends CommonObject
|
||||
$sql .= " WHERE rowid=".$this->id;
|
||||
|
||||
$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 (!$notrigger)
|
||||
{
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('TASK_COMMENT_DELETE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach ($this->errors as $errmsg)
|
||||
{
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
|
||||
}
|
||||
@ -355,13 +369,10 @@ class Comment extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if ($num_rows > 0) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$comment = new self($db);
|
||||
$comment->fetch($obj->rowid);
|
||||
$this->comments[] = $comment;
|
||||
|
||||
@ -743,6 +743,12 @@ abstract class CommonDocGenerator
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
@ -3161,7 +3161,7 @@ abstract class CommonObject
|
||||
$this->multicurrency_total_ttc += isset($this->revenuestamp) ? ($this->revenuestamp * $multicurrency_tx) : 0;
|
||||
|
||||
// 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();
|
||||
|
||||
|
||||
@ -537,6 +537,8 @@ class Conf
|
||||
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_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)
|
||||
$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
|
||||
|
||||
@ -39,9 +39,9 @@
|
||||
*/
|
||||
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
|
||||
private $_library = 'jflot'; // Graphic library to use (jflot, artichow)
|
||||
private $_library = 'chart'; // Graphic library to use (jflot, chart, artichow)
|
||||
|
||||
//! Array of data
|
||||
public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...)
|
||||
@ -115,7 +115,7 @@ class DolGraph
|
||||
|
||||
$this->_library = $library;
|
||||
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
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function SetType($type)
|
||||
@ -1156,6 +1156,7 @@ class DolGraph
|
||||
else {
|
||||
$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';
|
||||
|
||||
$this->stringtoshow .= 'var options = { maintainAspectRatio: false, aspectRatio: 2.5, ';
|
||||
|
||||
@ -125,7 +125,6 @@ class EmailSenderProfile extends CommonObject
|
||||
*/
|
||||
public $date_creation;
|
||||
|
||||
|
||||
public $tms;
|
||||
public $private;
|
||||
public $signature;
|
||||
@ -134,32 +133,6 @@ class EmailSenderProfile extends CommonObject
|
||||
// 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
|
||||
*
|
||||
|
||||
@ -35,6 +35,9 @@ class Fiscalyear extends CommonObject
|
||||
*/
|
||||
public $element = 'fiscalyear';
|
||||
|
||||
/**
|
||||
* @var string picto
|
||||
*/
|
||||
public $picto = 'technic';
|
||||
|
||||
/**
|
||||
@ -43,12 +46,12 @@ class Fiscalyear extends CommonObject
|
||||
public $table_element = 'accounting_fiscalyear';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable 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 = '';
|
||||
|
||||
|
||||
@ -1728,7 +1728,7 @@ class Form
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
// 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' : '').'> </option>'."\n";
|
||||
if ($show_every) $out .= '<option value="-2"'.((in_array(-2, $selected)) ? ' selected' : '').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
@ -4221,7 +4221,7 @@ class Form
|
||||
* @param string $title Title
|
||||
* @param string $question Question
|
||||
* @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', ...
|
||||
* @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
|
||||
|
||||
@ -51,14 +51,14 @@ class FormAdmin
|
||||
* @param string $htmlname Name of HTML select
|
||||
* @param int $showauto Show 'auto' choice
|
||||
* @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 $disabled Disable edit of select
|
||||
* @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 $forcecombo Force to use combo box (so no ajax beautify effect)
|
||||
* @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', ...)
|
||||
* @return string Return HTML select string with list of languages
|
||||
*/
|
||||
@ -95,9 +95,12 @@ class FormAdmin
|
||||
foreach ($langs_available as $key => $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 ($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>';
|
||||
}
|
||||
|
||||
|
||||
@ -620,15 +620,17 @@ class FormOther
|
||||
if ($i > 0) print '<option value="0" disabled>----------</option>';
|
||||
print '<option value="'.$lines[$i]->fk_project.'_0"';
|
||||
if ($selectedproject == $lines[$i]->fk_project) print ' selected';
|
||||
print '>'; // Project -> Task
|
||||
print $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||
if (empty($lines[$i]->public))
|
||||
{
|
||||
print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
|
||||
|
||||
$labeltoshow = $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||
if (empty($lines[$i]->public)) {
|
||||
$labeltoshow .= ' <span class="opacitymedium">('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')</span>';
|
||||
} else {
|
||||
print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
|
||||
$labeltoshow .= ' <span class="opacitymedium">('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')</span>';
|
||||
}
|
||||
//print '-'.$parent.'-'.$lines[$i]->fk_project.'-'.$lastprojectid;
|
||||
|
||||
print ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
|
||||
print '>'; // Project -> Task
|
||||
print $labeltoshow;
|
||||
print "</option>\n";
|
||||
|
||||
$lastprojectid = $lines[$i]->fk_project;
|
||||
@ -652,21 +654,26 @@ class FormOther
|
||||
print '<option value="'.$lines[$i]->fk_project.'_'.$lines[$i]->id.'"';
|
||||
if (($lines[$i]->id == $selectedtask) || ($lines[$i]->fk_project.'_'.$lines[$i]->id == $selectedtask)) print ' selected';
|
||||
if ($disabled) print ' disabled';
|
||||
print '>';
|
||||
print $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||
print ' '.$lines[$i]->projectlabel;
|
||||
|
||||
$labeltoshow = $langs->trans("Project").' '.$lines[$i]->projectref;
|
||||
$labeltoshow .= ' '.$lines[$i]->projectlabel;
|
||||
if (empty($lines[$i]->public))
|
||||
{
|
||||
print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')';
|
||||
$labeltoshow .= ' <span class="opacitymedium">('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')</span>';
|
||||
} else {
|
||||
print ' ('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')';
|
||||
$labeltoshow .= ' <span class="opacitymedium">('.$langs->trans("Visibility").': '.$langs->trans("SharedProject").')</span>';
|
||||
}
|
||||
if ($lines[$i]->id) print ' > ';
|
||||
if ($lines[$i]->id) $labeltoshow .= ' > ';
|
||||
for ($k = 0; $k < $level; $k++)
|
||||
{
|
||||
print " ";
|
||||
$labeltoshow .= " ";
|
||||
}
|
||||
print $lines[$i]->ref.' '.$lines[$i]->label."</option>\n";
|
||||
$labeltoshow .= $lines[$i]->ref.' '.$lines[$i]->label;
|
||||
|
||||
print ' data-html="'.dol_escape_htmltag($labeltoshow).'"';
|
||||
print '>';
|
||||
print $labeltoshow;
|
||||
print "</option>\n";
|
||||
$inc++;
|
||||
}
|
||||
|
||||
@ -918,9 +925,10 @@ class FormOther
|
||||
* @param int $useempty Show empty in list
|
||||
* @param int $longlabel Show long label
|
||||
* @param string $morecss More Css
|
||||
* @param bool $addjscombo Add js combo
|
||||
* @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
|
||||
global $langs;
|
||||
@ -947,6 +955,15 @@ class FormOther
|
||||
$select_month .= '</option>';
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
@ -986,18 +1003,10 @@ class FormOther
|
||||
* @param bool $addjscombo Add js combo
|
||||
* @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 = '';
|
||||
|
||||
// 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;
|
||||
$max_year = $currentyear + $max_year;
|
||||
$min_year = $currentyear - $min_year;
|
||||
@ -1028,6 +1037,14 @@ class FormOther
|
||||
}
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
@ -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.
|
||||
$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('__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
|
||||
);
|
||||
|
||||
@ -638,8 +638,8 @@ class Translate
|
||||
|
||||
// Restore reliable HTML tags into original translation string
|
||||
$str = str_replace(
|
||||
array('__quot__', '__tagb__', '__tagbend__', '__tagu__', '__taguend__', '__tagi__', '__tagiend__', '__tagcenter__', '__tagcenterend__', '__taga__', '__tagaend__', '__tagbr__', '__tagspan__', '__tagspanend__', '__lt__', '__gt__'),
|
||||
array('"', '<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<center>', '</center>', '<a ', '</a>', '<br>', '<span', '</span>', '< ', '> '),
|
||||
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>', '< ', '>'),
|
||||
$str
|
||||
);
|
||||
|
||||
@ -794,29 +794,33 @@ class Translate
|
||||
if ($mainlangonly) {
|
||||
$arrayofspecialmainlanguages = array(
|
||||
'en'=>'en_US',
|
||||
'sq'=>'sq_AL',
|
||||
'am'=>'am_ET',
|
||||
'ar'=>'ar_SA',
|
||||
'eu'=>'eu_ES',
|
||||
'bn'=>'bn_DB',
|
||||
'bs'=>'bs_BA',
|
||||
'ca'=>'ca_ES',
|
||||
'zh'=>'zh_TW',
|
||||
'cs'=>'cs_CZ',
|
||||
'da'=>'da_DK',
|
||||
'et'=>'et_EE',
|
||||
'ka'=>'ka_GE',
|
||||
'el'=>'el_GR',
|
||||
'eu'=>'eu_ES',
|
||||
'fa'=>'fa_IR',
|
||||
'he'=>'he_IL',
|
||||
'kn'=>'kn_IN',
|
||||
'ka'=>'ka_GE',
|
||||
'km'=>'km_KH',
|
||||
'kn'=>'kn_IN',
|
||||
'ko'=>'ko_KR',
|
||||
'ja'=>'ja_JP',
|
||||
'lo'=>'lo_LA',
|
||||
'nb'=>'nb_NO',
|
||||
'fa'=>'fa_IR',
|
||||
'sq'=>'sq_AL',
|
||||
'sr'=>'sr_RS',
|
||||
'sv'=>'sv_SE',
|
||||
'sl'=>'sl_SI',
|
||||
'uk'=>'uk_UA',
|
||||
'vi'=>'vi_VN'
|
||||
'vi'=>'vi_VN',
|
||||
'zh'=>'zh_CN'
|
||||
);
|
||||
if (strtolower($regs[1]) != strtolower($regs[2]) && !in_array($dir, $arrayofspecialmainlanguages)) continue;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -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 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.
|
||||
* 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 $timestampEnd Timestamp de fin
|
||||
@ -616,7 +631,6 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
|
||||
global $db, $conf, $mysoc;
|
||||
|
||||
$nbFerie = 0;
|
||||
$specialdayrule = array();
|
||||
|
||||
// Check to ensure we use correct parameters
|
||||
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 ($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;
|
||||
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)
|
||||
{
|
||||
$ferie = false;
|
||||
$specialdayrule = array();
|
||||
|
||||
$jour = date("d", $timestampStart);
|
||||
$mois = date("m", $timestampStart);
|
||||
$annee = date("Y", $timestampStart);
|
||||
$jour = gmdate("d", $timestampStart);
|
||||
$mois = gmdate("m", $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 .= " FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday";
|
||||
$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);
|
||||
return 'Error sql '.$db->lasterror();
|
||||
}
|
||||
//var_dump($specialdayrule)."\n";
|
||||
//print "ferie=".$ferie."\n";
|
||||
|
||||
// Special dayrules
|
||||
if (in_array('easter', $specialdayrule))
|
||||
{
|
||||
// Calculation for easter date
|
||||
$date_paques = easter_date($annee);
|
||||
$jour_paques = date("d", $date_paques);
|
||||
$mois_paques = date("m", $date_paques);
|
||||
if ($jour_paques == $jour && $mois_paques == $mois) $ferie = true;
|
||||
// Easter (sunday)
|
||||
}
|
||||
if (!$ferie) {
|
||||
// Special dayrules
|
||||
if (in_array('easter', $specialdayrule))
|
||||
{
|
||||
// Calculation for easter date
|
||||
$date_paques = getGMTEasterDatetime($annee);
|
||||
$jour_paques = gmdate("d", $date_paques);
|
||||
$mois_paques = gmdate("m", $date_paques);
|
||||
if ($jour_paques == $jour && $mois_paques == $mois) $ferie = true;
|
||||
// Easter (sunday)
|
||||
}
|
||||
|
||||
if (in_array('eastermonday', $specialdayrule))
|
||||
{
|
||||
// Calculation for the monday of easter date
|
||||
$date_paques = easter_date($annee);
|
||||
$date_lundi_paques = mktime(
|
||||
date("H", $date_paques),
|
||||
date("i", $date_paques),
|
||||
date("s", $date_paques),
|
||||
date("m", $date_paques),
|
||||
date("d", $date_paques) + 1,
|
||||
date("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)
|
||||
if (in_array('eastermonday', $specialdayrule))
|
||||
{
|
||||
// Calculation for the monday of easter date
|
||||
$date_paques = getGMTEasterDatetime($annee);
|
||||
$date_lundi_paques = mktime(
|
||||
gmdate("H", $date_paques),
|
||||
gmdate("i", $date_paques),
|
||||
gmdate("s", $date_paques),
|
||||
gmdate("m", $date_paques),
|
||||
gmdate("d", $date_paques) + 1,
|
||||
gmdate("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" (monday)
|
||||
}
|
||||
$jour_lundi_paques = gmdate("d", $date_lundi_paques);
|
||||
$mois_lundi_paques = gmdate("m", $date_lundi_paques);
|
||||
if ($jour_lundi_paques == $jour && $mois_lundi_paques == $mois) $ferie = true;
|
||||
// Easter (monday)
|
||||
}
|
||||
|
||||
if (in_array('viernessanto', $specialdayrule))
|
||||
{
|
||||
// Viernes Santo
|
||||
$date_paques = easter_date($annee);
|
||||
$date_viernes = mktime(
|
||||
date("H", $date_paques),
|
||||
date("i", $date_paques),
|
||||
date("s", $date_paques),
|
||||
date("m", $date_paques),
|
||||
date("d", $date_paques) - 2,
|
||||
date("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)
|
||||
if (in_array('ascension', $specialdayrule))
|
||||
{
|
||||
// Calcul du jour de l'ascension (39 days after easter day)
|
||||
$date_paques = getGMTEasterDatetime($annee);
|
||||
$date_ascension = mktime(
|
||||
gmdate("H", $date_paques),
|
||||
gmdate("i", $date_paques),
|
||||
gmdate("s", $date_paques),
|
||||
gmdate("m", $date_paques),
|
||||
gmdate("d", $date_paques) + 39,
|
||||
gmdate("Y", $date_paques)
|
||||
);
|
||||
$jour_fronleichnam = date("d", $date_fronleichnam);
|
||||
$mois_fronleichnam = date("m", $date_fronleichnam);
|
||||
if ($jour_fronleichnam == $jour && $mois_fronleichnam == $mois) $ferie = true;
|
||||
// Fronleichnam
|
||||
$jour_ascension = gmdate("d", $date_ascension);
|
||||
$mois_ascension = gmdate("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 = 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 ($includesaturday || $includesunday)
|
||||
{
|
||||
$jour_julien = unixtojd($timestampStart);
|
||||
$jour_semaine = jddayofweek($jour_julien, 0);
|
||||
if ($includesaturday) //Saturday (6) and Sunday (0)
|
||||
if (!$ferie) {
|
||||
if ($includesaturday || $includesunday)
|
||||
{
|
||||
if ($jour_semaine == 6) $ferie = true;
|
||||
}
|
||||
if ($includesunday) //Saturday (6) and Sunday (0)
|
||||
{
|
||||
if ($jour_semaine == 0) $ferie = true;
|
||||
$jour_julien = unixtojd($timestampStart);
|
||||
$jour_semaine = jddayofweek($jour_julien, 0);
|
||||
if ($includesaturday) //Saturday (6) and Sunday (0)
|
||||
{
|
||||
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
|
||||
if ($ferie) $nbFerie++;
|
||||
@ -815,6 +840,7 @@ function num_public_holiday($timestampStart, $timestampEnd, $country_code = '',
|
||||
$i++;
|
||||
}
|
||||
|
||||
//print "nbFerie=".$nbFerie."\n";
|
||||
return $nbFerie;
|
||||
}
|
||||
|
||||
|
||||
@ -154,6 +154,8 @@ function getBrowserInfo($user_agent)
|
||||
$os = 'unknown';
|
||||
$phone = '';
|
||||
|
||||
$user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent
|
||||
|
||||
$detectmobile = new Mobile_Detect(null, $user_agent);
|
||||
$tablet = $detectmobile->isTablet();
|
||||
|
||||
@ -709,11 +711,11 @@ if (!function_exists('dol_getprefix'))
|
||||
*/
|
||||
function dol_getprefix($mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
// If prefix is for email
|
||||
// If prefix is for email (we need to have $conf alreayd loaded for this case)
|
||||
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 ($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');
|
||||
}
|
||||
|
||||
// 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)
|
||||
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
|
||||
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');
|
||||
}
|
||||
|
||||
@ -1881,54 +1888,44 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
|
||||
$ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address);
|
||||
}
|
||||
// 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);
|
||||
$ret .= ($ret ? $sep : '').$town;
|
||||
if ($object->state)
|
||||
{
|
||||
if (!empty($object->state)) {
|
||||
$ret .= ($ret ? ", " : '').$object->state;
|
||||
}
|
||||
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);
|
||||
$ret .= ($ret ? $sep : '').$town;
|
||||
if ($object->state)
|
||||
{
|
||||
if (!empty($object->state)) {
|
||||
$ret .= ($ret ? ", " : '').$object->state;
|
||||
}
|
||||
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;
|
||||
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
|
||||
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
|
||||
if ($object->state)
|
||||
{
|
||||
if (!empty($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;
|
||||
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
|
||||
$ret .= ($town ? (($object->zip ? ' ' : '').$town) : '');
|
||||
$ret .= ($object->state_code ? (' '.($object->state_code)) : '');
|
||||
} else // Other: title firstname name \n address lines \n zip town \n country
|
||||
{
|
||||
$ret .= (empty($object->state_code) ? '' : (' '.$object->state_code));
|
||||
} else { // Other: title firstname name \n address lines \n zip town \n country
|
||||
$town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town);
|
||||
$ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
|
||||
$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;
|
||||
}
|
||||
}
|
||||
if (!is_object($outputlangs)) $outputlangs = $langs;
|
||||
if ($withcountry)
|
||||
{
|
||||
if ($withcountry) {
|
||||
$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;
|
||||
@ -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
|
||||
$url = DOL_URL_ROOT;
|
||||
$theme = $conf->theme;
|
||||
$theme = isset($conf->theme) ? $conf->theme : null;
|
||||
$path = 'theme/'.$theme;
|
||||
|
||||
// Define fullpathpicto to use into src
|
||||
if ($pictoisfullpath) {
|
||||
// Clean parameters
|
||||
@ -4804,7 +4800,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
if ($option != 1) { // If not a PHP number or unknown, we change or clean format
|
||||
//print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>';
|
||||
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
|
||||
@ -5153,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.
|
||||
* 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.
|
||||
* Instead this function must be called when adding a line to get the array of localtax and type, and then
|
||||
* provide it to the function calcul_price_total.
|
||||
*
|
||||
* 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 possible values for localtax and type, and then
|
||||
* 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 $local Number of localtax (1 or 2, or 0 to return 1 & 2)
|
||||
* @param Societe $buyer 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)
|
||||
* @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()
|
||||
*/
|
||||
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid = 0)
|
||||
@ -5175,13 +5171,13 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
// 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 .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
|
||||
if ($firstparamisid) $sql .= " WHERE t.rowid = ".(int) $vatrate;
|
||||
else {
|
||||
if ($firstparamisid) {
|
||||
$sql .= " WHERE t.rowid = ".(int) $vatrate;
|
||||
} else {
|
||||
$vatratecleaned = $vatrate;
|
||||
$vatratecode = '';
|
||||
$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];
|
||||
$vatratecode = $reg[2];
|
||||
}
|
||||
@ -5194,20 +5190,19 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($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)
|
||||
{
|
||||
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
} 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->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);
|
||||
if ($local == 1) {
|
||||
return array($obj->localtax1_type, get_localtax($vateratestring, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
|
||||
} 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->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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5704,9 +5699,11 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
|
||||
if ($removelinefeed == 2) $stringtoclean = preg_replace('/<br[^>]*>(\n|\r)+/ims', '<br>', $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 = str_replace('< ', '__ltspace__', $temp);
|
||||
|
||||
if ($strip_tags) {
|
||||
$temp = strip_tags($temp);
|
||||
} else {
|
||||
@ -5730,16 +5727,19 @@ function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto =
|
||||
}
|
||||
}
|
||||
|
||||
$temp = str_replace('__ltspace__', '< ', $temp);
|
||||
|
||||
return trim($temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 int $cleanalsosomestyles Remove absolute/fixed positioning from inline styles
|
||||
* @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
|
||||
*
|
||||
* @see dol_escape_htmltag() strip_tags() dol_string_nohtmltag() dol_string_neverthesehtmltags()
|
||||
@ -5757,16 +5757,21 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
$stringtoclean = dol_string_nounprintableascii($stringtoclean, 0);
|
||||
$stringtoclean = preg_replace('/:/i', ':', $stringtoclean);
|
||||
|
||||
$stringtoclean = preg_replace('/<!--[^>]*-->/', '', $stringtoclean);
|
||||
$stringtoclean = preg_replace('/:|:|:/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);
|
||||
|
||||
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
|
||||
$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
|
||||
// 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) {
|
||||
$temp = preg_replace('/javascript\s*:/i', '', $temp);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/**
|
||||
* \file htdocs/core/lib/phpsessionindb.lib.php
|
||||
* \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
|
||||
|
||||
@ -129,14 +129,14 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
$localtax1_type = 0;
|
||||
$localtax2_type = 0;
|
||||
|
||||
if (is_array($localtaxes_array))
|
||||
{
|
||||
if (is_array($localtaxes_array)) {
|
||||
$localtax1_type = $localtaxes_array[0];
|
||||
$localtax1_rate = $localtaxes_array[1];
|
||||
$localtax2_type = $localtaxes_array[2];
|
||||
$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);
|
||||
|
||||
$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);
|
||||
if ($obj)
|
||||
{
|
||||
$localtax1_rate = $obj->localtax1;
|
||||
$localtax2_rate = $obj->localtax2;
|
||||
$localtax1_rate = (float) $obj->localtax1; // Use float to force to get first numeric value when value is x:y:z
|
||||
$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;
|
||||
$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);
|
||||
}
|
||||
@ -417,7 +417,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
// initialize result array
|
||||
//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;
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ function dolSaveReadme($file, $content)
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
function showWebsiteTemplates(Website $website)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -67,12 +67,15 @@ class MenuManager
|
||||
global $conf, $user, $langs;
|
||||
|
||||
// We save into session the main menu selected
|
||||
if (GETPOSTISSET("mainmenu")) $_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09');
|
||||
if (GETPOSTISSET("idmenu")) $_SESSION["idmenu"] = GETPOST("idmenu", 'int');
|
||||
if (GETPOSTISSET("mainmenu")) {
|
||||
$_SESSION["mainmenu"] = GETPOST("mainmenu", 'aZ09');
|
||||
}
|
||||
if (GETPOSTISSET("idmenu")) {
|
||||
$_SESSION["idmenu"] = GETPOST("idmenu", 'int');
|
||||
}
|
||||
|
||||
// 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
|
||||
$mainmenu = GETPOST("mainmenu", 'aZ09');
|
||||
$_SESSION["mainmenu"] = $mainmenu;
|
||||
@ -81,16 +84,16 @@ class MenuManager
|
||||
// On va le chercher en session si non defini par le lien
|
||||
$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
|
||||
$leftmenu = GETPOST("leftmenu", 'aZ09');
|
||||
$_SESSION["leftmenu"] = $leftmenu;
|
||||
|
||||
if ($_SESSION["leftmenuopened"] == $leftmenu) // To collapse
|
||||
{
|
||||
if ($_SESSION["leftmenuopened"] == $leftmenu) { // To collapse
|
||||
//$leftmenu="";
|
||||
$_SESSION["leftmenuopened"] = "";
|
||||
} else {
|
||||
@ -100,7 +103,9 @@ class MenuManager
|
||||
// On va le chercher en session si non defini par le lien
|
||||
$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';
|
||||
$tabMenu = array();
|
||||
@ -129,8 +134,7 @@ class MenuManager
|
||||
|
||||
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_CONTACT_DISABLED = 1;
|
||||
}
|
||||
@ -138,36 +142,39 @@ class MenuManager
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
|
||||
$this->menu = new Menu();
|
||||
|
||||
if (empty($conf->global->MAIN_MENU_INVERT))
|
||||
{
|
||||
if ($mode == 'top') 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 (empty($conf->global->MAIN_MENU_INVERT)) {
|
||||
if ($mode == 'top') {
|
||||
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, $this->type_user);
|
||||
}
|
||||
} else {
|
||||
$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 == 'left') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
|
||||
if ($mode == 'top') {
|
||||
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
|
||||
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
|
||||
|
||||
// $this->menu->liste is top menu
|
||||
//var_dump($this->menu->liste);exit;
|
||||
$lastlevel = array();
|
||||
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 '<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['__USERID__'] = $user->id; // For backward compatibility
|
||||
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||
@ -178,7 +185,9 @@ class MenuManager
|
||||
print '<a class="alilevel0" href="#">';
|
||||
|
||||
// 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 '</a>'."\n";
|
||||
@ -187,7 +196,7 @@ class MenuManager
|
||||
$tmpmainmenu = $val['mainmenu'];
|
||||
$tmpleftmenu = 'all';
|
||||
$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
|
||||
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
|
||||
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
|
||||
@ -199,27 +208,27 @@ class MenuManager
|
||||
//var_dump($canonnexturl);
|
||||
print '<ul>'."\n";
|
||||
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
|
||||
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) print $langs->trans("Access");
|
||||
else print $langs->trans("Dashboard");
|
||||
} else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") { // No translation
|
||||
if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) {
|
||||
print $langs->trans("Access");
|
||||
} else {
|
||||
print $langs->trans("Dashboard");
|
||||
}
|
||||
} else {
|
||||
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
}
|
||||
print '</a>';
|
||||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
if ($val['level'] == 0)
|
||||
{
|
||||
if ($val['enabled'])
|
||||
{
|
||||
if ($val['level'] == 0) {
|
||||
if ($val['enabled']) {
|
||||
$lastlevel[0] = 'enabled';
|
||||
} elseif ($showmenu) // Not enabled but visible (so greyed)
|
||||
{
|
||||
} elseif ($showmenu) { // Not enabled but visible (so greyed)
|
||||
$lastlevel[0] = 'greyed';
|
||||
} else {
|
||||
$lastlevel[0] = 'hidden';
|
||||
@ -227,52 +236,52 @@ class MenuManager
|
||||
}
|
||||
|
||||
$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;
|
||||
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 ($val2['level'] > 0)
|
||||
{
|
||||
if ($val2['level'] > 0) {
|
||||
$levelcursor = $val2['level'] - 1;
|
||||
while ($levelcursor >= 0)
|
||||
{
|
||||
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu = false;
|
||||
while ($levelcursor >= 0) {
|
||||
if ($lastlevel2[$levelcursor] != 'enabled') {
|
||||
$showmenu = false;
|
||||
}
|
||||
$levelcursor--;
|
||||
}
|
||||
}
|
||||
|
||||
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['__USERID__'] = $user->id; // For backward compatibility
|
||||
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
|
||||
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['__USERID__'] = $user->id; // For backward compatibility
|
||||
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
|
||||
|
||||
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url']))
|
||||
{
|
||||
$relurl2 = dol_buildpath($val2['url'], 1);
|
||||
} else {
|
||||
$relurl2 = $val2['url'];
|
||||
}
|
||||
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url'])) {
|
||||
$relurl2 = dol_buildpath($val2['url'], 1);
|
||||
} else {
|
||||
$relurl2 = $val2['url'];
|
||||
}
|
||||
$canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
|
||||
//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 = '';
|
||||
if (!$val2['enabled'])
|
||||
{
|
||||
if (!$val2['enabled']) {
|
||||
$disabled = " vsmenudisabled";
|
||||
}
|
||||
|
||||
print str_pad('', $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
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
{
|
||||
if ($relurl2) {
|
||||
if ($val2['enabled']) { // Allowed
|
||||
print '<a href="'.$relurl2.'"';
|
||||
//print ' data-ajax="false"';
|
||||
print '>';
|
||||
@ -283,28 +292,27 @@ class MenuManager
|
||||
$lastlevel2[$val2['level']] = 'greyed';
|
||||
}
|
||||
} else {
|
||||
if ($val2['enabled']) // Allowed
|
||||
{
|
||||
if ($val2['enabled']) { // Allowed
|
||||
$lastlevel2[$val2['level']] = 'enabled';
|
||||
} else {
|
||||
$lastlevel2[$val2['level']] = 'greyed';
|
||||
}
|
||||
}
|
||||
print $val2['titre'];
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
if ($relurl2) {
|
||||
if ($val2['enabled']) { // Allowed
|
||||
print '</a>';
|
||||
else print '</a>';
|
||||
} else {
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
print '</li>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($submenu);
|
||||
print '</ul>';
|
||||
}
|
||||
if ($val['enabled'] == 2)
|
||||
{
|
||||
if ($val['enabled'] == 2) {
|
||||
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
|
||||
}
|
||||
print '</li>';
|
||||
|
||||
@ -32,10 +32,13 @@ class MenuManager
|
||||
|
||||
public $type_user = 0; // Put 0 for internal users, 1 for external users
|
||||
public $atarget = ""; // To store default target to use onto links
|
||||
public $name = "empty";
|
||||
|
||||
public $menu;
|
||||
public $menu_array_after;
|
||||
|
||||
public $tabMenu;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -60,6 +63,7 @@ class MenuManager
|
||||
public function loadMenu($forcemainmenu = '', $forceleftmenu = '')
|
||||
{
|
||||
// Do nothing
|
||||
$this->tabMenu = array();
|
||||
}
|
||||
|
||||
|
||||
@ -84,20 +88,19 @@ class MenuManager
|
||||
$noout = 0;
|
||||
//if ($mode == 'jmobile') $noout=1;
|
||||
|
||||
if ($mode == 'topnb')
|
||||
{
|
||||
if ($mode == 'topnb') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($mode == 'top')
|
||||
{
|
||||
if (empty($noout)) print_start_menu_array_empty();
|
||||
if ($mode == 'top') {
|
||||
if (empty($noout)) {
|
||||
print_start_menu_array_empty();
|
||||
}
|
||||
|
||||
$usemenuhider = 1;
|
||||
|
||||
// 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;
|
||||
$classname = 'class="tmenu menuhider"';
|
||||
$idsel = 'menu';
|
||||
@ -117,28 +120,37 @@ class MenuManager
|
||||
$this->menu->liste = dol_sort_array($this->menu->liste, 'position');
|
||||
|
||||
// Output menu entries
|
||||
foreach ($this->menu->liste as $menkey => $menuval)
|
||||
{
|
||||
if (empty($noout)) 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']);
|
||||
foreach ($this->menu->liste as $menkey => $menuval) {
|
||||
if (empty($noout)) {
|
||||
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']);
|
||||
}
|
||||
}
|
||||
|
||||
$showmode = 1;
|
||||
if (empty($noout)) print_start_menu_entry_empty('', 'class="tmenuend"', $showmode);
|
||||
if (empty($noout)) print_end_menu_entry_empty($showmode);
|
||||
if (empty($noout)) {
|
||||
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;
|
||||
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
|
||||
$showmode = 1;
|
||||
$classname = 'class="tmenusel"';
|
||||
@ -152,22 +164,22 @@ class MenuManager
|
||||
//var_dump($this->menu->liste);exit;
|
||||
$lastlevel = array();
|
||||
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 '<li class="lilevel0">';
|
||||
|
||||
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||
|
||||
if ($val['enabled'] == 1)
|
||||
{
|
||||
if ($val['enabled'] == 1) {
|
||||
$relurl = dol_buildpath($val['url'], 1);
|
||||
$canonurl = preg_replace('/\?.*$/', '', $val['url']);
|
||||
|
||||
print '<a class="alilevel0" href="#">';
|
||||
|
||||
// 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 '</a>'."\n";
|
||||
@ -206,27 +218,27 @@ class MenuManager
|
||||
//var_dump($canonnexturl);
|
||||
print '<ul>'."\n";
|
||||
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
|
||||
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
|
||||
{
|
||||
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access");
|
||||
else print $langs->trans("Dashboard");
|
||||
} else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") { // No translation
|
||||
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) {
|
||||
print $langs->trans("Access");
|
||||
} else {
|
||||
print $langs->trans("Dashboard");
|
||||
}
|
||||
} else {
|
||||
print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
|
||||
}
|
||||
print '</a>';
|
||||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
if ($val['level'] == 0)
|
||||
{
|
||||
if ($val['enabled'])
|
||||
{
|
||||
if ($val['level'] == 0) {
|
||||
if ($val['enabled']) {
|
||||
$lastlevel[0] = 'enabled';
|
||||
} elseif ($showmenu) // Not enabled but visible (so greyed)
|
||||
{
|
||||
} elseif ($showmenu) { // Not enabled but visible (so greyed)
|
||||
$lastlevel[0] = 'greyed';
|
||||
} else {
|
||||
$lastlevel[0] = 'hidden';
|
||||
@ -234,45 +246,46 @@ class MenuManager
|
||||
}
|
||||
|
||||
$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;
|
||||
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 ($val2['level'] > 0)
|
||||
{
|
||||
if ($val2['level'] > 0) {
|
||||
$levelcursor = $val2['level'] - 1;
|
||||
while ($levelcursor >= 0)
|
||||
{
|
||||
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu = false;
|
||||
while ($levelcursor >= 0) {
|
||||
if ($lastlevel2[$levelcursor] != 'enabled') {
|
||||
$showmenu = false;
|
||||
}
|
||||
$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);
|
||||
|
||||
$relurl2 = dol_buildpath($val2['url'], 1);
|
||||
$canonurl2 = preg_replace('/\?.*$/', '', $val2['url']);
|
||||
//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 = '';
|
||||
if (!$val2['enabled'])
|
||||
{
|
||||
if (!$val2['enabled']) {
|
||||
$disabled = " vsmenudisabled";
|
||||
}
|
||||
|
||||
print str_pad('', $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
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($val2['enabled']) // Allowed
|
||||
{
|
||||
if ($relurl2) {
|
||||
if ($val2['enabled']) { // Allowed
|
||||
print '<a href="'.$relurl2.'"';
|
||||
//print ' data-ajax="false"';
|
||||
print '>';
|
||||
@ -283,8 +296,7 @@ class MenuManager
|
||||
$lastlevel2[$val2['level']] = 'greyed';
|
||||
}
|
||||
} else {
|
||||
if ($val2['enabled']) // Allowed
|
||||
{
|
||||
if ($val2['enabled']) { // Allowed
|
||||
$lastlevel2[$val2['level']] = 'enabled';
|
||||
} else {
|
||||
$lastlevel2[$val2['level']] = 'greyed';
|
||||
@ -293,8 +305,7 @@ class MenuManager
|
||||
//var_dump($val2['level']);
|
||||
//var_dump($lastlevel2);
|
||||
print $val2['titre'];
|
||||
if ($relurl2)
|
||||
{
|
||||
if ($relurl2) {
|
||||
if ($val2['enabled']) {
|
||||
// Allowed
|
||||
print '</a>';
|
||||
@ -308,8 +319,7 @@ class MenuManager
|
||||
//var_dump($submenu);
|
||||
print '</ul>';
|
||||
}
|
||||
if ($val['enabled'] == 2)
|
||||
{
|
||||
if ($val['enabled'] == 2) {
|
||||
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
|
||||
}
|
||||
print '</li>';
|
||||
@ -317,8 +327,7 @@ class MenuManager
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'left')
|
||||
{
|
||||
if ($mode == 'left') {
|
||||
// Put here left menu entries
|
||||
// ***** START *****
|
||||
|
||||
@ -343,28 +352,40 @@ class MenuManager
|
||||
|
||||
// ***** END *****
|
||||
|
||||
$menu_array_before = array();
|
||||
$menu_array_after = array();
|
||||
|
||||
// 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;
|
||||
$num = count($this->menu->liste);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$num = count($menu_array);
|
||||
for ($i = 0; $i < $num; $i++) {
|
||||
$alt++;
|
||||
if (empty($this->menu->liste[$i]['level']))
|
||||
{
|
||||
if (empty($menu_array[$i]['level'])) {
|
||||
$altok++;
|
||||
$blockvmenuopened = true;
|
||||
$lastopened = true;
|
||||
for ($j = ($i + 1); $j < $num; $j++)
|
||||
{
|
||||
if (empty($menu_array[$j]['level'])) $lastopened = false;
|
||||
for ($j = ($i + 1); $j < $num; $j++) {
|
||||
if (empty($menu_array[$j]['level'])) {
|
||||
$lastopened = false;
|
||||
}
|
||||
}
|
||||
$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
|
||||
if (($alt % 2 == 0))
|
||||
{
|
||||
if (($alt % 2 == 0)) {
|
||||
print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n";
|
||||
} else {
|
||||
print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened ? ' blockvmenulast' : '').($alt == 1 ? ' blockvmenufirst' : '').'">'."\n";
|
||||
@ -373,122 +394,70 @@ class MenuManager
|
||||
|
||||
// Add tabulation
|
||||
$tabstring = '';
|
||||
$tabul = ($this->menu->liste[$i]['level'] - 1);
|
||||
if ($tabul > 0)
|
||||
{
|
||||
for ($j = 0; $j < $tabul; $j++)
|
||||
{
|
||||
$tabul = ($menu_array[$i]['level'] - 1);
|
||||
if ($tabul > 0) {
|
||||
for ($j = 0; $j < $tabul; $j++) {
|
||||
$tabstring .= ' ';
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->menu->liste[$i]['level'] == 0) {
|
||||
if ($this->menu->liste[$i]['enabled'])
|
||||
{
|
||||
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";
|
||||
if ($menu_array[$i]['level'] == 0) {
|
||||
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";
|
||||
} 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";
|
||||
}
|
||||
|
||||
if ($this->menu->liste[$i]['level'] > 0)
|
||||
{
|
||||
if ($menu_array[$i]['level'] > 0) {
|
||||
$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.'">';
|
||||
|
||||
if ($this->menu->liste[$i]['enabled'])
|
||||
{
|
||||
if ($menu_array[$i]['enabled']) {
|
||||
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'].'"' : '').'>';
|
||||
else print '<span class="vsmenu" title="'.dol_escape_htmltag($this->menu->liste[$i]['titre']).'">';
|
||||
if ($this->menu->liste[$i]['url']) print $this->menu->liste[$i]['titre'].'</a>';
|
||||
else print '</span>';
|
||||
if ($menu_array[$i]['url']) {
|
||||
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'].'"' : '').'>';
|
||||
} else {
|
||||
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 {
|
||||
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 (!strstr($this->menu->liste[$i]['titre'], '<table')) print '<br>';
|
||||
if (!strstr($menu_array[$i]['titre'], '<table')) {
|
||||
print '<br>';
|
||||
}
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
// 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>\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;
|
||||
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);
|
||||
|
||||
return $res;
|
||||
@ -519,8 +488,7 @@ function print_start_menu_array_empty()
|
||||
*/
|
||||
function print_start_menu_entry_empty($idsel, $classname, $showmode)
|
||||
{
|
||||
if ($showmode)
|
||||
{
|
||||
if ($showmode) {
|
||||
print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
|
||||
//print '<div class="tmenuleft tmenusep"></div>';
|
||||
print '<div class="tmenucenter">';
|
||||
@ -543,8 +511,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if ($showmode == 1)
|
||||
{
|
||||
if ($showmode == 1) {
|
||||
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 '</a>';
|
||||
@ -554,8 +521,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
|
||||
print '</span>';
|
||||
print '</a>';
|
||||
}
|
||||
if ($showmode == 2)
|
||||
{
|
||||
if ($showmode == 2) {
|
||||
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")).'">';
|
||||
}
|
||||
@ -569,8 +535,7 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
|
||||
*/
|
||||
function print_end_menu_entry_empty($showmode)
|
||||
{
|
||||
if ($showmode)
|
||||
{
|
||||
if ($showmode) {
|
||||
print '</div></li>';
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -1250,12 +1250,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
//print "Remove box ".$file.'<br>';
|
||||
if ($file == 'box_graph_product_distribution.php') {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
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') {
|
||||
@ -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 .= " 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);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -454,6 +454,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
|
||||
// Replace tags of object + external modules
|
||||
$tmparray = $this->get_substitutionarray_shipment($object, $outputlangs);
|
||||
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
|
||||
@ -25,7 +25,11 @@
|
||||
* \brief File to load import files with Excel format
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/import/modules_import.php';
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Style\Alignment;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/modules/import/modules_import.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -107,17 +111,22 @@ class ImportXlsx extends ModeleImports
|
||||
$this->extension = 'xlsx'; // Extension for generated file by this driver
|
||||
$this->picto = 'mime/xls'; // Picto (This is not used by the example file code as Mime type, too bad ...)
|
||||
$this->version = '1.0'; // Driver version
|
||||
|
||||
// If driver use an external library, put its name here
|
||||
require_once PHPEXCEL_PATH.'PHPExcel.php';
|
||||
require_once PHPEXCEL_PATH.'PHPExcel/Style/Alignment.php';
|
||||
if (!class_exists('ZipArchive')) // For Excel2007, PHPExcel need ZipArchive
|
||||
require_once DOL_DOCUMENT_ROOT . '/includes/phpoffice/autoloader.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/includes/Psr/autoloader.php';
|
||||
require_once PHPEXCELNEW_PATH . 'Spreadsheet.php';
|
||||
$this->workbook = new Spreadsheet();
|
||||
|
||||
//if ($this->id == 'excel2007new')
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorPHPNeedModule', 'zip');
|
||||
return -1;
|
||||
if (!class_exists('ZipArchive')) // For Excel2007
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorPHPNeedModule', 'zip');
|
||||
return -1;
|
||||
}
|
||||
$this->label_lib = 'PhpExcel';
|
||||
}
|
||||
$this->label_lib = 'PhpSpreadSheet';
|
||||
$this->version_lib = '1.8.0';
|
||||
|
||||
$this->datatoimport = $datatoimport;
|
||||
@ -135,21 +144,12 @@ class ImportXlsx extends ModeleImports
|
||||
public function write_header_example($outputlangs)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $user, $conf, $langs;
|
||||
global $user, $conf, $langs, $file;
|
||||
// create a temporary object, the final output will be generated in footer
|
||||
if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) {
|
||||
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM;
|
||||
$cacheSettings = array(
|
||||
'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR
|
||||
);
|
||||
PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
|
||||
}
|
||||
|
||||
$this->workbook = new PHPExcel();
|
||||
$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION);
|
||||
$this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file);
|
||||
$this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file);
|
||||
$this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file);
|
||||
$this->workbook->getProperties()->setCreator($user->getFullName($outputlangs) . ' - Dolibarr ' . DOL_VERSION);
|
||||
$this->workbook->getProperties()->setTitle($outputlangs->trans("Import") . ' - ' . $file);
|
||||
$this->workbook->getProperties()->setSubject($outputlangs->trans("Import") . ' - ' . $file);
|
||||
$this->workbook->getProperties()->setDescription($outputlangs->trans("Import") . ' - ' . $file);
|
||||
|
||||
$this->workbook->setActiveSheetIndex(0);
|
||||
$this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet"));
|
||||
@ -171,7 +171,7 @@ class ImportXlsx extends ModeleImports
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
|
||||
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
|
||||
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
|
||||
|
||||
$col = 0;
|
||||
foreach ($headerlinefields as $field) {
|
||||
@ -217,7 +217,7 @@ class ImportXlsx extends ModeleImports
|
||||
// phpcs:enable
|
||||
// return the file content as a string
|
||||
$tempfile = tempnam(sys_get_temp_dir(), 'dol');
|
||||
$objWriter = new PHPExcel_Writer_Excel2007($this->workbook);
|
||||
$objWriter = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($this->workbook);
|
||||
$objWriter->save($tempfile);
|
||||
$this->workbook->disconnectWorksheets();
|
||||
unset($this->workbook);
|
||||
@ -242,9 +242,9 @@ class ImportXlsx extends ModeleImports
|
||||
global $langs;
|
||||
$ret = 1;
|
||||
|
||||
dol_syslog(get_class($this)."::open_file file=".$file);
|
||||
dol_syslog(get_class($this) . "::open_file file=" . $file);
|
||||
|
||||
$reader = new PHPExcel_Reader_Excel2007();
|
||||
$reader = new Xlsx();
|
||||
$this->workbook = $reader->load($file);
|
||||
$this->record = 1;
|
||||
$this->file = $file;
|
||||
@ -263,7 +263,7 @@ class ImportXlsx extends ModeleImports
|
||||
public function import_get_nb_of_lines($file)
|
||||
{
|
||||
// phpcs:enable
|
||||
$reader = new PHPExcel_Reader_Excel2007();
|
||||
$reader = new Xlsx();
|
||||
$this->workbook = $reader->load($file);
|
||||
|
||||
$rowcount = $this->workbook->getActiveSheet()->getHighestDataRow();
|
||||
@ -286,8 +286,10 @@ class ImportXlsx extends ModeleImports
|
||||
// phpcs:enable
|
||||
// This is not called by the import code !!!
|
||||
$this->headers = array();
|
||||
$colcount = PHPExcel_Cell::columnIndexFromString($this->workbook->getActiveSheet()->getHighestDataColumn());
|
||||
for ($col = 0; $col < $colcount; $col++) {
|
||||
$xlsx = new Xlsx();
|
||||
$info = $xlsx->listWorksheetinfo($this->file);
|
||||
$countcolumns = $info[0]['totalColumns'];
|
||||
for ($col = 0; $col < $countcolumns; $col++) {
|
||||
$this->headers[$col] = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, 1)->getValue();
|
||||
}
|
||||
return 0;
|
||||
@ -309,8 +311,10 @@ class ImportXlsx extends ModeleImports
|
||||
if ($this->record > $rowcount)
|
||||
return false;
|
||||
$array = array();
|
||||
$colcount = PHPExcel_Cell::columnIndexFromString($this->workbook->getActiveSheet()->getHighestDataColumn(0));
|
||||
for ($col = 0; $col < $colcount; $col++) {
|
||||
$xlsx = new Xlsx();
|
||||
$info = $xlsx->listWorksheetinfo($this->file);
|
||||
$countcolumns = $info[0]['totalColumns'];
|
||||
for ($col = 0; $col < $countcolumns; $col++) {
|
||||
$val = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, $this->record)->getValue();
|
||||
$array[$col]['val'] = $val;
|
||||
$array[$col]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we consider it null
|
||||
@ -368,8 +372,7 @@ class ImportXlsx extends ModeleImports
|
||||
|
||||
//var_dump($sort_array_match_file_to_database);
|
||||
|
||||
if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[0]['val'])))
|
||||
{
|
||||
if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[0]['val']))) {
|
||||
//print 'W';
|
||||
$this->warnings[$warning]['lib'] = $langs->trans('EmptyLine');
|
||||
$this->warnings[$warning]['type'] = 'EMPTY';
|
||||
@ -379,8 +382,7 @@ class ImportXlsx extends ModeleImports
|
||||
$updatedone = false;
|
||||
$insertdone = false;
|
||||
// For each table to insert, me make a separate insert
|
||||
foreach ($objimport->array_import_tables[0] as $alias => $tablename)
|
||||
{
|
||||
foreach ($objimport->array_import_tables[0] as $alias => $tablename) {
|
||||
// Build sql request
|
||||
$sql = '';
|
||||
$listfields = array();
|
||||
@ -391,10 +393,9 @@ class ImportXlsx extends ModeleImports
|
||||
// Define $tablewithentity_cache[$tablename] if not already defined
|
||||
if (!isset($tablewithentity_cache[$tablename])) // keep this test with "isset"
|
||||
{
|
||||
dol_syslog("Check if table ".$tablename." has an entity field");
|
||||
dol_syslog("Check if table " . $tablename . " has an entity field");
|
||||
$resql = $this->db->DDLDescTable($tablename, 'entity');
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $tablewithentity_cache[$tablename] = 1; // table contains entity field
|
||||
else $tablewithentity_cache[$tablename] = 0; // table does not contains entity field
|
||||
@ -410,15 +411,13 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
|
||||
// Loop on each fields in the match array: $key = 1..n, $val=alias of field (s.nom)
|
||||
foreach ($sort_array_match_file_to_database as $key => $val)
|
||||
{
|
||||
foreach ($sort_array_match_file_to_database as $key => $val) {
|
||||
$fieldalias = preg_replace('/\..*$/i', '', $val);
|
||||
$fieldname = preg_replace('/^.*\./i', '', $val);
|
||||
|
||||
if ($alias != $fieldalias) continue; // Not a field of current table
|
||||
|
||||
if ($key <= $maxfields)
|
||||
{
|
||||
if ($key <= $maxfields) {
|
||||
// Set $newval with value to insert and set $listvalues with sql request part for insert
|
||||
$newval = '';
|
||||
if ($arrayrecord[($key - 1)]['type'] > 0) $newval = $arrayrecord[($key - 1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
|
||||
@ -426,8 +425,7 @@ class ImportXlsx extends ModeleImports
|
||||
// Make some tests on $newval
|
||||
|
||||
// Is it a required field ?
|
||||
if (preg_match('/\*/', $objimport->array_import_fields[0][$val]) && ((string) $newval == ''))
|
||||
{
|
||||
if (preg_match('/\*/', $objimport->array_import_fields[0][$val]) && ((string) $newval == '')) {
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorMissingMandatoryValue', $key);
|
||||
$this->errors[$error]['type'] = 'NOTNULL';
|
||||
$errorforthistable++;
|
||||
@ -436,14 +434,13 @@ class ImportXlsx extends ModeleImports
|
||||
// Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory)
|
||||
else {
|
||||
// We convert field if required
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]))
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val])) {
|
||||
//print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. ';
|
||||
if ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeid'
|
||||
if (
|
||||
$objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeid'
|
||||
|| $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromref'
|
||||
|| $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel'
|
||||
)
|
||||
{
|
||||
) {
|
||||
// New val can be an id or ref. If it start with id: it is forced to id, if it start with ref: it is forced to ref. It not, we try to guess.
|
||||
$isidorref = 'id';
|
||||
if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref';
|
||||
@ -454,21 +451,18 @@ class ImportXlsx extends ModeleImports
|
||||
$file = (empty($objimport->array_import_convertvalue[0][$val]['classfile']) ? $objimport->array_import_convertvalue[0][$val]['file'] : $objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
$class = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$method = $objimport->array_import_convertvalue[0][$val]['method'];
|
||||
if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] != '')
|
||||
{
|
||||
$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval];
|
||||
if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] != '') {
|
||||
$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval];
|
||||
} else {
|
||||
$resultload = dol_include_once($file);
|
||||
if (empty($resultload))
|
||||
{
|
||||
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
|
||||
if (empty($resultload)) {
|
||||
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
// Try the fetch from code or ref
|
||||
$param_array = array('', $newval);
|
||||
if ($class == 'AccountingAccount')
|
||||
{
|
||||
if ($class == 'AccountingAccount') {
|
||||
//var_dump($arrayrecord[0]['val']);
|
||||
/*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php';
|
||||
$tmpchartofaccount = new AccountancySystem($this->db);
|
||||
@ -485,12 +479,11 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
// If not found, try the fetch from label
|
||||
if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel')
|
||||
{
|
||||
if (!($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel') {
|
||||
$param_array = array('', '', $newval);
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
}
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] = $classinstance->id;
|
||||
$this->cacheconvert[$file . '_' . $class . '_' . $method . '_'][$newval] = $classinstance->id;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
if ($classinstance->id != '') // id may be 0, it is a found value
|
||||
{
|
||||
@ -516,19 +509,19 @@ class ImportXlsx extends ModeleImports
|
||||
$method = $objimport->array_import_convertvalue[0][$val]['method'];
|
||||
$codefromfield = $objimport->array_import_convertvalue[0][$val]['codefromfield'];
|
||||
$code = $arrayrecord[$arrayfield[$codefromfield]]['val'];
|
||||
if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] != '') {
|
||||
$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval];
|
||||
if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] != '') {
|
||||
$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval];
|
||||
} else {
|
||||
$resultload = dol_include_once($file);
|
||||
if (empty($resultload)) {
|
||||
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', code='.$code);
|
||||
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', code=' . $code);
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
// Try the fetch from code and ref
|
||||
$param_array = array('', $newval, $code);
|
||||
call_user_func_array(array($classinstance, $method), $param_array);
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$code][$newval] = $classinstance->id;
|
||||
$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $code][$newval] = $classinstance->id;
|
||||
if ($classinstance->id > 0) // we found record
|
||||
{
|
||||
$newval = $classinstance->id;
|
||||
@ -548,21 +541,19 @@ class ImportXlsx extends ModeleImports
|
||||
$class = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$method = $objimport->array_import_convertvalue[0][$val]['method'];
|
||||
$units = $objimport->array_import_convertvalue[0][$val]['units'];
|
||||
if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '')
|
||||
{
|
||||
$newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval];
|
||||
if ($this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] != '') {
|
||||
$newval = $this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval];
|
||||
} else {
|
||||
$resultload = dol_include_once($file);
|
||||
if (empty($resultload))
|
||||
{
|
||||
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units);
|
||||
if (empty($resultload)) {
|
||||
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method . ', units=' . $units);
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
// Try the fetch from code or ref
|
||||
call_user_func_array(array($classinstance, $method), array('', '', $newval, $units));
|
||||
$scaleorid = (($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeunits') ? $classinstance->id : $classinstance->scale);
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] = $scaleorid;
|
||||
$this->cacheconvert[$file . '_' . $class . '_' . $method . '_' . $units][$newval] = $scaleorid;
|
||||
//print 'We have made a '.$class.'->'.$method." to get a value from key '".$newval."' and we got '".$scaleorid."'.";exit;
|
||||
if ($classinstance->id > 0) // we found record
|
||||
{
|
||||
@ -576,32 +567,28 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
}
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomercodeifauto') {
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
if (strtolower($newval) == 'auto') {
|
||||
$this->thirpartyobject->get_codeclient(0, 0);
|
||||
$newval = $this->thirpartyobject->code_client;
|
||||
//print 'code_client='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
if (strtolower($newval) == 'auto') {
|
||||
$newval = $this->thirpartyobject->get_codefournisseur(0, 1);
|
||||
$newval = $this->thirpartyobject->code_fournisseur;
|
||||
//print 'code_fournisseur='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
if (strtolower($newval) == 'auto') {
|
||||
$this->thirpartyobject->get_codecompta('customer');
|
||||
$newval = $this->thirpartyobject->code_compta;
|
||||
//print 'code_compta='.$newval;
|
||||
}
|
||||
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
|
||||
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
|
||||
if (strtolower($newval) == 'auto')
|
||||
{
|
||||
if (strtolower($newval) == 'auto') {
|
||||
$this->thirpartyobject->get_codecompta('supplier');
|
||||
$newval = $this->thirpartyobject->code_compta_fournisseur;
|
||||
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
|
||||
@ -612,9 +599,8 @@ class ImportXlsx extends ModeleImports
|
||||
$defaultref = '';
|
||||
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
|
||||
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php"))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php';
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
|
||||
$modTask = new $obj;
|
||||
$defaultref = $modTask->getNextValue(null, null);
|
||||
}
|
||||
@ -625,9 +611,8 @@ class ImportXlsx extends ModeleImports
|
||||
$class = $objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$method = $objimport->array_import_convertvalue[0][$val]['method'];
|
||||
$resultload = dol_include_once($file);
|
||||
if (empty($resultload))
|
||||
{
|
||||
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method);
|
||||
if (empty($resultload)) {
|
||||
dol_print_error('', 'Error trying to call file=' . $file . ', class=' . $class . ', method=' . $method);
|
||||
break;
|
||||
}
|
||||
$classinstance = new $class($this->db);
|
||||
@ -649,34 +634,29 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
|
||||
// Test regexp
|
||||
if (!empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
|
||||
{
|
||||
if (!empty($objimport->array_import_regex[0][$val]) && ($newval != '')) {
|
||||
// If test is "Must exist in a field@table or field@table:..."
|
||||
if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
|
||||
{
|
||||
if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg)) {
|
||||
$field = $reg[1];
|
||||
$table = $reg[2];
|
||||
$filter = !empty($reg[3]) ?substr($reg[3], 1) : '';
|
||||
$filter = !empty($reg[3]) ? substr($reg[3], 1) : '';
|
||||
|
||||
$cachekey = $field.'@'.$table;
|
||||
if (!empty($filter)) $cachekey .= ':'.$filter;
|
||||
$cachekey = $field . '@' . $table;
|
||||
if (!empty($filter)) $cachekey .= ':' . $filter;
|
||||
|
||||
// Load content of field@table into cache array
|
||||
if (!is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
|
||||
{
|
||||
$sql = "SELECT ".$field." as aliasfield FROM ".$table;
|
||||
if (!empty($filter))
|
||||
{
|
||||
$sql .= ' WHERE '.$filter;
|
||||
$sql = "SELECT " . $field . " as aliasfield FROM " . $table;
|
||||
if (!empty($filter)) {
|
||||
$sql .= ' WHERE ' . $filter;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) $this->cachefieldtable[$cachekey][] = $obj->aliasfield;
|
||||
$i++;
|
||||
@ -687,10 +667,9 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
|
||||
// Now we check cache is not empty (should not) and key is into cache
|
||||
if (!is_array($this->cachefieldtable[$cachekey]) || !in_array($newval, $this->cachefieldtable[$cachekey]))
|
||||
{
|
||||
if (!is_array($this->cachefieldtable[$cachekey]) || !in_array($newval, $this->cachefieldtable[$cachekey])) {
|
||||
$tableforerror = $table;
|
||||
if (!empty($filter)) $tableforerror .= ':'.$filter;
|
||||
if (!empty($filter)) $tableforerror .= ':' . $filter;
|
||||
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
|
||||
$this->errors[$error]['type'] = 'FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
@ -698,7 +677,7 @@ class ImportXlsx extends ModeleImports
|
||||
}
|
||||
}
|
||||
// If test is just a static regex
|
||||
elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) {
|
||||
elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) {
|
||||
//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
|
||||
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]);
|
||||
$this->errors[$error]['type'] = 'REGEX';
|
||||
@ -717,37 +696,32 @@ class ImportXlsx extends ModeleImports
|
||||
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
|
||||
if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null");
|
||||
elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) $listvalues[] = "''";
|
||||
else $listvalues[] = "'".$this->db->escape($newval)."'";
|
||||
else $listvalues[] = "'" . $this->db->escape($newval) . "'";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
// We add hidden fields (but only if there is at least one field to add into table)
|
||||
if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0]))
|
||||
{
|
||||
if (!empty($listfields) && is_array($objimport->array_import_fieldshidden[0])) {
|
||||
// Loop on each hidden fields to add them into listfields/listvalues
|
||||
foreach ($objimport->array_import_fieldshidden[0] as $key => $val)
|
||||
{
|
||||
if (!preg_match('/^'.preg_quote($alias, '/').'\./', $key)) continue; // Not a field of current table
|
||||
if ($val == 'user->id')
|
||||
{
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
foreach ($objimport->array_import_fieldshidden[0] as $key => $val) {
|
||||
if (!preg_match('/^' . preg_quote($alias, '/') . '\./', $key)) continue; // Not a field of current table
|
||||
if ($val == 'user->id') {
|
||||
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
|
||||
$listvalues[] = $user->id;
|
||||
} elseif (preg_match('/^lastrowid-/', $val))
|
||||
{
|
||||
} elseif (preg_match('/^lastrowid-/', $val)) {
|
||||
$tmp = explode('-', $val);
|
||||
$lastinsertid = (isset($last_insert_id_array[$tmp[1]])) ? $last_insert_id_array[$tmp[1]] : 0;
|
||||
$keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$keyfield = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
|
||||
$listfields[] = $keyfield;
|
||||
$listvalues[] = $lastinsertid;
|
||||
//print $key."-".$val."-".$listfields."-".$listvalues."<br>";exit;
|
||||
} elseif (preg_match('/^const-/', $val))
|
||||
{
|
||||
} elseif (preg_match('/^const-/', $val)) {
|
||||
$tmp = explode('-', $val, 2);
|
||||
$listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key);
|
||||
$listvalues[] = "'".$tmp[1]."'";
|
||||
$listfields[] = preg_replace('/^' . preg_quote($alias, '/') . '\./', '', $key);
|
||||
$listvalues[] = "'" . $tmp[1] . "'";
|
||||
} else {
|
||||
$this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden';
|
||||
$this->errors[$error]['lib'] = 'Bad value of profile setup ' . $val . ' for array_import_fieldshidden';
|
||||
$this->errors[$error]['type'] = 'Import profile setup';
|
||||
$error++;
|
||||
}
|
||||
@ -757,18 +731,16 @@ class ImportXlsx extends ModeleImports
|
||||
|
||||
// If no error for this $alias/$tablename, we have a complete $listfields and $listvalues that are defined
|
||||
// so we can try to make the insert or update now.
|
||||
if (!$errorforthistable)
|
||||
{
|
||||
if (!$errorforthistable) {
|
||||
//print "$alias/$tablename/$listfields/$listvalues<br>";
|
||||
if (!empty($listfields))
|
||||
{
|
||||
if (!empty($listfields)) {
|
||||
$updatedone = false;
|
||||
$insertdone = false;
|
||||
if (!empty($updatekeys)) {
|
||||
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||
|
||||
if (empty($lastinsertid)) { // No insert done yet for a parent table
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
$sqlSelect = 'SELECT rowid FROM ' . $tablename;
|
||||
|
||||
$data = array_combine($listfields, $listvalues);
|
||||
$where = array();
|
||||
@ -776,10 +748,10 @@ class ImportXlsx extends ModeleImports
|
||||
foreach ($updatekeys as $key) {
|
||||
$col = $objimport->array_import_updatekeys[0][$key];
|
||||
$key = preg_replace('/^.*\./i', '', $key);
|
||||
$where[] = $key.' = '.$data[$key];
|
||||
$filters[] = $col.' = '.$data[$key];
|
||||
$where[] = $key . ' = ' . $data[$key];
|
||||
$filters[] = $col . ' = ' . $data[$key];
|
||||
}
|
||||
$sqlSelect .= ' WHERE '.implode(' AND ', $where);
|
||||
$sqlSelect .= ' WHERE ' . implode(' AND ', $where);
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
if ($resql) {
|
||||
@ -806,10 +778,10 @@ class ImportXlsx extends ModeleImports
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to know if record exists or not for the rowid.
|
||||
// Note: For extrafield tablename, we have in importfieldshidden_array an enty 'extra.fk_object'=>'lastrowid-tableparent' so $keyfield is 'fk_object'
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
$sqlSelect = 'SELECT rowid FROM ' . $tablename;
|
||||
|
||||
if (empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
$sqlSelect .= ' WHERE ' . $keyfield . ' = ' . $lastinsertid;
|
||||
|
||||
$resql = $this->db->query($sqlSelect);
|
||||
if ($resql) {
|
||||
@ -831,19 +803,19 @@ class ImportXlsx extends ModeleImports
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
// Build SQL UPDATE request
|
||||
$sqlstart = 'UPDATE '.$tablename;
|
||||
$sqlstart = 'UPDATE ' . $tablename;
|
||||
|
||||
$data = array_combine($listfields, $listvalues);
|
||||
$set = array();
|
||||
foreach ($data as $key => $val) {
|
||||
$set[] = $key.' = '.$val;
|
||||
$set[] = $key . ' = ' . $val;
|
||||
}
|
||||
$sqlstart .= ' SET '.implode(', ', $set);
|
||||
$sqlstart .= ' SET ' . implode(', ', $set);
|
||||
|
||||
if (empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlend = ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
$sqlend = ' WHERE ' . $keyfield . ' = ' . $lastinsertid;
|
||||
|
||||
$sql = $sqlstart.$sqlend;
|
||||
$sql = $sqlstart . $sqlend;
|
||||
|
||||
// Run update request
|
||||
$resql = $this->db->query($sql);
|
||||
@ -862,25 +834,23 @@ class ImportXlsx extends ModeleImports
|
||||
// Update not done, we do insert
|
||||
if (!$error && !$updatedone) {
|
||||
// Build SQL INSERT request
|
||||
$sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key';
|
||||
$sqlend = ') VALUES('.implode(', ', $listvalues).", '".$this->db->escape($importid)."'";
|
||||
$sqlstart = 'INSERT INTO ' . $tablename . '(' . implode(', ', $listfields) . ', import_key';
|
||||
$sqlend = ') VALUES(' . implode(', ', $listvalues) . ", '" . $this->db->escape($importid) . "'";
|
||||
if (!empty($tablewithentity_cache[$tablename])) {
|
||||
$sqlstart .= ', entity';
|
||||
$sqlend .= ', '.$conf->entity;
|
||||
$sqlend .= ', ' . $conf->entity;
|
||||
}
|
||||
if (!empty($objimport->array_import_tables_creator[0][$alias])) {
|
||||
$sqlstart .= ', '.$objimport->array_import_tables_creator[0][$alias];
|
||||
$sqlend .= ', '.$user->id;
|
||||
$sqlstart .= ', ' . $objimport->array_import_tables_creator[0][$alias];
|
||||
$sqlend .= ', ' . $user->id;
|
||||
}
|
||||
$sql = $sqlstart.$sqlend.')';
|
||||
$sql = $sqlstart . $sqlend . ')';
|
||||
dol_syslog("import_xlsx.modules", LOG_DEBUG);
|
||||
|
||||
// Run insert request
|
||||
if ($sql)
|
||||
{
|
||||
if ($sql) {
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr).
|
||||
$insertdone = true;
|
||||
} else {
|
||||
|
||||
@ -69,7 +69,9 @@ class modBookmark extends DolibarrModules
|
||||
$this->const = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array(0=>array('file'=>'box_bookmarks.php', 'enabledbydefaulton'=>'Home'));
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_bookmarks.php', 'enabledbydefaulton'=>'Home')
|
||||
);
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
|
||||
@ -374,7 +374,7 @@ class modCategorie extends DolibarrModules
|
||||
'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description",
|
||||
'ca.fk_parent' => 'Parent'
|
||||
);
|
||||
$this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]');
|
||||
$this->import_regex_array[$r] = array('ca.type'=>'^\d+$');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'ca.fk_parent' => array(
|
||||
'rule' => 'fetchidfromcodeandlabel',
|
||||
@ -386,10 +386,10 @@ class modCategorie extends DolibarrModules
|
||||
)
|
||||
);
|
||||
$typeexample = "";
|
||||
if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; }
|
||||
if (!empty($conf->product->enabled)) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; }
|
||||
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; }
|
||||
if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; }
|
||||
if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; }
|
||||
if (!empty($conf->societe->enabled)) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; }
|
||||
if (!empty($conf->adherent->enabled)) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; }
|
||||
$this->import_examplevalues_array[$r] = array(
|
||||
'ca.label'=>"Supplier Category", 'ca.type'=>$typeexample, 'ca.description'=>"My Category description",
|
||||
'ca.fk_parent' => '0'
|
||||
|
||||
@ -291,7 +291,7 @@ class modExpedition extends DolibarrModules
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'expedition as c';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expedition_extrafields as extra ON c.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'societe as s';
|
||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'expeditiondet as ed';
|
||||
@ -306,7 +306,7 @@ class modExpedition extends DolibarrModules
|
||||
}
|
||||
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_expedition AND ed.fk_origin_line = cd.rowid';
|
||||
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('expedition').')';
|
||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -138,14 +138,12 @@ class modProjet extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
$r = 0;
|
||||
$this->boxes[$r][1] = "box_project.php";
|
||||
$r++;
|
||||
$this->boxes[$r][1] = "box_task.php";
|
||||
$r++;
|
||||
$this->boxes[$r][1] = "box_validated_projects.php";
|
||||
$r++;
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_project.php', 'enabledbydefaulton'=>'Home'),
|
||||
1=>array('file'=>'box_task.php', 'enabledbydefaulton'=>'Home'),
|
||||
2=>array('file'=>'box_validated_projects.php', 'enabledbydefaulton'=>'Home'),
|
||||
3=>array('file'=>'box_funnel_of_prospection.php', 'enabledbydefaulton'=>'Home'),
|
||||
);
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
|
||||
@ -241,7 +241,7 @@ class modPropale extends DolibarrModules
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s ';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra4 ON s.rowid = extra4.fk_object';
|
||||
|
||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'propal as c';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pj ON c.fk_projet = pj.rowid';
|
||||
@ -254,7 +254,7 @@ class modPropale extends DolibarrModules
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object';
|
||||
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal';
|
||||
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')';
|
||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||
|
||||
// Imports
|
||||
//--------
|
||||
|
||||
@ -122,20 +122,14 @@ class modSociete extends DolibarrModules
|
||||
$r++;
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
$r = 0;
|
||||
$this->boxes[$r][1] = "box_clients.php";
|
||||
$r++;
|
||||
$this->boxes[$r][1] = "box_prospect.php";
|
||||
$r++;
|
||||
$this->boxes[$r][1] = "box_contacts.php";
|
||||
$r++;
|
||||
$this->boxes[$r][1] = "box_activity.php";
|
||||
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
||||
$r++;
|
||||
$this->boxes[$r][1] = "box_goodcustomers.php";
|
||||
$this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)';
|
||||
$r++;
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_clients.php', 'enabledbydefaulton'=>'Home'),
|
||||
1=>array('file'=>'box_prospect.php', 'enabledbydefaulton'=>'Home'),
|
||||
2=>array('file'=>'box_contacts.php', 'enabledbydefaulton'=>'Home'),
|
||||
3=>array('file'=>'box_activity.php', 'enabledbydefaulton'=>'Home', 'note'=>'(WarningUsingThisBoxSlowDown)'),
|
||||
4=>array('file'=>'box_goodcustomers.php', 'enabledbydefaulton'=>'Home', 'note'=>'(WarningUsingThisBoxSlowDown)'),
|
||||
);
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'societe';
|
||||
|
||||
@ -188,6 +188,35 @@ class modStock extends DolibarrModules
|
||||
//--------
|
||||
$r = 0;
|
||||
|
||||
// Export warehouses
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class.'_warehouses';
|
||||
$this->export_label[$r] = "Warehouses"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r] = "warehouse";
|
||||
$this->export_permission[$r] = array(array("stock", "lire"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'e.rowid'=>'IdWarehouse', 'e.ref'=>'LocationSummary', 'e.description'=>'DescWareHouse', 'e.lieu'=>'LieuWareHouse', 'e.address'=>'Address', 'e.zip'=>'Zip', 'e.town'=>'Town',
|
||||
'd.code_departement'=>'Departement', 'c.code'=>'CountryCode',
|
||||
'e.phone'=>'Phone', 'e.fax'=>'Fax', 'e.statut'=>'Status', 'pe.rowid'=>'ParentWarehouse', 'pe.ref'=>'LocationSummary'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'e.ref'=>'Text', 'e.description'=>'Text', 'e.lieu'=>'Text', 'e.address'=>'Text', 'e.zip'=>'Text', 'e.town'=>'Text',
|
||||
'd.code_departement'=>'List:c_departements:code_departement:code_departement:', 'c.code'=>'List:c_country:code:code:',
|
||||
'e.phone'=>'Text', 'e.fax'=>'Text', 'e.statut'=>'Text', 'pe.rowid'=>'List:entrepot:ref:rowid:stock', 'pe.ref'=>'Text'
|
||||
);
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon
|
||||
$this->export_aggregate_array[$r] = array();
|
||||
$keyforselect = 'warehouse'; $keyforelement = 'warehouse'; $keyforaliasextra = 'extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'entrepot as e';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON d.rowid = e.fk_departement';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON c.rowid = e.fk_pays';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as pe ON pe.rowid = e.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot_extrafields as extra ON extra.fk_object = e.rowid';
|
||||
$this->export_sql_end[$r] .= ' WHERE e.entity IN ('.getEntity('stock').')';
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r] = $this->rights_class;
|
||||
$this->export_label[$r] = "WarehousesAndProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
|
||||
@ -139,15 +139,10 @@ class modTicket extends DolibarrModules
|
||||
|
||||
// Boxes
|
||||
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
|
||||
$this->boxes = array(); // Boxes list
|
||||
$r = 0;
|
||||
// Example:
|
||||
|
||||
$this->boxes[$r][1] = "box_last_ticket";
|
||||
$r++;
|
||||
|
||||
$this->boxes[$r][1] = "box_last_modified_ticket";
|
||||
$r++;
|
||||
$this->boxes = array(
|
||||
0=>array('file'=>'box_last_ticket.php', 'enabledbydefaulton'=>'Home'),
|
||||
1=>array('file'=>'box_last_modified_ticket.php', 'enabledbydefaulton'=>'Home')
|
||||
); // Boxes list
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
|
||||
@ -28,8 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* \class ModeleThirdPartyDoc
|
||||
* \brief Parent class for third parties models of doc generators
|
||||
* Parent class for third parties models of doc generators
|
||||
*/
|
||||
abstract class ModeleThirdPartyDoc extends CommonDocGenerator
|
||||
{
|
||||
@ -62,8 +61,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
|
||||
}
|
||||
|
||||
/**
|
||||
* \class ModeleThirdPartyCode
|
||||
* \brief Parent class for third parties code generators
|
||||
* Parent class for third parties code generators
|
||||
*/
|
||||
abstract class ModeleThirdPartyCode
|
||||
{
|
||||
@ -72,6 +70,12 @@ abstract class ModeleThirdPartyCode
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var array Error code (or message) array
|
||||
*/
|
||||
public $errors;
|
||||
|
||||
|
||||
/** Renvoi la description par defaut du modele de numerotation
|
||||
*
|
||||
* @param Translate $langs Object langs
|
||||
|
||||
@ -717,20 +717,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
// Load translation files required by the page
|
||||
if (empty($object->actionmsg2)) {
|
||||
$langs->loadLangs(array("agenda", "other"));
|
||||
if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
|
||||
$object->actionmsg2 = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
if ($langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action."InDolibarr") { // specific translation key
|
||||
$object->actionmsg2 = $langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
|
||||
} else { // generic translation key
|
||||
$tmp = explode('_', $action);
|
||||
$object->actionmsg2 = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
$object->actionmsg2 = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
|
||||
}
|
||||
}
|
||||
if (empty($object->actionmsg)) {
|
||||
$langs->loadLangs(array("agenda", "other"));
|
||||
if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
|
||||
$object->actionmsg = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
if ($langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)) != $action."InDolibarr") { // specific translation key
|
||||
$object->actionmsg = $langs->transnoentities($action."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
|
||||
} else { // generic translation key
|
||||
$tmp = explode('_', $action);
|
||||
$object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", ($object->newref ? $object->newref : $object->ref));
|
||||
$object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref));
|
||||
}
|
||||
}
|
||||
|
||||
@ -787,8 +787,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
|
||||
}
|
||||
// Set societeforaction.
|
||||
if ($object->socid > 0) $societeforaction->fetch($object->socid);
|
||||
elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
|
||||
if (isset($object->socid) && $object->socid > 0) $societeforaction->fetch($object->socid);
|
||||
elseif (isset($object->fk_soc) && $object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
|
||||
|
||||
$projectid = isset($object->fk_project) ? $object->fk_project : 0;
|
||||
if ($object->element == 'project') $projectid = $object->id;
|
||||
|
||||
@ -132,8 +132,9 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
$langs->load('ticket');
|
||||
|
||||
// Send email to notification email
|
||||
$sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) {
|
||||
$sendto = empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? '' : $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
|
||||
if ($sendto) {
|
||||
// Init to avoid errors
|
||||
$filepath = array();
|
||||
@ -246,7 +247,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
||||
$message_customer .= '<p>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$url_public_ticket.'</a></p>';
|
||||
$message_customer .= '<p>'.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'</p>';
|
||||
|
||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||
$from = (empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM.' ').'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>';
|
||||
$replyto = $from;
|
||||
|
||||
$trackid = 'tic'.$object->id;
|
||||
|
||||
@ -48,7 +48,7 @@ class Delivery extends CommonObject
|
||||
public $element = "delivery";
|
||||
|
||||
/**
|
||||
* @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_delivery";
|
||||
|
||||
@ -58,7 +58,7 @@ class Delivery extends CommonObject
|
||||
public $table_element = "delivery";
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
public $table_element_line = "deliverydet";
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class Don extends CommonObject
|
||||
public $table_element = 'don';
|
||||
|
||||
/**
|
||||
* @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_donation';
|
||||
|
||||
|
||||
@ -52,13 +52,14 @@ class EmailCollector extends CommonObject
|
||||
* @var int Does emailcollector support extrafields ? 0=No, 1=Yes
|
||||
*/
|
||||
public $isextrafieldmanaged = 0;
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for emailcollector. Must be the part after the 'object_' into object_emailcollector.png
|
||||
*/
|
||||
public $picto = 'generic';
|
||||
|
||||
/**
|
||||
* @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_emailcollector';
|
||||
|
||||
@ -158,7 +159,9 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
public $date_creation;
|
||||
|
||||
|
||||
/**
|
||||
* @var int timestamp
|
||||
*/
|
||||
public $tms;
|
||||
|
||||
/**
|
||||
@ -171,6 +174,9 @@ class EmailCollector extends CommonObject
|
||||
*/
|
||||
public $fk_user_modif;
|
||||
|
||||
/**
|
||||
* @var string import key
|
||||
*/
|
||||
public $import_key;
|
||||
|
||||
|
||||
|
||||
@ -118,17 +118,17 @@ class EmailCollectorAction extends CommonObject
|
||||
// If this object has a subtable with lines
|
||||
|
||||
// /**
|
||||
// * @var int Name of subtable line
|
||||
// * @var string Name of subtable line
|
||||
// */
|
||||
//public $table_element_line = 'emailcollectoractiondet';
|
||||
|
||||
// /**
|
||||
// * @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_emailcollectoraction';
|
||||
|
||||
// /**
|
||||
// * @var int Name of subtable class that manage subtable lines
|
||||
// * @var string Name of subtable class that manage subtable lines
|
||||
// */
|
||||
//public $class_element_line = 'EmailcollectorActionline';
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class Expedition extends CommonObject
|
||||
public $element = "shipping";
|
||||
|
||||
/**
|
||||
* @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_expedition";
|
||||
|
||||
@ -65,7 +65,7 @@ class Expedition extends CommonObject
|
||||
public $table_element = "expedition";
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
public $table_element_line = "expeditiondet";
|
||||
|
||||
|
||||
@ -44,7 +44,14 @@ class ExpenseReport extends CommonObject
|
||||
*/
|
||||
public $table_element = 'expensereport';
|
||||
|
||||
/**
|
||||
* @var string table element line name
|
||||
*/
|
||||
public $table_element_line = 'expensereport_det';
|
||||
|
||||
/**
|
||||
* @var string Fieldname with ID of parent key if this field has a parent
|
||||
*/
|
||||
public $fk_element = 'fk_expensereport';
|
||||
|
||||
/**
|
||||
|
||||
@ -40,7 +40,7 @@ class ExpenseReportIk extends CoreObject
|
||||
public $table_element = 'expensereport_ik';
|
||||
|
||||
/**
|
||||
* @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_expense_ik';
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class ExpenseReportRule extends CoreObject
|
||||
public $table_element = 'expensereport_rules';
|
||||
|
||||
/**
|
||||
* @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_expense_rule';
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ class Export
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $error;
|
||||
|
||||
public $array_export_code = array(); // Tableau de "idmodule_numlot"
|
||||
public $array_export_module = array(); // Tableau de "nom de modules"
|
||||
public $array_export_label = array(); // Tableau de "libelle de lots"
|
||||
@ -139,11 +141,10 @@ class Export
|
||||
{
|
||||
$perm = $val;
|
||||
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
|
||||
if (!empty($perm[2]))
|
||||
{
|
||||
$bool = $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]};
|
||||
if (!empty($perm[2])) {
|
||||
$bool = isset($user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]}) ? $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]} : false;
|
||||
} else {
|
||||
$bool = $user->rights->{$perm[0]}->{$perm[1]};
|
||||
$bool = isset($user->rights->{$perm[0]}->{$perm[1]}) ? $user->rights->{$perm[0]}->{$perm[1]} : false;
|
||||
}
|
||||
if ($perm[0] == 'user' && $user->admin) $bool = true;
|
||||
if (!$bool) break;
|
||||
@ -185,14 +186,14 @@ class Export
|
||||
// Tableau des operations speciales sur champ
|
||||
$this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '');
|
||||
// Array of examples
|
||||
$this->array_export_examplevalues[$i] = $module->export_examplevalues_array[$r];
|
||||
$this->array_export_examplevalues[$i] = (!empty($module->export_examplevalues_array[$r]) ? $module->export_examplevalues_array[$r] : null);
|
||||
// Array of help tooltips
|
||||
$this->array_export_help[$i] = (!empty($module->export_help_array[$r]) ? $module->export_help_array[$r] : '');
|
||||
|
||||
// Requete sql du dataset
|
||||
$this->array_export_sql_start[$i] = $module->export_sql_start[$r];
|
||||
$this->array_export_sql_end[$i] = $module->export_sql_end[$r];
|
||||
$this->array_export_sql_order[$i] = $module->export_sql_order[$r];
|
||||
$this->array_export_sql_order[$i] = (!empty($module->export_sql_order[$r]) ? $module->export_sql_order[$r] : null);
|
||||
//$this->array_export_sql[$i]=$module->export_sql[$r];
|
||||
|
||||
dol_syslog(get_class($this)."::load_arrays loaded for module ".$modulename." with index ".$i.", dataset=".$module->export_code[$r].", nb of fields=".(!empty($module->export_fields_code[$r]) ?count($module->export_fields_code[$r]) : ''));
|
||||
@ -580,9 +581,12 @@ class Export
|
||||
if ($resql)
|
||||
{
|
||||
//$this->array_export_label[$indice]
|
||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
||||
if (!empty($conf->global->EXPORT_PREFIX_SPEC)) {
|
||||
$filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport;
|
||||
else $filename = "export_".$datatoexport;
|
||||
}
|
||||
else {
|
||||
$filename = "export_".$datatoexport;
|
||||
}
|
||||
$filename .= '.'.$objmodel->getDriverExtension();
|
||||
$dirname = $conf->export->dir_temp.'/'.$user->id;
|
||||
|
||||
@ -598,7 +602,7 @@ class Export
|
||||
$objmodel->write_header($outputlangs);
|
||||
|
||||
// Genere ligne de titre
|
||||
$objmodel->write_title($this->array_export_fields[$indice], $array_selected, $outputlangs, $this->array_export_TypeFields[$indice]);
|
||||
$objmodel->write_title($this->array_export_fields[$indice], $array_selected, $outputlangs, isset($this->array_export_TypeFields[$indice]) ? $this->array_export_TypeFields[$indice] : null);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
@ -651,18 +655,20 @@ class Export
|
||||
}
|
||||
$obj->$alias = $remaintopay;
|
||||
} else {
|
||||
// TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field
|
||||
// TODO FIXME
|
||||
// Export of compute field does not work. $obj contains $obj->alias_field and formula may contains $obj->field
|
||||
// Also the formula may contains objects of class that are not loaded.
|
||||
$computestring = $this->array_export_special[$indice][$key];
|
||||
$tmp = dol_eval($computestring, 1, 0);
|
||||
$obj->$alias = $tmp;
|
||||
//$tmp = dol_eval($computestring, 1, 0);
|
||||
//$obj->$alias = $tmp;
|
||||
|
||||
$this->error = "ERROPNOTSUPPORTED. Operation ".$this->array_export_special[$indice][$key]." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
||||
$this->error = "ERROPNOTSUPPORTED. Operation ".$computestring." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// end of special operation processing
|
||||
$objmodel->write_record($array_selected, $obj, $outputlangs, $this->array_export_TypeFields[$indice]);
|
||||
$objmodel->write_record($array_selected, $obj, $outputlangs, isset($this->array_export_TypeFields[$indice]) ? $this->array_export_TypeFields[$indice] : null);
|
||||
}
|
||||
|
||||
// Genere en-tete
|
||||
|
||||
@ -76,7 +76,7 @@ class Fichinter extends CommonObject
|
||||
public $table_element = 'fichinter';
|
||||
|
||||
/**
|
||||
* @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_fichinter';
|
||||
|
||||
@ -1435,7 +1435,7 @@ class FichinterLigne extends CommonObjectLine
|
||||
public $table_element = 'fichinterdet';
|
||||
|
||||
/**
|
||||
* @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_fichinter';
|
||||
|
||||
|
||||
@ -41,6 +41,10 @@ class FichinterRec extends Fichinter
|
||||
public $element = 'fichinterrec';
|
||||
public $table_element = 'fichinter_rec';
|
||||
public $table_element_line = 'fichinter_rec';
|
||||
|
||||
/**
|
||||
* @var string Fieldname with ID of parent key if this field has a parent
|
||||
*/
|
||||
public $fk_element = 'fk_fichinter';
|
||||
|
||||
/**
|
||||
|
||||
@ -53,12 +53,12 @@ class CommandeFournisseur extends CommonOrder
|
||||
public $table_element = 'commande_fournisseur';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
public $table_element_line = 'commande_fournisseurdet';
|
||||
|
||||
/**
|
||||
* @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_commande';
|
||||
|
||||
|
||||
@ -57,12 +57,12 @@ class FactureFournisseur extends CommonInvoice
|
||||
public $table_element = 'facture_fourn';
|
||||
|
||||
/**
|
||||
* @var int Name of subtable line
|
||||
* @var string Name of subtable line
|
||||
*/
|
||||
public $table_element_line = 'facture_fourn_det';
|
||||
|
||||
/**
|
||||
* @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_fourn';
|
||||
|
||||
@ -336,7 +336,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
/**
|
||||
* Create supplier invoice into database
|
||||
*
|
||||
* @param User $user object utilisateur qui cree
|
||||
* @param User $user user object that creates
|
||||
* @return int Id invoice created if OK, < 0 if KO
|
||||
*/
|
||||
public function create($user)
|
||||
@ -1251,8 +1251,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
* Tag invoice as a payed invoice
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet. Not implementd yet.
|
||||
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet.
|
||||
* @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet.
|
||||
* @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet.
|
||||
* @return int <0 si ko, >0 si ok
|
||||
*/
|
||||
public function set_paid($user, $close_code = '', $close_note = '')
|
||||
@ -1294,9 +1294,9 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
|
||||
* Fonction utilisee quand un paiement prelevement est refuse,
|
||||
* ou quand une facture annulee et reouverte.
|
||||
* Tag the invoice as not fully paid + trigger call BILL_UNPAYED
|
||||
* Function used when a direct debit payment is refused,
|
||||
* or when the invoice was canceled and reopened.
|
||||
*
|
||||
* @param User $user Object user that change status
|
||||
* @return int <0 si ok, >0 si ok
|
||||
@ -1579,25 +1579,25 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
|
||||
/**
|
||||
* Ajoute une ligne de facture (associe a aucun produit/service predefini)
|
||||
* Les parametres sont deja cense etre juste et avec valeurs finales a l'appel
|
||||
* de cette methode. Aussi, pour le taux tva, il doit deja avoir ete defini
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,idprod)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue).
|
||||
* Adds an invoice line (associated with no predefined product/service)
|
||||
* The parameters are already supposed to be correct and with final values when calling
|
||||
* this method. Also, for the VAT rate, it must already have been defined by the caller by
|
||||
* by the get_default_tva method(vendor_company, buying company, idprod) and the desc must
|
||||
* already have the right value (the caller has to manage the multilanguage).
|
||||
*
|
||||
* @param string $desc Description de la ligne
|
||||
* @param double $pu Prix unitaire (HT ou TTC selon price_base_type, > 0 even for credit note)
|
||||
* @param string $desc Description of the line
|
||||
* @param double $pu Unit price (HT or TTC according to price_base_type, > 0 even for credit note)
|
||||
* @param double $txtva Force Vat rate to use, -1 for auto.
|
||||
* @param double $txlocaltax1 LocalTax1 Rate
|
||||
* @param double $txlocaltax2 LocalTax2 Rate
|
||||
* @param double $qty Quantite
|
||||
* @param double $qty Quantity
|
||||
* @param int $fk_product Product/Service ID predefined
|
||||
* @param double $remise_percent Percentage discount of the line
|
||||
* @param integer $date_start Date de debut de validite du service
|
||||
* @param integer $date_end Date de fin de validite du service
|
||||
* @param string $ventil Code de ventilation comptable
|
||||
* @param int $info_bits Bits de type de lines
|
||||
* @param string $price_base_type HT ou TTC
|
||||
* @param integer $date_start Service start date
|
||||
* @param integer $date_end Service expiry date
|
||||
* @param string $ventil Accounting breakdown code
|
||||
* @param int $info_bits Line type bits
|
||||
* @param string $price_base_type HT or TTC
|
||||
* @param int $type Type of line (0=product, 1=service)
|
||||
* @param int $rang Position of line
|
||||
* @param int $notrigger Disable triggers
|
||||
@ -2046,9 +2046,9 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
|
||||
/**
|
||||
* Charge les informations d'ordre info dans l'objet facture
|
||||
* Loads the info order information into the invoice object
|
||||
*
|
||||
* @param int $id Id de la facture a charger
|
||||
* @param int $id Id of the invoice to load
|
||||
* @return void
|
||||
*/
|
||||
public function info($id)
|
||||
@ -2095,11 +2095,11 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi liste des factures remplacables
|
||||
* Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee
|
||||
* Return list of replaceable invoices
|
||||
* Status valid or abandoned for other reason + not paid + no payment + not already replaced
|
||||
*
|
||||
* @param int $socid Id societe
|
||||
* @return array|int Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
|
||||
* @param int $socid Thirdparty id
|
||||
* @return array|int Table of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1)
|
||||
* <0 if error
|
||||
*/
|
||||
public function list_replacable_supplier_invoices($socid = 0)
|
||||
@ -2144,12 +2144,12 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi liste des factures qualifiables pour correction par avoir
|
||||
* Les factures qui respectent les regles suivantes sont retournees:
|
||||
* (validee + paiement en cours) ou classee (payee completement ou payee partiellement) + pas deja remplacee + pas deja avoir
|
||||
* Return list of qualifying invoices for correction by credit note
|
||||
* Invoices that respect the following rules are returned:
|
||||
* (validated + payment in progress) or classified (paid in full or paid in part) + not already replaced + not already having
|
||||
*
|
||||
* @param int $socid Id societe
|
||||
* @return array|int Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
|
||||
* @param int $socid Thirdparty id
|
||||
* @return array|int Table of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
|
||||
* <0 if error
|
||||
*/
|
||||
public function list_qualified_avoir_supplier_invoices($socid = 0)
|
||||
|
||||
@ -61,11 +61,15 @@ class ProductFournisseur extends Product
|
||||
* @see $ref_supplier
|
||||
*/
|
||||
public $fourn_ref;
|
||||
|
||||
public $delivery_time_days;
|
||||
public $ref_supplier; // ref supplier (can be set by get_buyprice)
|
||||
public $desc_supplier;
|
||||
public $vatrate_supplier; // default vat rate for this supplier/qty/product (can be set by get_buyprice)
|
||||
|
||||
public $product_id;
|
||||
public $product_ref;
|
||||
|
||||
public $fourn_id; //supplier id
|
||||
public $fourn_qty; // quantity for price (can be set by get_buyprice)
|
||||
public $fourn_pu; // unit price for quantity (can be set by get_buyprice)
|
||||
@ -73,7 +77,9 @@ class ProductFournisseur extends Product
|
||||
public $fourn_price; // price for quantity
|
||||
public $fourn_remise_percent; // discount for quantity (percent)
|
||||
public $fourn_remise; // discount for quantity (amount)
|
||||
|
||||
public $product_fourn_id; // product-supplier id
|
||||
public $product_fourn_entity;
|
||||
|
||||
/**
|
||||
* @var int ID user_id - user who created/updated supplier price
|
||||
@ -516,10 +522,11 @@ class ProductFournisseur extends Product
|
||||
$sql .= " pfp.fk_soc, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,";
|
||||
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging,";
|
||||
$sql .= " p.ref as product_ref";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
|
||||
$sql .= " AND pfp.fk_product = p.rowid";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch_product_fournisseur_price", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -530,8 +537,11 @@ class ProductFournisseur extends Product
|
||||
{
|
||||
$this->product_fourn_price_id = $rowid;
|
||||
$this->id = $obj->fk_product;
|
||||
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->product_id = $obj->fk_product; // deprecated
|
||||
$this->product_id = $obj->fk_product;
|
||||
$this->product_ref = $obj->product_ref;
|
||||
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->fourn_ref = $obj->ref_fourn; // deprecated
|
||||
$this->ref_supplier = $obj->ref_fourn;
|
||||
@ -590,7 +600,7 @@ class ProductFournisseur extends Product
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->error = $this->db->error();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -612,15 +622,15 @@ class ProductFournisseur extends Product
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,";
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref,";
|
||||
$sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
|
||||
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type";
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")";
|
||||
$sql .= " AND pfp.fk_soc = s.rowid";
|
||||
$sql .= " AND pfp.fk_soc = s.rowid AND pfp.fk_product = p.rowid";
|
||||
$sql .= " AND s.status=1"; // only enabled company selected
|
||||
$sql .= " AND pfp.fk_product = ".$prodid;
|
||||
if (empty($sortfield)) $sql .= " ORDER BY s.nom, pfp.quantity, pfp.price";
|
||||
@ -638,11 +648,12 @@ class ProductFournisseur extends Product
|
||||
//define base attribute
|
||||
$prodfourn = new ProductFournisseur($this->db);
|
||||
|
||||
$prodfourn->product_ref = $record["product_ref"];
|
||||
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
|
||||
$prodfourn->product_fourn_id = $record["product_fourn_id"];
|
||||
$prodfourn->product_fourn_entity = $record["entity"];
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->ref_supplier = $record["ref_fourn"];
|
||||
$prodfourn->fourn_ref = $record["ref_fourn"];
|
||||
$prodfourn->desc_supplier = $record["desc_fourn"];
|
||||
$prodfourn->fourn_price = $record["price"];
|
||||
$prodfourn->fourn_qty = $record["quantity"];
|
||||
@ -958,11 +969,13 @@ class ProductFournisseur extends Product
|
||||
public function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0)
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql .= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec, u.lastname,";
|
||||
$sql .= " pfpl.price, pfpl.quantity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_log as pfpl";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " u.lastname,";
|
||||
$sql .= " pfpl.rowid, pfp.ref_fourn as supplier_ref, pfpl.datec,";
|
||||
$sql .= " pfpl.price, pfpl.quantity,";
|
||||
$sql .= " pfpl.fk_multicurrency, pfpl.multicurrency_code, pfpl.multicurrency_tx, pfpl.multicurrency_price, pfpl.multicurrency_unitprice";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_log as pfpl,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."product_fournisseur_price as pfp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE pfp.entity IN (".getEntity('productprice').")";
|
||||
$sql .= " AND pfpl.fk_user = u.rowid";
|
||||
$sql .= " AND pfp.rowid = pfpl.fk_product_fournisseur";
|
||||
@ -986,6 +999,11 @@ class ProductFournisseur extends Product
|
||||
$tmparray['lastname'] = $obj->lastname;
|
||||
$tmparray['price'] = $obj->price;
|
||||
$tmparray['quantity'] = $obj->quantity;
|
||||
$tmparray['fk_multicurrency'] = $obj->fk_multicurrency;
|
||||
$tmparray['multicurrency_code'] = $obj->multicurrency_code;
|
||||
$tmparray['multicurrency_tx'] = $obj->multicurrency_tx;
|
||||
$tmparray['multicurrency_price'] = $obj->multicurrency_price;
|
||||
$tmparray['multicurrency_unitprice'] = $obj->multicurrency_unitprice;
|
||||
|
||||
$retarray[] = $tmparray;
|
||||
}
|
||||
@ -1007,19 +1025,23 @@ class ProductFournisseur extends Product
|
||||
*/
|
||||
public function displayPriceProductFournisseurLog($productFournLogList = array())
|
||||
{
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$out = '';
|
||||
$langs->load("suppliers");
|
||||
if (count($productFournLogList) > 0) {
|
||||
$out .= '<table class="nobordernopadding" width="100%">';
|
||||
$out .= '<table class="noborder centpercent">';
|
||||
$out .= '<tr class="liste_titre"><td class="liste_titre">'.$langs->trans("Date").'</td>';
|
||||
$out .= '<td class="liste_titre right">'.$langs->trans("Price").'</td>';
|
||||
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
|
||||
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
|
||||
foreach ($productFournLogList as $productFournLog) {
|
||||
$out .= '<tr><td class="right">'.dol_print_date($productFournLog['datec'], 'dayhour', 'tzuser').'</td>';
|
||||
$out .= '<td class="right">'.price($productFournLog['price']).'</td>';
|
||||
$out .= '<td class="right">'.price($productFournLog['price'], 0, $langs, 1, -1, -1, $conf->currency);
|
||||
if ($productFournLog['multicurrency_code'] != $conf->currency) {
|
||||
$out .= ' ('.price($productFournLog['multicurrency_price'], 0, $langs, 1, -1, -1, $productFournLog['multicurrency_code']).')';
|
||||
}
|
||||
$out .= '</td>';
|
||||
//$out.= '<td class="right">'.$productFournLog['quantity'].'</td>';
|
||||
$out .= '<td>'.$productFournLog['lastname'].'</td></tr>';
|
||||
}
|
||||
@ -1050,7 +1072,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
$label = '<u>'.$langs->trans("SupplierRef").'</u>';
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Product').':</b> '.$this->ref;
|
||||
$label .= '<b>'.$langs->trans('Product').':</b> '.$this->product_ref;
|
||||
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.$this->ref_supplier;
|
||||
|
||||
$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here
|
||||
|
||||
@ -130,7 +130,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
'cf.ref'=>'Ref',
|
||||
'cf.ref_supplier'=>'RefSupplierOrder',
|
||||
'cf.ref_supplier'=>'RefOrderSupplier',
|
||||
'pd.description'=>'Description',
|
||||
's.nom'=>"ThirdParty",
|
||||
's.name_alias'=>"AliasNameShort",
|
||||
|
||||
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
// Get parameters
|
||||
@ -49,7 +49,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
$fuserid = (GETPOST('fuserid', 'int') ?GETPOST('fuserid', 'int') : $user->id);
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("holiday", "mails"));
|
||||
$langs->loadLangs(array("other", "holiday", "mails"));
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
@ -148,11 +148,11 @@ if (empty($reshook))
|
||||
$description = trim(GETPOST('description', 'restricthtml'));
|
||||
|
||||
// Check that leave is for a user inside the hierarchy or advanced permission for all is set
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->expensereport->writeall_advance))) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->write)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->writeall_advance))) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NotEnoughPermission"), null, 'errors');
|
||||
} else {
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance)) {
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)) {
|
||||
if (!in_array($fuserid, $childids)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("UserNotInHierachy"), null, 'errors');
|
||||
@ -403,7 +403,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
// Si brouillon et créateur
|
||||
// If draft and owner of leave
|
||||
if ($object->statut == Holiday::STATUS_DRAFT && $cancreate)
|
||||
{
|
||||
$object->oldcopy = dol_clone($object);
|
||||
@ -430,7 +430,8 @@ if (empty($reshook))
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user);
|
||||
$emailFrom = $expediteur->email;
|
||||
//$emailFrom = $expediteur->email; Email of user can be an email into another company. Sending will fails, we must use the generic email.
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
@ -441,6 +442,7 @@ if (empty($reshook))
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysToValidateBody")."\n";
|
||||
|
||||
$delayForRequest = $object->getConfCP('delayForRequest');
|
||||
@ -525,7 +527,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
|
||||
// Si statut en attente de validation et valideur = utilisateur
|
||||
// If status is waiting approval and approver is also user
|
||||
if ($object->statut == Holiday::STATUS_VALIDATED && $user->id == $object->fk_validator)
|
||||
{
|
||||
$object->oldcopy = dol_clone($object);
|
||||
@ -582,7 +584,8 @@ if (empty($reshook))
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_validator);
|
||||
$emailFrom = $expediteur->email;
|
||||
//$emailFrom = $expediteur->email; Email of user can be an email into another company. Sending will fails, we must use the generic email.
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
@ -593,6 +596,7 @@ if (empty($reshook))
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
|
||||
$message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
|
||||
@ -666,7 +670,8 @@ if (empty($reshook))
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_validator);
|
||||
$emailFrom = $expediteur->email;
|
||||
//$emailFrom = $expediteur->email; Email of user can be an email into another company. Sending will fails, we must use the generic email.
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
@ -677,6 +682,7 @@ if (empty($reshook))
|
||||
// Content
|
||||
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
|
||||
$message .= "\n";
|
||||
|
||||
$message .= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
|
||||
$message .= GETPOST('detail_refuse', 'alpha')."\n\n";
|
||||
|
||||
@ -813,7 +819,8 @@ if (empty($reshook))
|
||||
// From
|
||||
$expediteur = new User($db);
|
||||
$expediteur->fetch($object->fk_user_cancel);
|
||||
$emailFrom = $expediteur->email;
|
||||
//$emailFrom = $expediteur->email; Email of user can be an email into another company. Sending will fails, we must use the generic email.
|
||||
$emailFrom = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
|
||||
// Subject
|
||||
$societeName = $conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||
@ -962,8 +969,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />'."\n";
|
||||
print '<input type="hidden" name="action" value="add" />'."\n";
|
||||
|
||||
if (empty($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
{
|
||||
if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) {
|
||||
print dol_get_fiche_head('', '', '', -1);
|
||||
|
||||
$out = '';
|
||||
@ -973,15 +979,14 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
|
||||
$nb_type = $object->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_holiday += $nb_type;
|
||||
|
||||
$out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
|
||||
$out .= ' - '.($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']).': <strong>'.($nb_type ? price2num($nb_type) : 0).'</strong><br>';
|
||||
//$out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>';
|
||||
print $out;
|
||||
|
||||
print dol_get_fiche_end();
|
||||
} elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
{
|
||||
} elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE)) {
|
||||
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
|
||||
}
|
||||
|
||||
@ -999,10 +1004,10 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
|
||||
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance))
|
||||
{
|
||||
print $form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300');
|
||||
print img_picto('', 'user').$form->select_dolusers(($fuserid ? $fuserid : $user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500');
|
||||
//print '<input type="hidden" name="fuserid" value="'.($fuserid?$fuserid:$user->id).'">';
|
||||
} else {
|
||||
print $form->select_dolusers(GETPOST('fuserid', 'int') ? GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300');
|
||||
print img_picto('', 'user').$form->select_dolusers(GETPOST('fuserid', 'int') ? GETPOST('fuserid', 'int') : $user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'minwidth200 maxwidth500');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -1019,7 +1024,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
|
||||
$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')' : '');
|
||||
$arraytypeleaves[$val['rowid']] = $labeltoshow;
|
||||
}
|
||||
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : ''), 1);
|
||||
print $form->selectarray('type', $arraytypeleaves, (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : ''), 1, 0, 0, '', 0, 0, 0, '', '', true);
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -1048,7 +1053,6 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
|
||||
print $form->textwithpicto($langs->trans("DateFinCP"), $langs->trans("LastDayOfHoliday"));
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// Si la demande ne vient pas de l'agenda
|
||||
if (!GETPOST('date_fin_')) {
|
||||
print $form->selectDate(-1, 'date_fin_', 0, 0, 0, '', 1, 1);
|
||||
} else {
|
||||
@ -1067,13 +1071,14 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add')
|
||||
|
||||
$object = new Holiday($db);
|
||||
$include_users = $object->fetch_users_approver_holiday();
|
||||
if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
|
||||
else {
|
||||
if (empty($include_users)) {
|
||||
print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
|
||||
} else {
|
||||
$defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator); // Will work only if supervisor has permission to approve so is inside include_users
|
||||
if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) $defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver
|
||||
if (GETPOST('valideur', 'int') > 0) $defaultselectuser = GETPOST('valideur', 'int');
|
||||
$s = $form->select_dolusers($defaultselectuser, "valideur", 1, "", 0, $include_users);
|
||||
print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
||||
$s = $form->select_dolusers($defaultselectuser, "valideur", 1, '', 0, $include_users, '', '0,'.$conf->entity, 0, 0, '', 0, '', 'minwidth200 maxwidth500');
|
||||
print img_picto('', 'user').$form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate"));
|
||||
}
|
||||
|
||||
//print $form->select_dolusers((GETPOST('valideur','int')>0?GETPOST('valideur','int'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent
|
||||
|
||||
@ -50,7 +50,7 @@ class Holiday extends CommonObject
|
||||
public $ismultientitymanaged = 0;
|
||||
|
||||
/**
|
||||
* @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_holiday';
|
||||
|
||||
@ -1411,7 +1411,7 @@ class Holiday extends CommonObject
|
||||
|
||||
// Update each user counter
|
||||
foreach ($users as $userCounter) {
|
||||
$nbDaysToAdd = $typeleaves[$userCounter['type']]['newByMonth'];
|
||||
$nbDaysToAdd = (isset($typeleaves[$userCounter['type']]['newByMonth']) ? $typeleaves[$userCounter['type']]['newByMonth'] : 0);
|
||||
if (empty($nbDaysToAdd)) continue;
|
||||
|
||||
dol_syslog("We update leave type id ".$userCounter['type']." for user id ".$userCounter['rowid'], LOG_DEBUG);
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.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/holiday/common.inc.php
|
||||
* \ingroup holiday
|
||||
* \brief Common load of data
|
||||
*/
|
||||
|
||||
require_once realpath(__DIR__).'/../main.inc.php';
|
||||
if (!class_exists('Holiday')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('user', 'other', 'holiday'));
|
||||
|
||||
if (empty($conf->holiday->enabled))
|
||||
{
|
||||
llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
print '<div class="tabBar">';
|
||||
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
|
||||
print '</div>';
|
||||
llxFooter();
|
||||
exit();
|
||||
}
|
||||
@ -28,10 +28,10 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadlangs(array('users', 'hrm'));
|
||||
$langs->loadlangs(array('users', 'other', 'holiday', 'hrm'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'defineholidaylist';
|
||||
@ -56,7 +56,7 @@ if (!$sortorder) $sortorder = "ASC";
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
|
||||
// If the user does not have perm to read the page
|
||||
if (!$user->rights->holiday->read) accessforbidden();
|
||||
if (empty($user->rights->holiday->read)) accessforbidden();
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
@ -65,6 +65,17 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
|
||||
if (empty($conf->holiday->enabled))
|
||||
{
|
||||
llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
print '<div class="tabBar">';
|
||||
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
|
||||
print '</div>';
|
||||
llxFooter();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -32,12 +32,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('users', 'holiday', 'hrm'));
|
||||
$langs->loadLangs(array('users', 'other', 'holiday', 'hrm'));
|
||||
|
||||
// Protection if external user
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
@ -152,6 +152,15 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($conf->holiday->enabled))
|
||||
{
|
||||
llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
print '<div class="tabBar">';
|
||||
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
|
||||
print '</div>';
|
||||
llxFooter();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -179,8 +179,8 @@ print load_fiche_titre($langs->trans('MenuReportMonth'), '', 'title_hrm');
|
||||
|
||||
// Selection filter
|
||||
print '<div class="tabBar">';
|
||||
print $formother->select_month($search_month, 'remonth');
|
||||
print $formother->select_year($search_year, 'reyear');
|
||||
print $formother->select_month($search_month, 'remonth', 0, 0, 'minwidth50 maxwidth75imp valignmiddle', true);
|
||||
print $formother->selectyear($search_year, 'reyear', 0, 10, 5, 0, 0, '', 'valignmiddle width75', true);
|
||||
print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Search")).'" />';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
@ -34,7 +34,7 @@ if (empty($user->rights->holiday->define_holiday) || $user->socid > 0) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/common.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||
@ -72,7 +72,7 @@ if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$user->rights->holiday->readall) accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load('users');
|
||||
$langs->loadLangs(array('users', 'other', 'holiday'));
|
||||
|
||||
// Initialize technical objects
|
||||
$object = new Holiday($db);
|
||||
@ -83,6 +83,16 @@ $hookmanager->initHooks(array('leavemovementlist')); // Note that conf->hooks_mo
|
||||
$arrayfields = array();
|
||||
$arrayofmassactions = array();
|
||||
|
||||
if (empty($conf->holiday->enabled))
|
||||
{
|
||||
llxHeader('', $langs->trans('CPTitreMenu'));
|
||||
print '<div class="tabBar">';
|
||||
print '<span style="color: #FF0000;">'.$langs->trans('NotActiveModCP').'</span>';
|
||||
print '</div>';
|
||||
llxFooter();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -263,9 +273,9 @@ if (!empty($arrayfields['cpl.rowid']['checked'])) {
|
||||
|
||||
// Filter: Date
|
||||
if (!empty($arrayfields['cpl.date_action']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input class="flat valignmiddle maxwidth25" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
||||
print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'maxwidth200', true);
|
||||
print $formother->selectyear($search_year, 'search_year', 1, 10, 5, 0, 0, '', 'valignmiddle width75', true);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user