Merge branch 'develop' of git://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
98e07b6d32
13
.github/workflows/greetings-pr.yml.disabled
vendored
Normal file
13
.github/workflows/greetings-pr.yml.disabled
vendored
Normal 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
24
.github/workflows/stale-issues-safe.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
name: "Close stale issues (bugs and feature requests)"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 21 * * *"
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: DeMoorJasper/stale@master
|
||||
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-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: 15
|
||||
operations-per-run: 100
|
||||
dry-run: false
|
||||
|
||||
25
.github/workflows/stale-issues.yml
vendored
Normal file
25
.github/workflows/stale-issues.yml
vendored
Normal 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
1
.gitignore
vendored
@ -40,3 +40,4 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/symfony/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
|
||||
@ -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
|
||||
|
||||
@ -37,10 +37,11 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
||||
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
|
||||
|
||||
146
ChangeLog
146
ChangeLog
@ -2,10 +2,73 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 11.0.2 compared to 11.0.1 *****
|
||||
FIX: #10309
|
||||
FIX: #13110
|
||||
FIX: #13118
|
||||
FIX: #13124
|
||||
FIX: #13131
|
||||
FIX: #13135
|
||||
FIX: #13146 #13198
|
||||
FIX: #13175
|
||||
FIX: #13182
|
||||
FIX: #13183
|
||||
FIX: #13184
|
||||
FIX: #13263
|
||||
FIX: #13267
|
||||
FIX: an external user can not approve
|
||||
FIX: API Get list of documents for supplier_invoice
|
||||
FIX: API to push an expense report
|
||||
FIX: API upload/download doc for expensereport
|
||||
FIX: Avoid to download the export if we just press enter to refresh form
|
||||
FIX: Bad link to template invoices
|
||||
FIX: Bad sort link in accounting report
|
||||
FIX: Bad translation for productlot EatBy and SellBy
|
||||
FIX: better method to check user rights AND usergroup rights !
|
||||
FIX: CA by product list filter
|
||||
FIX: CSS
|
||||
FIX: Disable js if no javascript
|
||||
FIX: duplicate class name into some log lines
|
||||
FIX: etrafield with visibilty=5 were not in read only.
|
||||
FIX: excess paid from situation invoices not counted when calculating remain to pay.
|
||||
FIX: Force FEC export to txt format.
|
||||
FIX: Free input for email no more visible.
|
||||
FIX: Keep assigned users in session when loading projects and tasks
|
||||
FIX: List of viewed projects too large in task widget.
|
||||
FIX: Menu truncated. Add tooltip to have all content.
|
||||
FIX: Missing field "billed" in export.
|
||||
FIX: missing "statut" for getNomUrl() function
|
||||
FIX: modFournisseur is required by modSupplierProposal
|
||||
FIX: Multicompany compatibility
|
||||
FIX: must be == and not =
|
||||
FIX: option for topbar search and bookmarks
|
||||
FIX: option MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
FIX: some responsive troubles
|
||||
FIX: round MT in accountancy books
|
||||
FIX: search with '0'
|
||||
FIX: sort link
|
||||
FIX: SQL Overload in default contact trigger.
|
||||
FIX: SQl syntax error.
|
||||
FIX: Submit of documents for supplier invoices.
|
||||
FIX: timezone must be tzserver and not tzuser as on contract card
|
||||
FIX: token in barcode tools page missing
|
||||
FIX: Bad name of trigger PROPAL_SUPPLIER_TRIGGER, should be PROPOSAL_SUPPLIER_TRIGGER
|
||||
FIX: Type of contact for event does not exists and not supported
|
||||
FIX: Type of contact not saved when creating a contact
|
||||
FIX: typo on ckeck method
|
||||
FIX: undefined function measuringUnitString in product list
|
||||
FIX: Usage of project not available in export.
|
||||
FIX: wrong test
|
||||
FIX: z-index for moretabsList with constant MAIN_MAXTABS_IN_CARD
|
||||
FIX: Use GETPOST instead of POST
|
||||
FIX: HTML Injection
|
||||
FIX: Visualization rights correction on last modified contacts box.
|
||||
FIX: Vulnerability in module from modulebuilder.
|
||||
FIX: Vulnerability reported by code16
|
||||
|
||||
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
|
||||
For Users:
|
||||
|
||||
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||
|
||||
For Developers or integrators:
|
||||
|
||||
@ -15,9 +78,86 @@ WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* PHP 5.5 is no more supported. Minimum PHP is now 5.6+.
|
||||
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
|
||||
with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
|
||||
the HTML into content (in such a case, sanitize data later)
|
||||
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
|
||||
* Reference of object including a "/" are no more allowed. It is never used by default but to support setup that introduced it, the "/" will be replaced
|
||||
by a "_" automatically when a reference is generated.
|
||||
|
||||
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
|
||||
FIX: advanced target emailing sql and ergonomy.
|
||||
FIX: After import of a website template, home page was not set.
|
||||
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-2019–17223
|
||||
FIX: CVE-2019–17223
|
||||
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:
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
------------
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -11,4 +11,4 @@ objectclass: dcObject
|
||||
objectClass: organization
|
||||
objectClass: top
|
||||
dc: my-domain
|
||||
o: Mon organisation
|
||||
o: my organisation
|
||||
|
||||
@ -12,4 +12,4 @@ objectclass: dcObject
|
||||
objectClass: organization
|
||||
objectClass: top
|
||||
dc: my-domain
|
||||
o: Mon organisation
|
||||
o: my organisation
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -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') {
|
||||
|
||||
@ -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
|
||||
*/
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 "">
|
||||
|
||||
@ -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"/>
|
||||
|
||||
215
dev/setup/eclipse/PSR-12 [built-in].xml
Normal file
215
dev/setup/eclipse/PSR-12 [built-in].xml
Normal 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="	"/>
|
||||
<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>
|
||||
578
dev/tools/dolibarr-postgres2mysql.php
Normal file
578
dev/tools/dolibarr-postgres2mysql.php
Normal 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);
|
||||
}
|
||||
@ -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
|
||||
|
||||
@ -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".
|
||||
|
||||
|
||||
12
doc/user/README-DE.md
Normal file
12
doc/user/README-DE.md
Normal 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
|
||||
@ -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();
|
||||
@ -69,8 +70,7 @@ $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.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1)
|
||||
);
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
@ -101,14 +101,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
|
||||
@ -195,7 +192,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.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 +238,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 +270,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 +327,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 +352,6 @@ 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 (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
@ -377,7 +365,6 @@ 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 (!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,15 +441,6 @@ 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']++;
|
||||
}
|
||||
|
||||
// Activated or not
|
||||
if (!empty($arrayfields['aa.active']['checked']))
|
||||
{
|
||||
|
||||
@ -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');
|
||||
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> </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.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep 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).'"> </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).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <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>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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>
|
||||
@ -54,19 +54,27 @@ $list_account_main = 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';
|
||||
@ -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,15 +189,6 @@ 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();
|
||||
if (preg_match('/---(.*)---/', $key, $reg)) {
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -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>
|
||||
@ -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);
|
||||
@ -213,7 +225,11 @@ $aarowid_prodsell_intra = $accounting->fetch('', $conf->global->ACCOUNTING_P
|
||||
$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_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"));
|
||||
@ -228,7 +244,8 @@ $pcgvercode = dol_getIdFromCode($db, $pcgverid, 'accounting_system', 'rowid', 'p
|
||||
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.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";
|
||||
@ -236,6 +253,14 @@ $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 . "'";
|
||||
}
|
||||
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 . "'";
|
||||
@ -253,6 +278,14 @@ 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);
|
||||
@ -356,6 +389,13 @@ if ($result)
|
||||
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 '<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>';
|
||||
@ -386,7 +426,7 @@ if ($result)
|
||||
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
|
||||
@ -416,10 +456,16 @@ if ($result)
|
||||
} 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 ');
|
||||
} 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);
|
||||
@ -457,22 +503,22 @@ if ($result)
|
||||
$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_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_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_id = $aarowid_servsell_export;
|
||||
}
|
||||
else {
|
||||
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
@ -482,11 +528,40 @@ if ($result)
|
||||
|
||||
// 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') {
|
||||
@ -540,6 +621,26 @@ if ($result)
|
||||
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">';
|
||||
|
||||
@ -42,7 +42,6 @@ $page = 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;
|
||||
@ -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("Opening Balance", $_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> </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> </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> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -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';
|
||||
@ -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");
|
||||
|
||||
@ -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']++;
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ class AccountancyExport
|
||||
* @param int $type Format id
|
||||
* @return string Format code
|
||||
*/
|
||||
private static function getFormatCode($type)
|
||||
public static function getFormatCode($type)
|
||||
{
|
||||
$formatcode = array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => 'csv',
|
||||
@ -239,6 +239,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';
|
||||
|
||||
|
||||
@ -935,6 +936,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 +952,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 +971,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
|
||||
|
||||
@ -53,11 +53,6 @@ class AccountancySystem
|
||||
*/
|
||||
public $pcg_type;
|
||||
|
||||
/**
|
||||
* @var string pcg subtype
|
||||
*/
|
||||
public $pcg_subtype;
|
||||
|
||||
/**
|
||||
* @var string Accountancy System numero
|
||||
*/
|
||||
|
||||
@ -90,11 +90,6 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
public $pcg_type;
|
||||
|
||||
/**
|
||||
* @var string pcg subtype
|
||||
*/
|
||||
public $pcg_subtype;
|
||||
|
||||
/**
|
||||
* @var string account number
|
||||
*/
|
||||
@ -167,7 +162,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";
|
||||
$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 +193,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;
|
||||
@ -240,8 +234,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 +245,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 +254,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";
|
||||
@ -279,7 +266,6 @@ class AccountingAccount extends CommonObject
|
||||
$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) . "'");
|
||||
@ -341,17 +327,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) . "'" : "''");
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -211,7 +211,8 @@ if (empty($chartaccountcode))
|
||||
$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.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_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";
|
||||
$parameters = array();
|
||||
@ -222,7 +223,9 @@ $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$chartaccountcode."' AND aa.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$chartaccountcode."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$chartaccountcode."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
// Add search filter like
|
||||
@ -414,7 +417,6 @@ 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;
|
||||
@ -426,28 +428,67 @@ if ($result) {
|
||||
$facturefourn_static->type = $objp->type;
|
||||
|
||||
$code_buy_p_notset = '';
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$objp->aarowid_suggest = ''; // Will be set later
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
if ($objp->type_l == 1) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_s;
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
} elseif ($objp->type_l == 0) {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : '');
|
||||
if ($objp->aarowid == '')
|
||||
$objp->aarowid_suggest = $aarowid_p;
|
||||
if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'eec';
|
||||
} else {
|
||||
$objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : '');
|
||||
$suggestedaccountingaccountbydefaultfor = 'export';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($objp->code_buy_l == -1) $objp->code_buy_l = '';
|
||||
if ($objp->code_sell_l == -1) $objp->code_sell_l = '';
|
||||
|
||||
if (!empty($objp->code_buy)) {
|
||||
$objp->code_buy_p = $objp->code_buy; // Code on product
|
||||
// Search suggested account for product/service
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
$objp->code_buy_p = $objp->code_buy;
|
||||
$objp->aarowid_suggest = $objp->aarowid;
|
||||
$suggestedaccountingaccountfor = '';
|
||||
} else {
|
||||
if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale
|
||||
$objp->code_buy_p = $objp->code_buy_intra;
|
||||
$objp->aarowid_suggest = $objp->aarowid_intra;
|
||||
$suggestedaccountingaccountfor = 'eec';
|
||||
} else { // Foreign sale
|
||||
$objp->code_buy_p = $objp->code_buy_export;
|
||||
$objp->aarowid_suggest = $objp->aarowid_export;
|
||||
$suggestedaccountingaccountfor = 'export';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($objp->code_buy_p)) {
|
||||
// Value was defined previously
|
||||
} else {
|
||||
$code_buy_p_notset = 'color:orange';
|
||||
}
|
||||
if (empty($objp->code_buy_l) && empty($objp->code_buy_p)) $code_buy_p_notset = 'color:red';
|
||||
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
// $objp->code_buy_l is now default code of product/service
|
||||
// $objp->code_buy_p is now code of product/service
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -520,6 +561,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 +596,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">
|
||||
|
||||
@ -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,13 +29,15 @@ $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');
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
if ($this->getFormatCode($formatexportset) == "fec" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
|
||||
if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
|
||||
{
|
||||
// FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
|
||||
if (empty($search_date_end))
|
||||
@ -44,22 +46,22 @@ if ($this->getFormatCode($formatexportset) == "fec" && $type_export == "general_
|
||||
$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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,11 @@ class Subscription extends CommonObject
|
||||
*/
|
||||
public $table_element='subscription';
|
||||
|
||||
/**
|
||||
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table
|
||||
*/
|
||||
public $ismultientitymanaged = 'fk_adherent@adherent';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
@ -88,6 +93,21 @@ class Subscription extends CommonObject
|
||||
*/
|
||||
public $fk_bank;
|
||||
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||
'datef' =>array('type'=>'date', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
|
||||
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
|
||||
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||
'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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">';
|
||||
|
||||
|
||||
@ -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"];
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,6 +47,7 @@ $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');
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -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 ' ';
|
||||
print '</div><div class="inline-block valignmiddle">';
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&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 ' ';
|
||||
print '</div><div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&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
|
||||
|
||||
@ -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";
|
||||
|
||||
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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">
|
||||
@ -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">';
|
||||
|
||||
@ -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"));
|
||||
|
||||
|
||||
|
||||
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -58,6 +58,13 @@ if (GETPOST('cancel', 'alpha'))
|
||||
$action='';
|
||||
}
|
||||
|
||||
// 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);
|
||||
@ -81,15 +88,15 @@ 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_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()))));
|
||||
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
|
||||
@ -141,25 +148,26 @@ if ($action == 'update')
|
||||
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);
|
||||
|
||||
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];
|
||||
@ -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"> </td>';
|
||||
print '</tr>';
|
||||
@ -268,7 +275,7 @@ 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"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -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 = '';
|
||||
|
||||
@ -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')
|
||||
|
||||
@ -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');
|
||||
@ -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."'";
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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>';
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$entity=$conf->entity;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -70,14 +72,12 @@ print '<span class="opacitymedium">'.$langs->trans("DefaultRightsDesc")." ".$lan
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Charge les modules soumis a permissions
|
||||
// Search all modules with permission and reload permissions def.
|
||||
$modules = array();
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
||||
//print $dir."\n<br>";
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
@ -102,7 +102,7 @@ foreach ($modulesdir as $dir)
|
||||
// Load all permissions
|
||||
if ($objMod->rights_class)
|
||||
{
|
||||
$ret = $objMod->insert_permissions(0);
|
||||
$ret = $objMod->insert_permissions(0, $entity);
|
||||
$modules[$objMod->rights_class] = $objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
@ -122,35 +122,58 @@ dol_fiche_head($head, 'default', $langs->trans("Security"), -1);
|
||||
// Show warning about external users
|
||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
|
||||
print "\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Show permissions lines
|
||||
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td class="center"> </td>';
|
||||
print '<td class="center">'.$langs->trans("Default").'</td>';
|
||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
|
||||
$sql = "SELECT r.id, r.libelle as label, r.module, r.module_position, r.perms, r.subperms, r.bydefault";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " AND r.entity = ".$entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
$sql .= " ORDER BY r.module, r.id";
|
||||
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$oldmod = "";
|
||||
$oldmod = '';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||
if (!$modules[$obj->module])
|
||||
// If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it
|
||||
if (empty($modules[$obj->module]))
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Save field module_position in database if value is still zero
|
||||
if (empty($obj->module_position))
|
||||
{
|
||||
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
|
||||
{
|
||||
// TODO Define familyposition
|
||||
$family = $modules[$obj->module]->family_position;
|
||||
$familyposition = 0;
|
||||
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.",";
|
||||
$sqlupdate.= " family_position = ".$familyposition;
|
||||
$sqlupdate.= " WHERE module_position = 0 AND module = '".$db->escape($obj->module)."'";
|
||||
$db->query($sqlupdate);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if permission we found is inside a module definition. If not, we discard it.
|
||||
$found = false;
|
||||
foreach ($modules[$obj->module]->rights as $key => $val)
|
||||
@ -169,49 +192,65 @@ if ($result)
|
||||
}
|
||||
|
||||
// Break found, it's a new module to catch
|
||||
if ($oldmod <> $obj->module)
|
||||
if (isset($obj->module) && ($oldmod <> $obj->module))
|
||||
{
|
||||
$oldmod = $obj->module;
|
||||
|
||||
// Break detected, we get objMod
|
||||
$objMod = $modules[$obj->module];
|
||||
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Permission").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Default").'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
// Show break line
|
||||
print '<tr class="oddeven trforbreak">';
|
||||
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
|
||||
print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"></a>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"> </a>';
|
||||
|
||||
// Picto and label of module
|
||||
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
|
||||
//print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||
//print '<a name="'.$objMod->getName().'"> </a>';
|
||||
print '</td>';
|
||||
|
||||
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->libelle));
|
||||
// Tick
|
||||
if ($obj->bydefault == 1)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Permission and tick
|
||||
print '<td>'.$perm_libelle.'</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($obj->bydefault == 1)
|
||||
{
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
print '</td><td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
print '</td><td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
else dol_print_error($db);
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -234,7 +234,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
|
||||
@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("users","admin","other"));
|
||||
$langs->loadLangs(array("users", "admin", "other"));
|
||||
|
||||
if (! $user->admin)
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
|
||||
|
||||
@ -44,8 +44,8 @@ $action=GETPOST('action', 'alpha');
|
||||
|
||||
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
$code = $reg[1];
|
||||
$value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -56,7 +56,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
$code=$reg[1];
|
||||
$code = $reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -70,8 +70,8 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
|
||||
elseif ($action == 'updateform')
|
||||
{
|
||||
$res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"], 'chaine', 0, '', $conf->entity);
|
||||
$res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"], 'chaine', 0, '', $conf->entity);
|
||||
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ elseif ($action == 'updateform')
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$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("Miscellaneous"), $wikihelp);
|
||||
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup');
|
||||
@ -97,7 +97,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateform">';
|
||||
|
||||
$head=security_prepare_head();
|
||||
$head = security_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'misc', $langs->trans("Security"), -1);
|
||||
|
||||
@ -115,7 +115,7 @@ print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
|
||||
print '<td class="right">';
|
||||
if (function_exists("imagecreatefrompng"))
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA');
|
||||
}
|
||||
@ -142,7 +142,7 @@ print '</td></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
|
||||
print '<td class="right">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS');
|
||||
}
|
||||
@ -173,8 +173,8 @@ print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$sessiontimeout=ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout;
|
||||
$sessiontimeout = ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SessionTimeOut").'</td><td class="right">';
|
||||
print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor")));
|
||||
@ -185,8 +185,8 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$sessiontimeout=ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE="";
|
||||
$sessiontimeout = ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE = "";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MAIN_APPLICATION_TITLE").'</td><td class="right">';
|
||||
print '</td>';
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors"));
|
||||
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
@ -46,14 +48,13 @@ $action = GETPOST('action', 'aZ09');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && empty($_POST["cancel"]))
|
||||
if ($action == 'update' && !$cancel)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", $_POST["MAIN_DISABLE_ALL_SMS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", GETPOST("MAIN_DISABLE_ALL_SMS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", $_POST["MAIN_SMS_SENDMODE"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphahtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", $_POST["MAIN_MAIL_SMS_FROM"], 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", $_POST["MAIN_MAIL_AUTOCOPY_TO"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", GETPOST("MAIN_MAIL_SMS_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -68,15 +69,15 @@ if ($action == 'send' && !$_POST['cancel'])
|
||||
$error = 0;
|
||||
|
||||
$smsfrom = '';
|
||||
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms");
|
||||
if (empty($smsfrom)) $smsfrom = GETPOST("fromname");
|
||||
$sendto = GETPOST("sendto");
|
||||
$body = GETPOST('message');
|
||||
$deliveryreceipt = GETPOST("deliveryreceipt");
|
||||
$deferred = GETPOST('deferred');
|
||||
$priority = GETPOST('priority');
|
||||
$class = GETPOST('class');
|
||||
$errors_to = GETPOST("errorstosms");
|
||||
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms", 'alphanohtml');
|
||||
if (empty($smsfrom)) $smsfrom = GETPOST("fromname", 'alphanohtml');
|
||||
$sendto = GETPOST("sendto", 'alphanohtml');
|
||||
$body = GETPOST('message', 'alphanohtml');
|
||||
$deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml');
|
||||
$deferred = GETPOST('deferred', 'alphanohtml');
|
||||
$priority = GETPOST('priority', 'alphanohtml');
|
||||
$class = GETPOST('class', 'alphanohtml');
|
||||
$errors_to = GETPOST("errorstosms", 'alphanohtml');
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
|
||||
|
||||
@ -35,10 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "members", "mailmanspip"));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
$type=array('yesno','texte','chaine');
|
||||
$type = array('yesno', 'texte', 'chaine');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@ -50,25 +50,27 @@ $action = GETPOST('action', 'aZ09');
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constname=GETPOST("constname");
|
||||
$constvalue=GETPOST("constvalue");
|
||||
$constnamearray = GETPOST("constname", 'array');
|
||||
$constvaluearray = GETPOST("constvalue", 'array');
|
||||
$consttypearray = GETPOST("consttype", 'array');
|
||||
$constnotearray = GETPOST("constnote", 'array');
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
foreach($_POST['constname'] as $key => $val)
|
||||
foreach ($constnamearray as $key => $val)
|
||||
{
|
||||
$constname=$_POST["constname"][$key];
|
||||
$constvalue=$_POST["constvalue"][$key];
|
||||
$consttype=$_POST["consttype"][$key];
|
||||
$constnote=$_POST["constnote"][$key];
|
||||
$constname = dol_escape_htmltag($constnamearray[$key]);
|
||||
$constvalue = dol_escape_htmltag($constvaluearray[$key]);
|
||||
$consttype = dol_escape_htmltag($consttypearray[$key]);
|
||||
$constnote = dol_escape_htmltag($constnotearray[$key]);
|
||||
|
||||
$res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
|
||||
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -82,7 +84,7 @@ if ($action == 'update' || $action == 'add')
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($action == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
|
||||
$result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
@ -92,7 +94,7 @@ if ($action == 'set')
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($action == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db, $_GET["name"], $conf->entity);
|
||||
$result = dolibarr_del_const($db, $_GET["name"], $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
@ -105,12 +107,12 @@ if ($action == 'unset')
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='';
|
||||
$help_url = '';
|
||||
|
||||
llxHeader('', $langs->trans("MailmanSpipSetup"), $help_url);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("MailmanSpipSetup"), $linkback, 'title_setup');
|
||||
|
||||
|
||||
@ -120,7 +122,7 @@ $head = mailmanspip_admin_prepare_head();
|
||||
/*
|
||||
* Spip
|
||||
*/
|
||||
if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
if (!empty($conf->global->ADHERENT_USE_SPIP))
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -129,12 +131,12 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), -1, 'user');
|
||||
|
||||
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
$link = '<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Disable");
|
||||
$link.=img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$link.='</a>';
|
||||
$link .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$link .= '</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
$constantes = array(
|
||||
'ADHERENT_SPIP_SERVEUR',
|
||||
'ADHERENT_SPIP_DB',
|
||||
'ADHERENT_SPIP_USER',
|
||||
@ -156,10 +158,10 @@ else
|
||||
{
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
$link='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
$link = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Activate");
|
||||
$link.=img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$link.='</a>';
|
||||
$link .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$link .= '</a>';
|
||||
print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -171,7 +171,7 @@ if ($action == 'setmod')
|
||||
if ($action == 'addcat')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->CreateCategory($user, $_POST["cat"]);
|
||||
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
|
||||
}
|
||||
|
||||
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||
|
||||
@ -54,6 +54,8 @@ $specimenthirdparty->initAsSpecimen();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
@ -163,7 +165,7 @@ elseif ($action == 'setmod')
|
||||
elseif ($action == 'addcat')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->CreateCategory($user, $_POST["cat"]);
|
||||
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
|
||||
}
|
||||
|
||||
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||
|
||||
@ -197,6 +197,7 @@ dol_fiche_end();
|
||||
|
||||
print load_fiche_titre($langs->trans("TicketNumberingModules"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
@ -287,7 +288,9 @@ foreach ($dirmodels as $reldir) {
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
|
||||
@ -167,7 +167,7 @@ $head = ticketAdminPrepareHead();
|
||||
|
||||
dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a href="'.dol_buildpath('/public/ticket/index.php', 1).'" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess").'</span> : <a class="wordbreak" href="'.dol_buildpath('/public/ticket/index.php', 1).'" target="_blank" >'.dol_buildpath('/public/ticket/index.php', 2).'</a>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -176,14 +176,14 @@ $enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
|
||||
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
@ -200,6 +200,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
print '<input type="hidden" name="action" value="setvarother">';
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td>';
|
||||
print '<td class="left">';
|
||||
@ -279,7 +280,9 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '</form>';
|
||||
@ -288,6 +291,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
// Admin var of module
|
||||
print load_fiche_titre($langs->trans("TicketParamMail"));
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'" enctype="multipart/form-data" >';
|
||||
@ -369,13 +373,14 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
|
||||
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
|
||||
print '<tr><td>'.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").'</label>';
|
||||
print '</td><td>';
|
||||
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'" size="40" ></td>';
|
||||
print '<input type="text" class="minwidth500" name="TICKET_URL_PUBLIC_INTERFACE" value="'.$conf->global->TICKET_URL_PUBLIC_INTERFACE.'"></td>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
|
||||
|
||||
@ -173,9 +173,6 @@ if ($errormsg)
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
// Redirect t backup page
|
||||
header("Location: dolibarr_export.php");
|
||||
|
||||
|
||||
@ -34,13 +34,13 @@ require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadlangs(array('errors', 'admin', 'companies', 'website'));
|
||||
|
||||
$action=GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view';
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$rowid=GETPOST('rowid', 'alpha');
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
|
||||
$id=1;
|
||||
$id = 1;
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@ -52,7 +52,7 @@ $actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$status = 1;
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
@ -65,55 +65,55 @@ $pagenext = $page + 1;
|
||||
$hookmanager->initHooks(array('website'));
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
$tabname = array();
|
||||
$tabname[1] = MAIN_DB_PREFIX."website";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
$tablib = array();
|
||||
$tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql = array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX.'website as f WHERE f.entity IN ('.getEntity('website').')';
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[1] ="ref ASC";
|
||||
$tabsqlsort = array();
|
||||
$tabsqlsort[1] = "ref ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield = array();
|
||||
$tabfield[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[1] = "ref,description,virtualhost";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
|
||||
|
||||
// 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 = array();
|
||||
$tabrowid[1] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
$tabcond[1] = (! empty($conf->website->enabled));
|
||||
$tabcond = array();
|
||||
$tabcond[1] = (!empty($conf->website->enabled));
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>'));
|
||||
$tabhelp = array();
|
||||
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/<i>websiteref</i>'));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
$tabfieldcheck[1] = array();
|
||||
$tabfieldcheck = array();
|
||||
$tabfieldcheck[1] = array();
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
$sourceList = array();
|
||||
|
||||
|
||||
/*
|
||||
@ -123,35 +123,35 @@ $sourceList=array();
|
||||
// Actions add or modify a website
|
||||
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
$listfield=explode(',', $tabfield[$id]);
|
||||
$listfieldinsert=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',', $tabfieldvalue[$id]);
|
||||
$listfield = explode(',', $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 == 'ref' && (! isset($_POST[$value]) || $_POST[$value]==''))
|
||||
if ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == ''))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
}
|
||||
elseif ($value == 'ref' && ! preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (! empty($_POST['ref']))
|
||||
if (!empty($_POST['ref']))
|
||||
{
|
||||
$websitekey=strtolower($_POST['ref']);
|
||||
$websitekey = strtolower($_POST['ref']);
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
@ -160,13 +160,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);
|
||||
}
|
||||
@ -181,16 +181,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.=",status)";
|
||||
$sql.= " VALUES(";
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $tabrowid[$id].",";
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",status)";
|
||||
$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 == 'entity') {
|
||||
@ -199,19 +199,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
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');
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
unset($_POST); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -227,22 +227,22 @@ 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"; }
|
||||
|
||||
$db->begin();
|
||||
|
||||
$website=new Website($db);
|
||||
$rowid=GETPOST('rowid', 'int');
|
||||
$website = new Website($db);
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$website->fetch($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)
|
||||
@ -250,13 +250,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($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;
|
||||
@ -266,8 +266,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile=DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||
$destfile=DOL_DATA_ROOT.'/website/'.$newname;
|
||||
$srcfile = DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||
$destfile = DOL_DATA_ROOT.'/website/'.$newname;
|
||||
|
||||
if (dol_is_dir($destfile))
|
||||
{
|
||||
@ -294,7 +294,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
}
|
||||
@ -313,8 +313,8 @@ 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"; }
|
||||
|
||||
$website = new Website($db);
|
||||
$website->fetch($rowid);
|
||||
@ -332,7 +332,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid ='".$rowid."'";
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
@ -358,8 +358,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 status = 1 WHERE rowid ='".$rowid."'";
|
||||
@ -375,8 +375,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 status = 0 WHERE rowid ='".$rowid."'";
|
||||
@ -396,16 +396,16 @@ if ($action == $acts[1])
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
llxHeader('', $langs->trans("WebsiteSetup"));
|
||||
|
||||
$titre=$langs->trans("WebsiteSetup");
|
||||
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$titre = $langs->trans("WebsiteSetup");
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($titre, $linkback, 'title_setup');
|
||||
|
||||
// Onglets
|
||||
$head=array();
|
||||
$head = array();
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/website.php";
|
||||
@ -428,7 +428,7 @@ print "<br>\n";
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@ -438,12 +438,12 @@ if ($action == 'delete')
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
$sql.=$db->plimit($limit+1, $offset);
|
||||
$sql = $tabsql[$id];
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -452,10 +452,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">';
|
||||
@ -463,15 +463,15 @@ 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
|
||||
$align='';
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$align = '';
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td class="'.$align.'">';
|
||||
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]))
|
||||
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]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
@ -479,7 +479,7 @@ if ($id)
|
||||
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 colspan="4">';
|
||||
@ -496,7 +496,7 @@ if ($id)
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val, 'alpha'))
|
||||
$obj->$val=GETPOST($val);
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
@ -510,7 +510,7 @@ if ($id)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+2;
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -518,7 +518,7 @@ if ($id)
|
||||
|
||||
|
||||
// List of websites in database
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -540,10 +540,10 @@ if ($id)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$showfield=1; // Par defaut
|
||||
$align="left";
|
||||
$sortable=1;
|
||||
$valuetoshow='';
|
||||
$showfield = 1; // Par defaut
|
||||
$align = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
/*
|
||||
$tmparray=getLabelOfField($fieldlist[$field]);
|
||||
$showfield=$tmp['showfield'];
|
||||
@ -551,20 +551,20 @@ if ($id)
|
||||
$align=$tmp['align'];
|
||||
$sortable=$tmp['sortable'];
|
||||
*/
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
|
||||
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), "", "align=".$align, $sortfield, $sortorder);
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page?'page='.$page.'&':''), "", 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
@ -575,34 +575,34 @@ 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)))
|
||||
{
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editWebsiteFieldlist', $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('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
|
||||
print '<td colspan="3" class="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </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).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <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('viewWebsiteFieldlist', $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('viewWebsiteFieldlist', $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;
|
||||
$align="left";
|
||||
$fieldname=$fieldlist[$field];
|
||||
$valuetoshow=$obj->$fieldname;
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$fieldname = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$fieldname;
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
@ -610,14 +610,14 @@ if ($id)
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1; $isdisable=1; // true by default
|
||||
if ($obj->status) $iserasable=0; // We can't delete a website on. Disable it first.
|
||||
$iserasable = 1; $isdisable = 1; // true by default
|
||||
if ($obj->status) $iserasable = 0; // We can't delete a website on. Disable it first.
|
||||
|
||||
$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) : '').'&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
@ -660,10 +660,10 @@ $db->close();
|
||||
*/
|
||||
function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $conf, $langs, $db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
global $elementList, $sourceList, $localtax_typeList;
|
||||
global $bc;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
@ -678,18 +678,18 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->$fieldname)) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->$fieldname)?$obj->$fieldname:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->$fieldname) ? $obj->$fieldname : '').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size='';
|
||||
if ($fieldlist[$field]=='code') $size='size="8" ';
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='size="32" ';
|
||||
if ($fieldlist[$field]=='tracking') $size='size="92" ';
|
||||
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldname)?$obj->$fieldname:'').'" name="'.$fieldlist[$field].'">';
|
||||
$size = '';
|
||||
if ($fieldlist[$field] == 'code') $size = 'size="8" ';
|
||||
if ($fieldlist[$field] == 'position') $size = 'size="4" ';
|
||||
if ($fieldlist[$field] == 'libelle') $size = 'size="32" ';
|
||||
if ($fieldlist[$field] == 'tracking') $size = 'size="92" ';
|
||||
if ($fieldlist[$field] == 'sortorder') $size = 'size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldname) ? $obj->$fieldname : '').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,8 @@
|
||||
* \file htdocs/api/admin/explorer.php
|
||||
*/
|
||||
|
||||
use Luracast\Restler\Routes;
|
||||
|
||||
require_once '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||
|
||||
@ -96,7 +96,7 @@ llxHeader();
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
|
||||
|
||||
print $langs->trans("ApiDesc")."<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("ApiDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -130,7 +130,9 @@ print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("RESTRICT_API_ON_IP").'</td>';
|
||||
print '<td>'.$langs->trans("RESTRICT_ON_IP");
|
||||
print ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTRICT_ON_IP).'"></td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></td>';
|
||||
|
||||
@ -60,10 +60,9 @@ class Documents extends DolibarrApi
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 200
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*
|
||||
* @url GET /download
|
||||
*/
|
||||
@ -81,7 +80,18 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity = $conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
// If future, all object should use this to define path of documents.
|
||||
/*
|
||||
$tmpreldir = '';
|
||||
if ($modulepart == 'supplier_invoice') {
|
||||
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
|
||||
}
|
||||
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */
|
||||
$relativefile = $original_file;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
@ -118,12 +128,11 @@ class Documents extends DolibarrApi
|
||||
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws 500
|
||||
* @throws 501
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 200
|
||||
* @throws RestException 500
|
||||
* @throws RestException 501
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*
|
||||
* @url PUT /builddoc
|
||||
*/
|
||||
@ -148,7 +157,18 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity = $conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
// If future, all object should use this to define path of documents.
|
||||
/*
|
||||
$tmpreldir = '';
|
||||
if ($modulepart == 'supplier_invoice') {
|
||||
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
|
||||
}
|
||||
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */
|
||||
$relativefile = $original_file;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
@ -230,18 +250,17 @@ class Documents extends DolibarrApi
|
||||
/**
|
||||
* Return the list of documents of a dedicated element (from its ID or Ref)
|
||||
*
|
||||
* @param string $modulepart Name of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'shipment', 'project', ...)
|
||||
* @param string $modulepart Name of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...)
|
||||
* @param int $id ID of element
|
||||
* @param string $ref Ref of element
|
||||
* @param string $sortfield Sort criteria ('','fullname','relativename','name','date','size')
|
||||
* @param string $sortorder Sort order ('asc' or 'desc')
|
||||
* @return array Array of documents with path
|
||||
*
|
||||
* @throws 200
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @url GET /
|
||||
*/
|
||||
@ -275,6 +294,23 @@ class Documents extends DolibarrApi
|
||||
|
||||
$upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
|
||||
}
|
||||
elseif ($modulepart == 'user')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
|
||||
// Can get doc if has permission to read all user or if it is user itself
|
||||
if (!DolibarrApiAccess::$user->rights->user->user->lire && DolibarrApiAccess::$user->id != $id) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$object = new User($this->db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'User not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id;
|
||||
}
|
||||
elseif ($modulepart == 'adherent' || $modulepart == 'member')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
@ -355,6 +391,24 @@ class Documents extends DolibarrApi
|
||||
|
||||
$upload_dir = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
|
||||
}
|
||||
elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
|
||||
{
|
||||
$modulepart = 'supplier_invoice';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->fournisseur->facture->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$object = new FactureFournisseur($this->db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->fournisseur->dir_output."/facture/".get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
elseif ($modulepart == 'produit' || $modulepart == 'product')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
@ -387,6 +441,22 @@ class Documents extends DolibarrApi
|
||||
|
||||
$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
elseif ($modulepart == 'expensereport')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
|
||||
if (!DolibarrApiAccess::$user->rights->expensereport->read && !DolibarrApiAccess::$user->rights->expensereport->read) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$object = new ExpenseReport($this->db);
|
||||
$result = $object->fetch($id, $ref);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Expense report not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
|
||||
@ -418,8 +488,9 @@ class Documents extends DolibarrApi
|
||||
/**
|
||||
* Upload a file.
|
||||
*
|
||||
* Test sample 1: { "filename": "mynewfile.txt", "modulepart": "facture", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample 2: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
|
||||
* Test sample for invoice: { "filename": "mynewfile.txt", "modulepart": "invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample for supplier invoice: { "filename": "mynewfile.txt", "modulepart": "supplier_invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }.
|
||||
* Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
|
||||
*
|
||||
* @param string $filename Name of file to create ('FA1705-0123.txt')
|
||||
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
|
||||
@ -430,11 +501,10 @@ class Documents extends DolibarrApi
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @return string
|
||||
*
|
||||
* @throws 200
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @url POST /upload
|
||||
*/
|
||||
@ -476,6 +546,13 @@ class Documents extends DolibarrApi
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
|
||||
{
|
||||
$modulepart = 'supplier_invoice';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$object = new FactureFournisseur($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'project')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
@ -510,6 +587,11 @@ class Documents extends DolibarrApi
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$object = new Product($this->db);
|
||||
}
|
||||
elseif ($modulepart == 'expensereport')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
$object = new ExpenseReport($this->db);
|
||||
}
|
||||
// TODO Implement additional moduleparts
|
||||
else
|
||||
{
|
||||
@ -535,6 +617,12 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(404, 'The object '.$modulepart." with ref '".$ref."' was not found.");
|
||||
}
|
||||
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
// If future, all object should use this to define path of documents.
|
||||
if ($modulepart == 'supplier_invoice') {
|
||||
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
|
||||
}
|
||||
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write');
|
||||
@ -610,10 +698,9 @@ class Documents extends DolibarrApi
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: PRODUCT-REF-999/IMAGE-999.jpg)
|
||||
* @return array List of documents
|
||||
*
|
||||
* @throws 400
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 200
|
||||
* @throws RestException 400
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*
|
||||
* @url DELETE /
|
||||
*/
|
||||
@ -631,7 +718,18 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity = $conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
// Special cases that need to use get_exdir to get real dir of object
|
||||
// If future, all object should use this to define path of documents.
|
||||
/*
|
||||
$tmpreldir = '';
|
||||
if ($modulepart == 'supplier_invoice') {
|
||||
$tmpreldir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier');
|
||||
}
|
||||
|
||||
$relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); */
|
||||
$relativefile = $original_file;
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
|
||||
@ -48,9 +48,8 @@ class Login
|
||||
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
||||
* @return array Response status and user token
|
||||
*
|
||||
* @throws 200
|
||||
* @throws 403
|
||||
* @throws 500
|
||||
* @throws RestException 403
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @url GET /
|
||||
* @url POST /
|
||||
|
||||
@ -59,8 +59,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @return array [List of ordering methods]
|
||||
*
|
||||
* @throws 400 RestException
|
||||
* @throws 200 OK
|
||||
* @throws RestException 400
|
||||
*/
|
||||
public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
@ -121,8 +120,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @return array [List of payment types]
|
||||
*
|
||||
* @throws 400 RestException
|
||||
* @throws 200 OK
|
||||
* @throws RestException 400
|
||||
*/
|
||||
public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
@ -339,8 +337,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @return array [List of availability]
|
||||
*
|
||||
* @throws 400 RestException
|
||||
* @throws 200 OK
|
||||
* @throws RestException 400
|
||||
*/
|
||||
public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
@ -557,6 +554,70 @@ class Setup extends DolibarrApi
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of Expense Report types.
|
||||
*
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Number of items per page
|
||||
* @param int $page Page number (starting from zero)
|
||||
* @param string $module To filter on module
|
||||
* @param int $active Event's type is active or not {@min 0} {@max 1}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)"
|
||||
* @return array List of expense report types
|
||||
*
|
||||
* @url GET dictionary/expensereport_types
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getListOfExpenseReportsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
|
||||
{
|
||||
$list = array();
|
||||
|
||||
$sql = "SELECT id, code, label, accountancy_code, active, module, position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t";
|
||||
$sql .= " WHERE t.active = ".$active;
|
||||
if ($module) $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
|
||||
// Add sql filters
|
||||
if ($sqlfilters)
|
||||
{
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters))
|
||||
{
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
|
||||
if ($limit) {
|
||||
if ($page < 0) {
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql .= $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$min = min($num, ($limit <= 0 ? $num : $limit));
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
$list[] = $this->db->fetch_object($result);
|
||||
}
|
||||
} else {
|
||||
throw new RestException(503, 'Error when retrieving list of expense report types : '.$this->db->lasterror());
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the list of contacts types.
|
||||
*
|
||||
@ -908,8 +969,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @return array List of payment terms
|
||||
*
|
||||
* @throws 400 RestException
|
||||
* @throws 200 OK
|
||||
* @throws RestException 400
|
||||
*/
|
||||
public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
@ -969,8 +1029,7 @@ class Setup extends DolibarrApi
|
||||
*
|
||||
* @return array List of shipping methods
|
||||
*
|
||||
* @throws 400 RestException
|
||||
* @throws 200 OK
|
||||
* @throws RestException 400
|
||||
*/
|
||||
public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||
{
|
||||
|
||||
@ -68,9 +68,9 @@ class AssetType extends CommonObject
|
||||
public $note;
|
||||
|
||||
/** @var array Array of asset */
|
||||
public $asset=array();
|
||||
public $asset = array();
|
||||
|
||||
public $fields=array(
|
||||
public $fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||
@ -104,9 +104,9 @@ class AssetType extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->label=trim($this->label);
|
||||
$this->label = trim($this->label);
|
||||
$this->accountancy_code_asset = trim($this->accountancy_code_asset);
|
||||
$this->accountancy_code_depreciation_asset = trim($this->accountancy_code_depreciation_asset);
|
||||
$this->accountancy_code_depreciation_expense = trim($this->accountancy_code_depreciation_expense);
|
||||
@ -114,20 +114,20 @@ class AssetType extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_type (";
|
||||
$sql.= "label";
|
||||
$sql.= ", accountancy_code_asset";
|
||||
$sql.= ", accountancy_code_depreciation_asset";
|
||||
$sql.= ", accountancy_code_depreciation_expense";
|
||||
$sql.= ", note";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->label)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_asset)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
|
||||
$sql.= ", '".$this->db->escape($this->note)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
$sql .= "label";
|
||||
$sql .= ", accountancy_code_asset";
|
||||
$sql .= ", accountancy_code_depreciation_asset";
|
||||
$sql .= ", accountancy_code_depreciation_expense";
|
||||
$sql .= ", note";
|
||||
$sql .= ", entity";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->escape($this->label)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_asset)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_depreciation_asset)."'";
|
||||
$sql .= ", '".$this->db->escape($this->accountancy_code_depreciation_expense)."'";
|
||||
$sql .= ", '".$this->db->escape($this->note)."'";
|
||||
$sql .= ", ".$conf->entity;
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog("Asset_type::create", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -142,15 +142,15 @@ class AssetType extends CommonObject
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (! $notrigger)
|
||||
if (!$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ASSET_TYPE_CREATE', $user);
|
||||
$result = $this->call_trigger('ASSET_TYPE_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
@ -164,7 +164,7 @@ class AssetType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -181,45 +181,45 @@ class AssetType extends CommonObject
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$error=0;
|
||||
$error = 0;
|
||||
|
||||
$this->label=trim($this->label);
|
||||
$this->label = trim($this->label);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."asset_type ";
|
||||
$sql.= "SET ";
|
||||
$sql.= "label = '".$this->db->escape($this->label) ."',";
|
||||
$sql.= "accountancy_code_asset = '".$this->db->escape($this->accountancy_code_asset)."',";
|
||||
$sql.= "accountancy_code_depreciation_asset = '".$this->db->escape($this->accountancy_code_depreciation_asset)."',";
|
||||
$sql.= "accountancy_code_depreciation_expense = '".$this->db->escape($this->accountancy_code_depreciation_expense)."',";
|
||||
$sql.= "note = '".$this->db->escape($this->note) ."'";
|
||||
$sql.= " WHERE rowid =".$this->id;
|
||||
$sql .= "SET ";
|
||||
$sql .= "label = '".$this->db->escape($this->label)."',";
|
||||
$sql .= "accountancy_code_asset = '".$this->db->escape($this->accountancy_code_asset)."',";
|
||||
$sql .= "accountancy_code_depreciation_asset = '".$this->db->escape($this->accountancy_code_depreciation_asset)."',";
|
||||
$sql .= "accountancy_code_depreciation_expense = '".$this->db->escape($this->accountancy_code_depreciation_expense)."',";
|
||||
$sql .= "note = '".$this->db->escape($this->note)."'";
|
||||
$sql .= " WHERE rowid =".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$action='update';
|
||||
$action = 'update';
|
||||
|
||||
// Actions on extra fields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
||||
{
|
||||
$result=$this->insertExtraFields();
|
||||
$result = $this->insertExtraFields();
|
||||
if ($result < 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
if (!$error && !$notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ASSET_TYPE_MODIFY', $user);
|
||||
$result = $this->call_trigger('ASSET_TYPE_MODIFY', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -233,7 +233,7 @@ class AssetType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
@ -251,13 +251,13 @@ class AssetType extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_type";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql .= " WHERE rowid = ".$this->id;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('ASSET_TYPE_DELETE', $user);
|
||||
$result = $this->call_trigger('ASSET_TYPE_DELETE', $user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -2; }
|
||||
// End call triggers
|
||||
|
||||
@ -267,7 +267,7 @@ class AssetType extends CommonObject
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ class AssetType extends CommonObject
|
||||
|
||||
dol_syslog("Asset_type::fetch", LOG_DEBUG);
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
@ -306,7 +306,7 @@ class AssetType extends CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -320,15 +320,15 @@ class AssetType extends CommonObject
|
||||
public function liste_array()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs;
|
||||
global $conf, $langs;
|
||||
|
||||
$assettypes = array();
|
||||
|
||||
$sql = "SELECT rowid, label as label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset_type";
|
||||
$sql.= " WHERE entity IN (".getEntity('asset_type').")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."asset_type";
|
||||
$sql .= " WHERE entity IN (".getEntity('asset_type').")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$nump = $this->db->num_rows($resql);
|
||||
@ -365,13 +365,13 @@ class AssetType extends CommonObject
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$ret=array();
|
||||
$ret = array();
|
||||
|
||||
$sql = "SELECT a.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."asset as a";
|
||||
$sql.= " WHERE a.entity IN (".getEntity('asset').")";
|
||||
$sql.= " AND a.fk_asset_type = ".$this->id;
|
||||
if (! empty($excludefilter)) $sql.=' AND ('.$excludefilter.')';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."asset as a";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('asset').")";
|
||||
$sql .= " AND a.fk_asset_type = ".$this->id;
|
||||
if (!empty($excludefilter)) $sql .= ' AND ('.$excludefilter.')';
|
||||
|
||||
dol_syslog(get_class($this)."::listAssetsForGroup", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -379,31 +379,31 @@ class AssetType extends CommonObject
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
if (! array_key_exists($obj->rowid, $ret))
|
||||
if (!array_key_exists($obj->rowid, $ret))
|
||||
{
|
||||
if ($mode < 2)
|
||||
{
|
||||
$assetstatic=new Asset($this->db);
|
||||
$assetstatic = new Asset($this->db);
|
||||
if ($mode == 1) {
|
||||
$assetstatic->fetch($obj->rowid, '', '', '', false, false);
|
||||
} else {
|
||||
$assetstatic->fetch($obj->rowid);
|
||||
}
|
||||
$ret[$obj->rowid]=$assetstatic;
|
||||
$ret[$obj->rowid] = $assetstatic;
|
||||
}
|
||||
else $ret[$obj->rowid]=$obj->rowid;
|
||||
else $ret[$obj->rowid] = $obj->rowid;
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
$this->asset=$ret;
|
||||
$this->asset = $ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error = $this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -420,15 +420,15 @@ class AssetType extends CommonObject
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTypeCard", $this->label);
|
||||
$result = '';
|
||||
$label = $langs->trans("ShowTypeCard", $this->label);
|
||||
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/asset/type.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
$linkend = '</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->label, $maxlen):$this->label);
|
||||
if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
|
||||
if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->label, $maxlen) : $this->label);
|
||||
$result .= $linkend;
|
||||
|
||||
return $result;
|
||||
@ -448,13 +448,13 @@ class AssetType extends CommonObject
|
||||
// Initialize parameters
|
||||
$this->id = 0;
|
||||
$this->ref = 'ATSPEC';
|
||||
$this->specimen=1;
|
||||
$this->specimen = 1;
|
||||
|
||||
$this->label='ASSET TYPE SPECIMEN';
|
||||
$this->note='This is a note';
|
||||
$this->label = 'ASSET TYPE SPECIMEN';
|
||||
$this->note = 'This is a note';
|
||||
|
||||
// Assets of this asset type is just me
|
||||
$this->asset=array(
|
||||
$this->asset = array(
|
||||
$user->id => $user
|
||||
);
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ print '</tr>'."\n";
|
||||
// Fields title label
|
||||
// --------------------------------------------------------------------
|
||||
print '<tr class="liste_titre">';
|
||||
foreach($object->fields as $key => $val)
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
@ -427,8 +427,8 @@ foreach($object->fields as $key => $val)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
|
||||
@ -436,7 +436,7 @@ print '</tr>'."\n";
|
||||
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine=0;
|
||||
$needToFetchEachLine = 0;
|
||||
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
|
||||
{
|
||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||
@ -448,19 +448,19 @@ if (is_array($extrafields->attributes[$object->table_element]['computed']) && co
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < ($limit ? min($num, $limit) : $num))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
foreach($object->fields as $key => $val)
|
||||
foreach ($object->fields as $key => $val)
|
||||
{
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
|
||||
@ -609,37 +609,15 @@ if ($rowid > 0)
|
||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||
|
||||
// Extra field
|
||||
if (empty($reshook))
|
||||
{
|
||||
print '<br><br><table class="border centpercent">';
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key=>$label)
|
||||
{
|
||||
if (isset($_POST["options_".$key])) {
|
||||
if (is_array($_POST["options_".$key])) {
|
||||
// $_POST["options"] is an array but following code expects a comma separated string
|
||||
$value = implode(",", $_POST["options_".$key]);
|
||||
} else {
|
||||
$value = $_POST["options_".$key];
|
||||
}
|
||||
} else {
|
||||
$value = $adht->array_options["options_".$key];
|
||||
}
|
||||
print '<tr><td width="30%">'.$label.'</td><td>';
|
||||
print $extrafields->showInputField($key, $value);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
print '</table><br><br>';
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
@ -278,6 +278,7 @@ dol_htmloutput_errors($mesg);
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="mode" value="label">';
|
||||
print '<input type="hidden" name="action" value="builddoc">';
|
||||
print '<input type="hidden" name="token" value="'.newtoken().'">';
|
||||
|
||||
print '<div class="tagtable">';
|
||||
|
||||
|
||||
@ -28,9 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin","other","blockedlog"));
|
||||
$langs->loadLangs(array("admin", "other", "blockedlog"));
|
||||
|
||||
if (! $user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
|
||||
if (!$user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
@ -40,11 +40,12 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/set_(.*)/', $action, $reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$code = $reg[1];
|
||||
$values = GETPOST($code);
|
||||
if(is_array($values))$values = implode(',', $values);
|
||||
if (is_array($values)) $values = implode(',', $values);
|
||||
|
||||
if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
@ -59,7 +60,7 @@ if (preg_match('/set_(.*)/', $action, $reg))
|
||||
|
||||
if (preg_match('/del_(.*)/', $action, $reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$code = $reg[1];
|
||||
if (dolibarr_del_const($db, $code, 0) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -76,22 +77,22 @@ if (preg_match('/del_(.*)/', $action, $reg))
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
$block_static = new BlockedLog($db);
|
||||
|
||||
llxHeader('', $langs->trans("BlockedLogSetup"));
|
||||
|
||||
$linkback='';
|
||||
$linkback = '';
|
||||
if (GETPOST('withtab', 'alpha'))
|
||||
{
|
||||
$linkback='<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'), $linkback);
|
||||
|
||||
if (GETPOST('withtab', 'alpha'))
|
||||
{
|
||||
$head=blockedlogadmin_prepare_head();
|
||||
$head = blockedlogadmin_prepare_head();
|
||||
dol_fiche_head($head, 'blockedlog', '', -1);
|
||||
}
|
||||
|
||||
@ -134,16 +135,16 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">';
|
||||
|
||||
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$sql.= " WHERE active > 0";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_country";
|
||||
$sql .= " WHERE active > 0";
|
||||
|
||||
$countryArray=array();
|
||||
$resql=$db->query($sql);
|
||||
$countryArray = array();
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
$countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:''));
|
||||
$countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : ''));
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,8 +160,8 @@ print '</td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="titlefield">';
|
||||
print $langs->trans("ListOfTrackedEvents").'</td><td>';
|
||||
$arrayoftrackedevents=$block_static->trackedevents;
|
||||
foreach($arrayoftrackedevents as $key => $val)
|
||||
$arrayoftrackedevents = $block_static->trackedevents;
|
||||
foreach ($arrayoftrackedevents as $key => $val)
|
||||
{
|
||||
print $key.' - '.$langs->trans($val).'<br>';
|
||||
}
|
||||
|
||||
@ -520,7 +520,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<table class="border centpercent tableforfield">'."\n";
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak = 'efficiency';
|
||||
$keyforbreak = 'duration';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
// Other attributes
|
||||
|
||||
@ -95,7 +95,7 @@ class BOM extends CommonObject
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
|
||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
//'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLossForProductProduced'),
|
||||
'duration' => array('type'=>'duration', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'enabled'=>1, 'visible'=>-1, 'position'=>102),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
|
||||
@ -561,7 +561,7 @@ class BOM extends CommonObject
|
||||
{
|
||||
$num = $this->ref;
|
||||
}
|
||||
$this->newref = $num;
|
||||
$this->newref = dol_sanitizeFileName($num);
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
@ -1056,7 +1056,7 @@ class BOMLine extends CommonObjectLine
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'qty_frozen' => array('type'=>'smallint', 'label'=>'QuantityFrozen', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>105, 'css'=>'maxwidth50imp', 'help'=>'QuantityConsumedInvariable'),
|
||||
'disable_stock_change' => array('type'=>'smallint', 'label'=>'DisableStockChange', 'enabled'=>1, 'visible'=>1, 'default'=>0, 'position'=>108, 'css'=>'maxwidth50imp', 'help'=>'DisableStockChangeHelp'),
|
||||
//'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'),
|
||||
'efficiency' => array('type'=>'double(24,8)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfEfficiencyConsumedMeans'),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user