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

This commit is contained in:
Frédéric FRANCE 2022-02-15 19:11:24 +01:00
commit eb77f10d7b
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
3455 changed files with 67331 additions and 36725 deletions

View File

@ -26,8 +26,9 @@ Default **language here is english**. So please prepare your contributions in en
1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr). 1. [Fork](https://help.github.com/articles/fork-a-repo) the [GitHub repository](https://github.com/Dolibarr/dolibarr).
2. Clone your fork. 2. Clone your fork.
3. Choose a branch(See the [Branches](#branches) section below). 3. Choose a branch(See the [Branches](#branches) section below).
4. Commit and push your changes. 4. Read our developer documentation on the [Dolibarr Wiki](https://wiki.dolibarr.org/index.php?title=Developer_documentation).
5. [Make a pull request](https://help.github.com/articles/creating-a-pull-request). 5. Commit and push your changes.
6. [Make a pull request](https://help.github.com/articles/creating-a-pull-request).
<span id="branches" name="branches"></span> <span id="branches" name="branches"></span>
### Branches ### Branches

View File

@ -1,35 +0,0 @@
---
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:*
- *replace the bracket enclosed texts with meaningful information*
- *remove any unused sub-section*
# Bug
[*Short description*]
## Environment
- **Version**: [*Affected Dolibarr version(s)*]
- **OS**: [*Server OS type and version*]
- **Web server**: [*Webserver type and version*]
- **PHP**: [*PHP version*]
- **Database**: [*Database type and version*]
- **URL(s)**: [*Affected URL(s)*]
## Expected and actual behavior
[*Verbose description*]
## Steps to reproduce the behavior
[*Verbose description*]
## [Attached files](https://help.github.com/articles/issue-attachments) (Screenshots, screencasts, dolibarr.log, debugging informations…)
[*Files*]

71
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,71 @@
name: Bug report
description: Create a report to help us fix something that is broken
labels: ["Bug"]
body:
- type: markdown
attributes:
value: |
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.
- type: textarea
id: bug
attributes:
label: Bug
description: Please give a short description of the bug
validations:
required: true
- type: input
id: environment-version
attributes:
label: Environment Version
description: Affected Dolibarr version(s)
- type: input
id: environment-os
attributes:
label: Environment OS
description: Server OS type and version
- type: input
id: environment-webserver
attributes:
label: Environment Web server
description: Webserver type and version
- type: input
id: environment-php
attributes:
label: Environment PHP
description: PHP version
- type: input
id: environment-database
attributes:
label: Environment Database
description: Database type and version
- type: input
id: environment-urls
attributes:
label: Environment URL(s)
description: Affected URL(s)
- type: textarea
id: expected-behaviour
attributes:
label: Expected and actual behavior
description: Verbose description
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce the behavior
description: Verbose description
- type: textarea
id: files
attributes:
label: Attached files
description: Screenshots, screencasts, dolibarr.log, debugging informations

View File

@ -1,27 +0,0 @@
---
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*]

View File

@ -0,0 +1,35 @@
name: Feature request
description: Suggest a new idea for this project
labels: ["Feature request"]
body:
- type: markdown
attributes:
value: |
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.
- type: textarea
id: feature-request
attributes:
label: Feature Request
description: Short description
validations:
required: true
- type: textarea
id: use-case
attributes:
label: Use case
description: Verbose description
- type: textarea
id: suggested-implementation
attributes:
label: Suggested implementation
description: Verbose description
- type: textarea
id: suggested-steps
attributes:
label: Suggested steps
description: List of tasks to achieve goal

View File

@ -57,7 +57,7 @@ jobs:
php: nightly php: nightly
env: DB=mysql env: DB=mysql
- stage: PHP Dev - stage: PHP Dev
if: type = push AND branch = 14.0 if: type = push AND branch = 15.0
php: nightly php: nightly
env: DB=mysql env: DB=mysql
@ -411,6 +411,12 @@ script:
php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log php upgrade.php 13.0.0 14.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade13001400.log
php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log php upgrade2.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-2.log
php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log php step5.php 13.0.0 14.0.0 > $TRAVIS_BUILD_DIR/upgrade13001400-3.log
php upgrade.php 14.0.0 15.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade14001500.log
php upgrade2.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-2.log
php step5.php 14.0.0 15.0.0 > $TRAVIS_BUILD_DIR/upgrade14001500-3.log
php upgrade.php 15.0.0 16.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade15001600.log
php upgrade2.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-2.log
php step5.php 15.0.0 16.0.0 > $TRAVIS_BUILD_DIR/upgrade15001600-3.log
ls -alrt $TRAVIS_BUILD_DIR/ ls -alrt $TRAVIS_BUILD_DIR/
- | - |

View File

@ -12,10 +12,9 @@ NEW: Online proposal signature
NEW: Can define some max limit on expense report (per period, per type or expense, ...) NEW: Can define some max limit on expense report (per period, per type or expense, ...)
NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation. NEW: Allow the use of __NEWREF__ to get for example the new reference a draft order will get after validation.
NEW: Add option to disable globaly some notifications emails. NEW: Add option to disable globaly some notifications emails.
NEW: #18326 Workflow: Close order on shipment closing.
NEW: #18401 Add __NEWREF__ subtitute to get new object reference. NEW: #18401 Add __NEWREF__ subtitute to get new object reference.
NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment NEW: #18403 Add __URL_SHIPMENT__ substitute to get the URL of a shipment
NEW: #18689 REST API module: add api key generate / modify right. NEW: #18689 REST API module: add api key generate / modify permission.
NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties. NEW: #18663 Make "L'Annuaire des Entreprises" the default provider for SIREN verification for French thirdparties.
NEW: #18046 Add tags on ticket/categories NEW: #18046 Add tags on ticket/categories
NEW: #18326 Workflow: Close order on shipment closing. NEW: #18326 Workflow: Close order on shipment closing.
@ -106,6 +105,14 @@ NEW: when multiple order linked to facture, show list into note.
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
NEW: Editing a page in website module keep old page with name .back NEW: Editing a page in website module keep old page with name .back
NEW: External backups can be downloaded from the "About info page". NEW: External backups can be downloaded from the "About info page".
NEW: Add massaction to switch status on sale / on purchase of a product.
Modules
NEW: Stable module Knowledge Management
NEW: Experimental module Event Organization Management
NEW: Experimental module Workstations Management
NEW: Development of module Partnership Management
For developers: For developers:
@ -115,6 +122,7 @@ NEW: Introduce method hasRight
NEW: Can use textarea field into a confirm popup. NEW: Can use textarea field into a confirm popup.
NEW: Can use the result_mode of mysqli driver. Save memory for list count NEW: Can use the result_mode of mysqli driver. Save memory for list count
NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method. NEW: #18319 REST API - Shipment: Add 'close' action / endpoint / POST method.
NEW: Add API /approve and /makeOrder for purchase orders.
NEW: add action trigger for member excluded NEW: add action trigger for member excluded
NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL NEW: add option MAIN_IBAN_IS_NEVER_MANDATORY, MAIN_IBAN_NOT_MANDATORY, PROPAL_NOT_BILLABLE, PROPAL_REOPEN_UNSIGNED_ONLY, PROPOSAL_ARE_NOT_BILLABLE, TICKETS_MESSAGE_FORCE_MAIL
NEW: Add code codebar column on serial/lot structure NEW: Add code codebar column on serial/lot structure
@ -132,10 +140,13 @@ NEW: printFieldListFrom hook call on several lists
NEW: Use lang selector when using a field key 'lang' in modulebuilder NEW: Use lang selector when using a field key 'lang' in modulebuilder
NEW: we need to be able to put more filters on deleteByParentField() function NEW: we need to be able to put more filters on deleteByParentField() function
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
NEW: Experimental feature to manage user sessions in database
NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
NEW: Add hook printUnderHeaderPDFline on invoice PDF templates (can be used for example to add a barcode or more information on header of invoices).
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field
into forms will be broken. The security token field is expected since Dolibarr v9 but a lot of external modules did not implement it).
* Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook. * Update hook 'printOriginObjectLine', removed check on product type and special code. Need now reshook.
* Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale. * Old deprecated module "SimplePOS" has been completely removed. Use module "TakePOS" is you need a Point Of Sale.
* The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param). * The method static ActionComm::getActions($db, ...) is no more static. Use $actioncomm->getActions(...) instead (without $db param).
@ -143,8 +154,48 @@ Following changes may create regressions for some external modules, but were nec
* Method getDictvalue has been renamed into getDictionaryValue to match camel case rule. * Method getDictvalue has been renamed into getDictionaryValue to match camel case rule.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in * To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php method executeCLI() available into core/class/utils.class.php
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype
***** ChangeLog for 14.0.5 compared to 14.0.4 *****
FIX: 13.0: printFieldListWhere called twice on same query
FIX: 14.0.4 fatal error on cron list.
FIX: #19476
FIX: #19564
FIX: #19651
FIX: Accountancy - SQL error on subledger account search in journal
FIX: apply eldy's suggestion to not overwrite existing extrafields of $line
FIX: Can't close a down payment if paid with credit notes.
FIX: better compatibility with multicompany
FIX: contact card: bad colspan value for separator extrafield in creation/modification form
FIX: discounts are applied both when fetching the best supplier price and when displaying it
FIX: double display for contact categorie on societe create card
FIX: fatal error on cron list.
FIX: holiday list: only mass delete if leave request is not in draft, canceled or refused, like in card
FIX: holiday mass deletion: correct return of record deleted
FIX: Holiday month report
FIX: info tab on customer invoice record not found
FIX: line extrafields are inoperative in dispatch cards even when they exist
FIX: list of categories in stats of supplier invoices
FIX: missing default value for more comprehensive
FIX: multicurrency: fields in discount unitialized when creating deposit
FIX: Navigation on bank transaction list
FIX: Can't edit a bank transaction due to bad permission check.
FIX: Option MAIN_DIRECT_STATUS_UPDATE broken. Ajax on/off not saving value in DB after updating to version >=12
FIX: postgresql compatibility, "" as is not authorized
FIX: printFieldListWhere called twice (at different locations) for the same SQL query, can result in syntax errors
FIX: select too large into addrights (pb of missing parenthesis)
FIX: set optional from post, we can't untick boolean field on product card
FIX: Take into consideration work leave over serveral months
FIX: test if method exist on wrong object
FIX: title for nature of third party in company list
FIX: Urgent onglet contact inaccessible depuis une facture
FIX: wrong syntax of sql request
***** ChangeLog for 14.0.4 compared to 14.0.3 ***** ***** ChangeLog for 14.0.4 compared to 14.0.3 *****

View File

@ -4,6 +4,7 @@
![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg) ![Build status](https://img.shields.io/travis/Dolibarr/dolibarr/develop.svg)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/) [![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.6-8892BF.svg?style=flat-square)](https://php.net/)
[![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr) [![GitHub release](https://img.shields.io/github/v/release/Dolibarr/dolibarr)](https://github.com/Dolibarr/dolibarr)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5521/badge)](https://bestpractices.coreinfrastructure.org/projects/5521)
Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…). Dolibarr ERP & CRM is a modern software package that helps manage your organization's activity (contacts, suppliers, invoices, orders, stocks, agenda…).

View File

@ -6,13 +6,14 @@ This file contains some policies about the security reports on Dolibarr ERP CRM
| Version | Supported | | Version | Supported |
| ---------- | ---------------------- | | ---------- | ---------------------- |
| <= 14.0.1 | :x: | | <= 14.0.4 | :x: |
| >= 14.0.2+ | :white_check_mark: except CSRF attacks| | >= 14.0.5+ | :white_check_mark: except CSRF attacks|
| >= develop | :white_check_mark: | | >= develop | :white_check_mark: |
## Reporting a Vulnerability ## Reporting a Vulnerability
To report a vulnerability, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions) or alternatively send an email to security@dolibarr.org (for everybody) To report a vulnerability, for a private report, please use GitHub security advisory at [https://github.com/Dolibarr/dolibarr/security/advisories/new](https://github.com/Dolibarr/dolibarr/security/advisories/new) (if you have permissions).
Alternatively send an email to security@dolibarr.org (for everybody)
## Hunting vulnerabilities on Dolibarr ## Hunting vulnerabilities on Dolibarr
@ -66,7 +67,7 @@ Scope is the web application (back office) and the APIs.
* Remote code execution (RCE) * Remote code execution (RCE)
* Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA) * Local files access and manipulation (LFI, RFI, XXE, SSRF, XSPA)
* Code injections (HTML, JS, SQL, PHP, ...) * Code injections (HTML, JS, SQL, PHP, ...)
* Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose or into module "Web site" when permission to edit website content is allowed). * Cross-Site Scripting (XSS), except from setup page of module "External web site" (allowing any content here, editable by admin user only, is accepted on purpose) and except into module "Web site" when permission to edit website content is allowed (injecting any data in this case is allowed too).
* Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users) * Cross-Site Requests Forgery (CSRF) with real security impact (when using GET URLs, CSRF are qualified only for creating, updating or deleting data from pages restricted to admin users)
* Open redirect * Open redirect
* Broken authentication & session management * Broken authentication & session management

View File

@ -39,15 +39,13 @@ RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug && docker-php-ext-enable xdebug RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_autostart=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.mode=debug' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_enable=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.start_with_request=yes' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.default_enable=1' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.client_host=host.docker.internal' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'xdebug.remote_host=docker.host' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.client_port=9003' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_port=9000' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.discover_client_host=true' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_connect_back=1' >> ${PHP_INI_DIR}/php.ini #RUN echo 'xdebug.log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.profiler_enable=0' >> ${PHP_INI_DIR}/php.ini RUN echo 'xdebug.idekey="netbeans-xdebug"' >> ${PHP_INI_DIR}/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> ${PHP_INI_DIR}/php.ini
#RUN echo 'localhost docker.host' >> /etc/hosts
# set up sendmail config, to use maildev # set up sendmail config, to use maildev
RUN echo "account default" > /etc/msmtprc RUN echo "account default" > /etc/msmtprc

View File

@ -48,6 +48,7 @@ services:
- external-pod - external-pod
extra_hosts: extra_hosts:
- "localhost.localdomain:127.0.0.1" - "localhost.localdomain:127.0.0.1"
- "host.docker.internal:host-gateway"
mail: mail:
image: maildev/maildev image: maildev/maildev

View File

@ -205,6 +205,8 @@ with
with with
foreach ($value[1] as $k => $v) { foreach ($value[1] as $k => $v) {
JSGANTT: JSGANTT:
-------- --------
* Replace in function JSGantt.taskLink * Replace in function JSGantt.taskLink
@ -233,11 +235,13 @@ JCROP:
* Remove analytics tag into file index.html * Remove analytics tag into file index.html
JQUERYFILETREE: JQUERYFILETREE:
--------------- ---------------
* Remove directory htdocs/includes/jquery/plugins/jqueryFileTree/connectors * Remove directory htdocs/includes/jquery/plugins/jqueryFileTree/connectors
RESTLER: RESTLER:
-------- --------

View File

@ -132,7 +132,7 @@ then
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15 trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Init Dolibarr with demo values" --clear \ $DIALOG --title "Init Dolibarr with demo values" --clear \
--inputbox "Password for Mysql user login :" 16 55 2> $fichtemp --passwordbox "Password for Mysql user login :" 16 55 2> $fichtemp
valret=$? valret=$?
@ -153,7 +153,7 @@ then
# ---------------------------- confirmation # ---------------------------- confirmation
DIALOG=${DIALOG=dialog} DIALOG=${DIALOG=dialog}
$DIALOG --title "Init Dolibarr with demo values" --clear \ $DIALOG --title "Init Dolibarr with demo values" --clear \
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : '$passwd'" 15 55 --yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
case $? in case $? in
0) echo "Ok, start process...";; 0) echo "Ok, start process...";;

File diff suppressed because one or more lines are too long

View File

@ -116,7 +116,7 @@ then
fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$ fichtemp=`tempfile 2>/dev/null` || fichtemp=/tmp/test$$
trap "rm -f $fichtemp" 0 1 2 5 15 trap "rm -f $fichtemp" 0 1 2 5 15
$DIALOG --title "Save Dolibarr with demo values" --clear \ $DIALOG --title "Save Dolibarr with demo values" --clear \
--inputbox "Password for Mysql root login :" 16 55 2> $fichtemp --passwordbox "Password for Mysql root login :" 16 55 2> $fichtemp
valret=$? valret=$?
@ -150,7 +150,7 @@ then
# ---------------------------- confirmation # ---------------------------- confirmation
DIALOG=${DIALOG=dialog} DIALOG=${DIALOG=dialog}
$DIALOG --title "Save Dolibarr with demo values" --clear \ $DIALOG --title "Save Dolibarr with demo values" --clear \
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : '$passwd'" 15 55 --yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : --hidden--" 15 55
case $? in case $? in
0) echo "Ok, start process...";; 0) echo "Ok, start process...";;

View File

@ -0,0 +1,13 @@
List of QR Code format we found on some invoices
------------------------------------------------
* For SEPA QR payment Code format (Europe)
------------------------------------------
https://en.wikipedia.org/wiki/EPC_QR_code#Generators
* For ZATCA QR Code format (Saudi Arabia)
-----------------------------------------
https://www.pwc.com/m1/en/services/tax/me-tax-legal-news/2021/saudi-arabia-guide-to-develop-compliant-qr-code-for-simplified-einvoices.html

View File

@ -1,3 +1,5 @@
Address format
https://bitboost.com/ref/international-address-formats.html#Formats https://bitboost.com/ref/international-address-formats.html#Formats
https://www.upu.int/en/Postal-Solutions/Programmes-Services/Addressing-Solutions https://www.upu.int/en/Postal-Solutions/Programmes-Services/Addressing-Solutions

View File

@ -1,3 +1,5 @@
Date and number format
----------------------
For languages: For languages:
https://icu4c-demos.unicode.org/icu-bin/icudemos - Locale Explorer -> Error 404 https://icu4c-demos.unicode.org/icu-bin/icudemos - Locale Explorer -> Error 404

View File

@ -1,3 +1,6 @@
VAT Rates
---------
http://www.taxrates.cc/index.html http://www.taxrates.cc/index.html
https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates https://en.wikipedia.org/wiki/List_of_countries_by_tax_rates

View File

@ -2,13 +2,17 @@
#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i" #php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com" #php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com" php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
php_admin_value open_basedir /tmp/:/home/../htdocs php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
ServerName myvirtualalias ServerName myvirtualalias
ServerAlias myvirtualalias ServerAlias myvirtualalias
UseCanonicalName On UseCanonicalName On
KeepAlive On
KeepAliveTimeout 5
MaxKeepAliveRequests 20
AddDefaultCharset UTF-8 AddDefaultCharset UTF-8
DocumentRoot "/home/.../htdocs" DocumentRoot "/home/.../htdocs"
@ -17,13 +21,40 @@ DocumentRoot "/home/.../htdocs"
AllowOverride None AllowOverride None
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
Require all granted Require all granted
# To restrict access by a HTTP basic auth
#AuthType Basic
#AuthName "Authenticate to backoffice"
#AuthUserFile /etc/apache2/.htpasswd
#require valid-user
</Directory> </Directory>
<Directory "/home/../htdocs/cache"> # Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
Deny from all <Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml AuthType None
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml Require all granted
Satisfy any
</Directory> </Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
AuthType None
Require all granted
Satisfy any
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
AuthType None
Require all granted
Satisfy any
</Directory>
<Directory /home/admin/wwwroot/dolibarr/htdocs/.well-known/>
AuthType None
Require all granted
Satisfy any
</Directory>
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
AuthType None
Require all granted
Satisfy any
</Files>
ErrorLog /var/log/apache2/myvirtualalias_error_log ErrorLog /var/log/apache2/myvirtualalias_error_log

View File

@ -17,14 +17,14 @@ fi
# To detec # To detec
if [ "x$1" = "xlist" ] if [ "x$1" = "xlist" ]
then then
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep -v 'htdocs\/includes' | grep CRLF # find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep -v 'htdocs\/includes' | grep CRLF
fi fi
# To convert # To convert
if [ "x$1" = "xfix" ] if [ "x$1" = "xfix" ]
then then
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'documents\/website' | grep -v 'documents\/mdedias' | grep CRLF | awk -F':' '{ print $1 }' ` for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" -o -iname "*.pml" \) -exec file "{}" + | grep -v 'custom\/' | grep -v 'documents\/website' | grep -v 'documents\/medias' | grep -v 'documents\/sellyoursaas' | grep CRLF | awk -F':' '{ print $1 }' `
do do
echo "Fix file $fic" echo "Fix file $fic"
dos2unix "$fic" dos2unix "$fic"

View File

@ -14,7 +14,8 @@ max_output_size=0
usage() usage()
{ {
cat <<EO cat <<EO
Usage: $PROGNAME [options] Usage: $PROGNAME (list|fix) [options]
Example: optimize_images.sh (list|fix) -i dirtoscan
Script to optimize JPG and PNG images in a directory. Script to optimize JPG and PNG images in a directory.
@ -183,8 +184,8 @@ ARGS=$(getopt -s bash --options $SHORTOPTS --longoptions $LONGOPTS --name $PROGN
# Syntax # Syntax
if [ "x$1" != "xlist" -a "x$1" != "xfix" ] if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
then then
echo "Usage: optimize_images.sh (list|fix) -i dirtoscan" usage
exit exit 0
fi fi
eval set -- "$ARGS" eval set -- "$ARGS"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
doc/images/dolibarr_logo.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 KiB

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 KiB

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -363,7 +363,7 @@ if ($resql) {
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accounting_account', 0, $newcardbutton, '', $limit, 0, 0, 1);
// Box to select active chart of account // Box to select active chart of account
print $langs->trans("Selectchartofaccounts")." : "; print $langs->trans("Selectchartofaccounts")." : ";
@ -404,6 +404,11 @@ if ($resql) {
$moreforfilter = ''; $moreforfilter = '';
$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
$totalarray = array();
$totalarray['nbfield'] = 0;
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -466,11 +471,6 @@ if ($resql) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$accountstatic = new AccountingAccount($db);
$accountparent = new AccountingAccount($db);
$totalarray = array();
$totalarray['nbfield'] = 0;
$i = 0; $i = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -615,8 +615,13 @@ if ($resql) {
} }
if ($num == 0) { if ($num == 0) {
$totalarray['nbfield']++; $colspan = 1;
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
$colspan++;
}
}
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
} }
print "</table>"; print "</table>";

View File

@ -417,13 +417,13 @@ if ($action == 'create') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if (!empty($user->rights->accounting->chartofaccount)) { if (!empty($user->rights->accounting->chartofaccount)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
} }
if (!empty($user->rights->accounting->chartofaccount)) { if (!empty($user->rights->accounting->chartofaccount)) {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
} else { } else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>'; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
} }

View File

@ -142,7 +142,7 @@ $linkback = '';
print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy'); print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy');
print "\n".'<script type="text/javascript" language="javascript">'."\n"; print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {'."\n"; print 'jQuery(document).ready(function () {'."\n";
print ' function initfields()'."\n"; print ' function initfields()'."\n";
print ' {'."\n"; print ' {'."\n";

View File

@ -127,7 +127,6 @@ if ($result) {
$title = $langs->trans('AccountingPeriods'); $title = $langs->trans('AccountingPeriods');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
// Load attribute_label
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">'; print '<table class="tagtable liste centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -58,8 +58,8 @@ $listoffset = GETPOST('listoffset', 'alpha');
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000; $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
$active = 1; $active = 1;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -80,8 +80,8 @@ if (empty($accounting_product_mode)) {
} }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -753,7 +753,7 @@ if ($result) {
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
function init_savebutton() function init_savebutton()
{ {

View File

@ -237,11 +237,11 @@ if ($action != 'export_csv') {
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />'; $button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#exportcsvbutton").click(function() { jQuery("#exportcsvbutton").click(function() {
event.preventDefault(); event.preventDefault();
@ -417,7 +417,7 @@ if ($action != 'export_csv') {
// Show first line of a break // Show first line of a break
print '<tr class="trforbreak">'; print '<tr class="trforbreak">';
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; print '<td colspan="'.($colspan+1).'" class="tdforbreak">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
print '</tr>'; print '</tr>';
$displayed_account = $root_account_number; $displayed_account = $root_account_number;

View File

@ -38,6 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
$langs->loadLangs(array("accountancy", "bills", "compta")); $langs->loadLangs(array("accountancy", "bills", "compta"));
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int'); // id of record $id = GETPOST('id', 'int'); // id of record
@ -92,6 +94,11 @@ if (empty($user->rights->accounting->mouvements->lire)) {
* Actions * Actions
*/ */
if ($cancel) {
header("Location: ".DOL_URL_ROOT.'/accountancy/bookkeeping/list.php');
exit;
}
if ($action == "confirm_update") { if ($action == "confirm_update") {
$error = 0; $error = 0;
@ -618,9 +625,10 @@ if ($action == 'create') {
print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n"; print '<input type="hidden" name="fk_docdet" value="'.$object->fk_docdet.'">'."\n";
print '<input type="hidden" name="mode" value="'.$mode.'">'."\n"; print '<input type="hidden" name="mode" value="'.$mode.'">'."\n";
if (count($object->linesmvt) > 0) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
if (count($object->linesmvt) > 0) {
$total_debit = 0; $total_debit = 0;
$total_credit = 0; $total_credit = 0;
@ -670,8 +678,14 @@ if ($action == 'create') {
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">'; print '<input type="submit" class="button" name="update" value="'.$langs->trans("Update").'">';
print '</td>'; print '</td>';
} else { } else {
$accountingaccount->fetch(null, $line->numero_compte, true); $resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true);
print '<td>'.$accountingaccount->getNomUrl(0, 1, 1, '', 0).'</td>'; print '<td>';
if ($resultfetch > 0) {
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
} else {
print $line->numero_compte.' <span class="warning">('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')</span>';
}
print '</td>';
print '<td>'.length_accounta($line->subledger_account); print '<td>'.length_accounta($line->subledger_account);
if ($line->subledger_label) { if ($line->subledger_label) {
print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>'; print ' - <span class="opacitymedium">'.$line->subledger_label.'</span>';
@ -681,11 +695,15 @@ if ($action == 'create') {
print '<td class="right nowraponall amount">'.price($line->debit).'</td>'; print '<td class="right nowraponall amount">'.price($line->debit).'</td>';
print '<td class="right nowraponall amount">'.price($line->credit).'</td>'; print '<td class="right nowraponall amount">'.price($line->credit).'</td>';
print '<td class="center">'; print '<td class="center nowraponall">';
if (empty($line->date_export) && empty($line->date_validation)) { if (empty($line->date_export) && empty($line->date_validation)) {
print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
print img_edit('', 0, 'class="marginrightonly"'); print img_edit('', 0, 'class="marginrightonly"');
print '</a> &nbsp;'; print '</a> &nbsp;';
} else {
print '<a class="editfielda nohover cursornotallowed reposition disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
print img_edit($langs->trans("ForbiddenTransactionAlreadyExported"), 0, 'class="marginrightonly"');
print '</a> &nbsp;';
} }
if (empty($line->date_validation)) { if (empty($line->date_validation)) {
@ -696,9 +714,13 @@ if ($action == 'create') {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=' . $actiontodelete . '&id=' . $line->id . '&piece_num=' . urlencode($line->piece_num) . '&mode=' . urlencode($mode) . '&token=' . urlencode(newToken()) . '">';
print img_delete(); print img_delete();
print '</a>';
} else {
print '<a class="editfielda nohover cursornotallowed disabled" href="#" title="'.dol_escape_htmltag($langs->trans("ForbiddenTransactionAlreadyExported")).'">';
print img_delete($langs->trans("ForbiddenTransactionAlreadyValidated"));
print '</a>';
} }
print '</a>';
print '</td>'; print '</td>';
} }
print "</tr>\n"; print "</tr>\n";
@ -733,12 +755,16 @@ if ($action == 'create') {
print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>'; print '<td><input type="text" class="minwidth200" name="label_operation" value="' . $label_operation . '"/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="debit" value=""/></td>';
print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>'; print '<td class="right"><input type="text" size="6" class="right" name="credit" value=""/></td>';
print '<td><input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '"></td>'; print '<td>';
print '<input type="submit" class="button" name="save" value="' . $langs->trans("Add") . '">';
print '</td>';
print '</tr>'; print '</tr>';
} }
print '</table>';
} }
print '</table>';
print '</div>';
if ($mode == '_tmp' && $action == '') { if ($mode == '_tmp' && $action == '') {
print '<br>'; print '<br>';
print '<div class="center">'; print '<div class="center">';
@ -753,8 +779,9 @@ if ($action == 'create') {
print "</div>"; print "</div>";
} }
print '</form>';
} }
print '</form>';
} }
} else { } else {
print load_fiche_titre($langs->trans("NoRecords")); print load_fiche_titre($langs->trans("NoRecords"));

View File

@ -24,6 +24,7 @@
* \ingroup Accountancy (Double entries) * \ingroup Accountancy (Double entries)
* \brief List operation of book keeping * \brief List operation of book keeping
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -333,10 +334,6 @@ if (empty($reshook)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
} }
if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
}
if (!empty($search_accountancy_aux_code_start)) { if (!empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start; $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start); $param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
@ -533,11 +530,11 @@ if (count($filter) > 0) {
$sqlwhere[] = $key."='".$db->idate($value)."'"; $sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'"; $sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$db->escape($value)."'"; $sqlwhere[] = $key."'".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value); $sqlwhere[] = $key.'='.((int) $value);
} elseif ($key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'"; $sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
} elseif ($key == 't.subledger_account') { } elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1); $sqlwhere[] = natural_search($key, $value, 0, 1);
@ -696,9 +693,11 @@ if ($action == 'export_file') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
} }
if ($action == 'delmouv') { if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.urlencode(GETPOST('mvt_num')).$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
} }
if ($action == 'delbookkeepingyear') { if ($action == 'delbookkeepingyear') {
$form_question = array(); $form_question = array();
$delyear = GETPOST('delyear', 'int'); $delyear = GETPOST('delyear', 'int');
@ -719,6 +718,7 @@ if ($action == 'delbookkeepingyear') {
'type' => 'select', 'type' => 'select',
'label' => $langs->trans('DelMonth'), 'label' => $langs->trans('DelMonth'),
'values' => $month_array, 'values' => $month_array,
'morecss' => 'minwidth150',
'default' => '' 'default' => ''
); );
$form_question['delyear'] = array( $form_question['delyear'] = array(
@ -736,7 +736,7 @@ if ($action == 'delbookkeepingyear') {
'default' => $deljournal 'default' => $deljournal
); );
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 320);
} }
// Print form confirm // Print form confirm
@ -769,7 +769,7 @@ if (count($filter)) {
} }
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
// Button re-export // Button re-export
if (!empty($conf->global->ACCOUNTING_REEXPORT)) { if (!empty($conf->global->ACCOUNTING_REEXPORT)) {

View File

@ -473,7 +473,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
@ -711,8 +711,8 @@ while ($i < min($num, $limit)) {
} }
// Show the break account // Show the break account
print "<tr>"; print '<tr class="trforbreak">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" class="tdforbreak">';
if ($line->numero_compte != "" && $line->numero_compte != '-1') { if ($line->numero_compte != "" && $line->numero_compte != '-1') {
print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte); print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
} else { } else {

View File

@ -473,7 +473,7 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) { if (empty($reshook)) {
$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param); $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param, '', 1, array('morecss' => 'marginleftonly'));
@ -713,8 +713,8 @@ while ($i < min($num, $limit)) {
} }
// Show the break account // Show the break account
print "<tr>"; print '<tr class="trforbreak">';
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">'; print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" class="tdforbreak">';
if ($line->subledger_account != "" && $line->subledger_account != '-1') { if ($line->subledger_account != "" && $line->subledger_account != '-1') {
print $line->subledger_label.' : '.length_accounta($line->subledger_account); print $line->subledger_label.' : '.length_accounta($line->subledger_account);
} else { } else {

View File

@ -48,8 +48,8 @@ $socid = GETPOSTINT("socid");
// if ($user->socid) $socid=$user->socid; // if ($user->socid) $socid=$user->socid;
$limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOSTISSET('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == - 1) { if (empty($page) || $page == - 1) {
$page = 0; $page = 0;

View File

@ -48,8 +48,8 @@ $socid = GETPOSTINT("socid");
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == - 1) { if (empty($page) || $page == - 1) {
$page = 0; $page = 0;

View File

@ -915,7 +915,7 @@ class AccountancyExport
print "Montantdevise".$separator; print "Montantdevise".$separator;
print "Idevise".$separator; print "Idevise".$separator;
print "DateLimitReglmt".$separator; print "DateLimitReglmt".$separator;
print "NumFacture".$separator; print "NumFacture";
print $end_line; print $end_line;
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
@ -1000,10 +1000,10 @@ class AccountancyExport
print $line->multicurrency_code . $separator; print $line->multicurrency_code . $separator;
// FEC_suppl:DateLimitReglmt // FEC_suppl:DateLimitReglmt
print $date_limit_payment; print $date_limit_payment . $separator;
// FEC_suppl:NumFacture // FEC_suppl:NumFacture
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator; print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1);
print $end_line; print $end_line;
} }
@ -1042,7 +1042,7 @@ class AccountancyExport
print "Montantdevise".$separator; print "Montantdevise".$separator;
print "Idevise".$separator; print "Idevise".$separator;
print "DateLimitReglmt".$separator; print "DateLimitReglmt".$separator;
print "NumFacture".$separator; print "NumFacture";
print $end_line; print $end_line;
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
@ -1127,10 +1127,10 @@ class AccountancyExport
print $line->multicurrency_code . $separator; print $line->multicurrency_code . $separator;
// FEC_suppl:DateLimitReglmt // FEC_suppl:DateLimitReglmt
print $date_limit_payment; print $date_limit_payment . $separator;
// FEC_suppl:NumFacture // FEC_suppl:NumFacture
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator; print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1);
print $end_line; print $end_line;

View File

@ -29,6 +29,7 @@
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
/** /**
* Class to manage accounting accounts * Class to manage accounting accounts
*/ */
@ -108,6 +109,11 @@ class AccountingAccount extends CommonObject
*/ */
public $account_category; public $account_category;
/**
* @var int Label category account
*/
public $account_category_label;
/** /**
* @var int Status * @var int Status
*/ */
@ -148,6 +154,11 @@ class AccountingAccount extends CommonObject
*/ */
private $accountingaccount_codetotid_cache = array(); private $accountingaccount_codetotid_cache = array();
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;
/** /**
* Constructor * Constructor
* *
@ -166,7 +177,7 @@ class AccountingAccount extends CommonObject
* *
* @param int $rowid Id * @param int $rowid Id
* @param string $account_number Account number * @param string $account_number Account number
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account * @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code). * @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
* @return int <0 if KO, 0 if not found, Id of record if OK and found * @return int <0 if KO, 0 if not found, Id of record if OK and found
*/ */
@ -187,13 +198,14 @@ class AccountingAccount extends CommonObject
$sql .= " AND a.entity = ".$conf->entity; $sql .= " AND a.entity = ".$conf->entity;
} }
if (!empty($limittocurrentchart)) { if (!empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid='.$this->db->escape($conf->global->CHARTOFACCOUNTS).')'; $sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) $conf->global->CHARTOFACCOUNTS).')';
} }
if (!empty($limittoachartaccount)) { if (!empty($limittoachartaccount)) {
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'"; $sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
} }
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch rowid=".$rowid." account_number=".$account_number, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
@ -495,7 +507,7 @@ class AccountingAccount extends CommonObject
$url .= '&save_lastsearch_values=1'; $url .= '&save_lastsearch_values=1';
} }
$picto = 'billr'; $picto = 'accounting_account';
$label = ''; $label = '';
if (empty($this->labelshort) || $withcompletelabel == 1) { if (empty($this->labelshort) || $withcompletelabel == 1) {
@ -555,7 +567,7 @@ class AccountingAccount extends CommonObject
/** /**
* Information on record * Information on record
* *
* @param int $id of record * @param int $id ID of record
* @return void * @return void
*/ */
public function info($id) public function info($id)
@ -685,49 +697,22 @@ class AccountingAccount extends CommonObject
public function LibStatut($status, $mode = 0) public function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
global $langs; global $langs;
$langs->loadLangs(array("users")); $langs->load("users");
$this->labelStatus[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
if ($mode == 0) { $this->labelStatus[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
if ($status == 1) { $this->labelStatusShort[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
return $langs->trans('Enabled'); $this->labelStatusShort[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
} elseif ($status == 0) {
return $langs->trans('Disabled');
}
} elseif ($mode == 1) {
if ($status == 1) {
return $langs->trans('Enabled');
} elseif ($status == 0) {
return $langs->trans('Disabled');
}
} elseif ($mode == 2) {
if ($status == 1) {
return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled');
} elseif ($status == 0) {
return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled');
}
} elseif ($mode == 3) {
if ($status == 1) {
return img_picto($langs->trans('Enabled'), 'statut4');
} elseif ($status == 0) {
return img_picto($langs->trans('Disabled'), 'statut5');
}
} elseif ($mode == 4) {
if ($status == 1) {
return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled');
} elseif ($status == 0) {
return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled');
}
} elseif ($mode == 5) {
if ($status == 1) {
return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4');
} elseif ($status == 0) {
return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5');
}
}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps $statusType = 'status4';
if ($status == self::STATUS_DISABLED) {
$statusType = 'status5';
}
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
}
/** /**
* Return Suggest accounting accounts to bind * Return Suggest accounting accounts to bind
@ -866,8 +851,8 @@ class AccountingAccount extends CommonObject
// Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding) // Level 3 (define $code_t): Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) { if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
if (!empty($buyer->code_compta)) { if (!empty($buyer->code_compta_product)) {
$code_t = $buyer->code_compta; $code_t = $buyer->code_compta_product;
$suggestedid = $accountingAccount['thirdparty']; $suggestedid = $accountingAccount['thirdparty'];
$suggestedaccountingaccountfor = 'thridparty'; $suggestedaccountingaccountfor = 'thridparty';
} }

View File

@ -1013,7 +1013,7 @@ class BookKeeping extends CommonObject
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') { } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key.'\''.$this->db->escape($value).'\''; $sqlwhere[] = $key.'\''.$this->db->escape($value).'\'';
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.$value; $sqlwhere[] = $key.'='.((int) $value);
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\''; $sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
@ -2118,11 +2118,22 @@ class BookKeepingLine
*/ */
public $amount; public $amount;
/**
* @var float Multicurrency amount
*/
public $multicurrency_amount;
/**
* @var float Multicurrency code
*/
public $multicurrency_code;
/** /**
* @var string Sens * @var string Sens
*/ */
public $sens; public $sens;
public $lettering_code; public $lettering_code;
public $date_lettering;
/** /**
* @var int ID * @var int ID
@ -2153,4 +2164,9 @@ class BookKeepingLine
* @var integer|string $date_validation; * @var integer|string $date_validation;
*/ */
public $date_validation; public $date_validation;
/**
* @var integer|string $date_lim_reglement;
*/
public $date_lim_reglement;
} }

View File

@ -31,7 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "bills", "other", "accountancy")); $langs->loadLangs(array("compta", "bills", "other", "accountancy"));
$socid = GETPOST('socid', 'int'); $validatemonth = GETPOST('validatemonth', 'int');
$validateyear = GETPOST('validateyear', 'int');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
@ -68,52 +69,47 @@ if (empty($user->rights->accounting->fiscalyear->write)) {
} }
/* /*
* Actions * Actions
*/ */
$now = dol_now();
if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) { if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) {
$result = $object->fetchAll();
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
} else {
// Specify as export : update field date_validated on selected month/year
$error = 0;
$db->begin();
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
if (is_array($object->lines)) { $error = 0;
foreach ($object->lines as $movement) {
$now = dol_now();
$db->begin();
// Specify as export : update field date_validated on selected month/year
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
$sql .= " SET date_validated = '".$db->idate($now)."'"; $sql .= " SET date_validated = '".$db->idate($now)."'";
$sql .= " WHERE rowid = ".((int) $movement->id); $sql .= " WHERE entity = " . ((int) $conf->entity);
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'"; $sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'"; $sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
$sql .= " AND date_validated IS NULL";
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated", LOG_DEBUG); dol_syslog("/accountancy/closure/index.php action=validate_movement_confirm -> Set movements as validated", LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) { if (!$result) {
$error++; $error++;
break;
}
}
} }
if (!$error) { if (!$error) {
$db->commit(); $db->commit();
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs'); setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
} else {
$error++;
$db->rollback();
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
}
header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start); header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start);
exit; exit;
} else {
$db->rollback();
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
$action = '';
} }
} }

View File

@ -93,7 +93,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
*/ */
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) { if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
// Clean database // Clean database by removing binding done on non existing or no more existing accounts
$db->begin(); $db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd"; $sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
$sql1 .= " SET fk_code_ventilation = 0"; $sql1 .= " SET fk_code_ventilation = 0";
@ -119,6 +119,9 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0;
$notpossible = 0;
$db->begin(); $db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
@ -150,18 +153,17 @@ if ($action == 'validatehistory') {
$sql .= " co.code as country_code, co.label as country_label,"; $sql .= " co.code as country_code, co.label as country_label,";
$sql .= " s.tva_intra,"; $sql .= " s.tva_intra,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " spe.accountancy_code_sell as company_code_sell"; $sql .= " spe.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
} else { } else {
$sql .= " s.accountancy_code_sell as company_code_sell"; $sql .= " s.accountancy_code_sell as company_code_sell"; // accounting code for product but stored on thirdparty
} }
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
} }
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; // the main table
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
@ -172,8 +174,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0 AND l.product_type <= 2 AND f.entity = ".((int) $conf->entity);
$sql .= " AND l.product_type <= 2";
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
} }
@ -214,7 +215,7 @@ if ($action == 'validatehistory') {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta = $objp->company_code_sell; $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -277,18 +278,25 @@ if ($action == 'validatehistory') {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
break; break;
} else {
$nbbinddone++;
} }
} else {
$notpossible++;
} }
$i++; $i++;
} }
if ($num_lines > 10000) {
$notpossible += ($num_lines - 10000);
}
} }
if ($error) { if ($error) {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
} }
} }
@ -624,16 +632,22 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>'; print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
} }
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>'; print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,"; $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
for ($i = 1; $i <= 12; $i++) { for ($i = 1; $i <= 12; $i++) {
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
if ($j > 12) { if ($j > 12) {
$j -= 12; $j -= 12;
} }
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "(fd.total_ht-(fd.qty * fd.buy_price_ht))", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; $sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
" (".$db->ifsql("fd.total_ht < 0",
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
} }
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total"; $sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") as total";
$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
$sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'"; $sql .= " WHERE f.datef >= '".$db->idate($search_date_start)."'";
@ -650,7 +664,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
} else { } else {
$sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")"; $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.", ".Facture::TYPE_REPLACEMENT.", ".Facture::TYPE_CREDIT_NOTE.", ".Facture::TYPE_DEPOSIT.", ".Facture::TYPE_SITUATION.")";
} }
dol_syslog('htdocs/accountancy/customer/index.php'); dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {

View File

@ -516,7 +516,7 @@ if ($result) {
} }
print '</td>'; print '</td>';
print '<td>'.$objp->tva_intra.'</td>'; print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
print '<td>'; print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);

View File

@ -539,13 +539,14 @@ if ($result) {
$thirdpartystatic->client = $objp->client; $thirdpartystatic->client = $objp->client;
$thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->fournisseur = $objp->fournisseur;
$thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_client = $objp->code_client;
$thirdpartystatic->code_compta = $objp->code_compta_client; // For backward compatibility
$thirdpartystatic->code_compta_client = $objp->code_compta_client; $thirdpartystatic->code_compta_client = $objp->code_compta_client;
$thirdpartystatic->code_fournisseur = $objp->code_fournisseur; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur;
$thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta_company = $objp->company_code_sell; $thirdpartystatic->code_compta_product = $objp->company_code_sell; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -630,7 +631,7 @@ if ($result) {
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);
} }
if ($product_static->label) { if ($product_static->label) {
print '<br><span class="opacitymedium small">'.$product_static->label.'</span>'; print '<br><span class="opacitymedium small">'.dol_escape_htmltag($product_static->label).'</span>';
} }
print '</td>'; print '</td>';
@ -664,7 +665,7 @@ if ($result) {
print '</td>'; print '</td>';
// VAT Num // VAT Num
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>'; print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
@ -738,7 +739,7 @@ if ($db->type == 'mysqli') {
} }
// Add code to auto check the box when we select an account // Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery(".codeventil").change(function() { jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "") var s=$(this).attr("id").replace("codeventil", "")

View File

@ -99,40 +99,69 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0;
$notpossible = 0;
$db->begin(); $db->begin();
// Now make the binding // Now make the binding
if ($db->type == 'pgsql') { $sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det"; $sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
$sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
$sql1 .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst"; $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity);
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity); $sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number"; $sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0"; $sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
if ($validatemonth && $validateyear) { $sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
$sql1 .= dolSqlDateFilter('date', 0, $validatemonth, $validateyear);
}
} else {
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
$sql1 .= " AND erd.fk_code_ventilation = 0";
if ($validatemonth && $validateyear) { if ($validatemonth && $validateyear) {
$sql1 .= dolSqlDateFilter('erd.date', 0, $validatemonth, $validateyear); $sql1 .= dolSqlDateFilter('erd.date', 0, $validatemonth, $validateyear);
} }
}
dol_syslog('htdocs/accountancy/expensereport/index.php'); dol_syslog('htdocs/accountancy/expensereport/index.php');
$resql1 = $db->query($sql1); $result = $db->query($sql1);
if (!$resql1) { if (!$result) {
$error++; $error++;
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} else {
$num_lines = $db->num_rows($result);
$i = 0;
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
$objp = $db->fetch_object($result);
$lineid = $objp->rowid;
$suggestedid = $objp->suggestedid;
if ($suggestedid > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND rowid = ".((int) $lineid);
$resqlupdate = $db->query($sqlupdate);
if (!$resqlupdate) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
} else {
$nbbinddone++;
}
} else {
$notpossible++;
}
$i++;
}
if ($num_lines > 10000) {
$notpossible += ($num_lines - 10000);
}
}
if ($error) {
$db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
} }
} }
@ -155,7 +184,7 @@ print '</span><br>';
$y = $year_current; $y = $year_current;
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>'; $buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.$langs->trans("ValidateHistory").'</a>';
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1); print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);

View File

@ -394,11 +394,12 @@ if ($result) {
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>'; print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
// Accounting account affected // Accounting account affected
print '<td class="center">'; print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">'; print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>'; print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
print "</tr>"; print "</tr>";

View File

@ -470,7 +470,7 @@ if ($result) {
} }
// Add code to auto check the box when we select an account // Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery(".codeventil").change(function() { jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "") var s=$(this).attr("id").replace("codeventil", "")

View File

@ -100,7 +100,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
$showtutorial .= ' '.$langs->trans("ShowTutorial"); $showtutorial .= ' '.$langs->trans("ShowTutorial");
$showtutorial .= '</a></div>'; $showtutorial .= '</a></div>';
$showtutorial .= '<script type="text/javascript" language="javascript"> $showtutorial .= '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#show_hide").click(function () { jQuery("#show_hide").click(function () {
jQuery( "#idfaq" ).toggle({ jQuery( "#idfaq" ).toggle({

View File

@ -117,6 +117,9 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') { if ($action == 'validatehistory') {
$error = 0; $error = 0;
$nbbinddone = 0;
$notpossible = 0;
$db->begin(); $db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
@ -152,7 +155,6 @@ if ($action == 'validatehistory') {
} else { } else {
$sql .= " s.accountancy_code_buy as company_code_buy"; $sql .= " s.accountancy_code_buy as company_code_buy";
} }
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
@ -170,8 +172,7 @@ if ($action == 'validatehistory') {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0 AND l.product_type <= 2 AND f.entity = ".((int) $conf->entity);
$sql .= " AND l.product_type <= 2";
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; $sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
} }
@ -210,7 +211,7 @@ if ($action == 'validatehistory') {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta = $objp->company_code_sell; $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -229,7 +230,7 @@ if ($action == 'validatehistory') {
$facture_static->ref = $objp->ref; $facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid; $facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype; $facture_static->type = $objp->ftype;
$facture_static->datef = $objp->datef; $facture_static->date = $objp->datef;
$facture_static_det->id = $objp->rowid; $facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht; $facture_static_det->total_ht = $objp->total_ht;
@ -273,18 +274,25 @@ if ($action == 'validatehistory') {
$error++; $error++;
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
break; break;
} else {
$nbbinddone++;
} }
} else {
$notpossible++;
} }
$i++; $i++;
} }
if ($num_lines > 10000) {
$notpossible += ($num_lines - 10000);
}
} }
if ($error) { if ($error) {
$db->rollback(); $db->rollback();
} else { } else {
$db->commit(); $db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
} }
} }

View File

@ -521,7 +521,7 @@ if ($result) {
} }
print '</td>'; print '</td>';
print '<td>'.$objp->tva_intra.'</td>'; print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
print '<td>'; print '<td>';
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);

View File

@ -547,7 +547,7 @@ if ($result) {
$thirdpartystatic->email = $objp->email; $thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code; $thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra; $thirdpartystatic->tva_intra = $objp->tva_intra;
$thirdpartystatic->code_compta_company = $objp->company_code_buy; $thirdpartystatic->code_compta_product = $objp->company_code_buy; // The accounting account for product stored on thirdparty object (for level3 suggestion)
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
@ -672,7 +672,7 @@ if ($result) {
print '</td>'; print '</td>';
// VAT Num // VAT Num
print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>'; print '<td class="tdoverflowmax80" title="'.dol_escape_htmltag($objp->tva_intra).'">'.dol_escape_htmltag($objp->tva_intra).'</td>';
// Found accounts // Found accounts
print '<td class="small">'; print '<td class="small">';
@ -747,7 +747,7 @@ if ($db->type == 'mysqli') {
} }
// Add code to auto check the box when we select an account // Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery(".codeventil").change(function() { jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "") var s=$(this).attr("id").replace("codeventil", "")

View File

@ -113,7 +113,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user'); print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initemail() function initemail()
{ {

View File

@ -39,8 +39,8 @@ $langs->loadLangs(array("companies", "members"));
$id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int'); $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('rowid', 'int');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -136,7 +136,11 @@ if ($object->id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';

View File

@ -104,7 +104,7 @@ abstract class ActionsAdherentCardCommon
if ($action == 'create' || $action == 'edit') { if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript"> $this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'"; document.formsoc.action.value="'.$action.'";

View File

@ -327,7 +327,7 @@ if (empty($reshook)) {
$object->public = GETPOST("public", 'alpha'); $object->public = GETPOST("public", 'alpha');
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
if ($ret < 0) { if ($ret < 0) {
$error++; $error++;
} }
@ -918,12 +918,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// When used in standard mode // When used in standard mode
// ----------------------------------------- // -----------------------------------------
// Create mode
if ($action == 'create') { if ($action == 'create') {
/* ************************************************************************** */
/* */
/* Creation mode */
/* */
/* ************************************************************************** */
$object->canvas = $canvas; $object->canvas = $canvas;
$object->state_id = GETPOST('state_id', 'int'); $object->state_id = GETPOST('state_id', 'int');
@ -953,7 +949,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print load_fiche_titre($langs->trans("NewMember"), '', $object->picto); print load_fiche_titre($langs->trans("NewMember"), '', $object->picto);
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
@ -1094,15 +1090,15 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Pro phone // Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td>'; print '<tr><td>'.$langs->trans("PhonePro").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $soc->phone).'"></td></tr>'; print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').'<input type="text" name="phone" size="20" value="'.(GETPOSTISSET('phone') ? GETPOST('phone', 'alpha') : $soc->phone).'"></td></tr>';
// Personal phone // Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td>'; print '<tr><td>'.$langs->trans("PhonePerso").'</td>';
print '<td>'.img_picto('', 'object_phoning').' <input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>'; print '<td>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').'<input type="text" name="phone_perso" size="20" value="'.(GETPOSTISSET('phone_perso') ? GETPOST('phone_perso', 'alpha') : $object->phone_perso).'"></td></tr>';
// Mobile phone // Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td>'; print '<tr><td>'.$langs->trans("PhoneMobile").'</td>';
print '<td>'.img_picto('', 'object_phoning_mobile').' <input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>'; print '<td>'.img_picto('', 'object_phoning_mobile', 'class="pictofixedwidth"').'<input type="text" name="phone_mobile" size="20" value="'.(GETPOSTISSET('phone_mobile') ? GETPOST('phone_mobile', 'alpha') : $object->phone_mobile).'"></td></tr>';
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
@ -1145,13 +1141,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print "</form>\n"; print "</form>\n";
} }
// Edit mode
if ($action == 'edit') { if ($action == 'edit') {
/********************************************
*
* Edition mode
*
********************************************/
$res = $object->fetch($id); $res = $object->fetch($id);
if ($res < 0) { if ($res < 0) {
dol_print_error($db, $object->error); exit; dol_print_error($db, $object->error); exit;
@ -1183,7 +1174,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="edit"; document.formsoc.action.value="edit";
@ -1295,11 +1286,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// EMail // EMail
print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>'; print '<tr><td>'.($conf->global->ADHERENT_MAIL_REQUIRED ? '<span class="fieldrequired">' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '</span>' : '').'</td>';
print '<td>'.img_picto('', 'object_email').' <input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>'; print '<td>'.img_picto('', 'object_email', 'class="pictofixedwidth"').'<input type="text" name="member_email" class="minwidth300" maxlength="255" value="'.(GETPOSTISSET("member_email") ? GETPOST("member_email", '', 2) : $object->email).'"></td></tr>';
// Website // Website
print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('Web', 'member_url', GETPOST('member_url', 'alpha'), $object, 0).'</td>';
print '<td colspan="3">'.img_picto('', 'globe').' <input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET('member_url') ?GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>'; print '<td>'.img_picto('', 'globe', 'class="pictofixedwidth"').'<input type="text" name="member_url" id="member_url" class="maxwidth200onsmartphone maxwidth500 widthcentpercentminusx " value="'.(GETPOSTISSET('member_url') ?GETPOST('member_url', 'alpha') : $object->url).'"></td></tr>';
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'; print '<tr><td>'.$langs->trans("Address").'</td><td>';
@ -1412,13 +1403,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</form>'; print '</form>';
} }
// View
if ($id > 0 && $action != 'edit') { if ($id > 0 && $action != 'edit') {
/* ************************************************************************** */
/* */
/* View mode */
/* */
/* ************************************************************************** */
$res = $object->fetch($id); $res = $object->fetch($id);
if ($res < 0) { if ($res < 0) {
dol_print_error($db, $object->error); exit; dol_print_error($db, $object->error); exit;
@ -1707,7 +1693,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
@ -1862,13 +1853,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '</td></tr>'; print '</td></tr>';
// VCard // VCard
/*
print '<tr><td>'; print '<tr><td>';
print $langs->trans("VCard").'</td><td colspan="3">'; print $langs->trans("VCard").'</td><td colspan="3">';
print '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'">'; print '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'">';
print img_picto($langs->trans("Download"), 'vcard.png', 'class="paddingrightonly"'); print img_picto($langs->trans("Download").' vcard', 'vcard.png', 'class="paddingrightonly"');
print $langs->trans("Download"); print $langs->trans("Download");
print img_picto($langs->trans("Download").' vcard', 'download', 'class="paddingleft"');
print '</a>'; print '</a>';
print '</td></tr>'; print '</td></tr>';
*/
print "</table>\n"; print "</table>\n";

View File

@ -119,7 +119,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
} }
//if (!empty($objp->$key)) //if (!empty($objp->$key))
// $objp->array_options[$tmpkey] = $objp->$key; // $objp->array_options[$tmpkey] = $objp->$key;
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey; //$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', $object->table_element); //$objp->$tmpkey;
} }
} }
@ -275,7 +275,7 @@ dol_htmloutput_errors($mesg);
print '<br>'; print '<br>';
print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' '; print img_picto('', 'card').' '.$langs->trans("DocForAllMembersCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="foruserid" value="all">'; print '<input type="hidden" name="foruserid" value="all">';
@ -289,12 +289,12 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('modelcard', $arrayoflabels, (GETPOST('modelcard') ? GETPOST('modelcard') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br><br>'; print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' '; print img_picto('', 'card').' '.$langs->trans("DocForOneMemberCards", (!empty($conf->global->ADHERENT_CARD_TYPE) ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="cardlogin">'; print '<input type="hidden" name="mode" value="cardlogin">';
@ -308,12 +308,12 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('model', $arrayoflabels, (GETPOST('model') ?GETPOST('model') : (empty($conf->global->ADHERENT_CARD_TYPE) ? '' : $conf->global->ADHERENT_CARD_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">'; print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br><br>'; print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)).' '; print img_picto('', 'card').' '.$langs->trans("DocForLabels", (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="mode" value="label">'; print '<input type="hidden" name="mode" value="label">';
@ -326,7 +326,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) {
} }
asort($arrayoflabels); asort($arrayoflabels);
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : (empty($conf->global->ADHERENT_ETIQUETTE_TYPE) ? '' : $conf->global->ADHERENT_ETIQUETTE_TYPE)), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input type="submit" class="button" value="'.$langs->trans("BuildDoc").'">'; print '<br><input type="submit" class="button small" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
// End of page // End of page

View File

@ -2176,9 +2176,10 @@ class Adherent extends CommonObject
$linkend = ''; $linkend = '';
if (!empty($this->photo)) { if (!empty($this->photo)) {
$label .= '<div class="photointooltip">'; $label .= '<div class="photointooltip floatright">';
$label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); $label .= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photoref photowithmargin photologintooltip', 'small', 0, 1);
$label .= '</div><div style="clear: both;"></div>'; $label .= '</div>';
//$label .= '<div style="clear: both;"></div>';
} }
$label .= '<div class="centpercent">'; $label .= '<div class="centpercent">';

View File

@ -94,9 +94,15 @@ class AdherentType extends CommonObject
*/ */
public $amount; public $amount;
/** @var string Public note */ /**
* @var string Public note
* @deprecated
*/
public $note; public $note;
/** @var string Public note */
public $note_public;
/** @var integer Can vote */ /** @var integer Can vote */
public $vote; public $vote;
@ -358,6 +364,10 @@ class AdherentType extends CommonObject
$this->label = trim($this->label); $this->label = trim($this->label);
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type "; $sql = "UPDATE ".MAIN_DB_PREFIX."adherent_type ";
@ -368,14 +378,14 @@ class AdherentType extends CommonObject
$sql .= "subscription = '".$this->db->escape($this->subscription)."',"; $sql .= "subscription = '".$this->db->escape($this->subscription)."',";
$sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).","; $sql .= "amount = ".((empty($this->amount) && $this->amount == '') ? 'null' : ((float) $this->amount)).",";
$sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',"; $sql .= "duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."',";
$sql .= "note = '".$this->db->escape($this->note)."',"; $sql .= "note = '".$this->db->escape($this->note_public)."',";
$sql .= "vote = ".(integer) $this->db->escape($this->vote).","; $sql .= "vote = ".(integer) $this->db->escape($this->vote).",";
$sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; $sql .= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
$sql .= " WHERE rowid =".((int) $this->id); $sql .= " WHERE rowid =".((int) $this->id);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->description = $this->db->escape($this->note); $this->description = $this->db->escape($this->note_public);
// Multilangs // Multilangs
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
@ -461,7 +471,7 @@ class AdherentType extends CommonObject
{ {
global $langs, $conf; global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut as status, d.duration, d.subscription, d.amount, d.mail_valid, d.note as note_public, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@ -483,7 +493,8 @@ class AdherentType extends CommonObject
$this->subscription = $obj->subscription; $this->subscription = $obj->subscription;
$this->amount = $obj->amount; $this->amount = $obj->amount;
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public;
$this->vote = $obj->vote; $this->vote = $obj->vote;
// multilangs // multilangs
@ -792,12 +803,16 @@ class AdherentType extends CommonObject
// Object classes // Object classes
$info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS); $info["objectclass"] = explode(',', $conf->global->LDAP_MEMBER_TYPE_OBJECT_CLASS);
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
// Champs // Champs
if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) { if ($this->label && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)) {
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label; $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME] = $this->label;
} }
if ($this->note && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) { if ($this->note_public && !empty($conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)) {
$info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 0, 'UTF-8', 1); $info[$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_public, 0, 'UTF-8', 1);
} }
if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) { if (!empty($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)) {
$valueofldapfield = array(); $valueofldapfield = array();
@ -829,7 +844,7 @@ class AdherentType extends CommonObject
$this->specimen = 1; $this->specimen = 1;
$this->label = 'MEMBERS TYPE SPECIMEN'; $this->label = 'MEMBERS TYPE SPECIMEN';
$this->note = 'This is a note'; $this->note_public = 'This is a public note';
$this->mail_valid = 'This is welcome email'; $this->mail_valid = 'This is welcome email';
$this->subscription = 1; $this->subscription = 1;
$this->vote = 0; $this->vote = 0;

View File

@ -74,7 +74,7 @@ class AdherentStats extends Stats
if ($this->memberid) { if ($this->memberid) {
$this->where .= " AND m.rowid = ".((int) $this->memberid); $this->where .= " AND m.rowid = ".((int) $this->memberid);
} }
//if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid; //if ($this->userid > 0) $this->where .= " AND fk_user_author = ".((int) $this->userid);
} }

View File

@ -237,8 +237,9 @@ class Members extends DolibarrApi
} }
// Add sql filters // Add sql filters
if ($sqlfilters) { if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) { $errormessage = '';
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";

View File

@ -102,8 +102,9 @@ class MembersTypes extends DolibarrApi
// Add sql filters // Add sql filters
if ($sqlfilters) { if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) { $errormessage = '';
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";

View File

@ -100,8 +100,9 @@ class Subscriptions extends DolibarrApi
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
// Add sql filters // Add sql filters
if ($sqlfilters) { if ($sqlfilters) {
if (!DolibarrApi::_checkFilters($sqlfilters)) { $errormessage = '';
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
} }
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)'; $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";

View File

@ -215,7 +215,7 @@ class Subscription extends CommonObject
$sql .= " tms,"; $sql .= " tms,";
$sql .= " dateadh as dateh,"; $sql .= " dateadh as dateh,";
$sql .= " datef,"; $sql .= " datef,";
$sql .= " subscription, note, fk_bank"; $sql .= " subscription, note as note_public, fk_bank";
$sql .= " FROM ".MAIN_DB_PREFIX."subscription"; $sql .= " FROM ".MAIN_DB_PREFIX."subscription";
$sql .= " WHERE rowid=".((int) $rowid); $sql .= " WHERE rowid=".((int) $rowid);
@ -235,7 +235,8 @@ class Subscription extends CommonObject
$this->dateh = $this->db->jdate($obj->dateh); $this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef); $this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription; $this->amount = $obj->subscription;
$this->note = $obj->note; $this->note = $obj->note_public; // deprecated
$this->note_public = $obj->note_public;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
return 1; return 1;
} else { } else {
@ -266,10 +267,14 @@ class Subscription extends CommonObject
return -1; return -1;
} }
if (empty($this->note_public) && !empty($this->note)) { // For backward compatibility
$this->note_public = $this->note;
}
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".((int) $this->fk_type).","; $sql .= " fk_type = ".((int) $this->fk_type).",";
$sql .= " fk_adherent = ".((int) $this->fk_adherent).","; $sql .= " fk_adherent = ".((int) $this->fk_adherent).",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " note=".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null').",";
$sql .= " subscription = ".price2num($this->amount).","; $sql .= " subscription = ".price2num($this->amount).",";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',";

View File

@ -44,8 +44,8 @@ $confirm = GETPOST('confirm', 'alpha');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -138,7 +138,11 @@ if ($id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
@ -149,7 +153,7 @@ if ($id > 0) {
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>'; print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
} }
// Type // Type
@ -163,7 +167,7 @@ if ($id > 0) {
print '</tr>'; print '</tr>';
// Company // Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>'; print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
// Civility // Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>'; print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';

View File

@ -83,8 +83,8 @@ if ($search_status < -2) {
} }
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -107,7 +107,11 @@ if ($id) {
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback); $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';

View File

@ -22,27 +22,6 @@
* \brief Page to create/edit/view partnership * \brief Page to create/edit/view partnership
*/ */
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION', '1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION', '1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', '1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK', '1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP', 'none'); // Disable all Content Security Policies
//if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
//if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification
// Load Dolibarr environment // Load Dolibarr environment
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';

View File

@ -485,7 +485,11 @@ if ($rowid > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback); $morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
@ -838,7 +842,7 @@ if ($rowid > 0) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
//var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE)); //var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
$(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ? 'show()' : 'hide()').'; $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ? 'show()' : 'hide()').';
$("#none, #invoiceonly").click(function() { $("#none, #invoiceonly").click(function() {
@ -1159,9 +1163,13 @@ if ($rowid > 0) {
print dol_get_fiche_end(); print dol_get_fiche_end();
print '<div class="center">'; print '<div class="center">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
if (empty($reshook)) {
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">'; print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</div>'; print '</div>';
print '</form>'; print '</form>';

View File

@ -52,8 +52,8 @@ $sall = '';
$date_select = GETPOST("date_select", 'alpha'); $date_select = GETPOST("date_select", 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;

View File

@ -53,8 +53,8 @@ $status = GETPOST('status', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { if (empty($page) || $page == -1) {
$page = 0; $page = 0;
@ -180,7 +180,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) {
$object->vote = (boolean) trim($vote); $object->vote = (boolean) trim($vote);
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object); $ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
if ($ret < 0) { if ($ret < 0) {
$error++; $error++;
} }
@ -292,7 +292,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
$membertype->amount = $objp->amount; $membertype->amount = $objp->amount;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td class="nowraponall">';
print $membertype->getNomUrl(1); print $membertype->getNomUrl(1);
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a> //<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
print '</td>'; print '</td>';
@ -340,12 +340,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
} }
} }
// Creation
/* ************************************************************************** */
/* */
/* Creation mode */
/* */
/* ************************************************************************** */
if ($action == 'create') { if ($action == 'create') {
$object = new AdherentType($db); $object = new AdherentType($db);
@ -416,11 +411,7 @@ if ($action == 'create') {
print "</form>\n"; print "</form>\n";
} }
/* ************************************************************************** */ // View
/* */
/* View mode */
/* */
/* ************************************************************************** */
if ($rowid > 0) { if ($rowid > 0) {
if ($action != 'edit') { if ($action != 'edit') {
$object = new AdherentType($db); $object = new AdherentType($db);
@ -455,8 +446,9 @@ if ($rowid > 0) {
print yn($object->subscription); print yn($object->subscription);
print '</tr>'; print '</tr>';
// Amount
print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount)); print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
print '</tr>'; print '</tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';

View File

@ -85,7 +85,7 @@ print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
$head = company_admin_prepare_head(); $head = company_admin_prepare_head();
print dol_get_fiche_head($head, 'accountant', $langs->trans("Company"), -1, 'company'); print dol_get_fiche_head($head, 'accountant', '', -1, '');
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
@ -100,7 +100,7 @@ print "<br><br>\n";
* Edit parameters * Edit parameters
*/ */
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
$("#selectcountry_id").change(function() { $("#selectcountry_id").change(function() {
document.form_index.action.value="updateedit"; document.form_index.action.value="updateedit";
@ -119,7 +119,7 @@ print '<tr class="liste_titre"><th class="titlefieldcreate wordbreak">'.$langs->
// Name // Name
print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>'; print '<tr class="oddeven"><td><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
print '<input name="nom" id="name" class="minwidth200" value="'.(GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n"; print '<input name="nom" id="name" class="minwidth200" autofocus value="'.(GETPOSTISSET('nom') ? GETPOST('nom', 'nohtml') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_NAME) ? $conf->global->MAIN_INFO_ACCOUNTANT_NAME : '')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
// Address // Address
print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>'; print '<tr class="oddeven"><td><label for="address">'.$langs->trans("CompanyAddress").'</label></td><td>';
@ -157,7 +157,7 @@ print '</td></tr>'."\n";
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>'; print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth'); print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
print '<input name="mail" id="email" class="maxwidth150 widthcentpercentminusx" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>'; print '<input name="mail" id="email" class="maxwidth300 widthcentpercentminusx" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
// Web // Web

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