Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
17
.github/CONTRIBUTING.md
vendored
@ -113,13 +113,16 @@ Also, some code changes need a prior approbation:
|
||||
|
||||
* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
|
||||
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow
|
||||
every developer discuss about the PR.
|
||||
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later.
|
||||
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR.
|
||||
By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
|
||||
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio in Open Source world, don't expect the core team
|
||||
to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
|
||||
|
||||
If the label of PR start with "WIP" (Work In Progress), it will not be analyzed (until you change the label of PR).
|
||||
|
||||
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
|
||||
|
||||
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
|
||||
In most cases, it gives you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting an action of the developer/author.
|
||||
|
||||
Statistics on Dolibarr project shows that around 95% of submitted PR are reviewed and tagged. This is one of the most important ratio of answered PR in Open Source world. Don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
|
||||
|
||||
|
||||
### Resources
|
||||
|
||||
5
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
open_collective: dolibarr
|
||||
custom: https://wiki.dolibarr.org/index.php/Subscribe
|
||||
# github: [eldy]
|
||||
@ -1,8 +1,16 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us fix something that is broken
|
||||
title: ''
|
||||
labels: Bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Instructions
|
||||
*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*
|
||||
*Please:*
|
||||
- *only keep the "Bug" or "Feature Request" section*
|
||||
- *replace the bracket enclosed texts with meaningful informations*
|
||||
- *replace the bracket enclosed texts with meaningful information*
|
||||
- *remove any unused sub-section*
|
||||
|
||||
|
||||
@ -25,17 +33,3 @@
|
||||
|
||||
## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)
|
||||
[*Files*]
|
||||
|
||||
|
||||
|
||||
# Feature Request
|
||||
[*Short description*]
|
||||
|
||||
## Use case
|
||||
[*Verbose description*]
|
||||
|
||||
## Suggested implementation
|
||||
[*Verbose description*]
|
||||
|
||||
## Suggested steps
|
||||
[*List of tasks to achieve goal*]
|
||||
27
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest a new idea for this project
|
||||
title: ''
|
||||
labels: Feature request
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Instructions
|
||||
*This is a template to help you report good issues. You may use [Github Markdown](https://help.github.com/articles/getting-started-with-writing-and-formatting-on-github/) syntax to format your issue report.*
|
||||
*Please:*
|
||||
- *replace the bracket enclosed texts with meaningful information*
|
||||
- *remove any unused sub-section*
|
||||
|
||||
|
||||
# Feature Request
|
||||
[*Short description*]
|
||||
|
||||
## Use case
|
||||
[*Verbose description*]
|
||||
|
||||
## Suggested implementation
|
||||
[*Verbose description*]
|
||||
|
||||
## Suggested steps
|
||||
[*List of tasks to achieve goal*]
|
||||
@ -1,6 +1,12 @@
|
||||
# .scrutinizer.yml
|
||||
#build:
|
||||
# - php-scrutinizer-run
|
||||
build:
|
||||
- php-scrutinizer-run
|
||||
nodes:
|
||||
analysis:
|
||||
tests:
|
||||
override:
|
||||
- php-scrutinizer-run
|
||||
|
||||
imports:
|
||||
- javascript
|
||||
|
||||
10
.stickler.yml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
linters:
|
||||
phpcs:
|
||||
standard: 'dev/setup/codesniffer/ruleset.xml'
|
||||
extensions: 'php'
|
||||
tab_width: 4
|
||||
fixer: true
|
||||
|
||||
fixers:
|
||||
enable: true
|
||||
@ -288,17 +288,17 @@ script:
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
set +e
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Checking coding style"
|
||||
echo "Checking coding style (excluding Pull Requests builds)"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
# Exclusions are defined in the ruleset.xml file
|
||||
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
|
||||
phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
|
||||
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi
|
||||
set +e
|
||||
echo
|
||||
|
||||
|
||||
@ -32,12 +32,12 @@ PSR/simple-cache ? Library for cache (used by PHPSp
|
||||
Restler 3.0.0RC6 LGPL-3+ Yes Library to develop REST Web services (+ swagger-ui js lib into dir explorer)
|
||||
Sabre 3.2.2 BSD Yes DAV support
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
Stripe 6.35 MIT licence Yes Library for Stripe module
|
||||
Stripe 6.41 MIT licence Yes Library for Stripe module
|
||||
TCPDF 6.2.25 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
jQuery 3.3.1 MIT License Yes JS library
|
||||
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 blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
|
||||
|
||||
224
ChangeLog
@ -14,9 +14,231 @@ WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Properties ->libelle_incoterms were renamed into ->label_incoterms
|
||||
* Removed the method liste_array() of project class. It was not used by core code.
|
||||
* The function show_theme() hase been renamed into showSkins()
|
||||
* Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency.
|
||||
* The deprecated method get_OutstandingBill has been removed. You can use getOutstandingBills() instead.
|
||||
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 10.0.1 compared to 10.0.0 *****
|
||||
FIX: #10930
|
||||
FIX: #10984
|
||||
FIX: reposition on "Build backup" button
|
||||
FIX: #11400
|
||||
FIX: #11412
|
||||
FIX: #11460
|
||||
FIX: #11463
|
||||
FIX: #11466
|
||||
FIX: #11492
|
||||
FIX: #11498
|
||||
FIX: #11505
|
||||
FIX: #11506
|
||||
FIX: #11507
|
||||
FIX: #11509
|
||||
FIX: #11537
|
||||
FIX: #11543
|
||||
FIX: #11553
|
||||
FIX: #11576
|
||||
FIX: #11584
|
||||
FIX: #11590
|
||||
FIX: accounting mode must be taken from global conf, because there's no way to choose a mode with interface
|
||||
FIX: Add message from public interface
|
||||
FIX: add missing hook calls
|
||||
FIX: Add warning when setup is strange
|
||||
FIX: ajax call for line positioning when CSRFCHECK_WITH_TOKEN is on
|
||||
FIX: API return 404 sometimes even if API exists
|
||||
FIX: Attachment was lost when we validate an expense report
|
||||
FIX: avoid conflict with "$classname" in card.php
|
||||
FIX: Bad sql request
|
||||
FIX: better compatibility with multicompany transverse mode
|
||||
FIX: Better PHP compatibility
|
||||
FIX: Block to link with tickets
|
||||
FIX: Can't submit a ticket from public interface
|
||||
FIX: categories import: prevent mismatch between category type and object type
|
||||
FIX: Closing ticket from public interface
|
||||
FIX: Column 'paid' missing in expense report
|
||||
FIX: compatibility mysql 8. rank is reserved
|
||||
FIX: Computed field were not calculated into lists.
|
||||
FIX: Content of email for subscription
|
||||
FIX: correct error in files with multiple spaces
|
||||
FIX: CVE-2019-11199
|
||||
FIX: delete of links between objects
|
||||
FIX: div not balanced
|
||||
FIX: do not return formatted prices in json string
|
||||
FIX: duplicate on the check (TODO field $onetrtd not used ?)
|
||||
FIX: element name in update_price
|
||||
FIX: empty product_use_units in product configuration
|
||||
FIX: expedition card: infinite loop for printObjectLine hook if return > 0
|
||||
FIX: extrafield loading bug due to assumption that an object is a third party while it may be a contact if MAIN_USE_COMPANY_NAME_OF_CONTACT is set.
|
||||
FIX: Fatal error on dol_htmloutput_mesg with corrupted array
|
||||
FIX: Fatal situation if payment removed on expense report. Action
|
||||
FIX: FEC Format - Missing date_creation in general ledger when you add a new transaction
|
||||
FIX: FEC Format - Save translation of the journal label in database & nowrap on amount
|
||||
FIX: floating point precision errors in the triggers of the workflow module
|
||||
FIX: for #11232
|
||||
FIX: format of field with type timestamp
|
||||
FIX: fournrprice log for insert
|
||||
FIX: help text
|
||||
FIX: import filter error
|
||||
FIX: __INFOS__ tag not exists
|
||||
FIX: issue #9300: install error with PostgreSQL when using custom table prefix
|
||||
FIX: Language key
|
||||
FIX: Limit of uploaded files (max_post_size was not used)
|
||||
FIX: list of balance of leaves
|
||||
FIX: minor spelling issues
|
||||
FIX: missing "dropdown-icon" replacement
|
||||
FIX: Missing field "Conciliated" into bank transaction export
|
||||
FIX: missing filter by current contact
|
||||
FIX: missing token
|
||||
FIX: Missing where on entity
|
||||
FIX: move sql request in INNER JOIN
|
||||
FIX: name was able to be in field but went back to new line
|
||||
FIX: Nowrap on amount
|
||||
FIX: Online payment
|
||||
FIX: on shipment delete confirm dialog, a new checkbox allows the user to choose if they want their stock re-incremented after the deletion.
|
||||
FIX: option EXPORT_LABEL_FOR_SELECT to restore compatibility in export
|
||||
FIX: Option THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION
|
||||
FIX: outdated phpdoc
|
||||
FIX: Permission for BOM menu
|
||||
FIX: permission to delete a draft purchase order
|
||||
FIX: phpcs
|
||||
FIX: Position was lost when we edit the line of template invoice
|
||||
FIX: product_use_units was set to 0 each time a conf in block other was set
|
||||
FIX: propal createFrom hook: undefined parameter attached
|
||||
FIX: Responsive of public interface of ticket
|
||||
FIX: search by phone pro
|
||||
FIX: Setup of TakePos was not possible after a clean install
|
||||
FIX: Show list of events on tickets
|
||||
FIX: socpeople assigned list in action com list
|
||||
FIX: SQL problem on donation & nowrap on amount
|
||||
FIX: stock increase on shipment deletion if STOCK_CALCULATE_ON_SHIPMENT_NEW: is set
|
||||
FIX: stripe webhook ID constant set
|
||||
FIX: summary of time spent in preview tab of projects
|
||||
FIX: the feature to bill time spent was not enabled.
|
||||
FIX: The new feature to attach document on lines was not correclty
|
||||
FIX: The proposed new supplier code does not work
|
||||
FIX: this function can not be private
|
||||
FIX: tk9877 - PDF rouget requires product.lib.php (otherwise measuring_units_string() is not defined)
|
||||
FIX: Update the file index table when we validate/rename a ref.
|
||||
FIX: use rounding to compare the amounts
|
||||
FIX: We must save code instead of value in database for template invoice modelpdf
|
||||
FIX: we need to be able to add freeline with qty between 0 & 1 in supplierorder line
|
||||
FIX: We should remove property comments only for project and task api.
|
||||
FIX: When saving an action it didn't save the label based on the type of event if the label is empty and the type is customized
|
||||
FIX: when STOCK_CALCULATE_ON_SHIPMENT_NEW: is set, deleting a "closed" shipment now increases stock as expected
|
||||
FIX: wrong path sociales/index.php doesnt exist anymore
|
||||
|
||||
|
||||
***** ChangeLog for 10.0.1 compared to 10.0.0 *****
|
||||
FIX: #10930
|
||||
FIX: #10984
|
||||
FIX: reposition on "Build backup" button
|
||||
FIX: #11400
|
||||
FIX: #11412
|
||||
FIX: #11460
|
||||
FIX: #11463
|
||||
FIX: #11466
|
||||
FIX: #11492
|
||||
FIX: #11498
|
||||
FIX: #11505
|
||||
FIX: #11506
|
||||
FIX: #11507
|
||||
FIX: #11509
|
||||
FIX: #11537
|
||||
FIX: #11543
|
||||
FIX: #11553
|
||||
FIX: #11576
|
||||
FIX: #11584
|
||||
FIX: #11590
|
||||
FIX: accounting mode must be taken from global conf, because there's no way to choose a mode with interface
|
||||
FIX: Add message from public interface
|
||||
FIX: add missing hook calls
|
||||
FIX: Add warning when setup is strange
|
||||
FIX: ajax call for line positioning when CSRFCHECK_WITH_TOKEN is on
|
||||
FIX: API return 404 sometimes even if API exists
|
||||
FIX: Attachment was lost when we validate an expense report
|
||||
FIX: avoid conflict with "$classname" in card.php
|
||||
FIX: Bad sql request
|
||||
FIX: better compatibility with multicompany transverse mode
|
||||
FIX: Better PHP compatibility
|
||||
FIX: Block to link with tickets
|
||||
FIX: Can't submit a ticket from public interface
|
||||
FIX: categories import: prevent mismatch between category type and object type
|
||||
FIX: Closing ticket from public interface
|
||||
FIX: Column 'paid' missing in expense report
|
||||
FIX: compatibility mysql 8. rank is reserved
|
||||
FIX: Computed field were not calculated into lists.
|
||||
FIX: Content of email for subscription
|
||||
FIX: correct error in files with multiple spaces
|
||||
FIX: CVE-2019-11199
|
||||
FIX: delete of links between objects
|
||||
FIX: div not balanced
|
||||
FIX: do not return formatted prices in json string
|
||||
FIX: duplicate on the check (TODO field $onetrtd not used ?)
|
||||
FIX: element name in update_price
|
||||
FIX: empty product_use_units in product configuration
|
||||
FIX: expedition card: infinite loop for printObjectLine hook if return > 0
|
||||
FIX: extrafield loading bug due to assumption that an object is a third party while it may be a contact if MAIN_USE_COMPANY_NAME_OF_CONTACT is set.
|
||||
FIX: Fatal error on dol_htmloutput_mesg with corrupted array
|
||||
FIX: Fatal situation if payment removed on expense report. Action
|
||||
FIX: FEC Format - Missing date_creation in general ledger when you add a new transaction
|
||||
FIX: FEC Format - Save translation of the journal label in database & nowrap on amount
|
||||
FIX: floating point precision errors in the triggers of the workflow module
|
||||
FIX: for #11232
|
||||
FIX: format of field with type timestamp
|
||||
FIX: fournrprice log for insert
|
||||
FIX: help text
|
||||
FIX: import filter error
|
||||
FIX: __INFOS__ tag not exists
|
||||
FIX: issue #9300: install error with PostgreSQL when using custom table prefix
|
||||
FIX: Language key
|
||||
FIX: Limit of uploaded files (max_post_size was not used)
|
||||
FIX: list of balance of leaves
|
||||
FIX: minor spelling issues
|
||||
FIX: missing "dropdown-icon" replacement
|
||||
FIX: Missing field "Conciliated" into bank transaction export
|
||||
FIX: missing filter by current contact
|
||||
FIX: missing token
|
||||
FIX: Missing where on entity
|
||||
FIX: move sql request in INNER JOIN
|
||||
FIX: name was able to be in field but went back to new line
|
||||
FIX: Nowrap on amount
|
||||
FIX: Online payment
|
||||
FIX: on shipment delete confirm dialog, a new checkbox allows the user to choose if they want their stock re-incremented after the deletion.
|
||||
FIX: option EXPORT_LABEL_FOR_SELECT to restore compatibility in export
|
||||
FIX: Option THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION
|
||||
FIX: outdated phpdoc
|
||||
FIX: Permission for BOM menu
|
||||
FIX: permission to delete a draft purchase order
|
||||
FIX: phpcs
|
||||
FIX: Position was lost when we edit the line of template invoice
|
||||
FIX: product_use_units was set to 0 each time a conf in block other was set
|
||||
FIX: propal createFrom hook: undefined parameter attached
|
||||
FIX: Responsive of public interface of ticket
|
||||
FIX: search by phone pro
|
||||
FIX: Setup of TakePos was not possible after a clean install
|
||||
FIX: Show list of events on tickets
|
||||
FIX: socpeople assigned list in action com list
|
||||
FIX: SQL problem on donation & nowrap on amount
|
||||
FIX: stock increase on shipment deletion if STOCK_CALCULATE_ON_SHIPMENT_NEW: is set
|
||||
FIX: stripe webhook ID constant set
|
||||
FIX: summary of time spent in preview tab of projects
|
||||
FIX: the feature to bill time spent was not enabled.
|
||||
FIX: The new feature to attach document on lines was not correclty
|
||||
FIX: The proposed new supplier code does not work
|
||||
FIX: this function can not be private
|
||||
FIX: tk9877 - PDF rouget requires product.lib.php (otherwise measuring_units_string() is not defined)
|
||||
FIX: Update the file index table when we validate/rename a ref.
|
||||
FIX: use rounding to compare the amounts
|
||||
FIX: We must save code instead of value in database for template invoice modelpdf
|
||||
FIX: we need to be able to add freeline with qty between 0 & 1 in supplierorder line
|
||||
FIX: We should remove property comments only for project and task api.
|
||||
FIX: When saving an action it didn't save the label based on the type of event if the label is empty and the type is customized
|
||||
FIX: when STOCK_CALCULATE_ON_SHIPMENT_NEW: is set, deleting a "closed" shipment now increases stock as expected
|
||||
FIX: wrong path sociales/index.php doesnt exist anymore
|
||||
|
||||
***** ChangeLog for 10.0.0 compared to 9.0.0 *****
|
||||
For Users:
|
||||
NEW: Module "Ticket" is available as a stable module.
|
||||
@ -414,7 +636,7 @@ NEW: add option PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT
|
||||
NEW: Add option to display thirdparty adress in combolist
|
||||
NEW: Add option to swap sender/recipient address on PDF
|
||||
NEW: Add option to display thirdparty adress in combolist
|
||||
NEW: Add project on pament of salaries
|
||||
NEW: Add project on payment of salaries
|
||||
NEW: Add SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME and
|
||||
NEW: Add somes hooks in bank planned entries
|
||||
NEW: Add supplier ref in item reception page
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
# DOLIBARR ERP & CRM
|
||||
|
||||

|
||||
[](https://houndci.com)
|
||||
|
||||
|7|8|9|10|develop|
|
||||
|----------|----------|----------|----------|----------|
|
||||
@ -138,7 +137,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
|
||||
- Multi-company by adding of an external module.
|
||||
- Very user friendly and easy to use.
|
||||
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
|
||||
- Works with PHP 5.3+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
|
||||
- Works with PHP 5.5+ and MariaDB 5.0.3+, MySQL 5.0.3+ or PostgreSQL 8.1.4+ (See requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite))
|
||||
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
|
||||
- APIs.
|
||||
- An easy to understand, maintain and develop code (PHP with no heavy framework; trigger and hook architecture)
|
||||
|
||||
13
SECURITY.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| -------- | ------------------ |
|
||||
| <= 8.0.* | :x: |
|
||||
| >= 9.0.* | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a vulnerability, please send an email to security@dolibarr.org
|
||||
In most cases, after fixing the security, we make an answer by email to say the issue has been fixed.
|
||||
@ -3,8 +3,7 @@ README (English)
|
||||
Building packages
|
||||
##################################################
|
||||
|
||||
All sub-directories of "build" directory contains files required to build
|
||||
automatically Dolibarr packages.
|
||||
All sub-directories of "build" directory contains files (setup or binary tools) required to build automatically Dolibarr packages.
|
||||
There are several tools:
|
||||
|
||||
|
||||
|
||||
@ -458,16 +458,6 @@ variables_order = "GPCS"
|
||||
; with user data. This makes most sense when coupled with track_vars - in which
|
||||
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
|
||||
; variables.
|
||||
;
|
||||
; You should do your best to write your scripts so that they do not require
|
||||
; register_globals to be on; Using form variables as globals can easily lead
|
||||
; to possible security problems, if the code is not very well thought of.
|
||||
register_globals = Off
|
||||
|
||||
; Whether or not to register the old-style input arrays, HTTP_GET_VARS
|
||||
; and friends. If you're not using them, it's recommended to turn them off,
|
||||
; for performance reasons.
|
||||
register_long_arrays = Off
|
||||
|
||||
; This directive tells PHP whether to declare the argv&argc variables (that
|
||||
; would contain the GET information). If you don't use these variables, you
|
||||
@ -477,8 +467,7 @@ register_argc_argv = Off
|
||||
; When enabled, the SERVER and ENV variables are created when they're first
|
||||
; used (Just In Time) instead of when the script starts. If these variables
|
||||
; are not used within a script, having this directive on will result in a
|
||||
; performance gain. The PHP directives register_globals, register_long_arrays,
|
||||
; and register_argc_argv must be disabled for this directive to have any affect.
|
||||
; performance gain.
|
||||
auto_globals_jit = On
|
||||
|
||||
; Maximum size of POST data that PHP will accept.
|
||||
@ -1101,14 +1090,6 @@ session.gc_maxlifetime = 1800
|
||||
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
|
||||
; cd /path/to/sessions; find -cmin +24 | xargs rm
|
||||
|
||||
; PHP 4.2 and less have an undocumented feature/bug that allows you to
|
||||
; to initialize a session variable in the global scope, albeit register_globals
|
||||
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
|
||||
; You can disable the feature and the warning separately. At this time,
|
||||
; the warning is only displayed, if bug_compat_42 is enabled.
|
||||
|
||||
session.bug_compat_42 = 0
|
||||
session.bug_compat_warn = 1
|
||||
|
||||
; Check HTTP Referer to invalidate externally stored URLs containing ids.
|
||||
; HTTP_REFERER has to contain this substring for the session to be
|
||||
|
||||
@ -8,7 +8,7 @@ define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
define('DOL_URL_ROOT', '/');
|
||||
|
||||
// Load the main.inc.php file to have finctions llx_Header and llx_Footer defined
|
||||
// Load the main.inc.php file to have functions llx_Header and llx_Footer defined
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
|
||||
global $conf, $langs, $user, $db;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
||||
@ -29,16 +29,6 @@ Alias /dolibarr /usr/share/dolibarr/htdocs
|
||||
ErrorDocument 401 /public/error-401.php
|
||||
ErrorDocument 404 /public/error-404.php
|
||||
|
||||
<IfModule mod_php4.c>
|
||||
php_flag magic_quotes_gpc Off
|
||||
php_flag register_globals Off
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_php5.c>
|
||||
php_flag magic_quotes_gpc Off
|
||||
php_flag register_globals Off
|
||||
</IfModule>
|
||||
|
||||
|
||||
# OPTIMIZE: To use gzip compressed files (for Dolibarr already compressed files).
|
||||
# Note that constant MAIN_OPTIMIZE_SPEED must have a value with bit 0 set.
|
||||
|
||||
@ -27,6 +27,15 @@ With
|
||||
|
||||
|
||||
|
||||
ESCPOS:
|
||||
-------
|
||||
Replace
|
||||
private $connector;
|
||||
With
|
||||
protected $connector;
|
||||
|
||||
|
||||
|
||||
NUSOAP:
|
||||
-------
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
|
||||
4
dev/namespacemig/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
Test to migrate Dolibarr to namespace "Dolibarr".
|
||||
|
||||
Script bbb.php is a script of an external module with current code writing.
|
||||
It must works after migration.
|
||||
23
dev/namespacemig/aaa.class.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Dolibarr;
|
||||
|
||||
|
||||
global $globalaaa;
|
||||
$globalaaa = 'globalaaa';
|
||||
|
||||
function faaa()
|
||||
{
|
||||
return 'faaa';
|
||||
}
|
||||
|
||||
class Aaa
|
||||
{
|
||||
const AAA='aaa';
|
||||
|
||||
public function do()
|
||||
{
|
||||
echo 'doaaa'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
25
dev/namespacemig/bbb.class.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
global $globalbbb;
|
||||
$globalbbb = 'globalbbb';
|
||||
|
||||
function fbbb()
|
||||
{
|
||||
return 'fbbb';
|
||||
}
|
||||
|
||||
class Bbb
|
||||
{
|
||||
const BBB='bbb';
|
||||
public function do()
|
||||
{
|
||||
global $globalaaa, $globalbbb;
|
||||
echo 'dobbb'."\n";
|
||||
$globalaaa.='+bbb';
|
||||
$globalbbb.='+bbb';
|
||||
}
|
||||
}
|
||||
|
||||
31
dev/namespacemig/bbb.php
Executable file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
//use \Aaa as Aaa;
|
||||
|
||||
use Dolibarr\Aaa as Aaa;
|
||||
use function Dolibarr\faaa as faaa; // Need php 5.6+
|
||||
//use const Dolibarr\AAA;
|
||||
|
||||
//use Bbb as Bbb;
|
||||
|
||||
require './main.inc.php';
|
||||
require './aaa.class.php';
|
||||
require './bbb.class.php';
|
||||
|
||||
$bbb = new Bbb();
|
||||
$bbb->do();
|
||||
|
||||
$aaa = new Aaa();
|
||||
$aaa->do();
|
||||
|
||||
echo $aaa::AAA."\n";
|
||||
echo $bbb::BBB."\n";
|
||||
|
||||
echo Aaa::AAA."\n";
|
||||
echo Bbb::BBB."\n";
|
||||
|
||||
echo faaa()."\n";
|
||||
echo fbbb()."\n";
|
||||
|
||||
echo "globalaaa=$globalaaa\n";
|
||||
echo "globalbbb=$globalbbb\n";
|
||||
7
dev/namespacemig/main.inc.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
/*spl_autoload_register(function ($class_name) {
|
||||
var_dump('class='.$class_name);
|
||||
require $class_name;
|
||||
});
|
||||
*/
|
||||
@ -658,20 +658,6 @@ html_errors = Off
|
||||
; Example:
|
||||
;arg_separator.input = ";&"
|
||||
|
||||
; This directive determines which super global arrays are registered when PHP
|
||||
; starts up. If the register_globals directive is enabled, it also determines
|
||||
; what order variables are populated into the global space. G,P,C,E & S are
|
||||
; abbreviations for the following respective super globals: GET, POST, COOKIE,
|
||||
; ENV and SERVER. There is a performance penalty paid for the registration of
|
||||
; these arrays and because ENV is not as commonly used as the others, ENV is
|
||||
; is not recommended on productions servers. You can still get access to
|
||||
; the environment variables through getenv() should you need to.
|
||||
; Default Value: "EGPCS"
|
||||
; Development Value: "GPCS"
|
||||
; Production Value: "GPCS";
|
||||
; http://php.net/variables-order
|
||||
variables_order = "GPCS"
|
||||
|
||||
; This directive determines which super global data (G,P,C,E & S) should
|
||||
; be registered into the super global array REQUEST. If so, it also determines
|
||||
; the order in which that data is registered. The values for this directive are
|
||||
@ -685,15 +671,6 @@ variables_order = "GPCS"
|
||||
; http://php.net/request-order
|
||||
request_order = "GP"
|
||||
|
||||
; Whether or not to register the EGPCS variables as global variables. You may
|
||||
; want to turn this off if you don't want to clutter your scripts' global scope
|
||||
; with user data.
|
||||
; You should do your best to write your scripts so that they do not require
|
||||
; register_globals to be on; Using form variables as globals can easily lead
|
||||
; to possible security problems, if the code is not very well thought of.
|
||||
; http://php.net/register-globals
|
||||
register_globals = Off
|
||||
|
||||
; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
|
||||
; are registered by PHP or not. As they are deprecated, we obviously don't
|
||||
; recommend you use them. They are on by default for compatibility reasons but
|
||||
@ -722,8 +699,7 @@ register_argc_argv = Off
|
||||
; When enabled, the SERVER and ENV variables are created when they're first
|
||||
; used (Just In Time) instead of when the script starts. If these variables
|
||||
; are not used within a script, having this directive on will result in a
|
||||
; performance gain. The PHP directives register_globals, register_long_arrays,
|
||||
; and register_argc_argv must be disabled for this directive to have any affect.
|
||||
; performance gain.
|
||||
; http://php.net/auto-globals-jit
|
||||
auto_globals_jit = On
|
||||
|
||||
@ -1516,22 +1492,6 @@ session.gc_maxlifetime = 1440
|
||||
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
|
||||
; find /path/to/sessions -cmin +24 | xargs rm
|
||||
|
||||
; PHP 4.2 and less have an undocumented feature/bug that allows you to
|
||||
; to initialize a session variable in the global scope, even when register_globals
|
||||
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
|
||||
; You can disable the feature and the warning separately. At this time,
|
||||
; the warning is only displayed, if bug_compat_42 is enabled. This feature
|
||||
; introduces some serious security problems if not handled correctly. It's
|
||||
; recommended that you do not use this feature on production servers. But you
|
||||
; should enable this on development servers and enable the warning as well. If you
|
||||
; do not enable the feature on development servers, you won't be warned when it's
|
||||
; used and debugging errors caused by this can be difficult to track down.
|
||||
; Default Value: On
|
||||
; Development Value: On
|
||||
; Production Value: Off
|
||||
; http://php.net/session.bug-compat-42
|
||||
session.bug_compat_42 = Off
|
||||
|
||||
; This setting controls whether or not you are warned by PHP when initializing a
|
||||
; session value into the global space. session.bug_compat_42 must be enabled before
|
||||
; these warnings can be issued by PHP. See the directive above for more information.
|
||||
|
||||
@ -5,7 +5,9 @@
|
||||
|
||||
<exclude-pattern type="relative">build/html</exclude-pattern>
|
||||
<exclude-pattern type="relative">build/aps</exclude-pattern>
|
||||
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern>
|
||||
<exclude-pattern type="relative">documents</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/includes</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/install/doctemplates/websites</exclude-pattern>
|
||||
|
||||
BIN
doc/images/dolibarr_512x512.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 234 KiB |
|
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 246 KiB |
BIN
doc/images/dolibarr_screenshot1_1680x1050.jpg
Normal file
|
After Width: | Height: | Size: 256 KiB |
|
Before Width: | Height: | Size: 255 KiB After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 98 KiB |
1
htdocs/.gitignore
vendored
@ -28,3 +28,4 @@
|
||||
/nomenclature*
|
||||
/of/
|
||||
/workstation/
|
||||
/oblyon*
|
||||
|
||||
@ -156,17 +156,8 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
$ok=1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'country_id' && in_array($tablib[$id], array('DictionaryVAT','DictionaryRegion','DictionaryCompanyType','DictionaryHolidayTypes','DictionaryRevenueStamp','DictionaryAccountancyCategory','Pcg_version'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'country' && in_array($tablib[$id], array('DictionaryCanton','DictionaryCompanyType','DictionaryRevenueStamp'))) continue; // For some pages, country is not mandatory
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy')) // Fields that are not mandatory
|
||||
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
||||
)
|
||||
)
|
||||
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]==''))
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
@ -174,19 +165,6 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
|
||||
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
|
||||
if ($fieldnamekey == 'nbjour') $fieldnamekey='NbOfDays';
|
||||
if ($fieldnamekey == 'decalage') $fieldnamekey='Offset';
|
||||
if ($fieldnamekey == 'module') $fieldnamekey='Module';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
|
||||
if ($fieldnamekey == 'taux') $fieldnamekey = 'Rate';
|
||||
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
|
||||
if ($fieldnamekey == 'position') $fieldnamekey = 'Position';
|
||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@ -196,9 +174,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||
}
|
||||
if (isset($_POST["code"]))
|
||||
if (isset($_POST["pcg_version"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
if ($_POST["pcg_version"]=='0')
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
@ -211,28 +189,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||
{
|
||||
if (in_array($tablib[$id], array('DictionaryCompanyType','DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
||||
{
|
||||
$_POST["country"]='';
|
||||
}
|
||||
else
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
|
||||
}
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
|
||||
}
|
||||
if (! is_numeric($_POST["code"]))
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors');
|
||||
}
|
||||
|
||||
// Clean some parameters
|
||||
if (isset($_POST["localtax1"]) && empty($_POST["localtax1"])) $_POST["localtax1"]='0'; // If empty, we force to 0
|
||||
if (isset($_POST["localtax2"]) && empty($_POST["localtax2"])) $_POST["localtax2"]='0'; // If empty, we force to 0
|
||||
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
|
||||
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
|
||||
@ -162,7 +162,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
|
||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
|
||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
|
||||
}
|
||||
// Other checks
|
||||
if (isset($_POST["code"]))
|
||||
@ -437,7 +437,7 @@ if ($id)
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='nature') {
|
||||
$valuetoshow=$langs->trans("Nature");
|
||||
$valuetoshow=$langs->trans("NatureOfJournal");
|
||||
}
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
@ -516,7 +516,7 @@ if ($id)
|
||||
}
|
||||
|
||||
// Title line with search boxes
|
||||
print '<tr class="liste_titre_filter liste_titre_add">';
|
||||
/*print '<tr class="liste_titre_filter liste_titre_add">';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
@ -524,16 +524,14 @@ if ($id)
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if ($filterfound)
|
||||
{
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
}
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
*/
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre liste_titre_add">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
@ -558,7 +556,7 @@ if ($id)
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='nature') {
|
||||
$valuetoshow=$langs->trans("Nature");
|
||||
$valuetoshow=$langs->trans("NatureOfJournal");
|
||||
}
|
||||
|
||||
// Affiche nom du champ
|
||||
|
||||
@ -462,7 +462,7 @@ if ($result)
|
||||
// print '<td class="left">' . $obj->description . '</td>';
|
||||
// TODO: we shoul set a user defined value to adjust user square / wide screen size
|
||||
$trunclengh = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
|
||||
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
print '<td>' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
|
||||
}
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_SELL' || $accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA' || $accounting_product_mode == 'ACCOUNTANCY_SELL_EXPORT')
|
||||
|
||||
@ -73,19 +73,11 @@ $y = $year_current;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width=150>' . $langs->trans("Label") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("JanuaryMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("FebruaryMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("MarchMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("AprilMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("MayMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("JuneMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("JulyMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("AugustMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("SeptemberMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("OctoberMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("NovemberMin") . '</td>';
|
||||
print '<td class="center">' . $langs->trans("DecemberMin") . '</td>';
|
||||
print '<td class="center"><strong>Total</strong></td>';
|
||||
for($i = 1; $i <= 12; $i++)
|
||||
{
|
||||
print '<td class="right">' . $langs->trans("MonthShort".sprintf("%02s", $i)) . '</td>';
|
||||
}
|
||||
print '<td class="center"><strong>'.$langs->trans("Total").'</strong></td>';
|
||||
print '</tr>';
|
||||
|
||||
$sql = "SELECT bk.numero_compte AS 'compte',";
|
||||
|
||||
@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||
|
||||
$id = GETPOST('id', 'int'); // id of record
|
||||
$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
|
||||
@ -346,6 +347,8 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
|
||||
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
|
||||
print '<input type="hidden" name="mode" value="_tmp">' . "\n";
|
||||
@ -441,7 +444,8 @@ if ($action == 'create')
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editdate') {
|
||||
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setdate">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print $form->selectDate($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate");
|
||||
@ -464,7 +468,8 @@ if ($action == 'create')
|
||||
print '</td><td>';
|
||||
if ($action == 'editjournal') {
|
||||
print '<form name="setjournal" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setjournal">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print $formaccounting->select_journal($object->code_journal, 'code_journal', 0, 0, array(), 1, 1);
|
||||
@ -487,7 +492,8 @@ if ($action == 'create')
|
||||
print '</td><td>';
|
||||
if ($action == 'editdocref') {
|
||||
print '<form name="setdocref" action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setdocref">';
|
||||
print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
print '<input type="text" size="20" name="doc_ref" value="'.dol_escape_htmltag($object->doc_ref).'">';
|
||||
@ -583,6 +589,8 @@ if ($action == 'create')
|
||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="doc_date" value="' . $object->doc_date . '">' . "\n";
|
||||
print '<input type="hidden" name="doc_type" value="' . $object->doc_type . '">' . "\n";
|
||||
print '<input type="hidden" name="doc_ref" value="' . $object->doc_ref . '">' . "\n";
|
||||
@ -641,8 +649,8 @@ if ($action == 'create')
|
||||
print '<td>' . $accountingaccount->getNomUrl(0, 1, 1, '', 0) . '</td>';
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
print '<td>' . $line->label_operation. '</td>';
|
||||
print '<td class="right">' . price($line->debit) . '</td>';
|
||||
print '<td class="right">' . price($line->credit) . '</td>';
|
||||
print '<td class="nowrap right">' . price($line->debit) . '</td>';
|
||||
print '<td class="nowrap right">' . price($line->credit) . '</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
@ -675,7 +683,7 @@ if ($action == 'create')
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
|
||||
@ -789,7 +789,7 @@ if ($num > 0)
|
||||
// Amount debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldebit'] += $line->debit;
|
||||
@ -798,7 +798,7 @@ if ($num > 0)
|
||||
// Amount credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td class="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalcredit'] += $line->credit;
|
||||
@ -879,8 +879,8 @@ if ($num > 0)
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="right">'.price($totalarray['totalcredit']).'</td>';
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
@ -48,8 +48,10 @@ class AccountancyExport
|
||||
public static $EXPORT_TYPE_BOB50 = 35;
|
||||
public static $EXPORT_TYPE_CIEL = 40;
|
||||
public static $EXPORT_TYPE_SAGE50_SWISS = 45;
|
||||
public static $EXPORT_TYPE_CHARLEMAGNE = 50;
|
||||
public static $EXPORT_TYPE_QUADRATUS = 60;
|
||||
public static $EXPORT_TYPE_OPENCONCERTO = 100;
|
||||
public static $EXPORT_TYPE_LDCOMPTA = 110;
|
||||
public static $EXPORT_TYPE_FEC = 1000;
|
||||
|
||||
|
||||
@ -105,7 +107,9 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
|
||||
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
|
||||
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
|
||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||
self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'),
|
||||
);
|
||||
|
||||
ksort($listofexporttypes, SORT_NUMERIC);
|
||||
@ -133,6 +137,7 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_AGIRIS => 'agiris',
|
||||
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
|
||||
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
|
||||
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
|
||||
self::$EXPORT_TYPE_FEC => 'fec',
|
||||
);
|
||||
|
||||
@ -191,10 +196,18 @@ class AccountancyExport
|
||||
'label' => $langs->trans('Modelcsv_Sage50_Swiss'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||
),
|
||||
self::$EXPORT_TYPE_LDCOMPTA => array(
|
||||
'label' => $langs->trans('Modelcsv_LDCompta'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||
),
|
||||
self::$EXPORT_TYPE_FEC => array(
|
||||
'label' => $langs->trans('Modelcsv_FEC'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||
),
|
||||
self::$EXPORT_TYPE_CHARLEMAGNE => array(
|
||||
'label' => $langs->trans('Modelcsv_charlemagne'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||
),
|
||||
),
|
||||
'cr'=> array (
|
||||
'1' => $langs->trans("Unix"),
|
||||
@ -257,12 +270,18 @@ class AccountancyExport
|
||||
case self::$EXPORT_TYPE_OPENCONCERTO :
|
||||
$this->exportOpenConcerto($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_FEC :
|
||||
$this->exportFEC($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_SAGE50_SWISS :
|
||||
$this->exportSAGE50SWISS($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_LDCOMPTA :
|
||||
$this->exportLDCompta($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_FEC :
|
||||
$this->exportFEC($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_CHARLEMAGNE :
|
||||
$this->exportCharlemagne($TData);
|
||||
break;
|
||||
default:
|
||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||
break;
|
||||
@ -274,7 +293,6 @@ class AccountancyExport
|
||||
* Export format : CEGID
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCegid($objectLines)
|
||||
@ -300,7 +318,6 @@ class AccountancyExport
|
||||
* Export format : COGILOG
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCogilog($objectLines)
|
||||
@ -334,7 +351,6 @@ class AccountancyExport
|
||||
* Export format : COALA
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCoala($objectLines)
|
||||
@ -362,7 +378,6 @@ class AccountancyExport
|
||||
* Export format : BOB50
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportBob50($objectLines)
|
||||
@ -401,7 +416,6 @@ class AccountancyExport
|
||||
* Export format : CIEL
|
||||
*
|
||||
* @param array $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportCiel(&$TData)
|
||||
@ -442,7 +456,6 @@ class AccountancyExport
|
||||
* Export format : Quadratus
|
||||
*
|
||||
* @param array $TData data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportQuadratus(&$TData)
|
||||
@ -526,7 +539,6 @@ class AccountancyExport
|
||||
* Export format : EBP
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportEbp($objectLines)
|
||||
@ -563,7 +575,6 @@ class AccountancyExport
|
||||
* Export format : Agiris Isacompta
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportAgiris($objectLines)
|
||||
@ -604,7 +615,6 @@ class AccountancyExport
|
||||
* Export format : OpenConcerto
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportOpenConcerto($objectLines)
|
||||
@ -634,16 +644,17 @@ class AccountancyExport
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : Configurable
|
||||
* Export format : Configurable CSV
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportConfigurable($objectLines)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$separator = $this->separator;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
$tab = array();
|
||||
// export configurable
|
||||
@ -651,15 +662,14 @@ class AccountancyExport
|
||||
$tab[] = $line->piece_num;
|
||||
$tab[] = $date;
|
||||
$tab[] = $line->doc_ref;
|
||||
$tab[] = $line->label_operation;
|
||||
$tab[] = preg_match('/'.$separator.'/', $line->label_operation) ? "'".$line->label_operation."'" : $line->label_operation;
|
||||
$tab[] = length_accountg($line->numero_compte);
|
||||
$tab[] = length_accounta($line->subledger_account);
|
||||
$tab[] = price($line->debit);
|
||||
$tab[] = price($line->credit);
|
||||
$tab[] = price($line->montant);
|
||||
$tab[] = price2num($line->debit);
|
||||
$tab[] = price2num($line->credit);
|
||||
$tab[] = price2num($line->montant);
|
||||
$tab[] = $line->code_journal;
|
||||
|
||||
$separator = $this->separator;
|
||||
print implode($separator, $tab) . $this->end_line;
|
||||
}
|
||||
}
|
||||
@ -668,7 +678,6 @@ class AccountancyExport
|
||||
* Export format : FEC
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportFEC($objectLines)
|
||||
@ -909,6 +918,160 @@ class AccountancyExport
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : LD Compta version 9 & higher
|
||||
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportLDCompta($objectLines)
|
||||
{
|
||||
|
||||
$separator = ';';
|
||||
$end_line = "\n";
|
||||
|
||||
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');
|
||||
|
||||
// TYPE
|
||||
$type_enregistrement = 'E'; // For write movement
|
||||
print $type_enregistrement . $separator;
|
||||
// JNAL
|
||||
print substr($line->code_journal, 0, 2) . $separator;
|
||||
// NECR
|
||||
print $line->id . $separator;
|
||||
// NPIE
|
||||
print $line->piece_num . $separator;
|
||||
// DATP
|
||||
print $date_document . $separator;
|
||||
// LIBE
|
||||
print $line->label_operation . $separator;
|
||||
// DATH
|
||||
print $line->date_lim_reglement . $separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
$nature_piece = 'AF';
|
||||
} else {
|
||||
$nature_piece = 'FF';
|
||||
}
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
$nature_piece = 'AC';
|
||||
} else {
|
||||
$nature_piece = 'FC';
|
||||
}
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $nature_piece . $separator;
|
||||
// RACI
|
||||
/*
|
||||
if (! empty($line->subledger_account)) {
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
$racine_subledger_account = '40';
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
$racine_subledger_account = '41';
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $racine_subledger_account . $separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
*/
|
||||
// MONT
|
||||
print price(abs($line->montant)) . $separator;
|
||||
// CODC
|
||||
print $line->sens . $separator;
|
||||
// CPTG
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
// DATE
|
||||
print $date_creation . $separator;
|
||||
// CLET
|
||||
print $line->lettering_code . $separator;
|
||||
// DATL
|
||||
print $line->date_lettering . $separator;
|
||||
// CPTA
|
||||
if (! empty($line->subledger_account)) {
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
}
|
||||
// CNAT
|
||||
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
|
||||
print 'F';
|
||||
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
|
||||
print 'C';
|
||||
} else {
|
||||
print '';
|
||||
}
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : Charlemagne
|
||||
*
|
||||
* @param array $objectLines data
|
||||
* @return void
|
||||
*/
|
||||
public function exportCharlemagne($objectLines)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('compta');
|
||||
|
||||
$separator = "\t";
|
||||
$end_line = "\n";
|
||||
|
||||
/*
|
||||
* Charlemagne export need header
|
||||
*/
|
||||
print $langs->transnoentitiesnoconv('Date') . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Journal'), 6) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Account'), 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('LabelAccount'), 60) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Piece'), 20) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('LabelOperation'), 60) . $separator;
|
||||
print $langs->transnoentitiesnoconv('Amount') . $separator;
|
||||
print 'S' . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 1', 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 1', 60) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 2', 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 2', 60) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('Analytic') . ' 3', 15) . $separator;
|
||||
print self::trunc($langs->transnoentitiesnoconv('AnalyticLabel') . ' 3', 60) . $separator;
|
||||
print $end_line;
|
||||
|
||||
foreach($objectLines as $line) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
print $date . $separator; //Date
|
||||
|
||||
print self::trunc($line->code_journal, 6) . $separator; //Journal code
|
||||
|
||||
if(!empty($line->subledger_account)) $account = $line->subledger_account;
|
||||
else $account = $line->numero_compte;
|
||||
print self::trunc($account, 15) . $separator;//Account number
|
||||
|
||||
print self::trunc($line->label_compte, 60) . $separator;//Account label
|
||||
print self::trunc($line->doc_ref, 20) . $separator;//Piece
|
||||
print self::trunc($line->label_operation, 60) . $separator;//Operation label
|
||||
print price(abs($line->montant)) . $separator;//Amount
|
||||
print $line->sens . $separator;//Direction
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $separator;//Analytic
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* trunc
|
||||
*
|
||||
|
||||
@ -321,8 +321,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ", piece_num";
|
||||
$sql .= ', entity';
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'");
|
||||
$sql .= "'".$this->db->idate($this->doc_date)."'";
|
||||
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
|
||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||
$sql .= "," . $this->fk_doc;
|
||||
@ -338,7 +338,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= "," . $this->montant;
|
||||
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
|
||||
$sql .= ",'" . $this->db->idate($now). "'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
||||
$sql .= "," . $this->db->escape($this->piece_num);
|
||||
@ -469,14 +469,15 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function createStd(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->doc_type)) {
|
||||
$this->doc_type = trim($this->doc_type);
|
||||
}
|
||||
@ -540,10 +541,10 @@ class BookKeeping extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
$this->journal_label = $langs->trans($this->journal_label);
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.' (';
|
||||
$sql .= 'doc_date,';
|
||||
$sql .= 'date_lim_reglement,';
|
||||
$sql .= 'doc_type,';
|
||||
@ -567,7 +568,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= 'piece_num,';
|
||||
$sql .= 'entity';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'".$this->db->idate($this->doc_date)."'") . ',';
|
||||
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
||||
@ -584,7 +585,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||
$sql .= ' ' . $user->id . ',';
|
||||
$sql .= ' ' . "'" . $this->db->idate($now) . "',";
|
||||
$sql .= ' ' . "'".$this->db->idate($now)."',";
|
||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||
@ -1161,7 +1162,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . $mode.' SET';
|
||||
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ',';
|
||||
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'".$this->db->idate($this->doc_date)."'" : 'null') . ',';
|
||||
$sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ',';
|
||||
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
|
||||
$sql .= ' fk_doc = ' . (isset($this->fk_doc) ? $this->fk_doc : "null") . ',';
|
||||
@ -1689,28 +1690,30 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($direction==0)
|
||||
if ($direction==0)
|
||||
{
|
||||
$next_piecenum=$this->getNextNumMvt();
|
||||
$now = dol_now();
|
||||
|
||||
if ($next_piecenum < 0) {
|
||||
$error++;
|
||||
}
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . ' (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= 'SELECT doc_date, doc_type,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.'';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, ' . $next_piecenum . ", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $this->db->escape($piece_num);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $this->db->escape($piece_num);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
@ -1718,29 +1721,29 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
} elseif ($direction==1) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $piece_num;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'_tmp(doc_date, doc_type,';
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '_tmp (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= 'SELECT doc_date, doc_type,';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.' WHERE piece_num = '.$piece_num;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.' WHERE piece_num = ' . $piece_num;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $piece_num;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
|
||||
@ -374,9 +374,9 @@ if ($result) {
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
if ($product_static->id > 0) print $product_static->getNomUrl(1);
|
||||
if ($product_static->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($objp->product_label) print $objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
|
||||
@ -319,8 +319,8 @@ if ($result) {
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
@ -330,8 +330,8 @@ if ($result) {
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
if ($search_country) $param .= "&search_country=" . urlencode($search_country);
|
||||
if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra);
|
||||
if ($search_country) $param.= "&search_country=".urlencode($search_country);
|
||||
if ($search_tvaintra) $param.= "&search_tvaintra=".urlencode($search_tvaintra);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -403,7 +403,7 @@ if ($result) {
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
@ -964,7 +964,7 @@ if (empty($action) || $action == 'view') {
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
|
||||
// Test that setup is complete
|
||||
|
||||
@ -384,9 +384,9 @@ if ($result) {
|
||||
|
||||
// Ref product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
if ($product_static->id > 0) print $product_static->getNomUrl(1);
|
||||
if ($product_static->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($objp->product_label) print $objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
|
||||
@ -405,7 +405,7 @@ if ($result) {
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -653,7 +653,7 @@ if (empty($reshook))
|
||||
|
||||
if (empty($labeltouse) || (int) $labeltouse === -1) {
|
||||
//fallback on the old configuration.
|
||||
setEventMessages('WarningMandatorySetupNotComplete', [], 'errors');
|
||||
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
else {
|
||||
@ -734,7 +734,7 @@ if (empty($reshook))
|
||||
|
||||
if (empty($labeltouse) || (int) $labeltouse === -1) {
|
||||
//fallback on the old configuration.
|
||||
setEventMessages('WarningMandatorySetupNotComplete', [], 'errors');
|
||||
setEventMessages('WarningMandatorySetupNotComplete', null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
else {
|
||||
@ -1187,7 +1187,7 @@ else
|
||||
}
|
||||
// Morphy
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy")?GETPOST("morphy", 'alpha'):$object->morphy));
|
||||
print "</td></tr>";
|
||||
|
||||
@ -2315,6 +2315,7 @@ class Adherent extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
||||
$response->labelShort=$langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||
$response->img=img_object('', "user");
|
||||
|
||||
@ -2439,6 +2440,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
|
||||
*
|
||||
@ -2448,7 +2450,7 @@ class Adherent extends CommonObject
|
||||
* 2=Return key only (uid=qqq)
|
||||
* @return string DN
|
||||
*/
|
||||
private function _load_ldap_dn($info, $mode = 0)
|
||||
public function _load_ldap_dn($info, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
@ -121,10 +121,12 @@ class AdherentType extends CommonObject
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type (";
|
||||
$sql.= "libelle";
|
||||
$sql.= " morphy";
|
||||
$sql.= ", libelle";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->label)."'";
|
||||
$sql.= "'".$this->db->escape($this->morphy)."'";
|
||||
$sql.= ", '".$this->db->escape($this->label)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
@ -53,21 +53,21 @@ class Subscription extends CommonObject
|
||||
* @var integer
|
||||
*/
|
||||
public $datec;
|
||||
|
||||
|
||||
/**
|
||||
* Date modification record (tms)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $datem;
|
||||
|
||||
|
||||
/**
|
||||
* Subscription start date (date subscription)
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
public $dateh;
|
||||
|
||||
|
||||
/**
|
||||
* Subscription end date
|
||||
*
|
||||
@ -128,10 +128,11 @@ class Subscription extends CommonObject
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
|
||||
|
||||
if ($this->fk_type == null) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
$member=new Adherent($this->db);
|
||||
$result=$member->fetch($this->fk_adherent);
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
$member=new Adherent($this->db);
|
||||
$result=$member->fetch($this->fk_adherent);
|
||||
|
||||
if ($this->fk_type == null) { // If type not defined, we use the type of member
|
||||
$type=$member->typeid;
|
||||
} else {
|
||||
$type=$this->fk_type;
|
||||
@ -151,11 +152,13 @@ class Subscription extends CommonObject
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
$this->fk_type = $type;
|
||||
}
|
||||
|
||||
if (! $error && ! $notrigger)
|
||||
{
|
||||
// Call triggers
|
||||
$this->context = array('member'=>$member);
|
||||
// Call triggers
|
||||
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
@ -257,7 +260,8 @@ class Subscription extends CommonObject
|
||||
$result=$member->update_end_date($user);
|
||||
|
||||
if (! $error && ! $notrigger) {
|
||||
// Call triggers
|
||||
$this->context = array('member'=>$member);
|
||||
// Call triggers
|
||||
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
|
||||
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
|
||||
// End call triggers
|
||||
|
||||
@ -182,7 +182,7 @@ if ($result > 0)
|
||||
if (empty($dn))
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete").'</font></td></tr>';
|
||||
print '<tr '.$bc[false].'><td colspan="2"><font class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).'</font></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2007-2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -205,18 +205,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// 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'</td></tr>';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Member").'</td><td class="valeur" colspan="3">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date start subscription
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
|
||||
print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1);
|
||||
@ -309,6 +309,12 @@ if ($rowid && $action != 'edit')
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
@ -322,17 +328,6 @@ if ($rowid && $action != 'edit')
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Member
|
||||
$adh->ref=$adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date record
|
||||
/*print '<tr>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dol_print_date($object->datec,'dayhour').'</td>';
|
||||
print '</tr>';*/
|
||||
|
||||
// Date subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dol_print_date($object->dateh, 'day').'</td>';
|
||||
|
||||
@ -229,7 +229,7 @@ if ($search_type) $param.="&search_type=".urlencode($search_type);
|
||||
if ($date_select) $param.="&date_select=".urlencode($date_select);
|
||||
if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
|
||||
if ($search_login) $param.="&search_login=".urlencode($search_login);
|
||||
if ($search_acount) $param.="&search_account=".urlencode($search_account);
|
||||
if ($search_account) $param.="&search_account=".urlencode($search_account);
|
||||
if ($search_amount) $param.="&search_amount=".urlencode($search_amount);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
|
||||
@ -342,7 +342,7 @@ if ($action == 'create')
|
||||
// Morphy
|
||||
$morphys[""] = $langs->trans("MorPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
$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 "</td></tr>";
|
||||
@ -775,7 +775,7 @@ if ($rowid > 0)
|
||||
// Morphy
|
||||
$morphys[""] = $langs->trans("MorPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
$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 "</td></tr>";
|
||||
|
||||
@ -40,7 +40,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$search_event = GETPOST('search_event', 'alpha');
|
||||
|
||||
// Get list of triggers available
|
||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
|
||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype, a.rang as position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql.= " ORDER BY a.rang ASC";
|
||||
$resql=$db->query($sql);
|
||||
@ -55,6 +55,7 @@ if ($resql)
|
||||
$triggers[$i]['code'] = $obj->code;
|
||||
$triggers[$i]['element'] = $obj->elementtype;
|
||||
$triggers[$i]['label'] = ($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
|
||||
$triggers[$i]['position'] = $obj->position;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -65,6 +66,8 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//$triggers = dol_sort_array($triggers, 'code', 'asc', 0, 0, 1);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -37,12 +37,12 @@ $action = GETPOST('action', 'aZ09');
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$result=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
|
||||
$result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$result1=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
|
||||
$result2=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if ($result1 >= 0 && $result2 >= 0)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
|
||||
@ -35,7 +35,10 @@ if (!$user->admin)
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
|
||||
|
||||
$arrayofparameters=array(
|
||||
'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2),
|
||||
'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1),
|
||||
'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled)
|
||||
@ -68,7 +71,6 @@ $head=dav_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'webdav', '', -1, 'action');
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@ -76,14 +78,17 @@ if ($action == 'edit')
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
if (isset($val['enabled']) && empty($val['enabled'])) continue;
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
$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");
|
||||
print $form->textwithpicto($label, $tooltiphelp);
|
||||
print '</td><td>';
|
||||
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
|
||||
{
|
||||
@ -112,12 +117,13 @@ if ($action == 'edit')
|
||||
else
|
||||
{
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach($arrayofparameters as $key => $val)
|
||||
{
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans($key), $langs->trans($key.'Tooltip'));
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
print $form->textwithpicto($langs->trans($key), $tooltiphelp);
|
||||
print '</td><td>';
|
||||
if ($key == 'DAV_ALLOW_PRIVATE_DIR')
|
||||
{
|
||||
@ -177,6 +183,13 @@ if (! empty($conf->global->DAV_ALLOW_PUBLIC_DIR))
|
||||
}
|
||||
print $message;
|
||||
|
||||
print '<br><br><br>';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/sabre/autoload.php';
|
||||
$version = Sabre\DAV\Version::VERSION;
|
||||
print '<span class="opacitymedium">'.$langs->trans("BaseOnSabeDavVersion").' : '.$version.'</span>';
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -195,7 +195,6 @@ if ($action == 'edit')
|
||||
{
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
|
||||
@ -235,7 +234,6 @@ else
|
||||
{
|
||||
foreach($delays as $delay)
|
||||
{
|
||||
|
||||
$value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0);
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="20px">'.img_object('', $delay['img']).'</td>';
|
||||
@ -264,7 +262,7 @@ else
|
||||
print '<br>';
|
||||
|
||||
// Show logo for weather
|
||||
print $langs->trans("DescWeather").'<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
|
||||
|
||||
if($action == 'edit') {
|
||||
|
||||
@ -300,16 +298,16 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print img_weather($text, 0, $options);
|
||||
print '= <input type="text" size="2" name="MAIN_METEO_LEVEL0" value="'.$level0.'"/></td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL1" value="'.$level1.'"/></td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL2" value="'.$level2.'"/></td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_LEVEL3" value="'.$level3.'"/></td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@ -320,16 +318,16 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print '= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||
print img_weather($text, 0, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL0" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL1" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL2" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.'"/> %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= <input type="text" size="2" name="MAIN_METEO_PERCENTAGE_LEVEL3" value="'.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.'"/> %</td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@ -371,19 +369,19 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print img_weather($text, 0, $options);
|
||||
print '= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL0.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL1.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL2.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-storm.png', $options);
|
||||
print img_weather($text, 4, $options);
|
||||
print '> '.$conf->global->MAIN_METEO_PERCENTAGE_LEVEL3.' %</td>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
@ -391,19 +389,19 @@ if ($action == 'edit') {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clear.png', $options);
|
||||
print img_weather($text, 0, $options);
|
||||
print '= '.$level0;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-few-clouds.png', $options);
|
||||
print img_weather($text, 1, $options);
|
||||
print '<= '.$level1;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-clouds.png', $options);
|
||||
print img_weather($text, 2, $options);
|
||||
print '<= '.$level2;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-many-clouds.png', $options);
|
||||
print img_weather($text, 3, $options);
|
||||
print '<= '.$level3;
|
||||
print '</div><div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 'weather-storm.png', $options);
|
||||
print img_weather($text, 4, $options);
|
||||
print '> '.$level3;
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
@ -1058,7 +1058,7 @@ if ($id)
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class='';
|
||||
|
||||
if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='width100'; }
|
||||
if ($fieldlist[$field]=='pos') { $valuetoshow=$langs->trans("Position"); $class='maxwidth100'; }
|
||||
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); }
|
||||
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); }
|
||||
if ($fieldlist[$field]=='taux') {
|
||||
@ -1076,7 +1076,7 @@ if ($id)
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
||||
else $valuetoshow=$langs->trans("Type");
|
||||
}
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='width100'; }
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='maxwidth100'; }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||
{
|
||||
$valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"), 2, 1, img_help(1, ''));
|
||||
@ -1602,7 +1602,6 @@ if ($id)
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
|
||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
||||
if ($fieldlist[$field] == 'code') $class.=' width100';
|
||||
if ($fieldlist[$field] == 'position') $class.=' right';
|
||||
if ($fieldlist[$field] == 'localtax1_type') $class.=' nowrap';
|
||||
if ($fieldlist[$field] == 'localtax2_type') $class.=' nowrap';
|
||||
@ -1622,7 +1621,11 @@ if ($id)
|
||||
elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
|
||||
elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
|
||||
}
|
||||
|
||||
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page')))
|
||||
{
|
||||
$iserasable = 0; $canbedisabled = 0;
|
||||
if (in_array($obj->code, array('banner'))) $canbedisabled = 1;
|
||||
}
|
||||
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
|
||||
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
|
||||
$canbemodified=$iserasable;
|
||||
@ -1776,7 +1779,6 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList,$localtax_typeList;
|
||||
global $bc;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
@ -1977,7 +1979,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
}
|
||||
|
||||
$classtd=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $classtd='width100';
|
||||
if ($fieldlist[$field]=='code') $class='maxwidth100';
|
||||
if (in_array($fieldlist[$field], array('pos', 'use_default', 'affect', 'delay', 'position', 'sortorder', 'sens', 'category_type'))) $class='maxwidth50';
|
||||
if (in_array($fieldlist[$field], array('libelle', 'label', 'tracking'))) $class='quatrevingtpercent';
|
||||
print '<td class="'.$classtd.'">';
|
||||
|
||||
228
htdocs/admin/facture_situation.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/facture.php
|
||||
* \ingroup facture
|
||||
* \brief Page to setup invoice module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='invoice';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader(
|
||||
"", $langs->trans("BillsSetup"),
|
||||
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
|
||||
);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = invoice_admin_prepare_head();
|
||||
dol_fiche_head($head, 'situation', $langs->trans("InvoiceSituation"), -1, 'invoice');
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("InvoiceSituation"), '', '');
|
||||
$var=0;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
_updateBtn();
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
|
||||
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
|
||||
_printOnOff('INVOICE_USE_SITUATION_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
|
||||
|
||||
$metas = array(
|
||||
'type' => 'number',
|
||||
'step' => '0.01',
|
||||
'min' => 0,
|
||||
'max' => 100
|
||||
);
|
||||
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
|
||||
|
||||
|
||||
|
||||
|
||||
// Conditions paiements
|
||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="right" width="300">';
|
||||
print '<input type="hidden" name="param'.$inputCount.'" value="INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID">';
|
||||
$form->select_conditions_paiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'value'.$inputCount, -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
_updateBtn();
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
/**
|
||||
* Print an update button
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _updateBtn()
|
||||
{
|
||||
global $langs;
|
||||
print '<div style="text-align: right;" >';
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a On/Off button
|
||||
*
|
||||
* @param string $confkey the conf key
|
||||
* @param bool $title Title of conf
|
||||
* @param string $desc Description
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _printOnOff($confkey, $title = false, $desc = '')
|
||||
{
|
||||
global $var, $bc, $langs;
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.($title?$title:$langs->trans($confkey));
|
||||
if (!empty($desc)) {
|
||||
print '<br><small>'.$langs->trans($desc).'</small>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="right" width="300">';
|
||||
print ajax_constantonoff($confkey);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a form part
|
||||
*
|
||||
* @param string $confkey the conf key
|
||||
* @param bool $title Title of conf
|
||||
* @param string $desc Description of
|
||||
* @param array $metas html meta
|
||||
* @param string $type type of input textarea or input
|
||||
* @param bool $help help description
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false)
|
||||
{
|
||||
global $var, $bc, $langs, $conf, $db, $inputCount;
|
||||
$var=!$var;
|
||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
||||
$form=new Form($db);
|
||||
|
||||
$defaultMetas = array(
|
||||
'name' => 'value'.$inputCount
|
||||
);
|
||||
|
||||
if ($type!='textarea') {
|
||||
$defaultMetas['type'] = 'text';
|
||||
$defaultMetas['value'] = $conf->global->{$confkey};
|
||||
}
|
||||
|
||||
|
||||
$metas = array_merge($defaultMetas, $metas);
|
||||
$metascompil = '';
|
||||
foreach ($metas as $key => $values) {
|
||||
$metascompil .= ' '.$key.'="'.$values.'" ';
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
if (!empty($help)) {
|
||||
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
|
||||
} else {
|
||||
print $title?$title:$langs->trans($confkey);
|
||||
}
|
||||
|
||||
if (!empty($desc)) {
|
||||
print '<br><small>'.$langs->trans($desc).'</small>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="right" width="300">';
|
||||
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
if ($type=='textarea') {
|
||||
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
|
||||
} else {
|
||||
print '<input '.$metascompil.' />';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2009-2012 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
/* Copyright (C) 2009-2019 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -36,9 +36,11 @@ $langs->loadLangs(array("admin","errors"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'set')
|
||||
{
|
||||
$error=0;
|
||||
@ -53,8 +55,11 @@ if ($action == 'set')
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$res = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res1 = dolibarr_set_const($db, "GEOIP_VERSION", GETPOST('geoipversion', 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
if (! $res1 > 0) $error++;
|
||||
|
||||
$res2 = dolibarr_set_const($db, "GEOIPMAXMIND_COUNTRY_DATAFILE", $gimcdf, 'chaine', 0, '', $conf->entity);
|
||||
if (! $res2 > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -67,6 +72,8 @@ if ($action == 'set')
|
||||
}
|
||||
}
|
||||
|
||||
if (! isset($conf->global->GEOIP_VERSION)) $conf->global->GEOIP_VERSION = '2';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -85,13 +92,6 @@ $geoip='';
|
||||
if (! empty($conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE))
|
||||
{
|
||||
$geoip=new DolGeoIP('country', $conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE);
|
||||
//if ($geoip->error) print dol_htmloutput_errors($geoip->errorlabel,'',1);
|
||||
if ($geoip->gi == 'NOGI') $geointernal=true;
|
||||
else $geointernal=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (function_exists('geoip_country_code_by_name')) $geointernal=true;
|
||||
}
|
||||
|
||||
// Mode
|
||||
@ -105,16 +105,30 @@ print '<td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td
|
||||
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td width=\"50%\">'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
// Lib version
|
||||
print '<tr class="oddeven"><td width="50%">'.$langs->trans("GeoIPLibVersion").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$arrayofvalues = array('php' => 'Native PHP functions', '1' => 'Embedded GeoIP v1', '2' => 'Embedded GeoIP v2');
|
||||
print $form->selectarray('geoipversion', $arrayofvalues, (isset($conf->global->GEOIP_VERSION) ? $conf->global->GEOIP_VERSION : '2'));
|
||||
if ($conf->global->GEOIP_VERSION == 'php')
|
||||
{
|
||||
if ($geoip) $version=$geoip->getVersion();
|
||||
if ($version)
|
||||
{
|
||||
print '<br>'.$langs->trans("Version").': '.$version;
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Path to database file
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'</td>';
|
||||
print '<td colspan="2">';
|
||||
|
||||
if ($geointernal) print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).'<br>';
|
||||
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
|
||||
if ($geoip) $version=$geoip->getVersion();
|
||||
if ($version)
|
||||
if ($conf->global->GEOIP_VERSION == 'php')
|
||||
{
|
||||
print '<br>'.$langs->trans("Version").': '.$version;
|
||||
print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).' or /pathtodatafile/GeoLite2-Country.mmdb<br>';
|
||||
}
|
||||
print '<input size="50" type="text" name="GEOIPMAXMIND_COUNTRY_DATAFILE" value="'.$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -144,6 +158,13 @@ if ($geoip)
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("Error");
|
||||
|
||||
$ip='2a01:e0a:7e:4a60:429a:23ff:f7b8:dc8a'; // should be France
|
||||
print '<br>'.$ip.' -> ';
|
||||
$result=dol_print_ip($ip, 1);
|
||||
if ($result) print $result;
|
||||
else print $langs->trans("Error");
|
||||
|
||||
|
||||
/* We disable this test because dol_print_ip need an ip as input
|
||||
$ip='www.google.com';
|
||||
print '<br>'.$ip.' -> ';
|
||||
|
||||
@ -201,6 +201,7 @@ dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
|
||||
|
||||
print load_fiche_titre($langs->trans("HolidaysNumberingModules"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
@ -294,8 +295,10 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
@ -331,6 +334,7 @@ else
|
||||
}
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
@ -457,6 +461,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print "<br>";
|
||||
|
||||
|
||||
@ -469,6 +474,8 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_other">';
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
@ -506,6 +513,8 @@ print '<input size="50" class="flat" type="text" name="HOLIDAY_DRAFT_WATERMARK"
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
|
||||
@ -60,6 +60,7 @@ if (GETPOST('cancel', 'alpha'))
|
||||
|
||||
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);
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
|
||||
@ -81,6 +82,7 @@ if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACK
|
||||
if ($action == 'update')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity);
|
||||
@ -257,7 +259,7 @@ if ($action == 'edit') // Edit
|
||||
print '</table><br>'."\n";
|
||||
|
||||
// Themes and themes options
|
||||
show_theme(null, 1);
|
||||
showSkins(null, 1);
|
||||
print '<br>';
|
||||
|
||||
// Other
|
||||
@ -462,7 +464,7 @@ else // Show
|
||||
|
||||
|
||||
// Themes
|
||||
show_theme(null, 0);
|
||||
showSkins(null, 0);
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
@ -526,11 +526,17 @@ else
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Disable
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS);
|
||||
if (! empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO) && ! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
||||
{
|
||||
if (! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Add user to select destinaries list
|
||||
|
||||
@ -87,7 +87,8 @@ if ($action == 'update')
|
||||
$result=$menu->fetch(GETPOST('menuId', 'int'));
|
||||
if ($result > 0)
|
||||
{
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->titre=GETPOST('titre', 'alpha'); // deprecated
|
||||
$menu->title=GETPOST('titre', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'aZ09');
|
||||
$menu->url=GETPOST('url', 'alpha');
|
||||
$menu->langs=GETPOST('langs', 'alpha');
|
||||
@ -205,7 +206,8 @@ if ($action == 'add')
|
||||
$menu = new Menubase($db);
|
||||
$menu->menu_handler=preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
|
||||
$menu->type=GETPOST('type', 'alpha');
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->titre=GETPOST('titre', 'alpha'); // deprecated
|
||||
$menu->title=GETPOST('titre', 'alpha');
|
||||
$menu->url=GETPOST('url', 'alpha');
|
||||
$menu->langs=GETPOST('langs', 'alpha');
|
||||
$menu->position=GETPOST('position', 'int');
|
||||
@ -494,7 +496,7 @@ elseif ($action == 'edit')
|
||||
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre ? $menu->titre : $menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
|
||||
@ -244,13 +244,13 @@ print "<br>\n";
|
||||
// Confirmation for remove menu entry
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$sql = "SELECT m.titre";
|
||||
$sql = "SELECT m.titre as title";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||
$sql.= " WHERE m.rowid = ".GETPOST('menuId', 'int');
|
||||
$result = $db->query($sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->titre), "confirm_delete");
|
||||
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->title), "confirm_delete");
|
||||
}
|
||||
|
||||
$newcardbutton='';
|
||||
|
||||
@ -130,13 +130,13 @@ if ($action=='install')
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! preg_match('/\.zip$/i', $original_file))
|
||||
if (! $error && ! preg_match('/\.zip$/i', $original_file))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i', $original_file))
|
||||
if (! $error && ! preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors');
|
||||
@ -180,13 +180,13 @@ if ($action=='install')
|
||||
{
|
||||
// Now we move the dir of the module
|
||||
$modulename=preg_replace('/module_/', '', $original_file);
|
||||
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
|
||||
$modulename=preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
|
||||
// Search dir $modulename
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example .../mymodule
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
|
||||
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example .../htdocs/mymodule
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
@ -195,10 +195,16 @@ if ($action=='install')
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// TODO Make more test
|
||||
}
|
||||
|
||||
// Now we install the module
|
||||
if (! $error)
|
||||
{
|
||||
//var_dump($dirins);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulename);
|
||||
@dol_delete_dir_recursive($dirins.'/'.$modulename); // delete the zip file
|
||||
dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
|
||||
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
|
||||
if ($result <= 0)
|
||||
@ -653,8 +659,8 @@ if ($mode == 'common')
|
||||
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
|
||||
if (! empty($objMod->picto))
|
||||
{
|
||||
if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, ' width="14px"', 1);
|
||||
else print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"');
|
||||
if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule"', 1);
|
||||
else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule"');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -900,7 +906,8 @@ if ($mode == 'marketplace')
|
||||
|
||||
?>
|
||||
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
||||
<input type="hidden" name="mode" value="marketplace" />
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>">
|
||||
<input type="hidden" name="mode" value="marketplace">
|
||||
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
|
||||
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
||||
</div>
|
||||
@ -1026,15 +1033,35 @@ if ($mode == 'deploy')
|
||||
|
||||
print $langs->trans("YouCanSubmitFile");
|
||||
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // In Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
// Now $max and $maxphp are in Kb
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
if ($maxphp > 0) $maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp)
|
||||
{
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxmin > 0)
|
||||
{
|
||||
@ -1062,7 +1089,7 @@ if ($mode == 'deploy')
|
||||
{
|
||||
$langs->load('other');
|
||||
print ' ';
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1);
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2012-2107 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -279,6 +280,12 @@ if ($action == 'edit') // Edit
|
||||
print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS', (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
//Invert sender and recipient
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("SwapSenderAndRecipientOnPDF").'</td><td>';
|
||||
print $form->selectyesno('MAIN_INVERT_SENDER_RECIPIENT', (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT))?$conf->global->MAIN_INVERT_SENDER_RECIPIENT:0, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Place customer adress to the ISO location
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PlaceCustomerAddressToIsoLocation").'</td><td>';
|
||||
|
||||
@ -220,7 +220,7 @@ print load_fiche_titre($langs->trans("SupplierProposalSetup"), $linkback, 'title
|
||||
|
||||
$head = supplier_proposal_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("CommRequests"), 0, 'supplier_proposal');
|
||||
dol_fiche_head($head, 'general', $langs->trans("CommRequests"), -1, 'supplier_proposal');
|
||||
|
||||
/*
|
||||
* Module numerotation
|
||||
|
||||
@ -70,6 +70,18 @@ else
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module log
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test=empty($conf->syslog->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else
|
||||
{
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module debugbar
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
|
||||
@ -77,7 +89,7 @@ $test=empty($conf->debugbar->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else
|
||||
{
|
||||
print img_picto('', 'warning').' '.$langs->trans("DebugBarModuleActivated");
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("DebugBar"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
@ -110,20 +122,20 @@ $test=function_exists('xcache_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("XCacheInstalled");
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "XCache");
|
||||
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>';
|
||||
}
|
||||
$test=function_exists('eaccelerator_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("EAcceleratorInstalled");
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "Eaccelerator");
|
||||
}
|
||||
$test=function_exists('opcache_get_status');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ZendOPCacheInstalled"); // Should be by default starting with PHP 5.5
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "ZendOPCache"); // Should be by default starting with PHP 5.5
|
||||
//$tmp=opcache_get_status();
|
||||
//var_dump($tmp);
|
||||
}
|
||||
@ -144,6 +156,21 @@ if (! $foundcache && $test)
|
||||
if (! $foundcache) print $langs->trans("NoOPCodeCacheFound");
|
||||
print '<br>';
|
||||
|
||||
// Use of preload bootstrap
|
||||
if (ini_get('opcache.preload'))
|
||||
{
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: ';
|
||||
print ini_get('opcache.preload');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: ';
|
||||
print $langs->trans("No");
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// HTTPCacheStaticResources
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
@ -467,16 +494,46 @@ if ($resql)
|
||||
{
|
||||
if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
|
||||
{
|
||||
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXProductUseSearchOptim", $nb);
|
||||
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"), 'PRODUCT_DONOTSEARCH_ANYWHERE');
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXProductAndSearchOptimOn", $nb);
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NbOfProductIsLowerThanNoPb", $nb);
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
|
||||
}
|
||||
print '<br>';
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Thirdparty search
|
||||
$tab = array();
|
||||
$sql = "SELECT COUNT(*) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$limitforoptim=10000;
|
||||
$num=$db->num_rows($resql);
|
||||
$obj=$db->fetch_object($resql);
|
||||
$nb=$obj->nb;
|
||||
if ($nb > $limitforoptim)
|
||||
{
|
||||
if (empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE))
|
||||
{
|
||||
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'COMPANY_DONOTSEARCH_ANYWHERE');
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
|
||||
}
|
||||
print '<br>';
|
||||
$db->free($resql);
|
||||
|
||||
@ -48,14 +48,31 @@ if (isset($title))
|
||||
}
|
||||
|
||||
|
||||
// Check PHP setup is OK
|
||||
$maxphp=@ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("WarningParamUploadMaxFileSizeHigherThanPostMaxSize", @ini_get('upload_max_filesize'), @ini_get('post_max_size')), 0, 0, 0, 'warning');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print "\n";
|
||||
|
||||
$var=false;
|
||||
|
||||
// Recupere la version de PHP
|
||||
// Get PHP version
|
||||
$phpversion=version_php();
|
||||
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
||||
|
||||
|
||||
@ -50,14 +50,23 @@ if (! $user->admin)
|
||||
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
$action='';
|
||||
if (preg_match('/^backup\//', GETPOST('urlfile', 'alpha')))
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/backup/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$file=$conf->admin->dir_output.'/documents/'.basename(GETPOST('urlfile', 'alpha'));
|
||||
$ret=dol_delete_file($file, 1);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
|
||||
}
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -446,8 +455,10 @@ print "\n";
|
||||
|
||||
|
||||
<br>
|
||||
<div class="center"><input type="submit" class="button"
|
||||
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br>
|
||||
<div class="center">
|
||||
<input type="submit" class="button reposition" value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo">
|
||||
<input type="hidden" name="page_y" value="<?php echo GETPOST('page_y', 'int'); ?>">
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
@ -459,7 +470,7 @@ if (! empty($_SESSION["commandbackuplastdone"]))
|
||||
|
||||
//print $paramclear;
|
||||
|
||||
// Now run command and show result
|
||||
// Now show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
@ -598,9 +609,6 @@ print '<br>';
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
// End of page
|
||||
|
||||
@ -118,14 +118,14 @@ function create_script_table($list)
|
||||
{
|
||||
global $sortby,$langs;
|
||||
|
||||
if (GETPOT('order') == "asc" || GETPOST('order') =="desc") {
|
||||
$order = GETPOST('order');
|
||||
if (GETPOT('order', 'alpha') == "asc" || GETPOST('order', 'alpha') == "desc") {
|
||||
$order = GETPOST('order', 'alpha');
|
||||
} else {
|
||||
$order = "asc";
|
||||
}
|
||||
|
||||
if (GETPOST('order')) {
|
||||
switch (GETPOST('order')) {
|
||||
if (GETPOST('order', 'alpha')) {
|
||||
switch (GETPOST('order', 'alpha')) {
|
||||
case "mtime":
|
||||
case "size":
|
||||
case "reloads":
|
||||
|
||||
@ -50,7 +50,7 @@ if (! $user->admin) accessforbidden();
|
||||
if ($file && ! $what)
|
||||
{
|
||||
//print DOL_URL_ROOT.'/dolibarr_export.php';
|
||||
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))));
|
||||
header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int')?'&page_y='.GETPOST('page_y', 'int'):''));
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -122,25 +122,15 @@ $utils = new Utils($db);
|
||||
// MYSQL
|
||||
if ($what == 'mysql')
|
||||
{
|
||||
|
||||
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
$ok=0;
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
|
||||
foreach($arrayofallowedcommand as $allowedcommand)
|
||||
{
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$ok=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (! $ok)
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
|
||||
}
|
||||
@ -176,6 +166,18 @@ if ($what == 'postgresql')
|
||||
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
|
||||
$cmddump=dol_sanitizePathName($cmddump);
|
||||
|
||||
/* Not required, the command is output on screen but not ran for pgsql
|
||||
if (! empty($dolibarr_main_restrict_os_commands))
|
||||
{
|
||||
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
|
||||
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
|
||||
$basenamecmddump=basename($cmddump);
|
||||
if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
|
||||
{
|
||||
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
|
||||
}
|
||||
} */
|
||||
|
||||
if (! $errormsg && $cmddump)
|
||||
{
|
||||
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity);
|
||||
@ -193,7 +195,6 @@ if ($what == 'postgresql')
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($errormsg)
|
||||
{
|
||||
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
||||
@ -230,8 +231,8 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
|
||||
print '<br>';
|
||||
*/
|
||||
|
||||
// Redirect t backup page
|
||||
header("Location: dolibarr_export.php");
|
||||
// Redirect to backup page
|
||||
header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):''));
|
||||
|
||||
$time_end = time();
|
||||
|
||||
|
||||
@ -56,11 +56,12 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="dateevent";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
$search_code = GETPOST("search_code");
|
||||
$search_ip = GETPOST("search_ip");
|
||||
$search_user = GETPOST("search_user");
|
||||
$search_desc = GETPOST("search_desc");
|
||||
$search_ua = GETPOST("search_ua");
|
||||
$search_code = GETPOST("search_code", "alpha");
|
||||
$search_ip = GETPOST("search_ip", "alpha");
|
||||
$search_user = GETPOST("search_user", "alpha");
|
||||
$search_desc = GETPOST("search_desc", "alpha");
|
||||
$search_ua = GETPOST("search_ua", "none");
|
||||
$search_prefix_session = GETPOST("search_prefix_session", "none");
|
||||
|
||||
if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
|
||||
else $date_start=-1;
|
||||
@ -91,6 +92,8 @@ $date_endday = $tmp['mday'];
|
||||
$date_endmonth = $tmp['mon'];
|
||||
$date_endyear = $tmp['year'];
|
||||
|
||||
$arrayfields=array();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -108,6 +111,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_user='';
|
||||
$search_desc='';
|
||||
$search_ua='';
|
||||
$search_prefix_session='';
|
||||
}
|
||||
|
||||
// Purge audit events
|
||||
@ -136,6 +140,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
|
||||
$securityevent->type='SECURITY_EVENTS_PURGE';
|
||||
$securityevent->dateevent=$now;
|
||||
$securityevent->description=$text;
|
||||
|
||||
$result=$securityevent->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -163,7 +168,7 @@ $userstatic=new User($db);
|
||||
$usefilter=0;
|
||||
|
||||
$sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,";
|
||||
$sql.= " e.fk_user, e.description,";
|
||||
$sql.= " e.fk_user, e.description, e.prefix_session,";
|
||||
$sql.= " u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
@ -175,6 +180,7 @@ if ($search_ip) { $usefilter++; $sql.=natural_search("e.ip", $search_ip, 0); }
|
||||
if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, 0); }
|
||||
if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); }
|
||||
if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); }
|
||||
if ($search_prefix_session) { $usefilter++; $sql.=natural_search("e.prefix_session", $search_prefix_session, 0); }
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
@ -207,6 +213,7 @@ if ($result)
|
||||
if ($search_user) $param.='&search_user='.urlencode($search_user);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_ua) $param.='&search_ua='.urlencode($search_ua);
|
||||
if ($search_prefix_sessiona) $param.='&search_prefix_session='.urlencode($search_prefix_session);
|
||||
if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth);
|
||||
if ($date_startday) $param.= "&date_startday=".urlencode($date_startday);
|
||||
if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear);
|
||||
@ -239,22 +246,36 @@ if ($result)
|
||||
print '<td class="liste_titre" width="15%">'.$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0).'</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="search_code" value="'.$search_code.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_code" value="'.$search_code.'">';
|
||||
print '</td>';
|
||||
|
||||
// IP
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="search_ip" value="'.$search_ip.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_ip" value="'.$search_ip.'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="search_user" value="'.$search_user.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_user" value="'.$search_user.'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
//print '<input class="flat" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
|
||||
//print '<input class="flat maxwidth100" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_ua" value="'.$search_ua.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['e.prefix_session']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_prefix_session" value="'.$search_prefix_session.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
@ -264,11 +285,19 @@ if ($result)
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
{
|
||||
print_liste_field_titre("UserAgent", $_SERVER["PHP_SELF"], "e.user_agent", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['e.prefix_session']['checked']))
|
||||
{
|
||||
print_liste_field_titre("PrefixSession", $_SERVER["PHP_SELF"], "e.prefix_session", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -312,9 +341,26 @@ if ($result)
|
||||
print $text;
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
{
|
||||
// User agent
|
||||
print '<td>';
|
||||
print $obj->user_agent;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['e.prefix_session']['checked']))
|
||||
{
|
||||
// User agent
|
||||
print '<td>';
|
||||
print $obj->prefix_session;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// More informations
|
||||
print '<td class="right">';
|
||||
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent?$obj->user_agent:$langs->trans("Unknown"));
|
||||
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session?$obj->prefix_session:$langs->trans("Unknown"));
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -618,14 +618,14 @@ if ($id)
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a href="'.$url.'action='.$acts[$obj->status].'">'.$actl[$obj->status].'</a>';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status?1:0)].'">'.$actl[($obj->status?1:0)].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete">'.img_delete().'</a></td>';
|
||||
else print '<td align="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -78,6 +78,12 @@ if ($action == 'setproductionmode')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'save')
|
||||
{
|
||||
dolibarr_set_const($db, 'API_RESTRICT_ON_IP', GETPOST('API_RESTRICT_ON_IP', 'alpha'));
|
||||
}
|
||||
|
||||
|
||||
dol_mkdir(DOL_DATA_ROOT.'/api/temp'); // May have been deleted by a purge
|
||||
|
||||
|
||||
@ -93,37 +99,50 @@ print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
|
||||
print $langs->trans("ApiDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
//print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="save">';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print "<td>".$langs->trans("Parameter")."</td>";
|
||||
print '<td align="center">'.$langs->trans("Value")."</td>";
|
||||
print '<td>'.$langs->trans("Value")."</td>";
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
print '<tr class="impair">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ApiProductionMode").'</td>';
|
||||
$production_mode=(empty($conf->global->API_PRODUCTION_MODE)?false:true);
|
||||
if ($production_mode)
|
||||
{
|
||||
print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("RESTRICT_API_ON_IP").'</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>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br><br>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
|
||||
@ -32,7 +32,7 @@ class DolibarrApi
|
||||
/**
|
||||
* @var DoliDb $db Database object
|
||||
*/
|
||||
static protected $db;
|
||||
protected static $db;
|
||||
|
||||
/**
|
||||
* @var Restler $r Restler object
|
||||
@ -143,7 +143,6 @@ class DolibarrApi
|
||||
unset($object->picto);
|
||||
|
||||
unset($object->fieldsforcombobox);
|
||||
unset($object->comments);
|
||||
|
||||
unset($object->skip_update_total);
|
||||
unset($object->context);
|
||||
|
||||
@ -56,7 +56,7 @@ class Documents extends DolibarrApi
|
||||
* Note that, this API is similar to using the wrapper link "documents.php" to download a file (used for
|
||||
* internal HTML links of documents into application), but with no need to have a session cookie (the token is used instead).
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $modulepart Name of module or area concerned by file download ('facture', ...)
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||
* @return array List of documents
|
||||
*
|
||||
@ -67,11 +67,11 @@ class Documents extends DolibarrApi
|
||||
*
|
||||
* @url GET /download
|
||||
*/
|
||||
public function index($module_part, $original_file = '')
|
||||
public function index($modulepart, $original_file = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($module_part)) {
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
@ -81,7 +81,7 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
@ -98,6 +98,7 @@ class Documents extends DolibarrApi
|
||||
|
||||
if (! file_exists($original_file_osencoded))
|
||||
{
|
||||
dol_syslog("Try to download not found file ".$original_file_osencoded, LOG_WARNING);
|
||||
throw new RestException(404, 'File not found');
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ class Documents extends DolibarrApi
|
||||
*
|
||||
* Test sample 1: { "module_part": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }.
|
||||
*
|
||||
* @param string $module_part Name of module or area concerned by file download ('invoice', 'order', ...).
|
||||
* @param string $modulepart Name of module or area concerned by file download ('invoice', 'order', ...).
|
||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf).
|
||||
* @param string $doctemplate Set here the doc template to use for document generation (If not set, use the default template).
|
||||
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
||||
@ -126,11 +127,11 @@ class Documents extends DolibarrApi
|
||||
*
|
||||
* @url PUT /builddoc
|
||||
*/
|
||||
public function builddoc($module_part, $original_file = '', $doctemplate = '', $langcode = '')
|
||||
public function builddoc($modulepart, $original_file = '', $doctemplate = '', $langcode = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($module_part)) {
|
||||
if (empty($modulepart)) {
|
||||
throw new RestException(400, 'bad value for parameter modulepart');
|
||||
}
|
||||
if (empty($original_file)) {
|
||||
@ -147,7 +148,7 @@ class Documents extends DolibarrApi
|
||||
//--- Finds and returns the document
|
||||
$entity=$conf->entity;
|
||||
|
||||
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, DolibarrApiAccess::$user, '', 'write');
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
@ -166,7 +167,7 @@ class Documents extends DolibarrApi
|
||||
|
||||
$templateused='';
|
||||
|
||||
if ($module_part == 'facture' || $module_part == 'invoice')
|
||||
if ($modulepart == 'facture' || $modulepart == 'invoice')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$this->invoice = new Facture($this->db);
|
||||
@ -181,7 +182,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
elseif ($module_part == 'commande' || $module_part == 'order')
|
||||
elseif ($modulepart == 'commande' || $modulepart == 'order')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$this->order = new Commande($this->db);
|
||||
@ -195,7 +196,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
}
|
||||
elseif ($module_part == 'propal' || $module_part == 'proposal')
|
||||
elseif ($modulepart == 'propal' || $modulepart == 'proposal')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$this->propal = new Propal($this->db);
|
||||
@ -368,7 +369,7 @@ class Documents extends DolibarrApi
|
||||
throw new RestException(404, 'Product not found');
|
||||
}
|
||||
|
||||
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
|
||||
$upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product').dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
|
||||
{
|
||||
|
||||
@ -57,12 +57,13 @@ class Login
|
||||
*/
|
||||
public function index($login, $password, $entity = '', $reset = 0)
|
||||
{
|
||||
|
||||
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication))
|
||||
$dolibarr_main_authentication = 'http,dolibarr';
|
||||
// TODO Remove the API login. The token must be generated from backoffice only.
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'dolibarr';
|
||||
|
||||
// Authentication mode: forceuser
|
||||
if ($dolibarr_main_authentication == 'forceuser')
|
||||
{
|
||||
@ -73,6 +74,7 @@ class Login
|
||||
throw new RestException(403, "Your instance is set to use the automatic login '".$dolibarr_auto_user."' that is not the requested login. API usage is forbidden in this mode.");
|
||||
}
|
||||
}
|
||||
|
||||
// Set authmode
|
||||
$authmode = explode(',', $dolibarr_main_authentication);
|
||||
|
||||
@ -83,7 +85,7 @@ class Login
|
||||
if ($entity == '') $entity=1;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
|
||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode);
|
||||
$login = checkLoginPassEntity($login, $password, $entity, $authmode, 'api');
|
||||
if (empty($login))
|
||||
{
|
||||
throw new RestException(403, 'Access denied');
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
* \file htdocs/api/index.php
|
||||
*/
|
||||
|
||||
use Luracast\Restler\Format\UploadFormat;
|
||||
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
|
||||
@ -88,18 +90,21 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
|
||||
// index.php/xxx called by any REST client to run API
|
||||
|
||||
|
||||
$reg=array();
|
||||
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
||||
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
|
||||
|
||||
|
||||
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
||||
$refreshcache=false;
|
||||
// When in production mode, a file api/temp/routes.php is created with the API available of current call.
|
||||
// But, if we set $refreshcache to false, so it may have only one API in the routes.php file if we make a call for one API without
|
||||
// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
|
||||
// So we force refresh to each call.
|
||||
$refreshcache=(empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
$refreshcache=true;
|
||||
}
|
||||
|
||||
|
||||
$api = new DolibarrApi($db, '', $refreshcache);
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
|
||||
@ -114,8 +119,23 @@ $api->r->addAuthenticationClass('DolibarrApiAccess', '');
|
||||
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
|
||||
|
||||
|
||||
// Restrict API to some IPs
|
||||
if (! empty($conf->global->API_RESTRICT_ON_IP))
|
||||
{
|
||||
$allowedip=explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (! in_array($ipremote, $allowedip))
|
||||
{
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
|
||||
print 'APIs are not allowed from the IP '.$ipremote;
|
||||
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
|
||||
//print $conf->global->API_RESTRICT_ON_IP;
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Call Explorer file for all APIs definitions
|
||||
|
||||
// Call Explorer file for all APIs definitions (this part is slow)
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
// Scan all API files to load them
|
||||
@ -133,6 +153,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$regmod=array();
|
||||
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i", $file, $regmod))
|
||||
{
|
||||
$module = strtolower($regmod[1]);
|
||||
@ -162,6 +183,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
{
|
||||
if ($file_searched == 'api_access.class.php') continue;
|
||||
|
||||
$regapi = array();
|
||||
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi))
|
||||
{
|
||||
$classname = ucwords($regapi[1]);
|
||||
@ -201,6 +223,7 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' ||
|
||||
}
|
||||
|
||||
// Call one APIs or one definition of an API
|
||||
$regbis = array();
|
||||
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root')))
|
||||
{
|
||||
$module = $reg[1];
|
||||
@ -250,9 +273,9 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
$api->r->addAPIClass($classname);
|
||||
}
|
||||
|
||||
// TODO If not found, redirect to explorer
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
//exit;
|
||||
|
||||
// Call API (we suppose we found it)
|
||||
// Call API (we suppose we found it).
|
||||
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
|
||||
$api->r->handle();
|
||||
|
||||
@ -495,7 +495,7 @@ if (is_array($blocks))
|
||||
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
|
||||
|
||||
// Amount
|
||||
print '<td class="right">'.price($block->amounts).'</td>';
|
||||
print '<td class="right nowraponall">'.price($block->amounts).'</td>';
|
||||
|
||||
// Details link
|
||||
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';
|
||||
|
||||
@ -515,6 +515,7 @@ class BOM extends CommonObject
|
||||
public function valid($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
@ -582,13 +583,18 @@ class BOM extends CommonObject
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
|
||||
// in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'bom/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'bom/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->bom->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->bom->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
@ -889,7 +895,7 @@ class BOM extends CommonObject
|
||||
$this->lines=array();
|
||||
|
||||
$objectline = new BOMLine($this->db);
|
||||
$result = $objectline->fetchAll('ASC', 'rank', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
|
||||
$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_bom = '.$this->id));
|
||||
|
||||
if (is_numeric($result))
|
||||
{
|
||||
@ -1044,7 +1050,7 @@ class BOMLine extends CommonObject
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'rank' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
public $rowid;
|
||||
@ -1053,7 +1059,7 @@ class BOMLine extends CommonObject
|
||||
public $description;
|
||||
public $qty;
|
||||
public $efficiency;
|
||||
public $rank;
|
||||
public $position;
|
||||
public $import_key;
|
||||
// END MODULEBUILDER PROPERTIES
|
||||
|
||||
|
||||
@ -79,16 +79,6 @@ if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$retour=$langs->trans("ErrorModuleSetupNotComplete");
|
||||
header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid);
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
|
||||
// Check password
|
||||
$auth = new Auth($db);
|
||||
$retour = $auth->verif($username, $password);
|
||||
|
||||
@ -165,7 +165,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("Cash").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
|
||||
}
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
|
||||
print '</div>';
|
||||
@ -173,7 +173,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("CashDesk"))).'" />';
|
||||
}
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
|
||||
print '</div>';
|
||||
@ -181,7 +181,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete"), $langs->transnoentitiesnoconv("CashDesk")).'" />';
|
||||
}
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" onclick="javascript: verifClic(\'CHQ\');" />';
|
||||
print '</div>';
|
||||
|
||||
@ -168,287 +168,8 @@ if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5p
|
||||
//var_dump($objectpage);exit;
|
||||
print '<div class="centpercent websitebar">';
|
||||
|
||||
if (count($object->records) > 0)
|
||||
{
|
||||
// ***** Part for web sites
|
||||
|
||||
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||
print $langs->trans("WebSite").': ';
|
||||
print '</div>';
|
||||
|
||||
// List of websites
|
||||
print '<div class="websiteselection">';
|
||||
$out='';
|
||||
$out.='<select name="website" class="minwidth100" id="website">';
|
||||
if (empty($object->records)) $out.='<option value="-1"> </option>';
|
||||
// Loop on each sites
|
||||
$i=0;
|
||||
foreach($object->records as $key => $valwebsite)
|
||||
{
|
||||
if (empty($website)) $website=$valwebsite->ref;
|
||||
|
||||
$out.='<option value="'.$valwebsite->ref.'"';
|
||||
if ($website == $valwebsite->ref) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.=$valwebsite->ref;
|
||||
$out.='</option>';
|
||||
$i++;
|
||||
}
|
||||
$out.='</select>';
|
||||
$out.=ajax_combobox('website');
|
||||
print $out;
|
||||
print '<input type="submit" class="button" name="refreshsite" value="'.$langs->trans("Load").'">';
|
||||
|
||||
if ($website)
|
||||
{
|
||||
$virtualurl='';
|
||||
$dataroot=DOL_DATA_ROOT.'/collab/'.$website;
|
||||
if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost;
|
||||
}
|
||||
|
||||
if ($website && $action == 'preview')
|
||||
{
|
||||
$disabled='';
|
||||
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
|
||||
|
||||
print ' ';
|
||||
|
||||
//print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="editmedia">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditCss")).'" name="editcss">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditMenu")).'" name="editmenu">';
|
||||
print '<input type="submit"'.$disabled.' class="button" value="'.dol_escape_htmltag($langs->trans("AddPage")).'" name="create">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
// Button for websites
|
||||
print '<div class="websitetools">';
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
print '<div class="websiteinputurl">';
|
||||
print '<input type="text" id="previewsiteurl" class="minwidth200imp" name="previewsite" placeholder="'.$langs->trans("http://myvirtualhost").'" value="'.$virtualurl.'">';
|
||||
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
|
||||
$htmltext=$langs->trans("SetHereVirtualHost", $dataroot);
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</div>';
|
||||
|
||||
$urlext=$virtualurl;
|
||||
$urlint=$urlwithroot.'/public/collab/index.php?website='.$website;
|
||||
//if (! empty($object->virtualhost))
|
||||
//{
|
||||
print '<a class="websitebuttonsitepreview" id="previewsiteext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
//}
|
||||
|
||||
print '<a class="websitebuttonsitepreview" id="previewsite" href="'.$urlwithroot.'/public/collab/index.php?website='.$website.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview');
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
if (in_array($action, array('editcss','editmenu','create')))
|
||||
{
|
||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
// ***** Part for pages
|
||||
|
||||
if ($website)
|
||||
{
|
||||
print '</div>';
|
||||
|
||||
$array=$objectpage->fetchAll($object->id);
|
||||
if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
|
||||
$atleastonepage=(is_array($array) && count($array) > 0);
|
||||
|
||||
print '<div class="centpercent websitebar"'.($style?' style="'.$style.'"':'').'">';
|
||||
print '<div class="websiteselection hideonsmartphoneimp">';
|
||||
print $langs->trans("Page").': ';
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
|
||||
if ($action != 'add')
|
||||
{
|
||||
$out='';
|
||||
$out.='<select name="pageid" id="pageid" class="minwidth200">';
|
||||
if ($atleastonepage)
|
||||
{
|
||||
if (empty($pageid) && $action != 'create') // Page id is not defined, we try to take one
|
||||
{
|
||||
$firstpageid=0;$homepageid=0;
|
||||
foreach($array as $key => $valpage)
|
||||
{
|
||||
if (empty($firstpageid)) $firstpageid=$valpage->id;
|
||||
if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id;
|
||||
}
|
||||
$pageid=$homepageid?$homepageid:$firstpageid; // We choose home page and if not defined yet, we take first page
|
||||
}
|
||||
|
||||
foreach($array as $key => $valpage)
|
||||
{
|
||||
$out.='<option value="'.$key.'"';
|
||||
if ($pageid > 0 && $pageid == $key) $out.=' selected'; // To preselect a value
|
||||
$out.='>';
|
||||
$out.=$valpage->title;
|
||||
if ($object->fk_default_home && $key == $object->fk_default_home) $out.=' ('.$langs->trans("HomePage").')';
|
||||
$out.='</option>';
|
||||
}
|
||||
}
|
||||
else $out.='<option value="-1"> </option>';
|
||||
$out.='</select>';
|
||||
$out.=ajax_combobox('pageid');
|
||||
print $out;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("New");
|
||||
}
|
||||
|
||||
print '<input type="submit" class="button" name="refreshpage" value="'.$langs->trans("Load").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
//print $form->selectarray('page', $array);
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
$disabled='';
|
||||
if (empty($user->rights->websites->write)) $disabled=' disabled="disabled"';
|
||||
|
||||
if ($pageid > 0)
|
||||
{
|
||||
print ' ';
|
||||
|
||||
if ($object->fk_default_home > 0 && $pageid == $object->fk_default_home) print '<input type="submit" class="button" disabled="disabled" value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
else print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("SetAsHomePage")).'" name="setashome">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageMeta")).'" name="editmeta">';
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("EditPageContent")).'" name="editcontent">';
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editmeta&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageMeta")).'</a>';
|
||||
//print '<a href="'.$_SERVER["PHP_SELF"].'?action=editcontent&website='.urlencode($website).'&pageid='.urlencode($pageid).'" class="button">'.dol_escape_htmltag($langs->trans("EditPageContent")).'</a>';
|
||||
print '<input type="submit" class="buttonDelete" name="delete" value="'.$langs->trans("Delete").'"'.($atleastonepage?'':' disabled="disabled"').'>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<div class="websiteselection">';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="websitetools">';
|
||||
|
||||
if ($website && $pageid > 0 && $action == 'preview')
|
||||
{
|
||||
$websitepage = new WebSitePage($db);
|
||||
$websitepage->fetch($pageid);
|
||||
|
||||
$realpage=$urlwithroot.'/public/collab/index.php?website='.$website.'&page='.$pageid;
|
||||
$pagealias = $websitepage->pageurl;
|
||||
|
||||
print '<div class="websiteinputurl">';
|
||||
print '<input type="text" id="previewpageurl" class="minwidth200imp" name="previewsite" value="'.$pagealias.'" disabled="disabled">';
|
||||
//print '<input type="submit" class="button" name="previewwebsite" target="tab'.$website.'" value="'.$langs->trans("ViewSiteInNewTab").'">';
|
||||
$htmltext=$langs->trans("WEBSITE_PAGENAME", $pagealias);
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</div>';
|
||||
|
||||
if (! empty($object->virtualhost))
|
||||
{
|
||||
$urlext=$virtualurl.'/'.$pagealias.'.php';
|
||||
print '<a class="websitebuttonsitepreview" id="previewpageext" href="'.$urlext.'" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="websitebuttonsitepreview" id="previewpageextnoclick" href="#">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext');
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
print '<a class="websitebuttonsitepreview" id="previewpage" href="'.$realpage.'&nocache='.dol_now().'" class="button" target="tab'.$website.'" alt="'.dol_escape_htmltag($langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">';
|
||||
print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview');
|
||||
print '</a>'; // View page in new Tab
|
||||
//print '<input type="submit" class="button" name="previewpage" target="tab'.$website.'"value="'.$langs->trans("ViewPageInNewTab").'">';
|
||||
|
||||
// TODO Add js to save alias like we save virtual host name and use dynamic virtual host for url of id=previewpageext
|
||||
}
|
||||
if (! in_array($action, array('editcss','editmenu','create')))
|
||||
{
|
||||
if ($action != 'preview') print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="preview">';
|
||||
if (preg_match('/^create/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
if (preg_match('/^edit/', $action)) print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
if ($action == 'preview')
|
||||
{
|
||||
// Adding jquery code to change on the fly url of preview ext
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#previewsiteext,#previewpageext").click(function() {
|
||||
newurl=jQuery("#previewsiteurl").val();
|
||||
newpage=jQuery("#previewsiteurl").val() + "/" + jQuery("#previewpageurl").val() + ".php";
|
||||
console.log("Open url "+newurl);
|
||||
/* Save url */
|
||||
jQuery.ajax({
|
||||
method: "POST",
|
||||
url: "'.DOL_URL_ROOT.'/core/ajax/saveinplace.php",
|
||||
data: {
|
||||
field: \'editval_virtualhost\',
|
||||
element: \'websites\',
|
||||
table_element: \'website\',
|
||||
fk_element: '.$object->id.',
|
||||
value: newurl,
|
||||
},
|
||||
context: document.body
|
||||
});
|
||||
|
||||
jQuery("#previewsiteext").attr("href",newurl);
|
||||
jQuery("#previewpageext").attr("href",newpage);
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="websiteselection">';
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorModuleSetupNotComplete");
|
||||
print '<div>';
|
||||
$action='';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
|
||||
$head = array();
|
||||
|
||||
if ($action == 'editcontent')
|
||||
{
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
|
||||
$csscontent = @file_get_contents($filecss);
|
||||
|
||||
$contentforedit = '';
|
||||
/*$contentforedit.='<style scoped>'."\n"; // "scoped" means "apply to parent element only". Not yet supported by browsers
|
||||
$contentforedit.=$csscontent;
|
||||
$contentforedit.='</style>'."\n";*/
|
||||
$contentforedit .= $objectpage->content;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('PAGE_CONTENT', $contentforedit, '', 500, 'Full', '', true, true, true, ROWS_5, '90%');
|
||||
$doleditor->Create(0, '', false);
|
||||
}
|
||||
|
||||
print "</div>\n</form>\n";
|
||||
|
||||
|
||||
@ -1103,6 +1103,7 @@ class ActionComm extends CommonObject
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $conf->agenda->warning_delay/60/60/24;
|
||||
$response->label = $langs->trans("ActionsToDo");
|
||||
$response->labelShort = $langs->trans("ActionsToDoShort");
|
||||
$response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda';
|
||||
if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1';
|
||||
$response->img = img_object('', "action", 'class="inline-block valigntextmiddle"');
|
||||
@ -1286,8 +1287,10 @@ class ActionComm extends CommonObject
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||
if ((!$user->rights->agenda->allactions->read && $this->authorid != $user->id) || (!$user->rights->agenda->myactions->read && $this->authorid == $user->id))
|
||||
{
|
||||
$option = 'nolink';
|
||||
}
|
||||
|
||||
$label = $this->label;
|
||||
if (empty($label)) $label=$this->libelle; // For backward compatibility
|
||||
|
||||
@ -43,7 +43,7 @@ $action=GETPOST('action', 'alpha');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'actioncommlist'; // To manage different context of search
|
||||
$resourceid=GETPOST("search_resourceid", "int")?GETPOST("search_resourceid", "int"):GETPOST("resourceid", "int");
|
||||
$pid=GETPOST("search_projectid", 'int', 3)?GETPOST("search_projectid", 'int', 3):GETPOST("projectid", 'int', 3);
|
||||
$status=GETPOST("search_status", 'alpha')?GETPOST("search_status", 'alpha'):GETPOST("status", 'alpha');
|
||||
$status=(GETPOST("search_status", 'alpha') != '')?GETPOST("search_status", 'alpha'):GETPOST("status", 'alpha');
|
||||
$type=GETPOST('search_type', 'alphanohtml')?GETPOST('search_type', 'alphanohtml'):GETPOST('type', 'alphanohtml');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$year=GETPOST("year", 'int');
|
||||
@ -526,6 +526,7 @@ if ($resql)
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
|
||||
$caction=new CActionComm($db);
|
||||
$arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1);
|
||||
$contactListCache = array();
|
||||
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
@ -645,7 +646,34 @@ if ($resql)
|
||||
// Contact
|
||||
if (! empty($arrayfields['a.fk_contact']['checked'])) {
|
||||
print '<td>';
|
||||
if ($obj->fk_contact > 0)
|
||||
|
||||
|
||||
$actionstatic->fetchResources();
|
||||
if(!empty($actionstatic->socpeopleassigned))
|
||||
{
|
||||
$contactList = array();
|
||||
foreach ($actionstatic->socpeopleassigned as $socpeopleId => $socpeopleassigned)
|
||||
{
|
||||
if(!isset($contactListCache[$socpeopleassigned['id']]))
|
||||
{
|
||||
// if no cache found we fetch it
|
||||
$contact = new Contact($db);
|
||||
if($contact->fetch($socpeopleassigned['id'])>0)
|
||||
{
|
||||
$contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 28);
|
||||
$contactList[] = $contact->getNomUrl(1, '', 28);
|
||||
}
|
||||
}
|
||||
else{
|
||||
// use cache
|
||||
$contactList[] = $contactListCache[$socpeopleassigned['id']];
|
||||
}
|
||||
}
|
||||
if(!empty($contactList)){
|
||||
print implode(', ', $contactList);
|
||||
}
|
||||
}
|
||||
elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event
|
||||
{
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
$contactstatic->email=$obj->email;
|
||||
|
||||
@ -694,7 +694,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -779,7 +779,7 @@ if ($object->id > 0)
|
||||
$db->free($resql2);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -855,7 +855,7 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -919,7 +919,7 @@ if ($object->id > 0)
|
||||
if ($num >0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
@ -989,7 +989,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
|
||||
@ -1062,7 +1062,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -1167,7 +1167,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
|
||||
|
||||
@ -338,7 +338,7 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
print '<div class="tagtd">';
|
||||
if (empty($obj->picto)) $obj->picto='generic';
|
||||
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto);
|
||||
print img_object($langs->trans("EmailingTargetSelector").': '.get_class($obj), $obj->picto, 'class="valignmiddle pictomodule"');
|
||||
print ' ';
|
||||
print $obj->getDesc();
|
||||
print '</div>';
|
||||
@ -402,7 +402,8 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
|
||||
// List of selected targets
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.source_url, mc.source_id, mc.source_type, mc.error_text";
|
||||
$sql = "SELECT mc.rowid, mc.lastname, mc.firstname, mc.email, mc.other, mc.statut, mc.date_envoi, mc.tms,";
|
||||
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
|
||||
$sql .= " WHERE mc.fk_mailing=".$object->id;
|
||||
if ($search_lastname) $sql.= natural_search("mc.lastname", $search_lastname);
|
||||
@ -475,15 +476,15 @@ if ($object->fetch($id) >= 0)
|
||||
print '<tr class="liste_titre_filter">';
|
||||
// EMail
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '<input class="flat maxwidth75" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
// Name
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'">';
|
||||
print '</td>';
|
||||
// Firstname
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '<input class="flat maxwidth50" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
// Other
|
||||
print '<td class="liste_titre">';
|
||||
@ -494,10 +495,16 @@ if ($object->fetch($id) >= 0)
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Date last update
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
// Date sending
|
||||
print '<td class="liste_titre">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
|
||||
//Statut
|
||||
print '<td class="liste_titre right">';
|
||||
print $formmailing->selectDestinariesStatus($search_dest_status, 'search_dest_status', 1);
|
||||
@ -515,14 +522,10 @@ if ($object->fetch($id) >= 0)
|
||||
print_liste_field_titre("Firstname", $_SERVER["PHP_SELF"], "mc.firstname", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("OtherInformations", $_SERVER["PHP_SELF"], "", $param, "", "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Source", $_SERVER["PHP_SELF"], "", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
// Date last update
|
||||
print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "mc.tms", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
// Date sending
|
||||
if ($object->statut < 2) {
|
||||
print_liste_field_titre('');
|
||||
}
|
||||
else
|
||||
{
|
||||
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("DateSending", $_SERVER["PHP_SELF"], "mc.date_envoi", $param, '', 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "mc.statut", $param, '', 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
@ -583,16 +586,25 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Date last update
|
||||
print '<td class="center">';
|
||||
print dol_print_date($obj->tms, 'dayhour');
|
||||
print '</td>';
|
||||
|
||||
// Status of recipient sending email (Warning != status of emailing)
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
// Date sent
|
||||
print '<td align="center"> </td>';
|
||||
|
||||
print '<td class="nowrap right">'.$langs->trans("MailingStatusNotSent");
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Date sent
|
||||
print '<td align="center">'.$obj->date_envoi.'</td>';
|
||||
|
||||
print '<td class="nowrap right">';
|
||||
print $object::libStatutDest($obj->statut, 2, $obj->error_text);
|
||||
print '</td>';
|
||||
@ -620,7 +632,7 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
if ($object->statut < 2)
|
||||
{
|
||||
print '<tr><td colspan="8" class="opacitymedium">';
|
||||
print '<tr><td colspan="9" class="opacitymedium">';
|
||||
print $langs->trans("NoTargetYet");
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -380,7 +380,6 @@ if (empty($reshook))
|
||||
}
|
||||
} else {
|
||||
$object->ref = GETPOST('ref');
|
||||
$object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity);
|
||||
$object->ref_client = GETPOST('ref_client');
|
||||
$object->datep = $datep;
|
||||
$object->date_livraison = $date_delivery;
|
||||
@ -2249,7 +2248,8 @@ $formquestion = array_merge($formquestion, array(
|
||||
print '<tr><td>';
|
||||
print $langs->trans('OutstandingBill');
|
||||
print '</td><td class="right">';
|
||||
print price($soc->get_OutstandingBill()) . ' / ';
|
||||
$arrayoutstandingbills = $soc->getOutstandingBills();
|
||||
print price($arrayoutstandingbills['opened']) . ' / ';
|
||||
print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
@ -530,11 +530,11 @@ class Propal extends CommonObject
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Rang to use
|
||||
$rangtouse = $rang;
|
||||
if ($rangtouse == -1)
|
||||
$ranktouse = $rang;
|
||||
if ($ranktouse == -1)
|
||||
{
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$rangtouse = $rangmax + 1;
|
||||
$ranktouse = $rangmax + 1;
|
||||
}
|
||||
|
||||
// TODO A virer
|
||||
@ -568,7 +568,7 @@ class Propal extends CommonObject
|
||||
$this->line->fk_remise_except=$fk_remise_except;
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice=$pu_ht;
|
||||
$this->line->rang=$rangtouse;
|
||||
$this->line->rang=$ranktouse;
|
||||
$this->line->info_bits=$info_bits;
|
||||
$this->line->total_ht=$total_ht;
|
||||
$this->line->total_tva=$total_tva;
|
||||
@ -890,7 +890,6 @@ class Propal extends CommonObject
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->entity)) $this->entity = $conf->entity;
|
||||
if (empty($this->date)) $this->date=$this->datep;
|
||||
$this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600);
|
||||
if (empty($this->availability_id)) $this->availability_id=0;
|
||||
@ -1000,7 +999,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$this->entity;
|
||||
$sql.= ", ".setEntity($this);
|
||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||
$sql.= ", ".(double) $this->multicurrency_tx;
|
||||
@ -1056,14 +1055,6 @@ class Propal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Add linked object (deprecated, use ->linkedObjectsIds instead)
|
||||
if (! $error && $this->origin && $this->origin_id)
|
||||
{
|
||||
dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING);
|
||||
$ret = $this->add_object_linked();
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Insertion du detail des produits dans la base
|
||||
* Insert products detail in database
|
||||
@ -1091,7 +1082,7 @@ class Propal extends CommonObject
|
||||
$vatrate = $line->tva_tx;
|
||||
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';
|
||||
|
||||
$result = $this->addline(
|
||||
$result = $this->addline(
|
||||
$line->desc,
|
||||
$line->subprice,
|
||||
$line->qty,
|
||||
@ -1138,7 +1129,7 @@ class Propal extends CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql.= " SET fk_delivery_address = ".$this->fk_delivery_address;
|
||||
$sql.= " WHERE ref = '".$this->db->escape($this->ref)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity = ".setEntity($this);
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
}
|
||||
@ -1330,9 +1321,9 @@ class Propal extends CommonObject
|
||||
// Hook of thirdparty module
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj);
|
||||
$parameters=array('objFrom'=>$this,'clonedObj'=>$object);
|
||||
$action='';
|
||||
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) $error++;
|
||||
}
|
||||
}
|
||||
@ -1749,10 +1740,10 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function valid($user, $notrigger = 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
|
||||
// Protection
|
||||
@ -1818,14 +1809,18 @@ class Propal extends CommonObject
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Rename of propal directory ($this->ref = old ref, $num = new ref)
|
||||
// to not lose the linked files
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'propale/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'propale/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->propal->multidir_output[$this->entity].'/'.$oldref;
|
||||
$dirdest = $conf->propal->multidir_output[$this->entity].'/'.$newref;
|
||||
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
if (@rename($dirsource, $dirdest))
|
||||
@ -3273,21 +3268,24 @@ class Propal extends CommonObject
|
||||
|
||||
$delay_warning = 0;
|
||||
$statut = 0;
|
||||
$label = '';
|
||||
$label = $labelShort = '';
|
||||
if ($mode == 'opened') {
|
||||
$delay_warning=$conf->propal->cloture->warning_delay;
|
||||
$statut = self::STATUS_VALIDATED;
|
||||
$label = $langs->trans("PropalsToClose");
|
||||
$labelShort = $langs->trans("ToAcceptRefuse");
|
||||
}
|
||||
if ($mode == 'signed') {
|
||||
$delay_warning=$conf->propal->facturation->warning_delay;
|
||||
$statut = self::STATUS_SIGNED;
|
||||
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
|
||||
$labelShort = $langs->trans("ToBill");
|
||||
}
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay = $delay_warning/60/60/24;
|
||||
$response->label = $label;
|
||||
$response->labelShort = $labelShort;
|
||||
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
|
||||
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
|
||||
$response->img = img_object('', "propal");
|
||||
@ -3512,7 +3510,7 @@ class Propal extends CommonObject
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
|
||||
print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Proposal"));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,6 +168,7 @@ $arrayfields=array(
|
||||
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1),
|
||||
'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'p.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
'p.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
// Extra fields
|
||||
@ -269,10 +270,10 @@ $sql.= " typent.code as typent_code,";
|
||||
$sql.= " ava.rowid as availability,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.total as total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
|
||||
$sql.= ' p.datec as date_creation, p.tms as date_update,';
|
||||
$sql.= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
|
||||
$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
|
||||
$sql.= ' u.login';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
@ -688,6 +689,12 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date cloture
|
||||
if (! empty($arrayfields['p.date_cloture']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
@ -735,6 +742,7 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print '</tr>'."\n";
|
||||
@ -1054,7 +1062,7 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
@ -1073,6 +1081,14 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date cloture
|
||||
if (! empty($arrayfields['p.date_cloture']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['p.fk_statut']['checked']))
|
||||
{
|
||||
|
||||
@ -43,7 +43,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
// Load translation files required by the page
|
||||
$langs->load("propal");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc');
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
|
||||
@ -96,9 +96,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $user->rights->commande->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
$usercanread = $user->rights->commande->lire;
|
||||
$usercancreate = $user->rights->commande->creer;
|
||||
$usercanclose = $user->rights->commande->cloturer;
|
||||
$usercandelete = $user->rights->commande->supprimer;
|
||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)));
|
||||
$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)));
|
||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send);
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
$permissionedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@ -129,7 +137,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
@ -159,7 +167,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
elseif ($action == 'reopen' && $user->rights->commande->creer)
|
||||
elseif ($action == 'reopen' && $usercancreate)
|
||||
{
|
||||
if ($object->statut == Commande::STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED)
|
||||
{
|
||||
@ -176,7 +184,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Remove order
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer)
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
|
||||
{
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0)
|
||||
@ -191,7 +199,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Remove a product line
|
||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||
elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$result = $object->deleteline($user, $lineid);
|
||||
if ($result > 0)
|
||||
@ -222,16 +230,17 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Link to a project
|
||||
elseif ($action == 'classin' && $user->rights->commande->creer)
|
||||
elseif ($action == 'classin' && $usercancreate)
|
||||
{
|
||||
$object->setProject(GETPOST('projectid', 'int'));
|
||||
}
|
||||
|
||||
// Add order
|
||||
elseif ($action == 'add' && $user->rights->commande->creer)
|
||||
elseif ($action == 'add' && $usercancreate)
|
||||
{
|
||||
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
$selectedLines = GETPOST('toselect', 'array');
|
||||
|
||||
if ($datecommande == '') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
|
||||
@ -338,6 +347,8 @@ if (empty($reshook))
|
||||
|
||||
for($i = 0; $i < $num; $i ++)
|
||||
{
|
||||
if(!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
|
||||
|
||||
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
|
||||
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : '');
|
||||
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
|
||||
@ -481,7 +492,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'classifybilled' && $user->rights->commande->creer)
|
||||
elseif ($action == 'classifybilled' && $usercancreate)
|
||||
{
|
||||
$ret=$object->classifyBilled($user);
|
||||
|
||||
@ -489,7 +500,7 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
elseif ($action == 'classifyunbilled' && $user->rights->commande->creer)
|
||||
elseif ($action == 'classifyunbilled' && $usercancreate)
|
||||
{
|
||||
$ret=$object->classifyUnBilled();
|
||||
if ($ret < 0) {
|
||||
@ -498,7 +509,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Positionne ref commande client
|
||||
elseif ($action == 'setref_client' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setref_client' && $usercancreate) {
|
||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -506,7 +517,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setremise' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setremise' && $usercancreate) {
|
||||
$result = $object->set_remise($user, GETPOST('remise'));
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -514,7 +525,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setabsolutediscount' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setabsolutediscount' && $usercancreate) {
|
||||
if (GETPOST('remise_id')) {
|
||||
if ($object->id > 0) {
|
||||
$object->insert_discount(GETPOST('remise_id'));
|
||||
@ -524,7 +535,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setdate' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setdate' && $usercancreate) {
|
||||
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year'));
|
||||
|
||||
@ -534,7 +545,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setdate_livraison' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setdate_livraison' && $usercancreate) {
|
||||
// print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||
$datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
|
||||
@ -544,35 +555,35 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setmode' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setmode' && $usercancreate) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Multicurrency Code
|
||||
elseif ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
elseif ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
elseif ($action == 'setavailability' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setavailability' && $usercancreate) {
|
||||
$result = $object->availability(GETPOST('availability_id'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
elseif ($action == 'setdemandreason' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setdemandreason' && $usercancreate) {
|
||||
$result = $object->demand_reason(GETPOST('demand_reason_id'));
|
||||
if ($result < 0)
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
elseif ($action == 'setconditions' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
@ -604,7 +615,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// bank account
|
||||
elseif ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setbankaccount' && $usercancreate) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -612,7 +623,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// shipping method
|
||||
elseif ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setshippingmethod' && $usercancreate) {
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -620,23 +631,23 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// warehouse
|
||||
elseif ($action == 'setwarehouse' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setwarehouse' && $usercancreate) {
|
||||
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'setremisepercent' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise($user, GETPOST('remise_percent'));
|
||||
}
|
||||
|
||||
elseif ($action == 'setremiseabsolue' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, GETPOST('remise_absolue'));
|
||||
}
|
||||
|
||||
// Add a new line
|
||||
elseif ($action == 'addline' && $user->rights->commande->creer)
|
||||
elseif ($action == 'addline' && $usercancreate)
|
||||
{
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
@ -999,7 +1010,7 @@ if (empty($reshook))
|
||||
/*
|
||||
* Update a line
|
||||
*/
|
||||
elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save'))
|
||||
elseif ($action == 'updateline' && $usercancreate && GETPOST('save'))
|
||||
{
|
||||
// Clean parameters
|
||||
$date_start='';
|
||||
@ -1133,15 +1144,12 @@ if (empty($reshook))
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
|
||||
} elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) {
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -1195,7 +1203,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Go back to draft status
|
||||
elseif ($action == 'confirm_modif' && $user->rights->commande->creer) {
|
||||
elseif ($action == 'confirm_modif' && $usercancreate) {
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
$qualified_for_stock_change=0;
|
||||
@ -1243,17 +1251,14 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) {
|
||||
elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) {
|
||||
$result = $object->cloture($user);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_cancel' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -1310,7 +1315,7 @@ if (empty($reshook))
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
if ($action == 'set_thirdparty' && $user->rights->commande->creer)
|
||||
if ($action == 'set_thirdparty' && $usercancreate)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
|
||||
@ -1321,7 +1326,7 @@ if (empty($reshook))
|
||||
|
||||
// add lines from objectlinked
|
||||
if($action == 'import_lines_from_object'
|
||||
&& $user->rights->commande->creer
|
||||
&& $usercancreate
|
||||
&& $object->statut == Commande::STATUS_DRAFT
|
||||
)
|
||||
{
|
||||
@ -1405,8 +1410,8 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->commande->dir_output;
|
||||
$permissioncreate = $user->rights->commande->creer;
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity];
|
||||
$permissioncreate = $usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
// Actions to send emails
|
||||
@ -1417,7 +1422,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
@ -1478,7 +1483,7 @@ $formmargin = new FormMargin($db);
|
||||
if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); }
|
||||
|
||||
// Mode creation
|
||||
if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($action == 'create' && $usercancreate)
|
||||
{
|
||||
print load_fiche_titre($langs->trans('CreateOrder'), '', 'title_commercial.png');
|
||||
|
||||
@ -1519,11 +1524,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($element == 'order' || $element == 'commande') {
|
||||
$element = $subelement = 'commande';
|
||||
}
|
||||
if ($element == 'propal') {
|
||||
elseif ($element == 'propal') {
|
||||
$element = 'comm/propal';
|
||||
$subelement = 'propal';
|
||||
}
|
||||
if ($element == 'contract') {
|
||||
elseif ($element == 'contract') {
|
||||
$element = $subelement = 'contrat';
|
||||
}
|
||||
|
||||
@ -1756,6 +1761,15 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
if (! empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_ORDER)) {
|
||||
// copy from thirdparty
|
||||
$tpExtrafields = new Extrafields($db);
|
||||
$tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element);
|
||||
if ($soc->fetch_optionals() > 0) {
|
||||
$object->array_options = array_merge($object->array_options, $soc->array_options);
|
||||
}
|
||||
};
|
||||
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
}
|
||||
|
||||
@ -1870,8 +1884,6 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onclick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
// Show origin lines
|
||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
|
||||
$title = $langs->trans('ProductsAndServices');
|
||||
@ -1879,10 +1891,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$objectsrc->printOriginLinesList();
|
||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
// Mode view
|
||||
$now = dol_now();
|
||||
@ -2069,8 +2083,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherOrders").'</a>)';
|
||||
@ -2079,7 +2093,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@ -2116,7 +2130,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
if ($soc->outstanding_limit)
|
||||
{
|
||||
@ -2124,7 +2138,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans('OutstandingBill');
|
||||
print '</td><td>';
|
||||
print price($soc->get_OutstandingBill()) . ' / ';
|
||||
$arrayoutstandingbills = $soc->getOutstandingBills();
|
||||
print price($arrayoutstandingbills['opened']) . ' / ';
|
||||
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
@ -2159,7 +2174,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
|
||||
$editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("Date", 'date', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdate') {
|
||||
@ -2180,7 +2195,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Delivery date planed
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdate_livraison') {
|
||||
@ -2202,7 +2217,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Shipping Method
|
||||
if (! empty($conf->expedition->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
@ -2220,7 +2235,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct=new FormProduct($db);
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editwarehouse') {
|
||||
@ -2234,7 +2249,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
@ -2248,7 +2263,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Mode of payment
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
@ -2264,7 +2279,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Multicurrency code
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
$editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
|
||||
$editenable = $usercancreate && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencycode') {
|
||||
@ -2277,7 +2292,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Multicurrency rate
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
$editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
|
||||
$editenable = $usercancreate && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
|
||||
print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
@ -2298,7 +2313,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Delivery delay
|
||||
print '<tr class="fielddeliverydelay"><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editavailability') {
|
||||
@ -2310,7 +2325,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
// Source reason (why we have an ordrer)
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editdemandreason') {
|
||||
@ -2323,7 +2338,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// TODO Order mode (how we receive order). Not yet implemented
|
||||
/*
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editinputmode') {
|
||||
@ -2355,7 +2370,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
@ -2373,7 +2388,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Bank Account
|
||||
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) {
|
||||
print '<tr><td>';
|
||||
$editenable = $user->rights->commande->creer;
|
||||
$editenable = $usercancreate;
|
||||
print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable);
|
||||
print '</td><td>';
|
||||
if ($action == 'editbankaccount') {
|
||||
@ -2454,7 +2469,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>'; // Close fichecenter
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
@ -2497,7 +2512,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
/*
|
||||
* Form to add new line
|
||||
*/
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $user->rights->commande->creer && $action != 'selectlines')
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $usercancreate && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
@ -2528,22 +2543,19 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if ($object->statut > Commande::STATUS_DRAFT) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) {
|
||||
if ($usercansend) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
}
|
||||
|
||||
// Valid
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))
|
||||
)
|
||||
if ($object->statut == Commande::STATUS_DRAFT && $object->total_ttc >= 0 && $numlines > 0 && $usercanvalidate)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
// Edit
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && $user->rights->commande->creer) {
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
}
|
||||
// Create event
|
||||
@ -2591,18 +2603,18 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Shipment"))) . '">' . $langs->trans('CreateShipment') . '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen a closed order
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $user->rights->commande->creer) {
|
||||
if (($object->statut == Commande::STATUS_CLOSED || $object->statut == Commande::STATUS_CANCELED) && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
|
||||
}
|
||||
|
||||
// Set to shipped
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $user->rights->commande->cloturer) {
|
||||
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=shipped">' . $langs->trans('ClassifyShipped') . '</a></div>';
|
||||
}
|
||||
|
||||
@ -2612,31 +2624,28 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("CreateBill") . '</a></div>';
|
||||
}
|
||||
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifybilled">' . $langs->trans("ClassifyBilled") . '</a></div>';
|
||||
}
|
||||
}
|
||||
if ($object->statut > Commande::STATUS_DRAFT && $object->billed) {
|
||||
if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
if ($usercancreate && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=classifyunbilled">' . $langs->trans("ClassifyUnBilled") . '</a></div>';
|
||||
}
|
||||
}
|
||||
// Clone
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// Cancel order
|
||||
if ($object->statut == Commande::STATUS_VALIDATED &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
|
||||
)
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && (! empty($usercanclose) || ! empty($usercancancel)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
||||
}
|
||||
|
||||
// Delete order
|
||||
if ($user->rights->commande->supprimer) {
|
||||
if ($usercandelete) {
|
||||
if ($numshipping == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
} else {
|
||||
@ -2659,18 +2668,18 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Documents
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
$filedir = $conf->commande->dir_output . '/' . $comref;
|
||||
$filedir = $conf->commande->multidir_output[$object->entity] . '/' . $comref;
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->commande->lire;
|
||||
$delallowed = $user->rights->commande->creer;
|
||||
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
|
||||
$genallowed = $usercanread;
|
||||
$delallowed = $usercancreate;
|
||||
print $formfile->showdocuments('commande', $comref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang, '', $object);
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
|
||||
$compatibleImportElementsList = false;
|
||||
if($user->rights->commande->creer
|
||||
if($usercancreate
|
||||
&& $object->statut == Commande::STATUS_DRAFT)
|
||||
{
|
||||
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
|
||||
@ -2707,7 +2716,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
// Presend form
|
||||
$modelmail='order_send';
|
||||
$defaulttopic='SendOrderRef';
|
||||
$diroutput = $conf->commande->dir_output;
|
||||
$diroutput = $conf->commande->multidir_output[$object->entity];
|
||||
$trackid = 'ord'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
@ -321,6 +321,7 @@ class Commande extends CommonOrder
|
||||
public function valid($user, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
@ -364,7 +365,7 @@ class Commande extends CommonOrder
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
|
||||
$sql.= " SET ref = '".$num."',";
|
||||
$sql.= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql.= " fk_statut = ".self::STATUS_VALIDATED.",";
|
||||
$sql.= " date_valid='".$this->db->idate($now)."',";
|
||||
$sql.= " fk_user_valid = ".$user->id;
|
||||
@ -423,13 +424,18 @@ class Commande extends CommonOrder
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
|
||||
// in order not to lose the attachments
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'commande/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->commande->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->commande->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
$dirsource = $conf->commande->multidir_output[$this->entity].'/'.$oldref;
|
||||
$dirdest = $conf->commande->multidir_output[$this->entity].'/'.$newref;
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
@ -437,7 +443,7 @@ class Commande extends CommonOrder
|
||||
{
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles=dol_dir_list($conf->commande->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
$listoffiles=dol_dir_list($conf->commande->multidir_output[$this->entity].'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
foreach($listoffiles as $fileentry)
|
||||
{
|
||||
$dirsource=$fileentry['name'];
|
||||
@ -859,7 +865,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", ".setEntity($this);
|
||||
$sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null");
|
||||
$sql.= ", ".($this->pos_source != '' ? "'".$this->db->escape($this->pos_source)."'" : "null");
|
||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
||||
@ -1232,6 +1238,7 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i] = $line;
|
||||
}
|
||||
|
||||
$this->entity = $object->entity;
|
||||
$this->socid = $object->socid;
|
||||
$this->fk_project = $object->fk_project;
|
||||
$this->cond_reglement_id = $object->cond_reglement_id;
|
||||
@ -1451,11 +1458,11 @@ class Commande extends CommonOrder
|
||||
$pu_ht_devise = $tabprice[19];
|
||||
|
||||
// Rang to use
|
||||
$rangtouse = $rang;
|
||||
if ($rangtouse == -1)
|
||||
$ranktouse = $rang;
|
||||
if ($ranktouse == -1)
|
||||
{
|
||||
$rangmax = $this->line_max($fk_parent_line);
|
||||
$rangtouse = $rangmax + 1;
|
||||
$ranktouse = $rangmax + 1;
|
||||
}
|
||||
|
||||
// TODO A virer
|
||||
@ -1489,7 +1496,7 @@ class Commande extends CommonOrder
|
||||
$this->line->fk_remise_except=$fk_remise_except;
|
||||
$this->line->remise_percent=$remise_percent;
|
||||
$this->line->subprice=$pu_ht;
|
||||
$this->line->rang=$rangtouse;
|
||||
$this->line->rang=$ranktouse;
|
||||
$this->line->info_bits=$info_bits;
|
||||
$this->line->total_ht=$total_ht;
|
||||
$this->line->total_tva=$total_tva;
|
||||
@ -3329,10 +3336,10 @@ class Commande extends CommonOrder
|
||||
{
|
||||
// Remove directory with files
|
||||
$comref = dol_sanitizeFileName($this->ref);
|
||||
if ($conf->commande->dir_output && !empty($this->ref))
|
||||
if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref))
|
||||
{
|
||||
$dir = $conf->commande->dir_output . "/" . $comref ;
|
||||
$file = $conf->commande->dir_output . "/" . $comref . "/" . $comref . ".pdf";
|
||||
$dir = $conf->commande->multidir_output[$this->entity] . "/" . $comref ;
|
||||
$file = $conf->commande->multidir_output[$this->entity] . "/" . $comref . "/" . $comref . ".pdf";
|
||||
if (file_exists($file)) // We must delete all files before deleting directory
|
||||
{
|
||||
dol_delete_preview($this);
|
||||
@ -3405,6 +3412,7 @@ class Commande extends CommonOrder
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->commande->client->warning_delay/60/60/24;
|
||||
$response->label=$langs->trans("OrdersToProcess");
|
||||
$response->labelShort = $langs->trans("Opened");
|
||||
$response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders';
|
||||
$response->img=img_object('', "order");
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ $object = new Commande($db);
|
||||
if ($object->fetch($id))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
$upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
@ -92,7 +92,7 @@ if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->commande->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
|
||||
|
||||
$head = commande_prepare_head($object);
|
||||
dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), -1, 'order');
|
||||
@ -174,7 +174,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$modulepart = 'commande';
|
||||
$permission = $user->rights->commande->creer;
|
||||
$permtoedit = $user->rights->commande->creer;
|
||||
$param = '&id=' . $object->id;
|
||||
$param = '&id=' . $object->id.'&entity=' . (! empty($object->entity)?$object->entity:$conf->entity);
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||
}
|
||||
else
|
||||
|
||||
@ -241,7 +241,7 @@ $max=5;
|
||||
* Last modified orders
|
||||
*/
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
|
||||
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, c.date_cloture as datec, c.tms as datem,";
|
||||
$sql.= " s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_client";
|
||||
@ -297,7 +297,7 @@ if ($resql)
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
@ -323,7 +323,7 @@ else dol_print_error($db);
|
||||
*/
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.canvas";
|
||||
@ -377,7 +377,7 @@ if (! empty($conf->commande->enabled))
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
@ -405,7 +405,7 @@ if (! empty($conf->commande->enabled))
|
||||
*/
|
||||
if (! empty($conf->commande->enabled))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql = "SELECT c.rowid, c.entity, c.ref, c.fk_statut, c.facture, s.nom as name, s.rowid as socid";
|
||||
$sql.= ", s.client";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= ", s.canvas";
|
||||
@ -459,7 +459,7 @@ if (! empty($conf->commande->enabled))
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($commandestatic->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
@ -91,7 +91,7 @@ $id = (GETPOST('orderid')?GETPOST('orderid', 'int'):GETPOST('id', 'int'));
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'commande', $id, '');
|
||||
|
||||
$diroutputmassaction=$conf->commande->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$diroutputmassaction=$conf->commande->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
@ -143,6 +143,7 @@ $arrayfields=array(
|
||||
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||
'c.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
'c.facture'=>array('label'=>"Billed", 'checked'=>1, 'position'=>1000, 'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
|
||||
);
|
||||
@ -217,7 +218,7 @@ if (empty($reshook))
|
||||
$objectlabel='Orders';
|
||||
$permtoread = $user->rights->commande->lire;
|
||||
$permtodelete = $user->rights->commande->supprimer;
|
||||
$uploaddir = $conf->commande->dir_output;
|
||||
$uploaddir = $conf->commande->multidir_output[$conf->entity];
|
||||
$trigger_name='ORDER_SENTBYMAIL';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
}
|
||||
@ -247,7 +248,7 @@ $sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||
$sql.= ' c.date_creation as date_creation, c.tms as date_update,';
|
||||
$sql.= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
// Add fields from extrafields
|
||||
@ -693,6 +694,12 @@ if ($resql)
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Date cloture
|
||||
if (! empty($arrayfields['c.date_cloture']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '</td>';
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['c.fk_statut']['checked']))
|
||||
{
|
||||
@ -748,7 +755,8 @@ if ($resql)
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['c.date_cloture']['checked'])) print_liste_field_titre($arrayfields['c.date_cloture']['label'], $_SERVER["PHP_SELF"], "c.date_cloture", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print '</tr>'."\n";
|
||||
@ -926,7 +934,7 @@ if ($resql)
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$filedir=$conf->commande->multidir_output[$conf->entity] . '/' . dol_sanitizeFileName($obj->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
print '</td>';
|
||||
@ -1073,7 +1081,7 @@ if ($resql)
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Date creation
|
||||
@ -1092,6 +1100,14 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date cloture
|
||||
if (! empty($arrayfields['c.date_cloture']['checked']))
|
||||
{
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
if (! empty($arrayfields['c.fk_statut']['checked']))
|
||||
{
|
||||
|
||||
@ -548,7 +548,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
|
||||
</script>
|
||||
<?php
|
||||
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql = 'SELECT s.nom, s.rowid as socid, s.client, c.rowid, c.entity, c.ref, c.total_ht, c.ref_client,';
|
||||
$sql.= ' c.date_valid, c.date_commande, c.date_livraison, c.fk_statut, c.facture as billed';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
|
||||
@ -682,7 +682,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
|
||||
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename=dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$filedir=$conf->commande->multidir_output[$objp->entity] . '/' . dol_sanitizeFileName($objp->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->rowid;
|
||||
print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
|
||||
print '</td></tr></table>';
|
||||
|
||||
@ -39,7 +39,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
// Load translation files required by the page
|
||||
$langs->load("orders");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc');
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
|
||||
@ -26,13 +26,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries"));
|
||||
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta"));
|
||||
|
||||
$date_start =GETPOST('date_start', 'alpha');
|
||||
$date_startDay= GETPOST('date_startday', 'int');
|
||||
@ -503,9 +503,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.price($totalET).'</td>';
|
||||
print '<td align="right">'.price($totalIT).'</td>';
|
||||
print '<td align="right">'.price($totalVAT).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT, 'MT')).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
|
||||