Merge branch 'develop' into patch-17
This commit is contained in:
commit
fa2ccf6c44
16
.github/CONTRIBUTING.md
vendored
16
.github/CONTRIBUTING.md
vendored
@ -101,28 +101,30 @@ Long description (Can span accross multiple lines).
|
||||
</pre>
|
||||
|
||||
### Pull Requests
|
||||
When submitting a pull request, use same rule as [Commits](#commits) for the message.
|
||||
Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
|
||||
a process to follow to optimize the chance to have PRs merged efficiently...
|
||||
|
||||
If your pull request only contains one commit, GitHub will be smart enough to fill it for you.
|
||||
When submitting a pull request, use same rule as [Commits](#commits) for the message.
|
||||
If your pull request only contains 1 commit, GitHub will be smart enough to fill it for you.
|
||||
Otherwise, please be a bit verbose about what you're providing.
|
||||
|
||||
Your Pull Request (PR) must pass the Continuous Integration checks.
|
||||
Your Pull Request (PR) must pass the Continuous Integration checks and code quality checks.
|
||||
Also, some code changes need a prior approbation:
|
||||
|
||||
* if you want to include a new external library (into htdocs/includes directory), please ask before to the project manager (@eldy) to see if such a library can be accepted.
|
||||
|
||||
* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
|
||||
* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@eldy) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest.
|
||||
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case).
|
||||
|
||||
If the label of PR start with "WIP" (Work In Progress), it will not be analyzed (until you change the label of PR).
|
||||
|
||||
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
|
||||
|
||||
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
|
||||
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting an action of the developer/author.
|
||||
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag ask you. The majority of open PR are waiting an action of the author of the PR.
|
||||
|
||||
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. This is one of the most important ratio of answered PR in Open Source world. Don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
|
||||
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. Average answer delay is also one of the best among Open source project (just few days before having the Answer Tag set). This is one of the most important ratio of answered PR in Open Source world for a major project. Don't expect the core team to reach the 100%. A so high ratio is very rare on a so popular project and with the increasing popularity of Dolibarr, this ratio will probably decrease in future to a more common level.
|
||||
|
||||
|
||||
### Resources
|
||||
|
||||
24
.github/workflows/stale-issues-safe.yml
vendored
Normal file
24
.github/workflows/stale-issues-safe.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
name: "Close stale issues (bugs and feature requests)"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 21 * * *"
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: Dolibarr/stale@staleunstale
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
|
||||
stale-label: 'Issue Stale (automatic label)'
|
||||
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE)'
|
||||
days-before-stale: 365
|
||||
days-before-close: 15
|
||||
operations-per-run: 100
|
||||
dry-run: false
|
||||
|
||||
@ -12,12 +12,12 @@ jobs:
|
||||
- uses: Dolibarr/stale@master
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
|
||||
stale-issue-label: 'Issue Stale (automatic label)'
|
||||
exempt-issue-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: 15
|
||||
operations-per-run: 50
|
||||
days-before-close: -1
|
||||
operations-per-run: 100
|
||||
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-pr-label: 'PR Stale (automatic label)'
|
||||
stale-pr-message:
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -40,3 +40,4 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/symfony/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
|
||||
@ -17,7 +17,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
|
||||
Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers
|
||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
@ -32,15 +32,16 @@ PSR/simple-cache ? Library for cache (used by PHPSp
|
||||
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 3.2.2 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
Stripe 6.41 MIT licence Yes Library for Stripe module
|
||||
Stripe 6.43.1 MIT licence Yes Library for Stripe module
|
||||
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
Chart 2.9.3 MIT License Yes JS library for graph
|
||||
jQuery 3.4.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
|
||||
jQuery Flot 0.8.3 MIT License Yes JS library to build graph
|
||||
|
||||
72
ChangeLog
72
ChangeLog
@ -8,7 +8,10 @@ For Users:
|
||||
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||
|
||||
For Developers or integrators:
|
||||
|
||||
* A new way to navigate between pages in list is available. To use it, you must
|
||||
- replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
|
||||
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste
|
||||
|
||||
|
||||
WARNING:
|
||||
@ -20,8 +23,73 @@ Following changes may create regressions for some external modules, but were nec
|
||||
the HTML into content (in such a case, sanitize data later)
|
||||
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
|
||||
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
|
||||
by a "_" automatically when a reference is generated.
|
||||
by a "_" automatically when a reference (with a custom numbering mask that use it) is generated.
|
||||
|
||||
|
||||
***** ChangeLog for 11.0.2 compared to 11.0.1 *****
|
||||
FIX: #10309
|
||||
FIX: #13110
|
||||
FIX: #13118
|
||||
FIX: #13124
|
||||
FIX: #13131
|
||||
FIX: #13135
|
||||
FIX: #13146 #13198
|
||||
FIX: #13175
|
||||
FIX: #13182
|
||||
FIX: #13183
|
||||
FIX: #13184
|
||||
FIX: #13263
|
||||
FIX: #13267
|
||||
FIX: an external user can not approve
|
||||
FIX: API Get list of documents for supplier_invoice
|
||||
FIX: API to push an expense report
|
||||
FIX: API upload/download doc for expensereport
|
||||
FIX: Avoid to download the export if we just press enter to refresh form
|
||||
FIX: Bad link to template invoices
|
||||
FIX: Bad sort link in accounting report
|
||||
FIX: Bad translation for productlot EatBy and SellBy
|
||||
FIX: better method to check user rights AND usergroup rights !
|
||||
FIX: CA by product list filter
|
||||
FIX: CSS
|
||||
FIX: Disable js if no javascript
|
||||
FIX: duplicate class name into some log lines
|
||||
FIX: etrafield with visibilty=5 were not in read only.
|
||||
FIX: excess paid from situation invoices not counted when calculating remain to pay.
|
||||
FIX: Force FEC export to txt format.
|
||||
FIX: Free input for email no more visible.
|
||||
FIX: Keep assigned users in session when loading projects and tasks
|
||||
FIX: List of viewed projects too large in task widget.
|
||||
FIX: Menu truncated. Add tooltip to have all content.
|
||||
FIX: Missing field "billed" in export.
|
||||
FIX: missing "statut" for getNomUrl() function
|
||||
FIX: modFournisseur is required by modSupplierProposal
|
||||
FIX: Multicompany compatibility
|
||||
FIX: must be == and not =
|
||||
FIX: option for topbar search and bookmarks
|
||||
FIX: option MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
FIX: some responsive troubles
|
||||
FIX: round MT in accountancy books
|
||||
FIX: search with '0'
|
||||
FIX: sort link
|
||||
FIX: SQL Overload in default contact trigger.
|
||||
FIX: SQl syntax error.
|
||||
FIX: Submit of documents for supplier invoices.
|
||||
FIX: timezone must be tzserver and not tzuser as on contract card
|
||||
FIX: token in barcode tools page missing
|
||||
FIX: Bad name of trigger PROPAL_SUPPLIER_TRIGGER, should be PROPOSAL_SUPPLIER_TRIGGER
|
||||
FIX: Type of contact for event does not exists and not supported
|
||||
FIX: Type of contact not saved when creating a contact
|
||||
FIX: typo on ckeck method
|
||||
FIX: undefined function measuringUnitString in product list
|
||||
FIX: Usage of project not available in export.
|
||||
FIX: wrong test
|
||||
FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
|
||||
FIX: Use GETPOST instead of POST
|
||||
FIX: HTML Injection
|
||||
FIX: Visualization rights correction on last modified contacts box.
|
||||
FIX: Vulnerability in module from modulebuilder.
|
||||
FIX: Vulnerability reported by code16
|
||||
|
||||
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
|
||||
FIX: advanced target emailing sql and ergonomy.
|
||||
FIX: After import of a website template, home page was not set.
|
||||
|
||||
@ -28,11 +28,12 @@
|
||||
"ext-curl" : "*",
|
||||
"ckeditor/ckeditor" : "4.12.1",
|
||||
"mike42/escpos-php" : "2.2",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.33",
|
||||
"mobiledetect/mobiledetectlib" : "2.8.34",
|
||||
"phpoffice/phpexcel" : "1.8.1",
|
||||
"restler/framework" : "3.0.0-RC6",
|
||||
"tecnickcom/tcpdf" : "^6.2",
|
||||
"luracast/restler" : "^3.0"
|
||||
"tecnickcom/tcpdf" : "6.3.2",
|
||||
"nnnick/chartjs" : "^2.9",
|
||||
"stripe/stripe-php" : "6.43.1"
|
||||
},
|
||||
"require-dev" : {
|
||||
"jakub-onderka/php-parallel-lint" : "^0",
|
||||
@ -56,4 +57,4 @@
|
||||
"ext-zip" : "ODT, Excel and file compression support",
|
||||
"ext-xml" : "Excel support"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
152
composer.lock
generated
152
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "16c94fd4f22ac17820d85ee57b0616e1",
|
||||
"content-hash": "17e906996157e8a94564f686a6096dc5",
|
||||
"packages": [
|
||||
{
|
||||
"name": "ckeditor/ckeditor",
|
||||
@ -49,24 +49,31 @@
|
||||
},
|
||||
{
|
||||
"name": "mike42/escpos-php",
|
||||
"version": "v1.2.1",
|
||||
"version": "v2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mike42/escpos-php.git",
|
||||
"reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee"
|
||||
"reference": "e5496cf819b048b11877117bd14a9cea4fb17c03"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/cfea4c4fc95516ac953e1e5b623f854632afa2ee",
|
||||
"reference": "cfea4c4fc95516ac953e1e5b623f854632afa2ee",
|
||||
"url": "https://api.github.com/repos/mike42/escpos-php/zipball/e5496cf819b048b11877117bd14a9cea4fb17c03",
|
||||
"reference": "e5496cf819b048b11877117bd14a9cea4fb17c03",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "4.5.*",
|
||||
"squizlabs/php_codesniffer": "2.*"
|
||||
"guzzlehttp/guzzle": "^5.3",
|
||||
"phpunit/phpunit": "^4.8",
|
||||
"squizlabs/php_codesniffer": "^3.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "Used for image printing if present.",
|
||||
"ext-imagick": "Will be used for image printing if present. Required for PDF printing or use of custom fonts.",
|
||||
"guzzlehttp/guzzle": "Allows the use of the ApiConnector to send print jobs over HTTP."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@ -79,28 +86,12 @@
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Roni Saha",
|
||||
"email": "roni.cse@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Michael Billington",
|
||||
"email": "michael.billington@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gergely Radics",
|
||||
"email": "gerifield@ustream.tv"
|
||||
},
|
||||
{
|
||||
"name": "Warren Doyle",
|
||||
"email": "w.doyle@fuelled.co"
|
||||
},
|
||||
{
|
||||
"name": "vharo",
|
||||
"email": "vharo@geepok.com"
|
||||
}
|
||||
],
|
||||
"description": "Thermal receipt printer library, for use with ESC/POS compatible printers",
|
||||
"description": "PHP receipt printer library for use with ESC/POS-compatible thermal and impact printers",
|
||||
"homepage": "https://github.com/mike42/escpos-php",
|
||||
"keywords": [
|
||||
"ESC-POS",
|
||||
@ -109,20 +100,20 @@
|
||||
"print",
|
||||
"receipt"
|
||||
],
|
||||
"time": "2016-04-25T01:14:07+00:00"
|
||||
"time": "2019-10-05T05:59:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mobiledetect/mobiledetectlib",
|
||||
"version": "2.8.33",
|
||||
"version": "2.8.34",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/serbanghita/Mobile-Detect.git",
|
||||
"reference": "cd385290f9a0d609d2eddd165a1e44ec1bf12102"
|
||||
"reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/cd385290f9a0d609d2eddd165a1e44ec1bf12102",
|
||||
"reference": "cd385290f9a0d609d2eddd165a1e44ec1bf12102",
|
||||
"url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/6f8113f57a508494ca36acbcfa2dc2d923c7ed5b",
|
||||
"reference": "6f8113f57a508494ca36acbcfa2dc2d923c7ed5b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -161,7 +152,48 @@
|
||||
"mobile detector",
|
||||
"php mobile detect"
|
||||
],
|
||||
"time": "2018-09-01T15:05:15+00:00"
|
||||
"time": "2019-09-18T18:44:20+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nnnick/chartjs",
|
||||
"version": "v2.9.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chartjs/Chart.js.git",
|
||||
"reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chartjs/Chart.js/zipball/06f73dc3590084b2c464bf08189c7aee2b6b92d2",
|
||||
"reference": "06f73dc3590084b2c464bf08189c7aee2b6b92d2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"release/2.0": "v2.0-dev"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "NICK DOWNIE",
|
||||
"email": "hello@nickdownie.com"
|
||||
}
|
||||
],
|
||||
"description": "Simple HTML5 charts using the canvas element.",
|
||||
"homepage": "https://www.chartjs.org/",
|
||||
"keywords": [
|
||||
"JS",
|
||||
"chart"
|
||||
],
|
||||
"time": "2019-11-14T18:37:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoffice/phpexcel",
|
||||
@ -282,6 +314,62 @@
|
||||
],
|
||||
"time": "2019-05-12T15:15:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "stripe/stripe-php",
|
||||
"version": "v6.43.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/stripe/stripe-php.git",
|
||||
"reference": "42fcdaf99c44bb26937223f8eae1f263491d5ab8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/42fcdaf99c44bb26937223f8eae1f263491d5ab8",
|
||||
"reference": "42fcdaf99c44bb26937223f8eae1f263491d5ab8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "1.*",
|
||||
"phpunit/phpunit": "~4.0",
|
||||
"squizlabs/php_codesniffer": "~2.0",
|
||||
"symfony/process": "~2.8"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Stripe\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Stripe and contributors",
|
||||
"homepage": "https://github.com/stripe/stripe-php/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Stripe PHP Library",
|
||||
"homepage": "https://stripe.com/",
|
||||
"keywords": [
|
||||
"api",
|
||||
"payment processing",
|
||||
"stripe"
|
||||
],
|
||||
"time": "2019-08-29T16:56:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tcpdf",
|
||||
"version": "6.3.2",
|
||||
@ -1815,7 +1903,7 @@
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
"php": ">=5.3.0",
|
||||
"php": ">=5.5.0",
|
||||
"ext-curl": "*"
|
||||
},
|
||||
"platform-dev": []
|
||||
|
||||
@ -56,7 +56,7 @@ if (!$user->rights->accounting->chartofaccount) accessforbidden();
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -70,9 +70,12 @@ $arrayfields = array(
|
||||
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
|
||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
|
||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
'aa.reconciliable'=>array('label'=>$langs->trans("Reconciliable"), 'checked'=>1),
|
||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['aa.reconciliable']);
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
|
||||
@ -157,7 +160,8 @@ if (empty($reshook))
|
||||
|
||||
if ($action == 'disable') {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_desactivate($id);
|
||||
$mode = GETPOST('mode', 'int');
|
||||
$result = $accounting->account_desactivate($id, $mode);
|
||||
}
|
||||
|
||||
$action = 'update';
|
||||
@ -166,7 +170,8 @@ if (empty($reshook))
|
||||
}
|
||||
} elseif ($action == 'enable') {
|
||||
if ($accounting->fetch($id)) {
|
||||
$result = $accounting->account_activate($id);
|
||||
$mode = GETPOST('mode', 'int');
|
||||
$result = $accounting->account_activate($id, $mode);
|
||||
}
|
||||
$action = 'update';
|
||||
if ($result < 0) {
|
||||
@ -192,7 +197,7 @@ if ($action == 'delete') {
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, ";
|
||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.reconciliable, aa.active, ";
|
||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
|
||||
@ -352,6 +357,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print '<td class="liste_titre"> </td>'; }
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
@ -365,6 +371,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print_liste_field_titre($arrayfields['aa.reconciliable']['label'], $_SERVER["PHP_SELF"], 'aa.reconciliable', '', $param, '', $sortfield, $sortorder); }
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
@ -441,16 +448,36 @@ if ($resql)
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
// Activated or not reconciliation on accounting account
|
||||
if (!empty($arrayfields['aa.reconciliable']['checked'])) {
|
||||
print '<td class="center">';
|
||||
if (empty($obj->reconciliable)) {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=enable&mode=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=disable&mode=1">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Activated or not
|
||||
if (!empty($arrayfields['aa.active']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="center">';
|
||||
if (empty($obj->active)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=0">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
} else {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ $active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -56,7 +56,7 @@ $active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
@ -46,27 +46,35 @@ if (empty($user->rights->accounting->chartofaccount))
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
$list_account_main = array (
|
||||
$list_account_main = array(
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
);
|
||||
|
||||
$list_account = array ();
|
||||
$list_account = array();
|
||||
$list_account[] = '---Product---';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
|
||||
$list_account[] = '---Service---';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
|
||||
if ($mysoc->isInEEC()) {
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
|
||||
}
|
||||
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
|
||||
$list_account[] = '---Other---';
|
||||
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
|
||||
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
|
||||
@ -112,25 +120,25 @@ if ($action == 'update') {
|
||||
foreach ($list_account_main as $constname) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($list_account as $constname) {
|
||||
$reg=array();
|
||||
$reg = array();
|
||||
if (preg_match('/---(.*)---/', $constname, $reg)) { // This is a separator
|
||||
continue;
|
||||
}
|
||||
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
@ -182,7 +190,7 @@ foreach ($list_account_main as $key) {
|
||||
|
||||
|
||||
foreach ($list_account as $key) {
|
||||
$reg=array();
|
||||
$reg = array();
|
||||
if (preg_match('/---(.*)---/', $key, $reg)) {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans($reg[1]).'</td><td></td></tr>';
|
||||
}
|
||||
@ -190,9 +198,9 @@ foreach ($list_account as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
print '<td width="50%">'.$label.'</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -31,7 +31,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -57,7 +57,7 @@ $active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
@ -59,7 +59,7 @@ $search_label = GETPOST('search_label', 'alpha');
|
||||
$search_desc = GETPOST('search_desc', 'alpha');
|
||||
$search_current_account = GETPOST('search_current_account', 'alpha');
|
||||
$search_current_account_valid = GETPOST('search_current_account_valid', 'alpha');
|
||||
if ($search_current_account_valid == '') $search_current_account_valid='withoutvalidaccount';
|
||||
if ($search_current_account_valid == '') $search_current_account_valid = 'withoutvalidaccount';
|
||||
$search_onsell = GETPOST('search_onsell', 'alpha');
|
||||
$search_onpurchase = GETPOST('search_onpurchase', 'alpha');
|
||||
|
||||
@ -67,12 +67,12 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
|
||||
$btn_changetype = GETPOST('changetype', 'alpha');
|
||||
|
||||
if (empty($accounting_product_mode)) $accounting_product_mode='ACCOUNTANCY_SELL';
|
||||
if (empty($accounting_product_mode)) $accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -117,7 +117,9 @@ if ($action == 'update') {
|
||||
'ACCOUNTANCY_SELL',
|
||||
'ACCOUNTANCY_SELL_INTRA',
|
||||
'ACCOUNTANCY_SELL_EXPORT',
|
||||
'ACCOUNTANCY_BUY'
|
||||
'ACCOUNTANCY_BUY',
|
||||
'ACCOUNTANCY_BUY_INTRA',
|
||||
'ACCOUNTANCY_BUY_EXPORT'
|
||||
);
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
@ -159,6 +161,12 @@ if ($action == 'update') {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql .= " SET accountancy_code_buy = ".$accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$sql .= " SET accountancy_code_buy_intra = ".$accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$sql .= " SET accountancy_code_buy_export = ".$accounting->account_number;
|
||||
}
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
|
||||
}
|
||||
@ -204,7 +212,11 @@ $form = new FormAccounting($db);
|
||||
$accounting = new AccountingAccount($db);
|
||||
// TODO: we should need to check if result is already exists accountaccount rowid.....
|
||||
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
|
||||
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
|
||||
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
|
||||
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
|
||||
@ -212,47 +224,68 @@ $aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_P
|
||||
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
|
||||
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
|
||||
|
||||
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
llxHeader('', $langs->trans("ProductsBinding"));
|
||||
|
||||
$pcgverid = $conf->global->CHARTOFACCOUNTS;
|
||||
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
|
||||
if (empty($pcgvercode)) $pcgvercode=$pcgverid;
|
||||
if (empty($pcgvercode)) $pcgvercode = $pcgverid;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy,";
|
||||
$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,";
|
||||
$sql.= " p.tms, p.fk_product_type as product_type,";
|
||||
$sql.= " aa.rowid as aaid";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
|
||||
$sql .= " p.tms, p.fk_product_type as product_type,";
|
||||
$sql .= " aa.rowid as aaid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
|
||||
{
|
||||
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
{
|
||||
$sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=" p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
|
||||
$sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
|
||||
}
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
|
||||
}
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
if (strlen(trim($search_current_account))) {
|
||||
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
|
||||
@ -286,8 +319,8 @@ if (strlen(trim($search_label))) {
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= natural_search("p.description", $search_desc);
|
||||
}
|
||||
if ($search_onsell != '' && $search_onsell != '-1') $sql.= natural_search('p.tosell', $search_onsell, 1);
|
||||
if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql.= natural_search('p.tobuy', $search_onpurchase, 1);
|
||||
if ($search_onsell != '' && $search_onsell != '-1') $sql .= natural_search('p.tosell', $search_onsell, 1);
|
||||
if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql .= natural_search('p.tobuy', $search_onpurchase, 1);
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -334,70 +367,77 @@ if ($result)
|
||||
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
|
||||
print '<br>';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc") . '</span><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>';
|
||||
print '<br>';
|
||||
|
||||
// Select mode
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellDesc');
|
||||
print "</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellIntra') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellExport') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
if ($mysoc->isInEEC())
|
||||
{
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
}
|
||||
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
|
||||
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Refresh').'" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$moreforfilter = '';
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '">';
|
||||
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
|
||||
//print '<br><div class="center">'.$buttonsave.'</div>';
|
||||
|
||||
$texte=$langs->trans("ListOfProductsServices");
|
||||
$texte = $langs->trans("ListOfProductsServices");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
|
||||
// On sell
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).'</td>';
|
||||
}
|
||||
// On buy
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print '<td class="liste_titre center">'.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).'</td>';
|
||||
}
|
||||
// Current account
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
|
||||
$listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
|
||||
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="'.dol_escape_htmltag($search_current_account).'">';
|
||||
$listofvals = array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
|
||||
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="center liste_titre">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -405,30 +445,36 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
|
||||
// On sell / On purchase
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell";
|
||||
$fieldtosortaccount = "p.accountancy_code_sell";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_intra";
|
||||
$fieldtosortaccount = "p.accountancy_code_sell_intra";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_sell_export";
|
||||
} else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount="p.accountancy_code_buy";
|
||||
}
|
||||
$fieldtosortaccount = "p.accountancy_code_sell_export";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount = "p.accountancy_code_buy";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount = "p.accountancy_code_buy_intra";
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
$fieldtosortaccount = "p.accountancy_code_buy_export";
|
||||
}
|
||||
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AssignDedicatedAccountingAccount");
|
||||
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
|
||||
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
|
||||
print '</tr>';
|
||||
|
||||
$product_static = new Product($db);
|
||||
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
@ -445,48 +491,77 @@ if ($result)
|
||||
// Sales
|
||||
if ($obj->product_type == 0) {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell;
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_intra;
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_prodsell_export;
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodsell_id = $aarowid_servsell;
|
||||
}
|
||||
}
|
||||
|
||||
// Purchases
|
||||
if ($obj->product_type == 0) {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
} else {
|
||||
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_prodbuy;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_intra;
|
||||
}
|
||||
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$compta_prodbuy_id = $aarowid_servbuy;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -509,7 +584,7 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT')
|
||||
print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
|
||||
print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
|
||||
|
||||
// Current accounting account
|
||||
@ -517,7 +592,13 @@ if ($result)
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
print length_accountg($obj->accountancy_code_buy);
|
||||
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
print length_accountg($obj->accountancy_code_buy_intra);
|
||||
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
print length_accountg($obj->accountancy_code_buy_export);
|
||||
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
print length_accountg($obj->accountancy_code_sell);
|
||||
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
@ -530,52 +611,72 @@ if ($result)
|
||||
print '</td>';
|
||||
|
||||
// New account to set
|
||||
$defaultvalue='';
|
||||
$defaultvalue = '';
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
|
||||
// Accounting account buy
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy;
|
||||
$codesell=length_accountg($obj->accountancy_code_buy);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
|
||||
$codesell = length_accountg($obj->accountancy_code_buy);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
|
||||
// Accounting account buy intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_intra;
|
||||
$codesell = length_accountg($obj->accountancy_code_buy_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
|
||||
// Accounting account buy export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_export;
|
||||
$codesell = length_accountg($obj->accountancy_code_buy_export);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
|
||||
// Accounting account sell
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
|
||||
$codesell = length_accountg($obj->accountancy_code_sell);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
|
||||
// Accounting account sell intra (In EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell_intra);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
|
||||
$codesell = length_accountg($obj->accountancy_code_sell_intra);
|
||||
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
} else {
|
||||
// Accounting account sell export (Out of EEC)
|
||||
print '<td class="left">';
|
||||
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
|
||||
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
|
||||
$codesell=length_accountg($obj->accountancy_code_sell_export);
|
||||
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
|
||||
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
|
||||
$codesell = length_accountg($obj->accountancy_code_sell_export);
|
||||
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
|
||||
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td class="center">';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("accountancy"));
|
||||
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
@ -47,7 +47,7 @@ $action = GETPOST('action', 'aZ09');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -254,7 +254,7 @@ if ($action != 'export_csv')
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Opening Balance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("OpeningBalance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
@ -271,7 +271,7 @@ if ($action != 'export_csv')
|
||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = Array();
|
||||
$opening_balances = array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||
|
||||
@ -93,7 +93,7 @@ $search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -204,7 +204,7 @@ if (empty($reshook))
|
||||
$search_debit = '';
|
||||
$search_credit = '';
|
||||
$search_lettering_code = '';
|
||||
$search_not_reconciled='';
|
||||
$search_not_reconciled = '';
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
@ -276,32 +276,32 @@ if (empty($reshook))
|
||||
if (!empty($search_date_creation_start)) {
|
||||
$filter['t.date_creation>='] = $search_date_creation_start;
|
||||
$tmp = dol_getdate($search_date_creation_start);
|
||||
$param .= '&date_creation_startmonth=' . urlencode($tmp['mon']) . '&date_creation_startday=' . urlencode($tmp['mday']) . '&date_creation_startyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_creation_startmonth='.urlencode($tmp['mon']).'&date_creation_startday='.urlencode($tmp['mday']).'&date_creation_startyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_creation_end)) {
|
||||
$filter['t.date_creation<='] = $search_date_creation_end;
|
||||
$tmp = dol_getdate($search_date_creation_end);
|
||||
$param .= '&date_creation_endmonth=' .urlencode($tmp['mon']) . '&date_creation_endday=' . urlencode($tmp['mday']) . '&date_creation_endyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_creation_endmonth='.urlencode($tmp['mon']).'&date_creation_endday='.urlencode($tmp['mday']).'&date_creation_endyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_modification_start)) {
|
||||
$filter['t.tms>='] = $search_date_modification_start;
|
||||
$tmp = dol_getdate($search_date_modification_start);
|
||||
$param .= '&date_modification_startmonth=' . urlencode($tmp['mon']) . '&date_modification_startday=' . urlencode($tmp['mday']) . '&date_modification_startyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_modification_startmonth='.urlencode($tmp['mon']).'&date_modification_startday='.urlencode($tmp['mday']).'&date_modification_startyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_modification_end)) {
|
||||
$filter['t.tms<='] = $search_date_modification_end;
|
||||
$tmp = dol_getdate($search_date_modification_end);
|
||||
$param .= '&date_modification_endmonth=' . urlencode($tmp['mon']) . '&date_modification_endday=' . urlencode($tmp['mday']) . '&date_modification_endyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_modification_endmonth='.urlencode($tmp['mon']).'&date_modification_endday='.urlencode($tmp['mday']).'&date_modification_endyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_export_start)) {
|
||||
$filter['t.date_export>='] = $search_date_export_start;
|
||||
$tmp = dol_getdate($search_date_export_start);
|
||||
$param .= '&date_export_startmonth=' . urlencode($tmp['mon']) . '&date_export_startday=' . urlencode($tmp['mday']) . '&date_export_startyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_export_startmonth='.urlencode($tmp['mon']).'&date_export_startday='.urlencode($tmp['mday']).'&date_export_startyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_date_export_end)) {
|
||||
$filter['t.date_export<='] = $search_date_export_end;
|
||||
$tmp = dol_getdate($search_date_export_end);
|
||||
$param .= '&date_export_endmonth=' . urlencode($tmp['mon']) . '&date_export_endday=' . urlencode($tmp['mday']) . '&date_export_endyear=' . urlencode($tmp['year']);
|
||||
$param .= '&date_export_endmonth='.urlencode($tmp['mon']).'&date_export_endday='.urlencode($tmp['mday']).'&date_export_endyear='.urlencode($tmp['year']);
|
||||
}
|
||||
if (!empty($search_debit)) {
|
||||
$filter['t.debit'] = $search_debit;
|
||||
@ -315,9 +315,9 @@ if (empty($reshook))
|
||||
$filter['t.lettering_code'] = $search_lettering_code;
|
||||
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
|
||||
}
|
||||
if (! empty($search_not_reconciled)) {
|
||||
if (!empty($search_not_reconciled)) {
|
||||
$filter['t.reconciled_option'] = $search_not_reconciled;
|
||||
$param .= '&search_not_reconciled=' . urlencode($search_not_reconciled);
|
||||
$param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
|
||||
}
|
||||
}
|
||||
|
||||
@ -768,7 +768,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
|
||||
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled'?' checked':'').'>'.$langs->trans("NotReconciled").'</span>';
|
||||
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
|
||||
print '</td>';
|
||||
}
|
||||
// Code journal
|
||||
@ -953,9 +953,9 @@ while ($i < min($num, $limit))
|
||||
$objectstatic->fetch($line->fk_doc);
|
||||
//$modulepart = 'expensereport';
|
||||
|
||||
$filename=dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$filename = dol_sanitizeFileName($line->doc_ref);
|
||||
$filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
|
||||
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||
}
|
||||
else
|
||||
@ -969,7 +969,7 @@ while ($i < min($num, $limit))
|
||||
// Picto + Ref
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
|
||||
if($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
|
||||
if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report')
|
||||
{
|
||||
print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
|
||||
print $documentlink;
|
||||
|
||||
@ -62,7 +62,7 @@ $search_credit = GETPOST('search_credit', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -47,7 +47,7 @@ $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == - 1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
|
||||
@ -46,7 +46,7 @@ $socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == - 1) {
|
||||
$page = 0;
|
||||
} // If $page is not defined, or '' or -1
|
||||
|
||||
@ -54,6 +54,7 @@ class AccountancyExport
|
||||
public static $EXPORT_TYPE_QUADRATUS = 60;
|
||||
public static $EXPORT_TYPE_OPENCONCERTO = 100;
|
||||
public static $EXPORT_TYPE_LDCOMPTA = 110;
|
||||
public static $EXPORT_TYPE_LDCOMPTA10 = 120;
|
||||
public static $EXPORT_TYPE_FEC = 1000;
|
||||
|
||||
|
||||
@ -110,8 +111,9 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
|
||||
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
|
||||
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
|
||||
self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'),
|
||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
|
||||
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
|
||||
);
|
||||
|
||||
ksort($listofexporttypes, SORT_NUMERIC);
|
||||
@ -140,6 +142,7 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
|
||||
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
|
||||
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
|
||||
self::$EXPORT_TYPE_LDCOMPTA10 => 'ldcompta10',
|
||||
self::$EXPORT_TYPE_FEC => 'fec',
|
||||
);
|
||||
|
||||
@ -201,6 +204,10 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_LDCOMPTA => array(
|
||||
'label' => $langs->trans('Modelcsv_LDCompta'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||
),
|
||||
self::$EXPORT_TYPE_LDCOMPTA10 => array(
|
||||
'label' => $langs->trans('Modelcsv_LDCompta10'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||
),
|
||||
self::$EXPORT_TYPE_FEC => array(
|
||||
'label' => $langs->trans('Modelcsv_FEC'),
|
||||
@ -280,6 +287,9 @@ class AccountancyExport
|
||||
case self::$EXPORT_TYPE_LDCOMPTA :
|
||||
$this->exportLDCompta($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_LDCOMPTA10 :
|
||||
$this->exportLDCompta10($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_FEC :
|
||||
$this->exportFEC($TData);
|
||||
break;
|
||||
@ -921,7 +931,7 @@ class AccountancyExport
|
||||
|
||||
/**
|
||||
* Export format : LD Compta version 9 & higher
|
||||
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
|
||||
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW9.pdf
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
@ -1051,6 +1061,261 @@ class AccountancyExport
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : LD Compta version 10 & higher
|
||||
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportLDCompta10($objectLines)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$separator = ';';
|
||||
$end_line = "\r\n";
|
||||
$last_codeinvoice = '';
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
// TYPE C
|
||||
if($last_codeinvoice != $line->doc_ref){
|
||||
//recherche societe en fonction de son code client
|
||||
$sql = "SELECT code_client, fk_forme_juridique, nom, address, zip, town, fk_pays, phone, siret FROM ".MAIN_DB_PREFIX."societe WHERE code_client = '".$line->thirdparty_code ."'";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if($resql && $this->db->num_rows($resql)>0)
|
||||
{
|
||||
$soc = $this->db->fetch_object($resql);
|
||||
|
||||
$address = str_replace(array("\t", "\n", "\r"), " ", $soc->address);
|
||||
|
||||
$type_enregistrement = 'C';
|
||||
print $type_enregistrement.$separator;
|
||||
//NOCL
|
||||
print $soc->code_client.$separator;
|
||||
//NMCM
|
||||
print $separator;
|
||||
//LIBI
|
||||
print $separator;
|
||||
//TITR
|
||||
print getFormeJuridiqueLabel($soc->fk_forme_juridique).$separator;
|
||||
//RSSO
|
||||
print $soc->nom.$separator;
|
||||
//CAD1
|
||||
print substr($address, 0, 40).$separator;
|
||||
//CAD2
|
||||
print substr($address, 41, 40).$separator;
|
||||
//CAD3
|
||||
print substr($address, 82, 40).$separator;
|
||||
//COPO
|
||||
print $soc->zip.$separator;
|
||||
//BUDI
|
||||
print substr($soc->town, 0, 40).$separator;
|
||||
//CPAY
|
||||
print $separator;
|
||||
//PAYS
|
||||
print substr(getCountry($soc->fk_pays), 0, 40).$separator;
|
||||
//NTEL
|
||||
print $soc->phone.$separator;
|
||||
//TLEX
|
||||
print $separator;
|
||||
//TLPO
|
||||
print $separator;
|
||||
//TLCY
|
||||
print $separator;
|
||||
//NINT
|
||||
print $separator;
|
||||
//COMM
|
||||
print $separator;
|
||||
//SIRE
|
||||
print $soc->siret.$separator;
|
||||
//RIBP
|
||||
print $separator;
|
||||
//DOBQ
|
||||
print $separator;
|
||||
//IBBQ
|
||||
print $separator;
|
||||
//COBQ
|
||||
print $separator;
|
||||
//GUBQ
|
||||
print $separator;
|
||||
//CPBQ
|
||||
print $separator;
|
||||
//CLBQ
|
||||
print $separator;
|
||||
//BIBQ
|
||||
print $separator;
|
||||
//MOPM
|
||||
print $separator;
|
||||
//DJPM
|
||||
print $separator;
|
||||
//DMPM
|
||||
print $separator;
|
||||
//REFM
|
||||
print $separator;
|
||||
//SLVA
|
||||
print $separator;
|
||||
//PLCR
|
||||
print $separator;
|
||||
//ECFI
|
||||
print $separator;
|
||||
//CREP
|
||||
print $separator;
|
||||
//NREP
|
||||
print $separator;
|
||||
//TREP
|
||||
print $separator;
|
||||
//MREP
|
||||
print $separator;
|
||||
//GRRE
|
||||
print $separator;
|
||||
//LTTA
|
||||
print $separator;
|
||||
//CACT
|
||||
print $separator;
|
||||
//CODV
|
||||
print $separator;
|
||||
//GRTR
|
||||
print $separator;
|
||||
//NOFP
|
||||
print $separator;
|
||||
//BQAF
|
||||
print $separator;
|
||||
//BONP
|
||||
print $separator;
|
||||
//CESC
|
||||
print $separator;
|
||||
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
// TYPE E
|
||||
$type_enregistrement = 'E'; // For write movement
|
||||
print $type_enregistrement.$separator;
|
||||
// JNAL
|
||||
print substr($line->code_journal, 0, 2).$separator;
|
||||
// NECR
|
||||
print $line->id.$separator;
|
||||
// NPIE
|
||||
print $line->piece_num.$separator;
|
||||
// DATP
|
||||
print $date_document.$separator;
|
||||
// LIBE
|
||||
print dol_trunc($line->label_operation, 25, 'right', 'UTF-8', 1).$separator;
|
||||
// DATH
|
||||
print $date_lim_reglement.$separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
$nature_piece = 'AF';
|
||||
} else {
|
||||
$nature_piece = 'FF';
|
||||
}
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
$nature_piece = 'AC';
|
||||
} else {
|
||||
$nature_piece = 'FC';
|
||||
}
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $nature_piece.$separator;
|
||||
// RACI
|
||||
// if (! empty($line->subledger_account)) {
|
||||
// if ($line->doc_type == 'supplier_invoice') {
|
||||
// $racine_subledger_account = '40';
|
||||
// } elseif ($line->doc_type == 'customer_invoice') {
|
||||
// $racine_subledger_account = '41';
|
||||
// } else {
|
||||
// $racine_subledger_account = '';
|
||||
// }
|
||||
// } else {
|
||||
$racine_subledger_account = ''; // for records of type E leave this field blank
|
||||
// }
|
||||
|
||||
print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead
|
||||
// MONT
|
||||
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
||||
// CODC
|
||||
print $line->sens.$separator;
|
||||
// CPTG
|
||||
print length_accountg($line->numero_compte).$separator;
|
||||
// DATE
|
||||
print $date_document.$separator;
|
||||
// CLET
|
||||
print $line->lettering_code.$separator;
|
||||
// DATL
|
||||
print $line->date_lettering.$separator;
|
||||
// CPTA
|
||||
if (!empty($line->subledger_account)) {
|
||||
print length_accounta($line->subledger_account).$separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
// CNAT
|
||||
if ($line->doc_type == 'supplier_invoice' && !empty($line->subledger_account)) {
|
||||
print 'F'.$separator;
|
||||
} elseif ($line->doc_type == 'customer_invoice' && !empty($line->subledger_account)) {
|
||||
print 'C'.$separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
// SECT
|
||||
print $separator;
|
||||
// CTRE
|
||||
print $separator;
|
||||
// NORL
|
||||
print $separator;
|
||||
// DATV
|
||||
print $separator;
|
||||
// REFD
|
||||
print $line->doc_ref.$separator;
|
||||
// NECA
|
||||
print '0'.$separator;
|
||||
// CSEC
|
||||
print $separator;
|
||||
// CAFF
|
||||
print $separator;
|
||||
// CDES
|
||||
print $separator;
|
||||
// QTUE
|
||||
print '0'.$separator;
|
||||
// MTDV
|
||||
print $separator;
|
||||
// CODV
|
||||
print '0'.$separator;
|
||||
// TXDV
|
||||
print $separator;
|
||||
// MOPM
|
||||
print $separator;
|
||||
// BONP
|
||||
print $separator;
|
||||
// BQAF
|
||||
print $separator;
|
||||
// ECES
|
||||
print $separator;
|
||||
// TXTL
|
||||
print $separator;
|
||||
// ECRM
|
||||
print $separator;
|
||||
// DATK
|
||||
print $separator;
|
||||
// HEUK
|
||||
print $separator;
|
||||
|
||||
print $end_line;
|
||||
|
||||
$last_codeinvoice = $line->doc_ref;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : Charlemagne
|
||||
*
|
||||
|
||||
@ -135,6 +135,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
public $active;
|
||||
|
||||
/**
|
||||
* @var int reconciliable
|
||||
*/
|
||||
public $reconciliable;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -162,7 +167,7 @@ class AccountingAccount extends CommonObject
|
||||
global $conf;
|
||||
|
||||
if ($rowid || $account_number) {
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active, a.reconciliable";
|
||||
$sql .= ", ca.label as category_label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
|
||||
@ -203,6 +208,7 @@ class AccountingAccount extends CommonObject
|
||||
$this->fk_user_modif = $obj->fk_user_modif;
|
||||
$this->active = $obj->active;
|
||||
$this->status = $obj->active;
|
||||
$this->reconciliable = $obj->reconciliable;
|
||||
|
||||
return $this->id;
|
||||
} else {
|
||||
@ -261,6 +267,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", fk_accounting_category";
|
||||
$sql .= ", fk_user_author";
|
||||
$sql .= ", active";
|
||||
$sql .= ", reconciliable";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= " '" . $this->db->idate($now) . "'";
|
||||
$sql .= ", " . $conf->entity;
|
||||
@ -273,6 +280,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||
$sql .= ", " . $user->id;
|
||||
$sql .= ", " . (int) $this->active;
|
||||
$sql .= ", " . (int) $this->reconciliable;
|
||||
$sql .= ")";
|
||||
|
||||
$this->db->begin();
|
||||
@ -340,6 +348,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||
$sql .= " , fk_user_modif = " . $user->id;
|
||||
$sql .= " , active = " . (int) $this->active;
|
||||
$sql .= " , reconciliable = " . (int) $this->reconciliable;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||
@ -565,21 +574,31 @@ class AccountingAccount extends CommonObject
|
||||
* Account deactivated
|
||||
*
|
||||
* @param int $id Id
|
||||
* @param int $mode 0=field active, 1=field active_customer_list, 2=field_active_supplier_list
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function account_desactivate($id)
|
||||
public function account_desactivate($id, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = $this->checkUsage();
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$fieldtouse = 'active';
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
$fieldtouse = 'reconciliable';
|
||||
}
|
||||
|
||||
if ($result > 0) {
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= "SET active = '0'";
|
||||
$sql .= "SET " . $fieldtouse . " = '0'";
|
||||
$sql .= " WHERE rowid = " . $this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this) . "::desactivate sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::account_desactivate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
@ -600,18 +619,28 @@ class AccountingAccount extends CommonObject
|
||||
* Account activated
|
||||
*
|
||||
* @param int $id Id
|
||||
* @param int $mode 0=field active, 1=field reconciliable, 2=field active_customer_list, 3=field_active_supplier_list
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function account_activate($id)
|
||||
public function account_activate($id, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->db->begin();
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$fieldtouse = 'active';
|
||||
}
|
||||
elseif ($mode == 1)
|
||||
{
|
||||
$fieldtouse = 'reconciliable';
|
||||
}
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
|
||||
$sql .= "SET active = '1'";
|
||||
$sql .= "SET " . $fieldtouse . " = '1'";
|
||||
$sql .= " WHERE rowid = " . $this->db->escape($id);
|
||||
|
||||
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::account_activate " . $fieldtouse . " sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->db->commit();
|
||||
|
||||
@ -122,8 +122,8 @@ if ($action == 'validatehistory') {
|
||||
// Customer Invoice lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
@ -154,14 +154,22 @@ if ($action == 'validatehistory') {
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
// Search suggested account for product/service
|
||||
// Search suggested account for product/service (similar code exists in page list.php to make manual binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = 0; // There is a doubt, no automatic binding
|
||||
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_sell_p = $objp->code_sell_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
|
||||
@ -60,7 +60,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) $page = 0;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -69,7 +69,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -206,8 +206,10 @@ if (empty($chartaccountcode))
|
||||
// Customer Invoice lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
$sql .= " p.tosell as status, p.tobuy as status_buy,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
@ -399,7 +401,7 @@ if ($result) {
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -423,6 +425,14 @@ if ($result) {
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->status = $objp->status;
|
||||
$product_static->status_buy = $objp->status_buy;
|
||||
$product_static->accountancy_code_sell = $objp->code_sell;
|
||||
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
|
||||
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
|
||||
$facture_static->ref = $objp->ref;
|
||||
$facture_static->id = $objp->facid;
|
||||
@ -433,13 +443,20 @@ if ($result) {
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
// Search suggested default account for product/service
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
@ -452,7 +469,13 @@ if ($result) {
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
@ -463,14 +486,22 @@ if ($result) {
|
||||
}
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
|
||||
|
||||
// Search suggested account for product/service
|
||||
// Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = 'eecwithvat';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
|
||||
$objp->code_sell_p = $objp->code_sell;
|
||||
$objp->aarowid_suggest = $objp->aarowid; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
|
||||
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
|
||||
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_sell_p = $objp->code_sell_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
@ -487,6 +518,7 @@ if ($result) {
|
||||
$code_sell_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red';
|
||||
if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) $code_sell_p_notset = 'color:orange';
|
||||
|
||||
// $objp->code_sell_l is now default code of product/service
|
||||
// $objp->code_sell_p is now code of product/service
|
||||
@ -503,9 +535,10 @@ if ($result) {
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id > 0)
|
||||
if ($product_static->id > 0) {
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
}
|
||||
if ($objp->product_label) print '<br><span class="opacitymedium">'.$objp->product_label.'</span>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
@ -535,7 +568,7 @@ if ($result) {
|
||||
|
||||
// Current account
|
||||
print '<td class="center" style="'.$code_sell_p_notset.'">';
|
||||
$s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
|
||||
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
|
||||
@ -544,9 +577,11 @@ if ($result) {
|
||||
if ($objp->product_id > 0)
|
||||
{
|
||||
print '<br>';
|
||||
$s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
|
||||
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
|
||||
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
|
||||
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
|
||||
$s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p));
|
||||
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
|
||||
@ -582,6 +617,7 @@ if ($result) {
|
||||
print '<td class="center">';
|
||||
//var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
|
||||
$ischecked = $objp->aarowid_suggest;
|
||||
if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $ischecked = 0;
|
||||
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="'.$objp->rowid."_".$i.'"'.($ischecked ? "checked" : "").'/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ $search_year = GETPOST("search_year", "int");
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) $page = 0;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -62,7 +62,7 @@ $search_year = GETPOST("search_year", "int");
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -313,8 +313,8 @@ if ($result) {
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', '');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
|
||||
@ -366,12 +366,12 @@ if ($result) {
|
||||
print '</td>';
|
||||
|
||||
// Current account
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
print length_accountg(html_entity_decode($objp->code_buy));
|
||||
print '</td>';
|
||||
|
||||
// Suggested accounting account
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ if ($conf->accounting->enabled)
|
||||
|
||||
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
|
||||
|
||||
$helpisexpanded = empty($resultboxes['boxactivated']); // If there is no widget, the tooltip help is expanded by default.
|
||||
$helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
|
||||
$showtutorial = '';
|
||||
|
||||
if (!$helpisexpanded)
|
||||
@ -222,10 +222,6 @@ if ($conf->accounting->enabled)
|
||||
$boxlist .= '<div class="twocolumns">';
|
||||
|
||||
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
|
||||
if (!empty($nbworkboardcount))
|
||||
{
|
||||
$boxlist .= $boxwork;
|
||||
}
|
||||
|
||||
$boxlist .= $resultboxes['boxlista'];
|
||||
|
||||
@ -233,7 +229,6 @@ if ($conf->accounting->enabled)
|
||||
|
||||
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
|
||||
|
||||
$boxlist .= $boxstat;
|
||||
$boxlist .= $resultboxes['boxlistb'];
|
||||
|
||||
$boxlist .= '</div>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -119,8 +119,9 @@ if ($action == 'validatehistory') {
|
||||
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
@ -128,7 +129,9 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
|
||||
@ -157,16 +160,12 @@ if ($action == 'validatehistory') {
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
//$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
//$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
//$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
//$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ $search_tvaintra = GETPOST('search_tvaintra', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) $page = 0;
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
|
||||
@ -69,7 +69,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page < 0) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -210,8 +210,11 @@ if (empty($chartaccountcode))
|
||||
// Supplier Invoice Lines
|
||||
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
|
||||
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " aa.rowid as aarowid,";
|
||||
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
|
||||
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
|
||||
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
|
||||
$sql .= " p.tosell as status, p.tobuy as status_buy,";
|
||||
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
|
||||
$sql .= " co.code as country_code, co.label as country_label,";
|
||||
$sql .= " s.tva_intra";
|
||||
$parameters = array();
|
||||
@ -222,7 +225,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
// Add search filter like
|
||||
@ -396,7 +401,7 @@ if ($result) {
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
|
||||
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
|
||||
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
|
||||
$checkpicto = '';
|
||||
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
|
||||
@ -414,40 +419,86 @@ if ($result) {
|
||||
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
|
||||
$objp->code_buy_l = '';
|
||||
$objp->code_buy_p = '';
|
||||
$objp->aarowid_suggest = '';
|
||||
|
||||
$product_static->ref = $objp->product_ref;
|
||||
$product_static->id = $objp->product_id;
|
||||
$product_static->type = $objp->type;
|
||||
$product_static->label = $objp->product_label;
|
||||
$product_static->status = $objp->status;
|
||||
$product_static->status_buy = $objp->status_buy;
|
||||
$product_static->accountancy_code_sell = $objp->code_sell;
|
||||
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
|
||||
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
|
||||
$product_static->accountancy_code_buy = $objp->code_buy;
|
||||
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
|
||||
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
|
||||
|
||||
$facturefourn_static->ref = $objp->ref;
|
||||
$facturefourn_static->id = $objp->facid;
|
||||
$facturefourn_static->type = $objp->type;
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->code_buy_l == -1) $objp->code_buy_l = '';
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
|
||||
|
||||
if (!empty($objp->code_buy)) {
|
||||
$objp->code_buy_p = $objp->code_buy; // Code on product
|
||||
// Search suggested account for product/service
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($objp->code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
|
||||
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -467,7 +518,7 @@ if ($result) {
|
||||
print '<td>';
|
||||
if ($product_static->id > 0)
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
if ($objp->product_label) print '<br><span class="opacitymedium">'.$objp->product_label.'</span>';
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
@ -498,8 +549,8 @@ if ($result) {
|
||||
print '<td>'.$objp->tva_intra.'</td>';
|
||||
|
||||
// Current account
|
||||
print '<td class="center" style="'.$code_buy_p_notset.'">';
|
||||
$s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
|
||||
print '<td style="'.$code_buy_p_notset.'">';
|
||||
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
|
||||
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
|
||||
@ -508,7 +559,7 @@ if ($result) {
|
||||
if ($objp->product_id > 0)
|
||||
{
|
||||
print '<br>';
|
||||
$s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
|
||||
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
|
||||
$shelp = '';
|
||||
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
|
||||
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
|
||||
@ -520,6 +571,21 @@ if ($result) {
|
||||
// Suggested accounting account
|
||||
print '<td>';
|
||||
$suggestedid = $objp->aarowid_suggest;
|
||||
if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
|
||||
{
|
||||
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l]))
|
||||
{
|
||||
$tmpaccount = new AccountingAccount($db);
|
||||
$tmpaccount->fetch(0, $objp->code_buy_l, 1);
|
||||
if ($tmpaccount->id > 0) {
|
||||
$suggestedid = $tmpaccount->id;
|
||||
}
|
||||
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
|
||||
}
|
||||
else {
|
||||
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
|
||||
}
|
||||
}
|
||||
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
|
||||
print '</td>';
|
||||
|
||||
@ -540,6 +606,9 @@ if ($result) {
|
||||
} else {
|
||||
print $db->error();
|
||||
}
|
||||
if ($db->type == 'mysqli') {
|
||||
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
|
||||
}
|
||||
|
||||
// Add code to auto check the box when we select an account
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
|
||||
@ -41,7 +41,7 @@ $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -32,9 +32,9 @@
|
||||
* \ingroup member
|
||||
* \brief File of class to manage members of a foundation
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -341,7 +341,7 @@ class Adherent extends CommonObject
|
||||
if (dol_textishtml($text, 0)) $msgishtml = 1;
|
||||
}
|
||||
|
||||
dol_syslog('send_an_email msgishtml=' . $msgishtml);
|
||||
dol_syslog('send_an_email msgishtml='.$msgishtml);
|
||||
|
||||
$texttosend = $this->makeSubstitution($text);
|
||||
$subjecttosend = $this->makeSubstitution($subject);
|
||||
@ -351,15 +351,15 @@ class Adherent extends CommonObject
|
||||
$from = $conf->email_from;
|
||||
if (!empty($conf->global->ADHERENT_MAIL_FROM)) $from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
|
||||
$trackid = 'mem' . $this->id;
|
||||
$trackid = 'mem'.$this->id;
|
||||
|
||||
// Send email (substitutionarray must be done just before this)
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, '', '', $trackid, $moreinheader);
|
||||
if ($mailfile->sendfile()) {
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->email) . '. ' . $mailfile->error;
|
||||
$this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->email).'. '.$mailfile->error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -381,26 +381,26 @@ class Adherent extends CommonObject
|
||||
if (dol_textishtml($text, 1)) $msgishtml = 1;
|
||||
|
||||
$infos = '';
|
||||
if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle") . ": " . $this->getCivilityLabel() . "\n";
|
||||
$infos .= $langs->transnoentities("id") . ": " . $this->id . "\n";
|
||||
$infos .= $langs->transnoentities("Lastname") . ": " . $this->lastname . "\n";
|
||||
$infos .= $langs->transnoentities("Firstname") . ": " . $this->firstname . "\n";
|
||||
$infos .= $langs->transnoentities("Company") . ": " . $this->company . "\n";
|
||||
$infos .= $langs->transnoentities("Address") . ": " . $this->address . "\n";
|
||||
$infos .= $langs->transnoentities("Zip") . ": " . $this->zip . "\n";
|
||||
$infos .= $langs->transnoentities("Town") . ": " . $this->town . "\n";
|
||||
$infos .= $langs->transnoentities("Country") . ": " . $this->country . "\n";
|
||||
$infos .= $langs->transnoentities("EMail") . ": " . $this->email . "\n";
|
||||
$infos .= $langs->transnoentities("PhonePro") . ": " . $this->phone . "\n";
|
||||
$infos .= $langs->transnoentities("PhonePerso") . ": " . $this->phone_perso . "\n";
|
||||
$infos .= $langs->transnoentities("PhoneMobile") . ": " . $this->phone_mobile . "\n";
|
||||
if ($this->civility_id) $infos .= $langs->transnoentities("UserTitle").": ".$this->getCivilityLabel()."\n";
|
||||
$infos .= $langs->transnoentities("id").": ".$this->id."\n";
|
||||
$infos .= $langs->transnoentities("Lastname").": ".$this->lastname."\n";
|
||||
$infos .= $langs->transnoentities("Firstname").": ".$this->firstname."\n";
|
||||
$infos .= $langs->transnoentities("Company").": ".$this->company."\n";
|
||||
$infos .= $langs->transnoentities("Address").": ".$this->address."\n";
|
||||
$infos .= $langs->transnoentities("Zip").": ".$this->zip."\n";
|
||||
$infos .= $langs->transnoentities("Town").": ".$this->town."\n";
|
||||
$infos .= $langs->transnoentities("Country").": ".$this->country."\n";
|
||||
$infos .= $langs->transnoentities("EMail").": ".$this->email."\n";
|
||||
$infos .= $langs->transnoentities("PhonePro").": ".$this->phone."\n";
|
||||
$infos .= $langs->transnoentities("PhonePerso").": ".$this->phone_perso."\n";
|
||||
$infos .= $langs->transnoentities("PhoneMobile").": ".$this->phone_mobile."\n";
|
||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||
$infos .= $langs->transnoentities("Login") . ": " . $this->login . "\n";
|
||||
$infos .= $langs->transnoentities("Password") . ": " . $this->pass . "\n";
|
||||
$infos .= $langs->transnoentities("Login").": ".$this->login."\n";
|
||||
$infos .= $langs->transnoentities("Password").": ".$this->pass."\n";
|
||||
}
|
||||
$infos .= $langs->transnoentities("Birthday") . ": " . $birthday . "\n";
|
||||
$infos .= $langs->transnoentities("Photo") . ": " . $this->photo . "\n";
|
||||
$infos .= $langs->transnoentities("Public") . ": " . yn($this->public);
|
||||
$infos .= $langs->transnoentities("Birthday").": ".$birthday."\n";
|
||||
$infos .= $langs->transnoentities("Photo").": ".$this->photo."\n";
|
||||
$infos .= $langs->transnoentities("Public").": ".yn($this->public);
|
||||
|
||||
// Substitutions
|
||||
$substitutionarray = array('__ID__' => $this->id, '__MEMBER_ID__' => $this->id, '__CIVILITY__' => $this->getCivilityLabel(),
|
||||
@ -481,22 +481,22 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Insert member
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " (datec,login,fk_user_author,fk_user_mod,fk_user_valid,morphy,fk_adherent_type,entity,import_key)";
|
||||
$sql .= " VALUES (";
|
||||
$sql .= " '" . $this->db->idate($this->datec) . "'";
|
||||
$sql .= ", " . ($this->login ? "'" . $this->db->escape($this->login) . "'" : "null");
|
||||
$sql .= ", " . ($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
|
||||
$sql .= ", null, null, '" . $this->db->escape($this->morphy) . "'";
|
||||
$sql .= ", " . $this->typeid;
|
||||
$sql .= ", " . $conf->entity;
|
||||
$sql .= ", " . (!empty($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null");
|
||||
$sql .= " '".$this->db->idate($this->datec)."'";
|
||||
$sql .= ", ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
|
||||
$sql .= ", ".($user->id > 0 ? $user->id : "null"); // Can be null because member can be created by a guest or a script
|
||||
$sql .= ", null, null, '".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", ".$this->typeid;
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "adherent");
|
||||
$id = $this->db->last_insert_id(MAIN_DB_PREFIX."adherent");
|
||||
if ($id > 0) {
|
||||
$this->id = $id;
|
||||
$this->ref = (string) $id;
|
||||
@ -511,10 +511,10 @@ class Adherent extends CommonObject
|
||||
// Add link to user
|
||||
if ($this->user_id) {
|
||||
// Add link to user
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET";
|
||||
$sql .= " fk_member = " . $this->id;
|
||||
$sql .= " WHERE rowid = " . $this->user_id;
|
||||
dol_syslog(get_class($this) . "::create", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET";
|
||||
$sql .= " fk_member = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$this->user_id;
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = 'Failed to update user to make link with member';
|
||||
@ -533,7 +533,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
dol_syslog(get_class($this) . "::create " . implode(',', $this->errors), LOG_ERR);
|
||||
dol_syslog(get_class($this)."::create ".implode(',', $this->errors), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
} else {
|
||||
@ -542,7 +542,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$this->error = 'Failed to get last insert id';
|
||||
dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
@ -572,7 +572,7 @@ class Adherent extends CommonObject
|
||||
$nbrowsaffected = 0;
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncuser=" . $nosyncuser . ", nosyncuserpass=" . $nosyncuserpass . " nosyncthirdparty=" . $nosyncthirdparty . ", email=" .
|
||||
dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncuser=".$nosyncuser.", nosyncuserpass=".$nosyncuserpass." nosyncthirdparty=".$nosyncthirdparty.", email=".
|
||||
$this->email);
|
||||
|
||||
// Clean parameters
|
||||
@ -598,43 +598,43 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql .= " civility = " . ($this->civility_id ? "'" . $this->db->escape($this->civility_id) . "'" : "null");
|
||||
$sql .= ", firstname = " . ($this->firstname ? "'" . $this->db->escape($this->firstname) . "'" : "null");
|
||||
$sql .= ", lastname = " . ($this->lastname ? "'" . $this->db->escape($this->lastname) . "'" : "null");
|
||||
$sql .= ", gender = " . ($this->gender != -1 ? "'" . $this->db->escape($this->gender) . "'" : "null"); // 'man' or 'woman'
|
||||
$sql .= ", login = " . ($this->login ? "'" . $this->db->escape($this->login) . "'" : "null");
|
||||
$sql .= ", societe = " . ($this->company ? "'" . $this->db->escape($this->company) . "'" : ($this->societe ? "'" . $this->db->escape($this->societe) . "'" : "null"));
|
||||
$sql .= ", fk_soc = " . ($this->socid > 0 ? $this->db->escape($this->socid) : "null");
|
||||
$sql .= ", address = " . ($this->address ? "'" . $this->db->escape($this->address) . "'" : "null");
|
||||
$sql .= ", zip = " . ($this->zip ? "'" . $this->db->escape($this->zip) . "'" : "null");
|
||||
$sql .= ", town = " . ($this->town ? "'" . $this->db->escape($this->town) . "'" : "null");
|
||||
$sql .= ", country = " . ($this->country_id > 0 ? $this->db->escape($this->country_id) : "null");
|
||||
$sql .= ", state_id = " . ($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '" . $this->db->escape($this->email) . "'";
|
||||
$sql .= ", socialnetworks = '" . $this->db->escape(json_encode($this->socialnetworks)) . "'";
|
||||
$sql .= ", phone = " . ($this->phone ? "'" . $this->db->escape($this->phone) . "'" : "null");
|
||||
$sql .= ", phone_perso = " . ($this->phone_perso ? "'" . $this->db->escape($this->phone_perso) . "'" : "null");
|
||||
$sql .= ", phone_mobile = " . ($this->phone_mobile ? "'" . $this->db->escape($this->phone_mobile) . "'" : "null");
|
||||
$sql .= ", note_private = " . ($this->note_private ? "'" . $this->db->escape($this->note_private) . "'" : "null");
|
||||
$sql .= ", note_public = " . ($this->note_public ? "'" . $this->db->escape($this->note_public) . "'" : "null");
|
||||
$sql .= ", photo = " . ($this->photo ? "'" . $this->db->escape($this->photo) . "'" : "null");
|
||||
$sql .= ", public = '" . $this->db->escape($this->public) . "'";
|
||||
$sql .= ", statut = " . $this->db->escape($this->statut);
|
||||
$sql .= ", fk_adherent_type = " . $this->db->escape($this->typeid);
|
||||
$sql .= ", morphy = '" . $this->db->escape($this->morphy) . "'";
|
||||
$sql .= ", birth = " . ($this->birth ? "'" . $this->db->idate($this->birth) . "'" : "null");
|
||||
if ($this->socid) $sql .= ", fk_soc = '" . $this->db->escape($this->socid) . "'"; // Must be modified only when creating from a third-party
|
||||
if ($this->datefin) $sql .= ", datefin = '" . $this->db->idate($this->datefin) . "'"; // Must be modified only when deleting a subscription
|
||||
if ($this->datevalid) $sql .= ", datevalid = '" . $this->db->idate($this->datevalid) . "'"; // Must be modified only when validating a member
|
||||
$sql .= ", fk_user_mod = " . ($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " civility = ".($this->civility_id ? "'".$this->db->escape($this->civility_id)."'" : "null");
|
||||
$sql .= ", firstname = ".($this->firstname ? "'".$this->db->escape($this->firstname)."'" : "null");
|
||||
$sql .= ", lastname = ".($this->lastname ? "'".$this->db->escape($this->lastname)."'" : "null");
|
||||
$sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
|
||||
$sql .= ", login = ".($this->login ? "'".$this->db->escape($this->login)."'" : "null");
|
||||
$sql .= ", societe = ".($this->company ? "'".$this->db->escape($this->company)."'" : ($this->societe ? "'".$this->db->escape($this->societe)."'" : "null"));
|
||||
$sql .= ", fk_soc = ".($this->socid > 0 ? $this->db->escape($this->socid) : "null");
|
||||
$sql .= ", address = ".($this->address ? "'".$this->db->escape($this->address)."'" : "null");
|
||||
$sql .= ", zip = ".($this->zip ? "'".$this->db->escape($this->zip)."'" : "null");
|
||||
$sql .= ", town = ".($this->town ? "'".$this->db->escape($this->town)."'" : "null");
|
||||
$sql .= ", country = ".($this->country_id > 0 ? $this->db->escape($this->country_id) : "null");
|
||||
$sql .= ", state_id = ".($this->state_id > 0 ? $this->db->escape($this->state_id) : "null");
|
||||
$sql .= ", email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'";
|
||||
$sql .= ", phone = ".($this->phone ? "'".$this->db->escape($this->phone)."'" : "null");
|
||||
$sql .= ", phone_perso = ".($this->phone_perso ? "'".$this->db->escape($this->phone_perso)."'" : "null");
|
||||
$sql .= ", phone_mobile = ".($this->phone_mobile ? "'".$this->db->escape($this->phone_mobile)."'" : "null");
|
||||
$sql .= ", note_private = ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : "null");
|
||||
$sql .= ", note_public = ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : "null");
|
||||
$sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null");
|
||||
$sql .= ", public = '".$this->db->escape($this->public)."'";
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", fk_adherent_type = ".$this->db->escape($this->typeid);
|
||||
$sql .= ", morphy = '".$this->db->escape($this->morphy)."'";
|
||||
$sql .= ", birth = ".($this->birth ? "'".$this->db->idate($this->birth)."'" : "null");
|
||||
if ($this->socid) $sql .= ", fk_soc = '".$this->db->escape($this->socid)."'"; // Must be modified only when creating from a third-party
|
||||
if ($this->datefin) $sql .= ", datefin = '".$this->db->idate($this->datefin)."'"; // Must be modified only when deleting a subscription
|
||||
if ($this->datevalid) $sql .= ", datevalid = '".$this->db->idate($this->datevalid)."'"; // Must be modified only when validating a member
|
||||
$sql .= ", fk_user_mod = ".($user->id > 0 ? $user->id : 'null'); // Can be null because member can be create by a guest
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
// If we change the type of membership, we set also label of new type
|
||||
if (!empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid) {
|
||||
$sql2 = "SELECT libelle as label";
|
||||
$sql2 .= " FROM " . MAIN_DB_PREFIX . "adherent_type";
|
||||
$sql2 .= " WHERE rowid = " . $this->typeid;
|
||||
$sql2 .= " FROM ".MAIN_DB_PREFIX."adherent_type";
|
||||
$sql2 .= " WHERE rowid = ".$this->typeid;
|
||||
$resql2 = $this->db->query($sql2);
|
||||
if ($resql2) {
|
||||
while ($obj = $this->db->fetch_object($resql2)) {
|
||||
@ -643,7 +643,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::update update member", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
unset($this->country_code);
|
||||
@ -666,7 +666,7 @@ class Adherent extends CommonObject
|
||||
|
||||
// Update password
|
||||
if (!$error && $this->pass) {
|
||||
dol_syslog(get_class($this) . "::update update password");
|
||||
dol_syslog(get_class($this)."::update update password");
|
||||
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) {
|
||||
$isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1;
|
||||
|
||||
@ -678,9 +678,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove links to user and replace with new one
|
||||
if (!$error) {
|
||||
dol_syslog(get_class($this) . "::update update link to user");
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL WHERE fk_member = " . $this->id;
|
||||
dol_syslog(get_class($this) . "::update", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update update link to user");
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id;
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -689,8 +689,8 @@ class Adherent extends CommonObject
|
||||
}
|
||||
// If there is a user linked to this member
|
||||
if ($this->user_id > 0) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = " . $this->id . " WHERE rowid = " . $this->user_id;
|
||||
dol_syslog(get_class($this) . "::update", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id." WHERE rowid = ".$this->user_id;
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -704,9 +704,9 @@ class Adherent extends CommonObject
|
||||
{
|
||||
// Update information on linked user if it is an update
|
||||
if (!$error && $this->user_id > 0 && !$nosyncuser) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
dol_syslog(get_class($this) . "::update update linked user");
|
||||
dol_syslog(get_class($this)."::update update linked user");
|
||||
|
||||
$luser = new User($this->db);
|
||||
$result = $luser->fetch($this->user_id);
|
||||
@ -743,7 +743,7 @@ class Adherent extends CommonObject
|
||||
$result = $luser->update($user, 0, 1, 1); // Use nosync to 1 to avoid cyclic updates
|
||||
if ($result < 0) {
|
||||
$this->error = $luser->error;
|
||||
dol_syslog(get_class($this) . "::update " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -754,9 +754,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Update information on linked thirdparty if it is an update
|
||||
if (!$error && $this->fk_soc > 0 && !$nosyncthirdparty) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
|
||||
dol_syslog(get_class($this) . "::update update linked thirdparty");
|
||||
dol_syslog(get_class($this)."::update update linked thirdparty");
|
||||
|
||||
// This member is linked with a thirdparty, so we also update thirdparty informations
|
||||
// if this is an update.
|
||||
@ -779,7 +779,7 @@ class Adherent extends CommonObject
|
||||
if ($result < 0) {
|
||||
$this->error = $lthirdparty->error;
|
||||
$this->errors = $lthirdparty->errors;
|
||||
dol_syslog(get_class($this) . "::update " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
} elseif ($result < 0) {
|
||||
@ -828,11 +828,11 @@ class Adherent extends CommonObject
|
||||
|
||||
// Search for last subscription id and end date
|
||||
$sql = "SELECT rowid, datec as dateop, dateadh as datedeb, datef as datefin";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "subscription";
|
||||
$sql .= " WHERE fk_adherent=" . $this->id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."subscription";
|
||||
$sql .= " WHERE fk_adherent=".$this->id;
|
||||
$sql .= " ORDER by dateadh DESC"; // Sort by start subscription date
|
||||
|
||||
dol_syslog(get_class($this) . "::update_end_date", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@ -840,11 +840,11 @@ class Adherent extends CommonObject
|
||||
$datedeb = $this->db->jdate($obj->datedeb);
|
||||
$datefin = $this->db->jdate($obj->datefin);
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql .= " datefin=" . ($datefin != '' ? "'" . $this->db->idate($datefin) . "'" : "null");
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " datefin=".($datefin != '' ? "'".$this->db->idate($datefin)."'" : "null");
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::update_end_date", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::update_end_date", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->last_subscription_date = $dateop;
|
||||
@ -893,8 +893,8 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
// Remove category
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "categorie_member WHERE fk_member = " . $rowid;
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -904,8 +904,8 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove subscription
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "subscription WHERE fk_adherent = " . $rowid;
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE fk_adherent = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -932,15 +932,15 @@ class Adherent extends CommonObject
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$errorflag = -4;
|
||||
dol_syslog(get_class($this) . "::delete erreur " . $errorflag . " " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove adherent
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "adherent WHERE rowid = " . $rowid;
|
||||
dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."adherent WHERE rowid = ".$rowid;
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
@ -975,11 +975,11 @@ class Adherent extends CommonObject
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this) . "::setPassword user=" . $user->id . " password=" . preg_replace('/./i', '*', $password) . " isencrypted=" . $isencrypted);
|
||||
dol_syslog(get_class($this)."::setPassword user=".$user->id." password=".preg_replace('/./i', '*', $password)." isencrypted=".$isencrypted);
|
||||
|
||||
// If new password not provided, we generate one
|
||||
if (!$password) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
$password = getRandomPassword(false);
|
||||
}
|
||||
|
||||
@ -994,18 +994,18 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// Mise a jour
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " SET pass_crypted = '" . $this->db->escape($password_crypted) . "'";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " SET pass_crypted = '".$this->db->escape($password_crypted)."'";
|
||||
//if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
|
||||
if ($isencrypted) {
|
||||
$sql .= ", pass = null";
|
||||
} else {
|
||||
$sql .= ", pass = '" . $this->db->escape($password_indatabase) . "'";
|
||||
$sql .= ", pass = '".$this->db->escape($password_indatabase)."'";
|
||||
}
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
//dol_syslog("Adherent::Password sql=hidden");
|
||||
dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setPassword", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$nbaffectedrows = $this->db->affected_rows($result);
|
||||
@ -1016,7 +1016,7 @@ class Adherent extends CommonObject
|
||||
$this->pass_indatabase_crypted = $password_crypted;
|
||||
|
||||
if ($this->user_id && !$nosyncuser) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
// This member is linked with a user, so we also update users informations
|
||||
// if this is an update.
|
||||
@ -1027,7 +1027,7 @@ class Adherent extends CommonObject
|
||||
$result = $luser->setPassword($user, $this->pass, 0, 0, 1);
|
||||
if ($result < 0) {
|
||||
$this->error = $luser->error;
|
||||
dol_syslog(get_class($this) . "::setPassword " . $this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
@ -1074,8 +1074,8 @@ class Adherent extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
// If user is linked to this member, remove old link to this member
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL WHERE fk_member = " . $this->id;
|
||||
dol_syslog(get_class($this) . "::setUserId", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL WHERE fk_member = ".$this->id;
|
||||
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -1085,9 +1085,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Set link to user
|
||||
if ($userid > 0) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = " . $this->id;
|
||||
$sql .= " WHERE rowid = " . $userid;
|
||||
dol_syslog(get_class($this) . "::setUserId", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$userid;
|
||||
dol_syslog(get_class($this)."::setUserId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$this->error = $this->db->error();
|
||||
@ -1116,18 +1116,18 @@ class Adherent extends CommonObject
|
||||
|
||||
// Remove link to third party onto any other members
|
||||
if ($thirdpartyid > 0) {
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET fk_soc = null";
|
||||
$sql .= " WHERE fk_soc = '" . $thirdpartyid . "'";
|
||||
$sql .= " AND entity = " . $conf->entity;
|
||||
dol_syslog(get_class($this) . "::setThirdPartyId", LOG_DEBUG);
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = null";
|
||||
$sql .= " WHERE fk_soc = '".$thirdpartyid."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
}
|
||||
|
||||
// Add link to third party for current member
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET fk_soc = " . ($thirdpartyid > 0 ? $thirdpartyid : 'null');
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = ".($thirdpartyid > 0 ? $thirdpartyid : 'null');
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::setThirdPartyId", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::setThirdPartyId", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->db->commit();
|
||||
@ -1152,9 +1152,9 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " WHERE login='" . $this->db->escape($login) . "'";
|
||||
$sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE login='".$this->db->escape($login)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1180,10 +1180,10 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "adherent";
|
||||
$sql .= " WHERE firstname='" . $this->db->escape($firstname) . "'";
|
||||
$sql .= " AND lastname='" . $this->db->escape($lastname) . "'";
|
||||
$sql .= " AND entity = " . $conf->entity;
|
||||
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
|
||||
$sql .= " WHERE firstname='".$this->db->escape($firstname)."'";
|
||||
$sql .= " AND lastname='".$this->db->escape($lastname)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1227,24 +1227,24 @@ class Adherent extends CommonObject
|
||||
$sql .= " dep.nom as state, dep.code_departement as state_code,";
|
||||
$sql .= " t.libelle as type, t.subscription as subscription,";
|
||||
$sql .= " u.rowid as user_id, u.login as user_login";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent_type as t, " . MAIN_DB_PREFIX . "adherent as d";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON d.country = c.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as dep ON d.state_id = dep.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u ON d.rowid = u.fk_member";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as dep ON d.state_id = dep.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON d.rowid = u.fk_member";
|
||||
$sql .= " WHERE d.fk_adherent_type = t.rowid";
|
||||
if ($rowid)
|
||||
$sql .= " AND d.rowid=" . $rowid;
|
||||
$sql .= " AND d.rowid=".$rowid;
|
||||
elseif ($ref || $fk_soc) {
|
||||
$sql .= " AND d.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND d.entity IN (".getEntity('adherent').")";
|
||||
if ($ref)
|
||||
$sql .= " AND d.rowid='" . $this->db->escape($ref) . "'";
|
||||
$sql .= " AND d.rowid='".$this->db->escape($ref)."'";
|
||||
elseif ($fk_soc > 0)
|
||||
$sql .= " AND d.fk_soc=" . $fk_soc;
|
||||
$sql .= " AND d.fk_soc=".$fk_soc;
|
||||
} elseif ($ref_ext) {
|
||||
$sql .= " AND d.ref_ext='" . $this->db->escape($ref_ext) . "'";
|
||||
$sql .= " AND d.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
if ($this->db->num_rows($resql)) {
|
||||
@ -1257,7 +1257,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
|
||||
$this->civility_code = $obj->civility_code;
|
||||
$this->civility = $obj->civility_code ? ($langs->trans("Civility" . $obj->civility_code) != ("Civility" . $obj->civility_code) ? $langs->trans("Civility" . $obj->civility_code) : $obj->civility_code) : '';
|
||||
$this->civility = $obj->civility_code ? ($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code) : '';
|
||||
|
||||
$this->firstname = $obj->firstname;
|
||||
$this->lastname = $obj->lastname;
|
||||
@ -1281,8 +1281,8 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_code;
|
||||
if ($langs->trans("Country" . $obj->country_code) != "Country" . $obj->country_code)
|
||||
$this->country = $langs->transnoentitiesnoconv("Country" . $obj->country_code);
|
||||
if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code)
|
||||
$this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code);
|
||||
else
|
||||
$this->country = $obj->country;
|
||||
|
||||
@ -1354,17 +1354,17 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.subscription, c.note, c.fk_bank,";
|
||||
$sql = "SELECT c.rowid, c.fk_adherent, c.fk_type, c.subscription, c.note, c.fk_bank,";
|
||||
$sql .= " c.tms as datem,";
|
||||
$sql .= " c.datec as datec,";
|
||||
$sql .= " c.dateadh as dateh,";
|
||||
$sql .= " c.datef as datef";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "subscription as c";
|
||||
$sql .= " WHERE c.fk_adherent = " . $this->id;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."subscription as c";
|
||||
$sql .= " WHERE c.fk_adherent = ".$this->id;
|
||||
$sql .= " ORDER BY c.dateadh";
|
||||
dol_syslog(get_class($this) . "::fetch_subscriptions", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch_subscriptions", LOG_DEBUG);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1386,6 +1386,7 @@ class Adherent extends CommonObject
|
||||
$subscription = new Subscription($this->db);
|
||||
$subscription->id = $obj->rowid;
|
||||
$subscription->fk_adherent = $obj->fk_adherent;
|
||||
$subscription->fk_type = $obj->fk_type;
|
||||
$subscription->amount = $obj->subscription;
|
||||
$subscription->note = $obj->note;
|
||||
$subscription->fk_bank = $obj->fk_bank;
|
||||
@ -1400,7 +1401,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
$this->error = $this->db->error() . ' sql=' . $sql;
|
||||
$this->error = $this->db->error().' sql='.$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -1424,7 +1425,7 @@ class Adherent extends CommonObject
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
@ -1504,12 +1505,12 @@ class Adherent extends CommonObject
|
||||
|
||||
$this->invoice = null; // This will contains invoice if an invoice is created
|
||||
|
||||
dol_syslog("subscriptionComplementaryActions subscriptionid=" . $subscriptionid . " option=" . $option . " accountid=" . $accountid . " datesubscription=" . $datesubscription . " paymentdate=" .
|
||||
$paymentdate . " label=" . $label . " amount=" . $amount . " num_chq=" . $num_chq . " autocreatethirdparty=" . $autocreatethirdparty);
|
||||
dol_syslog("subscriptionComplementaryActions subscriptionid=".$subscriptionid." option=".$option." accountid=".$accountid." datesubscription=".$datesubscription." paymentdate=".
|
||||
$paymentdate." label=".$label." amount=".$amount." num_chq=".$num_chq." autocreatethirdparty=".$autocreatethirdparty);
|
||||
|
||||
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
|
||||
if ($option == 'bankdirect' && $accountid) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$acct = new Account($this->db);
|
||||
$result = $acct->fetch($accountid);
|
||||
@ -1518,11 +1519,11 @@ class Adherent extends CommonObject
|
||||
|
||||
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, '', $user, $emetteur_nom, $emetteur_banque);
|
||||
if ($insertid > 0) {
|
||||
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT . '/adherents/card.php?rowid=', $this->getFullname($langs), 'member');
|
||||
$inserturlid = $acct->add_url_line($insertid, $this->id, DOL_URL_ROOT.'/adherents/card.php?rowid=', $this->getFullname($langs), 'member');
|
||||
if ($inserturlid > 0) {
|
||||
// Update table subscription
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "subscription SET fk_bank=" . $insertid;
|
||||
$sql .= " WHERE rowid=" . $subscriptionid;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET fk_bank=".$insertid;
|
||||
$sql .= " WHERE rowid=".$subscriptionid;
|
||||
|
||||
dol_syslog("subscription::subscription", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -1545,8 +1546,8 @@ class Adherent extends CommonObject
|
||||
|
||||
// If option choosed, we create invoice
|
||||
if (($option == 'bankviainvoice' && $accountid) || $option == 'invoiceonly') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/paymentterm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
|
||||
|
||||
$invoice = new Facture($this->db);
|
||||
$customer = new Societe($this->db);
|
||||
@ -1658,9 +1659,9 @@ class Adherent extends CommonObject
|
||||
|
||||
// Add payment onto invoice
|
||||
if (!$error && $option == 'bankviainvoice' && $accountid) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
$amounts = array();
|
||||
$amounts[$invoice->id] = price2num($amount);
|
||||
@ -1694,8 +1695,8 @@ class Adherent extends CommonObject
|
||||
|
||||
if (!$error && !empty($bank_line_id)) {
|
||||
// Update fk_bank into subscription table
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'subscription SET fk_bank=' . $bank_line_id;
|
||||
$sql .= ' WHERE rowid=' . $subscriptionid;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'subscription SET fk_bank='.$bank_line_id;
|
||||
$sql .= ' WHERE rowid='.$subscriptionid;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
@ -1750,19 +1751,19 @@ class Adherent extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 1) {
|
||||
dol_syslog(get_class($this) . "::validate statut of member does not allow this", LOG_WARNING);
|
||||
dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = 1";
|
||||
$sql .= ", datevalid = '" . $this->db->idate($now) . "'";
|
||||
$sql .= ", fk_user_valid=" . $user->id;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql .= ", datevalid = '".$this->db->idate($now)."'";
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this) . "::validate", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::validate", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->statut = 1;
|
||||
@ -1802,16 +1803,16 @@ class Adherent extends CommonObject
|
||||
|
||||
// Check parameters
|
||||
if ($this->statut == 0) {
|
||||
dol_syslog(get_class($this) . "::resiliate statut of member does not allow this", LOG_WARNING);
|
||||
dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "adherent SET";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET";
|
||||
$sql .= " statut = 0";
|
||||
$sql .= ", fk_user_valid=" . $user->id;
|
||||
$sql .= " WHERE rowid = " . $this->id;
|
||||
$sql .= ", fk_user_valid=".$user->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
@ -1847,7 +1848,7 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
|
||||
$mailmanspip = new MailmanSpip($this->db);
|
||||
|
||||
$err = 0;
|
||||
@ -1897,7 +1898,7 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php';
|
||||
$mailmanspip = new MailmanSpip($this->db);
|
||||
|
||||
$err = 0;
|
||||
@ -1948,7 +1949,7 @@ class Adherent extends CommonObject
|
||||
|
||||
$code = (empty($this->civility_id) ? '' : $this->civility_id);
|
||||
if (empty($code)) return '';
|
||||
return $langs->getLabelFromKey($this->db, "Civility" . $code, "c_civility", "code", "label", $code);
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1981,15 +1982,15 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
$label .= '<div class="centpercent">';
|
||||
$label .= '<u>' . $langs->trans("Member") . '</u>';
|
||||
if (!empty($this->ref)) $label .= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
|
||||
if (!empty($this->company)) $label .= '<br><b>' . $langs->trans('Company') . ':</b> ' . $this->company;
|
||||
$label .= '<u>'.$langs->trans("Member").'</u>';
|
||||
if (!empty($this->ref)) $label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
if (!empty($this->firstname) || !empty($this->lastname)) $label .= '<br><b>'.$langs->trans('Name').':</b> '.$this->getFullName($langs);
|
||||
if (!empty($this->company)) $label .= '<br><b>'.$langs->trans('Company').':</b> '.$this->company;
|
||||
$label .= '</div>';
|
||||
|
||||
$url = DOL_URL_ROOT . '/adherents/card.php?rowid=' . $this->id;
|
||||
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
|
||||
if ($option == 'subscription') {
|
||||
$url = DOL_URL_ROOT . '/adherents/subscription.php?rowid=' . $this->id;
|
||||
$url = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$this->id;
|
||||
}
|
||||
|
||||
if ($option != 'nolink') {
|
||||
@ -1999,19 +2000,19 @@ class Adherent extends CommonObject
|
||||
if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$linkstart .= '<a href="' . $url . '"';
|
||||
$linkstart .= '<a href="'.$url.'"';
|
||||
$linkclose = "";
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
$langs->load("users");
|
||||
$label = $langs->trans("ShowUser");
|
||||
$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
|
||||
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
|
||||
$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
|
||||
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
|
||||
}
|
||||
|
||||
$linkstart .= $linkclose . '>';
|
||||
$linkstart .= $linkclose.'>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
@ -2021,19 +2022,19 @@ class Adherent extends CommonObject
|
||||
if (abs($withpictoimg) == 1) $paddafterimage = 'style="margin-right: 3px;"';
|
||||
// Only picto
|
||||
if ($withpictoimg > 0)
|
||||
$picto = '<span class="nopadding' . ($morecss ? ' userimg' . $morecss : '') . '">' .
|
||||
img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</span>';
|
||||
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'">'.
|
||||
img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</span>';
|
||||
// Picto must be a photo
|
||||
else {
|
||||
$picto = '<span class="nopadding' . ($morecss ? ' userimg' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>';
|
||||
$picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1);
|
||||
$picto = '<span class="nopadding'.($morecss ? ' userimg'.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>';
|
||||
$picto .= Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1);
|
||||
$picto .= '</span>';
|
||||
}
|
||||
$result .= $picto;
|
||||
}
|
||||
if ($withpictoimg > -2 && $withpictoimg != 2) {
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<span class="nopadding valignmiddle' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') .
|
||||
($morecss ? ' usertext' . $morecss : '') . '">';
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= '<span class="nopadding valignmiddle'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').
|
||||
($morecss ? ' usertext'.$morecss : '').'">';
|
||||
if ($mode == 'login')
|
||||
$result .= dol_trunc($this->login, $maxlen);
|
||||
elseif ($mode == 'ref')
|
||||
@ -2125,9 +2126,9 @@ class Adherent extends CommonObject
|
||||
$this->nb = array();
|
||||
|
||||
$sql = "SELECT count(a.rowid) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= " WHERE a.statut > 0";
|
||||
$sql .= " AND a.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -2161,16 +2162,16 @@ class Adherent extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
$sql = "SELECT a.rowid, a.datefin, a.statut";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a";
|
||||
$sql .= ", " . MAIN_DB_PREFIX . "adherent_type as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||
$sql .= " WHERE a.fk_adherent_type = t.rowid";
|
||||
if ($mode == 'expired') {
|
||||
$sql .= " AND a.statut = 1";
|
||||
$sql .= " AND a.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND ((a.datefin IS NULL or a.datefin < '" . $this->db->idate($now) . "') AND t.subscription = 1)";
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
$sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)";
|
||||
} elseif ($mode == 'shift') {
|
||||
$sql .= " AND a.statut = -1";
|
||||
$sql .= " AND a.entity IN (" . getEntity('adherent') . ")";
|
||||
$sql .= " AND a.entity IN (".getEntity('adherent').")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2186,10 +2187,10 @@ class Adherent extends CommonObject
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$label = $langs->trans("MembersWithSubscriptionToReceive");
|
||||
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||
$url = DOL_URL_ROOT . '/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
} elseif ($mode == 'shift') {
|
||||
$warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24;
|
||||
$url = DOL_URL_ROOT . '/adherents/list.php?mainmenu=members&statut=-1';
|
||||
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1';
|
||||
$label = $langs->trans("MembersListToValid");
|
||||
$labelShort = $langs->trans("ToValidate");
|
||||
}
|
||||
@ -2330,9 +2331,9 @@ class Adherent extends CommonObject
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$dn = '';
|
||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS . "=" . $info[$conf->global->LDAP_KEY_MEMBERS] . "," . $conf->global->LDAP_MEMBER_DN;
|
||||
if ($mode == 0) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN;
|
||||
if ($mode == 1) $dn = $conf->global->LDAP_MEMBER_DN;
|
||||
if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS . "=" . $info[$conf->global->LDAP_KEY_MEMBERS];
|
||||
if ($mode == 2) $dn = $conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS];
|
||||
return $dn;
|
||||
}
|
||||
|
||||
@ -2412,7 +2413,7 @@ class Adherent extends CommonObject
|
||||
if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) {
|
||||
// Create OpenLDAP MD5 password from Dolibarr MD5 password
|
||||
// Note: This suppose that "pass_indatabase_crypted" is a md5 (guaranted by the previous test if "(empty($conf->global->MAIN_SECURITY_HASH_ALGO))"
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}' . base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||
$info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = '{md5}'.base64_encode(hex2bin($this->pass_indatabase_crypted));
|
||||
}
|
||||
}
|
||||
} // Use $this->pass_indatabase value if exists
|
||||
@ -2444,10 +2445,10 @@ class Adherent extends CommonObject
|
||||
$sql .= ' a.datevalid as datev,';
|
||||
$sql .= ' a.tms as datem,';
|
||||
$sql .= ' a.fk_user_author, a.fk_user_valid, a.fk_user_mod';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'adherent as a';
|
||||
$sql .= ' WHERE a.rowid = ' . $id;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'adherent as a';
|
||||
$sql .= ' WHERE a.rowid = '.$id;
|
||||
|
||||
dol_syslog(get_class($this) . "::info", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::info", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
if ($this->db->num_rows($result)) {
|
||||
@ -2490,8 +2491,8 @@ class Adherent extends CommonObject
|
||||
public function getNbOfEMailings()
|
||||
{
|
||||
$sql = "SELECT count(mc.email) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.email = '" . $this->db->escape($this->email) . "'";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.email = '".$this->db->escape($this->email)."'";
|
||||
$sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2525,7 +2526,7 @@ class Adherent extends CommonObject
|
||||
}
|
||||
|
||||
// Get current categories
|
||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
$c = new Categorie($this->db);
|
||||
$existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id');
|
||||
|
||||
@ -2626,7 +2627,7 @@ class Adherent extends CommonObject
|
||||
$arraydaysbeforeend = explode(';', $daysbeforeendlist);
|
||||
foreach ($arraydaysbeforeend as $daysbeforeend) // Loop on each delay
|
||||
{
|
||||
dol_syslog(__METHOD__ . ' - Process delta = ' . $daysbeforeend, LOG_DEBUG);
|
||||
dol_syslog(__METHOD__.' - Process delta = '.$daysbeforeend, LOG_DEBUG);
|
||||
|
||||
if (!is_numeric($daysbeforeend)) {
|
||||
$blockingerrormsg = "Value for delta is not a positive or negative numeric";
|
||||
@ -2637,15 +2638,15 @@ class Adherent extends CommonObject
|
||||
$tmp = dol_getdate($now);
|
||||
$datetosearchfor = dol_time_plus_duree(dol_mktime(0, 0, 0, $tmp['mon'], $tmp['mday'], $tmp['year']), $daysbeforeend, 'd');
|
||||
|
||||
$sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'adherent';
|
||||
$sql .= " WHERE entity = " . $conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '" . $this->db->idate($datetosearchfor) . "'";
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'adherent';
|
||||
$sql .= " WHERE entity = ".$conf->entity; // Do not use getEntity('adherent').")" here, we want the batch to be on its entity only;
|
||||
$sql .= " AND datefin = '".$this->db->idate($datetosearchfor)."'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num_rows = $this->db->num_rows($resql);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$adherent = new Adherent($this->db);
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
@ -2669,7 +2670,7 @@ class Adherent extends CommonObject
|
||||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($languagecodeformember);
|
||||
$outputlangs->loadLangs(array("main", "members"));
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id " . $adherent->id . " set to " . $outputlangs->defaultlang . " mysoc->default_lang=" . $mysoc->default_lang);
|
||||
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);
|
||||
|
||||
$arraydefaultmessage = null;
|
||||
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
|
||||
@ -2686,10 +2687,10 @@ class Adherent extends CommonObject
|
||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||
$to = $adherent->email;
|
||||
|
||||
$trackid = 'mem' . $adherent->id;
|
||||
$moreinheader = 'X-Dolibarr-Info: sendReminderForExpiredSubscription' . "\r\n";
|
||||
$trackid = 'mem'.$adherent->id;
|
||||
$moreinheader = 'X-Dolibarr-Info: sendReminderForExpiredSubscription'."\r\n";
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, $moreinheader);
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result) {
|
||||
@ -2712,24 +2713,24 @@ class Adherent extends CommonObject
|
||||
$extraparams = '';
|
||||
|
||||
$actionmsg = '';
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy') . ' ' . CMailFile::getValidAddress($from, 4, 0, 1) . ' ' . $langs->transnoentities('To') . ' ' .
|
||||
$actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.
|
||||
CMailFile::getValidAddress($sendto, 4, 0, 1);
|
||||
if ($message) {
|
||||
$actionmsg = $langs->transnoentities('MailFrom') . ': ' . dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo') . ': ' . dol_escape_htmltag($sendto));
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
|
||||
if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
||||
// Insert record of emails sent
|
||||
$actioncomm = new ActionComm($this->db);
|
||||
|
||||
$actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$actioncomm->code = 'AC_' . $actioncode;
|
||||
$actioncomm->code = 'AC_'.$actioncode;
|
||||
$actioncomm->label = $actionmsg2;
|
||||
$actioncomm->note_private = $actionmsg;
|
||||
$actioncomm->fk_project = 0;
|
||||
@ -2779,8 +2780,8 @@ class Adherent extends CommonObject
|
||||
$this->error = $blockingerrormsg;
|
||||
return 1;
|
||||
} else {
|
||||
$this->output = 'Found ' . ($nbok + $nbko) . ' members to send reminder to.';
|
||||
$this->output .= ' Send email successfuly to ' . $nbok . ' members';
|
||||
$this->output = 'Found '.($nbok + $nbko).' members to send reminder to.';
|
||||
$this->output .= ' Send email successfuly to '.$nbok.' members';
|
||||
if (is_array($listofmembersok)) {
|
||||
$listofids = '';
|
||||
$i = 0;
|
||||
@ -2800,7 +2801,7 @@ class Adherent extends CommonObject
|
||||
$this->output .= $listofids;
|
||||
}
|
||||
if ($nbko) {
|
||||
$this->output .= ' - Canceled for ' . $nbko . ' member (no email or email sending error)';
|
||||
$this->output .= ' - Canceled for '.$nbko.' member (no email or email sending error)';
|
||||
if (is_array($listofmembersko)) {
|
||||
$listofids = '';
|
||||
$i = 0;
|
||||
|
||||
@ -47,7 +47,7 @@ $result=restrictedArea($user, 'adherent', $id);
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -176,11 +176,9 @@ if ($conf->use_javascript_ajax)
|
||||
$SommeD = 0;
|
||||
$total = 0;
|
||||
$dataval = array();
|
||||
$datalabels = array();
|
||||
$i = 0;
|
||||
foreach ($AdherentType as $key => $adhtype)
|
||||
{
|
||||
$datalabels[] = array($i, $adhtype->getNomUrl(0, dol_size(16)));
|
||||
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
|
||||
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
|
||||
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
|
||||
@ -198,13 +196,16 @@ if ($conf->use_javascript_ajax)
|
||||
$dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
|
||||
$dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ if ($statut < -1) $statut = '';
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -49,7 +49,7 @@ $typeid = GETPOST('typeid', 'int');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -54,7 +54,7 @@ $date_select = GETPOST("date_select", 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -50,7 +50,7 @@ $status = GETPOST('status', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -48,7 +48,7 @@ $constnote=GETPOST('constnote', 'alpha');
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -44,7 +44,7 @@ $mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'createform'; // 'cre
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -70,7 +70,7 @@ $active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -767,7 +767,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
|
||||
if ($keycode == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
{
|
||||
$sql .= "'".(int) GETPOST('position', 'int');
|
||||
$sql .= "'".(int) GETPOST('position', 'int')."'";
|
||||
}
|
||||
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
elseif ($keycode == 'content') {
|
||||
|
||||
@ -53,7 +53,7 @@ $id = GETPOST('id', 'int');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -36,12 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminihm'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
|
||||
|
||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD", "");
|
||||
if (!defined("MAIN_MOTD")) define("MAIN_MOTD", "");
|
||||
|
||||
|
||||
|
||||
@ -49,13 +49,13 @@ if (! defined("MAIN_MOTD")) define("MAIN_MOTD", "");
|
||||
* Action
|
||||
*/
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$action='';
|
||||
$action = '';
|
||||
}
|
||||
|
||||
// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
|
||||
@ -65,15 +65,15 @@ if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
|
||||
else dolibarr_del_const($db, $regs[2], $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
||||
if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND))
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||
$logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||
dol_delete_file($logofile);
|
||||
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
|
||||
$mysoc->logo='';
|
||||
$mysoc->logo = '';
|
||||
|
||||
/*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
|
||||
dol_delete_file($logosmallfile);
|
||||
@ -89,7 +89,7 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
|
||||
if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
@ -98,53 +98,53 @@ if ($action == 'update')
|
||||
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
|
||||
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
|
||||
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
|
||||
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
|
||||
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
@ -156,32 +156,31 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_SHOW_LOGO", GETPOST("MAIN_SHOW_LOGO", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
|
||||
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
|
||||
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
|
||||
if ($_FILES[$varforimage]["tmp_name"])
|
||||
{
|
||||
$reg = array();
|
||||
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
|
||||
{
|
||||
$original_file=$reg[1];
|
||||
$original_file = $reg[1];
|
||||
|
||||
$isimage=image_format_supported($original_file);
|
||||
$isimage = image_format_supported($original_file);
|
||||
if ($isimage >= 0)
|
||||
{
|
||||
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
|
||||
if (! is_dir($dirforimage))
|
||||
if (!is_dir($dirforimage))
|
||||
{
|
||||
dol_mkdir($dirforimage);
|
||||
}
|
||||
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
|
||||
if ($result > 0)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
|
||||
@ -190,7 +189,7 @@ if ($action == 'update')
|
||||
{
|
||||
$error++;
|
||||
$langs->load("errors");
|
||||
$tmparray=explode(':', $result);
|
||||
$tmparray = explode(':', $result);
|
||||
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
|
||||
}
|
||||
else
|
||||
@ -210,7 +209,7 @@ if ($action == 'update')
|
||||
|
||||
|
||||
|
||||
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
|
||||
$_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -221,12 +220,12 @@ if ($action == 'update')
|
||||
* View
|
||||
*/
|
||||
|
||||
$wikihelp='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('', $langs->trans("Setup"), $wikihelp);
|
||||
|
||||
$form=new Form($db);
|
||||
$formother=new FormOther($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
|
||||
|
||||
@ -282,12 +281,12 @@ print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max size of lists
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'"></td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max size of short lists on customer card
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="'.$conf->global->MAIN_SIZE_SHORTLIST_LIMIT.'"></td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -302,36 +301,36 @@ print '</tr>';
|
||||
|
||||
// First day for weeks
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
|
||||
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0);
|
||||
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingDays
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5').'">';
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// DefaultWorkingHours
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
|
||||
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18').'">';
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Firstname/Name
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
|
||||
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
|
||||
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
|
||||
$array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
|
||||
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide unauthorized button
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
|
||||
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1);
|
||||
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -354,28 +353,28 @@ print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Hide wiki link on login page
|
||||
$pictohelp='<span class="fa fa-question-circle"></span>';
|
||||
$pictohelp = '<span class="fa fa-question-circle"></span>';
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>';
|
||||
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1);
|
||||
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Message of the day on home page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
|
||||
print '<tr class="oddeven"><td class="titlefield">';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
$texthelp .= $key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
|
||||
|
||||
print '</td><td colspan="2">';
|
||||
|
||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
|
||||
print '</td></tr>'."\n";
|
||||
@ -392,23 +391,23 @@ print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
// Message on login page
|
||||
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
|
||||
complete_substitutions_array($substitutionarray, $langs);
|
||||
print '<tr class="oddeven"><td>';
|
||||
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach($substitutionarray as $key => $val)
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp.=$key.'<br>';
|
||||
$texthelp .= $key.'<br>';
|
||||
}
|
||||
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
|
||||
print '</td><td colspan="2">';
|
||||
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
|
||||
$doleditor->Create();
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Hide helpcenter link on login page
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
|
||||
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1);
|
||||
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK) ? $conf->global->MAIN_HELPCENTER_DISABLELINK : 0, 1);
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
print '</tr>';
|
||||
@ -417,13 +416,13 @@ print '</tr>';
|
||||
print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
|
||||
print '<div class="centpercent inline-block">';
|
||||
$disabled = '';
|
||||
if (! empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
|
||||
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
|
||||
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground"'.$disabled.'>';
|
||||
if ($disabled)
|
||||
{
|
||||
print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') ';
|
||||
}
|
||||
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
|
||||
print ' ';
|
||||
|
||||
@ -48,7 +48,7 @@ $id = GETPOST('id', 'int');
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -71,7 +71,7 @@ $active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -197,6 +197,7 @@ dol_fiche_end();
|
||||
|
||||
print load_fiche_titre($langs->trans("TicketNumberingModules"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
@ -287,7 +288,9 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
|
||||
@ -167,7 +167,7 @@ $head = ticketAdminPrepareHead();
|
||||
|
||||
dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a href="'.dol_buildpath('/public/ticket/index.php', 1).'" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.dol_buildpath('/public/ticket/index.php', 1).'" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -176,14 +176,14 @@ $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
@ -200,6 +200,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
print '<input type="hidden" name="action" value="setvarother">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td class="left">';
|
||||
@ -279,7 +280,9 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '</form>';
|
||||
@ -288,6 +291,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
// Admin var of module
|
||||
print load_fiche_titre($langs->trans("TicketParamMail"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
@ -369,13 +373,14 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'" size="40" ></td>';
|
||||
print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'"></td>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ $action = GETPOST('action', 'alpha');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "date";
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
|
||||
@ -39,7 +39,7 @@ $file=GETPOST('filename_template', 'alpha');
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
@ -41,7 +41,7 @@ $file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2)$/i', '', $file);
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="date";
|
||||
if ($page < 0) { $page = 0; }
|
||||
|
||||
@ -48,7 +48,7 @@ $langs->loadLangs(array("companies", "admin", "users", "other"));
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -43,7 +43,7 @@ if ($user->socid > 0)
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page ;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -45,7 +45,7 @@ $mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'overwrite';
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -55,7 +55,7 @@ $status = 1;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -48,7 +48,7 @@ $status = 1;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -47,7 +47,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -49,7 +49,7 @@ $id = GETPOST('id', 'int');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -43,7 +43,7 @@ $type = GETPOST('type', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -58,7 +58,7 @@ if (($search_start == -1 || empty($search_start)) && ! GETPOSTISSET('search_star
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -60,7 +60,7 @@ $search_agenda_label = GETPOST('search_agenda_label');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -48,7 +48,7 @@ $ref = GETPOST('ref', 'alpha');
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -47,7 +47,7 @@ $id = GETPOST('id', 'int');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -32,6 +32,7 @@ function printDropdownBookmarksList()
|
||||
global $conf, $user, $db, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
@ -60,6 +61,7 @@ function printDropdownBookmarksList()
|
||||
|
||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
$searchForm .= '<form id="top-menu-action-bookmark" name="actionbookmark" method="POST" action="" onsubmit="return false" >';
|
||||
$searchForm .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
|
||||
$searchForm .= '</form>';
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -305,6 +305,7 @@ switch ($action)
|
||||
$payment->note=$langs->trans("Payment").' '.$langs->trans("Invoice").' '.$obj_facturation->numInvoice();
|
||||
$payment->paiementid=$invoice->mode_reglement_id;
|
||||
$payment->num_paiement='';
|
||||
$payment->num_payment='';
|
||||
|
||||
$paiement_id = $payment->create($user);
|
||||
if ($paiement_id > 0)
|
||||
|
||||
@ -1912,8 +1912,8 @@ class Categorie extends CommonObject
|
||||
/**
|
||||
* Return label of contact status
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of contact status
|
||||
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @return string Label of contact status
|
||||
*/
|
||||
public function getLibStatut($mode)
|
||||
{
|
||||
@ -1968,8 +1968,9 @@ class Categorie extends CommonObject
|
||||
*/
|
||||
public static function getFilterJoinQuery($type, $rowIdName)
|
||||
{
|
||||
return " LEFT JOIN ".MAIN_DB_PREFIX."categorie_".$type." as cp"
|
||||
. " ON ".$rowIdName." = cp.fk_".$type;
|
||||
if ($type == 'bank_account') $type = 'account';
|
||||
|
||||
return " LEFT JOIN ".MAIN_DB_PREFIX."categorie_".$type." as cp ON ".$rowIdName." = cp.fk_".$type;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1982,6 +1983,8 @@ class Categorie extends CommonObject
|
||||
*/
|
||||
public static function getFilterSelectQuery($type, $rowIdName, $searchList)
|
||||
{
|
||||
if ($type == 'bank_account') $type = 'account';
|
||||
|
||||
if (empty($searchList) && !is_array($searchList))
|
||||
{
|
||||
return "";
|
||||
|
||||
@ -55,7 +55,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -64,7 +64,7 @@ if ($id > 0)
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -58,7 +58,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", "int");
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
@ -94,7 +94,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if ($page == -1 || $page == null) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
if (!$sortorder)
|
||||
|
||||
@ -56,7 +56,7 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS))
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", "int");
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
@ -56,7 +56,7 @@ $showbirthday = 0;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", "int");
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$offset = $limit * $page;
|
||||
|
||||
@ -41,7 +41,7 @@ $year=GETPOST('year');
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if ($page == -1 || $page == null) { $page = 0 ; }
|
||||
$offset = $limit * $page ;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
@ -67,7 +67,7 @@ $mode = GETPOST("mode");
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -751,7 +751,7 @@ if ($object->id > 0)
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
$sql .= " AND c.entity IN (".getEntity('commande').')';
|
||||
$sql .= " ORDER BY c.date_commande DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -905,7 +905,7 @@ if ($object->id > 0)
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
$sql .= " AND c.entity IN (".getEntity('contract').")";
|
||||
$sql .= " ORDER BY c.datec DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -975,7 +975,7 @@ if ($object->id > 0)
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f";
|
||||
$sql .= " WHERE f.fk_soc = s.rowid";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
$sql .= " AND f.entity IN (".getEntity('intervention').")";
|
||||
$sql .= " ORDER BY f.tms DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
@ -1044,7 +1044,7 @@ if ($object->id > 0)
|
||||
$sql .= ', s.nom, s.rowid as socid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= ' GROUP BY f.rowid, f.titre, f.total, f.tva, f.total_ttc,';
|
||||
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
|
||||
$sql .= ' f.suspended, f.date_when,';
|
||||
|
||||
@ -31,7 +31,7 @@ $langs->load("companies");
|
||||
|
||||
$sortfield=GETPOST('sortfield', 'alpha');
|
||||
$sortorder=GETPOST('sortorder', 'alpha');
|
||||
$page=GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.name";
|
||||
if ($page < 0) { $page = 0; }
|
||||
|
||||
@ -48,7 +48,7 @@ if (!$user->rights->mailing->lire || $user->socid > 0)
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -43,7 +43,7 @@ if (!$user->rights->mailing->lire || $user->socid > 0) accessforbidden();
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -34,7 +34,7 @@ $result = restrictedArea($user, 'mailing');
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -1893,7 +1893,7 @@ if ($action == 'create')
|
||||
{
|
||||
//Form to close proposal (signed or not)
|
||||
$formquestion = array(
|
||||
array('type' => 'select', 'name' => 'statut', 'label' => $langs->trans("CloseAs"), 'values' => array(2=>$object->LibStatut(Propal::STATUS_SIGNED), 3=>$object->LibStatut(Propal::STATUS_NOTSIGNED))),
|
||||
array('type' => 'select', 'name' => 'statut', 'label' => '<span class="fieldrequired">'.$langs->trans("CloseAs").'</span>', 'values' => array(2=>$object->LibStatut(Propal::STATUS_SIGNED), 3=>$object->LibStatut(Propal::STATUS_NOTSIGNED))),
|
||||
array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace)
|
||||
);
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', '', $contact_list);
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -83,7 +83,7 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', '', $contact_list);
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, '', $contact_list);
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,27 +109,26 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other objec
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id, $ref, $ref_ext, $ref_int);
|
||||
if( ! $result ) {
|
||||
$result = $this->propal->fetch($id, $ref, $ref_ext);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -163,18 +162,18 @@ class Proposals extends DolibarrApi
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as t";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('propal').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('propal').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
@ -183,23 +182,23 @@ class Proposals extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
@ -214,7 +213,7 @@ class Proposals extends DolibarrApi
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$proposal_static = new Propal($db);
|
||||
if($proposal_static->fetch($obj->rowid)) {
|
||||
if ($proposal_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$proposal_static->contacts_ids = $proposal_static->liste_contact(-1, 'external', 1);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($proposal_static);
|
||||
@ -225,7 +224,7 @@ class Proposals extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No proposal found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -239,13 +238,13 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->propal->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
@ -273,16 +272,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
@ -305,16 +304,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -369,16 +368,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if($result <= 0) {
|
||||
if ($result <= 0) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -392,27 +391,27 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice)?$request_data->subprice:$propalline->subprice,
|
||||
isset($request_data->qty)?$request_data->qty:$propalline->qty,
|
||||
isset($request_data->remise_percent)?$request_data->remise_percent:$propalline->remise_percent,
|
||||
isset($request_data->tva_tx)?$request_data->tva_tx:$propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx)?$request_data->localtax1_tx:$propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx)?$request_data->localtax2_tx:$propalline->localtax2_tx,
|
||||
isset($request_data->desc)?$request_data->desc:$propalline->desc,
|
||||
isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
|
||||
isset($request_data->qty) ? $request_data->qty : $propalline->qty,
|
||||
isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
|
||||
isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
|
||||
isset($request_data->desc) ? $request_data->desc : $propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits)?$request_data->info_bits:$propalline->info_bits,
|
||||
isset($request_data->special_code)?$request_data->special_code:$propalline->special_code,
|
||||
isset($request_data->fk_parent_line)?$request_data->fk_parent_line:$propalline->fk_parent_line,
|
||||
isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
|
||||
isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
|
||||
isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice)?$request_data->fk_fournprice:$propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht)?$request_data->pa_ht:$propalline->pa_ht,
|
||||
isset($request_data->label)?$request_data->label:$propalline->label,
|
||||
isset($request_data->product_type)?$request_data->product_type:$propalline->product_type,
|
||||
isset($request_data->date_start)?$request_data->date_start:$propalline->date_start,
|
||||
isset($request_data->date_end)?$request_data->date_end:$propalline->date_end,
|
||||
isset($request_data->array_options)?$request_data->array_options:$propalline->array_options,
|
||||
isset($request_data->fk_unit)?$request_data->fk_unit:$propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice)?$request_data->multicurrency_subprice:$propalline->subprice
|
||||
isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
|
||||
isset($request_data->label) ? $request_data->label : $propalline->label,
|
||||
isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
|
||||
isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
@ -439,16 +438,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -480,13 +479,13 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
@ -494,7 +493,7 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -523,17 +522,17 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -556,16 +555,16 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach ($request_data as $field => $value) {
|
||||
@ -580,7 +579,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
if (!empty($this->propal->fin_validite))
|
||||
{
|
||||
if($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite)<0)
|
||||
if ($this->propal->set_echeance(DolibarrApiAccess::$user, $this->propal->fin_validite) < 0)
|
||||
{
|
||||
throw new RestException(500, $this->propal->error);
|
||||
}
|
||||
@ -605,19 +604,19 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
|
||||
if (!$this->propal->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
|
||||
}
|
||||
|
||||
@ -640,15 +639,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function settodraft($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -661,11 +660,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -697,15 +696,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function validate($id, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -718,11 +717,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -745,15 +744,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function close($id, $status, $note_private = '', $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -766,11 +765,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -790,15 +789,15 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if ( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -808,11 +807,11 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if ( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
|
||||
@ -223,6 +223,90 @@ class Propal extends CommonObject
|
||||
|
||||
public $oldcopy;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'position' is the sort order of field.
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
*
|
||||
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20),
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'fin_validite' =>array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>85),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'price' =>array('type'=>'double', 'label'=>'Price', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>0, 'position'=>200), // deprecated
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>220),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>225),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>235),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>260),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
/**
|
||||
* Draft status
|
||||
*/
|
||||
@ -440,8 +524,8 @@ class Propal extends CommonObject
|
||||
* @param int $date_end End date of the line
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
||||
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @param int $fk_remise_except Id discount if line is from a discount
|
||||
* @return int >0 if OK, <0 if KO
|
||||
@ -1099,6 +1183,14 @@ class Propal extends CommonObject
|
||||
$vatrate = $line->tva_tx;
|
||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||
|
||||
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
||||
$originid=$line->origin_id;
|
||||
$origintype=$line->origin;
|
||||
} else {
|
||||
$originid=$line->id;
|
||||
$origintype=$this->element;
|
||||
}
|
||||
|
||||
$result = $this->addline(
|
||||
$line->desc,
|
||||
$line->subprice,
|
||||
@ -1122,8 +1214,8 @@ class Propal extends CommonObject
|
||||
$line->date_end,
|
||||
$line->array_options,
|
||||
$line->fk_unit,
|
||||
$this->element,
|
||||
$line->id
|
||||
$origintype,
|
||||
$originid
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
@ -1369,9 +1461,10 @@ class Propal extends CommonObject
|
||||
*
|
||||
* @param int $rowid id of object to load
|
||||
* @param string $ref Ref of proposal
|
||||
* @param string $ref_ext Ref ext of proposal
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function fetch($rowid, $ref = '')
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '')
|
||||
{
|
||||
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
|
||||
$sql .= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
|
||||
@ -3249,8 +3342,8 @@ class Propal extends CommonObject
|
||||
$statusType = '';
|
||||
if ($status == self::STATUS_DRAFT) $statusType = 'status0';
|
||||
elseif ($status == self::STATUS_VALIDATED) $statusType = 'status1';
|
||||
elseif ($status == self::STATUS_SIGNED) $statusType = 'status3';
|
||||
elseif ($status == self::STATUS_NOTSIGNED) $statusType = 'status5';
|
||||
elseif ($status == self::STATUS_SIGNED) $statusType = 'status4';
|
||||
elseif ($status == self::STATUS_NOTSIGNED) $statusType = 'status9';
|
||||
elseif ($status == self::STATUS_BILLED) $statusType = 'status6';
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
|
||||
@ -24,10 +24,10 @@
|
||||
* \brief File of class to manage proposals statistics
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -66,36 +66,36 @@ class PropaleStats extends Stats
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Propal($this->db);
|
||||
$object = new Propal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field_date='p.datep';
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->field_date = 'p.datep';
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0";
|
||||
$this->where .= " p.fk_statut > 0";
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
$object=new SupplierProposal($this->db);
|
||||
$object = new SupplierProposal($this->db);
|
||||
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field_date='p.date_valid';
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->field_date = 'p.date_valid';
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
|
||||
$this->where.= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
$this->where .= " p.fk_statut > 0"; // Validated, accepted, refused and closed
|
||||
}
|
||||
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
|
||||
$this->where.= " AND p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($this->socid)
|
||||
$this->where .= " AND p.entity IN (".getEntity('propal').")";
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND p.fk_soc = ".$this->socid;
|
||||
$this->where .= " AND p.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid;
|
||||
if ($this->userid > 0) $this->where .= ' AND fk_user_author = '.$this->userid;
|
||||
}
|
||||
|
||||
|
||||
@ -111,14 +111,14 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql, $format);
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -133,11 +133,11 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -154,14 +154,14 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, SUM(p.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql, $format);
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -176,12 +176,12 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%m') as dm, AVG(p.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
@ -196,11 +196,11 @@ class PropaleStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(".$this->field_date.",'%Y') as year, COUNT(*) as nb, SUM(".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
@ -210,23 +210,24 @@ class PropaleStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND ".$this->field_date." BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
/**
|
||||
* \file htdocs/comm/propal/contact.php
|
||||
* \ingroup propal
|
||||
* \brief Onglet de gestion des contacts de propal
|
||||
* \brief Tab to manage contacts/adresses of proposal
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -55,7 +55,7 @@ $result = restrictedArea($user, 'propal', $id);
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -82,7 +82,7 @@ if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useles
|
||||
* Statistics
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(p.rowid), p.fk_statut";
|
||||
$sql = "SELECT count(p.rowid) as nb, p.fk_statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -101,24 +101,26 @@ if ($resql)
|
||||
$total = 0;
|
||||
$totalinprocess = 0;
|
||||
$dataseries = array();
|
||||
$colorseries = array();
|
||||
$vals = array();
|
||||
|
||||
// -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
|
||||
while ($i < $num)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row)
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
|
||||
{
|
||||
$vals[$row[1]] = $row[0];
|
||||
$totalinprocess += $row[0];
|
||||
}
|
||||
$total += $row[0];
|
||||
$vals[$obj->status] = $obj->nb;
|
||||
$totalinprocess += $obj->nb;
|
||||
|
||||
$total += $obj->nb;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'</td></tr>'."\n";
|
||||
@ -126,7 +128,13 @@ if ($resql)
|
||||
foreach ($listofstatus as $status)
|
||||
{
|
||||
$dataseries[] = array($propalstatic->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
|
||||
if (!$conf->use_javascript_ajax)
|
||||
if ($status == Propal::STATUS_DRAFT) $colorseries[$status] = '-'.$badgeStatus0;
|
||||
if ($status == Propal::STATUS_VALIDATED) $colorseries[$status] = $badgeStatus1;
|
||||
if ($status == Propal::STATUS_SIGNED) $colorseries[$status] = $badgeStatus4;
|
||||
if ($status == Propal::STATUS_NOTSIGNED) $colorseries[$status] = $badgeStatus9;
|
||||
if ($status == Propal::STATUS_BILLED) $colorseries[$status] = $badgeStatus6;
|
||||
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$propalstatic->LibStatut($status, 0).'</td>';
|
||||
@ -141,10 +149,11 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->SetDataColor(array_values($colorseries));
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphthirdparties');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ $mesg = (GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -167,15 +167,15 @@ $arrayfields = array(
|
||||
'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||
'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||
'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)),
|
||||
'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>! empty($conf->multicurrency->enabled) && ! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>! empty($conf->multicurrency->enabled) && ! empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)),
|
||||
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
|
||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
@ -344,7 +344,7 @@ if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||
if ($search_montant_ht != '') $sql .= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql .= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql .= natural_search("p.total", $search_montant_ttc, 1);
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND p.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
|
||||
if ($search_multicurrency_code != '') $sql .= ' AND p.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
|
||||
if ($search_multicurrency_tx != '') $sql .= natural_search('p.multicurrency_tx', $search_multicurrency_tx, 1);
|
||||
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('p.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
|
||||
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('p.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
|
||||
@ -1099,7 +1099,7 @@ if ($resql)
|
||||
// Currency
|
||||
if (!empty($arrayfields['p.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1107,7 +1107,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['p.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -1165,9 +1165,7 @@ if ($resql)
|
||||
$nbofsalesrepresentative = count($listsalesrepresentatives);
|
||||
if ($nbofsalesrepresentative > 3) // We print only number
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$companystatic->id.'">';
|
||||
print $nbofsalesrepresentative;
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($nbofsalesrepresentative > 0)
|
||||
{
|
||||
|
||||
@ -64,7 +64,7 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', '', $contact_list);
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -82,7 +82,7 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', '', $contact_list);
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +100,7 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, '', $contact_list);
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,24 +111,23 @@ class Orders extends DolibarrApi
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other objec
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $ref_int = '', $contact_list = 1)
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext, $ref_int);
|
||||
if( ! $result ) {
|
||||
$result = $this->commande->fetch($id, $ref, $ref_ext);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -164,18 +163,18 @@ class Orders extends DolibarrApi
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
$search_sale = 0;
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
|
||||
|
||||
$sql = "SELECT t.rowid";
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as t";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as t";
|
||||
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
|
||||
|
||||
$sql.= ' WHERE t.entity IN ('.getEntity('commande').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('commande').')';
|
||||
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.fk_soc = sc.fk_soc";
|
||||
if ($socids) $sql .= " AND t.fk_soc IN (".$socids.")";
|
||||
if ($search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
|
||||
// Insert sale filter
|
||||
if ($search_sale > 0)
|
||||
{
|
||||
@ -184,23 +183,23 @@ class Orders extends DolibarrApi
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (! DolibarrApi::_checkFilters($sqlfilters))
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
@ -210,12 +209,12 @@ class Orders extends DolibarrApi
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
$i=0;
|
||||
$i = 0;
|
||||
while ($i < $min)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$commande_static = new Commande($db);
|
||||
if($commande_static->fetch($obj->rowid)) {
|
||||
if ($commande_static->fetch($obj->rowid)) {
|
||||
// Add external contacts ids
|
||||
$commande_static->contacts_ids = $commande_static->liste_contact(-1, 'external', 1);
|
||||
$obj_ret[] = $this->_cleanObjectDatas($commande_static);
|
||||
@ -226,7 +225,7 @@ class Orders extends DolibarrApi
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror());
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
if (!count($obj_ret)) {
|
||||
throw new RestException(404, 'No order found');
|
||||
}
|
||||
return $obj_ret;
|
||||
@ -240,13 +239,13 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
/*if (isset($request_data["lines"])) {
|
||||
@ -275,16 +274,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->commande->getLinesArray();
|
||||
@ -307,16 +306,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
@ -369,16 +368,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
@ -431,16 +430,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -470,16 +469,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -508,16 +507,16 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function deleteContact($id, $rowid)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -540,19 +539,19 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if (! $result) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
foreach($request_data as $field => $value) {
|
||||
foreach ($request_data as $field => $value) {
|
||||
if ($field == 'id') continue;
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
@ -581,19 +580,19 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->supprimer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->supprimer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if( ! $this->commande->delete(DolibarrApiAccess::$user)) {
|
||||
if (!$this->commande->delete(DolibarrApiAccess::$user)) {
|
||||
throw new RestException(500, 'Error when deleting order : '.$this->commande->error);
|
||||
}
|
||||
|
||||
@ -629,15 +628,15 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -649,11 +648,11 @@ class Orders extends DolibarrApi
|
||||
throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -682,21 +681,21 @@ class Orders extends DolibarrApi
|
||||
public function reopen($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($id)) {
|
||||
if (empty($id)) {
|
||||
throw new RestException(400, 'Order ID is mandatory');
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
$result = $this->commande->set_reopen(DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ($result < 0) {
|
||||
throw new RestException(405, $this->commande->error);
|
||||
}elseif( $result == 0) {
|
||||
}elseif ($result == 0) {
|
||||
throw new RestException(304);
|
||||
}
|
||||
|
||||
@ -720,28 +719,28 @@ class Orders extends DolibarrApi
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($id)) {
|
||||
if (empty($id)) {
|
||||
throw new RestException(400, 'Order ID is mandatory');
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
$result = $this->commande->classifyBilled(DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ($result < 0) {
|
||||
throw new RestException(400, $this->commande->error);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -762,15 +761,15 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function close($id, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -783,11 +782,11 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -808,15 +807,15 @@ class Orders extends DolibarrApi
|
||||
*/
|
||||
public function settodraft($id, $idwarehouse = -1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -829,11 +828,11 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -860,26 +859,26 @@ class Orders extends DolibarrApi
|
||||
public function createOrderFromProposal($proposalid)
|
||||
{
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($proposalid)) {
|
||||
if (empty($proposalid)) {
|
||||
throw new RestException(400, 'Proposal ID is mandatory');
|
||||
}
|
||||
|
||||
$propal = new Propal($this->db);
|
||||
$result = $propal->fetch($proposalid);
|
||||
if( ! $result ) {
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
$result = $this->commande->createFromProposal($propal, DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ($result < 0) {
|
||||
throw new RestException(405, $this->commande->error);
|
||||
}
|
||||
$this->commande->fetchObjectLinked();
|
||||
@ -922,7 +921,7 @@ class Orders extends DolibarrApi
|
||||
$commande = array();
|
||||
foreach (Orders::$FIELDS as $field) {
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, $field ." field missing");
|
||||
throw new RestException(400, $field." field missing");
|
||||
$commande[$field] = $data[$field];
|
||||
}
|
||||
return $commande;
|
||||
|
||||
@ -101,6 +101,7 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* @var string Internal ref for order
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int;
|
||||
|
||||
@ -232,6 +233,94 @@ class Commande extends CommonOrder
|
||||
//! key of pos source ('0', '1', ...)
|
||||
public $pos_source;
|
||||
|
||||
|
||||
/**
|
||||
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||
* 'label' the translation key.
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'position' is the sort order of field.
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'noteditable' says if field is not editable (1 or 0)
|
||||
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
*
|
||||
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25),
|
||||
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>26),
|
||||
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated
|
||||
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>56),
|
||||
'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>80),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'source' =>array('type'=>'smallint(6)', 'label'=>'Source', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
//'amount_ht' =>array('type'=>'double(24,8)', 'label'=>'AmountHT', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'LocalTax1', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
|
||||
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>230),
|
||||
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>235),
|
||||
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240),
|
||||
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245),
|
||||
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1),
|
||||
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1),
|
||||
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>260, 'isameasure'=>1),
|
||||
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>265, 'isameasure'=>1),
|
||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270),
|
||||
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275),
|
||||
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280),
|
||||
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900),
|
||||
);
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
/**
|
||||
* ERR Not enough stock
|
||||
*/
|
||||
@ -927,6 +1016,14 @@ class Commande extends CommonOrder
|
||||
$vatrate = $line->tva_tx;
|
||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||
|
||||
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
||||
$originid=$line->origin_id;
|
||||
$origintype=$line->origin;
|
||||
} else {
|
||||
$originid=$line->id;
|
||||
$origintype=$this->element;
|
||||
}
|
||||
|
||||
$result = $this->addline(
|
||||
$line->desc,
|
||||
$line->subprice,
|
||||
@ -951,8 +1048,8 @@ class Commande extends CommonOrder
|
||||
$line->label,
|
||||
$line->array_options,
|
||||
$line->fk_unit,
|
||||
$this->element,
|
||||
$line->id
|
||||
$origintype,
|
||||
$originid
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -1355,8 +1452,8 @@ class Commande extends CommonOrder
|
||||
* @param string $label Label
|
||||
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
||||
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
@ -1685,13 +1782,13 @@ class Commande extends CommonOrder
|
||||
* @param int $id Id of object to load
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param string $ref_int Internal reference of other object
|
||||
* @param string $notused Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($id, $ref = '', $ref_ext = '', $notused = '')
|
||||
{
|
||||
// Check parameters
|
||||
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||
if (empty($id) && empty($ref) && empty($ref_ext)) return -1;
|
||||
|
||||
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
|
||||
$sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
|
||||
@ -1722,7 +1819,7 @@ class Commande extends CommonOrder
|
||||
|
||||
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql .= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql .= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
if ($notused) $sql .= " AND c.ref_int='".$this->db->escape($notused)."'";
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -23,10 +23,10 @@
|
||||
* \ingroup commandes
|
||||
* \brief File of class to manage order statistics
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -67,31 +67,31 @@ class CommandeStats extends Stats
|
||||
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
$object=new Commande($this->db);
|
||||
$object = new Commande($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->where.= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 0"; // Not draft and not cancelled
|
||||
}
|
||||
elseif ($mode == 'supplier')
|
||||
{
|
||||
$object=new CommandeFournisseur($this->db);
|
||||
$object = new CommandeFournisseur($this->db);
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element." as c";
|
||||
$this->from_line = MAIN_DB_PREFIX.$object->table_element_line." as tl";
|
||||
$this->field='total_ht';
|
||||
$this->field_line='total_ht';
|
||||
$this->where.= " c.fk_statut > 2"; // Only approved & ordered
|
||||
$this->field = 'total_ht';
|
||||
$this->field_line = 'total_ht';
|
||||
$this->where .= " c.fk_statut > 2"; // Only approved & ordered
|
||||
}
|
||||
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
|
||||
$this->where.= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
$this->where .= ' AND c.entity IN ('.getEntity('commande').')';
|
||||
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($this->socid)
|
||||
{
|
||||
$this->where.=" AND c.fk_soc = ".$this->socid;
|
||||
$this->where .= " AND c.fk_soc = ".$this->socid;
|
||||
}
|
||||
if ($this->userid > 0) $this->where.=' AND c.fk_user_author = '.$this->userid;
|
||||
if ($this->userid > 0) $this->where .= ' AND c.fk_user_author = '.$this->userid;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,14 +106,14 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getNbByMonth($year, $sql, $format);
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -128,11 +128,11 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -149,14 +149,14 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res=$this->_getAmountByMonth($year, $sql, $format);
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -171,12 +171,12 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql.= " AND ".$this->where;
|
||||
$sql.= " GROUP BY dm";
|
||||
$sql.= $this->db->order('dm', 'DESC');
|
||||
$sql .= " WHERE c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
return $this->_getAverageByMonth($year, $sql);
|
||||
}
|
||||
@ -191,11 +191,11 @@ class CommandeStats extends Stats
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
@ -203,23 +203,24 @@ class CommandeStats extends Stats
|
||||
/**
|
||||
* Return nb, amount of predefined product for year
|
||||
*
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
* @param int $year Year to scan
|
||||
* @param int $limit Limit
|
||||
* @return array Array of values
|
||||
*/
|
||||
public function getAllByProduct($year)
|
||||
public function getAllByProduct($year, $limit = 10)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
|
||||
$sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql.= " GROUP BY product.ref";
|
||||
$sql.= $this->db->order('nb', 'DESC');
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid";
|
||||
$sql .= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year, 1, false))."' AND '".$this->db->idate(dol_get_last_day($year, 12, false))."'";
|
||||
$sql .= " GROUP BY product.ref";
|
||||
$sql .= $this->db->order('nb', 'DESC');
|
||||
//$sql.= $this->db->plimit(20);
|
||||
|
||||
return $this->_getAllByProduct($sql);
|
||||
return $this->_getAllByProduct($sql, $limit);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ $langs->loadLangs(array("companies", "orders"));
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -54,7 +54,7 @@ $result = restrictedArea($user, 'commande', $id, '');
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -140,10 +140,10 @@ if ($resql)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
$dolgraph->SetData($dataseries);
|
||||
$dolgraph->setShowLegend(1);
|
||||
$dolgraph->setShowLegend(2);
|
||||
$dolgraph->setShowPercent(1);
|
||||
$dolgraph->SetType(array('pie'));
|
||||
$dolgraph->setWidth('100%');
|
||||
$dolgraph->setHeight('200');
|
||||
$dolgraph->draw('idgraphstatus');
|
||||
print $dolgraph->show($total ? 0 : 1);
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ $diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/ma
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -1179,7 +1179,7 @@ if ($resql)
|
||||
// Currency
|
||||
if (!empty($arrayfields['c.multicurrency_code']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)."</td>\n";
|
||||
print '<td class="nowrap">'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -1187,7 +1187,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['c.multicurrency_tx']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">';
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
|
||||
print "</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ $hookmanager->initHooks(array('comptafileslist', 'globallist'));
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -133,7 +133,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
|
||||
// Customer invoices
|
||||
if (GETPOST('selectinvoices')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total as total_ht, t.total_ttc, t.tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
@ -142,7 +142,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Vendor invoices
|
||||
if (GETPOST('selectsupplierinvoices')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_soc, t.datef as date, t.date_lim_reglement as date_due, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays";
|
||||
$sql .= " WHERE datef between ".$wheretail;
|
||||
@ -151,7 +151,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Expense reports
|
||||
if (GETPOST('selectexpensereports')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, t.paid, t.total_ht, t.total_ttc, t.total_tva as total_vat, t.fk_user_author as fk_soc, t.date_fin as date, t.date_fin as date_due, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE date_fin between ".$wheretail;
|
||||
@ -160,7 +160,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Donations
|
||||
if (GETPOST('selectdonations')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, t.datedon as date, t.datedon as date_due, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country";
|
||||
$sql .= " WHERE datedon between ".$wheretail;
|
||||
@ -169,7 +169,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Paiements of salaries
|
||||
if (GETPOST('selectpaymentsofsalaries')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
@ -178,7 +178,7 @@ if (($action == "searchfiles" || $action == "dl")) {
|
||||
}
|
||||
// Social contributions
|
||||
if (GETPOST('selectsocialcontributions')) {
|
||||
if (! empty($sql)) $sql .= " UNION ALL";
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, t.paye as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_tva, 0 as fk_soc, t.date_creation as date, t.date_ech as date_due, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t";
|
||||
$sql .= " WHERE date_creation between ".$wheretail;
|
||||
@ -467,7 +467,7 @@ print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n
|
||||
if (!empty($conf->multicompany->enabled) && is_object($mc))
|
||||
{
|
||||
$mc->getInfo($conf->entity);
|
||||
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)?' opacitymedium':'').'">('.$langs->trans("Entity").' : ';
|
||||
print '<span class="marginleftonly marginrightonly'.(empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES) ? ' opacitymedium' : '').'">('.$langs->trans("Entity").' : ';
|
||||
print "<td>";
|
||||
if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) {
|
||||
print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true);
|
||||
@ -488,8 +488,8 @@ $listofchoices = array(
|
||||
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
|
||||
'selectsocialcontributions'=>array('label'=>'SocialContributions')
|
||||
);
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
$checked = (((! GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice))?' checked="checked"':'');
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
|
||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" name="'.$choice.'" value="1"'.$checked.'> '.$langs->trans($val['label']).'</div>';
|
||||
}
|
||||
|
||||
@ -508,8 +508,8 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
$param .= '&date_stopday='.GETPOST('date_stopday', 'int');
|
||||
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
|
||||
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
$param.='&'.$choice.'='.(GETPOST($choice, 'int')?1:0);
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
||||
}
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -518,7 +518,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
|
||||
print '<input type="hidden" name="date_start" value="'.dol_print_date($date_start, 'dayxcard').'" />';
|
||||
print '<input type="hidden" name="date_stop" value="'.dol_print_date($date_stop, 'dayxcard').'" />';
|
||||
foreach($listofchoices as $choice => $val) {
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
}
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ if ($user->socid)
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -98,7 +98,7 @@ if (empty($dateop)) $dateop = -1;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
$pageplusone = GETPOST("pageplusone", 'int');
|
||||
if ($pageplusone) $page = $pageplusone - 1;
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
|
||||
@ -56,7 +56,7 @@ if ($user->socid)
|
||||
// Get parameters
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
|
||||
@ -350,10 +350,11 @@ else
|
||||
}
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
if ($xday == '15')
|
||||
/*if ($xday == '15') // Set only some label for jflot
|
||||
{
|
||||
$labels[$i] = dol_print_date($day, "%b");
|
||||
}
|
||||
}*/
|
||||
$labels[$i] = dol_print_date($day, "%Y%m");
|
||||
$day += 86400;
|
||||
$textdate = strftime("%Y%m%d", $day);
|
||||
$xyear = substr($textdate, 0, 4);
|
||||
@ -465,10 +466,11 @@ else
|
||||
}
|
||||
$datamin[$i] = $object->min_desired;
|
||||
$dataall[$i] = $object->min_allowed;
|
||||
if (substr($textdate, 6, 2) == '01' || $i == 0)
|
||||
/*if (substr($textdate, 6, 2) == '01' || $i == 0) // Set only few label for jflot
|
||||
{
|
||||
$labels[$i] = substr($textdate, 4, 2);
|
||||
}
|
||||
$labels[$i] = substr($textdate, 0, 6);
|
||||
}*/
|
||||
$labels[$i] = substr($textdate, 0, 6);
|
||||
|
||||
$day += 86400;
|
||||
$textdate = strftime("%Y%m%d", $day);
|
||||
@ -815,6 +817,8 @@ else
|
||||
}
|
||||
print '<br><br></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Graphs
|
||||
if ($mode == 'standard')
|
||||
@ -826,39 +830,39 @@ if ($mode == 'standard')
|
||||
|
||||
// For month
|
||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".$prevyear."&month=".$prevmonth."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Month")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".$nextyear."&month=".$nextmonth."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td class="right">'.$link.'</td></tr>';
|
||||
print '<div class="right clearboth">'.$link.'</div>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
$file = "movement".$account."-".$year.$month.".png";
|
||||
print $show4;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show1;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
// For year
|
||||
$prevyear = $year - 1; $nextyear = $year + 1;
|
||||
$link = "<a href='".$_SERVER["PHP_SELF"]."?account=".$account.($_GET["option"] != 'all' ? '' : '&option=all')."&year=".($prevyear)."'>".img_previous('', 'class="valignbottom"')."</a> ".$langs->trans("Year")." <a href='".$_SERVER["PHP_SELF"]."?account=".$account."&year=".($nextyear)."'>".img_next('', 'class="valignbottom"')."</a>";
|
||||
print '<tr><td class="right">'.$link.'</td></tr>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="right clearboth margintoponly">'.$link.'</div>';
|
||||
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show5;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show2;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'showalltime')
|
||||
{
|
||||
print '<tr><td class="center">';
|
||||
print '<div class="center clearboth margintoponly">';
|
||||
print $show3;
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.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
|
||||
@ -30,36 +31,43 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcategory.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
|
||||
if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('banks', 'categories', 'accountancy', 'compta'));
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$massaction=GETPOST('massaction', 'alpha');
|
||||
$show_files=GETPOST('show_files', 'int');
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$show_files = GETPOST('show_files', 'int');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bankaccountlist'; // To manage different context of search
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bankaccountlist'; // To manage different context of search
|
||||
|
||||
$search_ref=GETPOST('search_ref', 'alpha');
|
||||
$search_label=GETPOST('search_label', 'alpha');
|
||||
$search_number=GETPOST('search_number', 'alpha');
|
||||
$search_status=GETPOST('search_status')?GETPOST('search_status', 'alpha'):'opened'; // 'all' or ''='opened'
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_label = GETPOST('search_label', 'alpha');
|
||||
$search_number = GETPOST('search_number', 'alpha');
|
||||
$search_status = GETPOST('search_status') ?GETPOST('search_status', 'alpha') : 'opened'; // 'all' or ''='opened'
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$search_category_list = GETPOST("search_category_".Categorie::TYPE_ACCOUNT."_list", "array");
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid=$user->socid;
|
||||
if (! empty($user->rights->accounting->chartofaccount)) $allowed=1; // Dictionary with list of banks accounting account allowed to manager of chart account
|
||||
if (! $allowed) $result=restrictedArea($user, 'banque');
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
if (!empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with list of banks accounting account allowed to manager of chart account
|
||||
if (!$allowed) $result = restrictedArea($user, 'banque');
|
||||
|
||||
$diroutputmassaction=$conf->bank->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$diroutputmassaction = $conf->bank->dir_output.'/temp/massgeneration/'.$user->id;
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
@ -74,7 +82,7 @@ $extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
$fieldstosearchall = array(
|
||||
@ -100,10 +108,10 @@ $arrayfields = array(
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
{
|
||||
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
||||
}
|
||||
}
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
@ -138,38 +146,50 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new FormCategory($db);
|
||||
|
||||
$title=$langs->trans('BankAccounts');
|
||||
$title = $langs->trans('BankAccounts');
|
||||
|
||||
// Load array of financial accounts (opened by default)
|
||||
$accounts = array();
|
||||
|
||||
$sql = "SELECT b.rowid, b.label, b.courant, b.rappro, b.account_number, b.fk_accountancy_journal, b.currency_code, b.datec as date_creation, b.tms as date_update";
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
$sql.= " WHERE b.entity IN (".getEntity('bank_account').")";
|
||||
if ($search_status == 'opened') $sql.= " AND clos = 0";
|
||||
if ($search_status == 'closed') $sql.= " AND clos = 1";
|
||||
if ($search_ref != '') $sql.=natural_search('b.ref', $search_ref);
|
||||
if ($search_label != '') $sql.=natural_search('b.label', $search_label);
|
||||
if ($search_number != '') $sql.=natural_search('b.number', $search_number);
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account as b";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_ACCOUNT, "b.rowid");
|
||||
}
|
||||
|
||||
$sql .= " WHERE b.entity IN (".getEntity('bank_account').")";
|
||||
if ($search_status == 'opened') $sql .= " AND clos = 0";
|
||||
if ($search_status == 'closed') $sql .= " AND clos = 1";
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$sql .= Categorie::getFilterSelectQuery(Categorie::TYPE_ACCOUNT, "b.rowid", $search_category_list);
|
||||
}
|
||||
|
||||
if ($search_ref != '') $sql .= natural_search('b.ref', $search_ref);
|
||||
if ($search_label != '') $sql .= natural_search('b.label', $search_label);
|
||||
if ($search_number != '') $sql .= natural_search('b.number', $search_number);
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
@ -263,6 +283,10 @@ if ($sall)
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
if (!empty($conf->categorie->enabled))
|
||||
{
|
||||
$moreforfilter .= $form->getFilterBox(Categorie::TYPE_ACCOUNT, $search_category_list);
|
||||
}
|
||||
|
||||
// Bank accounts
|
||||
$parameters = array();
|
||||
@ -414,52 +438,52 @@ foreach ($accounts as $key=>$type)
|
||||
|
||||
$solde = $objecttmp->solde(1);
|
||||
|
||||
if (! empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
|
||||
if (!empty($lastcurrencycode) && $lastcurrencycode != $objecttmp->currency_code)
|
||||
{
|
||||
$lastcurrencycode='various'; // We found several different currencies
|
||||
$lastcurrencycode = 'various'; // We found several different currencies
|
||||
}
|
||||
if ($lastcurrencycode != 'various')
|
||||
{
|
||||
$lastcurrencycode=$objecttmp->currency_code;
|
||||
$lastcurrencycode = $objecttmp->currency_code;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
if (! empty($arrayfields['b.ref']['checked']))
|
||||
if (!empty($arrayfields['b.ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">'.$objecttmp->getNomUrl(1).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label
|
||||
if (! empty($arrayfields['b.label']['checked']))
|
||||
if (!empty($arrayfields['b.label']['checked']))
|
||||
{
|
||||
print '<td>'.$objecttmp->label.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account type
|
||||
if (! empty($arrayfields['accountype']['checked']))
|
||||
if (!empty($arrayfields['accountype']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
print $objecttmp->type_lib[$objecttmp->type];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Number
|
||||
if (! empty($arrayfields['b.number']['checked']))
|
||||
if (!empty($arrayfields['b.number']['checked']))
|
||||
{
|
||||
print '<td>'.$objecttmp->number.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account number
|
||||
if (! empty($arrayfields['b.account_number']['checked']))
|
||||
if (!empty($arrayfields['b.account_number']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled) && ! empty($objecttmp->account_number))
|
||||
if (!empty($conf->accounting->enabled) && !empty($objecttmp->account_number))
|
||||
{
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('', $objecttmp->account_number, 1);
|
||||
@ -470,14 +494,14 @@ foreach ($accounts as $key=>$type)
|
||||
print $objecttmp->account_number;
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($arrayfields['b.fk_accountancy_journal']['checked']))
|
||||
if (!empty($arrayfields['b.fk_accountancy_journal']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled) && ! empty($objecttmp->fk_accountancy_journal))
|
||||
if (!empty($conf->accounting->enabled) && !empty($objecttmp->fk_accountancy_journal))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$accountingjournal->fetch($objecttmp->fk_accountancy_journal);
|
||||
@ -523,47 +547,47 @@ foreach ($accounts as $key=>$type)
|
||||
print '<span class="opacitymedium">'.$langs->trans("FeatureDisabled").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objecttmp); // Note that $action and $objecttmpect may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
if (! empty($arrayfields['b.datec']['checked']))
|
||||
if (!empty($arrayfields['b.datec']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($objecttmp->date_creation, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['b.tms']['checked']))
|
||||
if (!empty($arrayfields['b.tms']['checked']))
|
||||
{
|
||||
print '<td class="center">';
|
||||
print dol_print_date($objecttmp->date_update, 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Status
|
||||
if (! empty($arrayfields['b.clos']['checked']))
|
||||
if (!empty($arrayfields['b.clos']['checked']))
|
||||
{
|
||||
print '<td class="center">'.$objecttmp->getLibStatut(5).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Balance
|
||||
if (! empty($arrayfields['balance']['checked']))
|
||||
if (!empty($arrayfields['balance']['checked']))
|
||||
{
|
||||
print '<td class="nowraponall right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$objecttmp->id.'">'.price($solde, 0, $langs, 0, -1, -1, $objecttmp->currency_code).'</a>';
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='balance';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'balance';
|
||||
$totalarray['val']['balance'] += $solde;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user