diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 19c076242f8..5e56ac2a1fc 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -101,28 +101,30 @@ Long description (Can span accross multiple lines).
### 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
diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml
new file mode 100644
index 00000000000..55599654707
--- /dev/null
+++ b/.github/workflows/stale-issues-safe.yml
@@ -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
+
\ No newline at end of file
diff --git a/.github/workflows/stale-issues.yml.disabled b/.github/workflows/stale-issues.yml.disabled
index d36a0122b28..6e7dad5dc9b 100644
--- a/.github/workflows/stale-issues.yml.disabled
+++ b/.github/workflows/stale-issues.yml.disabled
@@ -12,13 +12,13 @@ jobs:
- uses: Dolibarr/stale@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- stale-issue-message: 'This issue is stale because it has been open 6 month 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 will be closed automatically by stale bot in 6 month.'
+ 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: 182
- days-before-close: 183
- operations-per-run: 50
- #stale-pr-message: 'This PR is stale because it has been open 6 month 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 6 month.'
+ days-before-stale: 365
+ 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:
exempt-pr-label: 'Priority Top Strategic'
diff --git a/COPYRIGHT b/COPYRIGHT
index 09557f6520e..c1f400aff4e 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -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,7 +32,7 @@ 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
diff --git a/ChangeLog b/ChangeLog
index 279fc01cfa8..0483767ac50 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,27 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
+
+***** ChangeLog for 12.0.0 compared to 11.0.0 *****
+For Users:
+NEW: Module MO (Manufacturing Order) is available as stable module.
+
+For Developers or integrators:
+
+
+
+WARNING:
+
+Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
+* PHP 5.5 is no more supported. Minimum PHP is now 5.6+.
+* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
+ with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
+ 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 (with a custom numbering mask that use it) is generated.
+
+
***** ChangeLog for 11.0.2 compared to 11.0.1 *****
FIX: #10309
FIX: #13110
@@ -66,25 +87,6 @@ FIX: Visualization rights correction on last modified contacts box.
FIX: Vulnerability in module from modulebuilder.
FIX: Vulnerability reported by code16
-***** ChangeLog for 12.0.0 compared to 11.0.0 *****
-For Users:
-NEW: Module MO (Manufacturing Order) is available as stable module.
-
-For Developers or integrators:
-
-
-
-WARNING:
-
-Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
-* PHP 5.5 is no more supported. Minimum PHP is now 5.6+.
-* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
- with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
- 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.
-
***** 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.
diff --git a/composer.json b/composer.json
index 86acd2f8d60..d26bbb05ad9 100644
--- a/composer.json
+++ b/composer.json
@@ -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"
}
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index e9ea391bba2..09c71674512 100644
--- a/composer.lock
+++ b/composer.lock
@@ -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": []
diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php
index 6d59a9de1f6..7da6de23725 100644
--- a/htdocs/accountancy/admin/account.php
+++ b/htdocs/accountancy/admin/account.php
@@ -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 '';
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '
';
+ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconciliable']['checked'])) print ' '; }
if (!empty($arrayfields['aa.active']['checked'])) print ' ';
print '';
$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 "\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 ' ';
+ if (empty($obj->reconciliable)) {
+ print 'rowid . '&action=enable&mode=1">';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+ } else {
+ print 'rowid . '&action=disable&mode=1">';
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ print ' ';
+ }
+ print ' ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ }
+
// Activated or not
if (!empty($arrayfields['aa.active']['checked']))
{
- print '';
+ print ' ';
if (empty($obj->active)) {
- print 'rowid.'&action=enable">';
+ print ' rowid.'&action=enable&mode=0">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print ' ';
} else {
- print 'rowid.'&action=disable">';
+ print ' rowid.'&action=disable&mode=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print ' ';
}
diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php
index 2ed3ad44695..0ab42d582d1 100644
--- a/htdocs/accountancy/admin/accountmodel.php
+++ b/htdocs/accountancy/admin/accountmodel.php
@@ -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;
diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php
index 50cf04a490a..500a0d3cbba 100644
--- a/htdocs/accountancy/admin/categories_list.php
+++ b/htdocs/accountancy/admin/categories_list.php
@@ -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;
diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php
index c0c3f835481..ad22a88f415 100644
--- a/htdocs/accountancy/admin/defaultaccounts.php
+++ b/htdocs/accountancy/admin/defaultaccounts.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2019 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2014 Marcos García
* Copyright (C) 2014 Juanjo Menent
@@ -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 ''.$langs->trans($reg[1]).' ';
}
@@ -190,9 +198,9 @@ foreach ($list_account as $key) {
print '';
// Param
$label = $langs->trans($key);
- print '' . $label . ' ';
+ print ''.$label.' ';
// Value
- print ''; // Do not force class=right, or it align also the content of the select box
+ print ' '; // 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 ' ';
print ' ';
diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php
index 7dd4ae1a935..b5cc46a3d0d 100644
--- a/htdocs/accountancy/admin/fiscalyear.php
+++ b/htdocs/accountancy/admin/fiscalyear.php
@@ -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;
diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php
index e47fba72756..eccb7450594 100644
--- a/htdocs/accountancy/admin/journals_list.php
+++ b/htdocs/accountancy/admin/journals_list.php
@@ -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;
diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php
index 60c9c88f0c8..c6c76a57621 100644
--- a/htdocs/accountancy/admin/productaccount.php
+++ b/htdocs/accountancy/admin/productaccount.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2013-2019 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014 Florian Henry
* Copyright (C) 2014 Juanjo Menent
* Copyright (C) 2015 Ari Elbaz (elarifr)
@@ -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 ' ';
- print ''.$langs->trans("InitAccountancyDesc") . ' ';
+ print ''.$langs->trans("InitAccountancyDesc").' ';
print ' ';
// Select mode
print '\n";
- print '
';
+ print '
';
print " \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 = ' ';
+ $buttonsave = ' ';
//print ''.$buttonsave.'
';
- $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 '';
- print '
';
+ print '';
print '';
- print ' ';
- print ' ';
- if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ' ';
+ print ' ';
+ print ' ';
+ if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ' ';
// On sell
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print ''.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).' ';
}
// 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 ''.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).' ';
}
// Current account
print '';
- print ' ';
- $listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
+ print ' ';
+ $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 ' ';
print ' ';
print '';
- $searchpicto=$form->showFilterButtons();
+ $searchpicto = $form->showFilterButtons();
print $searchpicto;
print ' ';
print ' ';
@@ -405,30 +445,36 @@ if ($result)
print '';
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 ' ';
$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 '';
@@ -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 ''.$product_static->getLibStatut(3, 0).' ';
- 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 ''.$product_static->getLibStatut(3, 1).' ';
// 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 '';
// New account to set
- $defaultvalue='';
+ $defaultvalue = '';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// Accounting account buy
print '';
//$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 ' ';
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
+ // Accounting account buy intra (In EEC)
+ print '';
+ //$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 ' ';
+ } elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
+ // Accounting account buy export (Out of EEC)
+ print '';
+ //$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 ' ';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell
print '';
//$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 ' ';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC)
print '';
//$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 ' ';
} else {
// Accounting account sell export (Out of EEC)
print '';
//$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 ' ';
}
// Checkbox select
print '';
- print ' ';
+ print ' ';
print " ";
- $i ++;
+ $i++;
}
print '
';
print '';
diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php
index bbc16fa08f9..b2a25b00ce2 100644
--- a/htdocs/accountancy/bookkeeping/balance.php
+++ b/htdocs/accountancy/bookkeeping/balance.php
@@ -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 '';
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);
diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index 9b6ad2fbbb0..e50112f7ff1 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -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 '';
print ' ';
- print ' '.$langs->trans("NotReconciled").' ';
+ print ' '.$langs->trans("NotReconciled").' ';
print ' ';
}
// 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 '';
- 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;
diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php
index 2cb28b59584..bb6f95d9047 100644
--- a/htdocs/accountancy/bookkeeping/listbyaccount.php
+++ b/htdocs/accountancy/bookkeeping/listbyaccount.php
@@ -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;
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
index 91ce9f5e31a..1dfb324599c 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
@@ -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
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
index 867f5303ff8..5a5a4d36c21 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php
@@ -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
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 847aa3ef47e..bb1f1b8679c 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -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
*
diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php
index 21f7c1cb210..0178f87a32d 100644
--- a/htdocs/accountancy/class/accountingaccount.class.php
+++ b/htdocs/accountancy/class/accountingaccount.class.php
@@ -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();
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 48df5ce374a..19a5adcca34 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -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';
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index d52c4c51f07..55342a98c27 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -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;
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index d964d348889..9e4f73d8f7a 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -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 ' ';
- if ($product_static->id > 0)
+ if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
- if ($objp->product_label) print ' '.$objp->product_label;
+ }
+ if ($objp->product_label) print ''.$objp->product_label.' ';
print ' ';
print '';
@@ -535,7 +568,7 @@ if ($result) {
// Current account
print ' ';
- $s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$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 ' ';
- $s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$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 ' ';
//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 ' ';
print ' ';
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index cc606555b37..63b142e1bdd 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -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;
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index c0d9d1a03b5..e03c717039f 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -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 '';
// Current account
- print '';
+ print ' ';
print length_accountg(html_entity_decode($objp->code_buy));
print ' ';
// Suggested accounting account
- print '';
+ print ' ';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print ' ';
diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php
index 3bc44698029..07877378ce1 100644
--- a/htdocs/accountancy/supplier/index.php
+++ b/htdocs/accountancy/supplier/index.php
@@ -1,7 +1,7 @@
* Copyright (C) 2013-2014 Florian Henry
- * Copyright (C) 2013-2015 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014 Juanjo Menent
*
* 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';
}
}
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index a035aed2b1f..ef44222568f 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -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;
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index ecd41f2f9da..b6c220c347a 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2013-2017 Alexandre Spangaro
+ * Copyright (C) 2013-2020 Alexandre Spangaro
* Copyright (C) 2014-2015 Ari Elbaz (elarifr)
* Copyright (C) 2013-2014 Florian Henry
* Copyright (C) 2014 Juanjo Menent 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 '';
@@ -467,7 +518,7 @@ if ($result) {
print '';
if ($product_static->id > 0)
print $product_static->getNomUrl(1);
- if ($objp->product_label) print ' '.$objp->product_label;
+ if ($objp->product_label) print ''.$objp->product_label.' ';
print ' ';
// Description
@@ -498,8 +549,8 @@ if ($result) {
print ''.$objp->tva_intra.' ';
// Current account
- print '';
- $s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ print ' ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$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 ' ';
- $s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
+ $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$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 ' ';
$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 ' ';
@@ -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 '';
if ($addlink) $out .= ' '.$langs->trans("Link").' ';
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index b75cb1e4bd6..e097c6d7120 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -348,7 +348,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
if ($thirdparty instanceof Societe) {
$socname .= $thirdparty->name;
if (($includealias || !empty($conf->global->PDF_INCLUDE_ALIAS_IN_THIRDPARTY_NAME)) && !empty($thirdparty->name_alias)) {
- $socname .= "\n".$thirdparty->name_alias;
+ $socname .= " - ".$thirdparty->name_alias;
}
} elseif ($thirdparty instanceof Contact) {
$socname = $thirdparty->socname;
@@ -386,7 +386,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
$stringaddress = '';
if (is_object($hookmanager))
{
- $parameters = array('sourcecompany'=>&$sourcecompany, 'targetcompany'=>&$targetcompany, 'targetcontact'=>&$targetcontact, 'outputlangs'=>$outputlangs, 'mode'=>$mode, 'usecontact'=>$usecontact);
+ $parameters = array('sourcecompany' => &$sourcecompany, 'targetcompany' => &$targetcompany, 'targetcontact' => &$targetcontact, 'outputlangs' => $outputlangs, 'mode' => $mode, 'usecontact' => $usecontact);
$action = '';
$reshook = $hookmanager->executeHooks('pdf_build_address', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$stringaddress .= $hookmanager->resPrint;
diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php
index dbfeef03259..ee80a525f04 100644
--- a/htdocs/core/lib/project.lib.php
+++ b/htdocs/core/lib/project.lib.php
@@ -2189,7 +2189,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks
print '';
print $projectstatic->getNomUrl(1);
- if (!in_array('projectlabel', $hiddenfields)) print ' '.dol_trunc($objp->title, 24);
+ if (!in_array('projectlabel', $hiddenfields)) print ''.dol_trunc($objp->title, 24).' ';
print ' ';
print '';
if ($objp->fk_soc > 0)
diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php
index 83cf576f0bb..6749f32ffbe 100644
--- a/htdocs/core/lib/security.lib.php
+++ b/htdocs/core/lib/security.lib.php
@@ -122,7 +122,7 @@ function dol_hash($chain, $type = '0')
}
// Salt value
- if (! empty($conf->global->MAIN_SECURITY_SALT) && $type != '4' && $type !== 'md5openldap') $chain = $conf->global->MAIN_SECURITY_SALT.$chain;
+ if (!empty($conf->global->MAIN_SECURITY_SALT) && $type != '4' && $type !== 'md5openldap') $chain = $conf->global->MAIN_SECURITY_SALT.$chain;
if ($type == '1' || $type == 'sha1') return sha1($chain);
elseif ($type == '2' || $type == 'sha1md5') return sha1(md5($chain));
@@ -198,7 +198,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
if (isset($hookmanager->resArray['result'])) {
- if ($hookmanager->resArray['result'] == 0) accessforbidden(); // Module returns 0, so access forbidden
+ if ($hookmanager->resArray['result'] == 0) accessforbidden(); // Module returns 0, so access forbidden
}
if ($reshook > 0) { // No other test done.
return 1;
diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php
index a0a1da26b3c..bd46b975120 100644
--- a/htdocs/core/lib/website.lib.php
+++ b/htdocs/core/lib/website.lib.php
@@ -38,8 +38,8 @@ function dolStripPhpCode($str, $replacewith = '')
$parts = explode('', $part);
if (!empty($partlings))
{
- $phppart = $partlings[0];
+ //$phppart = $partlings[0];
//remove content before closing tag
- if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
+ if (count($partlings) > 1) $partlings[0] = ''; // Todo why a count > 1 and not >= 1 ?
//append to out string
- $newstr .= ''.$replacewith.' '.implode('', $partlings);
+ //$newstr .= ''.$replacewith.' '.implode('', $partlings);
+ //$newstr .= ''.$replacewith.' '.implode('', $partlings);
+ $newstr .= ''.$replacewith.' '.implode('', $partlings);
+ //$newstr .= $replacewith.implode('', $partlings);
}
}
}
@@ -85,7 +88,7 @@ function dolKeepOnlyPhpCode($str)
$i++;
continue;
}
- $newstr.='', $part, 2);
if (!empty($partlings))
@@ -117,33 +120,33 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
{
$nbrep = 0;
- dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'').')', LOG_DEBUG);
+ dol_syslog('dolWebsiteReplacementOfLinks start (contenttype='.$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')', LOG_DEBUG);
//if ($contenttype == 'html') { print $content;exit; }
// Replace php code. Note $content may come from database and does not contains body tags.
- $replacewith='...php...';
- if ($removephppart) $replacewith='';
+ $replacewith = '...php...';
+ if ($removephppart) $replacewith = '';
$content = preg_replace('/value="<\?php((?!\?>).)*\?>\n*/ims', 'value="'.$replacewith.'"', $content);
- $replacewith='"callto=#';
- if ($removephppart) $replacewith='';
+ $replacewith = '"callto=#';
+ if ($removephppart) $replacewith = '';
$content = preg_replace('/"callto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
- $replacewith='"mailto=#';
- if ($removephppart) $replacewith='';
+ $replacewith = '"mailto=#';
+ if ($removephppart) $replacewith = '';
$content = preg_replace('/"mailto:<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
- $replacewith='src="php';
- if ($removephppart) $replacewith='';
+ $replacewith = 'src="php';
+ if ($removephppart) $replacewith = '';
$content = preg_replace('/src="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
- $replacewith='href="php';
- if ($removephppart) $replacewith='';
+ $replacewith = 'href="php';
+ if ($removephppart) $replacewith = '';
$content = preg_replace('/href="<\?php((?!\?>).)*\?>\n*/ims', $replacewith, $content);
//$replacewith='...php... ';
- $replacewith='...php...';
- if ($removephppart) $replacewith='';
+ $replacewith = '...php...';
+ if ($removephppart) $replacewith = '';
//$content = preg_replace('/<\?php((?!\?toremove>).)*\?toremove>\n*/ims', $replacewith, $content);
/*if ($content === null) {
if (preg_last_error() == PREG_JIT_STACKLIMIT_ERROR) $content = 'preg_replace error (when removing php tags) PREG_JIT_STACKLIMIT_ERROR';
@@ -185,11 +188,11 @@ function dolWebsiteReplacementOfLinks($website, $content, $removephppart = 0, $c
$content = preg_replace('/(action=")\/?([^:\"]*)(\.php\")/', '\1!~!~!~'.DOL_URL_ROOT.'/website/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep);
// Fix relative link /document.php with correct URL after the DOL_URL_ROOT: ...href="/document.php?modulepart="
- $content=preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
- $content=preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
+ $content = preg_replace('/(href=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
+ $content = preg_replace('/(src=")(\/?document\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
// Fix relative link /viewimage.php with correct URL after the DOL_URL_ROOT: ...href="/viewimage.php?modulepart="
- $content=preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
+ $content = preg_replace('/(url\(")(\/?viewimage\.php\?[^\"]*modulepart=[^\"]*)(\")/', '\1!~!~!~'.DOL_URL_ROOT.'\2\3', $content, -1, $nbrep);
// Fix relative URL
$content = str_replace('src="!~!~!~/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
@@ -218,11 +221,11 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
global $db, $langs, $conf, $user;
global $dolibarr_main_url_root, $dolibarr_main_data_root;
- dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'').')');
+ dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')');
// Define $urlwithroot
- $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
- $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
if (defined('USEDOLIBARREDITOR')) // REPLACEMENT OF LINKS When page called from Dolibarr editor
@@ -247,7 +250,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
$content = str_replace('href="//', 'href="!~!~!~//', $content);
$content = str_replace(array('src="viewimage.php', 'src="/viewimage.php'), 'src="!~!~!~/viewimage.php', $content);
$content = str_replace('src="'.DOL_URL_ROOT.'/viewimage.php', 'src="!~!~!~'.DOL_URL_ROOT.'/viewimage.php', $content);
- $content = str_replace(array('href="document.php','href="/document.php'), 'href="!~!~!~/document.php', $content);
+ $content = str_replace(array('href="document.php', 'href="/document.php'), 'href="!~!~!~/document.php', $content);
$content = str_replace('href="'.DOL_URL_ROOT.'/document.php', 'href="!~!~!~'.DOL_URL_ROOT.'/document.php', $content);
// Replace relative link / with dolibarr URL: ...href="/"...
@@ -292,62 +295,62 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '')
}
else // REPLACEMENT OF LINKS When page called from virtual host
{
- $symlinktomediaexists=1;
+ $symlinktomediaexists = 1;
// Make a change into HTML code to allow to include images from medias directory correct with direct link for virtual server
//
// become
//
- $nbrep=0;
- if (! $symlinktomediaexists)
+ $nbrep = 0;
+ if (!$symlinktomediaexists)
{
// ]*src=")\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
- $content=preg_replace('/(url\(["\']?)\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
+ $content = preg_replace('/( ]*src=")\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
+ $content = preg_replace('/(url\(["\']?)\/?image\//', '\1/wrapper.php?modulepart=medias&file=medias/image/', $content, -1, $nbrep);
- $content=preg_replace('/('."\n";
@@ -604,8 +607,8 @@ function getStructuredData($type, $data = array())
elseif ($type == 'product')
{
$ret = ''."\n";
- $ret.= ''."\n";
+ $ret .= ''."\n";
}
return $ret;
}
@@ -653,55 +656,55 @@ function getStructuredData($type, $data = array())
*/
function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
{
- global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
+ global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
$error = 0;
$arrayresult = array('code'=>'', 'list'=>array());
- if (! is_object($weblangs)) $weblangs = $langs;
+ if (!is_object($weblangs)) $weblangs = $langs;
if (empty($searchstring))
{
$error++;
- $arrayresult['code']='KO';
- $arrayresult['message']=$weblangs->trans("EmptySearchString");
+ $arrayresult['code'] = 'KO';
+ $arrayresult['message'] = $weblangs->trans("EmptySearchString");
}
elseif (dol_strlen($searchstring) < 2)
{
$weblangs->load("errors");
$error++;
- $arrayresult['code']='KO';
- $arrayresult['message']=$weblangs->trans("ErrorSearchCriteriaTooSmall");
+ $arrayresult['code'] = 'KO';
+ $arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall");
}
- elseif (! in_array($type, array('', 'page')))
+ elseif (!in_array($type, array('', 'page')))
{
$error++;
- $arrayresult['code']='KO';
- $arrayresult['message']='Bad value for parameter $type';
+ $arrayresult['code'] = 'KO';
+ $arrayresult['message'] = 'Bad value for parameter $type';
}
$searchdone = 0;
$found = 0;
- if (! $error && (empty($max) || ($found < $max)) && (preg_match('/meta/', $algo) || preg_match('/content/', $algo)))
+ if (!$error && (empty($max) || ($found < $max)) && (preg_match('/meta/', $algo) || preg_match('/content/', $algo)))
{
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'website_page';
- $sql.= " WHERE fk_website = ".$website->id;
- if ($type) $sql.= " AND type_container = '".$db->escape($type)."'";
- $sql.= " AND (";
+ $sql .= " WHERE fk_website = ".$website->id;
+ if ($type) $sql .= " AND type_container = '".$db->escape($type)."'";
+ $sql .= " AND (";
$searchalgo = '';
if (preg_match('/meta/', $algo))
{
- $searchalgo.= ($searchalgo?' OR ':'')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'";
- $searchalgo.= ($searchalgo?' OR ':'')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."title LIKE '%".$db->escape($searchstring)."%' OR description LIKE '%".$db->escape($searchstring)."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."keywords LIKE '".$db->escape($searchstring).",%' OR keywords LIKE '% ".$db->escape($searchstring)."%'"; // TODO Use a better way to scan keywords
}
if (preg_match('/content/', $algo))
{
- $searchalgo.= ($searchalgo?' OR ':'')."content LIKE '%".$db->escape($searchstring)."%'";
+ $searchalgo .= ($searchalgo ? ' OR ' : '')."content LIKE '%".$db->escape($searchstring)."%'";
}
- $sql.=$searchalgo;
- $sql.= ")";
- $sql.= $db->plimit($max);
+ $sql .= $searchalgo;
+ $sql .= ")";
+ $sql .= $db->plimit($max);
$resql = $db->query($sql);
if ($resql)
@@ -713,7 +716,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
{
$tmpwebsitepage = new WebsitePage($db);
$tmpwebsitepage->fetch($obj->rowid);
- if ($tmpwebsitepage->id > 0) $arrayresult['list'][]=$tmpwebsitepage;
+ if ($tmpwebsitepage->id > 0) $arrayresult['list'][] = $tmpwebsitepage;
$found++;
}
$i++;
@@ -722,69 +725,69 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25)
else
{
$error++;
- $arrayresult['code']=$db->lasterrno();
- $arrayresult['message']=$db->lasterror();
+ $arrayresult['code'] = $db->lasterrno();
+ $arrayresult['message'] = $db->lasterror();
}
$searchdone = 1;
}
- if (! $error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo)))
+ if (!$error && (empty($max) || ($found < $max)) && (preg_match('/sitefiles/', $algo)))
{
global $dolibarr_main_data_root;
- $pathofwebsite=$dolibarr_main_data_root.'/website/'.$website->ref;
- $filehtmlheader=$pathofwebsite.'/htmlheader.html';
- $filecss=$pathofwebsite.'/styles.css.php';
- $filejs=$pathofwebsite.'/javascript.js.php';
- $filerobot=$pathofwebsite.'/robots.txt';
- $filehtaccess=$pathofwebsite.'/.htaccess';
- $filemanifestjson=$pathofwebsite.'/manifest.json.php';
- $filereadme=$pathofwebsite.'/README.md';
+ $pathofwebsite = $dolibarr_main_data_root.'/website/'.$website->ref;
+ $filehtmlheader = $pathofwebsite.'/htmlheader.html';
+ $filecss = $pathofwebsite.'/styles.css.php';
+ $filejs = $pathofwebsite.'/javascript.js.php';
+ $filerobot = $pathofwebsite.'/robots.txt';
+ $filehtaccess = $pathofwebsite.'/.htaccess';
+ $filemanifestjson = $pathofwebsite.'/manifest.json.php';
+ $filereadme = $pathofwebsite.'/README.md';
$filecontent = file_get_contents($filehtmlheader);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
- $arrayresult['list'][]=array('type'=>'website_htmlheadercontent');
+ $arrayresult['list'][] = array('type'=>'website_htmlheadercontent');
}
$filecontent = file_get_contents($filecss);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
- $arrayresult['list'][]=array('type'=>'website_csscontent');
+ $arrayresult['list'][] = array('type'=>'website_csscontent');
}
$filecontent = file_get_contents($filejs);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
- $arrayresult['list'][]=array('type'=>'website_jscontent');
+ $arrayresult['list'][] = array('type'=>'website_jscontent');
}
$filerobot = file_get_contents($filerobot);
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent))
{
- $arrayresult['list'][]=array('type'=>'website_robotcontent');
+ $arrayresult['list'][] = array('type'=>'website_robotcontent');
}
$searchdone = 1;
}
- if (! $error)
+ if (!$error)
{
if ($searchdone)
{
- $arrayresult['code']='OK';
+ $arrayresult['code'] = 'OK';
if (empty($arrayresult['list']))
{
- $arrayresult['code']='KO';
- $arrayresult['message']=$weblangs->trans("NoRecordFound");
+ $arrayresult['code'] = 'KO';
+ $arrayresult['message'] = $weblangs->trans("NoRecordFound");
}
}
else
{
$error++;
- $arrayresult['code']='KO';
- $arrayresult['message']='No supported algorithm found';
+ $arrayresult['code'] = 'KO';
+ $arrayresult['message'] = 'No supported algorithm found';
}
}
diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php
index 5e8711e09d1..89df263b026 100644
--- a/htdocs/core/lib/website2.lib.php
+++ b/htdocs/core/lib/website2.lib.php
@@ -159,7 +159,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tmpshortlangcode = '';
if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en
if ($tmpshortlangcode != $shortlangcode) {
- $tplcontent .= ' '."\n";
+ $tplcontent .= ' '."\n";
}
}
}
@@ -176,7 +176,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
$tmpshortlangcode = '';
if ($obj->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en
if ($tmpshortlangcode != $shortlangcode) {
- $tplcontent .= ' '."\n";
+ $tplcontent .= ' '."\n";
}
}
}
@@ -184,7 +184,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage)
else dol_print_error($db);
}
// Add canonical reference
- $tplcontent .= ' '."\n";
+ $tplcontent .= ' '."\n";
// Add manifest.json on homepage
$tplcontent .= 'use_manifest) { print \' \'."\n"; } ?>'."\n";
$tplcontent .= ''."\n";
diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql
index 8948c391899..66ed948585f 100644
--- a/htdocs/core/menus/init_menu_auguria.sql
+++ b/htdocs/core/menus/init_menu_auguria.sql
@@ -281,7 +281,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Balance
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2435__+MAX_llx_menu__, 'accountancy', 'balance', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_balance', 'AccountBalance', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
-- Export accounting documents
- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/compta-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__);
+ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 17, __ENTITY__);
-- Reports
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2440__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2400__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'Reportings', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 17, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_report"', __HANDLER__, 'left', 2441__+MAX_llx_menu__, 'accountancy', 'accountancy_report', 2440__+MAX_llx_menu__, '/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy_report', 'MenuReportInOut', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 18, __ENTITY__);
diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
index fc1d737a7d5..e83e164d076 100644
--- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
+++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php
@@ -546,9 +546,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
- $iniY = $tab_top + $this->tabTitleHeight + 2;
- $curY = $tab_top + $this->tabTitleHeight + 2;
- $nexY = $tab_top + $this->tabTitleHeight + 2;
+ $nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
@@ -567,12 +565,9 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore = $pdf->getPage();
- // Description of product line
- $curX = $this->posxdesc - 1;
$showpricebeforepagebreak = 1;
$posYAfterImage = 0;
- $posYAfterDescription = 0;
if ($this->getColumnStatus('photo'))
{
@@ -603,15 +598,18 @@ class pdf_eratosthene extends ModelePDFCommandes
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
- $pageposafter = $pdf->getPage();
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
+
+ $pageposafter = $pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
@@ -638,7 +636,6 @@ class pdf_eratosthene extends ModelePDFCommandes
{
$pdf->commitTransaction();
}
- $posYAfterDescription = $pdf->GetY();
}
@@ -775,11 +772,10 @@ class pdf_eratosthene extends ModelePDFCommandes
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
- $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
+ $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
- $nexY += 2; // Add space between lines
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@@ -1691,7 +1687,7 @@ class pdf_eratosthene extends ModelePDFCommandes
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@@ -1728,10 +1724,11 @@ class pdf_eratosthene extends ModelePDFCommandes
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
+ 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index 0ef7acc7bef..6268f84d127 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -418,9 +418,7 @@ class pdf_espadon extends ModelePdfExpedition
$pdf->rollbackTransaction(true);
- $iniY = $tab_top + $this->tabTitleHeight + 2;
- $curY = $tab_top + $this->tabTitleHeight + 2;
- $nexY = $tab_top + $this->tabTitleHeight + 2;
+ $nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
for ($i = 0; $i < $nblines; $i++)
@@ -473,15 +471,15 @@ class pdf_espadon extends ModelePdfExpedition
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
- $pageposafter = $pdf->getPage();
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
+
+ $pageposafter = $pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
- $pageposafter = $pageposbefore;
- //print $pageposafter.'-'.$pageposbefore;exit;
- $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
@@ -582,16 +580,13 @@ class pdf_espadon extends ModelePdfExpedition
}
}
- $nexY += 3;
- if ($weighttxt && $voltxt) $nexY += 2;
-
// Add line
if (!empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblines - 1))
{
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
- $pdf->line($this->marge_gauche, $nexY - 1, $this->page_largeur - $this->marge_droite, $nexY - 1);
+ $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
@@ -1121,7 +1116,7 @@ class pdf_espadon extends ModelePdfExpedition
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@@ -1158,10 +1153,10 @@ class pdf_espadon extends ModelePdfExpedition
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
- 'align' => 'L',
+ 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 55deb9327ac..220c83d5d63 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -582,9 +582,7 @@ class pdf_sponge extends ModelePDFFactures
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
- $iniY = $tab_top + $this->tabTitleHeight + 2;
- $curY = $tab_top + $this->tabTitleHeight + 2;
- $nexY = $tab_top + $this->tabTitleHeight + 2;
+ $nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
@@ -605,7 +603,6 @@ class pdf_sponge extends ModelePDFFactures
$showpricebeforepagebreak = 1;
$posYAfterImage = 0;
- $posYAfterDescription = 0;
if ($this->getColumnStatus('photo'))
{
@@ -637,13 +634,17 @@ class pdf_sponge extends ModelePDFFactures
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
+
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
+
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
//var_dump($posyafter); var_dump(($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))); exit;
@@ -670,10 +671,9 @@ class pdf_sponge extends ModelePDFFactures
{
$pdf->commitTransaction();
}
- $posYAfterDescription = $pdf->GetY();
}
- $nexY = $pdf->GetY();
+ $nexY = $pdf->GetY();
$pageposafter = $pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
@@ -823,12 +823,10 @@ class pdf_sponge extends ModelePDFFactures
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
- $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
+ $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
- $nexY += 2; // Add space between lines
-
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) {
$pdf->setPage($pagenb);
@@ -2216,7 +2214,7 @@ class pdf_sponge extends ModelePDFFactures
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@@ -2257,6 +2255,7 @@ class pdf_sponge extends ModelePDFFactures
),
'content' => array(
'align' => 'L',
+ 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index 9c094aa122e..87f11decb5e 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -7,6 +7,7 @@
* Copyright (C) 2012-2013 Juanjo Menent
* Copyright (C) 2014 Christophe Battarel
* Copyright (C) 2014 Cedric Gross
+ * Copyright (C) 2020 Alexandre Spangaro
*
* 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
@@ -168,209 +169,214 @@ class modProduct extends DolibarrModules
// Exports
//--------
- $r=0;
+ $r = 0;
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array(
- 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",
- 'p.fk_product_type'=>'Type','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",
- 'p.description'=>"Description",'p.url'=>"PublicUrl",
- 'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry',
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "Products"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array(
+ 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
+ 'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",
+ 'p.description'=>"Description", 'p.url'=>"PublicUrl",
+ 'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry',
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
- 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
+ 'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
+ 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
'p.weight'=>"Weight", 'p.weight_units'=>"WeightUnits", 'p.length'=>"Length", 'p.length_units'=>"LengthUnits", 'p.width'=>"Width", 'p.width_units'=>"WidthUnits", 'p.height'=>"Height", 'p.height_units'=>"HeightUnits",
'p.surface'=>"Surface", 'p.surface_units'=>"SurfaceUnits", 'p.volume'=>"Volume", 'p.volume_units'=>"VolumeUnits",
'p.duration'=>"Duration",
'p.finished' => 'Nature',
- 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
+ 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC",
'p.tva_tx'=>'VATRate',
- 'p.datec'=>'DateCreation','p.tms'=>'DateModification'
+ 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
);
- if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
- if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
- if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
- if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
- $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
+ if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
+ if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
+ if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
- if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
- $this->export_TypeFields_array[$r]=array(
- 'p.ref'=>"Text",'p.label'=>"Text",
- 'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
- 'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
- 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
- 'p.note'=>"Text",'p.note_public'=>"Text",
- 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
+ if (!empty($conf->fournisseur->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote'));
+ if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
+ $this->export_TypeFields_array[$r] = array(
+ 'p.ref'=>"Text", 'p.label'=>"Text",
+ 'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
+ 'p.description'=>"Text", 'p.url'=>"Text",
+ 'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
+ 'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
+ 'p.note'=>"Text", 'p.note_public'=>"Text",
+ 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric",
'p.customcode'=>'Text',
'p.duration'=>"Text",
'p.finished' => 'Numeric',
- 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric',
- 'p.datec'=>'Date','p.tms'=>'Date'
+ 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
+ 'p.datec'=>'Date', 'p.tms'=>'Date'
);
- if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
- if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
- if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
- $this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
- if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
- if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
- if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
- if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
- if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
- if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
- if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
- $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
+ if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
+ if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ if (!empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
+ $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
+ if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
+ if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
+ if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
+ if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
+ if (!empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
+ $this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 0 AND p.entity IN ('.getEntity('product').')';
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] = ' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
- if (! empty($conf->global->PRODUIT_MULTIPRICES))
+ if (!empty($conf->global->PRODUIT_MULTIPRICES))
{
// Exports product multiprice
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
- 'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
- 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
- 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
+ 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
+ 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
+ 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation');
- if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
//$this->export_TypeFields_array[$r]=array(
// 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
// 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
// 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
// 'p.datec'=>'Date','p.tms'=>'Date'
//);
- $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
- 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
+ $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
+ 'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
- 'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
+ 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.recuperableonly'=>'product',
'pr.date_price'=>"product");
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
- $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
+ $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
}
- if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
+ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
// Exports product multiprice
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
's.nom'=>'ThirdParty',
'pr.price_base_type'=>"PriceBase",
- 'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
- 'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
+ 'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
+ 'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
'pr.tva_tx'=>'PriceVATRate',
'pr.default_vat_code'=>'PriceVATCode',
'pr.datec'=>'DateCreation');
- if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
- $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
+ $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
's.nom'=>'company',
- 'pr.price_base_type'=>"product",'pr.price'=>"product",
+ 'pr.price_base_type'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
- 'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
+ 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.default_vat_code'=>'product',
'pr.recuperableonly'=>'product',
'pr.datec'=>"product");
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
- $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
+ $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
}
- if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
+ if (!empty($conf->global->PRODUIT_SOUSPRODUITS))
{
// Exports virtual products
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array(
- 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
- 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
- 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
- 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
- 'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode',
- 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
- 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array(
+ 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
+ 'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
+ 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
+ 'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
+ 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
+ 'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
+ 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
+ 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
);
- if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
- if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
- $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
- $this->export_TypeFields_array[$r]=array(
- 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",
- 'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
- 'p.note'=>"Text",'p.note_public'=>"Text",
- 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text',
- 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
- 'p.datec'=>'Date','p.tms'=>'Date'
+ if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
+ if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
+ $this->export_TypeFields_array[$r] = array(
+ 'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
+ 'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
+ 'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
+ 'p.note'=>"Text", 'p.note_public'=>"Text",
+ 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
+ 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
+ 'p.datec'=>'Date', 'p.tms'=>'Date'
);
- if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
- if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
- $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
- $this->export_entities_array[$r]=array(
- 'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
- 'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
- 'p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
- 'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
- 'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
- 'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
+ if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
+ if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
+ $this->export_entities_array[$r] = array(
+ 'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
+ 'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
+ 'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
+ 'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
+ 'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
+ 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
+ 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
);
- if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
- if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
- $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
- $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
+ if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
+ $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
- $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
- $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
- $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
- $this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description"));
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct"));
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
+ $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
+ $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
+ $this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
}
// Imports
//--------
- $r=0;
+ $r = 0;
// Import list of products
$r++;
- $this->import_code[$r]=$this->rights_class.'_'.$r;
- $this->import_label[$r]="Products"; // Translation key
- $this->import_icon[$r]=$this->picto;
- $this->import_entities_array[$r]=array(); // We define here only fields that use a different icon from the one defined in import_icon
- $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
- $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
- $this->import_fields_array[$r]=array(
+ $this->import_code[$r] = $this->rights_class.'_'.$r;
+ $this->import_label[$r] = "Products"; // Translation key
+ $this->import_icon[$r] = $this->picto;
+ $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
+ $this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields');
+ $this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id
+ $this->import_fields_array[$r] = array(
'p.ref' => "Ref*",
'p.label' => "Label*",
'p.fk_product_type' => "Type*",
@@ -384,6 +390,8 @@ class modProduct extends DolibarrModules
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
+ 'p.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode",
+ 'p.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode",
'p.note_public' => "NotePublic",
'p.note' => "NotePrivate",
'p.weight' => "Weight",
@@ -533,6 +541,8 @@ class modProduct extends DolibarrModules
'p.accountancy_code_sell_intra' => "",
'p.accountancy_code_sell_export' => "",
'p.accountancy_code_buy' => "",
+ 'p.accountancy_code_buy_intra' => "",
+ 'p.accountancy_code_buy_export' => "",
'p.weight' => "",
'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.length' => "",
@@ -566,7 +576,7 @@ class modProduct extends DolibarrModules
)
);
- if (! is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
+ if (!is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
'p.fk_unit' => array(
'rule' => 'fetchidfromcodeorlabel',
diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php
index 4fb5cb175b0..e99f94aa154 100644
--- a/htdocs/core/modules/modService.class.php
+++ b/htdocs/core/modules/modService.class.php
@@ -4,6 +4,7 @@
* Copyright (C) 2004 Sebastien Di Cintio
* Copyright (C) 2004 Benoit Mortier
* Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2020 Alexandre Spangaro
*
* 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
@@ -135,211 +136,216 @@ class modService extends DolibarrModules
// Exports
//--------
- $r=0;
+ $r = 0;
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("service","export"));
- $this->export_fields_array[$r]=array(
- 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",
- 'p.fk_product_type'=>'Type','p.tosell'=>"OnSell",'p.tobuy'=>"OnBuy",
- 'p.description'=>"Description",'p.url'=>"PublicUrl",
- 'p.customcode'=>'CustomCode','p.fk_country'=>'IDCountry',
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "Services"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("service", "export"));
+ $this->export_fields_array[$r] = array(
+ 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label",
+ 'p.fk_product_type'=>'Type', 'p.tosell'=>"OnSell", 'p.tobuy'=>"OnBuy",
+ 'p.description'=>"Description", 'p.url'=>"PublicUrl",
+ 'p.customcode'=>'CustomCode', 'p.fk_country'=>'IDCountry',
'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
- 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
- 'p.weight'=>"Weight",'p.length'=>"Length",'p.width'=>"Width",'p.height'=>"Height",'p.surface'=>"Surface",'p.volume'=>"Volume",
+ 'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
+ 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
+ 'p.weight'=>"Weight", 'p.length'=>"Length", 'p.width'=>"Width", 'p.height'=>"Height", 'p.surface'=>"Surface", 'p.volume'=>"Volume",
'p.duration'=>"Duration",
'p.finished' => 'Nature',
- 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",
+ 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC",
'p.tva_tx'=>'VATRate',
- 'p.datec'=>'DateCreation','p.tms'=>'DateModification'
+ 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
);
- if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR';
- if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
- if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
- if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
- $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly'] = 'NPR';
+ if (!empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.cost_price'=>'CostPrice'));
+ if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
+ if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin','pf.unitprice'=>'BuyingPrice','pf.delivery_time_days'=>'NbDaysToDelivery'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote'));
- if (! empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
- $this->export_TypeFields_array[$r]=array(
- 'p.ref'=>"Text",'p.label'=>"Text",
- 'p.fk_product_type'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
- 'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",
- 'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
- 'p.note'=>"Text",'p.note_public'=>"Text",
- 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.width'=>"Numeric",'p.height'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",
+ if (!empty($conf->fournisseur->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('group_concat(cat.label)'=>'Categories'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel', 'l.description'=>'TranslatedDescription', 'l.note'=>'TranslatedNote'));
+ if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->export_fields_array[$r]['p.fk_unit'] = 'Unit';
+ $this->export_TypeFields_array[$r] = array(
+ 'p.ref'=>"Text", 'p.label'=>"Text",
+ 'p.fk_product_type'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
+ 'p.description'=>"Text", 'p.url'=>"Text", 'p.accountancy_code_sell'=>"Text",
+ 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text", 'p.accountancy_code_buy'=>"Text",
+ 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
+ 'p.note'=>"Text", 'p.note_public'=>"Text",
+ 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.width'=>"Numeric", 'p.height'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric",
'p.customcode'=>'Text',
'p.duration'=>"Text",
'p.finished' => 'Numeric',
- 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric',
- 'p.datec'=>'Date','p.tms'=>'Date'
+ 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric',
+ 'p.datec'=>'Date', 'p.tms'=>'Date'
);
- if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
- if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
- if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric','pf.delivery_time_days'=>'Numeric'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
- $this->export_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
- if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
- if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
- if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
- if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'product','p.pmp'=>'product'));
- if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
- if (! empty($conf->fournisseur->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref','pf.ref_fourn'=>'product_supplier_ref','pf.unitprice'=>'product_supplier_ref','pf.quantity'=>'product_supplier_ref','pf.remise_percent'=>'product_supplier_ref','pf.delivery_time_days'=>'product_supplier_ref'));
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation','l.description'=>'translation','l.note'=>'translation'));
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r]=array('category'=>'p.rowid');
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
- if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
- if (! empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
- $this->export_sql_end[$r] .=' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
- if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] =' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
+ if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
+ if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ if (!empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('s.nom'=>'Text', 'pf.ref_fourn'=>'Text', 'pf.unitprice'=>'Numeric', 'pf.quantity'=>'Numeric', 'pf.remise_percent'=>'Numeric', 'pf.delivery_time_days'=>'Numeric'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('l.lang'=>'Text', 'l.label'=>'Text', 'l.description'=>'Text', 'l.note'=>'Text'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array("group_concat(cat.label)"=>'Text'));
+ $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array("group_concat(cat.label)"=>'category'));
+ if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
+ if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
+ if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
+ if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
+ if (!empty($conf->fournisseur->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('s.nom'=>'product_supplier_ref', 'pf.ref_fourn'=>'product_supplier_ref', 'pf.unitprice'=>'product_supplier_ref', 'pf.quantity'=>'product_supplier_ref', 'pf.remise_percent'=>'product_supplier_ref', 'pf.delivery_time_days'=>'product_supplier_ref'));
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('l.lang'=>'translation', 'l.label'=>'translation', 'l.description'=>'translation', 'l.note'=>'translation'));
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_dependencies_array[$r] = array('category'=>'p.rowid');
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid';
+ if (!empty($conf->global->MAIN_MULTILANGS)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lang as l ON l.fk_product = p.rowid';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object';
+ if (!empty($conf->fournisseur->enabled)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price as pf ON pf.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'societe s ON s.rowid = pf.fk_soc';
+ $this->export_sql_end[$r] .= ' WHERE p.fk_product_type = 1 AND p.entity IN ('.getEntity('product').')';
+ if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_sql_order[$r] = ' GROUP BY p.rowid'; // FIXME The group by used a generic value to say "all fields in select except function fields"
if (empty($conf->product->enabled)) // We enable next import templates only if module product not already enabled (to avoid duplicate entries)
{
- if (! empty($conf->global->PRODUIT_MULTIPRICES))
+ if (!empty($conf->global->PRODUIT_MULTIPRICES))
{
// Exports product multiprice
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
- 'pr.price_base_type'=>"PriceBase",'pr.price_level'=>"PriceLevel",
- 'pr.price'=>"PriceLevelUnitPriceHT",'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
- 'pr.price_min'=>"MinPriceLevelUnitPriceHT",'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "ProductsMultiPrice"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
+ 'pr.price_base_type'=>"PriceBase", 'pr.price_level'=>"PriceLevel",
+ 'pr.price'=>"PriceLevelUnitPriceHT", 'pr.price_ttc'=>"PriceLevelUnitPriceTTC",
+ 'pr.price_min'=>"MinPriceLevelUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceLevelUnitPriceTTC",
'pr.tva_tx'=>'PriceLevelVATRate',
'pr.date_price'=>'DateCreation');
- if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
//$this->export_TypeFields_array[$r]=array(
// 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",
// 'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text',
// 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
// 'p.datec'=>'Date','p.tms'=>'Date'
//);
- $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
- 'pr.price_base_type'=>"product",'pr.price_level'=>"product",'pr.price'=>"product",
+ $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
+ 'pr.price_base_type'=>"product", 'pr.price_level'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
- 'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
+ 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.recuperableonly'=>'product',
'pr.date_price'=>"product");
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
- $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
+ $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
}
- if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
+ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
// Exports product multiprice
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array('p.rowid'=>"Id",'p.ref'=>"Ref",
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "ProductsPricePerCustomer"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array('p.rowid'=>"Id", 'p.ref'=>"Ref",
's.nom'=>'ThirdParty',
'pr.price_base_type'=>"PriceBase",
- 'pr.price'=>"PriceUnitPriceHT",'pr.price_ttc'=>"PriceUnitPriceTTC",
- 'pr.price_min'=>"MinPriceUnitPriceHT",'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
+ 'pr.price'=>"PriceUnitPriceHT", 'pr.price_ttc'=>"PriceUnitPriceTTC",
+ 'pr.price_min'=>"MinPriceUnitPriceHT", 'pr.price_min_ttc'=>"MinPriceUnitPriceTTC",
'pr.tva_tx'=>'PriceVATRate',
'pr.default_vat_code'=>'PriceVATCode',
'pr.datec'=>'DateCreation');
- if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly']='NPR';
- $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",
+ if (is_object($mysoc) && $mysoc->useNPR()) $this->export_fields_array[$r]['pr.recuperableonly'] = 'NPR';
+ $this->export_entities_array[$r] = array('p.rowid'=>"product", 'p.ref'=>"product",
's.nom'=>'company',
- 'pr.price_base_type'=>"product",'pr.price'=>"product",
+ 'pr.price_base_type'=>"product", 'pr.price'=>"product",
'pr.price_ttc'=>"product",
- 'pr.price_min'=>"product",'pr.price_min_ttc'=>"product",
+ 'pr.price_min'=>"product", 'pr.price_min_ttc'=>"product",
'pr.tva_tx'=>'product',
'pr.default_vat_code'=>'product',
'pr.recuperableonly'=>'product',
'pr.datec'=>"product");
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
- $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_customer_price as pr ON p.rowid = pr.fk_product AND pr.entity = '.$conf->entity; // export prices only for the current entity
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON pr.fk_soc = s.rowid';
+ $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
}
- if (! empty($conf->global->PRODUIT_SOUSPRODUITS))
+ if (!empty($conf->global->PRODUIT_SOUSPRODUITS))
{
// Exports virtual products
$r++;
- $this->export_code[$r]=$this->rights_class.'_'.$r;
- $this->export_label[$r]="AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
- $this->export_permission[$r]=array(array("produit","export"));
- $this->export_fields_array[$r]=array(
- 'p.rowid'=>"Id",'p.ref'=>"Ref",'p.label'=>"Label",'p.description'=>"Description",'p.url'=>"PublicUrl",
- 'p.accountancy_code_sell'=>"ProductAccountancySellCode",'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
- 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode",'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
- 'p.note'=>"NotePrivate",'p.note_public'=>'NotePublic',
- 'p.weight'=>"Weight",'p.length'=>"Length",'p.surface'=>"Surface",'p.volume'=>"Volume",'p.customcode'=>'CustomCode',
- 'p.price_base_type'=>"PriceBase",'p.price'=>"UnitPriceHT",'p.price_ttc'=>"UnitPriceTTC",'p.tva_tx'=>'VATRate','p.tosell'=>"OnSell",
- 'p.tobuy'=>"OnBuy",'p.datec'=>'DateCreation','p.tms'=>'DateModification'
+ $this->export_code[$r] = $this->rights_class.'_'.$r;
+ $this->export_label[$r] = "AssociatedProducts"; // Translation key (used only if key ExportDataset_xxx_z not found)
+ $this->export_permission[$r] = array(array("produit", "export"));
+ $this->export_fields_array[$r] = array(
+ 'p.rowid'=>"Id", 'p.ref'=>"Ref", 'p.label'=>"Label", 'p.description'=>"Description", 'p.url'=>"PublicUrl",
+ 'p.accountancy_code_sell'=>"ProductAccountancySellCode", 'p.accountancy_code_sell_intra'=>"ProductAccountancySellIntraCode",
+ 'p.accountancy_code_sell_export'=>"ProductAccountancySellExportCode", 'p.accountancy_code_buy'=>"ProductAccountancyBuyCode",
+ 'p.accountancy_code_buy_intra'=>"ProductAccountancyBuyIntraCode", 'p.accountancy_code_buy_export'=>"ProductAccountancyBuyExportCode",
+ 'p.note'=>"NotePrivate", 'p.note_public'=>'NotePublic',
+ 'p.weight'=>"Weight", 'p.length'=>"Length", 'p.surface'=>"Surface", 'p.volume'=>"Volume", 'p.customcode'=>'CustomCode',
+ 'p.price_base_type'=>"PriceBase", 'p.price'=>"UnitPriceHT", 'p.price_ttc'=>"UnitPriceTTC", 'p.tva_tx'=>'VATRate', 'p.tosell'=>"OnSell",
+ 'p.tobuy'=>"OnBuy", 'p.datec'=>'DateCreation', 'p.tms'=>'DateModification'
);
- if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue'));
- if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
- $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty','pa.incdec'=>'ComposedProductIncDecStock'));
- $this->export_TypeFields_array[$r]=array(
- 'p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",
- 'p.accountancy_code_sell'=>"Text",'p.accountancy_code_sell_intra'=>"Text",'p.accountancy_code_sell_export'=>"Text",'p.accountancy_code_buy'=>"Text",
- 'p.note'=>"Text",'p.note_public'=>"Text",
- 'p.weight'=>"Numeric",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.customcode'=>'Text',
- 'p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",
- 'p.datec'=>'Date','p.tms'=>'Date'
+ if (!empty($conf->stock->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
+ if (!empty($conf->barcode->enabled)) $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
+ $this->export_TypeFields_array[$r] = array(
+ 'p.ref'=>"Text", 'p.label'=>"Text", 'p.description'=>"Text", 'p.url'=>"Text",
+ 'p.accountancy_code_sell'=>"Text", 'p.accountancy_code_sell_intra'=>"Text", 'p.accountancy_code_sell_export'=>"Text",
+ 'p.accountancy_code_buy'=>"Text", 'p.accountancy_code_buy_intra'=>"Text", 'p.accountancy_code_buy_export'=>"Text",
+ 'p.note'=>"Text", 'p.note_public'=>"Text",
+ 'p.weight'=>"Numeric", 'p.length'=>"Numeric", 'p.surface'=>"Numeric", 'p.volume'=>"Numeric", 'p.customcode'=>'Text',
+ 'p.price_base_type'=>"Text", 'p.price'=>"Numeric", 'p.price_ttc'=>"Numeric", 'p.tva_tx'=>'Numeric', 'p.tosell'=>"Boolean", 'p.tobuy'=>"Boolean",
+ 'p.datec'=>'Date', 'p.tms'=>'Date'
);
- if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric'));
- if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
- $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
- $this->export_entities_array[$r]=array(
- 'p.rowid'=>"virtualproduct",'p.ref'=>"virtualproduct",'p.label'=>"virtualproduct",'p.description'=>"virtualproduct",'p.url'=>"virtualproduct",
- 'p.accountancy_code_sell'=>'virtualproduct','p.accountancy_code_sell_intra'=>'virtualproduct','p.accountancy_code_sell_export'=>'virtualproduct',
- 'p.accountancy_code_buy'=>'virtualproduct','p.note'=>"virtualproduct",'p.length'=>"virtualproduct",
- 'p.surface'=>"virtualproduct",'p.volume'=>"virtualproduct",'p.weight'=>"virtualproduct",'p.customcode'=>'virtualproduct',
- 'p.price_base_type'=>"virtualproduct",'p.price'=>"virtualproduct",'p.price_ttc'=>"virtualproduct",'p.tva_tx'=>"virtualproduct",
- 'p.tosell'=>"virtualproduct",'p.tobuy'=>"virtualproduct",'p.datec'=>"virtualproduct",'p.tms'=>"virtualproduct"
+ if (!empty($conf->stock->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
+ if (!empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
+ $this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
+ $this->export_entities_array[$r] = array(
+ 'p.rowid'=>"virtualproduct", 'p.ref'=>"virtualproduct", 'p.label'=>"virtualproduct", 'p.description'=>"virtualproduct", 'p.url'=>"virtualproduct",
+ 'p.accountancy_code_sell'=>'virtualproduct', 'p.accountancy_code_sell_intra'=>'virtualproduct', 'p.accountancy_code_sell_export'=>'virtualproduct',
+ 'p.accountancy_code_buy'=>'virtualproduct', 'p.accountancy_code_buy_intra'=>'virtualproduct', 'p.accountancy_code_buy_export'=>'virtualproduct',
+ 'p.note'=>"virtualproduct", 'p.length'=>"virtualproduct",
+ 'p.surface'=>"virtualproduct", 'p.volume'=>"virtualproduct", 'p.weight'=>"virtualproduct", 'p.customcode'=>'virtualproduct',
+ 'p.price_base_type'=>"virtualproduct", 'p.price'=>"virtualproduct", 'p.price_ttc'=>"virtualproduct", 'p.tva_tx'=>"virtualproduct",
+ 'p.tosell'=>"virtualproduct", 'p.tobuy'=>"virtualproduct", 'p.datec'=>"virtualproduct", 'p.tms'=>"virtualproduct"
);
- if (! empty($conf->stock->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct','p.seuil_stock_alerte'=>'virtualproduct','p.desiredstock'=>'virtualproduct','p.pmp'=>'virtualproduct'));
- if (! empty($conf->barcode->enabled)) $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
- $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct",'pa.incdec'=>'subproduct'));
- $keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
+ if (!empty($conf->stock->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
+ if (!empty($conf->barcode->enabled)) $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
+ $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
- $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id",'p2.ref'=>"Ref",'p2.label'=>"Label",'p2.description'=>"Description"));
- $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct",'p2.ref'=>"subproduct",'p2.label'=>"subproduct",'p2.description'=>"subproduct"));
- $this->export_sql_start[$r]='SELECT DISTINCT ';
- $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'product as p';
- $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
- $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
- $this->export_sql_end[$r] .=' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
- $this->export_sql_end[$r] .=' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
+ $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description"));
+ $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct"));
+ $this->export_sql_start[$r] = 'SELECT DISTINCT ';
+ $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p';
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,';
+ $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2';
+ $this->export_sql_end[$r] .= ' WHERE p.entity IN ('.getEntity('product').')'; // For product and service profile
+ $this->export_sql_end[$r] .= ' AND p.rowid = pa.fk_product_pere AND p2.rowid = pa.fk_product_fils';
}
}
// Imports
//--------
- $r=0;
+ $r = 0;
// Import list of services
$r++;
- $this->import_code[$r]=$this->rights_class.'_'.$r;
- $this->import_label[$r]="Products"; // Translation key
- $this->import_icon[$r]=$this->picto;
- $this->import_entities_array[$r]=array(); // We define here only fields that use a different icon from the one defined in import_icon
- $this->import_tables_array[$r]=array('p'=>MAIN_DB_PREFIX.'product','extra'=>MAIN_DB_PREFIX.'product_extrafields');
- $this->import_tables_creator_array[$r]=array('p'=>'fk_user_author'); // Fields to store import user id
- $this->import_fields_array[$r]=array(
+ $this->import_code[$r] = $this->rights_class.'_'.$r;
+ $this->import_label[$r] = "Products"; // Translation key
+ $this->import_icon[$r] = $this->picto;
+ $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon
+ $this->import_tables_array[$r] = array('p'=>MAIN_DB_PREFIX.'product', 'extra'=>MAIN_DB_PREFIX.'product_extrafields');
+ $this->import_tables_creator_array[$r] = array('p'=>'fk_user_author'); // Fields to store import user id
+ $this->import_fields_array[$r] = array(
'p.ref' => "Ref*",
'p.label' => "Label*",
'p.fk_product_type' => "Type*",
@@ -353,6 +359,8 @@ class modService extends DolibarrModules
'p.accountancy_code_sell_intra' => "ProductAccountancySellIntraCode",
'p.accountancy_code_sell_export' => "ProductAccountancySellExportCode",
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
+ 'p.accountancy_code_buy_intra' => "ProductAccountancyBuyIntraCode",
+ 'p.accountancy_code_buy_export' => "ProductAccountancyBuyExportCode",
'p.note_public' => "NotePublic",
'p.note' => "NotePrivate",
'p.weight' => "Weight",
@@ -500,6 +508,8 @@ class modService extends DolibarrModules
'p.accountancy_code_sell_intra' => "",
'p.accountancy_code_sell_export' => "",
'p.accountancy_code_buy' => "",
+ 'p.accountancy_code_buy_intra' => "",
+ 'p.accountancy_code_buy_export' => "",
'p.weight' => "",
'p.weight_units' => 'kg', // Use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
'p.length' => "",
@@ -533,7 +543,7 @@ class modService extends DolibarrModules
)
);
- if (! is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
+ if (!is_array($this->import_convertvalue_array[$r])) $this->import_convertvalue_array[$r] = array();
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
'p.fk_unit' => array(
'rule' => 'fetchidfromcodeorlabel',
diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
index 702202be988..c45db2f8380 100644
--- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php
@@ -564,9 +564,7 @@ class pdf_cyan extends ModelePDFPropales
$this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop);
$pdf->rollbackTransaction(true);
- $iniY = $tab_top + $this->tabTitleHeight + 2;
- $curY = $tab_top + $this->tabTitleHeight + 2;
- $nexY = $tab_top + $this->tabTitleHeight + 2;
+ $nexY = $tab_top + $this->tabTitleHeight;
// Loop on each lines
$pageposbeforeprintlines = $pdf->getPage();
@@ -621,15 +619,17 @@ class pdf_cyan extends ModelePDFPropales
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
+
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
- $pageposafter = $pageposbefore;
- //print $pageposafter.'-'.$pageposbefore;exit;
+
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc);
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
@@ -794,11 +794,11 @@ class pdf_cyan extends ModelePDFPropales
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
- $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
+ $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
- $nexY += 2; // Add space between lines
+
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@@ -1840,7 +1840,7 @@ class pdf_cyan extends ModelePDFPropales
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@@ -1877,10 +1877,11 @@ class pdf_cyan extends ModelePDFPropales
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
+ 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
index 362f17c7e9c..c3a00bf667b 100644
--- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
+++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php
@@ -230,7 +230,7 @@ class pdf_stdmovement extends ModelePDFMovement
$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
- $page = GETPOST("page", 'int');
+ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
index 92bc5219688..2d3c766a7c2 100644
--- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
+++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php
@@ -496,9 +496,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$height_note = 0;
}
- $iniY = $tab_top + 7;
- $curY = $tab_top + 7;
- $nexY = $tab_top + 7;
+ $nexY = $tab_top + 5;
// Use new auto collum system
$this->prepareArrayColumnField($object, $outputlangs, $hidedetails, $hidedesc, $hideref);
@@ -555,15 +553,15 @@ class pdf_cornas extends ModelePDFSuppliersOrders
if ($this->getColumnStatus('desc'))
{
$pdf->startTransaction();
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
+
$pageposafter = $pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
$pdf->rollbackTransaction(true);
- $pageposafter = $pageposbefore;
- //print $pageposafter.'-'.$pageposbefore;exit;
- $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
- pdf_writelinedesc($pdf, $object, $i, $outputlangs, $this->getColumnContentWidth('desc'), 3, $this->getColumnContentXStart('desc'), $curY, $hideref, $hidedesc);
+
+ $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1);
+
$pageposafter = $pdf->getPage();
$posyafter = $pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot))) // There is no space left for total+free text
@@ -724,12 +722,10 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$pdf->setPage($pageposafter);
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
//$pdf->SetDrawColor(190,190,200);
- $pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
+ $pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
$pdf->SetLineStyle(array('dash'=>0));
}
- $nexY += 2; // Add space between lines
-
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
{
@@ -1483,7 +1479,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
// Default field style for content
$this->defaultContentsFieldsStyle = array(
'align' => 'R', // R,C,L
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
);
// Default field style for content
@@ -1520,10 +1516,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
'align' => 'L',
// 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label
// 'label' => ' ', // the final label
- 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
+ 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
'content' => array(
'align' => 'L',
+ 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left
),
);
diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_simple.php b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php
new file mode 100644
index 00000000000..4275e202f6e
--- /dev/null
+++ b/htdocs/core/modules/takepos/mod_takepos_ref_simple.php
@@ -0,0 +1,193 @@
+
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2013 Juanjo Menent
+ * Copyright (C) 2020 Open-DSI
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/modules/takepos/mod_takepos_ref_simple.php
+ * \ingroup takepos
+ * \brief File with Simple ref numbering module for takepos
+ */
+dol_include_once('/core/modules/takepos/modules_takepos.php');
+
+/**
+ * Class to manage ref numbering of takepos cards with rule Simple.
+ */
+class mod_takepos_ref_simple extends ModeleNumRefTakepos
+{
+ /**
+ * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr'
+ * @var string
+ */
+ public $version = 'dolibarr';
+
+ /**
+ * Prefix
+ * @var string
+ */
+ public $prefix = 'TK';
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * Name
+ * @var string
+ */
+ public $nom = 'Simple';
+
+ /**
+ * Return description of numbering module
+ *
+ * @return string Text with description
+ */
+ public function info()
+ {
+ global $langs;
+
+ return $langs->trans('SimpleNumRefModelDesc', $this->prefix . '0-');
+ }
+
+ /**
+ * Return an example of numbering module values
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ return $this->prefix . '0-0501-0001';
+ }
+
+ /**
+ * Test si les numeros deja en vigueur dans la base ne provoquent pas de
+ * de conflits qui empechera cette numerotation de fonctionner.
+ *
+ * @return boolean false si conflit, true si ok
+ */
+ public function canBeActivated()
+ {
+ global $conf, $langs, $db;
+
+ $pryymm = '';
+ $max = '';
+
+ $posindice = 8;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "facture";
+ $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix) . "____-%'";
+ $sql .= " AND entity = " . $conf->entity;
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $row = $db->fetch_row($resql);
+ if ($row) {
+ $pryymm = substr($row[0], 0, 6);
+ $max = $row[0];
+ }
+ }
+
+ if (!$pryymm || preg_match('/' . $this->prefix . '[0-9][0-9][0-9][0-9]/i', $pryymm)) {
+ return true;
+ } else {
+ $langs->load("errors");
+ $this->error = $langs->trans('ErrorNumRefModel', $max);
+ return false;
+ }
+ }
+
+ /**
+ * Return next value
+ *
+ * @param Societe $objsoc Object third party
+ * @param Facture $invoice Object invoice
+ * @param string $mode 'next' for next value or 'last' for last value
+ * @return string Next value
+ */
+ public function getNextValue($objsoc = null, $invoice = null, $mode = 'next')
+ {
+ global $db;
+
+ $pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0;
+
+ // D'abord on recupere la valeur max
+ $posindice = strlen($this->prefix . $pos_source . '-____-') + 1;
+ $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM " . $posindice . ") AS SIGNED)) as max"; // This is standard SQL
+ $sql .= " FROM " . MAIN_DB_PREFIX . "facture";
+ $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix . $pos_source) . "-____-%'";
+ $sql .= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj) $max = intval($obj->max);
+ else $max = 0;
+ } else {
+ dol_syslog(get_class($this) . "::getNextValue", LOG_DEBUG);
+ return -1;
+ }
+
+ if ($mode == 'last')
+ {
+ if ($max >= (pow(10, 4) - 1)) $num=$max; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max);
+
+ $ref = '';
+ $sql = "SELECT ref as ref";
+ $sql .= " FROM ". MAIN_DB_PREFIX . "facture";
+ $sql .= " WHERE ref LIKE '" . $db->escape($this->prefix . $pos_source) . "-____-" . $num . "'";
+ $sql .= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
+ $sql .= " ORDER BY ref DESC";
+
+ $resql = $db->query($sql);
+ if ($resql) {
+ $obj = $db->fetch_object($resql);
+ if ($obj) $ref = $obj->ref;
+ }
+ else dol_print_error($db);
+
+ return $ref;
+ }
+ elseif ($mode == 'next')
+ {
+ $date = $invoice->date; // This is invoice date (not creation date)
+ $yymm = strftime("%y%m", $date);
+
+ if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+ else $num = sprintf("%04s", $max+1);
+
+ dol_syslog(get_class($this)."::getNextValue return " . $this->prefix . $pos_source . '-' . $yymm . '-' . $num);
+ return $this->prefix . $pos_source . '-' . $yymm . '-' . $num;
+ }
+ else dol_print_error('', 'Bad parameter for getNextValue');
+ }
+
+ /**
+ * Return next free value
+ *
+ * @param Societe $objsoc Object third party
+ * @param Object $objforref Object for number to search
+ * @return string Next free value
+ */
+ public function getNumRef($objsoc, $objforref)
+ {
+ return $this->getNextValue($objsoc, $objforref);
+ }
+}
diff --git a/htdocs/core/modules/takepos/mod_takepos_ref_universal.php b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
new file mode 100644
index 00000000000..7fdff4c1c6b
--- /dev/null
+++ b/htdocs/core/modules/takepos/mod_takepos_ref_universal.php
@@ -0,0 +1,158 @@
+
+ * Copyright (C) 2004-2008 Laurent Destailleur
+ * Copyright (C) 2005-2009 Regis Houssin
+ * Copyright (C) 2008 Raphael Bertrand (Resultic)
+ * Copyright (C) 2013 Juanjo Menent
+ * Copyright (C) 2020 Open-DSI
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/modules/takepos/mod_takepos_ref_universal.php
+ * \ingroup takepos
+ * \brief File with Universal ref numbering module for takepos
+ */
+dol_include_once('/core/modules/takepos/modules_takepos.php');
+
+/**
+ * Class to manage ref numbering of takepos cards with rule universal.
+ */
+class mod_takepos_ref_universal extends ModeleNumRefTakepos
+{
+ /**
+ * Dolibarr version of the loaded document 'development', 'experimental', 'dolibarr'
+ * @var string
+ */
+ public $version = 'dolibarr';
+
+ /**
+ * @var string Error code (or message)
+ */
+ public $error = '';
+
+ /**
+ * Name
+ * @var string
+ */
+ public $nom = 'Universal';
+
+ /**
+ * Renvoi la description du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $conf, $langs;
+
+ $langs->load('cashdesk@cashdesk');
+
+ $form = new Form($this->db);
+
+ $texte = $langs->trans('GenericNumRefModelDesc') . " \n";
+ $texte .= '';
+
+ return $texte;
+ }
+
+ /**
+ * Renvoi un exemple de numerotation
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $conf, $langs, $mysoc;
+
+ $old_code_client = $mysoc->code_client;
+ $mysoc->code_client = 'CCCCCCCCCC';
+ $numExample = $this->getNextValue($mysoc, '');
+ $mysoc->code_client = $old_code_client;
+
+ if (!$numExample) {
+ $numExample = $langs->trans('NotConfigured');
+ }
+ return $numExample;
+ }
+
+ /**
+ * Return next free value
+ *
+ * @param Societe $objsoc Object thirdparty
+ * @param Facture $invoice Object invoice
+ * @param string $mode 'next' for next value or 'last' for last value
+ * @return string Value if KO, <0 if KO
+ */
+ public function getNextValue($objsoc = 0, $invoice = null, $mode = 'next')
+ {
+ global $db, $conf;
+
+ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
+
+ // On defini critere recherche compteur
+ $mask = $conf->global->TAKEPOS_REF_UNIVERSAL_MASK;
+
+ if (!$mask) {
+ $this->error = 'NotConfigured';
+ return 0;
+ }
+
+ // Get entities
+ $entity = getEntity('invoicenumber', 1, $invoice);
+
+ $pos_source = is_object($invoice) && $invoice->pos_source > 0 ? $invoice->pos_source : 0;
+ $mask = str_replace('{TN}', $pos_source, $mask);
+ $numFinal = get_next_value($db, $mask, 'facture', 'ref', '', $objsoc, $invoice->date, $mode, false, null, $entity);
+
+ return $numFinal;
+ }
+
+
+ /**
+ * Return next free value
+ *
+ * @param Societe $objsoc Object third party
+ * @param Object $objforref Object for number to search
+ * @return string Next free value
+ */
+ public function getNumRef($objsoc, $objforref)
+ {
+ return $this->getNextValue($objsoc, $objforref);
+ }
+}
diff --git a/htdocs/core/modules/takepos/modules_takepos.php b/htdocs/core/modules/takepos/modules_takepos.php
new file mode 100644
index 00000000000..cb33fd2d9b3
--- /dev/null
+++ b/htdocs/core/modules/takepos/modules_takepos.php
@@ -0,0 +1,116 @@
+
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2011-2012 Philippe Grand
+ * Copyright (C) 2020 Open-DSI
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/modules/takepos/modules_takepos.php
+ * \ingroup takepos
+ * \brief Fichier contenant la classe mere de numerotation des tickets de caisse
+ */
+
+
+/**
+ * \class ModeleNumRefTakepos
+ * \brief Classe mere des modeles de numerotation des tickets de caisse
+ */
+abstract class ModeleNumRefTakepos
+{
+ /**
+ * @var string Error code (or message)
+ */
+ public $error='';
+
+
+ public $version = '';
+
+ /**
+ * Return if a module can be used or not
+ *
+ * @return boolean true if module can be used
+ */
+ public function isEnabled()
+ {
+ return true;
+ }
+
+ /**
+ * Renvoi la description par defaut du modele de numerotation
+ *
+ * @return string Texte descripif
+ */
+ public function info()
+ {
+ global $langs;
+ $langs->load("cashdesk@cashdesk");
+ return $langs->trans("NoDescription");
+ }
+
+ /**
+ * Return an example of numbering
+ *
+ * @return string Example
+ */
+ public function getExample()
+ {
+ global $langs;
+ $langs->load('cashdesk@cashdesk');
+ return $langs->trans('NoExample');
+ }
+
+ /**
+ * Checks if the numbers already in force in the data base do not
+ * cause conflicts that would prevent this numbering from working.
+ *
+ * @return boolean false if conflict, true if ok
+ */
+ public function canBeActivated()
+ {
+ return true;
+ }
+
+ /**
+ * Renvoi prochaine valeur attribuee
+ *
+ * @return string Valeur
+ */
+ public function getNextValue()
+ {
+ global $langs;
+ return $langs->trans('NotAvailable');
+ }
+
+ /**
+ * Renvoi version du modele de numerotation
+ *
+ * @return string Valeur
+ */
+ public function getVersion()
+ {
+ global $langs;
+ $langs->load("admin");
+
+ if ($this->version == 'development') return $langs->trans('VersionDevelopment');
+ if ($this->version == 'experimental') return $langs->trans('VersionExperimental');
+ if ($this->version == 'dolibarr') return DOL_VERSION;
+ if ($this->version) return $this->version;
+ return $langs->trans('NotAvailable');
+ }
+}
diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php
index 5f9a70d272b..6c25b5c07b5 100644
--- a/htdocs/core/tpl/admin_extrafields_add.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php
@@ -28,7 +28,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -154,7 +154,7 @@ $langs->load("modulebuilder");
selectarray('type', $type2label, GETPOST('type', 'alpha')); ?>
-
+
@@ -176,36 +176,36 @@ $langs->load("modulebuilder");
-trans("Position"); ?>
+trans("Position"); ?>
trans("LanguageFile"); ?>
global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
-
+
-
+
-
+
-
+
-
+
+
>
+
-
+
textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?>
multicompany->enabled) { ?>
- trans("AllEntities"); ?> >
+ trans("AllEntities"); ?> >
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index f2d3e4e7bb5..d0eaaec25f2 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -27,7 +27,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -54,7 +54,7 @@ $langs->load("modulebuilder");
var list = jQuery("#list");
var totalizable = jQuery("#totalizable");
load("modulebuilder");
attributes[$elementtype]['label'][$attrname];
-$type=$extrafields->attributes[$elementtype]['type'][$attrname];
-$size=$extrafields->attributes[$elementtype]['size'][$attrname];
-$computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
-$default=$extrafields->attributes[$elementtype]['default'][$attrname];
-$unique=$extrafields->attributes[$elementtype]['unique'][$attrname];
-$required=$extrafields->attributes[$elementtype]['required'][$attrname];
-$pos=$extrafields->attributes[$elementtype]['pos'][$attrname];
-$alwayseditable=$extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
-$param=$extrafields->attributes[$elementtype]['param'][$attrname];
-$perms=$extrafields->attributes[$elementtype]['perms'][$attrname];
-$langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname];
-$list=$extrafields->attributes[$elementtype]['list'][$attrname];
+$label = $extrafields->attributes[$elementtype]['label'][$attrname];
+$type = $extrafields->attributes[$elementtype]['type'][$attrname];
+$size = $extrafields->attributes[$elementtype]['size'][$attrname];
+$computed = $extrafields->attributes[$elementtype]['computed'][$attrname];
+$default = $extrafields->attributes[$elementtype]['default'][$attrname];
+$unique = $extrafields->attributes[$elementtype]['unique'][$attrname];
+$required = $extrafields->attributes[$elementtype]['required'][$attrname];
+$pos = $extrafields->attributes[$elementtype]['pos'][$attrname];
+$alwayseditable = $extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
+$param = $extrafields->attributes[$elementtype]['param'][$attrname];
+$perms = $extrafields->attributes[$elementtype]['perms'][$attrname];
+$langfile = $extrafields->attributes[$elementtype]['langfile'][$attrname];
+$list = $extrafields->attributes[$elementtype]['list'][$attrname];
$totalizable = $extrafields->attributes[$elementtype]['totalizable'][$attrname];
-$help=$extrafields->attributes[$elementtype]['help'][$attrname];
-$entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname];
-$printable=$extrafields->attributes[$elementtype]['printable'][$attrname];
+$help = $extrafields->attributes[$elementtype]['help'][$attrname];
+$entitycurrentorall = $extrafields->attributes[$elementtype]['entityid'][$attrname];
+$printable = $extrafields->attributes[$elementtype]['printable'][$attrname];
-if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
+if ((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{
$param_chain = '';
foreach ($param['options'] as $key => $value)
{
- if(strlen($key))
+ if (strlen($key))
{
$param_chain .= $key.','.$value."\n";
}
}
}
-elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate'))
+elseif (($type == 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate'))
{
- $paramlist=array_keys($param['options']);
+ $paramlist = array_keys($param['options']);
$param_chain = $paramlist[0];
}
?>
@@ -192,10 +192,10 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($t
trans("Type"); ?>
array('varchar', 'phone', 'mail', 'url', 'select', 'password', 'text', 'html'),
- 'text'=>array('text','html'),
- 'html'=>array('text','html'),
+ 'text'=>array('text', 'html'),
+ 'html'=>array('text', 'html'),
'password'=>array('password', 'varchar'),
'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'),
'url'=>array('varchar', 'phone', 'mail', 'url', 'select'),
@@ -204,12 +204,12 @@ $typewecanchangeinto=array(
);
if (in_array($type, array_keys($typewecanchangeinto)))
{
- $newarray=array();
+ $newarray = array();
print '';
- foreach($type2label as $key => $val)
+ foreach ($type2label as $key => $val)
{
- $selected='';
- if ($key == (GETPOST('type', 'alpha')?GETPOST('type', 'alpha'):$type)) $selected=' selected="selected"';
+ $selected = '';
+ if ($key == (GETPOST('type', 'alpha') ?GETPOST('type', 'alpha') : $type)) $selected = ' selected="selected"';
if (in_array($key, $typewecanchangeinto[$type])) print ''.$val.' ';
else print ''.$val.' ';
}
@@ -245,9 +245,9 @@ else
-trans("Position"); ?>
+trans("Position"); ?>
-trans("LanguageFile"); ?>
+trans("LanguageFile"); ?>
global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
@@ -257,23 +257,23 @@ else
-
+
-
+
-
+
+
>
-
+
+
textwithpicto($langs->trans("HelpOnTooltip"), $langs->trans("HelpOnTooltipDesc")); ?>
multicompany->enabled) { ?>
- trans("AllEntities"); ?> >
+ trans("AllEntities"); ?> >
diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php
index 769c12ceaa5..b2bb69aa0bf 100644
--- a/htdocs/core/tpl/admin_extrafields_view.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php
@@ -25,7 +25,7 @@
*/
// Protection to avoid direct call of template
-if (empty($langs) || ! is_object($langs))
+if (empty($langs) || !is_object($langs))
{
print "Error, template page can't be called as URL";
exit;
@@ -66,7 +66,7 @@ print '
'.$langs->trans("AlwaysEditable").' ';
print '
'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).' ';
print '
'.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).' ';
print '
'.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).' ';
-if ($conf->multicompany->enabled){
+if ($conf->multicompany->enabled) {
print '
'.$langs->trans("Entities").' ';
}
print '
';
@@ -74,16 +74,16 @@ print "\n";
if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type']))
{
- foreach($extrafields->attributes[$elementtype]['type'] as $key => $value)
+ foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value)
{
// Load language if required
- if (! empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
+ if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) {
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
}
print '
';
print "".$extrafields->attributes[$elementtype]['pos'][$key]." \n";
- print "".$extrafields->attributes[$elementtype]['label'][$key]." \n"; // We don't translate here, we want admin to know what is the key not translated value
+ print "".$extrafields->attributes[$elementtype]['label'][$key]." \n"; // We don't translate here, we want admin to know what is the key not translated value
print "".$langs->trans($extrafields->attributes[$elementtype]['label'][$key])." \n";
print "".$key." \n";
print "".$type2label[$extrafields->attributes[$elementtype]['type'][$key]]." \n";
@@ -93,9 +93,9 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
print ''.yn($extrafields->attributes[$elementtype]['required'][$key])." \n";
print ''.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])." \n";
print ''.$extrafields->attributes[$elementtype]['list'][$key]." \n";
- print ''.yn($extrafields->attributes[$elementtype]['printable'][$key])." \n";
+ print ''.$extrafields->attributes[$elementtype]['printable'][$key]." \n";
print ''.yn($extrafields->attributes[$elementtype]['totalizable'][$key])." \n";
- if (! empty($conf->multicompany->enabled)) {
+ if (!empty($conf->multicompany->enabled)) {
print '';
if (empty($extrafields->attributes[$elementtype]['entityid'][$key]))
{
@@ -103,7 +103,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
}
else {
global $multicompanylabel_cache;
- if (! is_array($multicompanylabel_cache)) $multicompanylabel_cache = array();
+ if (!is_array($multicompanylabel_cache)) $multicompanylabel_cache = array();
if (empty($multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]])) {
global $mc;
$mc->getInfo($extrafields->attributes[$elementtype]['entityid'][$key]);
@@ -120,8 +120,8 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel
}
else
{
- $colspan=13;
- if (! empty($conf->multicompany->enabled)) $colspan++;
+ $colspan = 13;
+ if (!empty($conf->multicompany->enabled)) $colspan++;
print ' ';
print '';
diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php
index e6de4520ba4..eca100731ac 100644
--- a/htdocs/core/tpl/contacts.tpl.php
+++ b/htdocs/core/tpl/contacts.tpl.php
@@ -128,10 +128,10 @@ if ($permission)
select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
+ $nbofcontacts = $form->select_contacts(($selectedCompany > 0 ? $selectedCompany : -1), '', 'contactid', 3, '', '', 1, 'minwidth100imp');
$newcardbutton = '';
- if (! empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
+ if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
{
$newcardbutton .= '
id).'" title="'.$langs->trans('NewContact').'"> ';
}
@@ -140,13 +140,13 @@ if ($permission)
element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
+ $tmpobject = $object;
+ if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject = $objectsrc;
$formcompany->selectTypeContact($tmpobject, '', 'type', 'external', 'position', 0, 'minwidth100imp'); ?>
- ">
+ ">
@@ -162,11 +162,11 @@ print "";
// TODO: replace this with direct SQL string to use $db->sort($sortfield, $sortorder)
$list = array();
-foreach(array('internal', 'external') as $source)
+foreach (array('internal', 'external') as $source)
{
$tmpobject = $object;
- if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc))
+ if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc))
{
$tmpobject = $objectsrc;
}
@@ -200,27 +200,27 @@ foreach(array('internal', 'external') as $source)
{
$entry->thirdparty = $conf->global->MAIN_INFO_SOCIETE_NOM;
}
- elseif (! $tab[$i]['socid'])
+ elseif (!$tab[$i]['socid'])
{
$entry->thirdparty = "";
}
- if ($tab[$i]['source']=='internal')
+ if ($tab[$i]['source'] == 'internal')
{
$userstatic->fetch($tab[$i]['id']);
$entry->contact = $userstatic->getNomUrl(-1, '', 0, 0, 0, 0, '', 'valignmiddle');
}
- elseif ($tab[$i]['source']=='external')
+ elseif ($tab[$i]['source'] == 'external')
{
$contactstatic->fetch($tab[$i]['id']);
- $entry->contact =$contactstatic->getNomUrl(1, '', 0, '', 0, 0);
+ $entry->contact = $contactstatic->getNomUrl(1, '', 0, '', 0, 0);
}
- if ($tab[$i]['source']=='internal')
+ if ($tab[$i]['source'] == 'internal')
{
$entry->status = $userstatic->LibStatut($tab[$i]['statuscontact'], 3);
}
- elseif ($tab[$i]['source']=='external')
+ elseif ($tab[$i]['source'] == 'external')
{
$entry->status = $contactstatic->LibStatut($tab[$i]['statuscontact'], 3);
}
@@ -279,7 +279,7 @@ print_liste_field_titre($arrayfields['status']['label'], $_SERVER["PHP_SELF"], "
print_liste_field_titre($arrayfields['link']['label'], $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder, 'center maxwidthsearch ');
print " ";
-foreach($list as $entry)
+foreach ($list as $entry)
{
print '
';
@@ -314,8 +314,8 @@ print "";
print "\n";
if (is_object($hookmanager)) {
$hookmanager->initHooks(array('contacttpl'));
- $parameters=array();
- $reshook=$hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action);
}
print "\n";
diff --git a/htdocs/core/tpl/extrafields_add.tpl.php b/htdocs/core/tpl/extrafields_add.tpl.php
index 0579c464d30..45ca9a29197 100644
--- a/htdocs/core/tpl/extrafields_add.tpl.php
+++ b/htdocs/core/tpl/extrafields_add.tpl.php
@@ -37,11 +37,14 @@ if (empty($conf) || !is_object($conf))
executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- $params = isset($tpl_context) ? array('tpl_context' => $tpl_context) : array(); // BUG #11554 : Add tpl_context in params
+ $params = array();
+ if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
+ $params['cols'] = $parameters['colspanvalue'];
print $object->showOptionals($extrafields, 'edit', $params); // BUG #11554 : Add context in params
}
diff --git a/htdocs/core/tpl/extrafields_edit.tpl.php b/htdocs/core/tpl/extrafields_edit.tpl.php
index adca8b50fab..dbc2b9745cd 100644
--- a/htdocs/core/tpl/extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/extrafields_edit.tpl.php
@@ -26,7 +26,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -37,11 +37,13 @@ if (empty($conf) || ! is_object($conf))
executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
- print $object->showOptionals($extrafields, 'edit');
+ $params = array();
+ $params['cols'] = $parameters['colspanvalue'];
+ print $object->showOptionals($extrafields, 'edit', $params);
}
?>
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index ef40e0a7caf..5fc268013c6 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -261,7 +261,7 @@ if ($nolinesbefore) {
if ($senderissupplier != 2)
{
$ajaxoptions = array(
- 'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key
+ 'update' => array('qty'=>'qty', 'remise_percent' => 'discount', 'idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key
'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done
'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for example shown we select a disabled option into combo)
);
@@ -378,7 +378,7 @@ if ($nolinesbefore) {
">
global->PRODUCT_USE_UNITS)) {
+ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$coldisplay++;
print '';
print $form->selectUnits($line->fk_unit, "units");
@@ -636,7 +636,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
{
console.log("We are in a price per qty context, we do not call ajax/product");
} else {
- global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
+ global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { ?>
if (isNaN(pbq)) { console.log("We use experimental option PRODUIT_CUSTOMER_PRICES_BY_QTY or PRODUIT_CUSTOMER_PRICES_BY_QTY but we are not yet able to get the id of pbq from product combo list, so load of price may be 0 if product has differet prices"); }
// Get the HT price for the product and display it
@@ -761,7 +761,7 @@ if (!empty($usemargins) && $user->rights->margins->creer)
/* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */
var pbq = parseInt($('option:selected', this).attr('data-pbq'));
- var pbqup = parseInt($('option:selected', this).attr('data-pbqup'));
+ var pbqup = parseFloat($('option:selected', this).attr('data-pbqup'));
var pbqbase = $('option:selected', this).attr('data-pbqbase');
var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty'));
var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent'));
diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php
index 66e1b6fa4cd..7acd977e714 100644
--- a/htdocs/core/triggers/interface_20_all_Logevents.class.php
+++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php
@@ -59,13 +59,13 @@ class InterfaceLogevents extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
- if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
+ if (!empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
- $key='MAIN_LOGEVENTS_'.$action;
+ $key = 'MAIN_LOGEVENTS_'.$action;
//dol_syslog("xxxxxxxxxxx".$key);
- if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
+ if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
- if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
+ if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
$date = dol_now();
@@ -76,18 +76,18 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text="(UserLogged,".$object->login.")";
- $text.=(empty($object->trigger_mesg)?'':' - '.$object->trigger_mesg);
- $desc="(UserLogged,".$object->login.")";
- $desc.=(empty($object->trigger_mesg)?'':' - '.$object->trigger_mesg);
+ $text = "(UserLogged,".$object->login.")";
+ $text .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
+ $desc = "(UserLogged,".$object->login.")";
+ $desc .= (empty($object->trigger_mesg) ? '' : ' - '.$object->trigger_mesg);
}
if ($action == 'USER_LOGIN_FAILED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Initialisation donnees (date,duree,texte,desc)
- $text=$object->trigger_mesg; // Message direct
- $desc=$object->trigger_mesg; // Message direct
+ $text = $object->trigger_mesg; // Message direct
+ $desc = $object->trigger_mesg; // Message direct
}
if ($action == 'USER_LOGOUT')
{
@@ -95,8 +95,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text="(UserLogoff,".$object->login.")";
- $desc="(UserLogoff,".$object->login.")";
+ $text = "(UserLogoff,".$object->login.")";
+ $desc = "(UserLogoff,".$object->login.")";
}
if ($action == 'USER_CREATE')
{
@@ -104,8 +104,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("NewUserCreated", $object->login);
- $desc=$langs->transnoentities("NewUserCreated", $object->login);
+ $text = $langs->transnoentities("NewUserCreated", $object->login);
+ $desc = $langs->transnoentities("NewUserCreated", $object->login);
}
elseif ($action == 'USER_MODIFY')
{
@@ -113,8 +113,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("EventUserModified", $object->login);
- $desc=$langs->transnoentities("EventUserModified", $object->login);
+ $text = $langs->transnoentities("EventUserModified", $object->login);
+ $desc = $langs->transnoentities("EventUserModified", $object->login);
}
elseif ($action == 'USER_NEW_PASSWORD')
{
@@ -122,8 +122,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("NewUserPassword", $object->login);
- $desc=$langs->transnoentities("NewUserPassword", $object->login);
+ $text = $langs->transnoentities("NewUserPassword", $object->login);
+ $desc = $langs->transnoentities("NewUserPassword", $object->login);
}
elseif ($action == 'USER_ENABLEDISABLE')
{
@@ -132,13 +132,13 @@ class InterfaceLogevents extends DolibarrTriggers
// Initialisation donnees (date,duree,texte,desc)
if ($object->statut == 0)
{
- $text=$langs->transnoentities("UserEnabled", $object->login);
- $desc=$langs->transnoentities("UserEnabled", $object->login);
+ $text = $langs->transnoentities("UserEnabled", $object->login);
+ $desc = $langs->transnoentities("UserEnabled", $object->login);
}
if ($object->statut == 1)
{
- $text=$langs->transnoentities("UserDisabled", $object->login);
- $desc=$langs->transnoentities("UserDisabled", $object->login);
+ $text = $langs->transnoentities("UserDisabled", $object->login);
+ $desc = $langs->transnoentities("UserDisabled", $object->login);
}
}
elseif ($action == 'USER_DELETE')
@@ -146,8 +146,8 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("UserDeleted", $object->login);
- $desc=$langs->transnoentities("UserDeleted", $object->login);
+ $text = $langs->transnoentities("UserDeleted", $object->login);
+ $desc = $langs->transnoentities("UserDeleted", $object->login);
}
// Groupes
@@ -156,24 +156,24 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("NewGroupCreated", $object->name);
- $desc=$langs->transnoentities("NewGroupCreated", $object->name);
+ $text = $langs->transnoentities("NewGroupCreated", $object->name);
+ $desc = $langs->transnoentities("NewGroupCreated", $object->name);
}
elseif ($action == 'GROUP_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("GroupModified", $object->name);
- $desc=$langs->transnoentities("GroupModified", $object->name);
+ $text = $langs->transnoentities("GroupModified", $object->name);
+ $desc = $langs->transnoentities("GroupModified", $object->name);
}
elseif ($action == 'GROUP_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
- $text=$langs->transnoentities("GroupDeleted", $object->name);
- $desc=$langs->transnoentities("GroupDeleted", $object->name);
+ $text = $langs->transnoentities("GroupDeleted", $object->name);
+ $desc = $langs->transnoentities("GroupDeleted", $object->name);
}
// If not found
@@ -186,28 +186,28 @@ class InterfaceLogevents extends DolibarrTriggers
*/
// Add more information into desc from the context property
- if (! empty($desc) && ! empty($object->context['audit'])) $desc.=' - '.$object->context['audit'];
+ if (!empty($desc) && !empty($object->context['audit'])) $desc .= ' - '.$object->context['audit'];
// Add entry in event table
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
- $event=new Events($this->db);
- $event->type=$action;
- $event->dateevent=$date;
- $event->label=$text;
- $event->description=$desc;
- $event->user_agent=$_SERVER["HTTP_USER_AGENT"];
+ $event = new Events($this->db);
+ $event->type = $action;
+ $event->dateevent = $date;
+ $event->label = $text;
+ $event->description = $desc;
+ $event->user_agent = $_SERVER["HTTP_USER_AGENT"];
- $result=$event->create($user);
+ $result = $event->create($user);
if ($result > 0)
{
return 1;
}
else
{
- $error ="Failed to insert security event: ".$event->error;
+ $error = "Failed to insert security event: ".$event->error;
$this->errors[] = $error;
- $this->error=$error;
+ $this->error = $error;
dol_syslog(get_class($this).": ".$error, LOG_ERR);
return -1;
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index 161ebe6cd73..3fe9d63c380 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -71,7 +71,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
- if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
+ if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
@@ -82,25 +82,25 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("agenda");
- if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO';
+ if (empty($object->actiontypecode)) $object->actiontypecode = 'AC_OTH_AUTO';
// Actions
if ($action == 'COMPANY_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","companies"));
+ $langs->loadLangs(array("agenda", "other", "companies"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr", $object->name);
- $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr", $object->name);
- if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")";
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
+ $object->actionmsg = $langs->transnoentities("NewCompanyToDolibarr", $object->name);
+ if (!empty($object->prefix)) $object->actionmsg .= " (".$object->prefix.")";
- $object->sendtoid=0;
- $object->socid=$object->id;
+ $object->sendtoid = 0;
+ $object->socid = $object->id;
}
elseif ($action == 'COMPANY_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR);
@@ -110,22 +110,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'CONTRACT_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","contracts"));
+ $langs->loadLangs(array("agenda", "other", "contracts"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("ContractValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'CONTRACT_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","contracts"));
+ $langs->loadLangs(array("agenda", "other", "contracts"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ContractSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ContractSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ContractSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -134,22 +134,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPAL_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPAL_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -158,82 +158,82 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPAL_CLOSE_SIGNED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPAL_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClassifiedBilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPAL_CLOSE_REFUSED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","orders"));
+ $langs->loadLangs(array("agenda", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_CLOSE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderDeliveredInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderBilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderBilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderBilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_CANCEL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderCanceledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("OrderSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -242,32 +242,32 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'BILL_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_UNVALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("InvoiceSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -276,69 +276,69 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'BILL_PAYED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
// Values for this action can't be defined by caller.
- $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_CANCEL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'FICHINTER_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionCreatedInDolibarr", $object->ref);
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'FICHINTER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("InterventionValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'FICHINTER_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionModifiedInDolibarr", $object->ref);
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'FICHINTER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("InterventionSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -347,44 +347,44 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionClassifiedBilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionClassifiedUnbilledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'FICHINTER_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","interventions"));
+ $langs->loadLangs(array("agenda", "other", "interventions"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InterventionDeletedInDolibarr", $object->ref);
- $object->sendtoid=0;
- $object->fk_element=0;
- $object->elementtype='';
+ $object->sendtoid = 0;
+ $object->fk_element = 0;
+ $object->elementtype = '';
}
elseif ($action == 'SHIPPING_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","sendings"));
+ $langs->loadLangs(array("agenda", "other", "sendings"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ShippingValidated", ($object->newref?$object->newref:$object->ref));
+ $object->actionmsg = $langs->transnoentities("ShippingValidated", ($object->newref ? $object->newref : $object->ref));
}
// Parameters $object->sendtoid defined by caller
@@ -393,12 +393,12 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'SHIPPING_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","sendings"));
+ $langs->loadLangs(array("agenda", "other", "sendings"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ShippingSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ShippingSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ShippingSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -409,10 +409,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("receptions");
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionValidated", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ReceptionValidated", ($object->newref?$object->newref:$object->ref));
+ $object->actionmsg = $langs->transnoentities("ReceptionValidated", ($object->newref ? $object->newref : $object->ref));
}
// Parameters $object->sendtoid defined by caller
@@ -424,10 +424,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$langs->load("other");
$langs->load("receptions");
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ReceptionSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ReceptionSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ReceptionSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -436,22 +436,22 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("PropalValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProposalSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("ProposalSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProposalSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -460,92 +460,92 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedSignedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","propal"));
+ $langs->loadLangs(array("agenda", "other", "propal"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("PropalClosedRefusedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderCreatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("OrderCreatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("OrderCreatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("OrderValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_APPROVE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderApprovedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_REFUSE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("OrderRefusedInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_SUBMIT')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("SupplierOrderSubmitedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_RECEIVE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","orders"));
+ $langs->loadLangs(array("agenda", "other", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("SupplierOrderReceivedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills","orders"));
+ $langs->loadLangs(array("agenda", "other", "bills", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("SupplierOrderSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -554,45 +554,45 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills","orders"));
+ $langs->loadLangs(array("agenda", "other", "bills", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
+ $object->actionmsg = $langs->transnoentities("SupplierOrderClassifiedBilled", $object->ref);
}
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
- $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref?$object->newref:$object->ref));
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
+ $object->actionmsg = $langs->transnoentities("InvoiceValidatedInDolibarr", ($object->newref ? $object->newref : $object->ref));
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_UNVALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceBackToDraftInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills","orders"));
+ $langs->loadLangs(array("agenda", "other", "bills", "orders"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
if (empty($object->actionmsg))
{
- $object->actionmsg=$langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
+ $object->actionmsg = $langs->transnoentities("SupplierInvoiceSentByEMail", $object->ref);
}
// Parameters $object->sendtoid defined by caller
@@ -601,244 +601,244 @@ class InterfaceActionsAuto extends DolibarrTriggers
elseif ($action == 'BILL_SUPPLIER_PAYED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoicePaidInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'BILL_SUPPLIER_CANCELED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","bills"));
+ $langs->loadLangs(array("agenda", "other", "bills"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// Members
elseif ($action == 'MEMBER_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberValidatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'MEMBER_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberModifiedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
$member = $this->context['member'];
- if (! is_object($member)) // This should not happen
+ if (!is_object($member)) // This should not happen
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($this->fk_adherent);
}
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
+ $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
+ $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
- $object->sendtoid=0;
- if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
+ $object->sendtoid = 0;
+ if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
$member = $this->context['member'];
- if (! is_object($member)) // This should not happen
+ if (!is_object($member)) // This should not happen
{
include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member = new Adherent($this->db);
$member->fetch($this->fk_adherent);
}
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->fk_type;
+ $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->amount;
+ $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
- $object->sendtoid=0;
- if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
+ $object->sendtoid = 0;
+ if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
}
elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberSubscriptionDeletedInDolibarr", $object->ref, $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
+ $object->actionmsg .= "\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
+ $object->actionmsg .= "\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
- $object->sendtoid=0;
- if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
+ $object->sendtoid = 0;
+ if ($object->fk_soc > 0) $object->socid = $object->fk_soc;
}
elseif ($action == 'MEMBER_RESILIATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberResiliatedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
elseif ($action == 'MEMBER_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","members"));
+ $langs->loadLangs(array("agenda", "other", "members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg = $langs->transnoentities("MemberDeletedInDolibarr", $object->getFullName($langs));
+ $object->actionmsg .= "\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// Projects
elseif ($action == 'PROJECT_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProjectCreatedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'PROJECT_VALIDATE')
+ elseif ($action == 'PROJECT_VALIDATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProjectValidatedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Project").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'PROJECT_MODIFY')
+ elseif ($action == 'PROJECT_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("ProjectModifiedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// Project tasks
- elseif($action == 'TASK_CREATE')
+ elseif ($action == 'TASK_CREATE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TaskCreatedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'TASK_MODIFY')
+ elseif ($action == 'TASK_MODIFY')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TaskModifieddInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskModifiedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TaskModifieddInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'TASK_DELETE')
+ elseif ($action == 'TASK_DELETE')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
- $object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TaskDeletedInDolibarr", $object->ref);
+ $object->actionmsg .= "\n".$langs->transnoentities("Task").': '.$object->ref;
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
- elseif($action == 'TICKET_ASSIGNED')
+ elseif ($action == 'TICKET_ASSIGNED')
{
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other","projects"));
+ $langs->loadLangs(array("agenda", "other", "projects"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
- $object->actionmsg=$langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
+ $object->actionmsg = $langs->transnoentities("TICKET_ASSIGNEDInDolibarr", $object->ref);
if ($object->oldcopy->fk_user_assign > 0)
{
- $tmpuser=new User($this->db);
+ $tmpuser = new User($this->db);
$tmpuser->fetch($object->oldcopy->fk_user_assign);
- $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs);
}
else
{
- $object->actionmsg.="\n".$langs->transnoentities("OldUser").': '.$langs->trans("None");
+ $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$langs->trans("None");
}
if ($object->fk_user_assign > 0)
{
- $tmpuser=new User($this->db);
+ $tmpuser = new User($this->db);
$tmpuser->fetch($object->fk_user_assign);
- $object->actionmsg.="\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs);
+ $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs);
}
else
{
- $object->actionmsg.="\n".$langs->transnoentities("NewUser").': '.$langs->trans("None");
+ $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$langs->trans("None");
}
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
// TODO Merge all previous cases into this generic one
else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ...
{
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). Key can be set in agenda setup if defined into c_action_trigger
// Load translation files required by the page
- $langs->loadLangs(array("agenda","other"));
+ $langs->loadLangs(array("agenda", "other"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities($action."InDolibarr", $object->ref);
- if (empty($object->actionmsg)) $object->actionmsg=$langs->transnoentities($action."InDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref);
+ if (empty($object->actionmsg)) $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref);
- $object->sendtoid=0;
+ $object->sendtoid = 0;
}
$object->actionmsg = $langs->transnoentities("Author").': '.$user->login."\n".$object->actionmsg;
@@ -846,21 +846,21 @@ class InterfaceActionsAuto extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Add entry in event table
- $now=dol_now();
+ $now = dol_now();
if (isset($_SESSION['listofnames-'.$object->trackid]))
{
- $attachs=$_SESSION['listofnames-'.$object->trackid];
+ $attachs = $_SESSION['listofnames-'.$object->trackid];
if ($attachs && strpos($action, 'SENTBYMAIL'))
{
- $object->actionmsg=dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
+ $object->actionmsg = dol_concatdesc($object->actionmsg, "\n".$langs->transnoentities("AttachedFiles").': '.$attachs);
}
}
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
- $contactforaction=new Contact($this->db);
- $societeforaction=new Societe($this->db);
+ $contactforaction = new Contact($this->db);
+ $societeforaction = new Societe($this->db);
// Set contactforaction if there is only 1 contact.
if (is_array($object->sendtoid))
{
@@ -874,7 +874,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
if ($object->socid > 0) $societeforaction->fetch($object->socid);
elseif ($object->fk_soc > 0) $societeforaction->fetch($object->fk_soc);
- $projectid = isset($object->fk_project)?$object->fk_project:0;
+ $projectid = isset($object->fk_project) ? $object->fk_project : 0;
if ($object->element == 'project') $projectid = $object->id;
$elementid = $object->id;
@@ -889,20 +889,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
- $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
+ $actioncomm->type_code = $object->actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
$actioncomm->code = 'AC_'.$action;
$actioncomm->label = $object->actionmsg2;
- $actioncomm->note_private= $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
+ $actioncomm->note_private = $object->actionmsg; // TODO Replace with ($actioncomm->email_msgid ? $object->email_content : $object->actionmsg)
$actioncomm->fk_project = $projectid;
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->durationp = 0;
$actioncomm->punctual = 1;
- $actioncomm->percentage = -1; // Not applicable
+ $actioncomm->percentage = -1; // Not applicable
$actioncomm->socid = $societeforaction->id;
$actioncomm->contactid = $contactforaction->id;
- $actioncomm->authorid = $user->id; // User saving action
- $actioncomm->userownerid = $user->id; // Owner of action
+ $actioncomm->authorid = $user->id; // User saving action
+ $actioncomm->userownerid = $user->id; // Owner of action
// Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
$actioncomm->email_msgid = $object->email_msgid;
$actioncomm->email_from = $object->email_from;
@@ -915,28 +915,28 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
// for such objects because there is already a dedicated field into table llx_actioncomm.
- if (! in_array($elementtype, array('societe','contact','project')))
+ if (!in_array($elementtype, array('societe', 'contact', 'project')))
{
$actioncomm->fk_element = $elementid;
$actioncomm->elementtype = $elementtype;
}
- if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles)>0) {
- $actioncomm->attachedfiles=$object->attachedfiles;
+ if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) {
+ $actioncomm->attachedfiles = $object->attachedfiles;
}
- if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid)>0) {
- $actioncomm->userassigned=$object->sendtouserid;
+ if (property_exists($object, 'sendtouserid') && is_array($object->sendtouserid) && count($object->sendtouserid) > 0) {
+ $actioncomm->userassigned = $object->sendtouserid;
}
- $ret=$actioncomm->create($user); // User creating action
+ $ret = $actioncomm->create($user); // User creating action
if ($ret > 0 && $conf->global->MAIN_COPY_FILE_IN_EVENT_AUTO)
{
- if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths'])>0) {
- foreach($object->attachedfiles['paths'] as $key=>$filespath) {
+ if (is_array($object->attachedfiles) && array_key_exists('paths', $object->attachedfiles) && count($object->attachedfiles['paths']) > 0) {
+ foreach ($object->attachedfiles['paths'] as $key=>$filespath) {
$srcfile = $filespath;
- $destdir = $conf->agenda->dir_output . '/' . $ret;
- $destfile = $destdir . '/' . $object->attachedfiles['names'][$key];
+ $destdir = $conf->agenda->dir_output.'/'.$ret;
+ $destfile = $destdir.'/'.$object->attachedfiles['names'][$key];
if (dol_mkdir($destdir) >= 0) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
dol_copy($srcfile, $destfile);
@@ -945,7 +945,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
}
- unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
+ unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
if ($ret > 0)
{
@@ -954,8 +954,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
else
{
- $this->error="Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
- $this->errors=$actioncomm->errors;
+ $this->error = "Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors);
+ $this->errors = $actioncomm->errors;
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
return -1;
diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php
index ac9f178b163..0b73d95a140 100644
--- a/htdocs/cron/list.php
+++ b/htdocs/cron/list.php
@@ -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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/don/document.php b/htdocs/don/document.php
index 9e23fe46452..dba5b4cff7b 100644
--- a/htdocs/don/document.php
+++ b/htdocs/don/document.php
@@ -57,7 +57,7 @@ $result = restrictedArea($user, 'don', $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;
diff --git a/htdocs/don/list.php b/htdocs/don/list.php
index 3cd49a20649..a61a97f7c78 100644
--- a/htdocs/don/list.php
+++ b/htdocs/don/list.php
@@ -27,27 +27,27 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
+if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","donations"));
+$langs->loadLangs(array("companies", "donations"));
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
-$page = GETPOST("page", 'int');
-$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="d.datedon";
+if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) $sortfield = "d.datedon";
-$search_status=(GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-4";
-$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
-$search_ref=GETPOST('search_ref', 'alpha');
-$search_company=GETPOST('search_company', 'alpha');
-$search_name=GETPOST('search_name', 'alpha');
+$search_status = (GETPOST("search_status", 'intcomma') != '') ? GETPOST("search_status", 'intcomma') : "-4";
+$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$search_ref = GETPOST('search_ref', 'alpha');
+$search_company = GETPOST('search_company', 'alpha');
+$search_name = GETPOST('search_name', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@@ -79,26 +79,26 @@ $fieldstosearchall = array(
* View
*/
-$form=new Form($db);
-if (! empty($conf->projet->enabled)) $projectstatic=new Project($db);
+$form = new Form($db);
+if (!empty($conf->projet->enabled)) $projectstatic = new Project($db);
llxHeader('', $langs->trans("Donations"), 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones');
-$donationstatic=new Don($db);
+$donationstatic = new Don($db);
// Genere requete de liste des dons
$sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,";
-$sql.= " d.amount, d.fk_statut as status,";
-$sql.= " p.rowid as pid, p.ref, p.title, p.public";
-$sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
-$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
+$sql .= " d.amount, d.fk_statut as status,";
+$sql .= " p.rowid as pid, p.ref, p.title, p.public";
+$sql .= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p";
+$sql .= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")";
if ($search_status != '' && $search_status != '-4')
{
$sql .= " AND d.fk_statut IN (".$db->escape($search_status).")";
}
if (trim($search_ref) != '')
{
- $sql.= natural_search('d.ref', $search_ref);
+ $sql .= natural_search('d.ref', $search_ref);
}
if (trim($search_all) != '')
{
@@ -137,17 +137,17 @@ if ($resql)
$i = 0;
$param = '';
- if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
+ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
if ($search_status && $search_status != -1) $param .= '&search_status='.urlencode($search_status);
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
if ($search_company) $param .= '&search_company='.urlencode($search_company);
if ($search_name) $param .= '&search_name='.urlencode($search_name);
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
- $newcardbutton='';
+ $newcardbutton = '';
if ($user->rights->don->creer)
{
- $newcardbutton.= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
+ $newcardbutton .= dolGetButtonTitle($langs->trans('NewDonation'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/don/card.php?action=create');
}
print ' ";
@@ -1606,6 +1655,21 @@ else
print '
';
print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
print ' ';
+
+ // Accountancy_code_buy_intra
+ if ($mysoc->isInEEC())
+ {
+ print '
'.$langs->trans("ProductAccountancyBuyIntraCode").' ';
+ print '';
+ print $formaccounting->select_account($object->accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, '', 1, 1);
+ print ' ';
+ }
+
+ // Accountancy_code_buy_export
+ print '
'.$langs->trans("ProductAccountancyBuyExportCode").' ';
+ print '';
+ print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1);
+ print ' ';
}
else // For external software
{
@@ -1631,6 +1695,19 @@ else
print '
'.$langs->trans("ProductAccountancyBuyCode").' ';
print ' ';
print '';
+
+ // Accountancy_code_buy_intra
+ if ($mysoc->isInEEC())
+ {
+ print '
'.$langs->trans("ProductAccountancyBuyIntraCode").' ';
+ print ' ';
+ print '';
+ }
+
+ // Accountancy_code_buy_export
+ print '
'.$langs->trans("ProductAccountancyBuyExportCode").' ';
+ print ' ';
+ print '';
}
print '';
@@ -1812,6 +1889,45 @@ else
}
print '
';
+ // Accountancy buy code intra-community
+ if ($mysoc->isInEEC())
+ {
+ print '';
+ print $langs->trans("ProductAccountancyBuyIntraCode");
+ print ' ';
+ if (!empty($conf->accounting->enabled))
+ {
+ if (!empty($object->accountancy_code_buy_intra))
+ {
+ $accountingaccount5 = new AccountingAccount($db);
+ $accountingaccount5->fetch('', $object->accountancy_code_buy_intra, 1);
+
+ print $accountingaccount5->getNomUrl(0, 1, 1, '', 1);
+ }
+ } else {
+ print $object->accountancy_code_buy_intra;
+ }
+ print ' ';
+ }
+
+ // Accountancy buy code export
+ print '';
+ print $langs->trans("ProductAccountancyBuyExportCode");
+ print ' ';
+ if (!empty($conf->accounting->enabled))
+ {
+ if (!empty($object->accountancy_code_buy_export))
+ {
+ $accountingaccount6 = new AccountingAccount($db);
+ $accountingaccount6->fetch('', $object->accountancy_code_buy_export, 1);
+
+ print $accountingaccount6->getNomUrl(0, 1, 1, '', 1);
+ }
+ } else {
+ print $object->accountancy_code_buy_export;
+ }
+ print ' ';
+
// Batch number management (to batch)
if (!empty($conf->productbatch->enabled))
{
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 6542190fbd2..405583ea314 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -8,7 +8,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2013-2014 Cedric GROSS
* Copyright (C) 2013-2016 Marcos García
- * Copyright (C) 2011-2017 Alexandre Spangaro
+ * Copyright (C) 2011-2020 Alexandre Spangaro
* Copyright (C) 2014 Henry Florian
* Copyright (C) 2014-2016 Philippe Grand
* Copyright (C) 2014 Ion agorria
@@ -139,10 +139,10 @@ class Product extends CommonObject
*/
public $price_min_ttc;
- /*
- * Base price ('TTC' for price including tax or 'HT' for net price)
- * @var float
- */
+ /**
+ * Base price ('TTC' for price including tax or 'HT' for net price)
+ * @var string
+ */
public $price_base_type;
//! Arrays for multiprices
@@ -284,6 +284,8 @@ class Product extends CommonObject
public $accountancy_code_sell_intra;
public $accountancy_code_sell_export;
public $accountancy_code_buy;
+ public $accountancy_code_buy_intra;
+ public $accountancy_code_buy_export;
/**
* Main Barcode value
@@ -544,7 +546,9 @@ class Product extends CommonObject
$price_min_ttc = price2num($this->price_min * (1 + ($this->tva_tx / 100)), 'MU');
}
- $this->accountancy_code_buy = trim($this->accountancy_code_buy);
+ $this->accountancy_code_buy = trim($this->accountancy_code_buy);
+ $this->accountancy_code_buy_intra = trim($this->accountancy_code_buy_intra);
+ $this->accountancy_code_buy_export = trim($this->accountancy_code_buy_export);
$this->accountancy_code_sell = trim($this->accountancy_code_sell);
$this->accountancy_code_sell_intra = trim($this->accountancy_code_sell_intra);
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
@@ -622,6 +626,8 @@ class Product extends CommonObject
$sql .= ", tobuy";
$sql .= ", tosell";
$sql .= ", accountancy_code_buy";
+ $sql .= ", accountancy_code_buy_intra";
+ $sql .= ", accountancy_code_buy_export";
$sql .= ", accountancy_code_sell";
$sql .= ", accountancy_code_sell_intra";
$sql .= ", accountancy_code_sell_export";
@@ -645,6 +651,8 @@ class Product extends CommonObject
$sql .= ", ".$this->status;
$sql .= ", ".$this->status_buy;
$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";
+ $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'";
+ $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_intra)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_sell_export)."'";
@@ -896,6 +904,8 @@ class Product extends CommonObject
$this->barcode = trim($this->barcode);
$this->accountancy_code_buy = trim($this->accountancy_code_buy);
+ $this->accountancy_code_buy_intra = trim($this->accountancy_code_buy_intra);
+ $this->accountancy_code_buy_export = trim($this->accountancy_code_buy_export);
$this->accountancy_code_sell = trim($this->accountancy_code_sell);
$this->accountancy_code_sell_intra = trim($this->accountancy_code_sell_intra);
$this->accountancy_code_sell_export = trim($this->accountancy_code_sell_export);
@@ -1010,6 +1020,8 @@ class Product extends CommonObject
$sql .= ", note = ".(isset($this->note) ? "'".$this->db->escape($this->note)."'" : 'null');
$sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'";
$sql .= ", accountancy_code_buy = '".$this->db->escape($this->accountancy_code_buy)."'";
+ $sql .= ", accountancy_code_buy_intra = '".$this->db->escape($this->accountancy_code_buy_intra)."'";
+ $sql .= ", accountancy_code_buy_export = '".$this->db->escape($this->accountancy_code_buy_export)."'";
$sql .= ", accountancy_code_sell= '".$this->db->escape($this->accountancy_code_sell)."'";
$sql .= ", accountancy_code_sell_intra= '".$this->db->escape($this->accountancy_code_sell_intra)."'";
$sql .= ", accountancy_code_sell_export= '".$this->db->escape($this->accountancy_code_sell_export)."'";
@@ -1431,7 +1443,7 @@ class Product extends CommonObject
* Sets an accountancy code for a product.
* Also calls PRODUCT_MODIFY trigger when modified
*
- * @param string $type It can be 'buy', 'sell', 'sell_intra' or 'sell_export'
+ * @param string $type It can be 'buy', 'buy_intra', 'buy_export', 'sell', 'sell_intra' or 'sell_export'
* @param string $value Accountancy code
* @return int <0 KO >0 OK
*/
@@ -1443,7 +1455,11 @@ class Product extends CommonObject
if ($type == 'buy') {
$field = 'accountancy_code_buy';
- } elseif ($type == 'sell') {
+ } elseif ($type == 'buy_intra') {
+ $field = 'accountancy_code_buy_intra';
+ } elseif ($type == 'buy_export') {
+ $field = 'accountancy_code_buy_export';
+ } elseif ($type == 'sell') {
$field = 'accountancy_code_sell';
} elseif ($type == 'sell_intra') {
$field = 'accountancy_code_sell_intra';
@@ -2082,7 +2098,8 @@ class Product extends CommonObject
$sql .= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, net_measure, net_measure_units, weight, weight_units,";
$sql .= " length, length_units, width, width_units, height, height_units,";
$sql .= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,";
- $sql .= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,";
+ $sql .= " accountancy_code_buy, accountancy_code_buy_intra, accountancy_code_buy_export,";
+ $sql .= " accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,";
$sql .= " datec, tms, import_key, entity, desiredstock, tobatch, fk_unit,";
$sql .= " fk_price_expression, price_autogen";
$sql .= " FROM ".MAIN_DB_PREFIX."product";
@@ -2163,10 +2180,12 @@ class Product extends CommonObject
$this->barcode = $obj->barcode;
$this->barcode_type = $obj->fk_barcode_type;
- $this->accountancy_code_buy = $obj->accountancy_code_buy;
- $this->accountancy_code_sell = $obj->accountancy_code_sell;
- $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
- $this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
+ $this->accountancy_code_buy = $obj->accountancy_code_buy;
+ $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
+ $this->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
+ $this->accountancy_code_sell = $obj->accountancy_code_sell;
+ $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
+ $this->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$this->fk_default_warehouse = $obj->fk_default_warehouse;
$this->seuil_stock_alerte = $obj->seuil_stock_alerte;
@@ -4398,15 +4417,15 @@ class Product extends CommonObject
if (!empty($conf->accounting->enabled) && $this->status) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= ''.$langs->trans('ProductAccountancySellCode').': '.length_accountg($this->accountancy_code_sell);
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
- $label .= ''.$langs->trans('ProductAccountancySellIntraCode').': '.length_accountg($this->accountancy_code_sell_export);
- $label .= ''.$langs->trans('ProductAccountancySellExportCode').': '.length_accountg($this->accountancy_code_sell_intra);
- }
+ $label .= ''.$langs->trans('ProductAccountancySellIntraCode').': '.length_accountg($this->accountancy_code_sell_intra);
+ $label .= ''.$langs->trans('ProductAccountancySellExportCode').': '.length_accountg($this->accountancy_code_sell_export);
}
if (!empty($conf->accounting->enabled) && $this->status_buy) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$label .= ''.$langs->trans('ProductAccountancyBuyCode').': '.length_accountg($this->accountancy_code_buy);
- }
+ $label .= ''.$langs->trans('ProductAccountancyBuyIntraCode').': '.length_accountg($this->accountancy_code_buy_intra);
+ $label .= ''.$langs->trans('ProductAccountancyBuyExportCode').': '.length_accountg($this->accountancy_code_buy_export);
+ }
if (isset($this->status) && isset($this->status_buy)) {
$label .= ''.$langs->trans("Status").": ".$this->getLibStatut(5, 0);
$label .= ' '.$this->getLibStatut(5, 1);
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 797ecab7647..89a60931138 100644
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -57,7 +57,7 @@ $hookmanager->initHooks(array('productdocuments'));
// 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;
diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php
index d0eae2f3b17..6659dc56054 100644
--- a/htdocs/product/dynamic_price/class/price_parser.class.php
+++ b/htdocs/product/dynamic_price/class/price_parser.class.php
@@ -20,7 +20,7 @@
* \ingroup product
* \brief File of class to calculate prices using expression
*/
-require_once DOL_DOCUMENT_ROOT.'/includes/evalmath/evalmath.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/evalmath.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_global_variable.class.php';
diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php
index 8ae37416dfb..e613d4a63cb 100644
--- a/htdocs/product/inventory/list.php
+++ b/htdocs/product/inventory/list.php
@@ -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;
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 252c3e214fa..ae89e4c558c 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -11,6 +11,7 @@
* Copyright (C) 2013 Adolfo segura
* Copyright (C) 2015 Jean-François Ferry
* Copyright (C) 2016 Ferran Marcet
+ * Copyright (C) 2020 Alexandre Spangaro
*
* 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
@@ -69,6 +70,8 @@ $search_accountancy_code_sell = GETPOST("search_accountancy_code_sell", 'alpha')
$search_accountancy_code_sell_intra = GETPOST("search_accountancy_code_sell_intra", 'alpha');
$search_accountancy_code_sell_export = GETPOST("search_accountancy_code_sell_export", 'alpha');
$search_accountancy_code_buy = GETPOST("search_accountancy_code_buy", 'alpha');
+$search_accountancy_code_buy_intra = GETPOST("search_accountancy_code_buy_intra", 'alpha');
+$search_accountancy_code_buy_export = GETPOST("search_accountancy_code_buy_export", 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$type = GETPOST("type", "int");
@@ -201,6 +204,8 @@ $arrayfields = array(
'p.accountancy_code_sell_intra'=>array('label'=>$langs->trans("ProductAccountancySellIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>401),
'p.accountancy_code_sell_export'=>array('label'=>$langs->trans("ProductAccountancySellExportCode"), 'checked'=>0, 'position'=>402),
'p.accountancy_code_buy'=>array('label'=>$langs->trans("ProductAccountancyBuyCode"), 'checked'=>0, 'position'=>403),
+ 'p.accountancy_code_buy_intra'=>array('label'=>$langs->trans("ProductAccountancyBuyIntraCode"), 'checked'=>0, 'enabled'=>$isInEEC, 'position'=>404),
+ 'p.accountancy_code_buy_export'=>array('label'=>$langs->trans("ProductAccountancyBuyExportCode"), 'checked'=>0, 'position'=>405),
'p.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
'p.tosell'=>array('label'=>$langs->trans("Status").' ('.$langs->trans("Sell").')', 'checked'=>1, 'position'=>1000),
@@ -256,6 +261,8 @@ if (empty($reshook))
$search_accountancy_code_sell_intra = '';
$search_accountancy_code_sell_export = '';
$search_accountancy_code_buy = '';
+ $search_accountancy_code_buy_intra = '';
+ $search_accountancy_code_buy_export = '';
$search_array_options = array();
}
@@ -297,7 +304,8 @@ else
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,';
$sql .= ' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
-$sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,';
+$sql .= ' p.tobatch, 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.datec as date_creation, p.tms as date_update, p.pmp, p.stock,';
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units,';
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,';
@@ -378,6 +386,8 @@ if ($search_accountancy_code_sell) $sql .= natural_search('p.accountancy_
if ($search_accountancy_code_sell_intra) $sql .= natural_search('p.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
if ($search_accountancy_code_sell_export) $sql .= natural_search('p.accountancy_code_sell_export', $search_accountancy_code_sell_export);
if ($search_accountancy_code_buy) $sql .= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy);
+if ($search_accountancy_code_buy_intra) $sql .= natural_search('p.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
+if ($search_accountancy_code_buy_export) $sql .= natural_search('p.accountancy_code_buy_export', $search_accountancy_code_buy_export);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -387,7 +397,8 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // No
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,";
$sql .= " p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,";
-$sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,';
+$sql .= ' p.datec, p.tms, p.entity, p.tobatch, 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, p.pmp, p.stock,';
$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units';
if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label';
@@ -481,6 +492,8 @@ if ($resql)
if ($search_accountancy_code_sell_intra) $param = "&search_accountancy_code_sell_intra=".urlencode($search_accountancy_code_sell_intra);
if ($search_accountancy_code_sell_export) $param = "&search_accountancy_code_sell_export=".urlencode($search_accountancy_code_sell_export);
if ($search_accountancy_code_buy) $param = "&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
+ if ($search_accountancy_code_buy_intra) $param = "&search_accountancy_code_buy_intra=".urlencode($search_accountancy_code_buy_intra);
+ if ($search_accountancy_code_buy_export) $param = "&search_accountancy_code_buy_export=".urlencode($search_accountancy_code_buy_export);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -770,7 +783,9 @@ if ($resql)
if (!empty($arrayfields['p.accountancy_code_sell_intra']['checked'])) print ' ';
if (!empty($arrayfields['p.accountancy_code_sell_export']['checked'])) print ' ';
// Accountancy code buy
- if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) print ' ';
+ if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) print ' ';
+ if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) print ' ';
+ if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) print ' ';
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
@@ -886,6 +901,12 @@ if ($resql)
if (!empty($arrayfields['p.accountancy_code_buy']['checked'])) {
print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy", "", $param, '', $sortfield, $sortorder);
}
+ if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked'])) {
+ print_liste_field_titre($arrayfields['p.accountancy_code_buy_intra']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy_intra", "", $param, '', $sortfield, $sortorder);
+ }
+ if (!empty($arrayfields['p.accountancy_code_buy_export']['checked'])) {
+ print_liste_field_titre($arrayfields['p.accountancy_code_buy_export']['label'], $_SERVER["PHP_SELF"], "p.accountancy_code_buy_export", "", $param, '', $sortfield, $sortorder);
+ }
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@@ -950,6 +971,8 @@ if ($resql)
$product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export;
$product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra;
$product_static->accountancy_code_buy = $obj->accountancy_code_buy;
+ $product_static->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra;
+ $product_static->accountancy_code_buy_export = $obj->accountancy_code_buy_export;
$product_static->length = $obj->length;
$product_static->length_units = $obj->length_units;
$product_static->width = $obj->width;
@@ -1306,6 +1329,16 @@ if ($resql)
print ''.$obj->accountancy_code_buy.' ';
if (!$i) $totalarray['nbfield']++;
}
+ if (!empty($arrayfields['p.accountancy_code_buy_intra']['checked']))
+ {
+ print ''.$obj->accountancy_code_buy_intra.' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
+ if (!empty($arrayfields['p.accountancy_code_buy_export']['checked']))
+ {
+ print ''.$obj->accountancy_code_buy_export.' ';
+ if (!$i) $totalarray['nbfield']++;
+ }
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
diff --git a/htdocs/product/popucom.php b/htdocs/product/popucom.php
index 41f14e25176..7b89e04bf61 100644
--- a/htdocs/product/popucom.php
+++ b/htdocs/product/popucom.php
@@ -42,7 +42,7 @@ $result=restrictedArea($user, 'produit|service');
$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
if (! $sortfield) $sortfield="c";
if (! $sortorder) $sortorder="DESC";
diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php
index 4df11c7d755..770a02fded5 100644
--- a/htdocs/product/popuprop.php
+++ b/htdocs/product/popuprop.php
@@ -42,7 +42,7 @@ $result=restrictedArea($user, 'produit|service');
$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
if (! $sortfield) $sortfield="c";
if (! $sortorder) $sortorder="DESC";
diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php
index 512d5ff2b89..1af1cebfbb5 100644
--- a/htdocs/product/reassort.php
+++ b/htdocs/product/reassort.php
@@ -54,7 +54,7 @@ $fourn_id = GETPOST("fourn_id", 'int');
$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;
if (!$sortfield) $sortfield = "p.ref";
if (!$sortorder) $sortorder = "ASC";
diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php
index e07dcf0536d..cd65b2c09f7 100644
--- a/htdocs/product/reassortlot.php
+++ b/htdocs/product/reassortlot.php
@@ -58,7 +58,7 @@ $fourn_id = GETPOST("fourn_id", 'int');
$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;
if (!$sortfield) $sortfield = "p.ref";
if (!$sortorder) $sortorder = "ASC";
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 260929cd546..71c1b0f1ef7 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -37,11 +37,11 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
-$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
-$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-$socid='';
-if (! empty($user->socid)) $socid=$user->socid;
-$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
+$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
+$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
+$socid = '';
+if (!empty($user->socid)) $socid = $user->socid;
+$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productstatsorder'));
@@ -49,62 +49,62 @@ $hookmanager->initHooks(array('productstatsorder'));
$mesg = '';
// Load variable for pagination
-$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;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="c.date_commande";
+if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) $sortfield = "c.date_commande";
$search_month = GETPOST('search_month', 'alpha');
$search_year = GETPOST('search_year', 'int');
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
- $search_month='';
- $search_year='';
+ $search_month = '';
+ $search_year = '';
}
/*
* View
*/
-$orderstatic=new Commande($db);
-$societestatic=new Societe($db);
+$orderstatic = new Commande($db);
+$societestatic = new Societe($db);
$form = new Form($db);
-$formother= new FormOther($db);
+$formother = new FormOther($db);
-if ($id > 0 || ! empty($ref))
+if ($id > 0 || !empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
- $parameters=array('id'=>$id);
- $reshook=$hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
+ $parameters = array('id'=>$id);
+ $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
llxHeader("", "", $langs->trans("CardProduct".$product->type));
if ($result > 0)
{
- $head=product_prepare_head($product);
- $titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==Product::TYPE_SERVICE?'service':'product');
+ $head = product_prepare_head($product);
+ $titre = $langs->trans("CardProduct".$product->type);
+ $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'referers', $titre, -1, $picto);
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
@@ -126,28 +126,28 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->commande->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,";
- $sql.= " c.ref_client,";
- $sql.= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
- if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- $sql.= ", ".MAIN_DB_PREFIX."commande as c";
- $sql.= ", ".MAIN_DB_PREFIX."commandedet as d";
- if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE c.fk_soc = s.rowid";
- $sql.= " AND c.entity IN (".getEntity('commande').")";
- $sql.= " AND d.fk_commande = c.rowid";
- $sql.= " AND d.fk_product =".$product->id;
- if (! empty($search_month))
- $sql.= ' AND MONTH(c.date_commande) IN (' . $search_month . ')';
- if (! empty($search_year))
- $sql.= ' AND YEAR(c.date_commande) IN (' . $search_year . ')';
- if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($socid) $sql.= " AND c.fk_soc = ".$socid;
- $sql.= $db->order($sortfield, $sortorder);
+ $sql .= " c.ref_client,";
+ $sql .= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
+ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql .= ", ".MAIN_DB_PREFIX."commande as c";
+ $sql .= ", ".MAIN_DB_PREFIX."commandedet as d";
+ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql .= " WHERE c.fk_soc = s.rowid";
+ $sql .= " AND c.entity IN (".getEntity('commande').")";
+ $sql .= " AND d.fk_commande = c.rowid";
+ $sql .= " AND d.fk_product =".$product->id;
+ if (!empty($search_month))
+ $sql .= ' AND MONTH(c.date_commande) IN ('.$search_month.')';
+ if (!empty($search_year))
+ $sql .= ' AND YEAR(c.date_commande) IN ('.$search_year.')';
+ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ if ($socid) $sql .= " AND c.fk_soc = ".$socid;
+ $sql .= $db->order($sortfield, $sortorder);
//Calcul total qty and amount for global if full scan list
- $total_ht=0;
- $total_qty=0;
+ $total_ht = 0;
+ $total_qty = 0;
// Count total nb of records
$totalofrecords = '';
@@ -164,30 +164,30 @@ if ($id > 0 || ! empty($ref))
{
$num = $db->num_rows($result);
- if (! empty($id))
+ if (!empty($id))
$option .= '&id='.$product->id;
- if (! empty($search_month))
+ if (!empty($search_month))
$option .= '&search_month='.$search_month;
- if (! empty($search_year))
+ if (!empty($search_year))
$option .= '&search_year='.$search_year;
- if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
+ if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit);
- print '' . "\n";
- if (! empty($sortfield))
- print ' ';
- if (! empty($sortorder))
- print ' ';
- if (! empty($page)) {
- print ' ';
- $option .= '&page=' . $page;
+ print ' '."\n";
+ if (!empty($sortfield))
+ print ' ';
+ if (!empty($sortorder))
+ print ' ';
+ if (!empty($page)) {
+ print ' ';
+ $option .= '&page='.$page;
}
print_barre_liste($langs->trans("CustomersOrders"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '';
print '
';
- print $langs->trans('Period').' ('.$langs->trans("OrderDate") .') - ';
- print $langs->trans('Month') . ':
';
- print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
+ print $langs->trans('Period').' ('.$langs->trans("OrderDate").') - ';
+ print $langs->trans('Month').':
';
+ print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print '
';
print '
';
print '
';
@@ -214,12 +214,12 @@ if ($id > 0 || ! empty($ref))
{
$objp = $db->fetch_object($result);
- $total_ht+=$objp->total_ht;
- $total_qty+=$objp->qty;
+ $total_ht += $objp->total_ht;
+ $total_qty += $objp->qty;
- $orderstatic->id=$objp->commandeid;
- $orderstatic->ref=$objp->ref;
- $orderstatic->ref_client=$objp->ref_client;
+ $orderstatic->id = $objp->commandeid;
+ $orderstatic->ref = $objp->ref;
+ $orderstatic->ref_client = $objp->ref_client;
$societestatic->fetch($objp->socid);
print '
';
diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php
index c854f8280ce..7a5b88000e1 100644
--- a/htdocs/product/stats/commande_fournisseur.php
+++ b/htdocs/product/stats/commande_fournisseur.php
@@ -54,7 +54,7 @@ $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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php
index e5e37e44242..8e61446a834 100644
--- a/htdocs/product/stats/contrat.php
+++ b/htdocs/product/stats/contrat.php
@@ -49,7 +49,7 @@ $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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php
index 5ef97845338..e42afd9f28c 100644
--- a/htdocs/product/stats/facture.php
+++ b/htdocs/product/stats/facture.php
@@ -38,35 +38,35 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
// Security check
-$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
-$fieldtype = (! empty($ref) ? 'ref' : 'rowid');
-$socid='';
-if (! empty($user->socid)) $socid=$user->socid;
-$result=restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
+$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
+$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
+$socid = '';
+if (!empty($user->socid)) $socid = $user->socid;
+$result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('productstatsinvoice'));
-$showmessage=GETPOST('showmessage');
+$showmessage = GETPOST('showmessage');
// Load variable for pagination
-$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;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="DESC";
-if (! $sortfield) $sortfield="f.datef";
+if (!$sortorder) $sortorder = "DESC";
+if (!$sortfield) $sortfield = "f.datef";
$search_month = GETPOST('search_month', 'alpha');
$search_year = GETPOST('search_year', 'int');
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
- $search_month='';
- $search_year='';
+ $search_month = '';
+ $search_year = '';
}
@@ -75,21 +75,21 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
* View
*/
-$invoicestatic=new Facture($db);
-$societestatic=new Societe($db);
+$invoicestatic = new Facture($db);
+$societestatic = new Societe($db);
$form = new Form($db);
-$formother= new FormOther($db);
+$formother = new FormOther($db);
-if ($id > 0 || ! empty($ref))
+if ($id > 0 || !empty($ref))
{
$product = new Product($db);
$result = $product->fetch($id, $ref);
$object = $product;
- $parameters=array('id'=>$id);
- $reshook=$hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
+ $parameters = array('id'=>$id);
+ $reshook = $hookmanager->executeHooks('doActions', $parameters, $product, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$title = $langs->trans('ProductServiceCard');
@@ -97,32 +97,32 @@ if ($id > 0 || ! empty($ref))
$shortlabel = dol_trunc($object->label, 16);
if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT))
{
- $title = $langs->trans('Product')." ". $shortlabel ." - ".$langs->trans('Referers');
- $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
+ $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Referers');
+ $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
}
if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE))
{
- $title = $langs->trans('Service')." ". $shortlabel ." - ".$langs->trans('Referers');
- $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
+ $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Referers');
+ $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
}
llxHeader('', $title, $helpurl);
if ($result > 0)
{
- $head=product_prepare_head($product);
- $titre=$langs->trans("CardProduct".$product->type);
- $picto=($product->type==Product::TYPE_SERVICE?'service':'product');
+ $head = product_prepare_head($product);
+ $titre = $langs->trans("CardProduct".$product->type);
+ $picto = ($product->type == Product::TYPE_SERVICE ? 'service' : 'product');
dol_fiche_head($head, 'referers', $titre, -1, $picto);
- $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
+ $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $product, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$linkback = ''.$langs->trans("BackToList").' ';
$shownav = 1;
- if ($user->socid && ! in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0;
+ if ($user->socid && !in_array('product', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0;
dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref');
@@ -147,28 +147,28 @@ if ($id > 0 || ! empty($ref))
elseif ($user->rights->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
- $sql.= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
- $sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
- if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
- $sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
- $sql.= ", ".MAIN_DB_PREFIX."facture as f";
- $sql.= ", ".MAIN_DB_PREFIX."facturedet as d";
- if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE f.fk_soc = s.rowid";
- $sql.= " AND f.entity IN (".getEntity('invoice').")";
- $sql.= " AND d.fk_facture = f.rowid";
- $sql.= " AND d.fk_product =".$product->id;
- if (! empty($search_month))
- $sql.= ' AND MONTH(f.datef) IN (' . $search_month . ')';
- if (! empty($search_year))
- $sql.= ' AND YEAR(f.datef) IN (' . $search_year . ')';
- if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
- if ($socid) $sql.= " AND f.fk_soc = ".$socid;
- $sql.= $db->order($sortfield, $sortorder);
+ $sql .= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
+ $sql .= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
+ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
+ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
+ $sql .= ", ".MAIN_DB_PREFIX."facture as f";
+ $sql .= ", ".MAIN_DB_PREFIX."facturedet as d";
+ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+ $sql .= " WHERE f.fk_soc = s.rowid";
+ $sql .= " AND f.entity IN (".getEntity('invoice').")";
+ $sql .= " AND d.fk_facture = f.rowid";
+ $sql .= " AND d.fk_product =".$product->id;
+ if (!empty($search_month))
+ $sql .= ' AND MONTH(f.datef) IN ('.$search_month.')';
+ if (!empty($search_year))
+ $sql .= ' AND YEAR(f.datef) IN ('.$search_year.')';
+ if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
+ if ($socid) $sql .= " AND f.fk_soc = ".$socid;
+ $sql .= $db->order($sortfield, $sortorder);
// Calcul total qty and amount for global if full scan list
- $total_ht=0;
- $total_qty=0;
+ $total_ht = 0;
+ $total_qty = 0;
// Count total nb of records
$totalofrecords = '';
@@ -178,37 +178,37 @@ if ($id > 0 || ! empty($ref))
$totalofrecords = $db->num_rows($result);
}
- $sql.= $db->plimit($limit + 1, $offset);
+ $sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
- if (! empty($id))
+ if (!empty($id))
$option .= '&id='.$product->id;
- if (! empty($search_month))
+ if (!empty($search_month))
$option .= '&search_month='.$search_month;
- if (! empty($search_year))
+ if (!empty($search_year))
$option .= '&search_year='.$search_year;
- if ($limit > 0 && $limit != $conf->liste_limit) $option.='&limit='.urlencode($limit);
+ if ($limit > 0 && $limit != $conf->liste_limit) $option .= '&limit='.urlencode($limit);
- print '' . "\n";
- if (! empty($sortfield))
- print ' ';
- if (! empty($sortorder))
- print ' ';
- if (! empty($page)) {
- print ' ';
- $option .= '&page=' . $page;
+ print ' '."\n";
+ if (!empty($sortfield))
+ print ' ';
+ if (!empty($sortorder))
+ print ' ';
+ if (!empty($page)) {
+ print ' ';
+ $option .= '&page='.$page;
}
print_barre_liste($langs->trans("CustomersInvoices"), $page, $_SERVER["PHP_SELF"], "&id=".$product->id, $sortfield, $sortorder, '', $num, $totalofrecords, '', 0, '', '', $limit);
print '';
print '
';
- print $langs->trans('Period').' ('.$langs->trans("DateInvoice") .') - ';
- print $langs->trans('Month') . ':
';
- print $langs->trans('Year') . ':' . $formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
+ print $langs->trans('Period').' ('.$langs->trans("DateInvoice").') - ';
+ print $langs->trans('Month').':
';
+ print $langs->trans('Year').':'.$formother->selectyear($search_year ? $search_year : - 1, 'search_year', 1, 20, 5);
print '
';
print '
';
print '
';
@@ -235,13 +235,13 @@ if ($id > 0 || ! empty($ref))
{
$objp = $db->fetch_object($result);
- if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty=-($objp->qty);
+ if ($objp->type == Facture::TYPE_CREDIT_NOTE) $objp->qty = -($objp->qty);
- $total_ht+=$objp->total_ht;
- $total_qty+=$objp->qty;
+ $total_ht += $objp->total_ht;
+ $total_qty += $objp->qty;
- $invoicestatic->id=$objp->facid;
- $invoicestatic->ref=$objp->ref;
+ $invoicestatic->id = $objp->facid;
+ $invoicestatic->ref = $objp->ref;
$societestatic->fetch($objp->socid);
$paiement = $invoicestatic->getSommePaiement();
diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php
index c8b085e8178..29774709e5e 100644
--- a/htdocs/product/stats/facture_fournisseur.php
+++ b/htdocs/product/stats/facture_fournisseur.php
@@ -53,7 +53,7 @@ $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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stats/mo.php b/htdocs/product/stats/mo.php
index 8c7eb34e7e1..0a148ad2c8a 100644
--- a/htdocs/product/stats/mo.php
+++ b/htdocs/product/stats/mo.php
@@ -49,7 +49,7 @@ $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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php
index 2355ecaed59..d65b88ccabc 100644
--- a/htdocs/product/stats/propal.php
+++ b/htdocs/product/stats/propal.php
@@ -52,7 +52,7 @@ $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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stats/supplier_proposal.php b/htdocs/product/stats/supplier_proposal.php
index ad425249200..a7fede51aa1 100644
--- a/htdocs/product/stats/supplier_proposal.php
+++ b/htdocs/product/stats/supplier_proposal.php
@@ -52,7 +52,7 @@ $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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php
index 8f8ca7ad283..d5fdf711ea5 100644
--- a/htdocs/product/stock/list.php
+++ b/htdocs/product/stock/list.php
@@ -61,7 +61,7 @@ if (!empty($conf->categorie->enabled))
$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;
diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php
index 8d98f028d23..36db491629f 100644
--- a/htdocs/product/stock/massstockmove.php
+++ b/htdocs/product/stock/massstockmove.php
@@ -52,7 +52,7 @@ $idline = GETPOST('idline');
$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
if (!$sortfield) {
diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php
index b7746e81e66..c8567108d2d 100644
--- a/htdocs/product/stock/movement_card.php
+++ b/htdocs/product/stock/movement_card.php
@@ -72,7 +72,7 @@ $search_qty = trim(GETPOST("search_qty", 'alpha'));
$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index dea7580aeb7..7c189f1015e 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -76,7 +76,7 @@ $search_qty = trim(GETPOST("search_qty"));
$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
-$page = GETPOST("page", 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php
index 5fb9cc23bca..95bf0b7f5c4 100644
--- a/htdocs/product/stock/productlot_document.php
+++ b/htdocs/product/stock/productlot_document.php
@@ -57,7 +57,7 @@ $hookmanager->initHooks(array('productlotdocuments'));
// 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;
diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php
index 4b36fda5ccb..5eedc40f40c 100644
--- a/htdocs/product/stock/productlot_list.php
+++ b/htdocs/product/stock/productlot_list.php
@@ -57,7 +57,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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index bd7941e1448..d860640be81 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -66,7 +66,7 @@ $texte = '';
$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;
diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php
index 5ca7debbef6..c1e1e157f79 100644
--- a/htdocs/product/stock/replenishorders.php
+++ b/htdocs/product/stock/replenishorders.php
@@ -46,7 +46,7 @@ $sref = GETPOST('search_ref', 'alpha');
$snom = GETPOST('search_nom', 'alpha');
$suser = GETPOST('search_user', 'alpha');
$sttc = GETPOST('search_ttc', 'alpha');
-$page = GETPOST('page', 'int');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$sproduct = GETPOST('sproduct', 'int');
$search_dateyear = GETPOST('search_dateyear', 'int');
$search_datemonth = GETPOST('search_datemonth', 'int');
diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php
index 6f551d7ae2b..d7e5c86ffa6 100644
--- a/htdocs/projet/class/projectstats.class.php
+++ b/htdocs/projet/class/projectstats.class.php
@@ -76,7 +76,6 @@ class ProjectStats extends Stats
$sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label";
$result = array ();
- $res = array ();
dol_syslog(get_class($this) . '::' . __METHOD__ . "", LOG_DEBUG);
$resql = $this->db->query($sql);
diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php
index f77419f2e75..1895270d758 100644
--- a/htdocs/projet/document.php
+++ b/htdocs/projet/document.php
@@ -57,7 +57,7 @@ if ($id > 0 || ! empty($ref)) {
// 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;
diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php
index 143a932ff28..ddb66bc3317 100644
--- a/htdocs/projet/index.php
+++ b/htdocs/projet/index.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2004-2016 Laurent Destailleur
+ * Copyright (C) 2004-2020 Laurent Destailleur
* Copyright (C) 2005-2010 Regis Houssin
* Copyright (C) 2019 Nicolas ZABOURI
*
@@ -200,7 +200,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
print '';
- print '';
+ print ' ';
$projectstatic->id = $obj->rowid;
$projectstatic->ref = $obj->ref;
diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php
index ddb7673dece..0058a5a94dd 100644
--- a/htdocs/projet/info.php
+++ b/htdocs/projet/info.php
@@ -39,7 +39,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');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "a.datep,a.id";
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index ca4f918c7d3..e04875294bf 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -62,7 +62,7 @@ $diroutputmassaction = $conf->projet->dir_output.'/temp/massgeneration/'.$user->
$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');
$page = is_numeric($page) ? $page : 0;
$page = $page == -1 ? 0 : $page;
if (!$sortfield) $sortfield = "p.ref";
diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php
index 38fa476fcab..09fcab7fedb 100644
--- a/htdocs/projet/stats/index.php
+++ b/htdocs/projet/stats/index.php
@@ -77,11 +77,12 @@ if (!empty($userid) && $userid != -1) $stats_project->userid = $userid;
if (!empty($socid) && $socid != -1) $stats_project->socid = $socid;
if (!empty($year)) $stats_project->year = $year;
-
-
+/*
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
+ // Current stats of project amount per status
$data1 = $stats_project->getAllProjectByStatus();
+
if (!is_array($data1) && $data1 < 0) {
setEventMessages($stats_project->error, null, 'errors');
}
@@ -100,43 +101,42 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$i = 0; $tot = count($data1); $legend = array();
while ($i <= $tot)
{
- $data1[$i][0] = $data1[$i][0]; // Required to avoid error "Could not draw pie with labels contained inside canvas"
$legend[] = $data1[$i][0];
$i++;
}
+
$px->SetData($data1);
unset($data1);
if ($nocolor)
- $px->SetDataColor(array(
+ $px->SetDataColor(array(
array(
220,
220,
220
)
));
- $px->SetLegend($legend);
- $px->setShowLegend(0);
- $px->setShowPointValue($showpointvalue);
- $px->setShowPercent(1);
- $px->SetMaxValue($px->GetCeilMaxValue());
- $px->SetWidth($WIDTH);
- $px->SetHeight($HEIGHT);
- $px->SetShading(3);
- $px->SetHorizTickIncrement(1);
- $px->SetCssPrefix("cssboxes");
- $px->SetType(array(
- 'pie'
- ));
- $px->SetTitle($langs->trans('OpportunitiesStatusForProjects'));
- $result = $px->draw($filenamenb, $fileurlnb);
+
+ $px->SetLegend($legend);
+ $px->setShowLegend(0);
+ $px->setShowPointValue($showpointvalue);
+ $px->setShowPercent(1);
+ $px->SetMaxValue($px->GetCeilMaxValue());
+ $px->SetWidth($WIDTH);
+ $px->SetHeight($HEIGHT);
+ $px->SetShading(3);
+ $px->SetHorizTickIncrement(1);
+ $px->SetCssPrefix("cssboxes");
+ $px->SetType(array('pie'));
+ $px->SetTitle($langs->trans('OpportunitiesStatusForProjects'));
+ $result = $px->draw($filenamenb, $fileurlnb);
if ($result < 0) {
setEventMessages($px->error, null, 'errors');
}
} else {
- setEventMessages(null, $mesgs, 'errors');
+ setEventMessages(null, $mesg, 'errors');
}
-}
+}*/
// Build graphic number of object
@@ -186,13 +186,14 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$mesg = $px2->isGraphKo();
if (!$mesg)
{
- $px2->SetData($data);
$i = $startyear; $legend = array();
while ($i <= $endyear)
{
$legend[] = $i;
$i++;
}
+
+ $px2->SetData($data);
$px2->SetLegend($legend);
$px2->SetMaxValue($px2->GetCeilMaxValue());
$px2->SetMinValue(min(0, $px2->GetFloorMinValue()));
@@ -201,6 +202,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$px2->SetYLabel($langs->trans("ProjectOppAmountOfProjectsByMonth"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
+ $px2->SetType(array('bars', 'bars'));
$px2->mode = 'depth';
$px2->SetTitle($langs->trans("ProjectOppAmountOfProjectsByMonth"));
@@ -353,8 +355,8 @@ else {
$stringtoshow .= " \n";
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
- $stringtoshow .= $px->show();
- $stringtoshow .= " \n";
+ //$stringtoshow .= $px->show();
+ //$stringtoshow .= " \n";
$stringtoshow .= $px2->show();
$stringtoshow .= " \n";
$stringtoshow .= $px3->show();
diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php
index 133b3d3d509..4dd06b10cd2 100644
--- a/htdocs/projet/tasks/document.php
+++ b/htdocs/projet/tasks/document.php
@@ -53,7 +53,7 @@ if (!$user->rights->projet->lire) accessforbidden();
// 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;
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 3fd85f4082e..09135733e9e 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -91,7 +91,7 @@ $diroutputmassaction = $conf->projet->dir_output.'/tasks/temp/massgeneration/'.$
$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;
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index 291ab4ab949..637ed3a6644 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -75,7 +75,7 @@ if (!$user->rights->projet->lire) 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;
diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php
index 560d7dbd0a9..1dfe694f154 100644
--- a/htdocs/public/members/public_list.php
+++ b/htdocs/public/members/public_list.php
@@ -80,7 +80,7 @@ function llxFooterVierge()
$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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index 1f1c1ed40d4..00f19d248cf 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -195,7 +195,7 @@ if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->payb
}
if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled))
{
- require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This include also /stripe/lib/stripe.lib.php, /includes/stripe/init.php, ...
+ require_once DOL_DOCUMENT_ROOT.'/stripe/config.php'; // This include also /stripe/lib/stripe.lib.php, /includes/stripe/stripe-php/init.php, ...
}
// Initialize $validpaymentmethod
@@ -1719,7 +1719,6 @@ if ($action != 'dopayment')
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled))
{
- // If STRIPE_PICTO_FOR_PAYMENT is 'cb' we show a picto of a crdit card instead of paybox
print ' ';
}
- // Other attributes
- $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
- $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- if (empty($reshook))
- {
- print $object->showOptionals($extrafields, 'edit', $parameters);
- }
+ // Other attributes
+ $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
// Assign a sale representative
print '';
@@ -2218,14 +2213,9 @@ else
print ' ';
}
- // Other attributes
- $parameters = array('colspan' => ' colspan="3"', 'cols' => '3');
- $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
- if (empty($reshook))
- {
- print $object->showOptionals($extrafields, 'edit', $parameters);
- }
+ // Other attributes
+ $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
// Webservices url/key
if (!empty($conf->syncsupplierwebservices->enabled)) {
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 5f7f297d55d..ad5c66a50b8 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -125,7 +125,7 @@ class Societe extends CommonObject
/**
* @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(
+ public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'parent' =>array('type'=>'integer', 'label'=>'Parent', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
@@ -134,7 +134,7 @@ class Societe extends CommonObject
'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name alias', 'enabled'=>1, 'visible'=>-1, 'position'=>36, 'showoncombobox'=>1),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>40, 'index'=>1),
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>45),
- 'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>50), // deprecated
+ 'ref_int' =>array('type'=>'varchar(60)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>50), // deprecated
'code_client' =>array('type'=>'varchar(24)', 'label'=>'Code client', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
'code_fournisseur' =>array('type'=>'varchar(24)', 'label'=>'Code fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
'code_compta' =>array('type'=>'varchar(24)', 'label'=>'Code compta', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
@@ -877,7 +877,7 @@ class Societe extends CommonObject
$contact->firstname = $this->firstname;
$contact->civility_id = $this->civility_id;
$contact->socid = $this->id; // fk_soc
- $contact->statut = 1; // deprecated
+ $contact->statut = 1; // deprecated
$contact->status = 1;
$contact->priv = 0;
$contact->country_id = $this->country_id;
@@ -2111,7 +2111,7 @@ class Societe extends CommonObject
$reparray[$i]['email'] = $obj->email;
$reparray[$i]['phone'] = $obj->office_phone;
$reparray[$i]['job'] = $obj->job;
- $reparray[$i]['statut'] = $obj->status; // deprecated
+ $reparray[$i]['statut'] = $obj->status; // deprecated
$reparray[$i]['status'] = $obj->status;
$reparray[$i]['entity'] = $obj->entity;
$reparray[$i]['login'] = $obj->login;
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index cd82533fc88..3664d8fd848 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -42,7 +42,7 @@ if ($socid > 0) $object->fetch($socid);
$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;
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index f907bd210f6..992892e96db 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -50,7 +50,7 @@ $result = restrictedArea($user, 'societe', $id, '&societe');
// 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;
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index a7860012740..06d60843a79 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -97,8 +97,6 @@ $search_type = GETPOST('search_type', 'alpha');
$search_level = GETPOST("search_level", "array");
$search_stcomm = GETPOST('search_stcomm', 'int');
$search_import_key = GETPOST("search_import_key", "alpha");
-$search_btn = GETPOST('button_search', 'alpha');
-$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_parent_name = GETPOST('search_parent_name', 'alpha');
$type = GETPOST('type', 'alpha');
@@ -110,10 +108,10 @@ $diroutputmassaction = $conf->societe->dir_output.'/temp/massgeneration/'.$user-
$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 (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "s.nom";
-if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; }
+if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@@ -619,10 +617,10 @@ print ' ';
print ' ';
print ' ';
print ' ';
-print ' ';
+//print ' ';
print ' ';
-print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit);
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'building', 0, $newcardbutton, '', $limit, 0, 0, 1);
$langs->load("other");
$textprofid = array();
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index dcb9dcb7996..f04459335d5 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -45,7 +45,7 @@ $result = restrictedArea($user, 'societe', '', '');
$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 (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="n.daten";
if (empty($page) || $page == -1) { $page = 0; }
diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php
index 5b383f30e28..b65f0486d17 100644
--- a/htdocs/societe/price.php
+++ b/htdocs/societe/price.php
@@ -231,7 +231,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$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) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php
index 8874a62bc3b..198252c3f3a 100644
--- a/htdocs/societe/societecontact.php
+++ b/htdocs/societe/societecontact.php
@@ -42,7 +42,7 @@ $massaction=GETPOST('massaction', '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 (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
if (empty($page) || $page == -1 || !empty($search_btn) || !empty($search_remove_btn) || (empty($toselect) && $massaction === '0')) { $page = 0; }
diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php
index 5d248ec16fd..7b3bf774a68 100644
--- a/htdocs/societe/website.php
+++ b/htdocs/societe/website.php
@@ -53,7 +53,7 @@ $result = restrictedArea($user, 'societe', $socid, '&societe');
$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;
diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php
index bea6223ff32..2ae2c858b46 100644
--- a/htdocs/stripe/charge.php
+++ b/htdocs/stripe/charge.php
@@ -40,7 +40,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$rowid = GETPOST("rowid", 'alpha');
$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;
diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php
index 65d80f9587b..730203245f4 100644
--- a/htdocs/stripe/config.php
+++ b/htdocs/stripe/config.php
@@ -25,8 +25,8 @@
* \brief Page to move config in api
*/
-require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php';
-require_once DOL_DOCUMENT_ROOT.'/includes/stripe/lib/Stripe.php';
+require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php';
+require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/lib/Stripe.php';
//global $stripe;
global $conf;
diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php
index 37f9ae65f42..90533464b7f 100644
--- a/htdocs/stripe/payout.php
+++ b/htdocs/stripe/payout.php
@@ -40,7 +40,7 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$rowid = GETPOST("rowid", 'alpha');
$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;
diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php
index 7094b9427a1..978b8ed3d62 100644
--- a/htdocs/stripe/transaction.php
+++ b/htdocs/stripe/transaction.php
@@ -40,7 +40,7 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$rowid = GETPOST("rowid", 'alpha');
$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;
diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php
index 151baf128aa..6caa21c7db7 100644
--- a/htdocs/supplier_proposal/document.php
+++ b/htdocs/supplier_proposal/document.php
@@ -54,7 +54,7 @@ $result = restrictedArea($user, 'supplier_proposal', $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;
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index fdd8609fd06..e73a29be1dc 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -91,7 +91,7 @@ $dayvalid = GETPOST("dayvalid");
$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;
@@ -307,7 +307,7 @@ if ($search_author) $sql .= natural_search('u.login', $search_author);
if ($search_montant_ht) $sql .= natural_search('sp.total_ht=', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql .= natural_search("sp.tva", $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql .= natural_search("sp.total", $search_montant_ttc, 1);
-if ($search_multicurrency_code != '') $sql .= ' AND sp.multicurrency_code = "' . $db->escape($search_multicurrency_code) . '"';
+if ($search_multicurrency_code != '') $sql .= ' AND sp.multicurrency_code = "'.$db->escape($search_multicurrency_code).'"';
if ($search_multicurrency_tx != '') $sql .= natural_search('sp.multicurrency_tx', $search_multicurrency_tx, 1);
if ($search_multicurrency_montant_ht != '') $sql .= natural_search('sp.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
if ($search_multicurrency_montant_vat != '') $sql .= natural_search('sp.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
@@ -719,121 +719,121 @@ if ($resql)
}
// Other picto tool
print '';
- $filename=dol_sanitizeFileName($obj->ref);
- $filedir=$conf->supplier_proposal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
- $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
+ $filename = dol_sanitizeFileName($obj->ref);
+ $filedir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($obj->ref);
+ $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print ' ';
print "\n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid;
// Company
- $companystatic->id=$obj->socid;
- $companystatic->name=$obj->name;
- $companystatic->client=$obj->client;
- $companystatic->code_client=$obj->code_client;
+ $companystatic->id = $obj->socid;
+ $companystatic->name = $obj->name;
+ $companystatic->client = $obj->client;
+ $companystatic->code_client = $obj->code_client;
// Thirdparty
- if (! empty($arrayfields['s.nom']['checked']))
+ if (!empty($arrayfields['s.nom']['checked']))
{
print '
';
print $companystatic->getNomUrl(1, 'customer');
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Town
- if (! empty($arrayfields['s.town']['checked']))
+ if (!empty($arrayfields['s.town']['checked']))
{
print '
';
print $obj->town;
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Zip
- if (! empty($arrayfields['s.zip']['checked']))
+ if (!empty($arrayfields['s.zip']['checked']))
{
print '
';
print $obj->zip;
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// State
- if (! empty($arrayfields['state.nom']['checked']))
+ if (!empty($arrayfields['state.nom']['checked']))
{
print "
".$obj->state_name." \n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Country
- if (! empty($arrayfields['country.code_iso']['checked']))
+ if (!empty($arrayfields['country.code_iso']['checked']))
{
print '
';
- $tmparray=getCountry($obj->fk_pays, 'all');
+ $tmparray = getCountry($obj->fk_pays, 'all');
print $tmparray['label'];
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Type ent
- if (! empty($arrayfields['typent.code']['checked']))
+ if (!empty($arrayfields['typent.code']['checked']))
{
print '
';
- if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
+ if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Date proposal
- if (! empty($arrayfields['sp.date_valid']['checked']))
+ if (!empty($arrayfields['sp.date_valid']['checked']))
{
print '
';
print dol_print_date($db->jdate($obj->date_valid), 'day');
print " \n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Date delivery
- if (! empty($arrayfields['sp.date_livraison']['checked']))
+ if (!empty($arrayfields['sp.date_livraison']['checked']))
{
print '
';
print dol_print_date($db->jdate($obj->dp), 'day');
print " \n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Amount HT
- if (! empty($arrayfields['sp.total_ht']['checked']))
+ if (!empty($arrayfields['sp.total_ht']['checked']))
{
print '
'.price($obj->total_ht)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_ht';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ht';
$totalarray['val']['sp.total_ht'] += $obj->total_ht;
}
// Amount VAT
- if (! empty($arrayfields['sp.total_vat']['checked']))
+ if (!empty($arrayfields['sp.total_vat']['checked']))
{
print '
'.price($obj->total_vat)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_vat';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_vat';
$totalarray['val']['sp.total_vat'] += $obj->total_vat;
}
// Amount TTC
- if (! empty($arrayfields['sp.total_ttc']['checked']))
+ if (!empty($arrayfields['sp.total_ttc']['checked']))
{
print '
'.price($obj->total_ttc)." \n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='sp.total_ttc';
+ if (!$i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'sp.total_ttc';
$totalarray['val']['sp.total_ttc'] += $obj->total_ttc;
}
// Currency
if (!empty($arrayfields['sp.multicurrency_code']['checked']))
{
- print '
'.$obj->multicurrency_code . ' - ' . $langs->trans('Currency' . $obj->multicurrency_code)." \n";
+ print '
'.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)." \n";
if (!$i) $totalarray['nbfield']++;
}
@@ -841,7 +841,7 @@ if ($resql)
if (!empty($arrayfields['sp.multicurrency_tx']['checked']))
{
print '
';
- $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 " \n";
if (!$i) $totalarray['nbfield']++;
}
@@ -864,58 +864,58 @@ if ($resql)
if (!$i) $totalarray['nbfield']++;
}
- $userstatic->id=$obj->fk_user_author;
- $userstatic->login=$obj->login;
+ $userstatic->id = $obj->fk_user_author;
+ $userstatic->login = $obj->login;
// Author
- if (! empty($arrayfields['u.login']['checked']))
+ if (!empty($arrayfields['u.login']['checked']))
{
print '
';
if ($userstatic->id) print $userstatic->getLoginUrl(1);
else print ' ';
print " \n";
- 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, 'obj'=>$obj);
- $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
+ $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
- if (! empty($arrayfields['sp.datec']['checked']))
+ if (!empty($arrayfields['sp.datec']['checked']))
{
print '
';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Date modification
- if (! empty($arrayfields['sp.tms']['checked']))
+ if (!empty($arrayfields['sp.tms']['checked']))
{
print '
';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Status
- if (! empty($arrayfields['sp.fk_statut']['checked']))
+ if (!empty($arrayfields['sp.fk_statut']['checked']))
{
print '
'.$objectstatic->LibStatut($obj->fk_statut, 5)." \n";
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
}
// Action column
print '
';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
- $selected=0;
- if (in_array($obj->rowid, $arrayofselected)) $selected=1;
- print ' ';
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
+ print ' ';
}
print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (!$i) $totalarray['nbfield']++;
print "\n";
diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php
index 0e8ba28e0bb..20b62da4650 100644
--- a/htdocs/takepos/admin/setup.php
+++ b/htdocs/takepos/admin/setup.php
@@ -43,7 +43,7 @@ if (!$user->admin) accessforbidden();
$langs->loadLangs(array("admin", "cashdesk"));
-global $db;
+global $db, $mysoc;
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_paiement";
$sql .= " WHERE entity IN (".getEntity('c_paiement').")";
@@ -57,10 +57,14 @@ if ($resql) {
}
}
+$action = GETPOST('action', 'alpha');
+
/*
* Actions
*/
-if (GETPOST('action', 'alpha') == 'set')
+$error = 0;
+
+if ($action == 'set')
{
$db->begin();
if (GETPOST('socid', 'int') < 0) $_POST["socid"] = '';
@@ -98,13 +102,29 @@ if (GETPOST('action', 'alpha') == 'set')
if (!$error)
{
$db->commit();
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
$db->rollback();
- setEventMessages($langs->trans("Error"), null, 'errors');
}
+} elseif ($action == 'updateMask') {
+ $maskconst = GETPOST('maskconst', 'alpha');
+ $maskvalue = GETPOST('maskvalue', 'alpha');
+ if ($maskconst) $res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
+ if (!$res > 0) {
+ $error++;
+ }
+} elseif ($action == 'setrefmod') {
+ $value = GETPOST('value', 'alpha');
+ dolibarr_set_const($db, "TAKEPOS_REF_ADDON", $value, 'chaine', 0, '', $conf->entity);
+}
+
+if ($action != '') {
+ if (!$error) {
+ setEventMessage($langs->trans('SetupSaved'));
+ } else {
+ setEventMessages($langs->trans('Error'), null, 'errors');
+ }
}
/*
@@ -122,6 +142,110 @@ $head = takepos_prepare_head();
dol_fiche_head($head, 'setup', 'TakePOS', -1);
print '
';
+// Numbering modules
+$now = dol_now();
+$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+
+print load_fiche_titre($langs->trans('CashDeskRefNumberingModules'), '', '');
+
+print '
';
+print '';
+print ''.$langs->trans("Name")." \n";
+print ''.$langs->trans("Description")." \n";
+print ''.$langs->trans("Example")." \n";
+print ''.$langs->trans("Status").' ';
+print ''.$langs->trans("ShortInfo").' ';
+print ' '."\n";
+
+clearstatcache();
+
+foreach ($dirmodels as $reldir)
+{
+ $dir = dol_buildpath($reldir."core/modules/takepos/");
+
+ if (is_dir($dir))
+ {
+ $handle = opendir($dir);
+ if (is_resource($handle))
+ {
+ $var=true;
+
+ while (($file = readdir($handle))!==false)
+ {
+ if (substr($file, 0, 16) == 'mod_takepos_ref_' && substr($file, dol_strlen($file)-3, 3) == 'php')
+ {
+ $file = substr($file, 0, dol_strlen($file)-4);
+
+ require_once $dir.$file.'.php';
+
+ $module = new $file;
+
+ // Show modules according to features level
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
+
+ if ($module->isEnabled())
+ {
+ $var=!$var;
+ print ''.$module->nom." \n";
+ print $module->info();
+ print ' ';
+
+ // Show example of numbering module
+ print '';
+ $tmp=$module->getExample();
+ if (preg_match('/^Error/', $tmp)) print ''.$langs->trans($tmp).'
';
+ elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
+ else print $tmp;
+ print ' '."\n";
+
+ print '';
+ if ($conf->global->TAKEPOS_REF_ADDON == "$file")
+ {
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ }
+ else
+ {
+ print '';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+ }
+ print ' ';
+
+ // example for next value
+ $invoice = new Facture($db);
+ $invoice->date = $now;
+ $invoice->module_source = 'takepos';
+ $invoice->pos_source = 1;
+
+ // Info
+ $htmltooltip='';
+ $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().' ';
+ $nextval=$module->getNextValue($mysoc, $invoice);
+ if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
+ $htmltooltip.=''.$langs->trans("NextValue").': ';
+ if ($nextval) {
+ if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
+ $nextval = $langs->trans($nextval);
+ $htmltooltip.=$nextval.' ';
+ } else {
+ $htmltooltip.=$langs->trans($module->error).' ';
+ }
+ }
+
+ print '';
+ print $form->textwithpicto('', $htmltooltip, 1, 0);
+ print ' ';
+
+ print " \n";
+ }
+ }
+ }
+ closedir($handle);
+ }
+ }
+}
+print "
\n";
// Mode
print '
';
@@ -175,7 +299,7 @@ print '';
print $langs->trans("SortProductField");
print ' ';
$prod = new Product($db);
-$array = array('rowid' => 'ID', 'ref' => 'Ref', 'datec' => 'DateCreation', 'tms' => 'DateModification');
+$array = array('rowid' => 'ID', 'ref' => 'Ref', 'label' => 'Label', 'datec' => 'DateCreation', 'tms' => 'DateModification');
print $form->selectarray('TAKEPOS_SORTPRODUCTFIELD', $array, (empty($conf->global->TAKEPOS_SORTPRODUCTFIELD) ? 'rowid' : $conf->global->TAKEPOS_SORTPRODUCTFIELD), 0, 0, 0, '', 1);
print " \n";
@@ -201,6 +325,13 @@ $array = array(0=>$langs->trans("Numberspad"), 1=>$langs->trans("BillsCoinsPad")
print $form->selectarray('TAKEPOS_NUMPAD', $array, (empty($conf->global->TAKEPOS_NUMPAD) ? '0' : $conf->global->TAKEPOS_NUMPAD), 0);
print "\n";
+// Numpad use payment icons
+print '';
+print $langs->trans('TakeposNumpadUsePaymentIcon');
+print ' ';
+print ajax_constantonoff("TAKEPOS_NUMPAD_USE_PAYMENT_ICON", array(), $conf->entity, 0, 0, 1, 0);
+print " \n";
+
// Direct Payment
print '';
print $langs->trans('DirectPaymentButton');
@@ -242,61 +373,61 @@ print $form->selectarray('TAKEPOS_EMAIL_TEMPLATE_INVOICE', $arrayofmessagename,
print " \n";
// Numbering module
-print '';
-print $langs->trans("BillsNumberingModule");
-print ' ';
-$array = array(0=>$langs->trans("Default"), "terminal"=>$langs->trans("ByTerminal"));
-$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
-foreach ($dirmodels as $reldir)
-{
- $dir = dol_buildpath($reldir."core/modules/facture/");
- if (is_dir($dir))
- {
- $handle = opendir($dir);
- if (is_resource($handle))
- {
- while (($file = readdir($handle)) !== false)
- {
- if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
- {
- $filebis = $file;
- $classname = preg_replace('/\.php$/', '', $file);
- // For compatibility
- if (!is_file($dir.$filebis))
- {
- $filebis = $file."/".$file.".modules.php";
- $classname = "mod_facture_".$file;
- }
- // Check if there is a filter on country
- preg_match('/\-(.*)_(.*)$/', $classname, $reg);
- if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
-
- $classname = preg_replace('/\-.*$/', '', $classname);
- if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
- {
- // Charging the numbering class
- require_once $dir.$filebis;
-
- $module = new $classname($db);
-
- // Show modules according to features level
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
-
- if ($module->isEnabled())
- {
- $array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))]=preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
- }
- }
- }
- }
- closedir($handle);
- }
- }
-}
-
-print $form->selectarray('TAKEPOS_ADDON', $array, (empty($conf->global->TAKEPOS_ADDON) ? '0' : $conf->global->TAKEPOS_ADDON), 0);
-print " \n";
+//print '';
+//print $langs->trans("BillsNumberingModule");
+//print ' ';
+//$array = array(0=>$langs->trans("Default"), "terminal"=>$langs->trans("ByTerminal"));
+//$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+//foreach ($dirmodels as $reldir)
+//{
+// $dir = dol_buildpath($reldir."core/modules/facture/");
+// if (is_dir($dir))
+// {
+// $handle = opendir($dir);
+// if (is_resource($handle))
+// {
+// while (($file = readdir($handle)) !== false)
+// {
+// if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
+// {
+// $filebis = $file;
+// $classname = preg_replace('/\.php$/', '', $file);
+// // For compatibility
+// if (!is_file($dir.$filebis))
+// {
+// $filebis = $file."/".$file.".modules.php";
+// $classname = "mod_facture_".$file;
+// }
+// // Check if there is a filter on country
+// preg_match('/\-(.*)_(.*)$/', $classname, $reg);
+// if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
+//
+// $classname = preg_replace('/\-.*$/', '', $classname);
+// if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
+// {
+// // Charging the numbering class
+// require_once $dir.$filebis;
+//
+// $module = new $classname($db);
+//
+// // Show modules according to features level
+// if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+// if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
+//
+// if ($module->isEnabled())
+// {
+// $array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))] = preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
+// }
+// }
+// }
+// }
+// closedir($handle);
+// }
+// }
+//}
+//
+//print $form->selectarray('TAKEPOS_ADDON', $array, (empty($conf->global->TAKEPOS_ADDON) ? '0' : $conf->global->TAKEPOS_ADDON), 0);
+//print " \n";
print '';
print ' ';
diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php
index 08ca05bb109..abd4f68adc5 100644
--- a/htdocs/takepos/admin/terminal.php
+++ b/htdocs/takepos/admin/terminal.php
@@ -213,9 +213,9 @@ if (!empty($conf->stock->enabled))
print '';
if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK) && !$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) {
- print '
' . $langs->trans('CashDeskForceDecreaseStockLabel') . ' ';
+ print ''.$langs->trans('CashDeskForceDecreaseStockLabel').' ';
print '';
- print '' . $langs->trans('CashDeskForceDecreaseStockDesc') . ' ';
+ print ''.$langs->trans('CashDeskForceDecreaseStockDesc').' ';
print ' ';
}
}
@@ -248,13 +248,13 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
print '';
}
-print '
' . $langs->trans('CashDeskReaderKeyCodeForEnter') . ' ';
+print ''.$langs->trans('CashDeskReaderKeyCodeForEnter').' ';
print '';
-print ' ';
+print ' ';
print ' ';
// Numbering module
-if ($conf->global->TAKEPOS_ADDON=="terminal"){
+if ($conf->global->TAKEPOS_ADDON == "terminal") {
print '
';
print $langs->trans("BillsNumberingModule");
print ' ';
@@ -298,7 +298,7 @@ if ($conf->global->TAKEPOS_ADDON=="terminal"){
if ($module->isEnabled())
{
- $array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))]=preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
+ $array[preg_replace('/\-.*$/', '', preg_replace('/\.php$/', '', $file))] = preg_replace('/\-.*$/', '', preg_replace('/mod_facture_/', '', preg_replace('/\.php$/', '', $file)));
}
}
}
diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php
index 6ce0dfcf88e..07de9e50a51 100644
--- a/htdocs/takepos/ajax/ajax.php
+++ b/htdocs/takepos/ajax/ajax.php
@@ -38,6 +38,10 @@ $action = GETPOST('action', 'alpha');
$term = GETPOST('term', 'alpha');
$id = GETPOST('id', 'int');
+if (empty($user->rights->takepos->run)) {
+ access_forbidden();
+}
+
/*
* View
@@ -103,14 +107,14 @@ elseif ($action == 'search' && $term != '') {
} elseif ($action == "opendrawer" && $term != '') {
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
$printer = new dolReceiptPrinter($db);
- // chek printer for terminal
+ // check printer for terminal
if ($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term} > 0) {
$printer->initPrinter($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term});
// open cashdrawer
$printer->pulse();
$printer->close();
}
-} elseif ($action == "printinvoiceticket" && $term != '' && $id > 0) {
+} elseif ($action == "printinvoiceticket" && $term != '' && $id > 0 && ! empty($user->rights->facture->lire)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$printer = new dolReceiptPrinter($db);
@@ -120,4 +124,13 @@ elseif ($action == 'search' && $term != '') {
$object->fetch($id);
$ret = $printer->sendToPrinter($object, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$term}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$term});
}
+} elseif ($action == 'getInvoice') {
+ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
+
+ $object = new Facture($db);
+ if ($id > 0) {
+ $object->fetch($id);
+ }
+
+ echo json_encode($object);
}
diff --git a/htdocs/takepos/css/colorful.css b/htdocs/takepos/css/colorful.css
index 3cfd18e72f1..298a29ce4cf 100644
--- a/htdocs/takepos/css/colorful.css
+++ b/htdocs/takepos/css/colorful.css
@@ -22,4 +22,12 @@ button.actionbutton {
tr.selected, tr.selected td {
background-color: #0000FF !important;
color: #FFFFFF !important;
-}
\ No newline at end of file
+}
+
+.header{
+ background: rgb(0,0,0) !important;
+}
+
+.topnav{
+ background: rgb(0,0,0) !important;
+}
diff --git a/htdocs/takepos/css/pos.css.php b/htdocs/takepos/css/pos.css.php
index 8a75549ce0c..c228b948c3b 100644
--- a/htdocs/takepos/css/pos.css.php
+++ b/htdocs/takepos/css/pos.css.php
@@ -101,6 +101,7 @@ button.calcbutton {
/* border-color: unset; */
border-width: 0;
margin: 1px;
+ font-size: 14pt;
}
button.calcbutton2 {
@@ -118,6 +119,8 @@ button.calcbutton2 {
width: calc(25% - 2px);
height: calc(25% - 2px);
font-weight: bold;
+ font-size: 8pt;
+ margin: 1px;
}
button.calcbutton3 {
@@ -128,10 +131,11 @@ button.calcbutton3 {
cursor: pointer;
vertical-align: middle;
text-align: center;
- font-size:120%;
overflow: visible; /* removes extra width in IE */
width: calc(25% - 2px);
height: calc(25% - 2px);
+ font-size: 14pt;
+ margin: 1px;
}
button.actionbutton {
@@ -153,6 +157,16 @@ button.actionbutton {
height: calc(25% - 2px);
}
+div[aria-describedby="dialog-info"] button:before {
+ content: "\f788";
+ font-family: "Font Awesome 5 Free";
+ font-weight: 900;
+ padding-right: 5px;
+}
+div[aria-describedby="dialog-info"].ui-dialog .ui-dialog-buttonpane {
+ border-width: 0;
+}
+
.takepospay {
font-size: 1.5em;
}
@@ -468,12 +482,6 @@ div.description_content {
}
@media screen and (min-width: 892px) {
- .calcbutton{
- font-size: 18px;
- }
- .calcbutton2{
- font-size: 14px;
- }
.actionbutton{
font-size: 13px;
}
@@ -486,12 +494,6 @@ div.description_content {
}
@media (max-width: 891px) and (min-width: 386px) {
- .calcbutton{
- font-size: 12px;
- }
- .calcbutton2{
- font-size: 9px;
- }
.actionbutton{
font-size: 12px;
}
@@ -504,12 +506,6 @@ div.description_content {
}
@media screen and (max-width: 385px){
- .calcbutton{
- font-size: 8px;
- }
- .calcbutton2{
- font-size: 7px;
- }
.actionbutton{
font-size: 10px;
}
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 4660032cc15..20054a52965 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -168,12 +168,12 @@ if ($action == 'valid' && $user->rights->facture->creer)
$invoice->update($user);
}
- $sav_FACTURE_ADDON='';
- if (! empty($conf->global->TAKEPOS_ADDON)) {
- $sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
- if ($conf->global->TAKEPOS_ADDON=="terminal") $conf->global->FACTURE_ADDON = $conf->global->{'TAKEPOS_ADDON'.$_SESSION["takeposterminal"]};
- else $conf->global->FACTURE_ADDON = $conf->global->TAKEPOS_ADDON;
- }
+ //$sav_FACTURE_ADDON = '';
+ //if (!empty($conf->global->TAKEPOS_ADDON)) {
+ // $sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
+ // if ($conf->global->TAKEPOS_ADDON == "terminal") $conf->global->FACTURE_ADDON = $conf->global->{'TAKEPOS_ADDON'.$_SESSION["takeposterminal"]};
+ // else $conf->global->FACTURE_ADDON = $conf->global->TAKEPOS_ADDON;
+ //}
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
if ($invoice->statut != Facture::STATUS_DRAFT) {
@@ -198,7 +198,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
dol_syslog("Validate invoice with stock change into warehouse defined into constant ".$constantforkey." = ".$conf->global->$constantforkey);
$batch_rule = 0;
if (!empty($conf->productbatch->enabled) && !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) {
- require_once DOL_DOCUMENT_ROOT . '/product/class/productbatch.class.php';
+ require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php';
$batch_rule = Productbatch::BATCH_RULE_SELLBY_EATBY_DATES_FIRST;
}
$res = $invoice->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule);
@@ -211,10 +211,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
}
// Restore save values
- if (! empty($sav_FACTURE_ADDON))
- {
- $conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
- }
+ //if (!empty($sav_FACTURE_ADDON))
+ //{
+ // $conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
+ //}
$remaintopay = $invoice->getRemainToPay();
@@ -227,7 +227,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
// If user has not used change control, add total invoice payment
// Or if user has used change control and the amount of payment is higher than remain to pay, add the remain to pay
- if ($amountofpayment == 0 || $amountofpayment>$remaintopay) $payment->amounts[$invoice->id] = $remaintopay;
+ if ($amountofpayment == 0 || $amountofpayment > $remaintopay) $payment->amounts[$invoice->id] = $remaintopay;
$payment->paiementid = $paiementid;
$payment->num_payment = $invoice->ref;
@@ -240,6 +240,8 @@ if ($action == 'valid' && $user->rights->facture->creer)
dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user);
if ($result > 0) $invoice->paye = 1;
+ // set payment method
+ $invoice->setPaymentMethods($paiementid);
} else {
dol_syslog("Invoice is not paid, remain to pay = ".$remaintopay);
}
@@ -300,7 +302,7 @@ if ($action == "addline")
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
- if (! empty($conf->global->TAKEPOS_SUPPLEMENTS))
+ if (!empty($conf->global->TAKEPOS_SUPPLEMENTS))
{
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$cat = new Categorie($db);
@@ -311,8 +313,8 @@ if ($action == "addline")
$sql = "SELECT fk_parent_line FROM ".MAIN_DB_PREFIX."facturedet where rowid=$selectedline";
$resql = $db->query($sql);
$row = $db->fetch_array($resql);
- if ($row[0]==null) $parent_line=$selectedline;
- else $parent_line=$row[0]; //If the parent line is already a supplement, add the supplement to the main product
+ if ($row[0] == null) $parent_line = $selectedline;
+ else $parent_line = $row[0]; //If the parent line is already a supplement, add the supplement to the main product
}
}
@@ -453,13 +455,19 @@ if ($action == "updatereduction")
else $result = $invoice->updateline($line->id, $line->desc, $line->multicurrency_subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
}
}
+ $invoice->fetch($placeid);
+} elseif ($action == 'update_reduction_global') {
+ foreach ($invoice->lines as $line) {
+ $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
+ }
+
$invoice->fetch($placeid);
}
if ($action == "order" and $placeid != 0)
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
- if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
+ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
$printer = new dolReceiptPrinter($db);
}
@@ -487,7 +495,7 @@ if ($action == "order" and $placeid != 0)
$order_receipt_printer1 .= ' ';
}
}
- if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
+ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
$invoice->fetch($placeid); //Reload object before send to printer
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1
}
@@ -512,7 +520,7 @@ if ($action == "order" and $placeid != 0)
$order_receipt_printer2 .= '';
}
}
- if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
+ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
$invoice->fetch($placeid); //Reload object before send to printer
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_PRINTER_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2
}
@@ -538,9 +546,9 @@ if ($action == "valid" || $action == "history")
else $sectionwithinvoicelink .= $langs->trans('BillShortStatusValidated');
}
$sectionwithinvoicelink .= '';
- if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector"){
+ if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
$sectionwithinvoicelink .= '
'.$langs->trans('PrintTicket').' ';
- } elseif ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter"){
+ } elseif ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
$sectionwithinvoicelink .= '
'.$langs->trans('PrintTicket').' ';
} else {
$sectionwithinvoicelink .= '
'.$langs->trans('PrintTicket').' ';
@@ -550,7 +558,7 @@ if ($action == "valid" || $action == "history")
$sectionwithinvoicelink .= '
'.$langs->trans('SendTicket').' ';
}
- if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink .= '';
+ if ($remaintopay <= 0 && $conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink .= '';
}
/*
@@ -664,6 +672,14 @@ function DolibarrTakeposPrinting(id) {
url: "" + id,
});
}
+
+$( document ).ready(function() {
+ $("a#customer").text("socid != $conf->global->$constforcompanyid) print $soc->name;
+ else print $langs->trans("Customer");
+ ?>");
+});
+
0)
$tmplines = array_reverse($invoice->lines);
foreach ($tmplines as $line)
{
- if ($line->fk_parent_line!=false)
+ if ($line->fk_parent_line != false)
{
- $htmlsupplements[$line->fk_parent_line].='
fk_parent_line].=' order';
- $htmlsupplements[$line->fk_parent_line].= '" id="'.$line->id.'">';
- $htmlsupplements[$line->fk_parent_line].= '';
- $htmlsupplements[$line->fk_parent_line].= img_picto('', 'rightarrow');
+ $htmlsupplements[$line->fk_parent_line] .= ' fk_parent_line] .= ' order';
+ $htmlsupplements[$line->fk_parent_line] .= '" id="'.$line->id.'">';
+ $htmlsupplements[$line->fk_parent_line] .= '';
+ $htmlsupplements[$line->fk_parent_line] .= img_picto('', 'rightarrow');
if ($line->product_label) $htmlsupplements[$line->fk_parent_line] .= $line->product_label;
if ($line->product_label && $line->desc) $htmlsupplements[$line->fk_parent_line] .= ' ';
if ($line->product_label != $line->desc)
@@ -829,19 +845,27 @@ if ($placeid > 0)
if (empty($line->product_type)) $htmlforlines .= img_object('', 'product').' ';
else $htmlforlines .= img_object('', 'service').' ';
}
- if ($line->product_label) $htmlforlines .= $line->product_label;
- if ($line->product_label && $line->desc) $htmlforlines .= ' ';
- if ($line->product_label != $line->desc)
- {
- $firstline = dolGetFirstLineOfText($line->desc);
- if ($firstline != $line->desc)
- {
- $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
- }
- else
- {
- $htmlforlines .= $line->desc;
- }
+ if (empty($conf->global->TAKEPOS_SHOW_N_FIRST_LINES)) {
+ $tooltiptext = ''.$langs->trans("Ref").' : '.$line->product_ref.' ';
+ $tooltiptext .= ''.$langs->trans("Label").' : '.$line->product_label.' ';
+ $tooltiptext .= ' ';
+ $tooltiptext .= $line->desc;
+ $htmlforlines .= $form->textwithpicto($line->product_label ? $line->product_label : $line->product_ref, $tooltiptext);
+ } else {
+ if ($line->product_label) $htmlforlines .= $line->product_label;
+ if ($line->product_label && $line->desc) $htmlforlines .= ' ';
+ if ($line->product_label != $line->desc)
+ {
+ $firstline = dolGetFirstLineOfText($line->desc, $conf->global->TAKEPOS_SHOW_N_FIRST_LINES);
+ if ($firstline != $line->desc)
+ {
+ $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc);
+ }
+ else
+ {
+ $htmlforlines .= $line->desc;
+ }
+ }
}
if (!empty($line->array_options['options_order_notes'])) $htmlforlines .= " (".$line->array_options['options_order_notes'].")";
if ($_SESSION["basiclayout"] != 1)
@@ -881,9 +905,7 @@ print '';
if ($invoice->socid != $conf->global->$constforcompanyid)
{
- print '';
print '';
- print $langs->trans("Customer").': '.$soc->name;
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
if (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1")
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index ec619015496..fb2442b5aba 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -214,7 +214,7 @@ else print "var received=0;";
}
-
+
trans('TotalTTC'); ?>: total_ttc, 1, '', 1, -1, -1) ?>
@@ -233,7 +233,7 @@ else print "var received=0;";
-
+
"parent.$.colorbox.close();",
- "span" => "id='printtext'",
- "text" => $langs->trans("Cancel"),
+ "span" => "id='printtext' style='font-weight: bold; font-size: 18pt;'",
+ "text" => "X",
"class" => "poscolordelete"
),
);
$numpad = $conf->global->TAKEPOS_NUMPAD;
+
+print ''.($numpad == 0 ? '7' : '10').' ';
+print ''.($numpad == 0 ? '8' : '20').' ';
+print ''.($numpad == 0 ? '9' : '50').' ';
?>
-);">
-);">
-);">
0) {
$paycode = $paiements[0]->code;
- if ($paycode == 'LIQ') $paycode = 'cash';
- if ($paycode == 'CB') $paycode = 'card';
- if ($paycode == 'CHQ') $paycode = 'cheque';
- ?>
-trans("PaymentTypeShort".$paiements[0]->code); ?>
-
-trans("NoPaimementModesDefined"); ?>
-
-);">
-);">
-);">
+ $payIcon = '';
+ if ($paycode == 'LIQ') {
+ $paycode = 'cash';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'coins';
+ } elseif ($paycode == 'CB') {
+ $paycode = 'card';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'credit-card';
+ } elseif ($paycode == 'CHQ') {
+ $paycode = 'cheque';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
+ }
+
+ print ''.(!empty($payIcon) ? ' ' : $langs->trans("PaymentTypeShort".$paiements[0]->code)).' ';
+} else {
+ print ''.$langs->trans("NoPaimementModesDefined").' ';
+}
+
+print ''.($numpad == 0 ? '4' : '1').' ';
+print ''.($numpad == 0 ? '5' : '2').' ';
+print ''.($numpad == 0 ? '6' : '5').' ';
+?>
1) {
$paycode = $paiements[1]->code;
- if ($paycode == 'LIQ') $paycode = 'cash';
- if ($paycode == 'CB') $paycode = 'card';
- if ($paycode == 'CHQ') $paycode = 'cheque';
- ?>
-trans("PaymentTypeShort".$paiements[1]->code); ?>
-
- ">>
-
-);">
-);">
-);">
+ $payIcon = '';
+ if ($paycode == 'LIQ') {
+ $paycode = 'cash';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'coins';
+ } elseif ($paycode == 'CB') {
+ $paycode = 'card';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'credit-card';
+ } elseif ($paycode == 'CHQ') {
+ $paycode = 'cheque';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
+ }
+
+ print ''.(!empty($payIcon) ? ' ' : $langs->trans("PaymentTypeShort".$paiements[1]->code)).' ';
+} else {
+ $button = array_pop($action_buttons);
+ print ''.$button["text"].' ';
+}
+
+print ''.($numpad == 0 ? '1' : '0.10').' ';
+print ''.($numpad == 0 ? '2' : '0.20').' ';
+print ''.($numpad == 0 ? '3' : '0.50').' ';
+?>
2) {
$paycode = $paiements[2]->code;
- if ($paycode == 'LIQ') $paycode = 'cash';
- if ($paycode == 'CB') $paycode = 'card';
- if ($paycode == 'CHQ') $paycode = 'cheque';
- ?>
-trans("PaymentTypeShort".$paiements[2]->code); ?>
-global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'coins';
+ } elseif ($paycode == 'CB') {
+ $paycode = 'card';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'credit-card';
+ } elseif ($paycode == 'CHQ') {
+ $paycode = 'cheque';
+ if (!empty($conf->global->TAKEPOS_NUMPAD_USE_PAYMENT_ICON)) $payIcon = 'money-check';
+ }
+
+ print ''.(!empty($payIcon) ? ' ' : $langs->trans("PaymentTypeShort".$paiements[2]->code)).' ';
+} else {
$button = array_pop($action_buttons);
- ?>
- ">>
-
-);">
-);">
-);">
-'.$button["text"].' ';
+}
+
+print ''.($numpad == 0 ? '0' : '0.01').' ';
+print ''.($numpad == 0 ? '000' : '0.02').' ';
+print ''.($numpad == 0 ? '.' : '0.05').' ';
+
$i = 3;
while ($i < count($paiements)) {
- ?>
-trans("PaymentTypeShort".$paiements[$i]->code); ?>
- trans($paiements[$i]->code).'\');">'.$langs->trans("PaymentTypeShort".$paiements[$i]->code).'';
$i = $i + 1;
}
@@ -320,9 +346,7 @@ if ($conf->global->TAKEPOS_ENABLE_SUMUP) {
$class = ($i == 3) ? "calcbutton3" : "calcbutton2";
foreach ($action_buttons as $button) {
$newclass = $class.($button["class"] ? " ".$button["class"] : "");
- ?>
- ">>
- '.$button["text"].' ';
}
?>
diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php
new file mode 100644
index 00000000000..a2d57ea3a6e
--- /dev/null
+++ b/htdocs/takepos/reduction.php
@@ -0,0 +1,219 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see
.
+ */
+
+/**
+ * \file htdocs/takepos/reduction.php
+ * \ingroup takepos
+ * \brief Page with the content of the popup to enter reductions
+ */
+
+//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
+if (!defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1');
+if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1');
+if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
+if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
+if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
+
+require '../main.inc.php'; // Load $user and permissions
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+
+$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
+
+$invoiceid = GETPOST('invoiceid', 'int');
+
+
+/*
+ * View
+ */
+
+$invoice = new Facture($db);
+if ($invoiceid > 0)
+{
+ $invoice->fetch($invoiceid);
+}
+else
+{
+ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'";
+ $resql = $db->query($sql);
+ $obj = $db->fetch_object($resql);
+ if ($obj)
+ {
+ $invoiceid = $obj->rowid;
+ }
+ if (!$invoiceid)
+ {
+ $invoiceid = 0; // Invoice does not exist yet
+ }
+ else
+ {
+ $invoice->fetch($invoiceid);
+ }
+}
+
+$arrayofcss = array('/takepos/css/pos.css.php');
+$arrayofjs = array();
+
+top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
+
+$langs->loadLangs(array('main', 'bills', 'cashdesk'));
+?>
+
+
+
+
+
+
+
+
+trans('Reduction').'">';
+?>
+
+
+
+
+7';
+print '8 ';
+print '9 ';
+print ' ';
+print '4 ';
+print '5 ';
+print '6 ';
+print ' ';
+print '1 ';
+print '2 ';
+print '3 ';
+print 'C ';
+print '0 ';
+print '. ';
+print ' ';
+print 'X ';
+
+?>
+
+
+
+