Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
glu000 2020-03-21 18:17:18 +01:00
commit 0746d70071
2367 changed files with 130692 additions and 56356 deletions

View File

@ -101,28 +101,30 @@ Long description (Can span accross multiple lines).
</pre>
### Pull Requests
When submitting a pull request, use same rule as [Commits](#commits) for the message.
Pull Request (PR) process is the process to submit a change (enhancement, bug fix, ...) into the code of the project. There is some rules to know and
a process to follow to optimize the chance to have PRs merged efficiently...
If your pull request only contains one commit, GitHub will be smart enough to fill it for you.
When submitting a pull request, use same rule as [Commits](#commits) for the message.
If your pull request only contains 1 commit, GitHub will be smart enough to fill it for you.
Otherwise, please be a bit verbose about what you're providing.
Your Pull Request (PR) must pass the Continuous Integration checks.
Your Pull Request (PR) must pass the Continuous Integration checks and code quality checks.
Also, some code changes need a prior approbation:
* if you want to include a new external library (into htdocs/includes directory), please ask before to the project manager (@eldy) to see if such a library can be accepted.
* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
* if you add a new table, you must first create a page on https://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Then ask the project manager (@eldy) if the new data model you plan to add is compatible with curent and future works in progress and can be accepted as you suggest.
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR (A label is added in such a case).
If the label of PR start with "WIP" (Work In Progress), it will not be analyzed (until you change the label of PR).
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting an action of the developer/author.
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the tag ask you. The majority of open PR are waiting an action of the author of the PR.
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. This is one of the most important ratio of answered PR in Open Source world. Don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. Average answer delay is also one of the best among Open source project (just few days before having the Answer Tag set). This is one of the most important ratio of answered PR in Open Source world for a major project. Don't expect the core team to reach the 100%. A so high ratio is very rare on a so popular project and with the increasing popularity of Dolibarr, this ratio will probably decrease in future to a more common level.
### Resources

View File

@ -0,0 +1,13 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: Greetings PR
on: [pull_request]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-message: 'Welcome to the Dolibarr army. You are on the road to become an Admiral (see https://wiki.dolibarr.org/index.php/Dolibarr_Project)'

24
.github/workflows/stale-issues-safe.yml vendored Normal file
View File

@ -0,0 +1,24 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: "Close stale issues (bugs and feature requests)"
on:
schedule:
- cron: "0 21 * * *"
issue_comment:
types: [created]
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: Dolibarr/stale@staleunstale
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-label: 'Issue Stale (automatic label)'
exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE)'
days-before-stale: 365
days-before-close: 15
operations-per-run: 100
dry-run: false

View File

@ -0,0 +1,25 @@
# 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 20 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: Dolibarr/stale@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-issue-label: 'Issue Stale (automatic label)'
exempt-issue-label: 'Priority High / Blocking'
days-before-stale: 365
days-before-close: -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'

1
.gitignore vendored
View File

@ -40,3 +40,4 @@ htdocs/includes/sebastian/
htdocs/includes/squizlabs/
htdocs/includes/symfony/
htdocs/includes/webmozart/
htdocs/.well-known/apple-developer-merchantid-domain-association

View File

@ -3,6 +3,7 @@
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
# We use dist: xenial to have php 5.6+ available
os: linux
dist: xenial
sudo: required
@ -43,7 +44,7 @@ env:
global:
# Set to true for very verbose output
- DEBUG=false
matrix:
jobs:
# MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mariadb
- DB=mysql
@ -53,7 +54,7 @@ env:
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
#- WS=nginx
matrix:
jobs:
fast_finish: true
allow_failures:
- php: nightly

View File

@ -17,7 +17,7 @@ CKEditor 4.12.1 LGPL-2.1+ Yes
EvalMath 1.0 BSD Yes Safe math expressions evaluation
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
Mobiledetect 2.8.34 MIT License Yes Detect mobile devices browsers
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
ParseDown 1.6 MIT License Yes Markdown parser
@ -32,15 +32,16 @@ PSR/simple-cache ? Library for cache (used by PHPSp
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.41 MIT licence Yes Library for Stripe module
Stripe 6.43.1 MIT licence Yes Library for Stripe module
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
Ace 1.4.8 BSD Yes JS library to get code syntaxique coloration in a textarea.
Chart 2.9.3 MIT License Yes JS library for graph
jQuery 3.4.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery select2 4.0.13 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery Flot 0.8.3 MIT License Yes JS library to build graph

184
ChangeLog
View File

@ -5,19 +5,195 @@ 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:
* A new way to navigate between pages in list is available. To use it, you must
- replace $page = GETPOST('page', 'int') with $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
- remove input field in form '<input type="hidden" name="page" value="'.$page.'">';'
- add parameter $pagenavastextinput to value 1 when calling print_barre_liste
WARNING:
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.3 compared to 11.0.2 *****
FIX: unit price for selected supplier products not set. NaN was used.
FIX: use bad var to check if total is positive for each VAT rate when validating an invoice
FIX: status missing from last customer invoices box when using MAIN_STATUS_USES_CSS
FIX: translations for "orders" not loaded in the homepage box
FIX: #13194
FIX: #13274 cannot add or update 0 value for an int or double extrafield
FIX: #13285 SQL error during migration with pgsql
FIX: #13294
FIX: #13313
FIX: Clone Fourn Command, add line's extrafields
FIX: cols parameter not propagated to tpl
FIX: CSRF error when creating an intervention
FIX: date order was -1D and desc with label repetition
FIX: empty of series in graph of product distribution
FIX: fk_type subscription list via api REST
FIX: link when using anchor on "/" in website module
FIX: menu export document was not visible when using "simple accounting"
FIX: missing class declaration
FIX: missing global $conf
FIX: Missing token in some forms (avoid unset POST errors)
FIX: params of setEventMessage($langs->trans('ErrorProductClone')...
FIX: Remove unexisting link
FIX: mass action on stock movements
FIX: substitute lines dates values on doc generator (ODT, ...)
FIX: Ticket - Load Cache Messages Ticket, wrong message's status
FIX: Ticket Public - Private messages are displayed
FIX: wrong include - replace extrafields_create.tpl.php to extrafields_add.tpl.php
***** ChangeLog for 11.0.2 compared to 11.0.1 *****
FIX: #10309
FIX: #13110
FIX: #13118
FIX: #13124
FIX: #13131
FIX: #13135
FIX: #13146
FIX: #13198
FIX: #13175
FIX: #13182
FIX: #13183
FIX: #13184
FIX: #13263
FIX: #13267
FIX: an external user can not approve
FIX: API Get list of documents for supplier_invoice
FIX: API to push an expense report
FIX: API upload/download doc for expensereport
FIX: Avoid to download the export if we just press enter to refresh form
FIX: Bad link to template invoices
FIX: Bad sort link in accounting report
FIX: Bad translation for productlot EatBy and SellBy
FIX: better method to check user rights AND usergroup rights !
FIX: CA by product list filter
FIX: CSS
FIX: Disable js if no javascript
FIX: duplicate class name into some log lines
FIX: etrafield with visibilty=5 were not in read only.
FIX: excess paid from situation invoices not counted when calculating remain to pay.
FIX: Force FEC export to txt format.
FIX: Free input for email no more visible.
FIX: Keep assigned users in session when loading projects and tasks
FIX: List of viewed projects too large in task widget.
FIX: Menu truncated. Add tooltip to have all content.
FIX: Missing field "billed" in export.
FIX: missing "statut" for getNomUrl() function
FIX: modFournisseur is required by modSupplierProposal
FIX: Multicompany compatibility
FIX: must be == and not =
FIX: option for topbar search and bookmarks
FIX: option MAIN_OPTIMIZEFORTEXTBROWSER
FIX: some responsive troubles
FIX: round MT in accountancy books
FIX: search with '0'
FIX: sort link
FIX: SQL Overload in default contact trigger.
FIX: SQl syntax error.
FIX: Submit of documents for supplier invoices.
FIX: timezone must be tzserver and not tzuser as on contract card
FIX: token in barcode tools page missing
FIX: Bad name of trigger PROPAL_SUPPLIER_TRIGGER, should be PROPOSAL_SUPPLIER_TRIGGER
FIX: Type of contact for event does not exists and not supported
FIX: Type of contact not saved when creating a contact
FIX: typo on ckeck method
FIX: undefined function measuringUnitString in product list
FIX: Usage of project not available in export.
FIX: wrong test
FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
FIX: Use GETPOST instead of POST
FIX: HTML Injection
FIX: Visualization rights correction on last modified contacts box.
FIX: Vulnerability in module from modulebuilder.
FIX: Vulnerability reported by code16
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
FIX: advanced target emailing sql and ergonomy.
FIX: After import of a website template, home page was not set.
FIX: Avoid deletion of bank record if in accounting
FIX: compatibility with multicompany (avoid duplicate data)
FIX: Confusion between 'bank reconciled' and 'accounted'. Show both data.
FIX: Count of Stripe payment mode must take test/live into account
FIX: Creation of Stripe card from backoffice must return a clean message
FIX: CVE-201917223
FIX: CVE-201917223
FIX: CVE-2020-7994
FIX: CVE Need permission to be able to develop modules
FIX: #13053
FIX: Disable ticket status change if ticket closed
FIX: doc of dictionnary API
FIX: expedition ceate line new parameter is not required.
FIX: export ledger
FIX: FEC export have specific name
FIX: Filenames must not contains non ascii char or we will get non ascii
FIX: Filter on list of events were lost after "Back to list"
FIX: hasDelay for retained warranty
FIX: If we can change vendor status, we must be able to chane vendor code
FIX: links in products/services index
FIX: Log of authentication ok or ko + CVE-2020-7996
FIX: Look and feel v11
FIX: Mail smtps truncated if content has a line with single .
FIX: missing hook parameter
FIX: Missing include
FIX: need weight short label in shipping doc
FIX: Picture of contact not visible in tooltip
FIX: Problem with column label in subscription list
FIX: ref_client not visible in tooltip.
FIX: search filter on extrafields were not restored after "Back to list"
FIX: situation invoice: allow excess paid to be converted to discount
FIX: situation invoice: bad amount for previous payments because of local variable overwriting a more global one
FIX: situation invoice: can't convert excess received to discount & bad previous payment amount
FIX: SQL request and phpunit
FIX: Update export_files.php
FIX: Use ref into label of ticket message
FIX: use "usergroup" instead of "user"
FIX: Warning on admin/export_files
FIX: #10203
FIX: default filtering for 'select' extrafields should use "=", not "LIKE"
FIX: #11975 When a product is split between multiple pages in a document, prices/quantity/etc appear on the last relevant page
FIX: #12760 #12763 #12755 #12765 #12751
FIX: #12874
FIX: #12892
FIX: #12908 User login with credentials from self-subscription form fails
FIX: #12932
FIX: #12966
FIX: #12973
FIX: #12974
FIX: #12975
FIX: #12978
FIX: #12986
FIX: #12991
FIX: #12992
FIX: #12995
FIX: #13018 Extrafields Supplier invoice
FIX: #13019
FIX: #13022
FIX: #13028
FIX: #13038 ExpenseReport PDF - custom category description is not correct
FIX: #13046 More complete
FIX: #13048
FIX: #13050
FIX: #13077 Replace left join with inner join (left join was useless)
FIX: #13085
FIX: #13094
FIX: #13096
FIX: #13100
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
For Users:

View File

@ -151,6 +151,7 @@ La documentation utilisateur, développeur et traducteur est disponible sous for
## CONTRIBUER
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
## CREDITS

View File

@ -170,7 +170,8 @@ Administrator, user, developer and translator's documentations are available alo
## CONTRIBUTING
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
## CREDITS

View File

@ -45,9 +45,12 @@ Dolibarr working. It is here only to build Dolibarr packages, and those
generated packages will not contains this "build" directory.
We can find in "build", following sub-directories:
You can find in "build", following sub-directories:
* debian:
* composer
To test an upgrade of a lib.
* debian
To build Debian package.
* dmg:

View File

@ -1,20 +1,24 @@
README (English)
##################################################
OBS Package tools
OBE - openSUSE Build Service
##################################################
This directory contains files to explain how to publish
a package onto OBS
This directory contains an instruction to explain
how to publish a package onto OBS.
# Create a project onto OBS
#----------------------------------
https://build.opensuse.org
# Create a project onto OBS
---------------------------
https://build.opensuse.org
Packaging rules: http://en.opensuse.org/Portal:Packaging
# Packaging rules:
------------------
https://en.opensuse.org/Portal:Packaging
Add attributes:
OBS:Screenshots URL of screenshot http://www.dolibarr.org/images/dolibarr_screenshot1.png
OBS:Screenshots URL of screenshot https://www.dolibarr.org/images/dolibarr_screenshot1.png
OBS:QualityCategory Development|Testing|Stable|Private
OBS:Maintained 1
@ -28,22 +32,24 @@ To submit a snapshot for building, we should have a service file with content
</service>
</services>
How to have such a service file created automatically ?
Go into project you want to update. It mught be:
# How to have such a service file created automatically ?
---------------------------------------------------------
Go into project you want to update. It might be:
- openSUSE Build Service > Projects > Application:ERP:Dolibarr > dolibarr
- or your private project
Once logged, click on "Add file" in section "Source Files", then select mode "Upload From: Remote URL"
Keep empty for "Filename", choose "Remote URL" and enter into last field, URL that should looks like this:
http://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-0.4.src.rpm
https://www.dolibarr.org/files/stable/package_rpm_generic/dolibarr-x.y.v-0.4.src.rpm
Then add into Advanded - Attributes
OBS:Screenshots http://www.dolibarr.org/images/dolibarr_screenshot1.png
OBS:QualityCategory Stable|Testing|Development|Private
OBS:Screenshots https://www.dolibarr.org/images/dolibarr_screenshot1.png
OBS:QualityCategory Stable|Testing|Development|Private
# Move project into official directory
--------------------------------------
- Enter a bug to ask to be a maintener of a category or to add a new one.
For example: https://bugzilla.novell.com/show_bug.cgi?id=848083 to be a maintener of category
https://build.opensuse.org/project/show/Application:ERP

View File

@ -28,11 +28,12 @@
"ext-curl" : "*",
"ckeditor/ckeditor" : "4.12.1",
"mike42/escpos-php" : "2.2",
"mobiledetect/mobiledetectlib" : "2.8.33",
"mobiledetect/mobiledetectlib" : "2.8.34",
"phpoffice/phpexcel" : "1.8.1",
"restler/framework" : "3.0.0-RC6",
"tecnickcom/tcpdf" : "^6.2",
"luracast/restler" : "^3.0"
"tecnickcom/tcpdf" : "6.3.2",
"nnnick/chartjs" : "^2.9",
"stripe/stripe-php" : "6.43.1"
},
"require-dev" : {
"jakub-onderka/php-parallel-lint" : "^0",
@ -56,4 +57,4 @@
"ext-zip" : "ODT, Excel and file compression support",
"ext-xml" : "Excel support"
}
}
}

152
composer.lock generated
View File

@ -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": []

View File

@ -253,6 +253,24 @@ PARSEDOWN
$shortage = 4 - $len % 4;
OAUTH
-----
Add into Class Google of file OAuth2/Service/Google:
// LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token"
public $approvalPrompt='auto';
public function setApprouvalPrompt($prompt)
{
if (!in_array($prompt, array('auto', 'force'), true)) {
// @todo Maybe could we rename this exception
throw new InvalidAccessTypeException('Invalid approuvalPrompt, expected either auto or force.');
}
$this->approvalPrompt = $prompt;
}
JEDITABLE.JS
------------

View File

@ -66,8 +66,9 @@ $obj = new Facture($db);
$obj->ref = 'ABCDE';
$obj->socid = 4; // Put id of third party (rowid in llx_societe table)
$obj->date = mktime();
$obj->note = 'A comment';
$obj->date = dol_now();
$obj->note_public = 'A public comment';
$obj->note_private = 'A private comment';
$obj->cond_reglement_id = 1;
$line1=new FactureLigne($db);

View File

@ -66,8 +66,9 @@ $com = new Commande($db);
$com->ref = 'ABCDE';
$com->socid = 4; // Put id of third party (rowid in llx_societe table)
$com->date_commande = mktime();
$com->note = 'A comment';
$com->date = dol_now();
$com->note_public = 'A public comment';
$com->note_private = 'A private comment';
$com->source = 1;
$com->remise_percent = 0;

View File

@ -11,4 +11,4 @@ objectclass: dcObject
objectClass: organization
objectClass: top
dc: my-domain
o: Mon organisation
o: my organisation

View File

@ -12,4 +12,4 @@ objectclass: dcObject
objectClass: organization
objectClass: top
dc: my-domain
o: Mon organisation
o: my organisation

View File

@ -23,6 +23,10 @@
* \brief Script example to inject random customer invoices (for load tests)
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -24,6 +24,10 @@
* \brief Script example to inject random orders (for load tests)
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -24,6 +24,10 @@
* \brief Script example to inject random products (for load tests)
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -24,6 +24,10 @@
* \brief Script example to inject random proposals (for load tests)
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -24,6 +24,10 @@
* \brief Script example to inject random thirdparties (for load tests)
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path=dirname(__FILE__).'/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {

View File

@ -20,7 +20,7 @@
*/
/**
* \file dev/initdata/import-thirdparties.php
* \file dev/initdata/import-users.php
* \brief Script example to insert thirdparties from a csv file.
* To purge data, you can have a look at purge-data.php
*/

View File

@ -1,7 +1,7 @@
* Page with licence compatibility
* Page with license compatibility
https://www.gnu.org/licenses/quick-guide-gplv3.fr.html
* FAQ on GPL licence
* FAQ on GPL license
https://www.fsf.org/licensing/licenses/gpl-faq.html
* Questions/Answers on Fork for using Dolibarr as a SaaS

View File

@ -1,2 +1,2 @@
To test a SEPA file:
http://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa
To test a SEPA file:
https://www.mesfluxdepaiement.fr/testez-vos-fichiers-sepa

View File

@ -1,13 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT ruleset (description,exclude-pattern*,rule+)>
<!ELEMENT ruleset (description,arg*,exclude-pattern*,rule+)>
<!ATTLIST ruleset name CDATA "">
<!ELEMENT description (#PCDATA)>
<!ELEMENT arg (#PCDATA)>
<!ATTLIST arg name CDATA "">
<!ATTLIST arg value CDATA "">
<!ELEMENT exclude-pattern (#PCDATA)>
<!ATTLIST exclude-pattern type CDATA "">
<!ELEMENT rule (properties*,severity*)>
<!ELEMENT rule (properties*,severity*,exclude*)>
<!ATTLIST rule ref CDATA "">
<!ELEMENT properties (property+)>
<!ELEMENT property (#PCDATA)>
<!ATTLIST property name CDATA "">
<!ATTLIST property value CDATA "">
<!ELEMENT severity (#PCDATA)>
<!ELEMENT exclude (#PCDATA)>
<!ATTLIST exclude name CDATA "">

View File

@ -2,6 +2,7 @@
<!DOCTYPE ruleset SYSTEM "ruleset.dtd">
<ruleset name="Dolibarr">
<description>Dolibarr coding standard.</description>
<arg name="tab-width" value="4"/>
<exclude-pattern type="relative">build/html</exclude-pattern>
<exclude-pattern type="relative">build/aps</exclude-pattern>
@ -188,7 +189,6 @@
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>

View File

@ -0,0 +1,215 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles>
<profile name="PSR-12 [built-in]">
<setting id="indentationChar" value="&#9;"/>
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_method_invocation_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_assignment_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_binary_expression_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_compact_if_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_conditional_expression_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_force_split" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_indent_policy" value="2"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_expressions_in_array_initializer_line_wrap_policy" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_parameters_in_method_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superclass_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_indent_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_superinterfaces_in_type_declaration_line_wrap_policy" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_field" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_block" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_lambda_function_declaration" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_method_declaration" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_switch" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.brace_position_for_type_declaration" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_block_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_javadoc_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_line_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_before_root_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.insert_new_line_for_parameter" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.keep_empty_line_for_empty_description" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.line_length" value="1000"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.never_format_unknown_tags" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.continuation_indentation_for_array_initializer" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.php.formatter.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.format_line_comment_starting_on_first_column" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_heredocs" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.indentation.size" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_catch_in_try_statement" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_else_in_if_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_finally_in_try_statement" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_before_while_in_do_statement" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_method_body" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_new_line_in_empty_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_closing_paren_in_cast" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_echo" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_for_inits" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_global" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_constant_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_static" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_comma_in_superinterfaces" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_opening_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_reference_symbol_in_referenced_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_semicolon_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_after_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_array_creation" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_arrow_in_yield" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_assignment_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_binary_operator" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_cast" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_catch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_foreach" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_if" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_switch" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_closing_paren_in_while" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_case" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_colon_in_default" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_field_access" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_coloncolon_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_echo" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_for_inits" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_global" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_constant_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_static" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_comma_in_superinterfaces" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_block" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_array_creation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_catch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_for" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_foreach" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_if" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_list" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_switch" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_opening_paren_in_while" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_postfix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_prefix_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_question_in_conditional" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_semicolon_in_for" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_before_unary_operator" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_brackets_in_array_type_reference" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_elseif_statement_on_same_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_imple_if_on_one_line" value="true"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.keep_trailing_comma_in_list" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.lineSplit" value="200"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_namespace" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_after_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_class_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_namespace" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_before_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_namespaces" value="1"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_blank_lines_between_use_statements" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.number_of_empty_lines_to_preserve" value="3"/>
<setting id="org.eclipse.php.formatter.core.formatter.put_empty_statement_on_new_line" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.php.formatter.core.formatter.use_on_off_tags" value="false"/>
</profile>
</profiles>

View File

@ -0,0 +1,578 @@
#!/usr/bin/env php
<?php
/*
* Copyright (C) 2005-2011 James Grant <james@lightbox.org> Lightbox Technologies Inc.
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This file is base on pg2mysql provided as Open source by lightbox.org.
* It was enhanced and updated by the Dolibarr team.
*/
/**
* \file dev/tools/dolibarr-postgres2mysql.php
* \brief Script to migrate a postgresql dump into a mysql dump
*/
$sapi_type = php_sapi_name();
$script_file = basename(__FILE__);
$path = dirname(__FILE__) . '/';
// Test si mode batch
$sapi_type = php_sapi_name();
if (substr($sapi_type, 0, 3) == 'cgi') {
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
exit();
}
error_reporting(E_ALL & ~ E_DEPRECATED);
define('PRODUCT', "pg2mysql");
define('VERSION', "2.0");
// this is the default, it can be overridden here, or specified as the third parameter on the command line
$config['engine'] = "InnoDB";
if (! ($argv[1] && $argv[2])) {
echo "Usage: php pg2mysql_cli.php <inputfilename> <outputfilename> [engine]\n";
exit();
} else {
if (isset($argv[3]))
$config['engine'] = $argv[3];
pg2mysql_large($argv[1], $argv[2]);
echo <<<XHTML
Notes:
- No its not perfect
- Yes it discards ALL stored procedures
- Yes it discards ALL queries except for CREATE TABLE and INSERT INTO
- If you're having problems creating your postgres dump, make sure you use "--format p --inserts"
- Default output engine if not specified is InnoDB
XHTML;
}
/**
* getfieldname
*
* @param string $l String
* @return string|null Field name
*/
function getfieldname($l)
{
// first check if its in nice quotes for us
$regs = array();
if (preg_match("/`(.*)`/", $l, $regs)) {
if ($regs[1])
return $regs[1];
else
return null;
} // if its not in quotes, then it should (we hope!) be the first "word" on the line, up to the first space.
elseif (preg_match("/([^\ ]*)/", trim($l), $regs)) {
if ($regs[1])
return $regs[1];
else
return null;
}
}
/**
* formatsize
*
* @param string $s Size to format
* @return string Formated size
*/
function formatsize($s)
{
if ($s < pow(2, 14))
return "{$s}B";
elseif ($s < pow(2, 20))
return sprintf("%.1f", round($s / 1024, 1)) . "K";
elseif ($s < pow(2, 30))
return sprintf("%.1f", round($s / 1024 / 1024, 1)) . "M";
else
return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G";
}
/**
* pg2mysql_large
*
* @param string $infilename Input filename
* @param string $outfilename Output filename
* @return int <0 if KO, >=0 if OK
*/
function pg2mysql_large($infilename, $outfilename)
{
$infp = fopen($infilename, "rt");
$outfp = fopen($outfilename, "wt");
$outputatend = '';
$arrayofprimaryalreadyintabledef = array();
// we read until we get a semicolon followed by a newline (;\n);
$pgsqlchunk = array();
$chunkcount = 1;
$linenum = 0;
$inquotes = false;
$first = true;
if (empty($infp)) {
print 'Failed to open file '.$infilename."\n";
return -1;
}
$fs = filesize($infilename);
echo "Filesize: " . formatsize($fs) . "\n";
while ($instr = fgets($infp)) {
$linenum ++;
$memusage = round(memory_get_usage(true) / 1024 / 1024);
$len = strlen($instr);
$pgsqlchunk[] = $instr;
$c = substr_count($instr, "'");
// we have an odd number of ' marks
if ($c % 2 != 0) {
if ($inquotes)
$inquotes = false;
else
$inquotes = true;
}
if ($linenum % 10000 == 0) {
$currentpos = ftell($infp);
$percent = round($currentpos / $fs * 100);
$position = formatsize($currentpos);
printf("Reading progress: %3d%% position: %7s line: %9d sql chunk: %9d mem usage: %4dM\r", $percent, $position, $linenum, $chunkcount, $memusage);
}
if (strlen($instr) > 3 && ($instr[$len - 3] == ")" && $instr[$len - 2] == ";" && $instr[$len - 1] == "\n") && $inquotes == false) {
$chunkcount ++;
if ($linenum % 10000 == 0) {
$currentpos = ftell($infp);
$percent = round($currentpos / $fs * 100);
$position = formatsize($currentpos);
printf("Processing progress: %3d%% position: %7s line: %9d sql chunk: %9d mem usage: %4dM\r", $percent, $position, $linenum, $chunkcount, $memusage);
}
/*
* echo "sending chunk:\n";
* echo "=======================\n";
* print_r($pgsqlchunk);
* echo "=======================\n";
*/
/*
* foreach ($pgsqlchunk as $aaa) {
* if (preg_match('/MAIN_ENABLE_DEFAULT|MAIN_MAIL_SMTP_SE/', $aaa)) {
* var_dump($pgsqlchunk);
* }
* }
*/
$mysqlchunk = pg2mysql($pgsqlchunk, $arrayofprimaryalreadyintabledef, $first);
fputs($outfp, $mysqlchunk['output']);
/*
* $break = false;
* foreach ($pgsqlchunk as $aaa) {
* if (preg_match('/MAIN_ENABLE_DEFAULT|MAIN_MAIL_SMTP_SE/', $aaa)) {
* var_dump($mysqlchunk);
* }
* if (preg_match('/MAIN_MAIL_SMTP_SE/', $aaa)) {
* $break = true;
* }
* }
* if ($break) break;
*/
$outputatend .= $mysqlchunk['outputatend'];
$first = false;
$pgsqlchunk = array();
$mysqlchunk = "";
}
}
echo "\n\n";
fputs($outfp, $outputatend);
fputs($outfp, "\n");
fputs($outfp, '/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;' . "\n");
fputs($outfp, '/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;' . "\n");
fputs($outfp, '/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;' . "\n");
fputs($outfp, '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . "\n");
fputs($outfp, '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . "\n");
fputs($outfp, '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . "\n");
fputs($outfp, '/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;' . "\n");
printf("Completed! %9d lines %9d sql chunks\n\n", $linenum, $chunkcount);
fclose($infp);
fclose($outfp);
return 0;
}
/**
* pg2mysql
*
* @param array $input Array of input
* @param array $arrayofprimaryalreadyintabledef Array of table already output with a primary key set into definition
* @param boolean $header Boolean
* @return string[] Array of output
*/
function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
{
global $config;
if (is_array($input)) {
$lines = $input;
} else {
$lines = split("\n", $input);
}
if ($header) {
$output = "-- Converted with " . PRODUCT . "-" . VERSION . "\n";
$output .= "-- Converted on " . date("r") . "\n";
$output .= "\n";
$output .= "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n";
$output .= "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n";
$output .= "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n";
$output .= "/*!40101 SET NAMES utf8 */;\n";
$output .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n";
$output .= "/*!40103 SET TIME_ZONE='+00:00' */;\n";
$output .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n";
$output .= "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n";
$output .= "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n";
$output .= "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n";
$output .= "\n";
$outputatend = "";
} else {
$output = "";
$outputatend = "";
}
$in_create_table = $in_insert = false;
$linenumber = 0;
$tbl_extra = "";
while (isset($lines[$linenumber])) {
$line = $lines[$linenumber];
// $line =str_replace('ALTER TABLE public\.', '', $line);
$reg = array();
if (preg_match('/CREATE SEQUENCE (?:public\.)(.*)_(id|rowid|id_comment)_seq/', $line, $reg)) {
$outputatend .= '-- Make field ' . $reg[2] . ' auto_increment for table ' . $reg[1] . "\n";
$outputatend .= 'ALTER TABLE ' . $reg[1] . ' CHANGE COLUMN ' . $reg[2] . ' ' . $reg[2] . ' INTEGER NOT NULL AUTO_INCREMENT;' . "\n\n";
// var_dump($outputatend);
}
if (substr($line, 0, 12) == "CREATE TABLE") {
$in_create_table = true;
$line = str_replace("\"", "`", $line);
$line = str_replace('public.', '', $line);
$reg2 = array();
if (preg_match('/CREATE TABLE ([^\s]+)/', $line, $reg2)) {
$in_create_table = $reg2[1];
}
$reg2 = array();
if (preg_match('/CREATE TABLE ([^\s]+)/', $line, $reg2)) {
$output .= 'DROP TABLE IF EXISTS `' . $reg2[1] . '`;' . "\n";
}
$output .= $line;
$linenumber ++;
continue;
}
if (substr($line, 0, 2) == ");" && $in_create_table) {
$in_create_table = false;
$line = ") ENGINE={$config['engine']};\n\n";
$output .= $tbl_extra;
$output .= $line;
$linenumber ++;
$tbl_extra = "";
continue;
}
if ($in_create_table) {
$regs = array();
$line = str_replace("\"", "`", $line);
$line = str_replace(" integer", " int(11)", $line);
$line = str_replace(" int_unsigned", " int(11) UNSIGNED", $line);
$line = str_replace(" smallint_unsigned", " smallint UNSIGNED", $line);
$line = str_replace(" bigint_unsigned", " bigint UNSIGNED", $line);
$line = str_replace(" serial ", " int(11) auto_increment ", $line);
$line = str_replace(" bytea", " BLOB", $line);
$line = str_replace(" boolean", " bool", $line);
$line = str_replace(" bool DEFAULT true", " bool DEFAULT 1", $line);
$line = str_replace(" bool DEFAULT false", " bool DEFAULT 0", $line);
if (preg_match("/ character varying\(([0-9]*)\)/", $line, $regs)) {
$num = $regs[1];
if ($num <= 255)
$line = preg_replace("/ character varying\([0-9]*\)/", " varchar($num)", $line);
else
$line = preg_replace("/ character varying\([0-9]*\)/", " text", $line);
}
// character varying with no size, we will default to varchar(255)
if (preg_match("/ character varying/", $line)) {
$line = preg_replace("/ character varying/", " varchar(255)", $line);
}
if (preg_match("/ DEFAULT \('([0-9]*)'::int/", $line, $regs) || preg_match("/ DEFAULT \('([0-9]*)'::smallint/", $line, $regs) || preg_match("/ DEFAULT \('([0-9]*)'::bigint/", $line, $regs)) {
$num = $regs[1];
$line = preg_replace("/ DEFAULT \('([0-9]*)'[^ ,]*/", " DEFAULT $num ", $line);
}
if (preg_match("/ DEFAULT \(([0-9\-]*)\)/", $line, $regs)) {
$num = $regs[1];
$line = preg_replace("/ DEFAULT \(([0-9\-]*)\)/", " DEFAULT $num ", $line);
}
$line = preg_replace("/ DEFAULT nextval\(.*\) /", " auto_increment ", $line);
$line = preg_replace("/::.*,/", ",", $line);
$line = preg_replace("/::.*$/", "\n", $line);
if (preg_match("/character\(([0-9]*)\)/", $line, $regs)) {
$num = $regs[1];
if ($num <= 255)
$line = preg_replace("/ character\([0-9]*\)/", " varchar($num)", $line);
else
$line = preg_replace("/ character\([0-9]*\)/", " text", $line);
}
// timestamps
$line = str_replace(" timestamp with time zone", " datetime", $line);
$line = str_replace(" timestamp without time zone", " datetime", $line);
// time
$line = str_replace(" time with time zone", " time", $line);
$line = str_replace(" time without time zone", " time", $line);
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
if (strstr($line, "auto_increment") || preg_match('/ rowid int/', $line) || preg_match('/ id int/', $line)) {
$field = getfieldname($line);
$tbl_extra .= ", PRIMARY KEY(`$field`)\n";
$arrayofprimaryalreadyintabledef[$in_create_table] = $in_create_table;
}
$specialfields = array("repeat","status","type","call");
$field = getfieldname($line);
if (in_array($field, $specialfields)) {
$line = str_replace("$field ", "`$field` ", $line);
}
// text/blob fields are not allowed to have a default, so if we find a text DEFAULT, change it to varchar(255) DEFAULT
if (strstr($line, "text DEFAULT")) {
$line = str_replace(" text DEFAULT ", " varchar(255) DEFAULT ", $line);
}
// just skip a CONSTRAINT line
if (strstr($line, " CONSTRAINT ")) {
$line = "";
// and if the previous output ended with a , remove the ,
$lastchr = substr($output, - 2, 1);
// echo "lastchr=$lastchr";
if ($lastchr == ",") {
$output = substr($output, 0, - 2) . "\n";
}
}
$output .= $line;
}
if (substr($line, 0, 11) == "INSERT INTO") {
$line = str_replace('public.', '', $line);
if (substr($line, - 3, - 1) == ");") {
// we have a complete insert on one line
list ($before, $after) = explode(" VALUES ", $line, 2);
// we only replace the " with ` in what comes BEFORE the VALUES
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
$before = str_replace("\"", "`", $before);
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we cant search for the previoous '
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
$after = str_replace(" (E'", " ('", $after);
$after = str_replace(", E'", ", '", $after);
$output .= $before . " VALUES " . $after;
$linenumber ++;
continue;
} else {
// this insert spans multiple lines, so keep dumping the lines until we reach a line
// that ends with ");"
list ($before, $after) = explode(" VALUES ", $line, 2);
// we only replace the " with ` in what comes BEFORE the VALUES
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
$before = str_replace("\"", "`", $before);
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
$after = str_replace(" (E'", " ('", $after);
$after = str_replace(", E'", ", '", $after);
$c = substr_count($line, "'");
// we have an odd number of ' marks
if ($c % 2 != 0) {
$inquotes = true;
} else {
$inquotes = false;
}
$output .= $before . " VALUES " . $after;
do {
$linenumber ++;
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
// after the first line, we only need to check for it in the middle, not at the beginning of an insert (becuase the beginning will be on the first line)
// $after=str_replace(" (E'","' ('",$after);
$line = $lines[$linenumber];
$line = str_replace("', E'", "', '", $line);
$output .= $line;
// printf("inquotes: %d linenumber: %4d line: %s\n",$inquotes,$linenumber,$lines[$linenumber]);
$c = substr_count($line, "'");
// we have an odd number of ' marks
if ($c % 2 != 0) {
if ($inquotes)
$inquotes = false;
else
$inquotes = true;
// echo "inquotes=$inquotes\n";
}
} while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes);
}
}
if (substr($line, 0, 16) == "ALTER TABLE ONLY") {
$line = preg_replace('/ ONLY/', '', $line);
$line = str_replace("\"", "`", $line);
$line = str_replace("public.", "", $line);
$pkey = $line;
$linenumber ++;
if (! empty($lines[$linenumber])) {
$line = $lines[$linenumber];
} else {
$line = '';
}
if (strstr($line, " PRIMARY KEY ") && substr($line, - 3, - 1) == ");") {
$reg2 = array();
if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) {
if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) {
// looks like we have a single line PRIMARY KEY definition, lets go ahead and add it
$output .= str_replace("\n", "", $pkey);
// the postgres and mysql syntax for this is (at least, in the example im looking at)
// identical, so we can just add it as is.
$output .= $line . "\n";
} else {
$output .= '-- ' . str_replace("\n", "", $pkey);
$output .= '-- ' . $line . "\n";
}
} else {
$output .= '-- ' . str_replace("\n", "", $pkey);
$output .= '-- ' . $line . "\n";
}
}
}
// while we're here, we might as well catch CREATE INDEX as well
if (substr($line, 0, 12) == "CREATE INDEX") {
$matches = array();
preg_match('/CREATE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
if (! empty($matches[3])) {
$indexname = $matches[1];
$tablename = str_replace('public.', '', $matches[2]);
$columns = $matches[3];
if ($tablename && $columns) {
$output .= "ALTER TABLE `" . $tablename . "` ADD INDEX " . $indexname . "( {$columns} ) ;\n";
}
}
}
if (substr($line, 0, 19) == "CREATE UNIQUE INDEX") {
$matches = array();
preg_match('/CREATE UNIQUE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
if (! empty($matches[3])) {
$indexname = $matches[1];
$tablename = str_replace('public.', '', $matches[2]);
$columns = str_replace('"', '', $matches[3]);
if ($tablename && $columns) {
$output .= "ALTER TABLE `" . $tablename . "` ADD UNIQUE INDEX " . $indexname . " ( {$columns} ) ;\n";
}
}
}
if (substr($line, 0, 13) == 'DROP DATABASE')
$output .= $line;
if (substr($line, 0, 15) == 'CREATE DATABASE') {
$matches = array();
preg_match('/CREATE DATABASE ([a-zA-Z0-9_]*) .* ENCODING = \'(.*)\'/', $line, $matches);
$output .= "CREATE DATABASE `$matches[1]` DEFAULT CHARACTER SET $matches[2];\n\n";
}
if (substr($line, 0, 8) == '\\connect') {
$matches = array();
preg_match('/connect ([a-zA-Z0-9_]*)/', $line, $matches);
$output .= "USE `$matches[1]`;\n\n";
}
if (substr($line, 0, 5) == 'COPY ') {
$matches = array();
preg_match('/COPY (.*) FROM stdin/', $line, $matches);
$heads = str_replace('"', "`", $matches[1]);
$values = array();
$in_insert = true;
} elseif ($in_insert) {
if ($line == "\\.\n") {
$in_insert = false;
if ($values) {
$output .= "INSERT INTO $heads VALUES\n" . implode(",\n", $values) . ";\n\n";
}
} else {
$vals = explode(' ', $line);
foreach ($vals as $i => $val) {
$vals[$i] = ($val == '\\N') ? 'NULL' : "'" . str_replace("'", "\\'", trim($val)) . "'";
}
$values[] = '(' . implode(',', $vals) . ')';
if (count($values) >= 1000) {
$output .= "INSERT INTO $heads VALUES\n" . implode(",\n", $values) . ";\n";
$values = array();
}
}
}
$linenumber ++;
}
return array('output' => $output,'outputatend' => $outputatend);
}

View File

@ -3,11 +3,12 @@ README (English)
This directory contains tools to generate translation files for a new
languages or to update translation files for existing languages.
See Dolibarr Wiki page:
http://wiki.dolibarr.org/index.php/Translator_documentation
https://wiki.dolibarr.org/index.php/Translator_documentation
For more information on how to use them.
for Linux OS:
To install transifex client:
sudo pip install --upgrade transifex-client
To update transifex client:
sudo pip install --upgrade transifex-client
sudo pip install --upgrade transifex-client

View File

@ -1,17 +1,25 @@
comparison of terms
Term Dolibarr SAP Odoo ...
----------------------------------------------------------------------------
Thirdparty Contact partner Partner/Contact (company)
Contact/address Contact person Partner/Contact (individual)
Dolibarr SAP ERP Odoo
-------------------------------------------------------------------------
Thirdparty Contact partner Partner/Contact (company)
Contact/address Contact person Partner/Contact (individual)
Financial ?? Invoicing
Income / Expense ?? Profit / Loss
Balance ?? Net profit
Subledger account Subledger account ??
Financial Finance (FI) Accounting
Accounting
Proposal ?? Quotation Proposal is ok but proposition looks better (proposal is for a detailed proposition). We can say also "business proposition or business proposal".
Indian are using "Quotation".
Income / Expense ?? Profit / Loss
Balance ?? Net profit
Subledger account Subledger account ??
CRM Sales & Distribution Sales
Proposal ?? Quotation
Proposal is ok but proposition looks better (proposal is for a detailed proposition).
We can say also "business proposition or business proposal".
In India they are using "Quotation".

View File

@ -54,5 +54,5 @@ fi
echo Think to launch also:
echo "> dev/tools/fixaltlanguages.sh fix all"
echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with ''"
echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with '' on *.lang files"

View File

@ -10,7 +10,11 @@
https://github.com/Dolibarr/foundation
* Few icons are from http://led24.de/iconset/. This is original README file for this source:
* Few icons are / were from website led24.de
* Attention: This website is no longer available!
This is original README file for this source:
-------------------------------------------------------
You can do whatever you want with these icons (use on web or in desktop applications) as long as you dont pass them off as your own and remove this readme file. A credit statement and a link back to
http://led24.de/iconset/ or http://led24.de/ would be appreciated.

12
doc/user/README-DE.md Normal file
View File

@ -0,0 +1,12 @@
README (german)
LiesMich (deutsch)
--------------------------------
Benutzeranleitung
--------------------------------
Alle Dolibarr-Informationen sind online verfuegbar ueber die Webseiten:
https://www.dolibarr.de
oder
https://www.dolibarr.org
https://wiki.dolibarr.org

View File

@ -45,7 +45,8 @@ $search_label = GETPOST('search_label', 'alpha');
$search_labelshort = GETPOST('search_labelshort', 'alpha');
$search_accountparent = GETPOST('search_accountparent', 'alpha');
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
$chartofaccounts = GETPOST('chartofaccounts', 'int');
// Security check
if ($user->socid > 0) accessforbidden();
@ -55,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;
@ -69,10 +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.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
'aa.reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1),
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
);
if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['aa.reconcilable']);
$accounting = new AccountingAccount($db);
@ -101,14 +104,11 @@ if (empty($reshook))
$search_labelshort = "";
$search_accountparent = "";
$search_pcgtype = "";
$search_pcgsubtype = "";
$search_array_options = array();
}
if (GETPOST('change_chart', 'alpha') && (GETPOST('valid_change_chart', 'int') || empty($conf->use_javascript_ajax)))
if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on
|| (GETPOST('chartofaccounts', 'int') > 0 && GETPOST('chartofaccounts', 'int') != $conf->global->CHARTOFACCOUNTS)) // a submit of form is done and chartofaccounts combo has been modified
{
$chartofaccounts = GETPOST('chartofaccounts', 'int');
if ($chartofaccounts > 0)
{
// Get language code for this $chartofaccounts
@ -160,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';
@ -169,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) {
@ -195,7 +197,7 @@ if ($action == 'delete') {
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, 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.reconcilable, 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;
@ -241,7 +243,6 @@ if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_la
if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort);
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
@ -274,23 +275,17 @@ if ($resql)
if ($search_labelshort) $param .= '&search_labelshort='.urlencode($search_labelshort);
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
if (!empty($conf->use_javascript_ajax))
{
print '<!-- Add javascript to update a flag when we select "Change plan" -->
print '<!-- Add javascript to reload page when we click "Change plan" -->
<script type="text/javascript">
$(document).ready(function () {
$("#searchFormList").on("submit", function (e) {
console.log("chartofaccounts focus = "+$("#chartofaccounts").is(":focus"));
console.log("change_chart focus = "+$("#change_chart").is(":focus"));
if ($("#change_chart").is(":focus"))
{
console.log("We set valid_change_chart to 1");
$("#valid_change_chart").val(1);
}
return true;
$("#change_chart").on("click", function (e) {
console.log("chartofaccounts seleted = "+$("#chartofaccounts").val());
// reload page
window.location.href = "'.$_SERVER["PHP_SELF"].'?valid_change_chart=1&chartofaccounts="+$("#chartofaccounts").val();
});
});
</script>';
@ -337,8 +332,7 @@ if ($resql)
else dol_print_error($db);
print "</select>";
print ajax_combobox("chartofaccounts");
print '<input type="submit" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<input type="hidden" name="valid_change_chart" id="valid_change_chart" value="0">';
print '<input type="'.(empty($conf->use_javascript_ajax)?'submit':'button').'" class="button" name="change_chart" id="change_chart" value="'.dol_escape_htmltag($langs->trans("ChangeAndLoad")).'">';
print '<br>';
print '<br>';
@ -363,7 +357,7 @@ if ($resql)
print '</td>';
}
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print '<td class="liste_titre">&nbsp;</td>'; }
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
@ -377,7 +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 (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (! empty($arrayfields['aa.reconcilable']['checked'])) print_liste_field_titre($arrayfields['aa.reconcilable']['label'], $_SERVER["PHP_SELF"], 'aa.reconcilable', '', $param, '', $sortfield, $sortorder); }
if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n";
@ -454,25 +448,36 @@ if ($resql)
if (!$i) $totalarray['nbfield']++;
}
// Chart of accounts subtype
if (!empty($arrayfields['aa.pcg_subtype']['checked']))
{
print "<td>";
print $obj->pcg_subtype;
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
// Activated or not reconciliation on accounting account
if (!empty($arrayfields['aa.reconcilable']['checked'])) {
print '<td class="center">';
if (empty($obj->reconcilable)) {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=enable&mode=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $obj->rowid . '&action=disable&mode=1">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
}
print '</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
}
// Activated or not
if (!empty($arrayfields['aa.active']['checked']))
{
print '<td>';
print '<td class="center">';
if (empty($obj->active)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=enable&mode=0">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable">';
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$obj->rowid.'&action=disable&mode=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a>';
}

View File

@ -39,31 +39,31 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm"));
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "compta", "accountancy", "hrm"));
$action=GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view';
$confirm=GETPOST('confirm', 'alpha');
$id=31;
$rowid=GETPOST('rowid', 'alpha');
$code=GETPOST('code', 'alpha');
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$confirm = GETPOST('confirm', 'alpha');
$id = 31;
$rowid = GETPOST('rowid', 'alpha');
$code = GETPOST('code', 'alpha');
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
$listoffset=GETPOST('listoffset', 'alpha');
$listlimit=GETPOST('listlimit', 'int')>0?GETPOST('listlimit', 'int'):1000;
$listoffset = GETPOST('listoffset', 'alpha');
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
$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 ;
$offset = $listlimit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
@ -72,7 +72,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
// Security check
if ($user->socid > 0) accessforbidden();
if (! $user->rights->accounting->chartofaccount) accessforbidden();
if (!$user->rights->accounting->chartofaccount) accessforbidden();
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
@ -82,56 +82,56 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Name of SQL tables of dictionaries
$tabname=array();
$tabname = array();
$tabname[31]= MAIN_DB_PREFIX."accounting_system";
$tabname[31] = MAIN_DB_PREFIX."accounting_system";
// Dictionary labels
$tablib=array();
$tablib[31]= "Pcg_version";
$tablib = array();
$tablib[31] = "Pcg_version";
// Requests to extract data
$tabsql=array();
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
$tabsql = array();
$tabsql[31] = "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[31]="pcg_version ASC";
$tabsqlsort = array();
$tabsqlsort[31] = "pcg_version ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[31]= "pcg_version,label,country_id,country";
$tabfield = array();
$tabfield[31] = "pcg_version,label,country_id,country";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[31]= "pcg_version,label,country";
$tabfieldvalue = array();
$tabfieldvalue[31] = "pcg_version,label,country";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[31]= "pcg_version,label,fk_country";
$tabfieldinsert = array();
$tabfieldinsert[31] = "pcg_version,label,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
// "nameoffield" if id field is not "rowid" or has not autoincrement on
$tabrowid=array();
$tabrowid[31]= "";
$tabrowid = array();
$tabrowid[31] = "";
// Condition to show dictionary in setup page
$tabcond=array();
$tabcond[31]= ! empty($conf->accounting->enabled);
$tabcond = array();
$tabcond[31] = !empty($conf->accounting->enabled);
// List of help for fields
$tabhelp=array();
$tabhelp = array();
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
$tabfieldcheck = array();
$tabfieldcheck[31] = array();
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList=array();
$sourceList = array();
@ -147,38 +147,38 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x',
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
{
$listfield=explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert=explode(',', $tabfieldinsert[$id]);
$listfieldmodify=explode(',', $tabfieldinsert[$id]);
$listfieldvalue=explode(',', $tabfieldvalue[$id]);
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
// Check that all fields are filled
$ok=1;
$ok = 1;
foreach ($listfield as $f => $value)
{
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
if ((! isset($_POST[$value]) || $_POST[$value]==''))
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
if ((!GETPOSTISSET($value)) || GETPOST($value) == '')
{
$ok=0;
$fieldnamekey=$listfield[$f];
$ok = 0;
$fieldnamekey = $listfield[$f];
// We take translate key of field
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'pcg_version') $fieldnamekey = 'Pcg_version';
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Label';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Other checks
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system','systemauto'))) {
$ok=0;
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array($_POST["type"], array('system', 'systemauto'))) {
$ok = 0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["pcg_version"]))
if (GETPOSTISSET("pcg_version"))
{
if ($_POST["pcg_version"]=='0')
if (GETPOST("pcg_version") == '0')
{
$ok=0;
$ok = 0;
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
}
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
@ -187,9 +187,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/
}
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2))
{
$ok=0;
$ok = 0;
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
}
@ -199,13 +199,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
if ($tabrowid[$id])
{
// Recupere id libre pour insertion
$newid=0;
$newid = 0;
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
$result = $db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
$newid=($obj->newid + 1);
$newid = ($obj->newid + 1);
} else {
dol_print_error($db);
}
@ -214,16 +214,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert))
$sql.= $tabrowid[$id].",";
$sql.= $tabfieldinsert[$id];
$sql.=",active)";
$sql.= " VALUES(";
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
$sql .= $tabrowid[$id].",";
$sql .= $tabfieldinsert[$id];
$sql .= ",active)";
$sql .= " VALUES(";
// List of values
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert))
$sql.= $newid.",";
$i=0;
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
$sql .= $newid.",";
$i = 0;
foreach ($listfieldinsert as $f => $value)
{
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
@ -232,19 +232,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
elseif ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
if ($i) $sql .= ",";
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
$sql.=",1)";
$sql .= ",1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
}
else
{
@ -260,16 +260,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
// Si verif ok et action modify, on modifie la ligne
if ($ok && GETPOST('actionmodify', 'alpha'))
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol = "rowid"; }
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldmodify))
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
{
$sql.= $tabrowid[$id]."=";
$sql.= "'".$db->escape($rowid)."', ";
$sql .= $tabrowid[$id]."=";
$sql .= "'".$db->escape($rowid)."', ";
}
$i = 0;
foreach ($listfieldmodify as $field)
@ -280,18 +280,18 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
elseif ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
if ($i) $sql .= ",";
$sql .= $field."=";
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
if (! $resql)
if (!$resql)
{
setEventMessages($db->error(), null, 'errors');
}
@ -306,14 +306,14 @@ if (GETPOST('actioncancel', 'alpha'))
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol = "rowid"; }
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
if (! $result)
if (!$result)
{
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{
@ -329,8 +329,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
// activate
if ($action == $acts[0])
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol = "rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
@ -349,8 +349,8 @@ if ($action == $acts[0])
// disable
if ($action == $acts[1])
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol = "rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
@ -369,8 +369,8 @@ if ($action == $acts[1])
// favorite
if ($action == 'activate_favorite')
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol = "rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
@ -389,8 +389,8 @@ if ($action == 'activate_favorite')
// disable favorite
if ($action == 'disable_favorite')
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
else { $rowidcol = "rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
@ -412,12 +412,12 @@ if ($action == 'disable_favorite')
*/
$form = new Form($db);
$formadmin=new FormAdmin($db);
$formadmin = new FormAdmin($db);
llxHeader();
$titre=$langs->trans($tablib[$id]);
$linkback='';
$titre = $langs->trans($tablib[$id]);
$linkback = '';
print load_fiche_titre($titre, $linkback, 'title_accountancy');
@ -425,7 +425,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy');
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.urlencode($page).'&':'').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode($page).'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
//var_dump($elementList);
@ -435,22 +435,22 @@ if ($action == 'delete')
if ($id)
{
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
$sql = $tabsql[$id];
if ($search_country_id > 0)
{
if (preg_match('/ WHERE /', $sql)) $sql.= " AND ";
else $sql.=" WHERE ";
$sql.= " c.rowid = ".$search_country_id;
if (preg_match('/ WHERE /', $sql)) $sql .= " AND ";
else $sql .= " WHERE ";
$sql .= " c.rowid = ".$search_country_id;
}
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.=$db->order($sortfield, $sortorder);
$sql.=$db->plimit($listlimit+1, $offset);
if ($sortfield == 'country') $sortfield = 'country_code';
$sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset);
//print $sql;
$fieldlist=explode(',', $tabfield[$id]);
$fieldlist = explode(',', $tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
@ -461,10 +461,10 @@ if ($id)
// Form to add a new line
if ($tabname[$id])
{
$alabelisused=0;
$var=false;
$alabelisused = 0;
$var = false;
$fieldlist=explode(',', $tabfield[$id]);
$fieldlist = explode(',', $tabfield[$id]);
// Line for title
print '<tr class="liste_titre">';
@ -472,33 +472,33 @@ if ($id)
{
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
$class="left";
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow = $langs->trans($valuetoshow); // try to translate
$class = "left";
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label')
{
$valuetoshow=$langs->trans("Label");
$valuetoshow = $langs->trans("Label");
}
if ($fieldlist[$field]=='country') {
if ($fieldlist[$field] == 'country') {
if (in_array('region_id', $fieldlist)) { print '<td>&nbsp;</td>'; continue; } // For region page, we do not show the country input
$valuetoshow=$langs->trans("Country");
$valuetoshow = $langs->trans("Country");
}
if ($fieldlist[$field]=='country_id') { $valuetoshow=''; }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($fieldlist[$field] == 'country_id') { $valuetoshow = ''; }
if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') { $valuetoshow = $langs->trans("Pcg_version"); }
if ($valuetoshow != '') {
print '<td class="'.$class.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (! empty($tabhelp[$id][$value])) {
} elseif (!empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
} else {
print $valuetoshow;
}
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
}
print '<td>';
@ -518,14 +518,14 @@ if ($id)
foreach ($fieldlist as $key=>$val)
{
if (GETPOST($val))
$obj->$val=GETPOST($val);
$obj->$val = GETPOST($val);
}
}
$tmpaction = 'create';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook))
{
@ -537,32 +537,32 @@ if ($id)
print '</td>';
print "</tr>";
$colspan=count($fieldlist)+3;
$colspan = count($fieldlist) + 3;
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available values in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql=$db->query($sql);
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
if ($search_country_id > 0) $param .= '&search_country_id='.$search_country_id;
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield;
// There is several pages
if ($num > $listlimit)
{
print '<tr class="none"><td class="right" colspan="'.(3+count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>';
}
@ -570,9 +570,9 @@ if ($id)
print '<tr class="liste_titre liste_titre_add">';
foreach ($fieldlist as $field => $value)
{
$showfield=1; // By defaut
$showfield = 1; // By defaut
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; }
if ($showfield)
{
@ -590,17 +590,17 @@ if ($id)
}
print '<td class="liste_titre"></td>';
print '<td class="liste_titre right" colspan="2">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
$searchpicto = $form->showFilterAndCheckAddButtons(0);
print $searchpicto;
print '</td>';
print '</tr>';
// Title of lines
print '<tr class="liste_titre">';
print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
@ -613,81 +613,81 @@ if ($id)
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
{
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
$tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
$tmpaction = 'edit';
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook)) fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit');
print '<td colspan="3" class="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
}
else
{
$tmpaction = 'view';
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
$error = $hookmanager->error; $errors = $hookmanager->errors;
if (empty($reshook))
{
foreach ($fieldlist as $field => $value)
{
$showfield=1;
$class="left";
$valuetoshow=$obj->{$fieldlist[$field]};
$showfield = 1;
$class = "left";
$valuetoshow = $obj->{$fieldlist[$field]};
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
}
elseif ($value == 'source')
{
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
}
elseif ($valuetoshow=='all') {
$valuetoshow=$langs->trans('All');
elseif ($valuetoshow == 'all') {
$valuetoshow = $langs->trans('All');
}
elseif ($fieldlist[$field]=='country') {
elseif ($fieldlist[$field] == 'country') {
if (empty($obj->country_code))
{
$valuetoshow='-';
$valuetoshow = '-';
}
else
{
$key=$langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
$key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
}
}
elseif ($fieldlist[$field]=='country_id') {
$showfield=0;
elseif ($fieldlist[$field] == 'country_id') {
$showfield = 0;
}
$class='tddict';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
$class = 'tddict';
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
}
}
// Can an entry be erased or disabled ?
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
if ($param) $url .= '&'.$param;
$url.='&';
$url .= '&';
// Active
print '<td class="center nowrap">';
@ -737,10 +737,10 @@ $db->close();
*/
function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '')
{
global $conf,$langs,$db;
global $conf, $langs, $db;
global $form;
global $region_id;
global $elementList,$sourceList;
global $elementList, $sourceList;
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
@ -758,15 +758,15 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
continue;
} // For state page, we do not show the country input (we link to region, not country)
print '<td>';
$fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
$fieldname = 'country';
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>';
}
elseif ($fieldlist[$field] == 'country_id')
{
if (! in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
{
$country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
$country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
print '</td>';
@ -776,24 +776,24 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
else print '<td>';
if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
} else {
print $form->selectyesno($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
}
print '</td>';
}
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
}
else
{
print '<td>';
$size=''; $class='';
if ($fieldlist[$field]=='code') $size='size="8" ';
if ($fieldlist[$field]=='position') $size='size="4" ';
if ($fieldlist[$field]=='libelle') $size='centpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
$size = ''; $class = '';
if ($fieldlist[$field] == 'code') $size = 'size="8" ';
if ($fieldlist[$field] == 'position') $size = 'size="4" ';
if ($fieldlist[$field] == 'libelle') $size = 'centpercent';
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') $size = 'size="2" ';
print '<input type="text" '.$size.' class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}
}

View File

@ -92,7 +92,6 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->pcg_subtype = GETPOST('pcg_subtype', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
@ -158,7 +157,6 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
$object->fk_pcg_version = $obj->pcg_version;
$object->pcg_type = GETPOST('pcg_type', 'alpha');
$object->pcg_subtype = GETPOST('pcg_subtype', 'alpha');
$object->account_number = $account_number;
$object->account_parent = $account_parent;
$object->account_category = GETPOST('account_category', 'alpha');
@ -260,12 +258,6 @@ if ($action == 'create') {
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>';
// Chart of accounts subtype
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
print '<td>';
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">';
print '</td></tr>';
print '</table>';
dol_fiche_end();
@ -329,12 +321,6 @@ elseif ($id > 0 || $ref) {
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
print '</td></tr>';
// Chart of accounts subtype
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
print '<td>';
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">';
print '</td></tr>';
print '</table>';
dol_fiche_end();
@ -383,10 +369,6 @@ elseif ($id > 0 || $ref) {
print '<tr><td>'.$langs->trans("Pcgtype").'</td>';
print '<td colspan="2">'.$object->pcg_type.'</td></tr>';
// Chart of accounts subtype
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
print '<td colspan="2">'.$object->pcg_subtype.'</td></tr>';
print '</table>';
print '</div>';

View File

@ -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;
@ -153,7 +153,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
if ($value == 'formula' && empty($_POST['formula'])) continue;
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
if ($value == 'country' || $value == 'country_id') continue;
if (!isset($_POST[$value]) || $_POST[$value] == '')
if (!GETPOSTISSET($value) || GETPOST($value) == '')
{
$ok = 0;
$fieldnamekey = $listfield[$f];
@ -677,9 +677,6 @@ if ($id)
}
if ($fieldlist[$field] == 'pcg_type') {
$valuetoshow = $langs->trans("Pcg_type");
}
if ($fieldlist[$field] == 'pcg_subtype') {
$valuetoshow = $langs->trans("Pcg_subtype");
}
if ($fieldlist[$field] == 'type_template') {
$valuetoshow = $langs->trans("TypeOfTemplate");

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
@ -46,27 +46,35 @@ if (empty($user->rights->accounting->chartofaccount))
$action = GETPOST('action', 'aZ09');
$list_account_main = array (
$list_account_main = array(
'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER',
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
);
$list_account = array ();
$list_account = array();
$list_account[] = '---Product---';
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT';
if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT';
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_ACCOUNT';
if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Service---';
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_ACCOUNT';
if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT';
$list_account[] = 'ACCOUNTING_SERVICE_BUY_ACCOUNT';
if ($mysoc->isInEEC()) {
$list_account[] = 'ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT';
}
$list_account[] = 'ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT';
$list_account[] = '---Other---';
$list_account[] = 'ACCOUNTING_VAT_BUY_ACCOUNT';
$list_account[] = 'ACCOUNTING_VAT_SOLD_ACCOUNT';
@ -112,25 +120,25 @@ if ($action == 'update') {
foreach ($list_account_main as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
foreach ($list_account as $constname) {
$reg=array();
$reg = array();
if (preg_match('/---(.*)---/', $constname, $reg)) { // This is a separator
continue;
}
$constvalue = GETPOST($constname, 'alpha');
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (! $error) {
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
@ -161,6 +169,7 @@ print '<input type="hidden" name="action" value="update">';
// Define main accounts for thirdparty
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td>'.$langs->trans("ThirdParties").' | '.$langs->trans("Users").'</td><td></td></tr>';
foreach ($list_account_main as $key) {
print '<tr class="oddeven value">';
@ -180,17 +189,8 @@ foreach ($list_account_main as $key) {
}
print "</table>\n";
print '<br>';
// Define default accounts
print '<table class="noborder centpercent">';
foreach ($list_account as $key) {
$reg=array();
$reg = array();
if (preg_match('/---(.*)---/', $key, $reg)) {
print '<tr class="liste_titre"><td>'.$langs->trans($reg[1]).'</td><td></td></tr>';
}
@ -198,9 +198,9 @@ foreach ($list_account as $key) {
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);
print '<td width="50%">' . $label . '</td>';
print '<td width="50%">'.$label.'</td>';
// Value
print '<td>'; // Do not force class=right, or it align also the content of the select box
print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>';
print '</tr>';

View File

@ -134,13 +134,13 @@ if ($action == 'update') {
$form = new Form($db);
$title = $langs->trans('ConfigAccountingExpert');
$title = $langs->trans('ExportOptions');
llxHeader('', $title);
$linkback = '';
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'accountancy');
print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy');
print "\n".'<script type="text/javascript" language="javascript">'."\n";

View File

@ -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;

View File

@ -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;
@ -165,9 +165,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
}
// Other checks
if (isset($_POST["code"]))
if (GETPOSTISSET("code"))
{
if ($_POST["code"] == '0')
if (GETPOST("code") == '0')
{
$ok = 0;
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
@ -59,7 +59,7 @@ $search_label = GETPOST('search_label', 'alpha');
$search_desc = GETPOST('search_desc', 'alpha');
$search_current_account = GETPOST('search_current_account', 'alpha');
$search_current_account_valid = GETPOST('search_current_account_valid', 'alpha');
if ($search_current_account_valid == '') $search_current_account_valid='withoutvalidaccount';
if ($search_current_account_valid == '') $search_current_account_valid = 'withoutvalidaccount';
$search_onsell = GETPOST('search_onsell', 'alpha');
$search_onpurchase = GETPOST('search_onpurchase', 'alpha');
@ -67,12 +67,12 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
$btn_changetype = GETPOST('changetype', 'alpha');
if (empty($accounting_product_mode)) $accounting_product_mode='ACCOUNTANCY_SELL';
if (empty($accounting_product_mode)) $accounting_product_mode = 'ACCOUNTANCY_SELL';
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@ -117,7 +117,9 @@ if ($action == 'update') {
'ACCOUNTANCY_SELL',
'ACCOUNTANCY_SELL_INTRA',
'ACCOUNTANCY_SELL_EXPORT',
'ACCOUNTANCY_BUY'
'ACCOUNTANCY_BUY',
'ACCOUNTANCY_BUY_INTRA',
'ACCOUNTANCY_BUY_EXPORT'
);
if (in_array($accounting_product_mode, $accounting_product_modes)) {
@ -159,6 +161,12 @@ if ($action == 'update') {
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql .= " SET accountancy_code_buy = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
$sql .= " SET accountancy_code_buy_intra = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
$sql .= " SET accountancy_code_buy_export = ".$accounting->account_number;
}
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$sql .= " SET accountancy_code_sell = ".$accounting->account_number;
}
@ -204,7 +212,11 @@ $form = new FormAccounting($db);
$accounting = new AccountingAccount($db);
// TODO: we should need to check if result is already exists accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1);
$aarowid_servbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT, 1);
$aarowid_servbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT, 1);
$aarowid_prodbuy = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1);
$aarowid_prodbuy_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT, 1);
$aarowid_prodbuy_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT, 1);
$aarowid_servsell = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1);
$aarowid_servsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT, 1);
$aarowid_servsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT, 1);
@ -212,47 +224,68 @@ $aarowid_prodsell = $accounting->fetch('', $conf->global->ACCOUNTING_P
$aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT, 1);
$aarowid_prodsell_export = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT, 1);
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell_intra = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell_export = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell_intra = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell_export = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
llxHeader('', $langs->trans("ProductsBinding"));
$pcgverid = $conf->global->CHARTOFACCOUNTS;
$pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'pcg_version');
if (empty($pcgvercode)) $pcgvercode=$pcgverid;
if (empty($pcgvercode)) $pcgvercode = $pcgverid;
$sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy,";
$sql.= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,";
$sql.= " p.tms, p.fk_product_type as product_type,";
$sql.= " aa.rowid as aaid";
$sql.= " FROM " . MAIN_DB_PREFIX . "product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
$sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,";
$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,";
$sql .= " p.tms, p.fk_product_type as product_type,";
$sql .= " aa.rowid as aaid";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON";
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$sql.=" p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
$sql .= " p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA')
{
$sql .= " p.accountancy_code_buy_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
{
$sql .= " p.accountancy_code_buy_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
{
$sql.=" p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
$sql .= " p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
{
$sql.=" p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
$sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
else
{
$sql.=" p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '" . $pcgvercode . "'";
$sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
}
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
$sql .= ' WHERE p.entity IN ('.getEntity('product').')';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy_intra", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_buy_export", $search_current_account);
}
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
if (strlen(trim($search_current_account))) {
$sql .= natural_search("p.accountancy_code_sell", $search_current_account);
@ -286,8 +319,8 @@ if (strlen(trim($search_label))) {
if (strlen(trim($search_desc))) {
$sql .= natural_search("p.description", $search_desc);
}
if ($search_onsell != '' && $search_onsell != '-1') $sql.= natural_search('p.tosell', $search_onsell, 1);
if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql.= natural_search('p.tobuy', $search_onpurchase, 1);
if ($search_onsell != '' && $search_onsell != '-1') $sql .= natural_search('p.tosell', $search_onsell, 1);
if ($search_onpurchase != '' && $search_onpurchase != '-1') $sql .= natural_search('p.tobuy', $search_onpurchase, 1);
$sql .= $db->order($sortfield, $sortorder);
@ -334,70 +367,77 @@ if ($result)
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
print '<br>';
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc") . '</span><br>';
print '<span class="opacitymedium">'.$langs->trans("InitAccountancyDesc").'</span><br>';
print '<br>';
// Select mode
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
print '<td>'.$langs->trans('Options').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSell') . '</td>';
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL"'.($accounting_product_mode == 'ACCOUNTANCY_SELL' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSell').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellDesc');
print "</td></tr>\n";
if ($mysoc->isInEEC())
{
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellIntra') . '</td>';
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellIntraDesc');
print "</td></tr>\n";
}
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"' . ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductSellExport') . '</td>';
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_SELL_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductSellExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductSellExportDesc');
print "</td></tr>\n";
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"' . ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') . '> ' . $langs->trans('OptionModeProductBuy') . '</td>';
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY"'.($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuy').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
if ($mysoc->isInEEC())
{
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_INTRA"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyIntra').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
}
print '<tr class="oddeven"><td class="titlefield"><input type="radio" name="accounting_product_mode" value="ACCOUNTANCY_BUY_EXPORT"'.($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT' ? ' checked' : '').'> '.$langs->trans('OptionModeProductBuyExport').'</td>';
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
print "</table>\n";
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans('Refresh').'" name="changetype"></div>';
print "<br>\n";
// Filter on categories
$moreforfilter='';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$moreforfilter = '';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '">';
$buttonsave = '<input type="submit" class="button" id="changeaccount" name="changeaccount" value="'.$langs->trans("Save").'">';
//print '<br><div class="center">'.$buttonsave.'</div>';
$texte=$langs->trans("ListOfProductsServices");
$texte = $langs->trans("ListOfProductsServices");
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '<div class="div-table-responsive">';
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="8" name="search_ref" value="'.dol_escape_htmltag($search_ref).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>';
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="'.dol_escape_htmltag($search_desc).'"></td>';
// On sell
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print '<td class="liste_titre center">'.$form->selectyesno('search_onsell', $search_onsell, 1, false, 1).'</td>';
}
// On buy
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print '<td class="liste_titre center">'.$form->selectyesno('search_onpurchase', $search_onpurchase, 1, false, 1).'</td>';
}
// Current account
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="' . dol_escape_htmltag($search_current_account) . '">';
$listofvals=array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
print '<input type="text" class="flat" size="6" name="search_current_account" id="search_current_account" value="'.dol_escape_htmltag($search_current_account).'">';
$listofvals = array('withoutvalidaccount'=>$langs->trans("WithoutValidAccount"), 'withvalidaccount'=>$langs->trans("WithValidAccount"));
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons();
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
@ -405,30 +445,36 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
if (!empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
// On sell / On purchase
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount="p.accountancy_code_sell";
$fieldtosortaccount = "p.accountancy_code_sell";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount="p.accountancy_code_sell_intra";
$fieldtosortaccount = "p.accountancy_code_sell_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount="p.accountancy_code_sell_export";
} else {
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount="p.accountancy_code_buy";
}
$fieldtosortaccount = "p.accountancy_code_sell_export";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_intra";
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
$fieldtosortaccount = "p.accountancy_code_buy_export";
}
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
$clickpitco = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
print '</tr>';
$product_static = new Product($db);
$i=0;
$i = 0;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
@ -445,48 +491,77 @@ if ($result)
// Sales
if ($obj->product_type == 0) {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_intra;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_export;
}
else {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
$compta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
}
}
else {
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_intra;
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell_intra;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT') {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell_export;
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell_export;
}
else {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
}
// Purchases
if ($obj->product_type == 0) {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
} else {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy_intra;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy_export;
}
else {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
}
}
else {
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy_intra;
}
elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy_export;
}
else {
$compta_prodbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
}
}
print '<tr class="oddeven">';
@ -509,7 +584,7 @@ if ($result)
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT')
print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' || $accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT')
print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
// Current accounting account
@ -517,7 +592,13 @@ if ($result)
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
print length_accountg($obj->accountancy_code_buy);
if ($obj->accountancy_code_buy && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
print length_accountg($obj->accountancy_code_buy_intra);
if ($obj->accountancy_code_buy_intra && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
print length_accountg($obj->accountancy_code_buy_export);
if ($obj->accountancy_code_buy_export && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
print length_accountg($obj->accountancy_code_sell);
if ($obj->accountancy_code_sell && empty($obj->aaid)) print ' '.img_warning($langs->trans("ValueNotIntoChartOfAccount"));
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
@ -530,52 +611,72 @@ if ($result)
print '</td>';
// New account to set
$defaultvalue='';
$defaultvalue = '';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
// Accounting account buy
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue=$compta_prodbuy;
$codesell=length_accountg($obj->accountancy_code_buy);
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy;
$codesell = length_accountg($obj->accountancy_code_buy);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_INTRA') {
// Accounting account buy intra (In EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_intra;
$codesell = length_accountg($obj->accountancy_code_buy_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_BUY_EXPORT') {
// Accounting account buy export (Out of EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue = $compta_prodbuy_export;
$codesell = length_accountg($obj->accountancy_code_buy_export);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') {
// Accounting account sell
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
$codesell=length_accountg($obj->accountancy_code_sell);
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
} elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') {
// Accounting account sell intra (In EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
$codesell=length_accountg($obj->accountancy_code_sell_intra);
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_intra);
//var_dump($defaultvalue.' - '.$codesell.' - '.$compta_prodsell);
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
} else {
// Accounting account sell export (Out of EEC)
print '<td class="left">';
//$defaultvalue=GETPOST('codeventil_' . $product_static->id,'alpha'); This is id and we need a code
if (empty($defaultvalue)) $defaultvalue=$compta_prodsell;
$codesell=length_accountg($obj->accountancy_code_sell_export);
if (! empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_' . $product_static->id, 1, array(), 1);
if (empty($defaultvalue)) $defaultvalue = $compta_prodsell;
$codesell = length_accountg($obj->accountancy_code_sell_export);
if (!empty($obj->aaid)) $defaultvalue = ''; // Do not suggest default new value is code is already valid
print $form->select_account($defaultvalue, 'codeventil_'.$product_static->id, 1, array(), 1);
print '</td>';
}
// Checkbox select
print '<td class="center">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="'.$obj->rowid.'"/></td>';
print "</tr>";
$i ++;
$i++;
}
print '</table>';
print '</div>';

View File

@ -38,17 +38,16 @@ 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');
if (GETPOST("exportcsv", 'alpha')) $action = 'export_csv';
// Load variable for pagination
$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;
@ -99,10 +98,8 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
$search_date_end = dol_get_last_day($year_end, $month_end);
}
}
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
$sortfield = "t.numero_compte";
if ($sortorder == "") $sortorder = "ASC";
if ($sortfield == "") $sortfield = "t.numero_compte";
$param = '';
@ -198,12 +195,24 @@ if ($action != 'export_csv')
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="action" id="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$button = '<input type="submit" name="exportcsv" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery("#exportcsvbutton").click(function() {
event.preventDefault();
console.log("Set action to export_csv");
jQuery("#action").val("export_csv");
jQuery("#searchFormList").submit();
jQuery("#action").val("list");
});
});
</script>';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
@ -228,7 +237,7 @@ if ($action != 'export_csv')
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre" colspan="5">';
print '<td class="liste_titre" colspan="6">';
print $langs->trans('From');
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
print ' ';
@ -245,6 +254,7 @@ if ($action != 'export_csv')
print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("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);
@ -257,6 +267,16 @@ if ($action != 'export_csv')
$sous_total_credit = 0;
$displayed_account = "";
$sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity;
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
$resql = $db->query($sql);
$nrows = $resql->num_rows;
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
}
foreach ($object->lines as $line)
{
$link = '';
@ -274,14 +294,14 @@ if ($action != 'export_csv')
{
// Affiche un Sous-Total par compte comptable
if ($displayed_account != "") {
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap right">' . price($sous_total_debit) . '</td><td class="nowrap right">' . price($sous_total_credit) . '</td><td class="nowrap right">' . price(price2num($sous_total_credit - $sous_total_debit)) . '</td>';
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
print "<td>&nbsp;</td>\n";
print '</tr>';
}
// Show first line of a break
print '<tr class="trforbreak">';
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '</tr>';
$displayed_account = $root_account_description;
@ -293,6 +313,7 @@ if ($action != 'export_csv')
print '<td>'.length_accountg($line->numero_compte).'</td>';
print '<td>'.$description.'</td>';
print '<td class="nowraponall right">'.price($opening_balances["'".$line->numero_compte."'"]).'</td>';
print '<td class="nowraponall right">'.price($line->debit).'</td>';
print '<td class="nowraponall right">'.price($line->credit).'</td>';
print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>';
@ -305,11 +326,11 @@ if ($action != 'export_csv')
$sous_total_credit += $line->credit;
}
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
print "<td>&nbsp;</td>\n";
print '</tr>';
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
print "<td>&nbsp;</td>\n";
print '</tr>';

View File

@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
@ -92,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;
@ -203,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.
@ -275,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;
@ -314,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);
}
}
@ -538,6 +539,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
*/
$formother = new FormOther($db);
$formfile = new FormFile($db);
$title_page = $langs->trans("Bookkeeping");
@ -766,7 +768,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled'?' checked':'').'>'.$langs->trans("NotReconciled").'</span>';
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
print '</td>';
}
// Code journal
@ -914,7 +916,69 @@ while ($i < min($num, $limit))
// Document ref
if (!empty($arrayfields['t.doc_ref']['checked']))
{
print '<td class="nowrap">'.$line->doc_ref.'</td>';
if ($line->doc_type == 'customer_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$objectstatic = new Facture($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'facture';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
}
elseif ($line->doc_type == 'supplier_invoice')
{
$langs->loadLangs(array('bills'));
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$objectstatic = new FactureFournisseur($db);
$objectstatic->fetch($line->fk_doc);
//$modulepart = 'invoice_supplier';
$filename = dol_sanitizeFileName($line->doc_ref);
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
}
elseif ($line->doc_type == 'expense_report')
{
$langs->loadLangs(array('trips'));
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
$objectstatic = new ExpenseReport($db);
$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;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
}
else
{
// Other type
}
print '<td class="nowrap">';
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
// Picto + Ref
print '<td class="nobordernopadding nowrap">';
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;
} else {
print $line->doc_ref;
}
print '</td></tr></table>';
print "</td>\n";
if (!$i) $totalarray['nbfield']++;
}

View File

@ -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;

View File

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

View File

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

View File

@ -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'),
@ -239,6 +246,7 @@ class AccountancyExport
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
$type_export = 'general_ledger';
global $db; // The tpl file use $db
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
@ -279,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;
@ -920,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
*
@ -935,6 +946,7 @@ class AccountancyExport
foreach ($objectLines as $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
$type_enregistrement = 'E'; // For write movement
@ -950,7 +962,7 @@ class AccountancyExport
// LIBE
print $line->label_operation.$separator;
// DATH
print $line->date_lim_reglement.$separator;
print $date_lim_reglement.$separator;
// CNPI
if ($line->doc_type == 'supplier_invoice') {
if ($line->montant < 0) {
@ -969,21 +981,19 @@ class AccountancyExport
}
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 {
$nature_piece = '';
}
print $racine_subledger_account . $separator;
} else {
print $separator;
}
*/
print $separator; // deprecated CPTG & CPTA use instead
// 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
@ -1051,6 +1061,273 @@ 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=array('','','');
if (strpos($soc->address, "\n")!==false) {
$address = explode("\n", $soc->address);
if (is_array($address) && count($address)>0) {
foreach($address as $key=>$data) {
$address[$key]=str_replace(array("\t", "\n", "\r"), "", $data);
$address[$key]=dol_trunc($address[$key], 40, 'right', 'UTF-8', 1);
}
}
} else {
$address[0] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 0, 40);
$address[1] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 41, 40);
$address[2] = substr(str_replace(array("\t", "\r"), " ", $soc->address), 82, 40);
}
$type_enregistrement = 'C';
//TYPE
print $type_enregistrement.$separator;
//NOCL
print $soc->code_client.$separator;
//NMCM
print $separator;
//LIBI
print $separator;
//TITR
print $separator;
//RSSO
print $soc->nom.$separator;
//CAD1
print $address[0].$separator;
//CAD2
print $address[1].$separator;
//CAD3
print $address[2].$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 str_replace(" ", "", $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;
}
// 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 $separator;
// MTDV
print '0'.$separator;
// CODV
print $separator;
// TXDV
print '0'.$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
*

View File

@ -53,11 +53,6 @@ class AccountancySystem
*/
public $pcg_type;
/**
* @var string pcg subtype
*/
public $pcg_subtype;
/**
* @var string Accountancy System numero
*/

View File

@ -90,11 +90,6 @@ class AccountingAccount extends CommonObject
*/
public $pcg_type;
/**
* @var string pcg subtype
*/
public $pcg_subtype;
/**
* @var string account number
*/
@ -140,6 +135,11 @@ class AccountingAccount extends CommonObject
*/
public $active;
/**
* @var int reconcilable
*/
public $reconcilable;
/**
* Constructor
*
@ -167,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.pcg_subtype, 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.reconcilable";
$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";
@ -198,7 +198,6 @@ class AccountingAccount extends CommonObject
$this->tms = $obj->tms;
$this->fk_pcg_version = $obj->fk_pcg_version;
$this->pcg_type = $obj->pcg_type;
$this->pcg_subtype = $obj->pcg_subtype;
$this->account_number = $obj->account_number;
$this->account_parent = $obj->account_parent;
$this->label = $obj->label;
@ -209,6 +208,7 @@ class AccountingAccount extends CommonObject
$this->fk_user_modif = $obj->fk_user_modif;
$this->active = $obj->active;
$this->status = $obj->active;
$this->reconcilable = $obj->reconcilable;
return $this->id;
} else {
@ -240,8 +240,6 @@ class AccountingAccount extends CommonObject
$this->fk_pcg_version = trim($this->fk_pcg_version);
if (isset($this->pcg_type))
$this->pcg_type = trim($this->pcg_type);
if (isset($this->pcg_subtype))
$this->pcg_subtype = trim($this->pcg_subtype);
if (isset($this->account_number))
$this->account_number = trim($this->account_number);
if (isset($this->label))
@ -253,10 +251,6 @@ class AccountingAccount extends CommonObject
{
$this->pcg_type = 'XXXXXX';
}
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
{
$this->pcg_subtype = 'XXXXXX';
}
// Check parameters
// Put here code to add control on parameters values
@ -266,7 +260,6 @@ class AccountingAccount extends CommonObject
$sql .= ", entity";
$sql .= ", fk_pcg_version";
$sql .= ", pcg_type";
$sql .= ", pcg_subtype";
$sql .= ", account_number";
$sql .= ", account_parent";
$sql .= ", label";
@ -274,12 +267,12 @@ class AccountingAccount extends CommonObject
$sql .= ", fk_accounting_category";
$sql .= ", fk_user_author";
$sql .= ", active";
$sql .= ", reconcilable";
$sql .= ") VALUES (";
$sql .= " '" . $this->db->idate($now) . "'";
$sql .= ", " . $conf->entity;
$sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'");
$sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'");
$sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'");
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent);
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'");
@ -287,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->reconcilable;
$sql .= ")";
$this->db->begin();
@ -341,17 +335,12 @@ class AccountingAccount extends CommonObject
{
$this->pcg_type = 'XXXXXX';
}
if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1')
{
$this->pcg_subtype = 'XXXXXX';
}
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account ";
$sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null");
$sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null");
$sql .= " , pcg_subtype = " . ($this->pcg_subtype ? "'" . $this->db->escape($this->pcg_subtype) . "'" : "null");
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
$sql .= " , account_parent = " . (int) $this->account_parent;
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''");
@ -359,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 .= " , reconcilable = " . (int) $this->reconcilable;
$sql .= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
@ -584,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 = 'reconcilable';
}
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) {
@ -619,18 +619,28 @@ class AccountingAccount extends CommonObject
* Account activated
*
* @param int $id Id
* @param int $mode 0=field active, 1=field reconcilable
* @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 = 'reconcilable';
}
$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();

View File

@ -926,6 +926,7 @@ class BookKeeping extends CommonObject
$sql .= " t.debit,";
$sql .= " t.credit,";
$sql .= " t.lettering_code,";
$sql .= " t.date_lettering,";
$sql .= " t.montant,";
$sql .= " t.sens,";
$sql .= " t.fk_user_author,";
@ -934,6 +935,7 @@ class BookKeeping extends CommonObject
$sql .= " t.journal_label,";
$sql .= " t.piece_num,";
$sql .= " t.date_creation,";
$sql .= " t.date_lim_reglement,";
$sql .= " t.tms as date_modification,";
$sql .= " t.date_export";
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
@ -1006,12 +1008,14 @@ class BookKeeping extends CommonObject
$line->montant = $obj->montant;
$line->sens = $obj->sens;
$line->lettering_code = $obj->lettering_code;
$line->date_lettering = $obj->date_lettering;
$line->fk_user_author = $obj->fk_user_author;
$line->import_key = $obj->import_key;
$line->code_journal = $obj->code_journal;
$line->journal_label = $obj->journal_label;
$line->piece_num = $obj->piece_num;
$line->date_creation = $this->db->jdate($obj->date_creation);
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
$line->date_modification = $this->db->jdate($obj->date_modification);
$line->date_export = $this->db->jdate($obj->date_export);
@ -1550,7 +1554,7 @@ class BookKeeping extends CommonObject
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
@ -1564,7 +1568,7 @@ class BookKeeping extends CommonObject
$this->date_creation = $obj->date_creation;
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_ERR);
return -1;
}
@ -1618,7 +1622,7 @@ class BookKeeping extends CommonObject
$sql .= " WHERE piece_num = ".$piecenum;
$sql .= " AND entity IN (".getEntity('accountancy').")";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
while ($obj = $this->db->fetch_object($result)) {
@ -1650,7 +1654,7 @@ class BookKeeping extends CommonObject
}
} else {
$this->error = "Error ".$this->db->lasterror();
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
dol_syslog(__METHOD__.$this->error, LOG_ERR);
return -1;
}

View File

@ -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';

View File

@ -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;

View File

@ -69,7 +69,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@ -206,8 +206,10 @@ if (empty($chartaccountcode))
// Customer Invoice lines
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
$sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
@ -399,7 +401,7 @@ if ($result) {
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto = '';
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
@ -423,6 +425,14 @@ if ($result) {
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
$product_static->status = $objp->status;
$product_static->status_buy = $objp->status_buy;
$product_static->accountancy_code_sell = $objp->code_sell;
$product_static->accountancy_code_sell_intra = $objp->code_sell_intra;
$product_static->accountancy_code_sell_export = $objp->code_sell_export;
$product_static->accountancy_code_buy = $objp->code_buy;
$product_static->accountancy_code_buy_intra = $objp->code_buy_intra;
$product_static->accountancy_code_buy_export = $objp->code_buy_export;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
@ -433,13 +443,20 @@ if ($result) {
$isBuyerInEEC = isInEEC($objp);
// Search suggested default account for product/service
$suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) {
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else { // Foreign sale
@ -452,7 +469,13 @@ if ($result) {
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with a VAT
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else {
@ -463,14 +486,22 @@ if ($result) {
}
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
// Search suggested account for product/service
// Search suggested account for product/service (similar code exists in page index.php to make automatic binding)
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
if ($isSellerInEEC && $isBuyerInEEC && $objp->tva_tx_line != 0) { // European intravat sale, but with VAT
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = 'eecwithvat';
} elseif ($isSellerInEEC && $isBuyerInEEC && empty($objp->tva_intra)) { // European intravat sale, without VAT intra community number
$objp->code_sell_p = $objp->code_sell;
$objp->aarowid_suggest = $objp->aarowid; // There is a doubt for this case. Is it an error on vat or we just forgot to fill vat number ?
$suggestedaccountingaccountfor = 'eecwithoutvatnumber';
} elseif ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_sell_p = $objp->code_sell_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
@ -487,6 +518,7 @@ if ($result) {
$code_sell_p_notset = 'color:orange';
}
if (empty($objp->code_sell_l) && empty($objp->code_sell_p)) $code_sell_p_notset = 'color:red';
if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) $code_sell_p_notset = 'color:orange';
// $objp->code_sell_l is now default code of product/service
// $objp->code_sell_p is now code of product/service
@ -503,9 +535,10 @@ if ($result) {
// Ref Product
print '<td>';
if ($product_static->id > 0)
if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
if ($objp->product_label) print '<br>'.$objp->product_label;
}
if ($objp->product_label) print '<br><span class="opacitymedium">'.$objp->product_label.'</span>';
print '</td>';
print '<td class="tdoverflowonsmartphone">';
@ -533,9 +566,9 @@ if ($result) {
print '<td>'.$objp->tva_intra.'</td>';
// Current account
print '<td class="center" style="'.$code_sell_p_notset.'">';
$s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
// Found accounts
print '<td style="'.$code_sell_p_notset.'">';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@ -544,9 +577,11 @@ if ($result) {
if ($objp->product_id > 0)
{
print '<br>';
$s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT");
elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
$s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p));
print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1);
@ -582,6 +617,7 @@ if ($result) {
print '<td class="center">';
//var_dump($objp->aarowid);var_dump($objp->aarowid_intra);var_dump($objp->aarowid_export);var_dump($objp->aarowid_suggest);
$ischecked = $objp->aarowid_suggest;
if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $ischecked = 0;
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="'.$objp->rowid."_".$i.'"'.($ischecked ? "checked" : "").'/>';
print '</td>';

View File

@ -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;

View File

@ -62,7 +62,7 @@ $search_year = GETPOST("search_year", "int");
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@ -313,8 +313,8 @@ if ($result) {
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'nowraponall ');
print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', '');
$checkpicto = '';
if ($massactionbutton) $checkpicto = $form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
@ -366,12 +366,12 @@ if ($result) {
print '</td>';
// Current account
print '<td class="center">';
print '<td>';
print length_accountg(html_entity_decode($objp->code_buy));
print '</td>';
// Suggested accounting account
print '<td class="center">';
print '<td>';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';

View File

@ -66,7 +66,7 @@ if ($conf->accounting->enabled)
$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
$helpisexpanded = empty($resultboxes['boxactivated']); // If there is no widget, the tooltip help is expanded by default.
$helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
$showtutorial = '';
if (!$helpisexpanded)
@ -222,10 +222,6 @@ if ($conf->accounting->enabled)
$boxlist .= '<div class="twocolumns">';
$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
if (!empty($nbworkboardcount))
{
$boxlist .= $boxwork;
}
$boxlist .= $resultboxes['boxlista'];
@ -233,7 +229,6 @@ if ($conf->accounting->enabled)
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $boxstat;
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>';

View File

@ -663,7 +663,7 @@ if (! $error && $action == 'writebookkeeping') {
} elseif ($tabtype[$key] == 'payment_various') {
$bookkeeping->subledger_account = $k;
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"];
$bookkeeping->numero_compte = $tabpay[$key]["account_various"];
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
$bookkeeping->label_compte = $accountingaccount->label;
@ -760,7 +760,7 @@ if (! $error && $action == 'writebookkeeping') {
}
}
if (price2num($totaldebit) != price2num($totalcredit))
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))
{
$error++;
$errorforline++;
@ -968,8 +968,8 @@ if (empty($action) || $action == 'view') {
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
// Test that setup is complete
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL AND clos=0';
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE entity = '.$conf->entity.' AND fk_accountancy_journal IS NULL AND clos=0';
$resql = $db->query($sql);
if ($resql)
{

View File

@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on line before
if (price2num($totaldebit) != price2num($totalcredit))
if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))
{
$error++;
$errorforline++;

View File

@ -513,7 +513,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on lines before
if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit)))
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{
$error++;
$errorforline++;

View File

@ -471,7 +471,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on lines before
if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit)))
if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{
$error++;
$errorforline++;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -119,8 +119,9 @@ if ($action == 'validatehistory') {
// Supplier Invoice Lines (must be same request than into page list.php for manual binding)
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
$sql .= " aa.rowid as aarowid,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
@ -128,7 +129,9 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql .= " AND l.product_type <= 2";
@ -157,16 +160,12 @@ if ($action == 'validatehistory') {
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
//$objp->code_buy_p = $objp->code_buy_intra;
$objp->code_buy_p = $objp->code_buy;
//$objp->aarowid_suggest = $objp->aarowid_intra;
$objp->aarowid_suggest = $objp->aarowid;
$objp->code_buy_p = $objp->code_buy_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
//$objp->code_buy_p = $objp->code_buy_export;
$objp->code_buy_p = $objp->code_buy;
//$objp->aarowid_suggest = $objp->aarowid_export;
$objp->aarowid_suggest = $objp->aarowid;
$objp->code_buy_p = $objp->code_buy_export;
$objp->aarowid_suggest = $objp->aarowid_export;
$suggestedaccountingaccountfor = 'export';
}
}

View File

@ -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;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
@ -69,7 +69,7 @@ $btn_ventil = GETPOST('ventil', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page < 0) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
@ -210,8 +210,11 @@ if (empty($chartaccountcode))
// Supplier Invoice Lines
$sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,";
$sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy, p.tva_tx as tva_tx_prod,";
$sql .= " aa.rowid as aarowid,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,";
$sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,";
$sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,";
$sql .= " p.tosell as status, p.tobuy as status_buy,";
$sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,";
$sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra";
$parameters = array();
@ -222,7 +225,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_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";
// 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);
@ -406,6 +411,10 @@ if ($result) {
$facturefourn_static = new FactureFournisseur($db);
$product_static = new Product($db);
$isBuyerInEEC = isInEEC($mysoc);
$accountingaccount_codetotid_cache = array();
while ($i < min($num_lines, $limit)) {
$objp = $db->fetch_object($result);
@ -414,40 +423,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
$isSellerInEEC = isInEEC($objp);
$suggestedaccountingaccountbydefaultfor = '';
if ($objp->type_l == 1) {
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_s;
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else { // Foreign sale
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'export';
}
}
} elseif ($objp->type_l == 0) {
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_p;
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'eec';
} else {
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
$suggestedaccountingaccountbydefaultfor = 'export';
}
}
}
if ($objp->code_buy_l == -1) $objp->code_buy_l = '';
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
if (!empty($objp->code_buy)) {
$objp->code_buy_p = $objp->code_buy; // Code on product
// Search suggested account for product/service
$suggestedaccountingaccountfor = '';
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
$objp->code_buy_p = $objp->code_buy;
$objp->aarowid_suggest = $objp->aarowid;
$suggestedaccountingaccountfor = '';
} else {
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
$objp->code_buy_p = $objp->code_buy_intra;
$objp->aarowid_suggest = $objp->aarowid_intra;
$suggestedaccountingaccountfor = 'eec';
} else { // Foreign sale
$objp->code_buy_p = $objp->code_buy_export;
$objp->aarowid_suggest = $objp->aarowid_export;
$suggestedaccountingaccountfor = 'export';
}
}
if (!empty($objp->code_buy_p)) {
// Value was defined previously
} else {
$code_buy_p_notset = 'color:orange';
}
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
// $objp->code_buy_p is now code of product/service
// $objp->code_buy_l is now default code of product/service
// $objp->code_buy_p is now code of product/service
print '<tr class="oddeven">';
@ -467,7 +522,7 @@ if ($result) {
print '<td>';
if ($product_static->id > 0)
print $product_static->getNomUrl(1);
if ($objp->product_label) print '<br>'.$objp->product_label;
if ($objp->product_label) print '<br><span class="opacitymedium">'.$objp->product_label.'</span>';
print '</td>';
// Description
@ -497,9 +552,9 @@ if ($result) {
// VAT Num
print '<td>'.$objp->tva_intra.'</td>';
// Current account
print '<td class="center" style="'.$code_buy_p_notset.'">';
$s = (($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
// Found accounts
print '<td style="'.$code_buy_p_notset.'">';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': </span>';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport");
@ -508,7 +563,7 @@ if ($result) {
if ($objp->product_id > 0)
{
print '<br>';
$s = (($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': ';
$s = '<span class="small">'.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': </span>';
$shelp = '';
if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC");
elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport");
@ -520,6 +575,21 @@ if ($result) {
// Suggested accounting account
print '<td>';
$suggestedid = $objp->aarowid_suggest;
if (empty($suggestedid) && empty($objp->code_buy_p) && !empty($objp->code_buy_l) && empty($conf->global->ACCOUNTANCY_DO_NOT_AUTOFILL_ACCOUNT_WITH_GENERIC))
{
if (empty($accountingaccount_codetotid_cache[$objp->code_buy_l]))
{
$tmpaccount = new AccountingAccount($db);
$tmpaccount->fetch(0, $objp->code_buy_l, 1);
if ($tmpaccount->id > 0) {
$suggestedid = $tmpaccount->id;
}
$accountingaccount_codetotid_cache[$objp->code_buy_l] = $tmpaccount->id;
}
else {
$suggestedid = $accountingaccount_codetotid_cache[$objp->code_buy_l];
}
}
print $formaccounting->select_account($suggestedid, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>';
@ -540,6 +610,9 @@ if ($result) {
} else {
print $db->error();
}
if ($db->type == 'mysqli') {
$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation
}
// Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript">

View File

@ -17,7 +17,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;
@ -29,7 +29,7 @@ $format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
$siren = $conf->global->MAIN_INFO_SIREN;
$date_export = "_" . dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
header('Content-Type: text/csv');
@ -46,22 +46,22 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
$search_date_end = dol_now();
}
$datetouseforfilename = $search_date_end;
$tmparray=dol_getdate($datetouseforfilename);
$fiscalmonth=empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START;
$tmparray = dol_getdate($datetouseforfilename);
$fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
// Define end of month to use
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon']=$fiscalmonth;
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon'] = $fiscalmonth;
else {
$tmparray['mon'] = $fiscalmonth;
$tmparray['mon'] = $fiscalmonth;
$tmparray['year']++;
}
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
$completefilename = $siren . "FEC" . $endaccountingperiod . "." . $format;
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
}
else
{
$completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format;
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
}
header('Content-Disposition: attachment;filename=' . $completefilename);
header('Content-Disposition: attachment;filename='.$completefilename);

View File

@ -41,7 +41,7 @@ $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@ $result=restrictedArea($user, 'adherent', $id);
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;

View File

@ -176,11 +176,9 @@ if ($conf->use_javascript_ajax)
$SommeD = 0;
$total = 0;
$dataval = array();
$datalabels = array();
$i = 0;
foreach ($AdherentType as $key => $adhtype)
{
$datalabels[] = array($i, $adhtype->getNomUrl(0, dol_size(16)));
$dataval['draft'][] = array($i, isset($MemberToValidate[$key]) ? $MemberToValidate[$key] : 0);
$dataval['notuptodate'][] = array($i, isset($MembersValidated[$key]) ? $MembersValidated[$key] - (isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0) : 0);
$dataval['uptodate'][] = array($i, isset($MemberUpToDate[$key]) ? $MemberUpToDate[$key] : 0);
@ -198,13 +196,16 @@ if ($conf->use_javascript_ajax)
$dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
$dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$dolgraph = new DolGraph();
$dolgraph->SetData($dataseries);
$dolgraph->setShowLegend(1);
$dolgraph->SetDataColor(array($badgeStatus1, $badgeStatus4, $badgeStatus6, '-'.$badgeStatus0));
$dolgraph->setShowLegend(2);
$dolgraph->setShowPercent(1);
$dolgraph->SetType(array('pie'));
$dolgraph->setWidth('100%');
$dolgraph->setHeight('200');
$dolgraph->draw('idgraphstatus');
print $dolgraph->show($total ? 0 : 1);

View File

@ -74,7 +74,7 @@ if ($statut < -1) $statut = '';
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;

View File

@ -75,7 +75,7 @@ if ($id)
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
dol_banner_tab($object, 'id', $linkback);
print '<div class="fichecenter">';

View File

@ -145,6 +145,8 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Show filter box
/*print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<table class="border centpercent">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
print '<tr><td>'.$langs->trans("Member").'</td><td>';

View File

@ -49,7 +49,7 @@ $typeid = GETPOST('typeid', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@ -229,7 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
// Payment informations
$accountid = $_POST["accountid"];
$operation = $_POST["operation"]; // Payment mode
$num_chq = $_POST["num_chq"];
$num_chq = GETPOST("num_chq", "alphanohtml");
$emetteur_nom = $_POST["chqemetteur"];
$emetteur_banque = $_POST["chqbank"];
$option = $_POST["paymentsave"];

View File

@ -214,7 +214,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
// Type
print '<tr>';
print '<td>'.$langs->trans("Type").'</td><td class="valeur" colspan="3">';
print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"]) ? $_POST["typeid"] : $object->fk_type));
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid") : $object->fk_type));
print'</td></tr>';
// Date start subscription

View File

@ -35,8 +35,8 @@ $action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
$filter = GETPOST("filter", "alpha");
$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
$search_ref = GETPOST('search_ref', 'alpha');
$search_type = GETPOST('search_type', 'alpha');
@ -47,13 +47,14 @@ $search_note = GETPOST('search_note', 'alpha');
$search_account = GETPOST('search_account', 'int');
$search_amount = GETPOST('search_amount', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$sall = '';
$date_select = GETPOST("date_select", 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@ -76,21 +77,21 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
$fieldstosearchall = array(
);
$arrayfields = array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'd.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
't.libelle'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
'c.dateadh'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
'c.datef'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
'd.ref'=>array('label'=>"Ref", 'checked'=>1),
'd.fk_type'=>array('label'=>"Type", 'checked'=>1),
'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
'd.login'=>array('label'=>"Login", 'checked'=>1),
't.libelle'=>array('label'=>"Label", 'checked'=>1),
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),
'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101),
'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
// 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
);
// Security check
@ -256,7 +257,6 @@ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$opt
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
@ -388,46 +388,17 @@ print "</tr>\n";
print '<tr class="liste_titre">';
if (!empty($arrayfields['d.ref']['checked']))
{
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.fk_type']['checked']))
{
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.lastname']['checked']))
{
print_liste_field_titre("LastName", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.firstname']['checked']))
{
print_liste_field_titre("FirstName", $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['d.login']['checked']))
{
print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['t.libelle']['checked']))
{
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
}
if (!empty($arrayfields['d.bank']['checked']))
{
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
}
if (!empty($arrayfields['c.dateadh']['checked']))
{
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
}
if (!empty($arrayfields['c.datef']['checked']))
{
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
}
if (!empty($arrayfields['d.amount']['checked']))
{
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
}
if (!empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
if (!empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
if (!empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
if (!empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
if (!empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
@ -441,12 +412,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'alig
print "</tr>\n";
$total = 0;
$totalarray = array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$total += $obj->subscription;
$subscription->ref = $obj->crowid;
$subscription->id = $obj->crowid;

View File

@ -50,7 +50,7 @@ $status = GETPOST('status', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
@ -792,7 +792,7 @@ if ($rowid > 0)
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"]) ? $_POST["morphy"] : $object->morphy);
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy);
print "</td></tr>";
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';

View File

@ -66,7 +66,7 @@ llxHeader('', $langs->trans("ClickToDialSetup"), $wikihelp);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ClickToDialSetup"), $linkback, 'title_setup');
print $langs->trans("ClickToDialDesc")."<br>\n";
print '<span class="opacitymedium">'.$langs->trans("ClickToDialDesc")."</span><br>\n";
print '<br>';
print '<form method="post" action="clicktodial.php">';

View File

@ -414,7 +414,7 @@ print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
// Name
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address
@ -478,36 +478,36 @@ if (!empty($conf->barcode->enabled)) {
// Logo
print '<tr class="oddeven"><td><label for="logo">'.$form->textwithpicto($langs->trans("Logo"), 'png, jpg').'</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<div class="centpertent nobordernopadding valignmiddle "><div class="inline-block marginrightonly">';
print '<input type="file" class="flat minwidth200" name="logo" id="logo" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';
print '</div><div class="inline-block valignmiddle marginrightonly">';
if (!empty($mysoc->logo_mini)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
print ' &nbsp; ';
print '</div><div class="inline-block valignmiddle">';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_mini).'">';
}
} else {
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
}
print '</td></tr></table>';
print '</div>';
print '</td></tr>';
// Logo (squarred)
print '<tr class="oddeven"><td><label for="logo_squarred">'.$form->textwithpicto($langs->trans("LogoSquarred"), 'png, jpg').'</label></td><td>';
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
print '<div class="centpertent nobordernopadding valignmiddle"><div class="inline-block marginrightonly">';
print '<input type="file" class="flat minwidth200" name="logo_squarred" id="logo_squarred" accept="image/*">';
print '</td><td class="nocellnopadd right" valign="middle">';
print '</div><div class="inline-block valignmiddle marginrightonly">';
if (!empty($mysoc->logo_squarred_mini)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred">'.img_delete($langs->trans("Delete")).'</a>';
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
print ' &nbsp; ';
print '</div><div class="inline-block valignmiddle marginrightonly">';
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini).'">';
}
} else {
print '<img height="30" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png">';
}
print '</td></tr></table>';
print '</div>';
print '</td></tr>';
// Note

View File

@ -48,7 +48,7 @@ $constnote=GETPOST('constnote', 'alpha');
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
@ -201,14 +201,14 @@ print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '', $sortfield, $sortorder, '')."\n";
print '<td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Comment").'</td>';
print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center')."\n";
print getTitleFieldOfList("Value", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print getTitleFieldOfList("Comment", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
if (! empty($conf->multicompany->enabled) && !$user->entity)
{
print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center')."\n";
print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
}
print '<td class="center">'.$langs->trans("Action").'</td>';
print getTitleFieldOfList("Action", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print "</tr>\n";

View File

@ -87,7 +87,10 @@ if ($action == 'edit')
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
$label = $langs->trans($key);
if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP");
if ($key == 'DAV_RESTICT_ON_IP') {
$label = $langs->trans("RESTRICT_ON_IP");
$label .= ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
}
print $form->textwithpicto($label, $tooltiphelp);
print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
@ -124,7 +127,10 @@ else
print '<tr class="oddeven"><td>';
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
$label = $langs->trans($key);
if ($key == 'DAV_RESTICT_ON_IP') $label = $langs->trans("RESTRICT_ON_IP");
if ($key == 'DAV_RESTICT_ON_IP') {
$label = $langs->trans("RESTRICT_ON_IP");
$label .= ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
}
print $form->textwithpicto($label, $tooltiphelp);
print '</td><td>';
if ($key == 'DAV_ALLOW_PRIVATE_DIR')

View File

@ -44,7 +44,7 @@ $mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'createform'; // 'cre
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;

View File

@ -70,7 +70,7 @@ $active = 1;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
@ -437,15 +437,15 @@ $tabcond[8] = !empty($conf->societe->enabled);
$tabcond[9] = true;
$tabcond[10] = true;
$tabcond[11] = (!empty($conf->societe->enabled));
$tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled));
$tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || !empty($conf->fournisseur->enabled));
$tabcond[12] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled));
$tabcond[13] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled) || !empty($conf->supplier_order->enabled));
$tabcond[14] = (!empty($conf->product->enabled) && (!empty($conf->ecotax->enabled) || !empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
$tabcond[15] = true;
$tabcond[16] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
$tabcond[17] = (!empty($conf->deplacement->enabled) || !empty($conf->expensereport->enabled));
$tabcond[18] = !empty($conf->expedition->enabled) || !empty($conf->reception->enabled);
$tabcond[19] = !empty($conf->societe->enabled);
$tabcond[20] = !empty($conf->fournisseur->enabled);
$tabcond[20]= (! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled));
$tabcond[21] = !empty($conf->propal->enabled);
$tabcond[22] = (!empty($conf->commande->enabled) || !empty($conf->propal->enabled));
$tabcond[23] = true;
@ -678,9 +678,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$ok = 0;
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
}
if (isset($_POST["code"]))
if (GETPOSTISSET("code"))
{
if ($_POST["code"] == '0')
if (GETPOST("code") == '0')
{
$ok = 0;
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
@ -691,7 +691,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
}*/
}
if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2))
if (GETPOSTISSET("country") && ($_POST["country"] == '0') && ($id != 2))
{
if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
{
@ -753,20 +753,33 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0;
foreach ($listfieldinsert as $f => $value)
{
$keycode = $listfieldvalue[$i];
if (empty($keycode)) $keycode = $value;
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
}
elseif ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
if ($keycode == 'sortorder') // For column name 'sortorder', we use the field name 'position'
{
$sql .= "'".(int) $db->escape(GETPOST('position'))."'";
$sql .= "'".(int) GETPOST('position', 'int')."'";
}
elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
else $sql .= "'".$db->escape(GETPOST($listfieldvalue[$i], 'nohtml'))."'";
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
}
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
}
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
$i++;
}
$sql .= ",1)";
@ -806,23 +819,36 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
$i = 0;
foreach ($listfieldmodify as $field)
{
$keycode = $listfieldvalue[$i];
if (empty($keycode)) $keycode = $field;
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
}
elseif ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
$_POST[$keycode] = getEntity($tabname[$id]);
}
if ($i) $sql .= ",";
$sql .= $field."=";
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
{
$sql .= "'".(int) $db->escape($_POST['position'])."'";
$sql .= (int) GETPOST('position', 'int');
}
elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
}
elseif (in_array($keycode, array('private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
}
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
$i++;
}
$sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
$sql .= " WHERE ".$rowidcol." = ".(int) $db->escape($rowid);
if (in_array('entity', $listfieldmodify)) $sql .= " AND entity = '".getEntity($tabname[$id])."'";
dol_syslog("actionmodify", LOG_DEBUG);

View File

@ -231,7 +231,9 @@ if ($action == 'confirm_collect')
$form = new Form($db);
$formfile = new FormFile($db);
llxHeader('', 'EmailCollector', '');
$help_url="EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
llxHeader('', 'EmailCollector', $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
@ -481,7 +483,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<input type="hidden" name="id" value="'.$object->id.'">';
// Filters
print '<table class="border centpercent">';
print '<table class="border centpercent tableforfield">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Filters").'</td><td></td><td></td>';
print '</tr>';
@ -560,7 +562,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="clearboth"></div><br>';
// Operations
print '<table id="tablelines" class="noborder noshadow">';
print '<table id="tablelines" class="noborder noshadow tableforfield">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td><td></td>';
print '</tr>';
@ -573,6 +575,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
'recordevent'=>'RecordEvent');
if ($conf->projet->enabled) $arrayoftypes['project'] = 'CreateLeadAndThirdParty';
if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
// support hook for add action
$parameters = array( 'arrayoftypes' => $arrayoftypes ) ;
$res = $hookmanager->executeHooks('addMoreActionsEmailCollector', $parameters, $object, $action);
if($res)
$arrayoftypes = $hookmanager->resArray;
else
foreach($hookmanager->resArray as $k=>$desc)
$arrayoftypes[$k]=$desc;
print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300');
print '</td><td>';
print '<input type="text" name="operationparam">';

View File

@ -53,7 +53,7 @@ $id = GETPOST('id', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
$offset = $limit * $page;
$pageprev = $page - 1;
@ -170,10 +170,7 @@ if (empty($reshook))
$form = new Form($db);
$now = dol_now();
//$help_url="EN:Module_EmailCollector|FR:Module_EmailCollector_FR|ES:Módulo_EmailCollector";
$help_url = '';
$help_url="EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector";
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("EmailCollector"));

View File

@ -32,13 +32,13 @@ if (!$user->admin)
accessforbidden();
// Load translation files required by the page
$langs->loadLangs(array("users","admin","other"));
$langs->loadLangs(array("users", "admin", "other"));
$action=GETPOST('action', 'aZ09');
$action = GETPOST('action', 'aZ09');
$securityevent=new Events($db);
$eventstolog=$securityevent->eventstolog;
$securityevent = new Events($db);
$eventstolog = $securityevent->eventstolog;
/*
@ -46,15 +46,14 @@ $eventstolog=$securityevent->eventstolog;
*/
if ($action == "save")
{
$i=0;
$i = 0;
$db->begin();
foreach ($eventstolog as $key => $arr)
{
$param='MAIN_LOGEVENTS_'.$arr['id'];
//print "param=".$param." - ".$_POST[$param];
if (! empty($_POST[$param])) dolibarr_set_const($db, $param, $_POST[$param], 'chaine', 0, '', $conf->entity);
$param = 'MAIN_LOGEVENTS_'.$arr['id'];
if (GETPOST($param, 'alphanohtml')) dolibarr_set_const($db, $param, GETPOST($param, 'alphanohtml'), 'chaine', 0, '', $conf->entity);
else dolibarr_del_const($db, $param, $conf->entity);
}
@ -68,7 +67,7 @@ if ($action == "save")
* View
*/
$wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
llxHeader('', $langs->trans("Audit"), $wikihelp);
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
@ -82,7 +81,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="save">';
$head=security_prepare_head();
$head = security_prepare_head();
dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);
@ -98,9 +97,9 @@ foreach ($eventstolog as $key => $arr)
print '<tr class="oddeven">';
print '<td>'.$arr['id'].'</td>';
print '<td>';
$key='MAIN_LOGEVENTS_'.$arr['id'];
$value=$conf->global->$key;
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value?' checked':'').'>';
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = $conf->global->$key;
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>';
print '</td></tr>'."\n";
}
}

View File

@ -23,9 +23,9 @@
*/
/**
* \file htdocs/admin/expedition.php
* \ingroup expedition
* \brief Page d'administration/configuration du module Expedition
* \file htdocs/admin/export.php
* \ingroup export
* \brief config Page module Export
*/
require '../main.inc.php';
@ -38,13 +38,15 @@ if (!$user->admin)
accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'save') {
dolibarr_set_const($db, 'EXPORT_CSV_SEPARATOR_TO_USE', GETPOST('EXPORT_CSV_SEPARATOR_TO_USE', 'alphanohtml'));
}
/*
@ -69,32 +71,38 @@ $head[$h][1] = $langs->trans("Setup");
$head[$h][2] = 'setup';
$h++;
dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "exports");
dol_fiche_head($head, 'setup', $langs->trans("ExportsArea"), -1, "technic");
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="save">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100"></td>'."\n";
print '</tr>';
// Example with a yes / no select
print '<tr class="oddeven">';
print '<td>'.$langs->trans("EXPORTS_SHARE_MODELS").'</td>';
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set_EXPORTS_SHARE_MODELS">';
echo ajax_constantonoff('EXPORTS_SHARE_MODELS');
print '</form>';
print '</td></tr>';
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ExportCsvSeparator").'</td>';
print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"EXPORT_CSV_SEPARATOR_TO_USE\" value=\"".(empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\"></td>";
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr>';
print '</table>';
print '</form>';
dol_fiche_end();
// End of page

View File

@ -57,7 +57,7 @@ $modules = array(
$conditions = array(
'SOCIETE' => 1,
'PRODUCTDESC' => (! empty($conf->product->enabled) || ! empty($conf->service->enabled)),
'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled)),
'DETAILS' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled) || ! empty($conf->supplier_proposal->enabled) || ! empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || ! empty($conf->supplier_order->enabled) || ! empty($conf->supplier_invoice->enabled)),
'USERSIGN' => 1,
'MAILING' => ! empty($conf->mailing->enabled),
'MAIL' => (! empty($conf->facture->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->commande->enabled)),
@ -239,13 +239,6 @@ else
jsdump(CKEDITOR.env, "divforlog");
</script>';
}
/*
print '<!-- Result -->';
print $_POST["formtestfield"];
print '<!-- Result -->';
print $conf->global->FCKEDITOR_TEST;
*/
}
// End of page

View File

@ -36,12 +36,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
if (! $user->admin) accessforbidden();
if (!$user->admin) accessforbidden();
$action = GETPOST('action', 'aZ09');
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminihm'; // To manage different context of search
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
if (! defined("MAIN_MOTD")) define("MAIN_MOTD", "");
if (!defined("MAIN_MOTD")) define("MAIN_MOTD", "");
@ -49,24 +49,31 @@ if (! defined("MAIN_MOTD")) define("MAIN_MOTD", "");
* Action
*/
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (GETPOST('cancel', 'alpha'))
{
$action='';
$action = '';
}
if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND))
// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
$regs = array();
if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
if ($regs[1] == 'set') dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
else dolibarr_del_const($db, $regs[2], $conf->entity);
}
if ($action == 'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND))
{
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
$logofile = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
dol_delete_file($logofile);
dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
$mysoc->logo='';
$mysoc->logo = '';
/*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
dol_delete_file($logosmallfile);
@ -81,98 +88,99 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
if ($action == 'update')
{
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
/*$val=GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
if (! $val) dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
else dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);*/
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
$val=(implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
else dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", $_POST["main_size_liste_limit"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", $_POST["main_size_shortliste_limit"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", $_POST["MAIN_DISABLE_JAVASCRIPT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", $_POST["MAIN_BUTTON_HIDE_UNAUTHORIZED"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_START_WEEK", $_POST["MAIN_START_WEEK"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", $_POST["MAIN_DEFAULT_WORKING_DAYS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", $_POST["MAIN_DEFAULT_WORKING_HOURS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SHOW_LOGO", $_POST["MAIN_SHOW_LOGO"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", $_POST["MAIN_FIRSTNAME_NAME_POSITION"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"], 'chaine', 0, '', 0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"], 'chaine', 0, '', 0); // Param for all entities
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"], 'chaine', 0, '', $conf->entity);
//dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
$varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/';
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST('MAIN_BUGTRACK_ENABLELINK', 'aZ09'), 'chaine', 0, '', $conf->entity);
$varforimage = 'imagebackground'; $dirforimage = $conf->mycompany->dir_output.'/logos/';
if ($_FILES[$varforimage]["tmp_name"])
{
$reg = array();
if (preg_match('/([^\\/:]+)$/i', $_FILES[$varforimage]["name"], $reg))
{
$original_file=$reg[1];
$original_file = $reg[1];
$isimage=image_format_supported($original_file);
$isimage = image_format_supported($original_file);
if ($isimage >= 0)
{
dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file);
if (! is_dir($dirforimage))
if (!is_dir($dirforimage))
{
dol_mkdir($dirforimage);
}
$result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
$result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage.$original_file, 1, 0, $_FILES[$varforimage]['error']);
if ($result > 0)
{
dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
@ -181,7 +189,7 @@ if ($action == 'update')
{
$error++;
$langs->load("errors");
$tmparray=explode(':', $result);
$tmparray = explode(':', $result);
setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors');
}
else
@ -201,7 +209,7 @@ if ($action == 'update')
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
$_SESSION["mainmenu"] = ""; // Le gestionnaire de menu a pu changer
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
@ -212,12 +220,12 @@ if ($action == 'update')
* View
*/
$wikihelp='EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
llxHeader('', $langs->trans("Setup"), $wikihelp);
$form=new Form($db);
$formother=new FormOther($db);
$formadmin=new FormAdmin($db);
$form = new Form($db);
$formother = new FormOther($db);
$formadmin = new FormAdmin($db);
print load_fiche_titre($langs->trans("GUISetup"), '', 'title_setup');
@ -248,8 +256,7 @@ print '</tr>';
// Multilingual GUI
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
//print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
print ajax_constantonoff('MAIN_MULTILANGS');
print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
@ -268,18 +275,18 @@ print '</tr>';
// Disable javascript and ajax
print '<tr class="oddeven"><td>'.$langs->trans("DisableJavascript").'</td><td>';
print $form->selectyesno('MAIN_DISABLE_JAVASCRIPT', isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0, 1);
print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Max size of lists
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '"></td>';
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeList").'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Max size of short lists on customer card
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '"></td>';
print '<tr class="oddeven"><td>'.$langs->trans("DefaultMaxSizeShortList").'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="'.$conf->global->MAIN_SIZE_SHORTLIST_LIMIT.'"></td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
@ -294,36 +301,36 @@ print '</tr>';
// First day for weeks
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("WeekStartOnDay").'</td><td>';
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'), 'MAIN_START_WEEK', 0);
print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK : '1'), 'MAIN_START_WEEK', 0);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// DefaultWorkingDays
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingDays").'</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5').'">';
print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS : '1-5').'">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// DefaultWorkingHours
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultWorkingHours").'</td><td>';
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18').'">';
print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="'.(isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS : '9-18').'">';
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Firstname/Name
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("FirstnameNamePosition").'</td><td>';
$array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0));
$array = array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"), 1=>$langs->trans("Lastname").' '.$langs->trans("Firstname"));
print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Hide unauthorized button
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("ButtonHideUnauthorized").'</td><td>';
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0, 1);
print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED', isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED) ? $conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED : 0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
@ -346,28 +353,28 @@ print '<td width="20">&nbsp;</td>';
print '</tr>';
// Hide wiki link on login page
$pictohelp='<span class="fa fa-question-circle"></span>';
$pictohelp = '<span class="fa fa-question-circle"></span>';
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelp", $pictohelp).'</td><td>';
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0, 1);
print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK) ? $conf->global->MAIN_HELP_DISABLELINK : 0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
// Message of the day on home page
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount'));
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
complete_substitutions_array($substitutionarray, $langs);
print '<tr class="oddeven"><td class="titlefield">';
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val)
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach ($substitutionarray as $key => $val)
{
$texthelp.=$key.'<br>';
$texthelp .= $key.'<br>';
}
print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
print '</td><td colspan="2">';
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>'."\n";
@ -384,23 +391,23 @@ print '<td width="20">&nbsp;</td>';
print '</tr>';
// Message on login page
$substitutionarray=getCommonSubstitutionArray($langs, 0, array('object','objectamount','user'));
$substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
complete_substitutions_array($substitutionarray, $langs);
print '<tr class="oddeven"><td>';
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach($substitutionarray as $key => $val)
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
foreach ($substitutionarray as $key => $val)
{
$texthelp.=$key.'<br>';
$texthelp .= $key.'<br>';
}
print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
print '</td><td colspan="2">';
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME : ''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
$doleditor->Create();
print '</td></tr>'."\n";
// Hide helpcenter link on login page
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DisableLinkToHelpCenter").'</td><td>';
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0, 1);
print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK) ? $conf->global->MAIN_HELPCENTER_DISABLELINK : 0, 1);
print '</td>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
@ -409,13 +416,13 @@ print '</tr>';
print '<tr class="oddeven"><td><label for="imagebackground">'.$langs->trans("BackgroundImageLogin").' (png,jpg)</label></td><td colspan="2">';
print '<div class="centpercent inline-block">';
$disabled = '';
if (! empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) $disabled = ' disabled="disabled"';
print '<input type="file" class="flat class=minwidth200" name="imagebackground" id="imagebackground"'.$disabled.'>';
if ($disabled)
{
print '('.$langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND").') ';
}
if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removebackgroundlogin">'.img_delete($langs->trans("Delete")).'</a>';
if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) {
print ' &nbsp; ';

100
htdocs/admin/import.php Normal file
View File

@ -0,0 +1,100 @@
<?php
/* Copyright (C) 2003-2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2020 Floriazn Henry <florian.henry@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/import.php
* \ingroup import
* \brief config page module import
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'exports', 'other'));
if (!$user->admin)
accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
/*
* View
*/
$form = new Form($db);
$page_name = "ImportSetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback);
//$head = export_admin_prepare_head();
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/import.php';
$head[$h][1] = $langs->trans("Setup");
$head[$h][2] = 'setup';
$h++;
dol_fiche_head($head, 'setup', $langs->trans("ImportArea"), -1, "technic");
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="setModuleOptions">';
print '<input type="hidden" name="param" value="IMPORT_CSV_SEPARATOR_TO_USE">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td class="center" width="20">&nbsp;</td>';
print '<td class="center" width="100"></td>'."\n";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("ImportCsvSeparator").' ('.$langs->trans("ByDefault").')</td>';
print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"value\" value=\"".(empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->IMPORT_CSV_SEPARATOR_TO_USE)."\"></td>";
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</td></tr>';
print '</table>';
print '</form>';
dol_fiche_end();
// End of page
llxFooter();
$db->close();

View File

@ -51,14 +51,14 @@ if ($action == 'setvalue' && $user->admin)
$error = 0;
$db->begin();
if (!dolibarr_set_const($db, 'LDAP_GROUP_DN', GETPOST("group"), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_DN', GETPOST("group", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',$_POST["fieldname"],'chaine',0,'',$conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS', GETPOST("fieldgroupmembers"), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid"), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',GETPOST("fieldname", 'alphanohtml'),'chaine',0,'',$conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION', GETPOST("fielddescription", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS', GETPOST("fieldgroupmembers", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
// This one must be after the others
$valkey = '';

View File

@ -134,9 +134,8 @@ $head = email_admin_prepare_head();
// List of sending methods
$listofmethods = array();
$listofmethods['mail'] = 'PHP mail function';
//$listofmethods['simplemail']='Simplemail class';
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
if (version_compare(phpversion(), '7.0', '>=')) $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
if ($action == 'edit')

View File

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

View File

@ -58,6 +58,8 @@ $search_topic = GETPOST('search_topic', 'alpha');
if (!empty($user->socid)) accessforbidden();
$acts = array();
$actl = array();
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
@ -69,7 +71,7 @@ $active = 1;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOST("page", 'int');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page;
$pageprev = $page - 1;
@ -160,8 +162,8 @@ if ($conf->expedition->enabled) $elementList['shipping_send'] = $langs->t
if ($conf->reception->enabled) $elementList['reception_send'] = $langs->trans('MailToSendReception');
if ($conf->ficheinter->enabled) $elementList['fichinter_send'] = $langs->trans('MailToSendIntervention');
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send'] = $langs->trans('MailToSendSupplierRequestForQuotation');
if ($conf->fournisseur->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_order->enabled) $elementList['order_supplier_send'] = $langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || $conf->supplier_invoice->enabled) $elementList['invoice_supplier_send'] = $langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty'] = $langs->trans('MailToThirdparty');
if ($conf->adherent->enabled) $elementList['member'] = $langs->trans('MailToMember');
if ($conf->contrat->enabled) $elementList['contract'] = $langs->trans('MailToSendContract');
@ -261,28 +263,39 @@ if (empty($reshook))
$i = 0;
foreach ($listfieldinsert as $f => $value)
{
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
$keycode = $listfieldvalue[$i];
if ($value == 'label') $_POST[$keycode] = dol_escape_htmltag($_POST[$keycode]);
if ($value == 'lang') $keycode = 'langcode';
if (empty($keycode)) $keycode = $value;
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql .= ",";
if ($value == 'fk_user' && !($_POST[$keycode] > 0)) $_POST[$keycode] = '';
if ($value == 'private' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '0';
if ($value == 'position' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '1';
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql .= "null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql .= "''"; // lang must be '' if not defined so the unique key that include lang will work
else $sql .= "'".$db->escape($_POST[$keycode])."'";
//var_dump($keycode.' '.$value);
if ($i) $sql .= ", ";
if (GETPOST($keycode) == '' && $keycode != 'langcode') $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
}
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
}
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
$i++;
}
$sql .= ",1)";
$sql .= ", 1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
$_POST = array('id'=>$id); // Clean $_POST array, we keep only id
}
else
{
@ -308,6 +321,7 @@ if (empty($reshook))
{
$keycode = $listfieldvalue[$i];
if ($field == 'lang') $keycode = 'langcode';
if (empty($keycode)) $keycode = $field;
if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) $_POST['fk_user'] = '';
if ($field == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid];
@ -315,15 +329,22 @@ if (empty($reshook))
if ($field == 'content') $_POST['content'] = $_POST['content-'.$rowid];
if ($field == 'content_lines') $_POST['content_lines'] = $_POST['content_lines-'.$rowid];
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
if ($i) $sql .= ",";
if ($i) $sql .= ", ";
$sql .= $field."=";
//print $keycode.' - '.$_POST[$keycode].'<br>';
if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && empty($_POST[$keycode]))) $sql .= "null"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql .= "''"; // lang must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'private') $sql .= ((int) $_POST[$keycode]); // private must be 0 or 1
elseif ($keycode == 'position') $sql .= ((int) $_POST[$keycode]);
else $sql .= "'".$db->escape($_POST[$keycode])."'";
if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
}
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
$sql .= (int) GETPOST($keycode, 'int');
}
else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
}
$i++;
}
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";

View File

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
// Load translation files required by the page
$langs->loadLangs(array("other", "admin"));
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
if (!$user->admin) accessforbidden();
$dirstandard = array();
@ -64,12 +66,12 @@ if (GETPOST("menu_handler")) $menu_handler = GETPOST("menu_handler");
if ($action == 'update')
{
if (!$_POST['cancel'])
if (!$cancel)
{
$leftmenu = ''; $mainmenu = '';
if (!empty($_POST['menuIdParent']) && !is_numeric($_POST['menuIdParent']))
if (GETPOST('menuIdParent', 'alpha') && !is_numeric(GETPOST('menuIdParent', 'alpha')))
{
$tmp = explode('&', $_POST['menuIdParent']);
$tmp = explode('&', GETPOST('menuIdParent', 'alpha'));
foreach ($tmp as $s)
{
if (preg_match('/fk_mainmenu=/', $s))
@ -138,7 +140,7 @@ if ($action == 'update')
if ($action == 'add')
{
if ($_POST['cancel'])
if ($cancel)
{
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit;

View File

@ -930,7 +930,7 @@ if ($mode == 'marketplace')
?>
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>">
<input type="hidden" name="token" value="<?php echo newToken(); ?>">
<input type="hidden" name="mode" value="marketplace">
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>

View File

@ -24,7 +24,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
use OAuth\Common\Storage\DoliStorage;
@ -59,9 +59,18 @@ if ($action == 'setconst' && $user->admin)
{
$error = 0;
$db->begin();
foreach ($_POST['setupdriver'] as $setupconst) {
$setupconstarray = GETPOST('setupdriver', 'array');
foreach ($setupconstarray as $setupconst) {
//print '<pre>'.print_r($setupconst, true).'</pre>';
$result = dolibarr_set_const($db, $setupconst['varname'], $setupconst['value'], 'chaine', 0, '', $conf->entity);
$constname = dol_escape_htmltag($setupconst['varname']);
$constvalue = dol_escape_htmltag($setupconst['value']);
$consttype = dol_escape_htmltag($setupconst['type']);
$constnote = dol_escape_htmltag($setupconst['note']);
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
if (!$result > 0) $error++;
}
@ -119,6 +128,9 @@ $head = oauthadmin_prepare_head();
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
if (GETPOST('error')) {
setEventMessages(GETPOST('error'), null, 'errors');
}
if ($mode == 'setup' && $user->admin)
{
@ -135,17 +147,21 @@ if ($mode == 'setup' && $user->admin)
if ($key[0] == 'OAUTH_GITHUB_NAME')
{
$OAUTH_SERVICENAME = 'GitHub';
$state='user,public_repo'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
// We pass this param list in to 'state' because we need it before and after the redirect.
$shortscope = 'user,public_repo';
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://github.com/settings/applications/';
}
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
{
$OAUTH_SERVICENAME = 'Google';
$state='userinfo_email,userinfo_profile,cloud_print'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
//$state.=',gmail_full';
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
// We pass this param list in to 'state' because we need it before and after the redirect.
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
//$scope.=',gmail_full';
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
}

View File

@ -58,12 +58,13 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
@ -79,6 +80,9 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
exit;
}
@ -295,6 +299,16 @@ print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
//if (! empty($conf->global->MAIN_MULTILANGS))
//{
print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
//} else {
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
//}
print '</td></tr>';
print '</table>';
print '</div>';

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