Merge branch 'develop' into patch-36
This commit is contained in:
commit
0aa4ee9d40
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
10
.github/ISSUE_TEMPLATE/custom.md
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
name: Custom issue template
|
||||||
|
about: Describe this issue template's purpose here.
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
13
.github/workflows/greetings-pr.yml.disabled
vendored
Normal file
13
.github/workflows/greetings-pr.yml.disabled
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||||
|
name: Greetings PR
|
||||||
|
|
||||||
|
on: [pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
greeting:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/first-interaction@v1
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
pr-message: 'Welcome to the Dolibarr army. You are on the road to become an Admiral (see https://wiki.dolibarr.org/index.php/Dolibarr_Project)'
|
||||||
23
.github/workflows/stale-issues.yml
vendored
Normal file
23
.github/workflows/stale-issues.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||||
|
name: "Close stale issues (bugs and feature requests)"
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stale:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/stale@v1
|
||||||
|
with:
|
||||||
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||||
|
stale-issue-label: 'Issue Stale (automatic label)'
|
||||||
|
exempt-issue-label: 'Priority High / Blocking'
|
||||||
|
days-before-stale: 365
|
||||||
|
days-before-close: 10
|
||||||
|
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||||
|
#stale-pr-label: 'PR Stale (automatic label)'
|
||||||
|
#exempt-pr-label: 'Priority Top Strategic'
|
||||||
|
|
||||||
82
.travis.yml
82
.travis.yml
@ -2,8 +2,8 @@
|
|||||||
# from Dolibarr GitHub repository.
|
# from Dolibarr GitHub repository.
|
||||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||||
|
|
||||||
# We use dist: trusty to have php 5.4+ available
|
# We use dist: xenial to have php 5.6+ available
|
||||||
dist: trusty
|
dist: xenial
|
||||||
sudo: required
|
sudo: required
|
||||||
|
|
||||||
language: php
|
language: php
|
||||||
@ -11,14 +11,16 @@ language: php
|
|||||||
# Start on every boot
|
# Start on every boot
|
||||||
services:
|
services:
|
||||||
- memcached
|
- memcached
|
||||||
|
- mysql
|
||||||
|
- postgresql
|
||||||
|
|
||||||
addons:
|
addons:
|
||||||
mariadb: '10.0'
|
# Force postgresql to 9.4 (the oldest availablable on xenial)
|
||||||
postgresql: '9.3'
|
postgresql: '9.4'
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
# To use the last version of pgloader, we add repo of postgresql
|
# To use the last version of pgloader, we add repo of postgresql with a name available in http://apt.postgresql.org/pub/repos/apt/
|
||||||
- pgdg-trusty
|
- pgdg-xenial
|
||||||
packages:
|
packages:
|
||||||
# We need a webserver to test the webservices
|
# We need a webserver to test the webservices
|
||||||
# Let's install Apache with.
|
# Let's install Apache with.
|
||||||
@ -29,7 +31,6 @@ addons:
|
|||||||
- pgloader
|
- pgloader
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- '5.5'
|
|
||||||
- '5.6'
|
- '5.6'
|
||||||
- '7.0'
|
- '7.0'
|
||||||
- '7.1'
|
- '7.1'
|
||||||
@ -44,11 +45,9 @@ env:
|
|||||||
- DEBUG=false
|
- DEBUG=false
|
||||||
matrix:
|
matrix:
|
||||||
# MariaDB overrides MySQL installation so it's not possible to test both yet
|
# MariaDB overrides MySQL installation so it's not possible to test both yet
|
||||||
#- DB=mysql
|
#- DB=mariadb
|
||||||
- DB=mariadb
|
- DB=mysql
|
||||||
- DB=postgresql
|
- DB=postgresql
|
||||||
# TODO
|
|
||||||
#- DB=sqlite
|
|
||||||
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
|
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
|
||||||
#- WS=apache
|
#- WS=apache
|
||||||
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
|
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
|
||||||
@ -60,18 +59,14 @@ matrix:
|
|||||||
- php: nightly
|
- php: nightly
|
||||||
# We exclude some combinations not usefull to save Travis CPU
|
# We exclude some combinations not usefull to save Travis CPU
|
||||||
exclude:
|
exclude:
|
||||||
- php: '5.6'
|
|
||||||
env: DB=mariadb
|
|
||||||
- php: '7.0'
|
- php: '7.0'
|
||||||
env: DB=mariadb
|
env: DB=mysql
|
||||||
- php: '7.1'
|
- php: '7.1'
|
||||||
env: DB=mariadb
|
env: DB=mysql
|
||||||
- php: '7.2'
|
- php: '7.2'
|
||||||
env: DB=mariadb
|
env: DB=mysql
|
||||||
- php: '7.3'
|
- php: '7.3'
|
||||||
env: DB=mariadb
|
env: DB=mysql
|
||||||
- php: '5.6'
|
|
||||||
env: DB=postgresql
|
|
||||||
- php: '7.0'
|
- php: '7.0'
|
||||||
env: DB=postgresql
|
env: DB=postgresql
|
||||||
- php: '7.1'
|
- php: '7.1'
|
||||||
@ -188,32 +183,31 @@ before_script:
|
|||||||
# Check Apache version
|
# Check Apache version
|
||||||
echo "Apache version"
|
echo "Apache version"
|
||||||
apache2 -v | head -
|
apache2 -v | head -
|
||||||
# Check MariaDb
|
# Check Database
|
||||||
echo "MariaDb version"
|
echo "Database version"
|
||||||
mysql --version | head -
|
mysql --version | head -
|
||||||
mysql -e "SELECT VERSION();" | head -
|
mysql -e "SELECT VERSION();" | head -
|
||||||
|
psql --version
|
||||||
echo
|
echo
|
||||||
|
|
||||||
- |
|
- |
|
||||||
echo "Setting up database"
|
echo "Setting up database"
|
||||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
||||||
echo "MySQL"
|
echo "MySQL"
|
||||||
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
mysql -u root -e 'DROP DATABASE IF EXISTS travis;'
|
||||||
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
mysql -u root -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||||
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
mysql -u root -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||||
mysql -e 'FLUSH PRIVILEGES;'
|
mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
mysql -u root -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
fi
|
fi
|
||||||
if [ "$DB" = 'postgresql' ]; then
|
if [ "$DB" = 'postgresql' ]; then
|
||||||
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
#psql -c 'create database travis;' -U postgres
|
||||||
#pgloader mysql://root:pass@127.0.0.1/dolibarr_9 postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dev
|
#psql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||||
echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
#pgloader mysql://root:pass@127.0.0.1/dolibarr_src postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dest
|
||||||
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
echo pgloader mysql://root@127.0.0.1/travis postgresql://postgres@/travis
|
||||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis
|
pgloader mysql://root@127.0.0.1/travis postgresql://postgres@/travis
|
||||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis
|
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql -U postgres travis
|
||||||
#echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis
|
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql -U postgres travis
|
||||||
#echo 'select * from information_schema.table_constraints;' | psql travis
|
|
||||||
#echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis
|
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -262,10 +256,7 @@ before_script:
|
|||||||
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
||||||
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
|
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
|
||||||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||||
# configure apache virtual hosts for precise
|
# configure apache virtual hosts
|
||||||
#- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
|
|
||||||
#- sudo cat /etc/apache2/sites-available/default
|
|
||||||
# configure apache virtual hosts for trusty
|
|
||||||
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
|
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
|
||||||
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
|
||||||
- sudo cat /etc/apache2/sites-available/000-default.conf
|
- sudo cat /etc/apache2/sites-available/000-default.conf
|
||||||
@ -290,7 +281,7 @@ script:
|
|||||||
# Ensure we catch errors
|
# Ensure we catch errors
|
||||||
set -e
|
set -e
|
||||||
#parallel-lint --exclude htdocs/includes --blame .
|
#parallel-lint --exclude htdocs/includes --blame .
|
||||||
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
|
parallel-lint --exclude dev/namespacemig --exclude dev/initdata/dbf/includes --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||||
set +e
|
set +e
|
||||||
echo
|
echo
|
||||||
|
|
||||||
@ -406,9 +397,12 @@ script:
|
|||||||
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
|
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
|
||||||
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
|
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
|
||||||
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
|
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
|
||||||
php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
|
php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade10001100.log
|
||||||
php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
|
php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-2.log
|
||||||
php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
|
php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade10001100-3.log
|
||||||
|
php upgrade.php 11.0.0 12.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade11001200.log
|
||||||
|
php upgrade2.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-2.log
|
||||||
|
php step5.php 11.0.0 12.0.0 > $TRAVIS_BUILD_DIR/upgrade11001200-3.log
|
||||||
# Enable modules not enabled into original dump
|
# Enable modules not enabled into original dump
|
||||||
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log
|
php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log
|
||||||
echo $?
|
echo $?
|
||||||
@ -455,7 +449,7 @@ after_failure:
|
|||||||
# Dolibarr log file
|
# Dolibarr log file
|
||||||
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
||||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||||
# MariaDB log file
|
# Database log file
|
||||||
echo "Debugging informations for file mysql error.log"
|
echo "Debugging informations for file mysql error.log"
|
||||||
sudo tail -n 50 /var/log/mysql/error.log
|
sudo tail -n 50 /var/log/mysql/error.log
|
||||||
# TODO: PostgreSQL log file
|
# TODO: PostgreSQL log file
|
||||||
|
|||||||
19
ChangeLog
19
ChangeLog
@ -3,6 +3,24 @@ English Dolibarr ChangeLog
|
|||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
|
||||||
|
For Users:
|
||||||
|
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||||
|
|
||||||
|
For Developers or integrators:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
WARNING:
|
||||||
|
|
||||||
|
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||||
|
* PHP 5.5 is no more supported. Minimum PHP is now 5.6+.
|
||||||
|
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
|
||||||
|
with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
|
||||||
|
the HTML into content (in such a case, sanitize data later)
|
||||||
|
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
|
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
|
||||||
FIX: advanced target emailing sql and ergonomy.
|
FIX: advanced target emailing sql and ergonomy.
|
||||||
FIX: After import of a website template, home page was not set.
|
FIX: After import of a website template, home page was not set.
|
||||||
@ -75,6 +93,7 @@ FIX: #13094
|
|||||||
FIX: #13096
|
FIX: #13096
|
||||||
FIX: #13100
|
FIX: #13100
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
||||||
For Users:
|
For Users:
|
||||||
|
|
||||||
|
|||||||
@ -151,6 +151,7 @@ La documentation utilisateur, développeur et traducteur est disponible sous for
|
|||||||
## CONTRIBUER
|
## CONTRIBUER
|
||||||
|
|
||||||
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
||||||
|
|
||||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|||||||
@ -170,7 +170,8 @@ Administrator, user, developer and translator's documentations are available alo
|
|||||||
|
|
||||||
## CONTRIBUTING
|
## CONTRIBUTING
|
||||||
|
|
||||||
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
|
||||||
|
|
||||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||||
|
|
||||||
## CREDITS
|
## CREDITS
|
||||||
|
|||||||
@ -3,10 +3,11 @@ FROM php:7.2-apache
|
|||||||
ENV HOST_USER_ID 33
|
ENV HOST_USER_ID 33
|
||||||
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
ENV PHP_INI_DATE_TIMEZONE 'UTC'
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev zlib1g-dev libicu-dev g++\
|
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev libzip-dev zlib1g-dev libicu-dev g++\
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
|
||||||
&& docker-php-ext-install gd \
|
&& docker-php-ext-install gd \
|
||||||
|
&& docker-php-ext-install zip \
|
||||||
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
|
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
|
||||||
&& docker-php-ext-install ldap \
|
&& docker-php-ext-install ldap \
|
||||||
&& docker-php-ext-install mysqli \
|
&& docker-php-ext-install mysqli \
|
||||||
|
|||||||
@ -253,6 +253,24 @@ PARSEDOWN
|
|||||||
$shortage = 4 - $len % 4;
|
$shortage = 4 - $len % 4;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
OAUTH
|
||||||
|
-----
|
||||||
|
Add into Class Google of file OAuth2/Service/Google:
|
||||||
|
|
||||||
|
// LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token"
|
||||||
|
public $approvalPrompt='auto';
|
||||||
|
public function setApprouvalPrompt($prompt)
|
||||||
|
{
|
||||||
|
if (!in_array($prompt, array('auto', 'force'), true)) {
|
||||||
|
// @todo Maybe could we rename this exception
|
||||||
|
throw new InvalidAccessTypeException('Invalid approuvalPrompt, expected either auto or force.');
|
||||||
|
}
|
||||||
|
$this->approvalPrompt = $prompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JEDITABLE.JS
|
JEDITABLE.JS
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|||||||
@ -66,8 +66,9 @@ $obj = new Facture($db);
|
|||||||
|
|
||||||
$obj->ref = 'ABCDE';
|
$obj->ref = 'ABCDE';
|
||||||
$obj->socid = 4; // Put id of third party (rowid in llx_societe table)
|
$obj->socid = 4; // Put id of third party (rowid in llx_societe table)
|
||||||
$obj->date = mktime();
|
$obj->date = dol_now();
|
||||||
$obj->note = 'A comment';
|
$obj->note_public = 'A public comment';
|
||||||
|
$obj->note_private = 'A private comment';
|
||||||
$obj->cond_reglement_id = 1;
|
$obj->cond_reglement_id = 1;
|
||||||
|
|
||||||
$line1=new FactureLigne($db);
|
$line1=new FactureLigne($db);
|
||||||
|
|||||||
@ -66,8 +66,9 @@ $com = new Commande($db);
|
|||||||
|
|
||||||
$com->ref = 'ABCDE';
|
$com->ref = 'ABCDE';
|
||||||
$com->socid = 4; // Put id of third party (rowid in llx_societe table)
|
$com->socid = 4; // Put id of third party (rowid in llx_societe table)
|
||||||
$com->date_commande = mktime();
|
$com->date = dol_now();
|
||||||
$com->note = 'A comment';
|
$com->note_public = 'A public comment';
|
||||||
|
$com->note_private = 'A private comment';
|
||||||
$com->source = 1;
|
$com->source = 1;
|
||||||
$com->remise_percent = 0;
|
$com->remise_percent = 0;
|
||||||
|
|
||||||
|
|||||||
231
dev/initdata/dbf/import-dbf.php
Normal file
231
dev/initdata/dbf/import-dbf.php
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file dev/initdata/import-dbf.php
|
||||||
|
* \brief Script example to create a table from a large DBF file (openoffice)
|
||||||
|
* To purge data, you can have a look at purge-data.php
|
||||||
|
*/
|
||||||
|
// Test si mode batch
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
|
||||||
|
$path = dirname(__FILE__) . '/';
|
||||||
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recupere root dolibarr
|
||||||
|
$path = dirname($_SERVER["PHP_SELF"]);
|
||||||
|
require $path . "./../htdocs/master.inc.php";
|
||||||
|
require $path . "/includes/dbase.class.php";
|
||||||
|
|
||||||
|
// Global variables
|
||||||
|
$version = DOL_VERSION;
|
||||||
|
$confirmed = 1;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main
|
||||||
|
*/
|
||||||
|
|
||||||
|
@set_time_limit(0);
|
||||||
|
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||||
|
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||||
|
|
||||||
|
|
||||||
|
$filepath = $argv[1];
|
||||||
|
$filepatherr = $filepath . '.err';
|
||||||
|
$startchar = empty($argv[2]) ? 0 : (int) $argv[2];
|
||||||
|
$deleteTable = empty($argv[3]) ? 1 : 0;
|
||||||
|
$startlinenb = empty($argv[3]) ? 1 : (int) $argv[3];
|
||||||
|
$endlinenb = empty($argv[4]) ? 0 : (int) $argv[4];
|
||||||
|
|
||||||
|
if (empty($filepath)) {
|
||||||
|
print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n";
|
||||||
|
print "Example: php $script_file myfilepath.dbf 0 2 1002\n";
|
||||||
|
print "\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
if (!file_exists($filepath)) {
|
||||||
|
print "Error: File " . $filepath . " not found.\n";
|
||||||
|
print "\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = $user->fetch('', 'admin');
|
||||||
|
if (!$ret > 0) {
|
||||||
|
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$user->getrights();
|
||||||
|
|
||||||
|
// Ask confirmation
|
||||||
|
if (!$confirmed) {
|
||||||
|
print "Hit Enter to continue or CTRL+C to stop...\n";
|
||||||
|
$input = trim(fgets(STDIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open input and output files
|
||||||
|
$fhandle = dbase_open($filepath, 0);
|
||||||
|
if (!$fhandle) {
|
||||||
|
print 'Error: Failed to open file ' . $filepath . "\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
$fhandleerr = fopen($filepatherr, 'w');
|
||||||
|
if (!$fhandleerr) {
|
||||||
|
print 'Error: Failed to open file ' . $filepatherr . "\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$langs->setDefaultLang($defaultlang);
|
||||||
|
|
||||||
|
$record_numbers = dbase_numrecords($fhandle);
|
||||||
|
$table_name = substr(basename($filepath), 0, strpos(basename($filepath), '.'));
|
||||||
|
print 'Info: ' . $record_numbers . " lines in file \n";
|
||||||
|
$header = dbase_get_header_info($fhandle);
|
||||||
|
if ($deleteTable) {
|
||||||
|
$db->query("DROP TABLE IF EXISTS `$table_name`");
|
||||||
|
}
|
||||||
|
$sqlCreate = "CREATE TABLE IF NOT EXISTS `$table_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT ";
|
||||||
|
$fieldArray = array("`id`");
|
||||||
|
foreach ($header as $value) {
|
||||||
|
$fieldName = substr(str_replace('_', '', $value['name']), $startchar);
|
||||||
|
$fieldArray[] = "`$fieldName`";
|
||||||
|
$sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL ";
|
||||||
|
}
|
||||||
|
$sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB";
|
||||||
|
$resql = $db->query($sqlCreate);
|
||||||
|
if ($resql !== false) {
|
||||||
|
print "Table $table_name created\n";
|
||||||
|
} else {
|
||||||
|
var_dump($db->errno());
|
||||||
|
print "Impossible : " . $sqlCreate . "\n";
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
$nboflines++;
|
||||||
|
|
||||||
|
$fields = implode(',', $fieldArray);
|
||||||
|
//var_dump($fieldArray);die();
|
||||||
|
$maxLength = 0;
|
||||||
|
for ($i = 1; $i <= $record_numbers; $i++) {
|
||||||
|
if ($startlinenb && $i < $startlinenb)
|
||||||
|
continue;
|
||||||
|
if ($endlinenb && $i > $endlinenb)
|
||||||
|
continue;
|
||||||
|
$row = dbase_get_record_with_names($fhandle, $i);
|
||||||
|
if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1'))
|
||||||
|
continue;
|
||||||
|
$sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,";
|
||||||
|
array_shift($row); // remove delete column
|
||||||
|
foreach ($row as $value) {
|
||||||
|
$sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', ";
|
||||||
|
}
|
||||||
|
replaceable_echo(implode("\t", $row));
|
||||||
|
$sqlInsert = rtrim($sqlInsert, ', ');
|
||||||
|
$sqlInsert .= ")";
|
||||||
|
$resql = $db->query($sqlInsert);
|
||||||
|
if ($resql === false) {
|
||||||
|
print "Impossible : " . $sqlInsert . "\n";
|
||||||
|
var_dump($row, $db->errno());
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
// $fields = (object) $row;
|
||||||
|
// var_dump($fields);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
die();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// commit or rollback
|
||||||
|
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||||
|
print "Nb of errors: " . $error . "\n";
|
||||||
|
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
|
||||||
|
print "Rollback any changes.\n";
|
||||||
|
$db->rollback();
|
||||||
|
} else {
|
||||||
|
print "Commit all changes.\n";
|
||||||
|
$db->commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
fclose($fhandle);
|
||||||
|
fclose($fhandleerr);
|
||||||
|
|
||||||
|
exit($error);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* replaceable_echo
|
||||||
|
*
|
||||||
|
* @param string $message Message
|
||||||
|
* @param int $force_clear_lines Force clear messages
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function replaceable_echo($message, $force_clear_lines = null)
|
||||||
|
{
|
||||||
|
static $last_lines = 0;
|
||||||
|
|
||||||
|
if (!is_null($force_clear_lines)) {
|
||||||
|
$last_lines = $force_clear_lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toss = array();
|
||||||
|
$status = 0;
|
||||||
|
$term_width = exec('tput cols', $toss, $status);
|
||||||
|
if ($status) {
|
||||||
|
$term_width = 64; // Arbitrary fall-back term width.
|
||||||
|
}
|
||||||
|
|
||||||
|
$line_count = 0;
|
||||||
|
foreach (explode("\n", $message) as $line) {
|
||||||
|
$line_count += count(str_split($line, $term_width));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Erasure MAGIC: Clear as many lines as the last output had.
|
||||||
|
for ($i = 0; $i < $last_lines; $i++) {
|
||||||
|
// Return to the beginning of the line
|
||||||
|
echo "\r";
|
||||||
|
// Erase to the end of the line
|
||||||
|
echo "\033[K";
|
||||||
|
// Move cursor Up a line
|
||||||
|
echo "\033[1A";
|
||||||
|
// Return to the beginning of the line
|
||||||
|
echo "\r";
|
||||||
|
// Erase to the end of the line
|
||||||
|
echo "\033[K";
|
||||||
|
// Return to the beginning of the line
|
||||||
|
echo "\r";
|
||||||
|
// Can be consolodated into
|
||||||
|
// echo "\r\033[K\033[1A\r\033[K\r";
|
||||||
|
}
|
||||||
|
|
||||||
|
$last_lines = $line_count;
|
||||||
|
|
||||||
|
echo $message . "\n";
|
||||||
|
}
|
||||||
241
dev/initdata/dbf/importdb-products.php
Normal file
241
dev/initdata/dbf/importdb-products.php
Normal file
@ -0,0 +1,241 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file dev/initdata/import-product.php
|
||||||
|
* \brief Script example to insert products from a csv file.
|
||||||
|
* To purge data, you can have a look at purge-data.php
|
||||||
|
*/
|
||||||
|
// Test si mode batch
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path = dirname(__FILE__) . '/';
|
||||||
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recupere root dolibarr
|
||||||
|
$path = preg_replace('/importdb-products.php/i', '', $_SERVER["PHP_SELF"]);
|
||||||
|
require $path . "../../htdocs/master.inc.php";
|
||||||
|
require $path . "includes/dbase.class.php";
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
|
//$delimiter = ',';
|
||||||
|
//$enclosure = '"';
|
||||||
|
//$linelength = 10000;
|
||||||
|
//$escape = '/';
|
||||||
|
// Global variables
|
||||||
|
$version = DOL_VERSION;
|
||||||
|
$confirmed = 1;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$tvas = [
|
||||||
|
'1' => "20.00",
|
||||||
|
'2' => "5.50",
|
||||||
|
'3' => "0.00",
|
||||||
|
'4' => "20.60",
|
||||||
|
'5' => "19.60",
|
||||||
|
];
|
||||||
|
$tvasD = [
|
||||||
|
'1' => "20",
|
||||||
|
'2' => "5.5",
|
||||||
|
'3' => "0",
|
||||||
|
'4' => "20",
|
||||||
|
'5' => "20",
|
||||||
|
];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main
|
||||||
|
*/
|
||||||
|
|
||||||
|
@set_time_limit(0);
|
||||||
|
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||||
|
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||||
|
|
||||||
|
$table = $argv[1];
|
||||||
|
|
||||||
|
if (empty($argv[1])) {
|
||||||
|
print "Error: Which table ?\n";
|
||||||
|
print "\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = $user->fetch('', 'admin');
|
||||||
|
if (!$ret > 0) {
|
||||||
|
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM `$table` WHERE 1";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
while ($fields = $db->fetch_array($resql)) {
|
||||||
|
$errorrecord = 0;
|
||||||
|
if ($fields === false)
|
||||||
|
continue;
|
||||||
|
$nboflines++;
|
||||||
|
|
||||||
|
$produit = new Product($db);
|
||||||
|
$produit->type = 0;
|
||||||
|
$produit->status = 1;
|
||||||
|
$produit->ref = trim($fields['REF']);
|
||||||
|
if ($produit->ref == '')
|
||||||
|
continue;
|
||||||
|
print "Process line nb " . $j . ", ref " . $produit->ref;
|
||||||
|
$produit->label = trim($fields['LIBELLE']);
|
||||||
|
if ($produit->label == '')
|
||||||
|
$produit->label = $produit->ref;
|
||||||
|
if (empty($produit->label))
|
||||||
|
continue;
|
||||||
|
//$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : ''));
|
||||||
|
// $produit->volume = price2num($fields[8]);
|
||||||
|
// $produit->volume_unit = 0;
|
||||||
|
$produit->weight = price2num($fields['MASSE']);
|
||||||
|
$produit->weight_units = 0; // -3 = g
|
||||||
|
//$produit->customcode = $fields[10];
|
||||||
|
$produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT);
|
||||||
|
$produit->barcode_type = '2';
|
||||||
|
$produit->import_key = $fields['CODE'];
|
||||||
|
|
||||||
|
$produit->status = 1;
|
||||||
|
$produit->status_buy = 1;
|
||||||
|
|
||||||
|
$produit->finished = 1;
|
||||||
|
|
||||||
|
// $produit->multiprices[0] = price2num($fields['TARIF0']);
|
||||||
|
// $produit->multiprices[1] = price2num($fields['TARIF1']);
|
||||||
|
// $produit->multiprices[2] = price2num($fields['TARIF2']);
|
||||||
|
// $produit->multiprices[3] = price2num($fields['TARIF3']);
|
||||||
|
// $produit->multiprices[4] = price2num($fields['TARIF4']);
|
||||||
|
// $produit->multiprices[5] = price2num($fields['TARIF5']);
|
||||||
|
// $produit->multiprices[6] = price2num($fields['TARIF6']);
|
||||||
|
// $produit->multiprices[7] = price2num($fields['TARIF7']);
|
||||||
|
// $produit->multiprices[8] = price2num($fields['TARIF8']);
|
||||||
|
// $produit->multiprices[9] = price2num($fields['TARIF9']);
|
||||||
|
// $produit->price_min = null;
|
||||||
|
// $produit->price_min_ttc = null;
|
||||||
|
// $produit->price = price2num($fields[11]);
|
||||||
|
// $produit->price_ttc = price2num($fields[12]);
|
||||||
|
// $produit->price_base_type = 'TTC';
|
||||||
|
// $produit->tva_tx = price2num($fields[13]);
|
||||||
|
$produit->tva_tx = (int) ($tvas[$fields['CODTVA']]);
|
||||||
|
$produit->tva_npr = 0;
|
||||||
|
// $produit->cost_price = price2num($fields[16]);
|
||||||
|
//compta
|
||||||
|
|
||||||
|
$produit->accountancy_code_buy = trim($fields['COMACH']);
|
||||||
|
$produit->accountancy_code_sell = trim($fields['COMVEN']);
|
||||||
|
// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']);
|
||||||
|
// $produit->accountancy_code_sell_export=trim($fields['COMVEN']);
|
||||||
|
// Extrafields
|
||||||
|
// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]);
|
||||||
|
|
||||||
|
$produit->seuil_stock_alerte = $fields['STALERTE'];
|
||||||
|
$ret = $produit->create($user, 0);
|
||||||
|
if ($ret < 0) {
|
||||||
|
print " - Error in create result code = " . $ret . " - " . $produit->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
} else {
|
||||||
|
print " - Creation OK with ref " . $produit->ref . " - id = " . $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog("Add prices");
|
||||||
|
|
||||||
|
// If we use price level, insert price for each level
|
||||||
|
if (!$errorrecord && 1) {
|
||||||
|
//$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
|
||||||
|
$ret1 = false;
|
||||||
|
for ($i = 0; $i < 10; $i++) {
|
||||||
|
if ($fields['TARIF' . ($i)] == 0)
|
||||||
|
continue;
|
||||||
|
$ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0;
|
||||||
|
}
|
||||||
|
if ($ret1) {
|
||||||
|
print " - Error in updatePrice result " . $produit->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
} else {
|
||||||
|
print " - updatePrice OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// dol_syslog("Add multilangs");
|
||||||
|
// Add alternative languages
|
||||||
|
// if (!$errorrecord && 1) {
|
||||||
|
// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private);
|
||||||
|
// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private);
|
||||||
|
//
|
||||||
|
// $ret = $produit->setMultiLangs($user);
|
||||||
|
// if ($ret < 0) {
|
||||||
|
// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString();
|
||||||
|
// $errorrecord++;
|
||||||
|
// } else {
|
||||||
|
// print " - setMultiLangs OK";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
dol_syslog("Add stocks");
|
||||||
|
// stocks
|
||||||
|
if (!$errorrecord && $fields['STOCK'] != 0) {
|
||||||
|
$rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé');
|
||||||
|
if ($rets < 0) {
|
||||||
|
print " - Error in correct_stock result " . $produit->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
} else {
|
||||||
|
print " - correct_stock OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//update date créa
|
||||||
|
if (!$errorrecord) {
|
||||||
|
$date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2);
|
||||||
|
$retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id");
|
||||||
|
if ($retd < 1) {
|
||||||
|
print " - Error in update date créa result " . $produit->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
} else {
|
||||||
|
print " - update date créa OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
if ($errorrecord) {
|
||||||
|
print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n");
|
||||||
|
var_dump($db);
|
||||||
|
die();
|
||||||
|
$error++; // $errorrecord will be reset
|
||||||
|
}
|
||||||
|
$j++;
|
||||||
|
} else
|
||||||
|
die("error : $sql");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// commit or rollback
|
||||||
|
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||||
|
print "Nb of errors: " . $error . "\n";
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
exit($error);
|
||||||
355
dev/initdata/dbf/importdb-thirdparties.php
Normal file
355
dev/initdata/dbf/importdb-thirdparties.php
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file dev/initdata/import-product.php
|
||||||
|
* \brief Script example to insert products from a csv file.
|
||||||
|
* To purge data, you can have a look at purge-data.php
|
||||||
|
*/
|
||||||
|
// Test si mode batch
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path = dirname(__FILE__) . '/';
|
||||||
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recupere root dolibarr
|
||||||
|
$path = preg_replace('/importdb-thirdparties.php/i', '', $_SERVER["PHP_SELF"]);
|
||||||
|
require $path . "../../htdocs/master.inc.php";
|
||||||
|
require $path . "includes/dbase.class.php";
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||||
|
|
||||||
|
//$delimiter = ',';
|
||||||
|
//$enclosure = '"';
|
||||||
|
//$linelength = 10000;
|
||||||
|
//$escape = '/';
|
||||||
|
// Global variables
|
||||||
|
$version = DOL_VERSION;
|
||||||
|
$confirmed = 1;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$civilPrivate = array("MLLE",
|
||||||
|
"MM",
|
||||||
|
"MM/MADAME",
|
||||||
|
"MME",
|
||||||
|
"MME.",
|
||||||
|
"MME²",
|
||||||
|
"MMONSIEUR",
|
||||||
|
"MMR",
|
||||||
|
"MOBNSIEUR",
|
||||||
|
"MOMSIEUR",
|
||||||
|
"MON SIEUR",
|
||||||
|
"MONDIAL",
|
||||||
|
"MONIEUR",
|
||||||
|
"MONJSIEUR",
|
||||||
|
"MONNSIEUR",
|
||||||
|
"MONRIEUR",
|
||||||
|
"MONS",
|
||||||
|
"MONSIEÕR",
|
||||||
|
"MONSIER",
|
||||||
|
"MONSIERU",
|
||||||
|
"MONSIEU",
|
||||||
|
"monsieue",
|
||||||
|
"MONSIEUR",
|
||||||
|
"Monsieur \"",
|
||||||
|
"MONSIEUR \"",
|
||||||
|
"MONSIEUR E",
|
||||||
|
"MONSIEUR DENIS",
|
||||||
|
"MONSIEUR ET MME",
|
||||||
|
"MONSIEUR!",
|
||||||
|
"MONSIEUR.",
|
||||||
|
"MONSIEUR.MADAME",
|
||||||
|
"MONSIEUR3",
|
||||||
|
"MONSIEURN",
|
||||||
|
"MONSIEURT",
|
||||||
|
"MONSIEUR£",
|
||||||
|
"MONSIEYR",
|
||||||
|
"Monsigur",
|
||||||
|
"MONSIIEUR",
|
||||||
|
"MONSIUER",
|
||||||
|
"MONSIZEUR",
|
||||||
|
"MOPNSIEUR",
|
||||||
|
"MOSIEUR",
|
||||||
|
"MR",
|
||||||
|
"Mr Mme",
|
||||||
|
"Mr - MME",
|
||||||
|
"MR BLANC",
|
||||||
|
"MR ET MME",
|
||||||
|
"mr mm",
|
||||||
|
"MR OU MME",
|
||||||
|
"Mr.",
|
||||||
|
"MR/MME",
|
||||||
|
"MRME",
|
||||||
|
"MRR",
|
||||||
|
"Mrs",
|
||||||
|
"Mademoiselle",
|
||||||
|
"MADAOME",
|
||||||
|
"madamme",
|
||||||
|
"MADAME",
|
||||||
|
"M0NSIEUR",
|
||||||
|
"M.et Madame",
|
||||||
|
"M. ET MR",
|
||||||
|
"M.",
|
||||||
|
"M%",
|
||||||
|
"M MME",
|
||||||
|
"M ET MME",
|
||||||
|
"M",
|
||||||
|
"M CROCE",
|
||||||
|
"M DIEVART",
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main
|
||||||
|
*/
|
||||||
|
|
||||||
|
@set_time_limit(0);
|
||||||
|
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||||
|
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||||
|
|
||||||
|
$table = $argv[1];
|
||||||
|
|
||||||
|
if (empty($argv[1])) {
|
||||||
|
print "Error: Quelle table ?\n";
|
||||||
|
print "\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ret = $user->fetch('', 'admin');
|
||||||
|
if (!$ret > 0) {
|
||||||
|
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
//$db->begin();
|
||||||
|
if ($resql)
|
||||||
|
while ($fields = $db->fetch_array($resql)) {
|
||||||
|
$i++;
|
||||||
|
$errorrecord = 0;
|
||||||
|
|
||||||
|
if ($startlinenb && $i < $startlinenb)
|
||||||
|
continue;
|
||||||
|
if ($endlinenb && $i > $endlinenb)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$nboflines++;
|
||||||
|
|
||||||
|
$object = new Societe($db);
|
||||||
|
$object->import_key = $fields['CODE'];
|
||||||
|
$object->state = 1;
|
||||||
|
$object->client = 3;
|
||||||
|
$object->fournisseur = 0;
|
||||||
|
|
||||||
|
$object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM'];
|
||||||
|
//$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
|
||||||
|
|
||||||
|
$date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101');
|
||||||
|
$object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT);
|
||||||
|
|
||||||
|
|
||||||
|
$object->address = trim($fields['FADR1']);
|
||||||
|
if ($fields['FADR2'])
|
||||||
|
$object->address .= "\n" . trim($fields['FADR2']);
|
||||||
|
if ($fields['FADR3'])
|
||||||
|
$object->address .= "\n" . trim($fields['FADR3']);
|
||||||
|
|
||||||
|
$object->zip = trim($fields['FPOSTE']);
|
||||||
|
$object->town = trim($fields['FVILLE']);
|
||||||
|
if ($fields['FPAYS'])
|
||||||
|
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
|
||||||
|
else
|
||||||
|
$object->country_id = 1;
|
||||||
|
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
|
||||||
|
$object->phone = substr($object->phone, 0, 20);
|
||||||
|
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
|
||||||
|
$object->fax = substr($object->fax, 0, 20);
|
||||||
|
$object->email = trim($fields['FMAIL']);
|
||||||
|
// $object->idprof2 = trim($fields[29]);
|
||||||
|
$object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']);
|
||||||
|
$object->tva_intra = substr($object->tva_intra, 0, 20);
|
||||||
|
$object->default_lang = 'fr_FR';
|
||||||
|
|
||||||
|
$object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1);
|
||||||
|
$object->multicurrency_code = 'EUR';
|
||||||
|
|
||||||
|
if ($fields['REMISE'] != '0.00') {
|
||||||
|
$object->remise_percent = abs($fields['REMISE']);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $object->code_client = $fields[9];
|
||||||
|
// $object->code_fournisseur = $fields[10];
|
||||||
|
|
||||||
|
|
||||||
|
if ($fields['FCIVIL']) {
|
||||||
|
$labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL';
|
||||||
|
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set price level
|
||||||
|
$object->price_level = $fields['TARIF'] + 1;
|
||||||
|
// if ($labeltype == 'Revendeur')
|
||||||
|
// $object->price_level = 2;
|
||||||
|
|
||||||
|
print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name;
|
||||||
|
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$object->array_options['options_banque'] = $fields['BANQUE'];
|
||||||
|
$object->array_options['options_banque2'] = $fields['BANQUE2'];
|
||||||
|
$object->array_options['options_banquevalid'] = $fields['VALID'];
|
||||||
|
|
||||||
|
if (!$errorrecord) {
|
||||||
|
$ret = $object->create($user);
|
||||||
|
if ($ret < 0) {
|
||||||
|
print " - Error in create result code = " . $ret . " - " . $object->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
var_dump($object->code_client, $db);
|
||||||
|
die();
|
||||||
|
} else {
|
||||||
|
print " - Creation OK with name " . $object->name . " - id = " . $ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$errorrecord) {
|
||||||
|
dol_syslog("Set price level");
|
||||||
|
$object->set_price_level($object->price_level, $user);
|
||||||
|
}
|
||||||
|
if (!$errorrecord && @$object->remise_percent) {
|
||||||
|
dol_syslog("Set remise client");
|
||||||
|
$object->set_remise_client($object->remise_percent, 'Importé', $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
dol_syslog("Add contact");
|
||||||
|
// Insert an invoice contact if there is an invoice email != standard email
|
||||||
|
if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) {
|
||||||
|
$madame = array("MADAME",
|
||||||
|
"MADEMOISELLE",
|
||||||
|
"MELLE",
|
||||||
|
"MLLE",
|
||||||
|
"MM",
|
||||||
|
"Mme",
|
||||||
|
"MNE",
|
||||||
|
);
|
||||||
|
$monsieur = array("M",
|
||||||
|
"M ET MME",
|
||||||
|
"M MME",
|
||||||
|
"M.",
|
||||||
|
"M. MME",
|
||||||
|
"M. OU Mme",
|
||||||
|
"M.ou Madame",
|
||||||
|
"MONSEUR",
|
||||||
|
"MONSIER",
|
||||||
|
"MONSIEU",
|
||||||
|
"MONSIEUR",
|
||||||
|
"monsieur:mme",
|
||||||
|
"MONSIEUR¨",
|
||||||
|
"MONSIEZUR",
|
||||||
|
"MONSIUER",
|
||||||
|
"MONSKIEUR",
|
||||||
|
"MR",
|
||||||
|
);
|
||||||
|
$ret1 = $ret2 = 0;
|
||||||
|
|
||||||
|
$contact = new Contact($db);
|
||||||
|
if (in_array($fields['LCIVIL'], $madame)) {
|
||||||
|
// une dame
|
||||||
|
$contact->civility_id = 'MME';
|
||||||
|
$contact->lastname = $fields['LNOM'];
|
||||||
|
} elseif (in_array($fields['LCIVIL'], $monsieur)) {
|
||||||
|
// un monsieur
|
||||||
|
$contact->civility_id = 'MR';
|
||||||
|
$contact->lastname = $fields['LNOM'];
|
||||||
|
} elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) {
|
||||||
|
// un monsieur
|
||||||
|
$contact->civility_id = 'DR';
|
||||||
|
$contact->lastname = $fields['LNOM'];
|
||||||
|
} else {
|
||||||
|
// un a rattraper
|
||||||
|
$contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM'];
|
||||||
|
}
|
||||||
|
$contact->address = trim($fields['LADR1']);
|
||||||
|
if ($fields['LADR2'])
|
||||||
|
$contact->address .= "\n" . trim($fields['LADR2']);
|
||||||
|
if ($fields['LADR3'])
|
||||||
|
$contact->address .= "\n" . trim($fields['LADR3']);
|
||||||
|
|
||||||
|
$contact->zip = trim($fields['LPOSTE']);
|
||||||
|
$contact->town = trim($fields['LVILLE']);
|
||||||
|
if ($fields['FPAYS'])
|
||||||
|
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
|
||||||
|
else
|
||||||
|
$contact->country_id = 1;
|
||||||
|
$contact->email = $fields['LMAIL'];
|
||||||
|
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
|
||||||
|
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
|
||||||
|
$contact->socid = $object->id;
|
||||||
|
|
||||||
|
$ret1 = $contact->create($user);
|
||||||
|
if ($ret1 > 0) {
|
||||||
|
//$ret2=$contact->add_contact($object->id, 'BILLING');
|
||||||
|
}
|
||||||
|
if ($ret1 < 0 || $ret2 < 0) {
|
||||||
|
print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
} else {
|
||||||
|
print " - create contact OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//update date créa
|
||||||
|
if (!$errorrecord) {
|
||||||
|
$datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2);
|
||||||
|
$retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id");
|
||||||
|
if ($retd < 1) {
|
||||||
|
print " - Error in update date créa result " . $object->errorsToString();
|
||||||
|
$errorrecord++;
|
||||||
|
} else {
|
||||||
|
print " - update date créa OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
if ($errorrecord) {
|
||||||
|
print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n");
|
||||||
|
var_dump($db, $object, $contact);
|
||||||
|
// $db->rollback();
|
||||||
|
die();
|
||||||
|
$error++; // $errorrecord will be reset
|
||||||
|
}
|
||||||
|
$j++;
|
||||||
|
} else
|
||||||
|
die("error : $sql");
|
||||||
|
|
||||||
|
$db->commit();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// commit or rollback
|
||||||
|
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||||
|
print "Nb of errors: " . $error . "\n";
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
exit($error);
|
||||||
402
dev/initdata/dbf/includes/dbase.class.php
Normal file
402
dev/initdata/dbf/includes/dbase.class.php
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* \file dev/initdata/dbf/includes/dbase.class.php
|
||||||
|
* \ingroup dev
|
||||||
|
* \brief Class to manage DBF databases
|
||||||
|
*/
|
||||||
|
|
||||||
|
// source : https://github.com/donfbecker/php-dbase
|
||||||
|
|
||||||
|
define('DBASE_RDONLY', 0);
|
||||||
|
define('DBASE_WRONLY', 1);
|
||||||
|
define('DBASE_RDWR', 2);
|
||||||
|
define('DBASE_TYPE_DBASE', 0);
|
||||||
|
define('DBASE_TYPE_FOXPRO', 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for DBase
|
||||||
|
*/
|
||||||
|
class DBase
|
||||||
|
{
|
||||||
|
private $fd;
|
||||||
|
private $headerLength = 0;
|
||||||
|
private $fields = array();
|
||||||
|
private $fieldCount = 0;
|
||||||
|
private $recordLength = 0;
|
||||||
|
private $recordCount = 0;
|
||||||
|
|
||||||
|
//resource dbase_open ( string $filename , int $mode )
|
||||||
|
public static function open($filename, $mode)
|
||||||
|
{
|
||||||
|
if (!file_exists($filename))
|
||||||
|
return false;
|
||||||
|
$modes = array('r', 'w', 'r+');
|
||||||
|
$mode = $modes[$mode];
|
||||||
|
$fd = fopen($filename, $mode);
|
||||||
|
if (!$fd)
|
||||||
|
return false;
|
||||||
|
return new DBase($fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
//resource dbase_create ( string $filename , array $fields [, int $type = DBASE_TYPE_DBASE ] )
|
||||||
|
public static function create($filename, $fields, $type = DBASE_TYPE_DBASE)
|
||||||
|
{
|
||||||
|
if (file_exists($filename))
|
||||||
|
return false;
|
||||||
|
$fd = fopen($filename, 'c+');
|
||||||
|
if (!$fd)
|
||||||
|
return false;
|
||||||
|
// Byte 0 (1 byte): Valid dBASE for DOS file; bits 0-2 indicate version number, bit 3
|
||||||
|
// indicates the presence of a dBASE for DOS memo file, bits 4-6 indicate the
|
||||||
|
// presence of a SQL table, bit 7 indicates the presence of any memo file
|
||||||
|
// (either dBASE m PLUS or dBASE for DOS)
|
||||||
|
self::putChar8($fd, 5);
|
||||||
|
// Byte 1-3 (3 bytes): Date of last update; formatted as YYMMDD
|
||||||
|
self::putChar8($fd, date('Y') - 1900);
|
||||||
|
self::putChar8($fd, date('m'));
|
||||||
|
self::putChar8($fd, date('d'));
|
||||||
|
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
|
||||||
|
self::putInt32($fd, 0);
|
||||||
|
// Byte 8-9 (16-bit number): Number of bytes in the header.
|
||||||
|
self::putInt16($fd, 32 + (32 * count($fields)) + 1);
|
||||||
|
// Byte 10-11 (16-bit number): Number of bytes in record.
|
||||||
|
// Make sure the include the byte for deleted flag
|
||||||
|
$len = 1;
|
||||||
|
foreach ($fields as &$field)
|
||||||
|
$len += self::length($field);
|
||||||
|
self::putInt16($fd, $len);
|
||||||
|
// Byte 12-13 (2 bytes): Reserved, 0 filled.
|
||||||
|
self::putInt16($fd, 0);
|
||||||
|
// Byte 14 (1 byte): Flag indicating incomplete transaction
|
||||||
|
// The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
|
||||||
|
self::putChar8($fd, 0);
|
||||||
|
// Byte 15 (1 byte): Encryption flag. If this flag is set to 1, the message Database encrypted appears. Changing this flag to 0 removes the message, but does not decrypt the file.
|
||||||
|
self::putChar8($fd, 0);
|
||||||
|
// Byte 16-27 (12 bytes): Reserved for dBASE for DOS in a multi-user environment
|
||||||
|
self::putInt32($fd, 0);
|
||||||
|
self::putInt32($fd, 0);
|
||||||
|
self::putInt32($fd, 0);
|
||||||
|
// Byte 28 (1 byte): Production .mdx file flag; 0x01 if there is a production .mdx file, 0x00 if not
|
||||||
|
self::putChar8($fd, 0);
|
||||||
|
// Byte 29 (1 byte): Language driver ID
|
||||||
|
// (no clue what this is)
|
||||||
|
self::putChar8($fd, 0);
|
||||||
|
// Byte 30-31 (2 bytes): Reserved, 0 filled.
|
||||||
|
self::putInt16($fd, 0);
|
||||||
|
// Byte 32 - n (32 bytes each): Field descriptor array
|
||||||
|
foreach ($fields as &$field) {
|
||||||
|
self::putString($fd, $field[0], 11); // Byte 0 - 10 (11 bytes): Field name in ASCII (zero-filled)
|
||||||
|
self::putString($fd, $field[1], 1); // Byte 11 (1 byte): Field type in ASCII (C, D, F, L, M, or N)
|
||||||
|
self::putInt32($fd, 0); // Byte 12 - 15 (4 bytes): Reserved
|
||||||
|
self::putChar8($fd, self::length($field)); // Byte 16 (1 byte): Field length in binary. The maximum length of a field is 254 (0xFE).
|
||||||
|
self::putChar8($fd, $field[3]); // Byte 17 (1 byte): Field decimal count in binary
|
||||||
|
self::putInt16($fd, 0); // Byte 18 - 19 (2 bytes): Work area ID
|
||||||
|
self::putChar8($fd, 0); // Byte 20 (1 byte): Example (??)
|
||||||
|
self::putInt32($fd, 0); // Byte 21 - 30 (10 bytes): Reserved
|
||||||
|
self::putInt32($fd, 0);
|
||||||
|
self::putInt16($fd, 0);
|
||||||
|
self::putChar8($fd, 0); // Byte 31 (1 byte): Production MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not
|
||||||
|
}
|
||||||
|
// Byte n + 1 (1 byte): 0x0D as the field descriptor array terminator
|
||||||
|
self::putChar8($fd, 0x0D);
|
||||||
|
return new DBase($fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create DBase instance
|
||||||
|
private function __construct($fd)
|
||||||
|
{
|
||||||
|
$this->fd = $fd;
|
||||||
|
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
|
||||||
|
fseek($this->fd, 4, SEEK_SET);
|
||||||
|
$this->recordCount = self::getInt32($fd);
|
||||||
|
// Byte 8-9 (16-bit number): Number of bytes in the header.
|
||||||
|
fseek($this->fd, 8, SEEK_SET);
|
||||||
|
$this->headerLength = self::getInt16($fd);
|
||||||
|
// Number of fields is (headerLength - 33) / 32)
|
||||||
|
$this->fieldCount = ($this->headerLength - 33) / 32;
|
||||||
|
// Byte 10-11 (16-bit number): Number of bytes in record.
|
||||||
|
fseek($this->fd, 10, SEEK_SET);
|
||||||
|
$this->recordLength = self::getInt16($fd);
|
||||||
|
// Byte 32 - n (32 bytes each): Field descriptor array
|
||||||
|
fseek($fd, 32, SEEK_SET);
|
||||||
|
for ($i = 0; $i < $this->fieldCount; $i++) {
|
||||||
|
$data = fread($this->fd, 32);
|
||||||
|
$field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data));
|
||||||
|
$this->fields[] = $field;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool dbase_close ( resource $dbase_identifier )
|
||||||
|
public function close()
|
||||||
|
{
|
||||||
|
fclose($this->fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
//array dbase_get_header_info ( resource $dbase_identifier )
|
||||||
|
public function get_header_info()
|
||||||
|
{
|
||||||
|
return $this->fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
//int dbase_numfields ( resource $dbase_identifier )
|
||||||
|
public function numfields()
|
||||||
|
{
|
||||||
|
return $this->fieldCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//int dbase_numrecords ( resource $dbase_identifier )
|
||||||
|
public function numrecords()
|
||||||
|
{
|
||||||
|
return $this->recordCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool dbase_add_record ( resource $dbase_identifier , array $record )
|
||||||
|
public function add_record($record)
|
||||||
|
{
|
||||||
|
if (count($record) != $this->fieldCount)
|
||||||
|
return false;
|
||||||
|
// Seek to end of file, minus the end of file marker
|
||||||
|
fseek($this->fd, 0, SEEK_END);
|
||||||
|
// Put the deleted flag
|
||||||
|
self::putChar8($this->fd, 0x20);
|
||||||
|
// Put the record
|
||||||
|
if (!$this->putRecord($record))
|
||||||
|
return false;
|
||||||
|
// Update the record count
|
||||||
|
fseek($this->fd, 4);
|
||||||
|
self::putInt32($this->fd, ++$this->recordCount);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number )
|
||||||
|
public function replace_record($record, $record_number)
|
||||||
|
{
|
||||||
|
if (count($record) != $this->fieldCount)
|
||||||
|
return false;
|
||||||
|
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||||
|
return false;
|
||||||
|
// Skip to the record location, plus the 1 byte for the deleted flag
|
||||||
|
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1);
|
||||||
|
return $this->putRecord($record);
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool dbase_delete_record ( resource $dbase_identifier , int $record_number )
|
||||||
|
public function delete_record($record_number)
|
||||||
|
{
|
||||||
|
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||||
|
return false;
|
||||||
|
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
|
||||||
|
self::putChar8($this->fd, 0x2A);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//array dbase_get_record ( resource $dbase_identifier , int $record_number )
|
||||||
|
public function get_record($record_number)
|
||||||
|
{
|
||||||
|
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||||
|
return false;
|
||||||
|
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
|
||||||
|
$record = array(
|
||||||
|
'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0
|
||||||
|
);
|
||||||
|
foreach ($this->fields as $i => &$field) {
|
||||||
|
$value = trim(fread($this->fd, $field['length']));
|
||||||
|
if ($field['type'] == 'L') {
|
||||||
|
$value = strtolower($value);
|
||||||
|
if ($value == 't' || $value == 'y')
|
||||||
|
$value = true;
|
||||||
|
elseif ($value == 'f' || $value == 'n')
|
||||||
|
$value = false;
|
||||||
|
else
|
||||||
|
$value = null;
|
||||||
|
}
|
||||||
|
$record[$i] = $value;
|
||||||
|
}
|
||||||
|
return $record;
|
||||||
|
}
|
||||||
|
|
||||||
|
//array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number )
|
||||||
|
public function get_record_with_names($record_number)
|
||||||
|
{
|
||||||
|
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||||
|
return false;
|
||||||
|
$record = $this->get_record($record_number);
|
||||||
|
foreach ($this->fields as $i => &$field) {
|
||||||
|
$record[$field['name']] = $record[$i];
|
||||||
|
unset($record[$i]);
|
||||||
|
}
|
||||||
|
return $record;
|
||||||
|
}
|
||||||
|
|
||||||
|
//bool dbase_pack ( resource $dbase_identifier )
|
||||||
|
public function pack()
|
||||||
|
{
|
||||||
|
$in_offset = $out_offset = $this->headerLength;
|
||||||
|
$new_count = 0;
|
||||||
|
$rec_count = $this->recordCount;
|
||||||
|
while ($rec_count > 0) {
|
||||||
|
fseek($this->fd, $in_offset, SEEK_SET);
|
||||||
|
$record = fread($this->fd, $this->recordLength);
|
||||||
|
$deleted = substr($record, 0, 1);
|
||||||
|
if ($deleted != '*') {
|
||||||
|
fseek($this->fd, $out_offset, SEEK_SET);
|
||||||
|
fwrite($this->fd, $record);
|
||||||
|
$out_offset += $this->recordLength;
|
||||||
|
$new_count++;
|
||||||
|
}
|
||||||
|
$in_offset += $this->recordLength;
|
||||||
|
$rec_count--;
|
||||||
|
}
|
||||||
|
ftruncate($this->fd, $out_offset);
|
||||||
|
// Update the record count
|
||||||
|
fseek($this->fd, 4);
|
||||||
|
self::putInt32($this->fd, $new_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A few utilitiy functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static function length($field)
|
||||||
|
{
|
||||||
|
switch ($field[1]) {
|
||||||
|
case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
|
||||||
|
return 8;
|
||||||
|
case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro)
|
||||||
|
return 18;
|
||||||
|
case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
|
||||||
|
case 'N': // Number: -.0123456789 (right justified, padded with whitespaces)
|
||||||
|
case 'F': // Float: -.0123456789 (right justified, padded with whitespaces)
|
||||||
|
case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length)
|
||||||
|
return $field[2];
|
||||||
|
case 'L': // Boolean: YyNnTtFf? (? when not initialized)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Functions for reading and writing bytes
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static function getChar8($fd)
|
||||||
|
{
|
||||||
|
return ord(fread($fd, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function putChar8($fd, $value)
|
||||||
|
{
|
||||||
|
return fwrite($fd, chr($value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getInt16($fd, $n = 1)
|
||||||
|
{
|
||||||
|
$data = fread($fd, 2 * $n);
|
||||||
|
$i = unpack("S$n", $data);
|
||||||
|
if ($n == 1)
|
||||||
|
return (int) $i[1];
|
||||||
|
else
|
||||||
|
return array_merge($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function putInt16($fd, $value)
|
||||||
|
{
|
||||||
|
return fwrite($fd, pack('S', $value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getInt32($fd, $n = 1)
|
||||||
|
{
|
||||||
|
$data = fread($fd, 4 * $n);
|
||||||
|
$i = unpack("L$n", $data);
|
||||||
|
if ($n == 1)
|
||||||
|
return (int) $i[1];
|
||||||
|
else
|
||||||
|
return array_merge($i);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function putInt32($fd, $value)
|
||||||
|
{
|
||||||
|
return fwrite($fd, pack('L', $value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function putString($fd, $value, $length = 254)
|
||||||
|
{
|
||||||
|
$ret = fwrite($fd, pack('A' . $length, $value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function putRecord($record)
|
||||||
|
{
|
||||||
|
foreach ($this->fields as $i => &$field) {
|
||||||
|
$value = $record[$i];
|
||||||
|
// Number types are right aligned with spaces
|
||||||
|
if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) {
|
||||||
|
$value = str_repeat(' ', $field['length'] - strlen($value)) . $value;
|
||||||
|
}
|
||||||
|
self::putString($this->fd, $value, $field['length']);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('dbase_open')) {
|
||||||
|
|
||||||
|
function dbase_open($filename, $mode)
|
||||||
|
{
|
||||||
|
return DBase::open($filename, $mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE)
|
||||||
|
{
|
||||||
|
return DBase::create($filename, $fields, $type);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_close($dbase_identifier)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_get_header_info($dbase_identifier)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->get_header_info();
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_numfields($dbase_identifier)
|
||||||
|
{
|
||||||
|
$dbase_identifier->numfields();
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_numrecords($dbase_identifier)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->numrecords();
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_add_record($dbase_identifier, $record)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->add_record($record);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_delete_record($dbase_identifier, $record_number)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->delete_record($record_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_replace_record($dbase_identifier, $record, $record_number)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->replace_record($record, $record_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_get_record($dbase_identifier, $record_number)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->get_record($record_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_get_record_with_names($dbase_identifier, $record_number)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->get_record_with_names($record_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dbase_pack($dbase_identifier)
|
||||||
|
{
|
||||||
|
return $dbase_identifier->pack();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -23,10 +23,14 @@
|
|||||||
* \brief Script example to inject random customer invoices (for load tests)
|
* \brief Script example to inject random customer invoices (for load tests)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path=dirname(__FILE__).'/';
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,10 +24,14 @@
|
|||||||
* \brief Script example to inject random orders (for load tests)
|
* \brief Script example to inject random orders (for load tests)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path=dirname(__FILE__).'/';
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,10 +24,14 @@
|
|||||||
* \brief Script example to inject random products (for load tests)
|
* \brief Script example to inject random products (for load tests)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path=dirname(__FILE__).'/';
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,10 +24,14 @@
|
|||||||
* \brief Script example to inject random proposals (for load tests)
|
* \brief Script example to inject random proposals (for load tests)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path=dirname(__FILE__).'/';
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,10 +24,14 @@
|
|||||||
* \brief Script example to inject random thirdparties (for load tests)
|
* \brief Script example to inject random thirdparties (for load tests)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path=dirname(__FILE__).'/';
|
||||||
|
|
||||||
// Test si mode batch
|
// Test si mode batch
|
||||||
$sapi_type = php_sapi_name();
|
$sapi_type = php_sapi_name();
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
|||||||
$script_file = basename(__FILE__);
|
$script_file = basename(__FILE__);
|
||||||
$path=dirname(__FILE__).'/';
|
$path=dirname(__FILE__).'/';
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
|||||||
$script_file = basename(__FILE__);
|
$script_file = basename(__FILE__);
|
||||||
$path=dirname(__FILE__).'/';
|
$path=dirname(__FILE__).'/';
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file dev/initdata/import-thirdparties.php
|
* \file dev/initdata/import-users.php
|
||||||
* \brief Script example to insert thirdparties from a csv file.
|
* \brief Script example to insert thirdparties from a csv file.
|
||||||
* To purge data, you can have a look at purge-data.php
|
* To purge data, you can have a look at purge-data.php
|
||||||
*/
|
*/
|
||||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
|||||||
$script_file = basename(__FILE__);
|
$script_file = basename(__FILE__);
|
||||||
$path=dirname(__FILE__).'/';
|
$path=dirname(__FILE__).'/';
|
||||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n";
|
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!ELEMENT ruleset (description,exclude-pattern*,rule+)>
|
<!ELEMENT ruleset (description,arg*,exclude-pattern*,rule+)>
|
||||||
<!ATTLIST ruleset name CDATA "">
|
<!ATTLIST ruleset name CDATA "">
|
||||||
<!ELEMENT description (#PCDATA)>
|
<!ELEMENT description (#PCDATA)>
|
||||||
|
<!ELEMENT arg (#PCDATA)>
|
||||||
|
<!ATTLIST arg name CDATA "">
|
||||||
|
<!ATTLIST arg value CDATA "">
|
||||||
<!ELEMENT exclude-pattern (#PCDATA)>
|
<!ELEMENT exclude-pattern (#PCDATA)>
|
||||||
<!ATTLIST exclude-pattern type CDATA "">
|
<!ATTLIST exclude-pattern type CDATA "">
|
||||||
<!ELEMENT rule (properties*,severity*)>
|
<!ELEMENT rule (properties*,severity*,exclude*)>
|
||||||
<!ATTLIST rule ref CDATA "">
|
<!ATTLIST rule ref CDATA "">
|
||||||
<!ELEMENT properties (property+)>
|
<!ELEMENT properties (property+)>
|
||||||
<!ELEMENT property (#PCDATA)>
|
<!ELEMENT property (#PCDATA)>
|
||||||
<!ATTLIST property name CDATA "">
|
<!ATTLIST property name CDATA "">
|
||||||
<!ATTLIST property value CDATA "">
|
<!ATTLIST property value CDATA "">
|
||||||
<!ELEMENT severity (#PCDATA)>
|
<!ELEMENT severity (#PCDATA)>
|
||||||
|
<!ELEMENT exclude (#PCDATA)>
|
||||||
|
<!ATTLIST exclude name CDATA "">
|
||||||
|
|||||||
@ -2,10 +2,12 @@
|
|||||||
<!DOCTYPE ruleset SYSTEM "ruleset.dtd">
|
<!DOCTYPE ruleset SYSTEM "ruleset.dtd">
|
||||||
<ruleset name="Dolibarr">
|
<ruleset name="Dolibarr">
|
||||||
<description>Dolibarr coding standard.</description>
|
<description>Dolibarr coding standard.</description>
|
||||||
|
<arg name="tab-width" value="4"/>
|
||||||
|
|
||||||
<exclude-pattern type="relative">build/html</exclude-pattern>
|
<exclude-pattern type="relative">build/html</exclude-pattern>
|
||||||
<exclude-pattern type="relative">build/aps</exclude-pattern>
|
<exclude-pattern type="relative">build/aps</exclude-pattern>
|
||||||
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern>
|
<exclude-pattern type="relative">dev/namespacemig</exclude-pattern>
|
||||||
|
<exclude-pattern type="relative">dev/initdata/dbf/includes</exclude-pattern>
|
||||||
<exclude-pattern type="relative">documents</exclude-pattern>
|
<exclude-pattern type="relative">documents</exclude-pattern>
|
||||||
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
|
<exclude-pattern type="relative">htdocs/core/class/lessc.class.php</exclude-pattern>
|
||||||
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
|
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
|
||||||
@ -187,7 +189,6 @@
|
|||||||
<!-- Disabled as this does not support tab -->
|
<!-- Disabled as this does not support tab -->
|
||||||
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
|
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
|
||||||
|
|
||||||
<arg name="tab-width" value="4"/>
|
|
||||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="indent" value="4"/>
|
<property name="indent" value="4"/>
|
||||||
|
|||||||
578
dev/tools/dolibarr-postgres2mysql.php
Normal file
578
dev/tools/dolibarr-postgres2mysql.php
Normal file
@ -0,0 +1,578 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2011 James Grant <james@lightbox.org> Lightbox Technologies Inc.
|
||||||
|
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* This file is base on pg2mysql provided as Open source by lightbox.org.
|
||||||
|
* It was enhanced and updated by the Dolibarr team.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file dev/tools/dolibarr-postgres2mysql.php
|
||||||
|
* \brief Script to migrate a postgresql dump into a mysql dump
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path = dirname(__FILE__) . '/';
|
||||||
|
|
||||||
|
// Test si mode batch
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
|
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||||
|
define('PRODUCT', "pg2mysql");
|
||||||
|
define('VERSION', "2.0");
|
||||||
|
|
||||||
|
// this is the default, it can be overridden here, or specified as the third parameter on the command line
|
||||||
|
$config['engine'] = "InnoDB";
|
||||||
|
|
||||||
|
if (! ($argv[1] && $argv[2])) {
|
||||||
|
echo "Usage: php pg2mysql_cli.php <inputfilename> <outputfilename> [engine]\n";
|
||||||
|
exit();
|
||||||
|
} else {
|
||||||
|
if (isset($argv[3]))
|
||||||
|
$config['engine'] = $argv[3];
|
||||||
|
pg2mysql_large($argv[1], $argv[2]);
|
||||||
|
|
||||||
|
echo <<<XHTML
|
||||||
|
Notes:
|
||||||
|
- No its not perfect
|
||||||
|
- Yes it discards ALL stored procedures
|
||||||
|
- Yes it discards ALL queries except for CREATE TABLE and INSERT INTO
|
||||||
|
- If you're having problems creating your postgres dump, make sure you use "--format p --inserts"
|
||||||
|
- Default output engine if not specified is InnoDB
|
||||||
|
|
||||||
|
XHTML;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getfieldname
|
||||||
|
*
|
||||||
|
* @param string $l String
|
||||||
|
* @return string|null Field name
|
||||||
|
*/
|
||||||
|
function getfieldname($l)
|
||||||
|
{
|
||||||
|
// first check if its in nice quotes for us
|
||||||
|
$regs = array();
|
||||||
|
if (preg_match("/`(.*)`/", $l, $regs)) {
|
||||||
|
if ($regs[1])
|
||||||
|
return $regs[1];
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
} // if its not in quotes, then it should (we hope!) be the first "word" on the line, up to the first space.
|
||||||
|
elseif (preg_match("/([^\ ]*)/", trim($l), $regs)) {
|
||||||
|
if ($regs[1])
|
||||||
|
return $regs[1];
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* formatsize
|
||||||
|
*
|
||||||
|
* @param string $s Size to format
|
||||||
|
* @return string Formated size
|
||||||
|
*/
|
||||||
|
function formatsize($s)
|
||||||
|
{
|
||||||
|
if ($s < pow(2, 14))
|
||||||
|
return "{$s}B";
|
||||||
|
elseif ($s < pow(2, 20))
|
||||||
|
return sprintf("%.1f", round($s / 1024, 1)) . "K";
|
||||||
|
elseif ($s < pow(2, 30))
|
||||||
|
return sprintf("%.1f", round($s / 1024 / 1024, 1)) . "M";
|
||||||
|
else
|
||||||
|
return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pg2mysql_large
|
||||||
|
*
|
||||||
|
* @param string $infilename Input filename
|
||||||
|
* @param string $outfilename Output filename
|
||||||
|
* @return int <0 if KO, >=0 if OK
|
||||||
|
*/
|
||||||
|
function pg2mysql_large($infilename, $outfilename)
|
||||||
|
{
|
||||||
|
$infp = fopen($infilename, "rt");
|
||||||
|
$outfp = fopen($outfilename, "wt");
|
||||||
|
|
||||||
|
$outputatend = '';
|
||||||
|
$arrayofprimaryalreadyintabledef = array();
|
||||||
|
|
||||||
|
// we read until we get a semicolon followed by a newline (;\n);
|
||||||
|
$pgsqlchunk = array();
|
||||||
|
$chunkcount = 1;
|
||||||
|
$linenum = 0;
|
||||||
|
$inquotes = false;
|
||||||
|
$first = true;
|
||||||
|
|
||||||
|
if (empty($infp)) {
|
||||||
|
print 'Failed to open file '.$infilename."\n";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fs = filesize($infilename);
|
||||||
|
echo "Filesize: " . formatsize($fs) . "\n";
|
||||||
|
|
||||||
|
while ($instr = fgets($infp)) {
|
||||||
|
$linenum ++;
|
||||||
|
$memusage = round(memory_get_usage(true) / 1024 / 1024);
|
||||||
|
$len = strlen($instr);
|
||||||
|
$pgsqlchunk[] = $instr;
|
||||||
|
$c = substr_count($instr, "'");
|
||||||
|
// we have an odd number of ' marks
|
||||||
|
if ($c % 2 != 0) {
|
||||||
|
if ($inquotes)
|
||||||
|
$inquotes = false;
|
||||||
|
else
|
||||||
|
$inquotes = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($linenum % 10000 == 0) {
|
||||||
|
$currentpos = ftell($infp);
|
||||||
|
$percent = round($currentpos / $fs * 100);
|
||||||
|
$position = formatsize($currentpos);
|
||||||
|
printf("Reading progress: %3d%% position: %7s line: %9d sql chunk: %9d mem usage: %4dM\r", $percent, $position, $linenum, $chunkcount, $memusage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen($instr) > 3 && ($instr[$len - 3] == ")" && $instr[$len - 2] == ";" && $instr[$len - 1] == "\n") && $inquotes == false) {
|
||||||
|
$chunkcount ++;
|
||||||
|
|
||||||
|
if ($linenum % 10000 == 0) {
|
||||||
|
$currentpos = ftell($infp);
|
||||||
|
$percent = round($currentpos / $fs * 100);
|
||||||
|
$position = formatsize($currentpos);
|
||||||
|
printf("Processing progress: %3d%% position: %7s line: %9d sql chunk: %9d mem usage: %4dM\r", $percent, $position, $linenum, $chunkcount, $memusage);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* echo "sending chunk:\n";
|
||||||
|
* echo "=======================\n";
|
||||||
|
* print_r($pgsqlchunk);
|
||||||
|
* echo "=======================\n";
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* foreach ($pgsqlchunk as $aaa) {
|
||||||
|
* if (preg_match('/MAIN_ENABLE_DEFAULT|MAIN_MAIL_SMTP_SE/', $aaa)) {
|
||||||
|
* var_dump($pgsqlchunk);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
$mysqlchunk = pg2mysql($pgsqlchunk, $arrayofprimaryalreadyintabledef, $first);
|
||||||
|
fputs($outfp, $mysqlchunk['output']);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* $break = false;
|
||||||
|
* foreach ($pgsqlchunk as $aaa) {
|
||||||
|
* if (preg_match('/MAIN_ENABLE_DEFAULT|MAIN_MAIL_SMTP_SE/', $aaa)) {
|
||||||
|
* var_dump($mysqlchunk);
|
||||||
|
* }
|
||||||
|
* if (preg_match('/MAIN_MAIL_SMTP_SE/', $aaa)) {
|
||||||
|
* $break = true;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* if ($break) break;
|
||||||
|
*/
|
||||||
|
|
||||||
|
$outputatend .= $mysqlchunk['outputatend'];
|
||||||
|
|
||||||
|
$first = false;
|
||||||
|
$pgsqlchunk = array();
|
||||||
|
$mysqlchunk = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo "\n\n";
|
||||||
|
|
||||||
|
fputs($outfp, $outputatend);
|
||||||
|
|
||||||
|
fputs($outfp, "\n");
|
||||||
|
|
||||||
|
fputs($outfp, '/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;' . "\n");
|
||||||
|
fputs($outfp, '/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;' . "\n");
|
||||||
|
fputs($outfp, '/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;' . "\n");
|
||||||
|
fputs($outfp, '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . "\n");
|
||||||
|
fputs($outfp, '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . "\n");
|
||||||
|
fputs($outfp, '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . "\n");
|
||||||
|
fputs($outfp, '/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;' . "\n");
|
||||||
|
|
||||||
|
printf("Completed! %9d lines %9d sql chunks\n\n", $linenum, $chunkcount);
|
||||||
|
|
||||||
|
fclose($infp);
|
||||||
|
fclose($outfp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pg2mysql
|
||||||
|
*
|
||||||
|
* @param array $input Array of input
|
||||||
|
* @param array $arrayofprimaryalreadyintabledef Array of table already output with a primary key set into definition
|
||||||
|
* @param boolean $header Boolean
|
||||||
|
* @return string[] Array of output
|
||||||
|
*/
|
||||||
|
function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if (is_array($input)) {
|
||||||
|
$lines = $input;
|
||||||
|
} else {
|
||||||
|
$lines = split("\n", $input);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($header) {
|
||||||
|
$output = "-- Converted with " . PRODUCT . "-" . VERSION . "\n";
|
||||||
|
$output .= "-- Converted on " . date("r") . "\n";
|
||||||
|
$output .= "\n";
|
||||||
|
|
||||||
|
$output .= "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n";
|
||||||
|
$output .= "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n";
|
||||||
|
$output .= "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n";
|
||||||
|
$output .= "/*!40101 SET NAMES utf8 */;\n";
|
||||||
|
$output .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n";
|
||||||
|
$output .= "/*!40103 SET TIME_ZONE='+00:00' */;\n";
|
||||||
|
$output .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n";
|
||||||
|
$output .= "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n";
|
||||||
|
$output .= "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n";
|
||||||
|
$output .= "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n";
|
||||||
|
$output .= "\n";
|
||||||
|
|
||||||
|
$outputatend = "";
|
||||||
|
} else {
|
||||||
|
$output = "";
|
||||||
|
$outputatend = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
$in_create_table = $in_insert = false;
|
||||||
|
|
||||||
|
$linenumber = 0;
|
||||||
|
$tbl_extra = "";
|
||||||
|
while (isset($lines[$linenumber])) {
|
||||||
|
$line = $lines[$linenumber];
|
||||||
|
// $line =str_replace('ALTER TABLE public\.', '', $line);
|
||||||
|
|
||||||
|
$reg = array();
|
||||||
|
if (preg_match('/CREATE SEQUENCE (?:public\.)(.*)_(id|rowid|id_comment)_seq/', $line, $reg)) {
|
||||||
|
$outputatend .= '-- Make field ' . $reg[2] . ' auto_increment for table ' . $reg[1] . "\n";
|
||||||
|
$outputatend .= 'ALTER TABLE ' . $reg[1] . ' CHANGE COLUMN ' . $reg[2] . ' ' . $reg[2] . ' INTEGER NOT NULL AUTO_INCREMENT;' . "\n\n";
|
||||||
|
// var_dump($outputatend);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($line, 0, 12) == "CREATE TABLE") {
|
||||||
|
$in_create_table = true;
|
||||||
|
$line = str_replace("\"", "`", $line);
|
||||||
|
$line = str_replace('public.', '', $line);
|
||||||
|
|
||||||
|
$reg2 = array();
|
||||||
|
if (preg_match('/CREATE TABLE ([^\s]+)/', $line, $reg2)) {
|
||||||
|
$in_create_table = $reg2[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
$reg2 = array();
|
||||||
|
if (preg_match('/CREATE TABLE ([^\s]+)/', $line, $reg2)) {
|
||||||
|
$output .= 'DROP TABLE IF EXISTS `' . $reg2[1] . '`;' . "\n";
|
||||||
|
}
|
||||||
|
$output .= $line;
|
||||||
|
$linenumber ++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($line, 0, 2) == ");" && $in_create_table) {
|
||||||
|
$in_create_table = false;
|
||||||
|
$line = ") ENGINE={$config['engine']};\n\n";
|
||||||
|
|
||||||
|
$output .= $tbl_extra;
|
||||||
|
$output .= $line;
|
||||||
|
|
||||||
|
$linenumber ++;
|
||||||
|
$tbl_extra = "";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($in_create_table) {
|
||||||
|
$regs = array();
|
||||||
|
$line = str_replace("\"", "`", $line);
|
||||||
|
$line = str_replace(" integer", " int(11)", $line);
|
||||||
|
$line = str_replace(" int_unsigned", " int(11) UNSIGNED", $line);
|
||||||
|
$line = str_replace(" smallint_unsigned", " smallint UNSIGNED", $line);
|
||||||
|
$line = str_replace(" bigint_unsigned", " bigint UNSIGNED", $line);
|
||||||
|
$line = str_replace(" serial ", " int(11) auto_increment ", $line);
|
||||||
|
$line = str_replace(" bytea", " BLOB", $line);
|
||||||
|
$line = str_replace(" boolean", " bool", $line);
|
||||||
|
$line = str_replace(" bool DEFAULT true", " bool DEFAULT 1", $line);
|
||||||
|
$line = str_replace(" bool DEFAULT false", " bool DEFAULT 0", $line);
|
||||||
|
if (preg_match("/ character varying\(([0-9]*)\)/", $line, $regs)) {
|
||||||
|
$num = $regs[1];
|
||||||
|
if ($num <= 255)
|
||||||
|
$line = preg_replace("/ character varying\([0-9]*\)/", " varchar($num)", $line);
|
||||||
|
else
|
||||||
|
$line = preg_replace("/ character varying\([0-9]*\)/", " text", $line);
|
||||||
|
}
|
||||||
|
// character varying with no size, we will default to varchar(255)
|
||||||
|
if (preg_match("/ character varying/", $line)) {
|
||||||
|
$line = preg_replace("/ character varying/", " varchar(255)", $line);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match("/ DEFAULT \('([0-9]*)'::int/", $line, $regs) || preg_match("/ DEFAULT \('([0-9]*)'::smallint/", $line, $regs) || preg_match("/ DEFAULT \('([0-9]*)'::bigint/", $line, $regs)) {
|
||||||
|
$num = $regs[1];
|
||||||
|
$line = preg_replace("/ DEFAULT \('([0-9]*)'[^ ,]*/", " DEFAULT $num ", $line);
|
||||||
|
}
|
||||||
|
if (preg_match("/ DEFAULT \(([0-9\-]*)\)/", $line, $regs)) {
|
||||||
|
$num = $regs[1];
|
||||||
|
$line = preg_replace("/ DEFAULT \(([0-9\-]*)\)/", " DEFAULT $num ", $line);
|
||||||
|
}
|
||||||
|
$line = preg_replace("/ DEFAULT nextval\(.*\) /", " auto_increment ", $line);
|
||||||
|
$line = preg_replace("/::.*,/", ",", $line);
|
||||||
|
$line = preg_replace("/::.*$/", "\n", $line);
|
||||||
|
if (preg_match("/character\(([0-9]*)\)/", $line, $regs)) {
|
||||||
|
$num = $regs[1];
|
||||||
|
if ($num <= 255)
|
||||||
|
$line = preg_replace("/ character\([0-9]*\)/", " varchar($num)", $line);
|
||||||
|
else
|
||||||
|
$line = preg_replace("/ character\([0-9]*\)/", " text", $line);
|
||||||
|
}
|
||||||
|
// timestamps
|
||||||
|
$line = str_replace(" timestamp with time zone", " datetime", $line);
|
||||||
|
$line = str_replace(" timestamp without time zone", " datetime", $line);
|
||||||
|
|
||||||
|
// time
|
||||||
|
$line = str_replace(" time with time zone", " time", $line);
|
||||||
|
$line = str_replace(" time without time zone", " time", $line);
|
||||||
|
|
||||||
|
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||||
|
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||||
|
|
||||||
|
if (strstr($line, "auto_increment") || preg_match('/ rowid int/', $line) || preg_match('/ id int/', $line)) {
|
||||||
|
$field = getfieldname($line);
|
||||||
|
$tbl_extra .= ", PRIMARY KEY(`$field`)\n";
|
||||||
|
$arrayofprimaryalreadyintabledef[$in_create_table] = $in_create_table;
|
||||||
|
}
|
||||||
|
|
||||||
|
$specialfields = array("repeat","status","type","call");
|
||||||
|
|
||||||
|
$field = getfieldname($line);
|
||||||
|
if (in_array($field, $specialfields)) {
|
||||||
|
$line = str_replace("$field ", "`$field` ", $line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// text/blob fields are not allowed to have a default, so if we find a text DEFAULT, change it to varchar(255) DEFAULT
|
||||||
|
if (strstr($line, "text DEFAULT")) {
|
||||||
|
$line = str_replace(" text DEFAULT ", " varchar(255) DEFAULT ", $line);
|
||||||
|
}
|
||||||
|
|
||||||
|
// just skip a CONSTRAINT line
|
||||||
|
if (strstr($line, " CONSTRAINT ")) {
|
||||||
|
$line = "";
|
||||||
|
// and if the previous output ended with a , remove the ,
|
||||||
|
$lastchr = substr($output, - 2, 1);
|
||||||
|
// echo "lastchr=$lastchr";
|
||||||
|
if ($lastchr == ",") {
|
||||||
|
$output = substr($output, 0, - 2) . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($line, 0, 11) == "INSERT INTO") {
|
||||||
|
$line = str_replace('public.', '', $line);
|
||||||
|
|
||||||
|
if (substr($line, - 3, - 1) == ");") {
|
||||||
|
// we have a complete insert on one line
|
||||||
|
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||||
|
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||||
|
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||||
|
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||||
|
|
||||||
|
$before = str_replace("\"", "`", $before);
|
||||||
|
|
||||||
|
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we cant search for the previoous '
|
||||||
|
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||||
|
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||||
|
$after = str_replace(" (E'", " ('", $after);
|
||||||
|
$after = str_replace(", E'", ", '", $after);
|
||||||
|
|
||||||
|
$output .= $before . " VALUES " . $after;
|
||||||
|
$linenumber ++;
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
// this insert spans multiple lines, so keep dumping the lines until we reach a line
|
||||||
|
// that ends with ");"
|
||||||
|
|
||||||
|
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||||
|
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||||
|
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||||
|
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||||
|
|
||||||
|
$before = str_replace("\"", "`", $before);
|
||||||
|
|
||||||
|
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||||
|
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||||
|
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||||
|
$after = str_replace(" (E'", " ('", $after);
|
||||||
|
$after = str_replace(", E'", ", '", $after);
|
||||||
|
|
||||||
|
$c = substr_count($line, "'");
|
||||||
|
// we have an odd number of ' marks
|
||||||
|
if ($c % 2 != 0) {
|
||||||
|
$inquotes = true;
|
||||||
|
} else {
|
||||||
|
$inquotes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output .= $before . " VALUES " . $after;
|
||||||
|
do {
|
||||||
|
$linenumber ++;
|
||||||
|
|
||||||
|
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||||
|
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||||
|
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||||
|
|
||||||
|
// after the first line, we only need to check for it in the middle, not at the beginning of an insert (becuase the beginning will be on the first line)
|
||||||
|
// $after=str_replace(" (E'","' ('",$after);
|
||||||
|
$line = $lines[$linenumber];
|
||||||
|
$line = str_replace("', E'", "', '", $line);
|
||||||
|
$output .= $line;
|
||||||
|
|
||||||
|
// printf("inquotes: %d linenumber: %4d line: %s\n",$inquotes,$linenumber,$lines[$linenumber]);
|
||||||
|
|
||||||
|
$c = substr_count($line, "'");
|
||||||
|
// we have an odd number of ' marks
|
||||||
|
if ($c % 2 != 0) {
|
||||||
|
if ($inquotes)
|
||||||
|
$inquotes = false;
|
||||||
|
else
|
||||||
|
$inquotes = true;
|
||||||
|
// echo "inquotes=$inquotes\n";
|
||||||
|
}
|
||||||
|
} while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (substr($line, 0, 16) == "ALTER TABLE ONLY") {
|
||||||
|
$line = preg_replace('/ ONLY/', '', $line);
|
||||||
|
$line = str_replace("\"", "`", $line);
|
||||||
|
$line = str_replace("public.", "", $line);
|
||||||
|
$pkey = $line;
|
||||||
|
|
||||||
|
$linenumber ++;
|
||||||
|
if (! empty($lines[$linenumber])) {
|
||||||
|
$line = $lines[$linenumber];
|
||||||
|
} else {
|
||||||
|
$line = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strstr($line, " PRIMARY KEY ") && substr($line, - 3, - 1) == ");") {
|
||||||
|
$reg2 = array();
|
||||||
|
if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) {
|
||||||
|
if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) {
|
||||||
|
// looks like we have a single line PRIMARY KEY definition, lets go ahead and add it
|
||||||
|
$output .= str_replace("\n", "", $pkey);
|
||||||
|
// the postgres and mysql syntax for this is (at least, in the example im looking at)
|
||||||
|
// identical, so we can just add it as is.
|
||||||
|
$output .= $line . "\n";
|
||||||
|
} else {
|
||||||
|
$output .= '-- ' . str_replace("\n", "", $pkey);
|
||||||
|
$output .= '-- ' . $line . "\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$output .= '-- ' . str_replace("\n", "", $pkey);
|
||||||
|
$output .= '-- ' . $line . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// while we're here, we might as well catch CREATE INDEX as well
|
||||||
|
if (substr($line, 0, 12) == "CREATE INDEX") {
|
||||||
|
$matches = array();
|
||||||
|
preg_match('/CREATE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
|
||||||
|
if (! empty($matches[3])) {
|
||||||
|
$indexname = $matches[1];
|
||||||
|
$tablename = str_replace('public.', '', $matches[2]);
|
||||||
|
$columns = $matches[3];
|
||||||
|
if ($tablename && $columns) {
|
||||||
|
$output .= "ALTER TABLE `" . $tablename . "` ADD INDEX " . $indexname . "( {$columns} ) ;\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (substr($line, 0, 19) == "CREATE UNIQUE INDEX") {
|
||||||
|
$matches = array();
|
||||||
|
preg_match('/CREATE UNIQUE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
|
||||||
|
if (! empty($matches[3])) {
|
||||||
|
$indexname = $matches[1];
|
||||||
|
$tablename = str_replace('public.', '', $matches[2]);
|
||||||
|
$columns = str_replace('"', '', $matches[3]);
|
||||||
|
if ($tablename && $columns) {
|
||||||
|
$output .= "ALTER TABLE `" . $tablename . "` ADD UNIQUE INDEX " . $indexname . " ( {$columns} ) ;\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($line, 0, 13) == 'DROP DATABASE')
|
||||||
|
$output .= $line;
|
||||||
|
|
||||||
|
if (substr($line, 0, 15) == 'CREATE DATABASE') {
|
||||||
|
$matches = array();
|
||||||
|
preg_match('/CREATE DATABASE ([a-zA-Z0-9_]*) .* ENCODING = \'(.*)\'/', $line, $matches);
|
||||||
|
$output .= "CREATE DATABASE `$matches[1]` DEFAULT CHARACTER SET $matches[2];\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($line, 0, 8) == '\\connect') {
|
||||||
|
$matches = array();
|
||||||
|
preg_match('/connect ([a-zA-Z0-9_]*)/', $line, $matches);
|
||||||
|
$output .= "USE `$matches[1]`;\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (substr($line, 0, 5) == 'COPY ') {
|
||||||
|
$matches = array();
|
||||||
|
preg_match('/COPY (.*) FROM stdin/', $line, $matches);
|
||||||
|
$heads = str_replace('"', "`", $matches[1]);
|
||||||
|
$values = array();
|
||||||
|
$in_insert = true;
|
||||||
|
} elseif ($in_insert) {
|
||||||
|
if ($line == "\\.\n") {
|
||||||
|
$in_insert = false;
|
||||||
|
if ($values) {
|
||||||
|
$output .= "INSERT INTO $heads VALUES\n" . implode(",\n", $values) . ";\n\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$vals = explode(' ', $line);
|
||||||
|
foreach ($vals as $i => $val) {
|
||||||
|
$vals[$i] = ($val == '\\N') ? 'NULL' : "'" . str_replace("'", "\\'", trim($val)) . "'";
|
||||||
|
}
|
||||||
|
$values[] = '(' . implode(',', $vals) . ')';
|
||||||
|
if (count($values) >= 1000) {
|
||||||
|
$output .= "INSERT INTO $heads VALUES\n" . implode(",\n", $values) . ";\n";
|
||||||
|
$values = array();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$linenumber ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array('output' => $output,'outputatend' => $outputatend);
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -42,6 +42,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'acc
|
|||||||
|
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
|
$search_labelshort = GETPOST('search_labelshort', 'alpha');
|
||||||
$search_accountparent = GETPOST('search_accountparent', 'alpha');
|
$search_accountparent = GETPOST('search_accountparent', 'alpha');
|
||||||
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
$search_pcgtype = GETPOST('search_pcgtype', 'alpha');
|
||||||
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
||||||
@ -65,6 +66,7 @@ if (!$sortorder) $sortorder = "ASC";
|
|||||||
$arrayfields = array(
|
$arrayfields = array(
|
||||||
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||||
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||||
|
'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1),
|
||||||
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
|
'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1),
|
||||||
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'),
|
||||||
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'),
|
||||||
@ -96,6 +98,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$search_account = "";
|
$search_account = "";
|
||||||
$search_label = "";
|
$search_label = "";
|
||||||
|
$search_labelshort = "";
|
||||||
$search_accountparent = "";
|
$search_accountparent = "";
|
||||||
$search_pcgtype = "";
|
$search_pcgtype = "";
|
||||||
$search_pcgsubtype = "";
|
$search_pcgsubtype = "";
|
||||||
@ -192,7 +195,7 @@ if ($action == 'delete') {
|
|||||||
|
|
||||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||||
|
|
||||||
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
|
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, ";
|
||||||
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity;
|
||||||
@ -235,6 +238,7 @@ if (strlen(trim($search_account))) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_label);
|
||||||
|
if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort);
|
||||||
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
|
if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2);
|
||||||
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
|
if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
|
||||||
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
|
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
|
||||||
@ -267,6 +271,7 @@ if ($resql)
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||||
|
if ($search_labelshort) $param .= '&search_labelshort='.urlencode($search_labelshort);
|
||||||
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
|
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||||
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||||
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||||
@ -351,6 +356,7 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
|
if (!empty($arrayfields['aa.account_number']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_account" value="'.$search_account.'"></td>';
|
||||||
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
if (!empty($arrayfields['aa.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
||||||
|
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="'.$search_labelshort.'"></td>';
|
||||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
||||||
@ -368,6 +374,7 @@ if ($resql)
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
if (!empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
|
if (!empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
|
||||||
|
if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder);
|
||||||
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
|
if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
|
if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
|
||||||
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
|
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
|
||||||
@ -408,6 +415,15 @@ if ($resql)
|
|||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Account label to show (label short)
|
||||||
|
if (!empty($arrayfields['aa.labelshort']['checked']))
|
||||||
|
{
|
||||||
|
print "<td>";
|
||||||
|
print $obj->labelshort;
|
||||||
|
print "</td>\n";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
if (!empty($arrayfields['aa.account_parent']['checked']))
|
if (!empty($arrayfields['aa.account_parent']['checked']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -157,7 +157,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
|
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
|
||||||
if ((! isset($_POST[$value]) || $_POST[$value]==''))
|
if ((!GETPOSTISSET($value)) || GETPOST($value) == '')
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$fieldnamekey = $listfield[$f];
|
$fieldnamekey = $listfield[$f];
|
||||||
@ -170,13 +170,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Other checks
|
// Other checks
|
||||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system','systemauto'))) {
|
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array($_POST["type"], array('system', 'systemauto'))) {
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||||
}
|
}
|
||||||
if (isset($_POST["pcg_version"]))
|
if (GETPOSTISSET("pcg_version"))
|
||||||
{
|
{
|
||||||
if ($_POST["pcg_version"]=='0')
|
if (GETPOST("pcg_version") == '0')
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -97,6 +97,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||||||
$object->account_parent = $account_parent;
|
$object->account_parent = $account_parent;
|
||||||
$object->account_category = GETPOST('account_category', 'alpha');
|
$object->account_category = GETPOST('account_category', 'alpha');
|
||||||
$object->label = GETPOST('label', 'alpha');
|
$object->label = GETPOST('label', 'alpha');
|
||||||
|
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||||
$object->active = 1;
|
$object->active = 1;
|
||||||
|
|
||||||
$res = $object->create($user);
|
$res = $object->create($user);
|
||||||
@ -162,6 +163,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
|
|||||||
$object->account_parent = $account_parent;
|
$object->account_parent = $account_parent;
|
||||||
$object->account_category = GETPOST('account_category', 'alpha');
|
$object->account_category = GETPOST('account_category', 'alpha');
|
||||||
$object->label = GETPOST('label', 'alpha');
|
$object->label = GETPOST('label', 'alpha');
|
||||||
|
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||||
|
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
@ -236,6 +238,10 @@ if ($action == 'create') {
|
|||||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
|
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
|
||||||
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
|
print '<td><input name="label" size="70" value="'.$object->label.'"></td></tr>';
|
||||||
|
|
||||||
|
// Label short
|
||||||
|
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>';
|
||||||
|
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"></td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -254,7 +260,7 @@ if ($action == 'create') {
|
|||||||
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
print '<input type="text" name="pcg_type" value="'.dol_escape_htmltag(isset($_POST['pcg_type']) ?GETPOST('pcg_type', 'alpha') : $object->pcg_type).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Chart of acounts subtype
|
// Chart of accounts subtype
|
||||||
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
|
print '<tr><td>'.$langs->trans("Pcgsubtype").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">';
|
print '<input type="text" name="pcg_subtype" value="'.dol_escape_htmltag(isset($_POST['pcg_subtype']) ?GETPOST('pcg_subtype', 'alpha') : $object->pcg_subtype).'">';
|
||||||
@ -301,6 +307,10 @@ elseif ($id > 0 || $ref) {
|
|||||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
|
print '<tr><td><span class="fieldrequired">'.$langs->trans("Label").'</span></td>';
|
||||||
print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>';
|
print '<td><input name="label" size="70" value="'.$object->label.'"</td></tr>';
|
||||||
|
|
||||||
|
// Label short
|
||||||
|
print '<tr><td>' . $langs->trans("LabelToShow") . '</td>';
|
||||||
|
print '<td><input name="labelshort" size="70" value="' . $object->labelshort . '"</td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
print '<tr><td>'.$langs->trans("Accountparent").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -354,6 +364,10 @@ elseif ($id > 0 || $ref) {
|
|||||||
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Label").'</td>';
|
||||||
print '<td colspan="2">'.$object->label.'</td></tr>';
|
print '<td colspan="2">'.$object->label.'</td></tr>';
|
||||||
|
|
||||||
|
// Label to show
|
||||||
|
print '<tr><td class="titlefield">' . $langs->trans("LabelToShow") . '</td>';
|
||||||
|
print '<td colspan="2">' . $object->labelshort . '</td></tr>';
|
||||||
|
|
||||||
// Account parent
|
// Account parent
|
||||||
$accp = new AccountingAccount($db);
|
$accp = new AccountingAccount($db);
|
||||||
if (!empty($object->account_parent)) {
|
if (!empty($object->account_parent)) {
|
||||||
|
|||||||
@ -153,7 +153,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||||
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
||||||
if ($value == 'country' || $value == 'country_id') continue;
|
if ($value == 'country' || $value == 'country_id') continue;
|
||||||
if (!isset($_POST[$value]) || $_POST[$value] == '')
|
if (!GETPOSTISSET($value) || GETPOST($value) == '')
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$fieldnamekey = $listfield[$f];
|
$fieldnamekey = $listfield[$f];
|
||||||
|
|||||||
@ -165,9 +165,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
|
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
|
||||||
}
|
}
|
||||||
// Other checks
|
// Other checks
|
||||||
if (isset($_POST["code"]))
|
if (GETPOSTISSET("code"))
|
||||||
{
|
{
|
||||||
if ($_POST["code"] == '0')
|
if (GETPOST("code") == '0')
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
|
|||||||
@ -98,10 +98,8 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
|||||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($sortorder == "")
|
if ($sortorder == "") $sortorder = "ASC";
|
||||||
$sortorder = "ASC";
|
if ($sortfield == "") $sortfield = "t.numero_compte";
|
||||||
if ($sortfield == "")
|
|
||||||
$sortfield = "t.numero_compte";
|
|
||||||
|
|
||||||
|
|
||||||
$param = '';
|
$param = '';
|
||||||
@ -202,6 +200,8 @@ if ($action != 'export_csv')
|
|||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
|
|
||||||
|
$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" language="javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
jQuery("#exportcsvbutton").click(function() {
|
jQuery("#exportcsvbutton").click(function() {
|
||||||
@ -214,9 +214,6 @@ if ($action != 'export_csv')
|
|||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
|
|
||||||
|
|
||||||
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
|
||||||
|
|
||||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||||
|
|
||||||
$moreforfilter = '';
|
$moreforfilter = '';
|
||||||
@ -240,7 +237,7 @@ if ($action != 'export_csv')
|
|||||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||||
|
|
||||||
print '<tr class="liste_titre_filter">';
|
print '<tr class="liste_titre_filter">';
|
||||||
print '<td class="liste_titre" colspan="5">';
|
print '<td class="liste_titre" colspan="6">';
|
||||||
print $langs->trans('From');
|
print $langs->trans('From');
|
||||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||||
print ' ';
|
print ' ';
|
||||||
@ -257,6 +254,7 @@ if ($action != 'export_csv')
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||||
|
print_liste_field_titre("Opening Balance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||||
@ -269,6 +267,16 @@ if ($action != 'export_csv')
|
|||||||
$sous_total_credit = 0;
|
$sous_total_credit = 0;
|
||||||
$displayed_account = "";
|
$displayed_account = "";
|
||||||
|
|
||||||
|
$sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity;
|
||||||
|
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
$nrows = $resql->num_rows;
|
||||||
|
$opening_balances = Array();
|
||||||
|
for ($i = 0; $i < $nrows; $i++) {
|
||||||
|
$arr = $resql->fetch_array();
|
||||||
|
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($object->lines as $line)
|
foreach ($object->lines as $line)
|
||||||
{
|
{
|
||||||
$link = '';
|
$link = '';
|
||||||
@ -293,7 +301,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="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
|
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$displayed_account = $root_account_description;
|
$displayed_account = $root_account_description;
|
||||||
@ -305,6 +313,7 @@ if ($action != 'export_csv')
|
|||||||
|
|
||||||
print '<td>'.length_accountg($line->numero_compte).'</td>';
|
print '<td>'.length_accountg($line->numero_compte).'</td>';
|
||||||
print '<td>'.$description.'</td>';
|
print '<td>'.$description.'</td>';
|
||||||
|
print '<td class="nowraponall right">'.price($opening_balances["'".$line->numero_compte."'"]).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
||||||
print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>';
|
print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>';
|
||||||
@ -317,11 +326,11 @@ if ($action != 'export_csv')
|
|||||||
$sous_total_credit += $line->credit;
|
$sous_total_credit += $line->credit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
|
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
|
||||||
print "<td> </td>\n";
|
print "<td> </td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||||
*
|
*
|
||||||
@ -86,6 +86,7 @@ $search_debit = GETPOST('search_debit', 'alpha');
|
|||||||
$search_credit = GETPOST('search_credit', 'alpha');
|
$search_credit = GETPOST('search_credit', 'alpha');
|
||||||
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||||
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||||
|
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
|
||||||
|
|
||||||
// Load variable for pagination
|
// Load variable for pagination
|
||||||
$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);
|
||||||
@ -202,6 +203,7 @@ if (empty($reshook))
|
|||||||
$search_debit = '';
|
$search_debit = '';
|
||||||
$search_credit = '';
|
$search_credit = '';
|
||||||
$search_lettering_code = '';
|
$search_lettering_code = '';
|
||||||
|
$search_not_reconciled='';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must be after the remove filter action, before the export.
|
// Must be after the remove filter action, before the export.
|
||||||
@ -312,6 +314,10 @@ if (empty($reshook))
|
|||||||
$filter['t.lettering_code'] = $search_lettering_code;
|
$filter['t.lettering_code'] = $search_lettering_code;
|
||||||
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
|
$param .= '&search_lettering_code='.urlencode($search_lettering_code);
|
||||||
}
|
}
|
||||||
|
if (! empty($search_not_reconciled)) {
|
||||||
|
$filter['t.reconciled_option'] = $search_not_reconciled;
|
||||||
|
$param .= '&search_not_reconciled=' . urlencode($search_not_reconciled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
|
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
|
||||||
@ -444,6 +450,8 @@ if (count($filter) > 0) {
|
|||||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||||
|
} elseif ($key == 't.reconciled_option') {
|
||||||
|
$sqlwhere[] = 't.lettering_code IS NULL';
|
||||||
} else {
|
} else {
|
||||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||||
}
|
}
|
||||||
@ -758,6 +766,7 @@ if (!empty($arrayfields['t.lettering_code']['checked']))
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
|
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
|
||||||
|
print '<br><span class="nowrap"><input type="checkbox" name="search_reconciled_option" value="notreconciled"'.($search_not_reconciled == 'notreconciled'?' checked':'').'>'.$langs->trans("NotReconciled").'</span>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Code journal
|
// Code journal
|
||||||
|
|||||||
@ -260,9 +260,9 @@ if ($resql) {
|
|||||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
print '<td class="nowrap right">' . price($obj->debit) . '</td>';
|
||||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
print '<td class="nowrap right">' . price($obj->credit) . '</td>';
|
||||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
print '<td class="nowrap right">' . price(round($solde, 2)) . '</td>';
|
||||||
|
|
||||||
// Journal
|
// Journal
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
@ -285,15 +285,15 @@ if ($resql) {
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
print '<td class="nowrap right"><strong>' . price($debit) . '</strong></td>';
|
||||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
print '<td class="nowrap right"><strong>' . price($credit) . '</strong></td>';
|
||||||
print '<td colspan="4"></td>';
|
print '<td colspan="4"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||||
print '<td colspan="2"> </td>';
|
print '<td colspan="2"> </td>';
|
||||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
print '<td class="nowrap right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
print '<td colspan="6"></td>';
|
print '<td colspan="6"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -144,7 +144,7 @@ dol_fiche_end();
|
|||||||
|
|
||||||
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
|
||||||
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
|
||||||
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code ";
|
$sql .= " bk.credit, bk.montant , bk.sens , bk.code_journal , bk.piece_num, bk.lettering_code, bk.date_validated ";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
|
||||||
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
$sql .= " WHERE (bk.subledger_account = '" . $object->code_compta_fournisseur . "' AND bk.numero_compte = '" . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . "' )";
|
||||||
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
if (dol_strlen($search_date_start) || dol_strlen($search_date_end)) {
|
||||||
@ -257,9 +257,9 @@ if ($resql) {
|
|||||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||||
print '<td>' . $obj->doc_ref . '</td>';
|
print '<td>' . $obj->doc_ref . '</td>';
|
||||||
print '<td>' . $obj->label_compte . '</td>';
|
print '<td>' . $obj->label_compte . '</td>';
|
||||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
print '<td class="nowrap right">' . price($obj->debit) . '</td>';
|
||||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
print '<td class="nowrap right">' . price($obj->credit) . '</td>';
|
||||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
print '<td class="nowrap right">' . price(round($solde, 2)) . '</td>';
|
||||||
|
|
||||||
// Journal
|
// Journal
|
||||||
$accountingjournal = new AccountingJournal($db);
|
$accountingjournal = new AccountingJournal($db);
|
||||||
@ -267,7 +267,7 @@ if ($resql) {
|
|||||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
||||||
print '<td class="center">' . $journaltoshow . '</td>';
|
print '<td class="center">' . $journaltoshow . '</td>';
|
||||||
|
|
||||||
if (empty($obj->lettering_code)) {
|
if (empty($obj->lettering_code) && empty($obj->date_validated) ) {
|
||||||
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
|
||||||
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
|
print '<td><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
|
||||||
print img_edit();
|
print img_edit();
|
||||||
@ -282,15 +282,15 @@ if ($resql) {
|
|||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
print '<td class="nowrap right"><strong>' . price($debit) . '</strong></td>';
|
||||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
print '<td class="nowrap right"><strong>' . price($credit) . '</strong></td>';
|
||||||
print '<td colspan="6"></td>';
|
print '<td colspan="6"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||||
print '<td colspan="2"> </td>';
|
print '<td colspan="2"> </td>';
|
||||||
print '<td class="right"><strong>' . price($credit - $debit) . '</strong></td>';
|
print '<td class="nowrap right"><strong>' . price($credit - $debit) . '</strong></td>';
|
||||||
print '<td colspan="4"></td>';
|
print '<td colspan="4"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2013-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
@ -120,6 +120,11 @@ class AccountingAccount extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $label;
|
public $label;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Label short of account
|
||||||
|
*/
|
||||||
|
public $labelshort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int ID
|
* @var int ID
|
||||||
*/
|
*/
|
||||||
@ -162,7 +167,7 @@ class AccountingAccount extends CommonObject
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if ($rowid || $account_number) {
|
if ($rowid || $account_number) {
|
||||||
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
$sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active";
|
||||||
$sql .= ", ca.label as category_label";
|
$sql .= ", ca.label as category_label";
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a";
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid";
|
||||||
@ -197,6 +202,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$this->account_number = $obj->account_number;
|
$this->account_number = $obj->account_number;
|
||||||
$this->account_parent = $obj->account_parent;
|
$this->account_parent = $obj->account_parent;
|
||||||
$this->label = $obj->label;
|
$this->label = $obj->label;
|
||||||
|
$this->labelshort = $obj->labelshort;
|
||||||
$this->account_category = $obj->fk_accounting_category;
|
$this->account_category = $obj->fk_accounting_category;
|
||||||
$this->account_category_label = $obj->category_label;
|
$this->account_category_label = $obj->category_label;
|
||||||
$this->fk_user_author = $obj->fk_user_author;
|
$this->fk_user_author = $obj->fk_user_author;
|
||||||
@ -240,6 +246,8 @@ class AccountingAccount extends CommonObject
|
|||||||
$this->account_number = trim($this->account_number);
|
$this->account_number = trim($this->account_number);
|
||||||
if (isset($this->label))
|
if (isset($this->label))
|
||||||
$this->label = trim($this->label);
|
$this->label = trim($this->label);
|
||||||
|
if (isset($this->labelshort))
|
||||||
|
$this->labelshort = trim($this->labelshort);
|
||||||
|
|
||||||
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
if (empty($this->pcg_type) || $this->pcg_type == '-1')
|
||||||
{
|
{
|
||||||
@ -262,6 +270,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", account_number";
|
$sql .= ", account_number";
|
||||||
$sql .= ", account_parent";
|
$sql .= ", account_parent";
|
||||||
$sql .= ", label";
|
$sql .= ", label";
|
||||||
|
$sql .= ", labelshort";
|
||||||
$sql .= ", fk_accounting_category";
|
$sql .= ", fk_accounting_category";
|
||||||
$sql .= ", fk_user_author";
|
$sql .= ", fk_user_author";
|
||||||
$sql .= ", active";
|
$sql .= ", active";
|
||||||
@ -274,6 +283,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
|
||||||
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent);
|
$sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent);
|
||||||
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'");
|
$sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'");
|
||||||
|
$sql .= ", " . (empty($this->labelshort) ? "''" : "'" . $this->db->escape($this->labelshort) . "'");
|
||||||
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
$sql .= ", " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||||
$sql .= ", " . $user->id;
|
$sql .= ", " . $user->id;
|
||||||
$sql .= ", " . (int) $this->active;
|
$sql .= ", " . (int) $this->active;
|
||||||
@ -345,6 +355,7 @@ class AccountingAccount extends CommonObject
|
|||||||
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
|
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
|
||||||
$sql .= " , account_parent = " . (int) $this->account_parent;
|
$sql .= " , account_parent = " . (int) $this->account_parent;
|
||||||
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''");
|
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''");
|
||||||
|
$sql .= " , labelshort = " . ($this->labelshort ? "'" . $this->db->escape($this->labelshort) . "'" : "''");
|
||||||
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : (int) $this->account_category);
|
||||||
$sql .= " , fk_user_modif = " . $user->id;
|
$sql .= " , fk_user_modif = " . $user->id;
|
||||||
$sql .= " , active = " . (int) $this->active;
|
$sql .= " , active = " . (int) $this->active;
|
||||||
@ -462,9 +473,10 @@ class AccountingAccount extends CommonObject
|
|||||||
* @param string $moretitle Add more text to title tooltip
|
* @param string $moretitle Add more text to title tooltip
|
||||||
* @param int $notooltip 1=Disable tooltip
|
* @param int $notooltip 1=Disable tooltip
|
||||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||||
|
* @param int $withcompletelabel 0=Short label (field short label), 1=Complete label (field label)
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
|
public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1, $withcompletelabel = 0)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||||
@ -483,11 +495,18 @@ class AccountingAccount extends CommonObject
|
|||||||
$picto = 'billr';
|
$picto = 'billr';
|
||||||
$label='';
|
$label='';
|
||||||
|
|
||||||
|
if (empty($this->labelshort) || $withcompletelabel == 1)
|
||||||
|
{
|
||||||
|
$labeltoshow = $this->label;
|
||||||
|
} else {
|
||||||
|
$labeltoshow = $this->labelshort;
|
||||||
|
}
|
||||||
|
|
||||||
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>';
|
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>';
|
||||||
if (! empty($this->account_number))
|
if (! empty($this->account_number))
|
||||||
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
|
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
|
||||||
if (! empty($this->label))
|
if (! empty($labeltoshow))
|
||||||
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label;
|
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $labeltoshow;
|
||||||
if ($moretitle) $label.=' - '.$moretitle;
|
if ($moretitle) $label.=' - '.$moretitle;
|
||||||
|
|
||||||
$linkclose='';
|
$linkclose='';
|
||||||
@ -514,7 +533,7 @@ class AccountingAccount extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
$label_link = length_accountg($this->account_number);
|
$label_link = length_accountg($this->account_number);
|
||||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
if ($withlabel) $label_link .= ' - ' . $labeltoshow;
|
||||||
|
|
||||||
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
|
||||||
if ($withpicto && $withpicto != 2) $result .= ' ';
|
if ($withpicto && $withpicto != 2) $result .= ' ';
|
||||||
|
|||||||
@ -361,20 +361,20 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ", '".$this->db->escape($this->doc_ref)."'";
|
$sql .= ", '".$this->db->escape($this->doc_ref)."'";
|
||||||
$sql .= ", ".$this->fk_doc;
|
$sql .= ", ".$this->fk_doc;
|
||||||
$sql .= ", ".$this->fk_docdet;
|
$sql .= ", ".$this->fk_docdet;
|
||||||
$sql .= ",'".$this->db->escape($this->thirdparty_code)."'";
|
$sql .= ", ".(!empty($this->thirdparty_code)?("'".$this->db->escape($this->thirdparty_code)."'"):"NULL");
|
||||||
$sql .= ",'".$this->db->escape($this->subledger_account)."'";
|
$sql .= ", ".(!empty($this->subledger_account)?("'".$this->db->escape($this->subledger_account)."'"):"NULL");
|
||||||
$sql .= ",'".$this->db->escape($this->subledger_label)."'";
|
$sql .= ", ".(!empty($this->subledger_label)?("'".$this->db->escape($this->subledger_label)."'"):"NULL");
|
||||||
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
|
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
|
||||||
$sql .= ",'".$this->db->escape($this->label_compte)."'";
|
$sql .= ", ".(!empty($this->label_operation)?("'".$this->db->escape($this->label_operation)."'"):"NULL");
|
||||||
$sql .= ", '".$this->db->escape($this->label_operation)."'";
|
$sql .= ", '".$this->db->escape($this->label_operation)."'";
|
||||||
$sql .= ", ".$this->debit;
|
$sql .= ", ".$this->debit;
|
||||||
$sql .= ", ".$this->credit;
|
$sql .= ", ".$this->credit;
|
||||||
$sql .= ", ".$this->montant;
|
$sql .= ", ".$this->montant;
|
||||||
$sql .= ",'".$this->db->escape($this->sens)."'";
|
$sql .= ", ".(!empty($this->sens)?("'".$this->db->escape($this->sens)."'"):"NULL");
|
||||||
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
|
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
|
||||||
$sql .= ", '".$this->db->idate($now)."'";
|
$sql .= ", '".$this->db->idate($now)."'";
|
||||||
$sql .= ", '".$this->db->escape($this->code_journal)."'";
|
$sql .= ", '".$this->db->escape($this->code_journal)."'";
|
||||||
$sql .= ",'".$this->db->escape($this->journal_label)."'";
|
$sql .= ", ".(!empty($this->journal_label)?("'".$this->db->escape($this->journal_label)."'"):"NULL");
|
||||||
$sql .= ", ".$this->db->escape($this->piece_num);
|
$sql .= ", ".$this->db->escape($this->piece_num);
|
||||||
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
|
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
|
|||||||
@ -76,6 +76,7 @@ class Lettering extends BookKeeping
|
|||||||
|
|
||||||
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
|
||||||
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
|
||||||
|
$sql .= ' AND bk.date_validated IS NULL ';
|
||||||
$sql .= $this->db->order('bk.doc_date', 'DESC');
|
$sql .= $this->db->order('bk.doc_date', 'DESC');
|
||||||
|
|
||||||
// echo $sql;
|
// echo $sql;
|
||||||
@ -253,7 +254,7 @@ class Lettering extends BookKeeping
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
|
||||||
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
|
$sql .= " rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
|
||||||
$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);
|
||||||
@ -275,7 +276,7 @@ class Lettering extends BookKeeping
|
|||||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||||
$sql .= " lettering_code='" . $lettre . "'";
|
$sql .= " lettering_code='" . $lettre . "'";
|
||||||
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
|
||||||
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
|
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||||
|
|||||||
@ -202,7 +202,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
// Creation user
|
// Creation user
|
||||||
$nuser = new User($db);
|
$nuser = new User($db);
|
||||||
$result = $nuser->create_from_member($object, GETPOST('login'));
|
$result = $nuser->create_from_member($object, GETPOST('login', 'alphanohtml'));
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@ -1747,7 +1747,7 @@ else
|
|||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $form->showCategories($object->id, 'member', 1);
|
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -241,6 +241,62 @@ class Adherent extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $entity;
|
public $entity;
|
||||||
|
|
||||||
|
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||||
|
'ref_ext' =>array('type'=>'varchar(128)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>20),
|
||||||
|
'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||||
|
'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||||
|
'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
|
||||||
|
'login' =>array('type'=>'varchar(50)', 'label'=>'Login', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
|
'gender' =>array('type'=>'varchar(10)', 'label'=>'Gender', 'enabled'=>1, 'visible'=>-1, 'position'=>250),
|
||||||
|
'pass' =>array('type'=>'varchar(50)', 'label'=>'Pass', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
|
'pass_crypted' =>array('type'=>'varchar(128)', 'label'=>'Pass crypted', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||||
|
'fk_adherent_type' =>array('type'=>'integer', 'label'=>'Fk adherent type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>55),
|
||||||
|
'morphy' =>array('type'=>'varchar(3)', 'label'=>'MorPhy', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>60),
|
||||||
|
'societe' =>array('type'=>'varchar(128)', 'label'=>'Societe', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||||
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||||
|
'address' =>array('type'=>'text', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||||
|
'zip' =>array('type'=>'varchar(10)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
|
'town' =>array('type'=>'varchar(50)', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
|
'state_id' =>array('type'=>'integer', 'label'=>'State id', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||||
|
'country' =>array('type'=>'integer', 'label'=>'Country', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||||
|
'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||||
|
'socialnetworks' =>array('type'=>'text', 'label'=>'Socialnetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||||
|
//'skype' =>array('type'=>'varchar(255)', 'label'=>'Skype', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||||
|
'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||||
|
'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'Phone perso', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||||
|
'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'Phone mobile', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||||
|
'birth' =>array('type'=>'date', 'label'=>'DateToBirth', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||||
|
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
|
||||||
|
'public' =>array('type'=>'smallint(6)', 'label'=>'Public', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>145),
|
||||||
|
'datefin' =>array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||||
|
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||||
|
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||||
|
'datevalid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||||
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
|
||||||
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||||
|
'fk_user_mod' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user mod', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
|
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||||
|
'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||||
|
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', -1=>'MemberStatusResiliatedShort')),
|
||||||
|
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>800),
|
||||||
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>805),
|
||||||
|
/*'twitter' =>array('type'=>'varchar(255)', 'label'=>'Twitter', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
|
||||||
|
'facebook' =>array('type'=>'varchar(255)', 'label'=>'Facebook', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
|
||||||
|
'instagram' =>array('type'=>'varchar(255)', 'label'=>'Instagram', 'enabled'=>1, 'visible'=>-1, 'position'=>220),
|
||||||
|
'snapchat' =>array('type'=>'varchar(255)', 'label'=>'Snapchat', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||||
|
'googleplus' =>array('type'=>'varchar(255)', 'label'=>'Googleplus', 'enabled'=>1, 'visible'=>-1, 'position'=>230),
|
||||||
|
'youtube' =>array('type'=>'varchar(255)', 'label'=>'Youtube', 'enabled'=>1, 'visible'=>-1, 'position'=>235),
|
||||||
|
'whatsapp' =>array('type'=>'varchar(255)', 'label'=>'Whatsapp', 'enabled'=>1, 'visible'=>-1, 'position'=>240),
|
||||||
|
'linkedin' =>array('type'=>'varchar(255)', 'label'=>'Linkedin', 'enabled'=>1, 'visible'=>-1, 'position'=>245),*/
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -2264,9 +2320,10 @@ class Adherent extends CommonObject
|
|||||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||||
*
|
*
|
||||||
* @param User $user Objet user
|
* @param User $user Objet user
|
||||||
|
* @param string $mode "expired" for membership to renew, "shift" for member to validate
|
||||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||||
*/
|
*/
|
||||||
public function load_board($user)
|
public function load_board($user, $mode)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
@ -2279,20 +2336,46 @@ class Adherent extends CommonObject
|
|||||||
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
|
||||||
$sql.= " WHERE a.fk_adherent_type = t.rowid";
|
$sql.= " WHERE a.fk_adherent_type = t.rowid";
|
||||||
|
if ($mode == 'expired')
|
||||||
|
{
|
||||||
$sql.= " AND a.statut = 1";
|
$sql.= " AND a.statut = 1";
|
||||||
$sql.= " AND a.entity IN (".getEntity('adherent').")";
|
$sql.= " AND a.entity IN (".getEntity('adherent').")";
|
||||||
$sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)";
|
$sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)";
|
||||||
|
}
|
||||||
|
elseif ($mode == 'shift')
|
||||||
|
{
|
||||||
|
$sql.= " AND a.statut = -1";
|
||||||
|
$sql.= " AND a.entity IN (".getEntity('adherent').")";
|
||||||
|
}
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
|
$warning_delay = 0;
|
||||||
|
$url = '';
|
||||||
|
$label = '';
|
||||||
|
$labelShort = '';
|
||||||
|
|
||||||
|
if ($mode == 'expired') {
|
||||||
|
$warning_delay = $conf->adherent->subscription->warning_delay/60/60/24;
|
||||||
|
$label = $langs->trans("MembersWithSubscriptionToReceive");
|
||||||
|
$labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort");
|
||||||
|
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
||||||
|
}
|
||||||
|
elseif ($mode == 'shift') {
|
||||||
|
$warning_delay = $conf->adherent->subscription->warning_delay/60/60/24;
|
||||||
|
$url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1';
|
||||||
|
$label = $langs->trans("MembersListToValid");
|
||||||
|
$labelShort = $langs->trans("ToValidate");
|
||||||
|
}
|
||||||
|
|
||||||
$response = new WorkboardResponse();
|
$response = new WorkboardResponse();
|
||||||
$response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24;
|
$response->warning_delay=$warning_delay;
|
||||||
$response->label=$langs->trans("MembersWithSubscriptionToReceive");
|
$response->label=$label;
|
||||||
$response->labelShort=$langs->trans("MembersWithSubscriptionToReceiveShort");
|
$response->labelShort=$labelShort;
|
||||||
$response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate';
|
$response->url=$url;
|
||||||
$response->img=img_object('', "user");
|
$response->img=img_object('', "user");
|
||||||
|
|
||||||
$adherentstatic = new Adherent($this->db);
|
$adherentstatic = new Adherent($this->db);
|
||||||
|
|||||||
@ -42,6 +42,11 @@ class Subscription extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $table_element='subscription';
|
public $table_element='subscription';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table
|
||||||
|
*/
|
||||||
|
public $ismultientitymanaged = 'fk_adherent@adherent';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||||
*/
|
*/
|
||||||
@ -88,6 +93,21 @@ class Subscription extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $fk_bank;
|
public $fk_bank;
|
||||||
|
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||||
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||||
|
'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||||
|
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||||
|
'datef' =>array('type'=>'date', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
|
||||||
|
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
|
||||||
|
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
|
'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||||
|
'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||||
|
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60),
|
||||||
|
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@ -531,7 +531,7 @@ if ($rowid > 0)
|
|||||||
{
|
{
|
||||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
print $form->showCategories($object->id, 'member', 1);
|
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -214,7 +214,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
|||||||
// Type
|
// Type
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans("Type").'</td><td class="valeur" colspan="3">';
|
print '<td>'.$langs->trans("Type").'</td><td class="valeur" colspan="3">';
|
||||||
print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"]) ? $_POST["typeid"] : $object->fk_type));
|
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid") : $object->fk_type));
|
||||||
print'</td></tr>';
|
print'</td></tr>';
|
||||||
|
|
||||||
// Date start subscription
|
// Date start subscription
|
||||||
|
|||||||
@ -35,8 +35,8 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
$massaction = GETPOST('massaction', 'alpha');
|
$massaction = GETPOST('massaction', 'alpha');
|
||||||
$confirm = GETPOST('confirm', 'alpha');
|
$confirm = GETPOST('confirm', 'alpha');
|
||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||||
|
|
||||||
$filter = GETPOST("filter", "alpha");
|
|
||||||
$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
|
$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
|
||||||
$search_ref = GETPOST('search_ref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha');
|
||||||
$search_type = GETPOST('search_type', 'alpha');
|
$search_type = GETPOST('search_type', 'alpha');
|
||||||
@ -47,6 +47,7 @@ $search_note = GETPOST('search_note', 'alpha');
|
|||||||
$search_account = GETPOST('search_account', 'int');
|
$search_account = GETPOST('search_account', 'int');
|
||||||
$search_amount = GETPOST('search_amount', 'alpha');
|
$search_amount = GETPOST('search_amount', 'alpha');
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
|
$sall = '';
|
||||||
|
|
||||||
$date_select = GETPOST("date_select", 'alpha');
|
$date_select = GETPOST("date_select", 'alpha');
|
||||||
|
|
||||||
@ -76,21 +77,21 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||||||
$fieldstosearchall = array(
|
$fieldstosearchall = array(
|
||||||
);
|
);
|
||||||
$arrayfields = array(
|
$arrayfields = array(
|
||||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
'd.ref'=>array('label'=>"Ref", 'checked'=>1),
|
||||||
'd.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
'd.fk_type'=>array('label'=>"Type", 'checked'=>1),
|
||||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
|
||||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
|
||||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
'd.login'=>array('label'=>"Login", 'checked'=>1),
|
||||||
't.libelle'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
't.libelle'=>array('label'=>"Label", 'checked'=>1),
|
||||||
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
|
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
|
||||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
|
||||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
|
||||||
'c.dateadh'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
|
'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),
|
||||||
'c.datef'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
|
'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101),
|
||||||
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
|
'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102),
|
||||||
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||||
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||||
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
// 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -256,7 +257,6 @@ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$opt
|
|||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
print '<input type="hidden" name="action" value="list">';
|
print '<input type="hidden" name="action" value="list">';
|
||||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
|
||||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
@ -412,12 +412,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'alig
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
$total = 0;
|
|
||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$total += $obj->subscription;
|
|
||||||
|
|
||||||
$subscription->ref = $obj->crowid;
|
$subscription->ref = $obj->crowid;
|
||||||
$subscription->id = $obj->crowid;
|
$subscription->id = $obj->crowid;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ $subscription = GETPOST("subscription", "int");
|
|||||||
$duration_value = GETPOST('duration_value', 'int');
|
$duration_value = GETPOST('duration_value', 'int');
|
||||||
$duration_unit = GETPOST('duration_unit', 'alpha');
|
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||||
$vote = GETPOST("vote", "int");
|
$vote = GETPOST("vote", "int");
|
||||||
$comment = GETPOST("comment", 'alphanohtml');
|
$comment = GETPOST("comment", 'none');
|
||||||
$mail_valid = GETPOST("mail_valid", 'none');
|
$mail_valid = GETPOST("mail_valid", 'none');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
@ -364,7 +364,9 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
||||||
|
$doleditor->Create();
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
@ -790,7 +792,7 @@ if ($rowid > 0)
|
|||||||
$morphys["phy"] = $langs->trans("Physical");
|
$morphys["phy"] = $langs->trans("Physical");
|
||||||
$morphys["mor"] = $langs->trans("Moral");
|
$morphys["mor"] = $langs->trans("Moral");
|
||||||
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
||||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"]) ? $_POST["morphy"] : $object->morphy);
|
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||||
@ -807,10 +809,12 @@ if ($rowid > 0)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
|
||||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
$doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
||||||
|
$doleditor->Create();
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
print '<tr><td class="tdtop">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
|
||||||
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
$doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%');
|
||||||
$doleditor->Create();
|
$doleditor->Create();
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|||||||
@ -235,7 +235,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/action/doc/");
|
$dir = dol_buildpath($reldir."core/modules/action/doc");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -257,7 +257,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "<td>\n";
|
print "<td>\n";
|
||||||
require_once $dir.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db, $specimenthirdparty);
|
$module = new $classname($db, $specimenthirdparty);
|
||||||
if (method_exists($module, 'info'))
|
if (method_exists($module, 'info'))
|
||||||
print $module->info($langs);
|
print $module->info($langs);
|
||||||
|
|||||||
@ -178,6 +178,7 @@ $message .= $langs->trans("AgendaUrlOptionsNotAdmin", $user->login, $user->login
|
|||||||
$message .= $langs->trans("AgendaUrlOptions4", $user->login, $user->login).'<br>';
|
$message .= $langs->trans("AgendaUrlOptions4", $user->login, $user->login).'<br>';
|
||||||
$message .= $langs->trans("AgendaUrlOptionsProject", $user->login, $user->login).'<br>';
|
$message .= $langs->trans("AgendaUrlOptionsProject", $user->login, $user->login).'<br>';
|
||||||
$message .= $langs->trans("AgendaUrlOptionsNotAutoEvent", 'systemauto', 'systemauto').'<br>';
|
$message .= $langs->trans("AgendaUrlOptionsNotAutoEvent", 'systemauto', 'systemauto').'<br>';
|
||||||
|
$message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'<br>';
|
||||||
|
|
||||||
print info_admin($message);
|
print info_admin($message);
|
||||||
|
|
||||||
|
|||||||
@ -350,7 +350,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
|
$realpath = $reldir."core/modules/bom".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -382,7 +383,6 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
if ($modulequalified)
|
if ($modulequalified)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
|
||||||
print '<tr class="oddeven"><td width="100">';
|
print '<tr class="oddeven"><td width="100">';
|
||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
@ -425,6 +425,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||||
|
|||||||
@ -403,7 +403,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/commande".$valdir);
|
$realpath = $reldir."core/modules/commande".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -477,6 +478,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -181,6 +181,13 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FACEBOOK_URL", GETPOST("facebookurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TWITTER_URL", GETPOST("twitterurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LINKEDIN_URL", GETPOST("linkedinurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_INSTAGRAM_URL", GETPOST("instagramurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_YOUTUBE_URL", GETPOST("youtubeurl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GITHUB_URL", GETPOST("githuburl", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS", GETPOST("MAIN_INFO_SOCIETE_MANAGERS", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_GDPR", GETPOST("MAIN_INFO_GDPR", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_INFO_CAPITAL", GETPOST("capital", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
@ -407,32 +414,26 @@ print '<table class="noborder centpercent">';
|
|||||||
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans("CompanyInfo").'</th><th>'.$langs->trans("Value").'</th></tr>'."\n";
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
print '<tr class="oddeven"><td class="fieldrequired"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||||
|
|
||||||
// Addresse
|
// Address
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||||
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_SOCIETE_ADDRESS ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')).'</textarea></td></tr>'."\n";
|
print '<textarea name="MAIN_INFO_SOCIETE_ADDRESS" id="MAIN_INFO_SOCIETE_ADDRESS" class="quatrevingtpercent" rows="'.ROWS_3.'">'.($conf->global->MAIN_INFO_SOCIETE_ADDRESS ? $conf->global->MAIN_INFO_SOCIETE_ADDRESS : GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml')).'</textarea></td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ZIP">'.$langs->trans("CompanyZip").'</label></td><td>';
|
||||||
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP ? $conf->global->MAIN_INFO_SOCIETE_ZIP : GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')).'"></td></tr>'."\n";
|
print '<input class="minwidth100" name="MAIN_INFO_SOCIETE_ZIP" id="MAIN_INFO_SOCIETE_ZIP" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP ? $conf->global->MAIN_INFO_SOCIETE_ZIP : GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha')).'"></td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_TOWN">'.$langs->trans("CompanyTown").'</label></td><td>';
|
||||||
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN ? $conf->global->MAIN_INFO_SOCIETE_TOWN : GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')).'"></td></tr>'."\n";
|
print '<input name="MAIN_INFO_SOCIETE_TOWN" class="minwidth100" id="MAIN_INFO_SOCIETE_TOWN" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN ? $conf->global->MAIN_INFO_SOCIETE_TOWN : GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml')).'"></td></tr>'."\n";
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
|
|
||||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
|
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
|
||||||
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
|
//if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization
|
||||||
print $form->select_country($mysoc->country_id, 'country_id');
|
print $form->select_country($mysoc->country_id, 'country_id');
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
print '<tr class="oddeven"><td><label for="state_id">'.$langs->trans("State").'</label></td><td class="maxwidthonsmartphone">';
|
||||||
$state_id = 0;
|
$state_id = 0;
|
||||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
||||||
@ -443,22 +444,22 @@ if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE))
|
|||||||
$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
|
$formcompany->select_departement($state_id, $mysoc->country_code, 'state_id');
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Currency
|
||||||
print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="currency">'.$langs->trans("CompanyCurrency").'</label></td><td>';
|
||||||
print $form->selectCurrency($conf->currency, "currency");
|
print $form->selectCurrency($conf->currency, "currency");
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Phone
|
||||||
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="phone">'.$langs->trans("Phone").'</label></td><td>';
|
||||||
print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>';
|
print '<input name="tel" id="phone" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TEL).'"></td></tr>';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Fax
|
||||||
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="fax">'.$langs->trans("Fax").'</label></td><td>';
|
||||||
print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>';
|
print '<input name="fax" id="fax" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FAX).'"></td></tr>';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Email
|
||||||
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 '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>';
|
print '<input name="mail" id="email" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MAIL).'"></td></tr>';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@ -516,6 +517,45 @@ print '</td></tr>';
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
// Social networks
|
||||||
|
print '<br>';
|
||||||
|
print '<table class="noborder centpercent">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="titlefield">'.$langs->trans("SocialNetworksInformation").'</td><td>'.$langs->trans("Value").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Facebook
|
||||||
|
print '<tr class="oddeven"><td><label for="facebookurl">'.$langs->trans("SocialNetworksFacebookURL").'</label></td><td>';
|
||||||
|
print '<input name="facebookurl" id="facebookurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_FACEBOOK_URL).'"></td></tr>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Twitter
|
||||||
|
print '<tr class="oddeven"><td><label for="twitterurl">'.$langs->trans("SocialNetworksTwitterURL").'</label></td><td>';
|
||||||
|
print '<input name="twitterurl" id="twitterurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TWITTER_URL).'"></td></tr>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// LinkedIn
|
||||||
|
print '<tr class="oddeven"><td><label for="linkedinurl">'.$langs->trans("SocialNetworksLinkedinURL").'</label></td><td>';
|
||||||
|
print '<input name="linkedinurl" id="linkedinurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_LINKEDIN_URL).'"></td></tr>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Instagram
|
||||||
|
print '<tr class="oddeven"><td><label for="instagramurl">'.$langs->trans("SocialNetworksInstagramURL").'</label></td><td>';
|
||||||
|
print '<input name="instagramurl" id="instagramurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_INSTAGRAM_URL).'"></td></tr>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Youtube
|
||||||
|
print '<tr class="oddeven"><td><label for="youtubeurl">'.$langs->trans("SocialNetworksYoutubeURL").'</label></td><td>';
|
||||||
|
print '<input name="youtubeurl" id="youtubeurl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_YOUTUBE_URL).'"></td></tr>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
// Github
|
||||||
|
print '<tr class="oddeven"><td><label for="githuburl">'.$langs->trans("SocialNetworksGithubURL").'</label></td><td>';
|
||||||
|
print '<input name="githuburl" id="githuburl" class="minwidth300" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GITHUB_URL).'"></td></tr>';
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
// IDs of the company (country-specific)
|
// IDs of the company (country-specific)
|
||||||
@ -525,24 +565,20 @@ print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyId
|
|||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
// Managing Director(s)
|
// Managing Director(s)
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="director">'.$langs->trans("ManagingDirectors").'</label></td><td>';
|
||||||
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
|
print '<input name="MAIN_INFO_SOCIETE_MANAGERS" id="director" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_MANAGERS).'"></td></tr>';
|
||||||
|
|
||||||
// GDPR contact
|
// GDPR contact
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
|
print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc"));
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
|
print '<input name="MAIN_INFO_GDPR" id="director" class="minwidth500" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_GDPR).'"></td></tr>';
|
||||||
|
|
||||||
// Capital
|
// Capital
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="capital">'.$langs->trans("Capital").'</label></td><td>';
|
||||||
print '<input name="capital" id="capital" class="minwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>';
|
print '<input name="capital" id="capital" class="minwidth100" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_CAPITAL).'"></td></tr>';
|
||||||
|
|
||||||
// Juridical Status
|
// Juridical Status
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
|
||||||
if ($mysoc->country_code) {
|
if ($mysoc->country_code) {
|
||||||
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
|
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
|
||||||
@ -551,7 +587,7 @@ if ($mysoc->country_code) {
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// ProfID1
|
// ProfId1
|
||||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
||||||
{
|
{
|
||||||
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
|
||||||
@ -641,14 +677,12 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TVA Intra
|
// Intra-community VAT number
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="intra_vat">'.$langs->trans("VATIntra").'</label></td><td>';
|
||||||
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
|
print '<input name="tva" id="intra_vat" class="minwidth200" value="'.dol_escape_htmltag(!empty($conf->global->MAIN_INFO_TVAINTRA) ? $conf->global->MAIN_INFO_TVAINTRA : '').'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Object of the company
|
// Object of the company
|
||||||
|
|
||||||
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
|
print '<tr class="oddeven"><td><label for="object">'.$langs->trans("CompanyObject").'</label></td><td>';
|
||||||
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
print '<textarea class="flat quatrevingtpercent" name="object" id="object" rows="'.ROWS_5.'">'.(!empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? $conf->global->MAIN_INFO_SOCIETE_OBJECT : '').'</textarea></td></tr>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|||||||
@ -339,7 +339,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/contract".$valdir);
|
$realpath = $reldir."core/modules/contract".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -413,6 +414,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -107,6 +107,10 @@ $modules = array(
|
|||||||
array(
|
array(
|
||||||
'code' => 'MAIN_DELAY_MEMBERS',
|
'code' => 'MAIN_DELAY_MEMBERS',
|
||||||
'img' => 'user'
|
'img' => 'user'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'code' => 'MAIN_DELAY_MEMBERS_SHIFT',
|
||||||
|
'img' => 'user'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'expensereport' => array(
|
'expensereport' => array(
|
||||||
|
|||||||
@ -678,9 +678,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$ok = 0;
|
$ok = 0;
|
||||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||||
}
|
}
|
||||||
if (isset($_POST["code"]))
|
if (GETPOSTISSET("code"))
|
||||||
{
|
{
|
||||||
if ($_POST["code"] == '0')
|
if (GETPOST("code") == '0')
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||||
@ -691,7 +691,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
|||||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2))
|
if (GETPOSTISSET("country") && ($_POST["country"] == '0') && ($id != 2))
|
||||||
{
|
{
|
||||||
if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
||||||
{
|
{
|
||||||
|
|||||||
@ -53,8 +53,7 @@ if ($action == "save")
|
|||||||
foreach ($eventstolog as $key => $arr)
|
foreach ($eventstolog as $key => $arr)
|
||||||
{
|
{
|
||||||
$param = 'MAIN_LOGEVENTS_'.$arr['id'];
|
$param = 'MAIN_LOGEVENTS_'.$arr['id'];
|
||||||
//print "param=".$param." - ".$_POST[$param];
|
if (GETPOST($param, 'alphanohtml')) dolibarr_set_const($db, $param, GETPOST($param, 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
if (! empty($_POST[$param])) dolibarr_set_const($db, $param, $_POST[$param], 'chaine', 0, '', $conf->entity);
|
|
||||||
else dolibarr_del_const($db, $param, $conf->entity);
|
else dolibarr_del_const($db, $param, $conf->entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -486,7 +486,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/facture".$valdir);
|
$realpath = $reldir."core/modules/facture".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -560,6 +561,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -239,13 +239,6 @@ else
|
|||||||
jsdump(CKEDITOR.env, "divforlog");
|
jsdump(CKEDITOR.env, "divforlog");
|
||||||
</script>';
|
</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
print '<!-- Result -->';
|
|
||||||
print $_POST["formtestfield"];
|
|
||||||
print '<!-- Result -->';
|
|
||||||
print $conf->global->FCKEDITOR_TEST;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
@ -409,7 +409,8 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/fichinter/doc/");
|
$realpath = $reldir."core/modules/fichinter/doc";
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -480,6 +481,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -355,7 +355,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
|
$realpath = $reldir."core/modules/holiday".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -429,6 +430,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -83,7 +83,7 @@ if ($action == 'update')
|
|||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["MAIN_LANG_DEFAULT"], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV+1, 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
//dolibarr_set_const($db, "MAIN_MULTILANGS", $_POST["MAIN_MULTILANGS"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
@ -241,13 +241,14 @@ print '</tr>';
|
|||||||
// Default language
|
// Default language
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("DefaultLanguage").'</td><td>';
|
||||||
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2);
|
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2);
|
||||||
|
print '<input class="button" type="submit" name="submit" value="'.$langs->trans("Save").'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Multilingual GUI
|
// Multilingual GUI
|
||||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||||
print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
|
print ajax_constantonoff('MAIN_MULTILANGS');
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td width="20"> </td>';
|
print '<td width="20"> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|||||||
@ -51,14 +51,14 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_DN', GETPOST("group"), 'chaine', 0, '', $conf->entity)) $error++;
|
if (!dolibarr_set_const($db, 'LDAP_GROUP_DN', GETPOST("group", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
|
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||||
|
|
||||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
|
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||||
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',$_POST["fieldname"],'chaine',0,'',$conf->entity)) $error++;
|
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',GETPOST("fieldname", 'alphanohtml'),'chaine',0,'',$conf->entity)) $error++;
|
||||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
|
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION', GETPOST("fielddescription", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS', GETPOST("fieldgroupmembers"), 'chaine', 0, '', $conf->entity)) $error++;
|
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS', GETPOST("fieldgroupmembers", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid"), 'chaine', 0, '', $conf->entity)) $error++;
|
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||||
|
|
||||||
// This one must be after the others
|
// This one must be after the others
|
||||||
$valkey = '';
|
$valkey = '';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
|
* Copyright (C) 2009-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -32,31 +32,37 @@ $langs->loadLangs(array('companies', 'products', 'admin'));
|
|||||||
if (! $user->admin) accessforbidden();
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$currencycode = GETPOST('currencycode', 'alpha');
|
||||||
|
|
||||||
|
$mainmaxdecimalsunit = 'MAIN_MAX_DECIMALS_UNIT'.(! empty($currencycode)?'_'.$currencycode:'');
|
||||||
|
$mainmaxdecimalstot = 'MAIN_MAX_DECIMALS_TOT'.(! empty($currencycode)?'_'.$currencycode:'');
|
||||||
|
$mainmaxdecimalsshown = 'MAIN_MAX_DECIMALS_SHOWN'.(! empty($currencycode)?'_'.$currencycode:'');
|
||||||
|
$mainroundingruletot = 'MAIN_ROUNDING_RULE_TOT'.(! empty($currencycode)?'_'.$currencycode:'');
|
||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
$MAXDEC=8;
|
$MAXDEC=8;
|
||||||
if ($_POST["MAIN_MAX_DECIMALS_UNIT"] > $MAXDEC
|
if ($_POST[$mainmaxdecimalsunit] > $MAXDEC
|
||||||
|| $_POST["MAIN_MAX_DECIMALS_TOT"] > $MAXDEC
|
|| $_POST[$mainmaxdecimalstot] > $MAXDEC
|
||||||
|| $_POST["MAIN_MAX_DECIMALS_SHOWN"] > $MAXDEC)
|
|| $_POST[$mainmaxdecimalsshown] > $MAXDEC)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
|
setEventMessages($langs->trans("ErrorDecimalLargerThanAreForbidden", $MAXDEC), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["MAIN_MAX_DECIMALS_UNIT"] < 0
|
if ($_POST[$mainmaxdecimalsunit].(! empty($currencycode)?'_'.$currencycode:'') < 0
|
||||||
|| $_POST["MAIN_MAX_DECIMALS_TOT"] < 0
|
|| $_POST[$mainmaxdecimalstot] < 0
|
||||||
|| $_POST["MAIN_MAX_DECIMALS_SHOWN"] < 0)
|
|| $_POST[$mainmaxdecimalsshown] < 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
|
setEventMessages($langs->trans("ErrorNegativeValueNotAllowed"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST["MAIN_ROUNDING_RULE_TOT"])
|
if ($_POST[$mainroundingruletot])
|
||||||
{
|
{
|
||||||
if ($_POST["MAIN_ROUNDING_RULE_TOT"] * pow(10, $_POST["MAIN_MAX_DECIMALS_TOT"]) < 1)
|
if ($_POST[$mainroundingruletot] * pow(10, $_POST[$mainmaxdecimalstot]) < 1)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$error++;
|
$error++;
|
||||||
@ -66,19 +72,18 @@ if ($action == 'update')
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_MAX_DECIMALS_UNIT", $_POST["MAIN_MAX_DECIMALS_UNIT"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainmaxdecimalsunit, $_POST[$mainmaxdecimalsunit], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAX_DECIMALS_TOT", $_POST["MAIN_MAX_DECIMALS_TOT"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainmaxdecimalstot, $_POST[$mainmaxdecimalstot], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_MAX_DECIMALS_SHOWN", $_POST["MAIN_MAX_DECIMALS_SHOWN"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainmaxdecimalsshown, $_POST[$mainmaxdecimalsshown], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_ROUNDING_RULE_TOT", $_POST["MAIN_ROUNDING_RULE_TOT"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, $mainroundingruletot, $_POST[$mainroundingruletot], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup".(! empty($currencycode)?'¤cycode='.$currencycode:''));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -89,6 +94,31 @@ llxHeader();
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup');
|
print load_fiche_titre($langs->trans("LimitsSetup"), '', 'title_setup');
|
||||||
|
|
||||||
|
$currencycode = (! empty($currencycode)?$currencycode:$conf->currency);
|
||||||
|
$aCurrencies = array($conf->currency); // Default currency always first position
|
||||||
|
|
||||||
|
if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
|
||||||
|
|
||||||
|
$sql = 'SELECT rowid, code FROM '.MAIN_DB_PREFIX.'multicurrency';
|
||||||
|
$sql.= ' WHERE entity = '.$conf->entity;
|
||||||
|
$sql.= ' AND code != "'.$conf->currency.'"'; // Default currency always first position
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
while ($obj = $db->fetch_object($resql))
|
||||||
|
{
|
||||||
|
$aCurrencies[] = $obj->code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($aCurrencies) && count($aCurrencies) > 1)
|
||||||
|
{
|
||||||
|
$head = multicurrencyLimitPrepareHead($aCurrencies);
|
||||||
|
dol_fiche_head($head, $currencycode, '', -1, "multicurrency");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n";
|
print '<span class="opacitymedium">'.$langs->trans("LimitsDesc")."</span><br>\n";
|
||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
@ -98,29 +128,29 @@ if ($action == 'edit')
|
|||||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="update">';
|
print '<input type="hidden" name="action" value="update">';
|
||||||
|
if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY)) {
|
||||||
|
print '<input type="hidden" name="currencycode" value="'.$currencycode.'">';
|
||||||
|
}
|
||||||
|
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_UNIT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_UNIT . '"></td></tr>';
|
print '</td><td><input class="flat" name="'.$mainmaxdecimalsunit.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsunit)?$conf->global->$mainmaxdecimalsunit:$conf->global->MAIN_MAX_DECIMALS_UNIT).'"></td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
print '<tr><td>';
|
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td><input class="flat" name="MAIN_MAX_DECIMALS_TOT" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_TOT . '"></td></tr>';
|
print '</td><td><input class="flat" name="'.$mainmaxdecimalstot.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalstot)?$conf->global->$mainmaxdecimalstot:$conf->global->MAIN_MAX_DECIMALS_TOT).'"></td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
|
||||||
|
print '<td><input class="flat" name="'.$mainmaxdecimalsshown.'" size="3" value="'.(isset($conf->global->$mainmaxdecimalsshown)?$conf->global->$mainmaxdecimalsshown:$conf->global->MAIN_MAX_DECIMALS_SHOWN).'"></td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td><input class="flat" name="MAIN_MAX_DECIMALS_SHOWN" size="3" value="' . $conf->global->MAIN_MAX_DECIMALS_SHOWN . '"></td></tr>';
|
print '<tr class="oddeven"><td>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td><input class="flat" name="MAIN_ROUNDING_RULE_TOT" size="3" value="' . $conf->global->MAIN_ROUNDING_RULE_TOT . '"></td></tr>';
|
print '</td><td><input class="flat" name="'.$mainroundingruletot.'" size="3" value="'.(isset($conf->global->$mainroundingruletot)?$conf->global->$mainroundingruletot:$conf->global->MAIN_ROUNDING_RULE_TOT).'"></td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -138,31 +168,35 @@ else
|
|||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td class="right">'.$conf->global->MAIN_MAX_DECIMALS_UNIT.'</td></tr>';
|
print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalsunit)?$conf->global->$mainmaxdecimalsunit:$conf->global->MAIN_MAX_DECIMALS_UNIT).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
print '<tr><td>';
|
|
||||||
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td class="right">'.$conf->global->MAIN_MAX_DECIMALS_TOT.'</td></tr>';
|
print '</td><td align="right">'.(isset($conf->global->$mainmaxdecimalstot)?$conf->global->$mainmaxdecimalstot:$conf->global->MAIN_MAX_DECIMALS_TOT).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td>';
|
||||||
|
print '<td align="right">'.(isset($conf->global->$mainmaxdecimalsshown)?$conf->global->$mainmaxdecimalsshown:$conf->global->MAIN_MAX_DECIMALS_SHOWN).'</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'</td><td class="right">'.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'</td></tr>';
|
print '<tr class="oddeven"><td>';
|
||||||
|
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"), $langs->trans("ParameterActiveForNextInputOnly"));
|
||||||
print '</td><td class="right">'.$conf->global->MAIN_ROUNDING_RULE_TOT.'</td></tr>';
|
print '</td><td align="right">'.(isset($conf->global->$mainroundingruletot)?$conf->global->$mainroundingruletot:$conf->global->MAIN_ROUNDING_RULE_TOT).'</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<div class="tabsAction tabsActionNoBottom">';
|
print '<div class="tabsAction">';
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit'.(! empty($currencycode)?'¤cycode='.$currencycode:'').'">'.$langs->trans("Modify").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($conf->multicurrency->enabled) && ! empty($conf->global->MULTICURRENCY_USE_LIMIT_BY_CURRENCY))
|
||||||
|
{
|
||||||
|
if (! empty($aCurrencies) && count($aCurrencies) > 1)
|
||||||
|
{
|
||||||
|
dol_fiche_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($mysoc->country_code))
|
if (empty($mysoc->country_code))
|
||||||
{
|
{
|
||||||
@ -197,7 +231,6 @@ else
|
|||||||
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
print " - ".$langs->trans("VAT").": ".$vat.'%';
|
||||||
print " -> ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
print " -> ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."<br>\n";
|
||||||
|
|
||||||
|
|
||||||
// Add vat rates examples specific to country
|
// Add vat rates examples specific to country
|
||||||
$vat_rates=array();
|
$vat_rates=array();
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("other", "admin"));
|
$langs->loadLangs(array("other", "admin"));
|
||||||
|
|
||||||
|
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
$dirstandard = array();
|
$dirstandard = array();
|
||||||
@ -64,12 +66,12 @@ if (GETPOST("menu_handler")) $menu_handler = GETPOST("menu_handler");
|
|||||||
|
|
||||||
if ($action == 'update')
|
if ($action == 'update')
|
||||||
{
|
{
|
||||||
if (!$_POST['cancel'])
|
if (!$cancel)
|
||||||
{
|
{
|
||||||
$leftmenu = ''; $mainmenu = '';
|
$leftmenu = ''; $mainmenu = '';
|
||||||
if (!empty($_POST['menuIdParent']) && !is_numeric($_POST['menuIdParent']))
|
if (GETPOST('menuIdParent', 'alpha') && !is_numeric(GETPOST('menuIdParent', 'alpha')))
|
||||||
{
|
{
|
||||||
$tmp = explode('&', $_POST['menuIdParent']);
|
$tmp = explode('&', GETPOST('menuIdParent', 'alpha'));
|
||||||
foreach ($tmp as $s)
|
foreach ($tmp as $s)
|
||||||
{
|
{
|
||||||
if (preg_match('/fk_mainmenu=/', $s))
|
if (preg_match('/fk_mainmenu=/', $s))
|
||||||
@ -138,7 +140,7 @@ if ($action == 'update')
|
|||||||
|
|
||||||
if ($action == 'add')
|
if ($action == 'add')
|
||||||
{
|
{
|
||||||
if ($_POST['cancel'])
|
if ($cancel)
|
||||||
{
|
{
|
||||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
|
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -351,7 +351,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/mrp".$valdir);
|
$realpath = $reldir."core/modules/mrp".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -383,7 +384,6 @@ foreach ($dirmodels as $reldir)
|
|||||||
|
|
||||||
if ($modulequalified)
|
if ($modulequalified)
|
||||||
{
|
{
|
||||||
$var = !$var;
|
|
||||||
print '<tr class="oddeven"><td width="100">';
|
print '<tr class="oddeven"><td width="100">';
|
||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
@ -426,6 +426,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||||
|
|||||||
@ -53,6 +53,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (!$error && is_array($_POST))
|
if (!$error && is_array($_POST))
|
||||||
{
|
{
|
||||||
//var_dump($_POST);
|
//var_dump($_POST);
|
||||||
|
$reg = array();
|
||||||
foreach ($_POST as $key => $val)
|
foreach ($_POST as $key => $val)
|
||||||
{
|
{
|
||||||
if (!preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
|
if (!preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
require '../main.inc.php';
|
require '../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
use OAuth\Common\Storage\DoliStorage;
|
use OAuth\Common\Storage\DoliStorage;
|
||||||
|
|
||||||
@ -59,9 +59,18 @@ if ($action == 'setconst' && $user->admin)
|
|||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$db->begin();
|
||||||
foreach ($_POST['setupdriver'] as $setupconst) {
|
|
||||||
|
$setupconstarray = GETPOST('setupdriver', 'array');
|
||||||
|
|
||||||
|
foreach ($setupconstarray as $setupconst) {
|
||||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||||
$result = dolibarr_set_const($db, $setupconst['varname'], $setupconst['value'], 'chaine', 0, '', $conf->entity);
|
|
||||||
|
$constname = dol_escape_htmltag($setupconst['varname']);
|
||||||
|
$constvalue = dol_escape_htmltag($setupconst['value']);
|
||||||
|
$consttype = dol_escape_htmltag($setupconst['type']);
|
||||||
|
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||||
|
|
||||||
|
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||||
if (!$result > 0) $error++;
|
if (!$result > 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,6 +128,9 @@ $head = oauthadmin_prepare_head();
|
|||||||
|
|
||||||
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
||||||
|
|
||||||
|
if (GETPOST('error')) {
|
||||||
|
setEventMessages(GETPOST('error'), null, 'errors');
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode == 'setup' && $user->admin)
|
if ($mode == 'setup' && $user->admin)
|
||||||
{
|
{
|
||||||
@ -135,17 +147,21 @@ if ($mode == 'setup' && $user->admin)
|
|||||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||||
{
|
{
|
||||||
$OAUTH_SERVICENAME = 'GitHub';
|
$OAUTH_SERVICENAME = 'GitHub';
|
||||||
$state='user,public_repo'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
|
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||||
|
$shortscope = 'user,public_repo';
|
||||||
|
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||||
}
|
}
|
||||||
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||||
{
|
{
|
||||||
$OAUTH_SERVICENAME = 'Google';
|
$OAUTH_SERVICENAME = 'Google';
|
||||||
$state='userinfo_email,userinfo_profile,cloud_print'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
|
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||||
//$state.=',gmail_full';
|
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||||
|
//$scope.=',gmail_full';
|
||||||
|
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,12 +58,13 @@ if ($action == 'update')
|
|||||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||||
@ -79,6 +80,9 @@ if ($action == 'update')
|
|||||||
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity);
|
||||||
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -295,6 +299,16 @@ print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td
|
|||||||
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
|
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
|
||||||
|
//if (! empty($conf->global->MAIN_MULTILANGS))
|
||||||
|
//{
|
||||||
|
print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
|
||||||
|
//} else {
|
||||||
|
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
|
||||||
|
//}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,8 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
|
|
||||||
if (!$user->admin) accessforbidden();
|
if (!$user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$entity=$conf->entity;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -70,14 +72,12 @@ print '<span class="opacitymedium">'.$langs->trans("DefaultRightsDesc")." ".$lan
|
|||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// Charge les modules soumis a permissions
|
// Search all modules with permission and reload permissions def.
|
||||||
$modules = array();
|
$modules = array();
|
||||||
$modulesdir = dolGetModulesDirs();
|
$modulesdir = dolGetModulesDirs();
|
||||||
|
|
||||||
foreach ($modulesdir as $dir)
|
foreach ($modulesdir as $dir)
|
||||||
{
|
{
|
||||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
|
||||||
//print $dir."\n<br>";
|
|
||||||
$handle = @opendir(dol_osencode($dir));
|
$handle = @opendir(dol_osencode($dir));
|
||||||
if (is_resource($handle))
|
if (is_resource($handle))
|
||||||
{
|
{
|
||||||
@ -102,7 +102,7 @@ foreach ($modulesdir as $dir)
|
|||||||
// Load all permissions
|
// Load all permissions
|
||||||
if ($objMod->rights_class)
|
if ($objMod->rights_class)
|
||||||
{
|
{
|
||||||
$ret = $objMod->insert_permissions(0);
|
$ret = $objMod->insert_permissions(0, $entity);
|
||||||
$modules[$objMod->rights_class] = $objMod;
|
$modules[$objMod->rights_class] = $objMod;
|
||||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||||
}
|
}
|
||||||
@ -122,35 +122,58 @@ dol_fiche_head($head, 'default', $langs->trans("Security"), -1);
|
|||||||
// Show warning about external users
|
// Show warning about external users
|
||||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||||
|
|
||||||
|
print "\n";
|
||||||
print '<div class="div-table-responsive-no-min">';
|
print '<div class="div-table-responsive-no-min">';
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
|
|
||||||
// Show permissions lines
|
print '<tr class="liste_titre">';
|
||||||
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
|
print '<td>'.$langs->trans("Module").'</td>';
|
||||||
|
print '<td class="center"> </td>';
|
||||||
|
print '<td class="center">'.$langs->trans("Default").'</td>';
|
||||||
|
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
|
||||||
|
$sql = "SELECT r.id, r.libelle as label, r.module, r.module_position, r.perms, r.subperms, r.bydefault";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||||
$sql .= " AND entity = ".$conf->entity;
|
$sql .= " AND r.entity = ".$entity;
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||||
$sql .= " ORDER BY r.module, r.id";
|
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$oldmod = "";
|
$oldmod = '';
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
|
|
||||||
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
// If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it
|
||||||
if (!$modules[$obj->module])
|
if (empty($modules[$obj->module]))
|
||||||
{
|
{
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save field module_position in database if value is still zero
|
||||||
|
if (empty($obj->module_position))
|
||||||
|
{
|
||||||
|
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
|
||||||
|
{
|
||||||
|
// TODO Define familyposition
|
||||||
|
$family = $modules[$obj->module]->family_position;
|
||||||
|
$familyposition = 0;
|
||||||
|
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.",";
|
||||||
|
$sqlupdate.= " family_position = ".$familyposition;
|
||||||
|
$sqlupdate.= " WHERE module_position = 0 AND module = '".$db->escape($obj->module)."'";
|
||||||
|
$db->query($sqlupdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if permission we found is inside a module definition. If not, we discard it.
|
// Check if permission we found is inside a module definition. If not, we discard it.
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($modules[$obj->module]->rights as $key => $val)
|
foreach ($modules[$obj->module]->rights as $key => $val)
|
||||||
@ -169,49 +192,65 @@ if ($result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Break found, it's a new module to catch
|
// Break found, it's a new module to catch
|
||||||
if ($oldmod <> $obj->module)
|
if (isset($obj->module) && ($oldmod <> $obj->module))
|
||||||
{
|
{
|
||||||
$oldmod = $obj->module;
|
$oldmod = $obj->module;
|
||||||
|
|
||||||
|
// Break detected, we get objMod
|
||||||
$objMod = $modules[$obj->module];
|
$objMod = $modules[$obj->module];
|
||||||
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
// Show break line
|
||||||
print '<td>'.$langs->trans("Module").'</td>';
|
print '<tr class="oddeven trforbreak">';
|
||||||
print '<td>'.$langs->trans("Permission").'</td>';
|
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
|
||||||
print '<td class="center">'.$langs->trans("Default").'</td>';
|
print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||||
print '<td align="center"> </td>';
|
print '<a name="'.$objMod->getName().'"></a>';
|
||||||
print "</tr>\n";
|
print '</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label));
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>';
|
|
||||||
print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
// Picto and label of module
|
||||||
print '<a name="'.$objMod->getName().'"> </a>';
|
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
|
||||||
|
//print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||||
|
//print '<a name="'.$objMod->getName().'"> </a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->libelle));
|
// Tick
|
||||||
print '<td>'.$perm_libelle.'</td>';
|
|
||||||
|
|
||||||
print '<td class="center">';
|
|
||||||
if ($obj->bydefault == 1)
|
if ($obj->bydefault == 1)
|
||||||
{
|
{
|
||||||
print img_picto($langs->trans("Active"), 'tick');
|
print '<td>';
|
||||||
print '</td><td>';
|
|
||||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print img_picto($langs->trans("Active"), 'tick');
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ' ';
|
print '<td>';
|
||||||
print '</td><td>';
|
|
||||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="center">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</td></tr>';
|
// Permission and tick
|
||||||
|
print '<td>'.$perm_libelle.'</td>';
|
||||||
|
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|||||||
@ -271,7 +271,7 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/propale/");
|
$dir = dol_buildpath($reldir."core/modules/propale");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.'/'.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
@ -399,7 +399,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/propale".$valdir);
|
$realpath = $reldir."core/modules/propale".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -474,6 +475,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -221,7 +221,7 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/reception/");
|
$dir = dol_buildpath($reldir."core/modules/reception");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -234,7 +234,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.'/'.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
@ -353,7 +353,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/reception".$valdir);
|
$realpath = $reldir."core/modules/reception".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -427,6 +428,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -70,8 +70,8 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
|||||||
|
|
||||||
elseif ($action == 'updateform')
|
elseif ($action == 'updateform')
|
||||||
{
|
{
|
||||||
$res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"], 'chaine', 0, '', $conf->entity);
|
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
$res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"], 'chaine', 0, '', $conf->entity);
|
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors"));
|
$langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors"));
|
||||||
|
|
||||||
|
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||||
|
|
||||||
if (!$user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
@ -46,14 +48,13 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'update' && empty($_POST["cancel"]))
|
if ($action == 'update' && !$cancel)
|
||||||
{
|
{
|
||||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", $_POST["MAIN_DISABLE_ALL_SMS"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", GETPOST("MAIN_DISABLE_ALL_SMS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", $_POST["MAIN_SMS_SENDMODE"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphahtml'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", $_POST["MAIN_MAIL_SMS_FROM"], 'chaine', 0, '', $conf->entity);
|
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", GETPOST("MAIN_MAIL_SMS_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||||
//dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", $_POST["MAIN_MAIL_AUTOCOPY_TO"], 'chaine', 0, '', $conf->entity);
|
|
||||||
|
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||||
exit;
|
exit;
|
||||||
@ -68,15 +69,15 @@ if ($action == 'send' && !$_POST['cancel'])
|
|||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
$smsfrom = '';
|
$smsfrom = '';
|
||||||
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms");
|
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms", 'alphanohtml');
|
||||||
if (empty($smsfrom)) $smsfrom = GETPOST("fromname");
|
if (empty($smsfrom)) $smsfrom = GETPOST("fromname", 'alphanohtml');
|
||||||
$sendto = GETPOST("sendto");
|
$sendto = GETPOST("sendto", 'alphanohtml');
|
||||||
$body = GETPOST('message');
|
$body = GETPOST('message', 'alphanohtml');
|
||||||
$deliveryreceipt = GETPOST("deliveryreceipt");
|
$deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml');
|
||||||
$deferred = GETPOST('deferred');
|
$deferred = GETPOST('deferred', 'alphanohtml');
|
||||||
$priority = GETPOST('priority');
|
$priority = GETPOST('priority', 'alphanohtml');
|
||||||
$class = GETPOST('class');
|
$class = GETPOST('class', 'alphanohtml');
|
||||||
$errors_to = GETPOST("errorstosms");
|
$errors_to = GETPOST("errorstosms", 'alphanohtml');
|
||||||
|
|
||||||
// Create form object
|
// Create form object
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
|
||||||
|
|||||||
@ -50,18 +50,20 @@ $action = GETPOST('action', 'aZ09');
|
|||||||
// Action mise a jour ou ajout d'une constante
|
// Action mise a jour ou ajout d'une constante
|
||||||
if ($action == 'update' || $action == 'add')
|
if ($action == 'update' || $action == 'add')
|
||||||
{
|
{
|
||||||
$constname=GETPOST("constname");
|
$constnamearray = GETPOST("constname", 'array');
|
||||||
$constvalue=GETPOST("constvalue");
|
$constvaluearray = GETPOST("constvalue", 'array');
|
||||||
|
$consttypearray = GETPOST("consttype", 'array');
|
||||||
|
$constnotearray = GETPOST("constnote", 'array');
|
||||||
|
|
||||||
// Action mise a jour ou ajout d'une constante
|
// Action mise a jour ou ajout d'une constante
|
||||||
if ($action == 'update' || $action == 'add')
|
if ($action == 'update' || $action == 'add')
|
||||||
{
|
{
|
||||||
foreach($_POST['constname'] as $key => $val)
|
foreach ($constnamearray as $key => $val)
|
||||||
{
|
{
|
||||||
$constname=$_POST["constname"][$key];
|
$constname = dol_escape_htmltag($constnamearray[$key]);
|
||||||
$constvalue=$_POST["constvalue"][$key];
|
$constvalue = dol_escape_htmltag($constvaluearray[$key]);
|
||||||
$consttype=$_POST["consttype"][$key];
|
$consttype = dol_escape_htmltag($consttypearray[$key]);
|
||||||
$constnote=$_POST["constnote"][$key];
|
$constnote = dol_escape_htmltag($constnotearray[$key]);
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
|
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
|
||||||
|
|
||||||
|
|||||||
@ -461,6 +461,7 @@ print "</tr>\n";
|
|||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
/*
|
||||||
print '<br>';
|
print '<br>';
|
||||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||||
{
|
{
|
||||||
@ -471,7 +472,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
// Example with a yes / no select
|
// Example with a yes / no select
|
||||||
/*print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
@ -481,10 +482,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL);
|
print $form->selectarray("INVENTORY_DISABLE_VIRTUAL", $arrval, $conf->global->INVENTORY_DISABLE_VIRTUAL);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
*/
|
|
||||||
|
|
||||||
// Example with a yes / no select
|
// Example with a yes / no select
|
||||||
/*print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
|
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
if ($conf->use_javascript_ajax) {
|
if ($conf->use_javascript_ajax) {
|
||||||
@ -494,7 +495,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA);
|
print $form->selectarray("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA", $arrval, $conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
*/
|
|
||||||
|
|
||||||
// Example with a yes / no select
|
// Example with a yes / no select
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
@ -507,8 +508,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
|||||||
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
|
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
/* I keep the option/feature, but hidden to end users for the moment. If feature is used by module, no need to have users see it.
|
||||||
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
|
||||||
|
|||||||
@ -90,7 +90,7 @@ if ($action == 'specimen') // For invoices
|
|||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$file = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/pdf_".$modele.".modules.php", 0);
|
$file = dol_buildpath($reldir."core/modules/supplier_invoice/doc/pdf_".$modele.".modules.php", 0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound = 1;
|
$filefound = 1;
|
||||||
@ -171,7 +171,7 @@ if ($action == 'setmod')
|
|||||||
if ($action == 'addcat')
|
if ($action == 'addcat')
|
||||||
{
|
{
|
||||||
$fourn = new Fournisseur($db);
|
$fourn = new Fournisseur($db);
|
||||||
$fourn->CreateCategory($user, $_POST["cat"]);
|
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||||
@ -230,7 +230,7 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
|
$dir = dol_buildpath($reldir."core/modules/supplier_invoice");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.'/'.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
@ -360,7 +360,8 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/pdf/");
|
$realpath = $reldir."core/modules/supplier_invoice/doc";
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -385,7 +386,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "<td>\n";
|
print "<td>\n";
|
||||||
require_once $dir.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db, $specimenthirdparty);
|
$module = new $classname($db, $specimenthirdparty);
|
||||||
if (method_exists($module, 'info')) print $module->info($langs);
|
if (method_exists($module, 'info')) print $module->info($langs);
|
||||||
else print $module->description;
|
else print $module->description;
|
||||||
@ -434,6 +435,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -88,7 +88,7 @@ elseif ($action == 'specimen') // For orders
|
|||||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$file = dol_buildpath($reldir."core/modules/supplier_order/pdf/pdf_".$modele.".modules.php", 0);
|
$file = dol_buildpath($reldir."core/modules/supplier_order/doc/pdf_".$modele.".modules.php", 0);
|
||||||
if (file_exists($file))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
$filefound = 1;
|
$filefound = 1;
|
||||||
@ -165,7 +165,7 @@ elseif ($action == 'setmod')
|
|||||||
elseif ($action == 'addcat')
|
elseif ($action == 'addcat')
|
||||||
{
|
{
|
||||||
$fourn = new Fournisseur($db);
|
$fourn = new Fournisseur($db);
|
||||||
$fourn->CreateCategory($user, $_POST["cat"]);
|
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
|
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||||
@ -390,7 +390,8 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
|
$realpath = $reldir."core/modules/supplier_order/doc";
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -413,7 +414,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "<td>\n";
|
print "<td>\n";
|
||||||
require_once $dir.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db, $specimenthirdparty);
|
$module = new $classname($db, $specimenthirdparty);
|
||||||
if (method_exists($module, 'info')) print $module->info($langs);
|
if (method_exists($module, 'info')) print $module->info($langs);
|
||||||
else print $module->description;
|
else print $module->description;
|
||||||
@ -458,6 +459,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -332,7 +332,8 @@ clearstatcache();
|
|||||||
|
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/");
|
$realpath = $reldir."core/modules/supplier_payment/doc";
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -356,7 +357,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
print (empty($module->name) ? $name : $module->name);
|
print (empty($module->name) ? $name : $module->name);
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "<td>\n";
|
print "<td>\n";
|
||||||
require_once $dir.$file;
|
require_once $dir.'/'.$file;
|
||||||
$module = new $classname($db, $specimenthirdparty);
|
$module = new $classname($db, $specimenthirdparty);
|
||||||
if (method_exists($module, 'info')) print $module->info($langs);
|
if (method_exists($module, 'info')) print $module->info($langs);
|
||||||
else print $module->description;
|
else print $module->description;
|
||||||
@ -405,6 +406,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
|
|||||||
@ -239,7 +239,7 @@ print '</tr>'."\n";
|
|||||||
clearstatcache();
|
clearstatcache();
|
||||||
foreach ($dirmodels as $reldir)
|
foreach ($dirmodels as $reldir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal/");
|
$dir = dol_buildpath($reldir."core/modules/supplier_proposal");
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -252,7 +252,7 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||||
|
|
||||||
require_once $dir.$file.'.php';
|
require_once $dir.'/'.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
@ -366,7 +366,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
foreach (array('', '/doc') as $valdir)
|
foreach (array('', '/doc') as $valdir)
|
||||||
{
|
{
|
||||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal".$valdir);
|
$realpath = $reldir."core/modules/supplier_proposal".$valdir;
|
||||||
|
$dir = dol_buildpath($realpath);
|
||||||
|
|
||||||
if (is_dir($dir))
|
if (is_dir($dir))
|
||||||
{
|
{
|
||||||
@ -440,6 +441,8 @@ foreach ($dirmodels as $reldir)
|
|||||||
{
|
{
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
}
|
}
|
||||||
|
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||||
|
|
||||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||||
|
|||||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
|
$langs->load("install");
|
||||||
|
$langs->load("errors");
|
||||||
|
|
||||||
if (! $user->admin)
|
if (! $user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -66,21 +68,123 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
|
$ErrorPicturePath = "../../theme/eldy/img/error.png";
|
||||||
|
$WarningPicturePath = "../../theme/eldy/img/warning.png";
|
||||||
|
$OkayPicturePath = "../../theme/eldy/img/tick.png";
|
||||||
|
|
||||||
// Get PHP version
|
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
|
||||||
$phpversion=version_php();
|
|
||||||
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
|
||||||
|
|
||||||
|
$arrayphpminversionerror = array(5,5,0);
|
||||||
|
$arrayphpminversionwarning = array(5,5,0);
|
||||||
|
if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0)
|
||||||
|
{
|
||||||
|
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror));
|
||||||
|
}
|
||||||
|
elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0)
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.versiontostring(versionphparray());
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>GET and POST support</td><td>';
|
||||||
|
|
||||||
|
if (! isset($_GET["testget"]) && ! isset($_POST["testpost"]) && ! isset($_GET["mainmenu"]))
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("PHPSupportPOSTGETKo");
|
||||||
|
print ' (<a href="'.$_SERVER["PHP_SELF"].'?testget=ok">'.$langs->trans("Recheck").'</a>)';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportPOSTGETOk");
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>Sessions support</td><td>';
|
||||||
|
|
||||||
|
if (! function_exists("session_id"))
|
||||||
|
{
|
||||||
|
print '<img src="'.$ErrorPicturePath.'" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportSessions");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportSessions");
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>GD support</td><td>';
|
||||||
|
|
||||||
|
if (! function_exists("imagecreate"))
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportGD");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportGD");
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>Curl support</td><td>';
|
||||||
|
|
||||||
|
if (! function_exists("curl_init"))
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportCurl");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportCurl");
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>UTF-8 support</td><td>';
|
||||||
|
|
||||||
|
if (! function_exists("utf8_encode"))
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportUTF8");
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
print '<tr><td>Intl support</td><td>';
|
||||||
|
|
||||||
|
if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost')
|
||||||
|
{
|
||||||
|
if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region"))
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupportIntl");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupportIntl");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr><td>Zip support</td><td>';
|
||||||
|
|
||||||
|
if (!class_exists('ZipArchive'))
|
||||||
|
{
|
||||||
|
print '<img src="'.$WarningPicturePath.'" alt="Warning"> '.$langs->trans("ErrorPHPDoesNotSupport", "Zip");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<img src="'.$OkayPicturePath.'" alt="Ok"> '.$langs->trans("PHPSupport", "Zip");
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get php_info array
|
// Get php_info array
|
||||||
$phparray=phpinfo_array();
|
$phparray=phpinfo_array();
|
||||||
foreach($phparray as $key => $value)
|
foreach($phparray as $key => $value)
|
||||||
|
|||||||
@ -209,7 +209,7 @@ print "</tr>\n";
|
|||||||
clearstatcache();
|
clearstatcache();
|
||||||
|
|
||||||
foreach ($dirmodels as $reldir) {
|
foreach ($dirmodels as $reldir) {
|
||||||
$dir = dol_buildpath($reldir."core/modules/ticket/");
|
$dir = dol_buildpath($reldir."core/modules/ticket");
|
||||||
|
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
|
|||||||
$file = $reg[1];
|
$file = $reg[1];
|
||||||
$classname = substr($file, 4);
|
$classname = substr($file, 4);
|
||||||
|
|
||||||
include_once $dir.$file.'.php';
|
include_once $dir.'/'.$file.'.php';
|
||||||
|
|
||||||
$module = new $file;
|
$module = new $file;
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
|||||||
$ok = 1;
|
$ok = 1;
|
||||||
foreach ($listfield as $f => $value)
|
foreach ($listfield as $f => $value)
|
||||||
{
|
{
|
||||||
if ($value == 'ref' && (! isset($_POST[$value]) || $_POST[$value]==''))
|
if ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == ''))
|
||||||
{
|
{
|
||||||
$ok = 0;
|
$ok = 0;
|
||||||
$fieldnamekey = $listfield[$f];
|
$fieldnamekey = $listfield[$f];
|
||||||
|
|||||||
@ -25,6 +25,8 @@
|
|||||||
* \file htdocs/api/admin/explorer.php
|
* \file htdocs/api/admin/explorer.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Luracast\Restler\Routes;
|
||||||
|
|
||||||
require_once '../../main.inc.php';
|
require_once '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
|
||||||
|
|||||||
@ -60,10 +60,9 @@ class Documents extends DolibarrApi
|
|||||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
* @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf)
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws 400
|
* @throws RestException 400
|
||||||
* @throws 401
|
* @throws RestException 401
|
||||||
* @throws 404
|
* @throws RestException 404
|
||||||
* @throws 200
|
|
||||||
*
|
*
|
||||||
* @url GET /download
|
* @url GET /download
|
||||||
*/
|
*/
|
||||||
@ -118,12 +117,11 @@ class Documents extends DolibarrApi
|
|||||||
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws 500
|
* @throws RestException 500
|
||||||
* @throws 501
|
* @throws RestException 501
|
||||||
* @throws 400
|
* @throws RestException 400
|
||||||
* @throws 401
|
* @throws RestException 401
|
||||||
* @throws 404
|
* @throws RestException 404
|
||||||
* @throws 200
|
|
||||||
*
|
*
|
||||||
* @url PUT /builddoc
|
* @url PUT /builddoc
|
||||||
*/
|
*/
|
||||||
@ -237,11 +235,10 @@ class Documents extends DolibarrApi
|
|||||||
* @param string $sortorder Sort order ('asc' or 'desc')
|
* @param string $sortorder Sort order ('asc' or 'desc')
|
||||||
* @return array Array of documents with path
|
* @return array Array of documents with path
|
||||||
*
|
*
|
||||||
* @throws 200
|
* @throws RestException 400
|
||||||
* @throws 400
|
* @throws RestException 401
|
||||||
* @throws 401
|
* @throws RestException 404
|
||||||
* @throws 404
|
* @throws RestException 500
|
||||||
* @throws 500
|
|
||||||
*
|
*
|
||||||
* @url GET /
|
* @url GET /
|
||||||
*/
|
*/
|
||||||
@ -275,6 +272,23 @@ class Documents extends DolibarrApi
|
|||||||
|
|
||||||
$upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
|
$upload_dir = $conf->societe->multidir_output[$object->entity]."/".$object->id;
|
||||||
}
|
}
|
||||||
|
elseif ($modulepart == 'user')
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
|
||||||
|
// Can get doc if has permission to read all user or if it is user itself
|
||||||
|
if (!DolibarrApiAccess::$user->rights->user->user->lire && DolibarrApiAccess::$user->id != $id) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object = new User($this->db);
|
||||||
|
$result = $object->fetch($id, $ref);
|
||||||
|
if (!$result) {
|
||||||
|
throw new RestException(404, 'User not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
$upload_dir = $conf->user->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id;
|
||||||
|
}
|
||||||
elseif ($modulepart == 'adherent' || $modulepart == 'member')
|
elseif ($modulepart == 'adherent' || $modulepart == 'member')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
@ -430,11 +444,10 @@ class Documents extends DolibarrApi
|
|||||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* @throws 200
|
* @throws RestException 400
|
||||||
* @throws 400
|
* @throws RestException 401
|
||||||
* @throws 401
|
* @throws RestException 404
|
||||||
* @throws 404
|
* @throws RestException 500
|
||||||
* @throws 500
|
|
||||||
*
|
*
|
||||||
* @url POST /upload
|
* @url POST /upload
|
||||||
*/
|
*/
|
||||||
@ -610,10 +623,9 @@ class Documents extends DolibarrApi
|
|||||||
* @param string $original_file Relative path with filename, relative to modulepart (for example: PRODUCT-REF-999/IMAGE-999.jpg)
|
* @param string $original_file Relative path with filename, relative to modulepart (for example: PRODUCT-REF-999/IMAGE-999.jpg)
|
||||||
* @return array List of documents
|
* @return array List of documents
|
||||||
*
|
*
|
||||||
* @throws 400
|
* @throws RestException 400
|
||||||
* @throws 401
|
* @throws RestException 401
|
||||||
* @throws 404
|
* @throws RestException 404
|
||||||
* @throws 200
|
|
||||||
*
|
*
|
||||||
* @url DELETE /
|
* @url DELETE /
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -48,9 +48,8 @@ class Login
|
|||||||
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
|
||||||
* @return array Response status and user token
|
* @return array Response status and user token
|
||||||
*
|
*
|
||||||
* @throws 200
|
* @throws RestException 403
|
||||||
* @throws 403
|
* @throws RestException 500
|
||||||
* @throws 500
|
|
||||||
*
|
*
|
||||||
* @url GET /
|
* @url GET /
|
||||||
* @url POST /
|
* @url POST /
|
||||||
|
|||||||
@ -59,8 +59,7 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return array [List of ordering methods]
|
* @return array [List of ordering methods]
|
||||||
*
|
*
|
||||||
* @throws 400 RestException
|
* @throws RestException 400
|
||||||
* @throws 200 OK
|
|
||||||
*/
|
*/
|
||||||
public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
@ -121,8 +120,7 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return array [List of payment types]
|
* @return array [List of payment types]
|
||||||
*
|
*
|
||||||
* @throws 400 RestException
|
* @throws RestException 400
|
||||||
* @throws 200 OK
|
|
||||||
*/
|
*/
|
||||||
public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
@ -339,8 +337,7 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return array [List of availability]
|
* @return array [List of availability]
|
||||||
*
|
*
|
||||||
* @throws 400 RestException
|
* @throws RestException 400
|
||||||
* @throws 200 OK
|
|
||||||
*/
|
*/
|
||||||
public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
@ -908,8 +905,7 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return array List of payment terms
|
* @return array List of payment terms
|
||||||
*
|
*
|
||||||
* @throws 400 RestException
|
* @throws RestException 400
|
||||||
* @throws 200 OK
|
|
||||||
*/
|
*/
|
||||||
public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
@ -969,8 +965,7 @@ class Setup extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @return array List of shipping methods
|
* @return array List of shipping methods
|
||||||
*
|
*
|
||||||
* @throws 400 RestException
|
* @throws RestException 400
|
||||||
* @throws 200 OK
|
|
||||||
*/
|
*/
|
||||||
public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -82,7 +82,7 @@ class Asset extends CommonObject
|
|||||||
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
|
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",),
|
||||||
'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
||||||
'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",),
|
||||||
'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
|
'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",),
|
||||||
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
|
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,),
|
||||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
|
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,),
|
||||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),
|
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,),
|
||||||
|
|||||||
@ -70,6 +70,17 @@ class AssetType extends CommonObject
|
|||||||
/** @var array Array of asset */
|
/** @var array Array of asset */
|
||||||
public $asset = array();
|
public $asset = array();
|
||||||
|
|
||||||
|
public $fields = array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20),
|
||||||
|
'label' =>array('type'=>'varchar(50)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25, 'showoncombobox'=>1),
|
||||||
|
'accountancy_code_asset' =>array('type'=>'varchar(32)', 'label'=>'Accountancy code asset', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||||
|
'accountancy_code_depreciation_asset' =>array('type'=>'varchar(32)', 'label'=>'Accountancy code depreciation asset', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
|
||||||
|
'accountancy_code_depreciation_expense' =>array('type'=>'varchar(32)', 'label'=>'Accountancy code depreciation expense', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
|
'note' =>array('type'=>'mediumtext', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
|||||||
@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
|
|||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("assets"));
|
$langs->loadLangs(array("assets"));
|
||||||
|
|
||||||
$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
||||||
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
||||||
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
||||||
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
||||||
@ -50,7 +50,7 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|||||||
$sortfield = GETPOST('sortfield', 'alpha');
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
$sortorder = GETPOST('sortorder', 'alpha');
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
$page = GETPOST('page', 'int');
|
$page = GETPOST('page', 'int');
|
||||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||||
$offset = $limit * $page;
|
$offset = $limit * $page;
|
||||||
$pageprev = $page - 1;
|
$pageprev = $page - 1;
|
||||||
$pagenext = $page + 1;
|
$pagenext = $page + 1;
|
||||||
@ -63,6 +63,7 @@ $hookmanager->initHooks(array('assetlist')); // Note that conf->hooks_modules co
|
|||||||
|
|
||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
//$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
|
||||||
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
||||||
|
|
||||||
@ -70,9 +71,9 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
|||||||
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
||||||
if (!$sortorder) $sortorder = "ASC";
|
if (!$sortorder) $sortorder = "ASC";
|
||||||
|
|
||||||
// Protection if external user
|
// Security check
|
||||||
$socid = 0;
|
$socid = 0;
|
||||||
if ($user->socid > 0)
|
if ($user->socid > 0) // Protection if external user
|
||||||
{
|
{
|
||||||
//$socid = $user->socid;
|
//$socid = $user->socid;
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -84,7 +85,7 @@ $search_all = trim(GETPOST("search_all", 'alpha'));
|
|||||||
$search = array();
|
$search = array();
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
|
if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
@ -99,26 +100,33 @@ $arrayfields = array();
|
|||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
// If $val['visible']==0, then we never show the field
|
// If $val['visible']==0, then we never show the field
|
||||||
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||||
{
|
{
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
|
||||||
{
|
{
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
|
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||||
$arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
|
$arrayfields["ef.".$key] = array(
|
||||||
|
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||||
|
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
|
||||||
|
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||||
|
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
|
$permissiontoread = $user->rights->asset->read;
|
||||||
|
$permissiontoadd = $user->rights->asset->write;
|
||||||
|
$permissiontodelete = $user->rights->asset->delete;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*
|
|
||||||
* Put here all code to do according to value of "$action" parameter
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
||||||
@ -152,8 +160,6 @@ if (empty($reshook))
|
|||||||
// Mass actions
|
// Mass actions
|
||||||
$objectclass = 'Asset';
|
$objectclass = 'Asset';
|
||||||
$objectlabel = 'Asset';
|
$objectlabel = 'Asset';
|
||||||
$permissiontoread = $user->rights->asset->read;
|
|
||||||
$permissiontodelete = $user->rights->asset->delete;
|
|
||||||
$uploaddir = $conf->asset->dir_output;
|
$uploaddir = $conf->asset->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
@ -162,8 +168,6 @@ if (empty($reshook))
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*
|
|
||||||
* Put here all code to render page
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
@ -183,23 +187,30 @@ foreach ($object->fields as $key => $val)
|
|||||||
$sql .= 't.'.$key.', ';
|
$sql .= 't.'.$key.', ';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||||
|
}
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
|
||||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('assets').")";
|
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||||
else $sql .= " WHERE 1 = 1";
|
else $sql .= " WHERE 1 = 1";
|
||||||
foreach ($search as $key => $val)
|
foreach ($search as $key => $val)
|
||||||
{
|
{
|
||||||
|
if ($key == 'status' && $search[$key] == -1) continue;
|
||||||
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
||||||
|
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
||||||
|
if ($search[$key] == '-1') $search[$key] = '';
|
||||||
|
$mode_search = 2;
|
||||||
|
}
|
||||||
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
||||||
}
|
}
|
||||||
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||||
|
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
@ -216,10 +227,12 @@ foreach($object->fields as $key => $val)
|
|||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||||
|
}
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
|
$sql=preg_replace('/,\s*$/','', $sql);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$sql .= $db->order($sortfield, $sortorder);
|
$sql .= $db->order($sortfield, $sortorder);
|
||||||
@ -228,16 +241,22 @@ $sql .= $db->order($sortfield, $sortorder);
|
|||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
{
|
{
|
||||||
$result = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$nbtotalofrecords = $db->num_rows($result);
|
$nbtotalofrecords = $db->num_rows($resql);
|
||||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||||
{
|
{
|
||||||
$page = 0;
|
$page = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||||
$sql .= $db->plimit($limit + 1, $offset);
|
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
|
||||||
|
{
|
||||||
|
$num = $nbtotalofrecords;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
@ -247,9 +266,10 @@ if (!$resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
}
|
||||||
|
|
||||||
// Direct jump if only one record found
|
// Direct jump if only one record found
|
||||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
@ -285,7 +305,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&co
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
foreach ($search as $key => $val)
|
foreach ($search as $key => $val)
|
||||||
{
|
{
|
||||||
$param .= '&search_'.$key.'='.urlencode($search[$key]);
|
if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
|
||||||
|
else $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
||||||
}
|
}
|
||||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||||
// Add $param from extra fields
|
// Add $param from extra fields
|
||||||
@ -296,19 +317,11 @@ $arrayofmassactions = array(
|
|||||||
//'presend'=>$langs->trans("SendByMail"),
|
//'presend'=>$langs->trans("SendByMail"),
|
||||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||||
);
|
);
|
||||||
if ($user->rights->asset->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||||
if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
$newcardbutton = '';
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
||||||
if ($user->rights->asset->write)
|
|
||||||
{
|
|
||||||
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/asset/card.php?action=create"><span class="valignmiddle text-plus-circle">'.$langs->trans('NewAsset').'</span>';
|
|
||||||
$newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
|
||||||
$newcardbutton .= '</a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
|
||||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||||
@ -318,6 +331,8 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|||||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||||
|
|
||||||
|
$newcardbutton = dolGetButtonTitle($langs->trans('NewAsset'), '', 'fa fa-plus-circle', dol_buildpath('/asset/card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
|
||||||
|
|
||||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accountancy', 0, $newcardbutton, '', $limit);
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accountancy', 0, $newcardbutton, '', $limit);
|
||||||
|
|
||||||
// Add code for pre mass action (confirmation or email presend form)
|
// Add code for pre mass action (confirmation or email presend form)
|
||||||
@ -363,11 +378,21 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$align = '';
|
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align .= ($align ? ' ' : '').'center';
|
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if (in_array($val['type'], array('timestamp'))) $align .= ($align ? ' ' : '').'nowrap';
|
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if ($key == 'status') $align .= ($align ? ' ' : '').'center';
|
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
|
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||||
|
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||||
|
{
|
||||||
|
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||||
|
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||||
|
elseif (strpos($val['type'], 'integer:') === 0) {
|
||||||
|
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||||
|
}
|
||||||
|
elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||||
@ -389,11 +414,15 @@ print '</tr>'."\n";
|
|||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$align='';
|
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n";
|
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||||
|
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||||
|
{
|
||||||
|
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||||
@ -401,18 +430,18 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
|||||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
|
// Action column
|
||||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
|
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
|
||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
|
||||||
// Detect if we need a fetch on each output line
|
// Detect if we need a fetch on each output line
|
||||||
$needToFetchEachLine = 0;
|
$needToFetchEachLine = 0;
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['computed'])) {
|
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
|
||||||
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
|
{
|
||||||
if (preg_match('/\$object/', $val)) {
|
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
|
||||||
// There is at least one compute field that use $object
|
{
|
||||||
$needToFetchEachLine++;
|
if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,84 +450,65 @@ if (is_array($extrafields->attributes[$object->table_element]['computed'])) {
|
|||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
while ($i < min($num, $limit))
|
while ($i < ($limit ? min($num, $limit) : $num))
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
if (empty($obj)) break; // Should not happen
|
if (empty($obj)) break; // Should not happen
|
||||||
|
|
||||||
// Store properties in $object
|
// Store properties in $object
|
||||||
$object->id = $obj->rowid;
|
$object->setVarsFromFetchObj($obj);
|
||||||
foreach($object->fields as $key => $val)
|
|
||||||
{
|
|
||||||
if (property_exists($obj, $key)) $object->$key = $obj->$key;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show here line of result
|
// Show here line of result
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
foreach ($object->fields as $key => $val)
|
foreach ($object->fields as $key => $val)
|
||||||
{
|
{
|
||||||
$align='';
|
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center';
|
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap';
|
elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||||
if ($key == 'status') $align.=($align?' ':'').'center';
|
|
||||||
|
if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
|
elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||||
|
|
||||||
|
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||||
|
|
||||||
if (!empty($arrayfields['t.'.$key]['checked']))
|
if (!empty($arrayfields['t.'.$key]['checked']))
|
||||||
{
|
{
|
||||||
print '<td';
|
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||||
if ($align) print ' class="'.$align.'"';
|
if ($key == 'status') print $object->getLibStatut(5);
|
||||||
print '>';
|
else print $object->showOutputField($val, $key, $object->$key, '');
|
||||||
print $object->showOutputField($val, $key, $obj->$key, '');
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!empty($val['isameasure']))
|
if (!empty($val['isameasure']))
|
||||||
{
|
{
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||||
$totalarray['val']['t.'.$key] += $obj->$key;
|
$totalarray['val']['t.'.$key] += $object->$key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Extra fields
|
// Extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||||
print $hookmanager->resPrint;
|
print $hookmanager->resPrint;
|
||||||
// Action column
|
// Action column
|
||||||
print '<td class="nowrap" align="center">';
|
print '<td class="nowrap center">';
|
||||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||||
{
|
{
|
||||||
$selected = 0;
|
$selected = 0;
|
||||||
if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
|
if (in_array($object->id, $arrayofselected)) $selected = 1;
|
||||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>'."\n";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show total line
|
// Show total line
|
||||||
if (isset($totalarray['pos']))
|
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||||
{
|
|
||||||
print '<tr class="liste_total">';
|
|
||||||
$i = 0;
|
|
||||||
while ($i < $totalarray['nbfield'])
|
|
||||||
{
|
|
||||||
$i++;
|
|
||||||
if (!empty($totalarray['pos'][$i])) print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($i == 1)
|
|
||||||
{
|
|
||||||
if ($num < $limit) print '<td class="left">'.$langs->trans("Total").'</td>';
|
|
||||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
|
||||||
}
|
|
||||||
else print '<td></td>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no record found
|
// If no record found
|
||||||
if ($num == 0)
|
if ($num == 0)
|
||||||
@ -522,8 +532,9 @@ print '</form>'."\n";
|
|||||||
|
|
||||||
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
|
||||||
{
|
{
|
||||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
|
$hidegeneratedfilelistifempty = 1;
|
||||||
{
|
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
$formfile = new FormFile($db);
|
$formfile = new FormFile($db);
|
||||||
|
|
||||||
@ -532,16 +543,11 @@ if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $n
|
|||||||
$urlsource .= str_replace('&', '&', $param);
|
$urlsource .= str_replace('&', '&', $param);
|
||||||
|
|
||||||
$filedir = $diroutputmassaction;
|
$filedir = $diroutputmassaction;
|
||||||
$genallowed = $user->rights->asset->read;
|
$genallowed = $permissiontoread;
|
||||||
$delallowed = $user->rights->asset->create;
|
$delallowed = $permissiontoadd;
|
||||||
|
|
||||||
print $formfile->showdocuments('massfilesarea_asset', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '');
|
print $formfile->showdocuments('massfilesarea_asset', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '');
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -609,37 +609,15 @@ if ($rowid > 0)
|
|||||||
print $object->showOptionals($extrafields, 'edit', $parameters);
|
print $object->showOptionals($extrafields, 'edit', $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
// Other attributes
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
|
||||||
|
|
||||||
// Extra field
|
print '</table>';
|
||||||
if (empty($reshook))
|
|
||||||
{
|
|
||||||
print '<br><br><table class="border centpercent">';
|
|
||||||
foreach ($extrafields->attributes[$object->element]['label'] as $key=>$label)
|
|
||||||
{
|
|
||||||
if (isset($_POST["options_".$key])) {
|
|
||||||
if (is_array($_POST["options_".$key])) {
|
|
||||||
// $_POST["options"] is an array but following code expects a comma separated string
|
|
||||||
$value = implode(",", $_POST["options_".$key]);
|
|
||||||
} else {
|
|
||||||
$value = $_POST["options_".$key];
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$value = $adht->array_options["options_".$key];
|
|
||||||
}
|
|
||||||
print '<tr><td width="30%">'.$label.'</td><td>';
|
|
||||||
print $extrafields->showInputField($key, $value);
|
|
||||||
print "</td></tr>\n";
|
|
||||||
}
|
|
||||||
print '</table><br><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
print ' <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||||
print ' ';
|
|
||||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print "</form>";
|
print "</form>";
|
||||||
|
|||||||
@ -40,6 +40,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$reg = array();
|
||||||
if (preg_match('/set_(.*)/', $action, $reg))
|
if (preg_match('/set_(.*)/', $action, $reg))
|
||||||
{
|
{
|
||||||
$code = $reg[1];
|
$code = $reg[1];
|
||||||
|
|||||||
@ -109,7 +109,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(isset($_POST["qty"]) ?GETPOST("qty", 'alpha', 2) : 1).'">';
|
print '<td class="bordertop nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(GETPOSTISSET("qty") ? GETPOST("qty", 'alpha', 2) : 1).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($conf->global->PRODUCT_USE_UNITS)
|
if ($conf->global->PRODUCT_USE_UNITS)
|
||||||
@ -141,7 +141,7 @@ print '</td>';
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (is_object($objectline)) {
|
if (is_object($objectline)) {
|
||||||
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1);
|
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@ print '</td>';
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
if (is_object($objectline)) {
|
if (is_object($objectline)) {
|
||||||
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1);
|
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
|
print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";
|
||||||
|
|||||||
@ -156,7 +156,7 @@ print '</tr>';
|
|||||||
//Line extrafield
|
//Line extrafield
|
||||||
if (!empty($extrafields))
|
if (!empty($extrafields))
|
||||||
{
|
{
|
||||||
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1);
|
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
|
print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";
|
||||||
|
|||||||
@ -21,132 +21,6 @@
|
|||||||
* \brief File with library for bookmark module
|
* \brief File with library for bookmark module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Add area with bookmarks in menu
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function printBookmarksList()
|
|
||||||
{
|
|
||||||
global $conf, $user, $db, $langs;
|
|
||||||
|
|
||||||
$ret = '<div class="menu_top"></div>'."\n";
|
|
||||||
|
|
||||||
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
|
||||||
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
|
|
||||||
|
|
||||||
$langs->load("bookmarks");
|
|
||||||
|
|
||||||
$url= $_SERVER["PHP_SELF"];
|
|
||||||
|
|
||||||
if (! empty($_SERVER["QUERY_STRING"]))
|
|
||||||
{
|
|
||||||
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
global $sortfield,$sortorder;
|
|
||||||
$tmpurl='';
|
|
||||||
// No urlencode, all param $url will be urlencoded later
|
|
||||||
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
|
|
||||||
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
|
|
||||||
if (is_array($_POST))
|
|
||||||
{
|
|
||||||
foreach($_POST as $key => $val)
|
|
||||||
{
|
|
||||||
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$url.=($tmpurl?'?'.$tmpurl:'');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Menu bookmark
|
|
||||||
$ret = '<div class="menu_top"></div>'."\n";
|
|
||||||
|
|
||||||
$ret.= '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
|
||||||
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
|
|
||||||
$ret.= '<input type="hidden" name="token" value="'.newToken().'">';
|
|
||||||
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo" alt="Bookmarks">';
|
|
||||||
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
|
||||||
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
|
||||||
$ret.= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
|
||||||
$ret.= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
|
||||||
// Url to go on create new bookmark page
|
|
||||||
if (! empty($user->rights->bookmark->creer))
|
|
||||||
{
|
|
||||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
|
||||||
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
|
||||||
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
|
|
||||||
$ret.= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.$langs->trans('AddThisPageToBookmarks').'...').'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks').'...').'</option>';
|
|
||||||
}
|
|
||||||
// Menu with all bookmarks
|
|
||||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
|
||||||
{
|
|
||||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
|
||||||
$sql.= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
|
||||||
$sql.= " AND entity IN (".getEntity('bookmarks').")";
|
|
||||||
$sql.= " ORDER BY position";
|
|
||||||
if ($resql = $db->query($sql) )
|
|
||||||
{
|
|
||||||
$i=0;
|
|
||||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
|
||||||
{
|
|
||||||
$ret.='<option name="bookmark'.$obj->rowid.'" value="'.$obj->rowid.'" '.($obj->target == 1?' target="_blank"':'').' rel="'.dol_escape_htmltag($obj->url).'"';
|
|
||||||
//$ret.=' data-html="'.dol_escape_htmltag('<span class="fa fa-print"></span> '.$obj->title).'"';
|
|
||||||
$ret.='>';
|
|
||||||
$ret.=dol_escape_htmltag($obj->title);
|
|
||||||
$ret.='</option>';
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret.= '</select>';
|
|
||||||
$ret.= '</form>';
|
|
||||||
|
|
||||||
$ret.=ajax_combobox('boxbookmark');
|
|
||||||
|
|
||||||
$ret.='<script>
|
|
||||||
$(document).ready(function () {';
|
|
||||||
$ret.=' jQuery("#boxbookmark").change(function() {
|
|
||||||
var urlselected = jQuery("#boxbookmark option:selected").attr("rel");
|
|
||||||
if (! urlselected) console.log("Error, failed to get the URL to jump to from the rel attribute");
|
|
||||||
var urltarget = jQuery("#boxbookmark option:selected").attr("target");
|
|
||||||
if (! urltarget) { urltarget=""; }
|
|
||||||
jQuery("form#actionbookmark").attr("target",urltarget);
|
|
||||||
jQuery("form#actionbookmark").attr("action",urlselected);
|
|
||||||
|
|
||||||
console.log("We change select bookmark. We choose urlselected="+urlselected+" with target="+urltarget);
|
|
||||||
|
|
||||||
// Method is POST for internal link, GET for external
|
|
||||||
if (urlselected.startsWith(\'http\'))
|
|
||||||
{
|
|
||||||
var newmethod=\'GET\';
|
|
||||||
jQuery("form#actionbookmark").attr("method", newmethod);
|
|
||||||
console.log("We change method to newmethod="+newmethod);
|
|
||||||
jQuery("#actionbookmark").submit();
|
|
||||||
console.log("We restore method to POST");
|
|
||||||
jQuery("form#actionbookmark").attr("method", \'POST\');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jQuery("#actionbookmark").submit();
|
|
||||||
}
|
|
||||||
});';
|
|
||||||
$ret.='})</script>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret.= '<div class="menu_end"></div>'."\n";
|
|
||||||
|
|
||||||
return $ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add area with bookmarks in top menu
|
* Add area with bookmarks in top menu
|
||||||
@ -158,7 +32,6 @@ function printDropdownBookmarksList()
|
|||||||
global $conf, $user, $db, $langs;
|
global $conf, $user, $db, $langs;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||||
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
|
|
||||||
|
|
||||||
$langs->load("bookmarks");
|
$langs->load("bookmarks");
|
||||||
|
|
||||||
@ -204,11 +77,8 @@ function printDropdownBookmarksList()
|
|||||||
$newbtn .= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
$newbtn .= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$bookmarkList = '<div id="dropdown-bookmarks-list" >';
|
$bookmarkList = '<div id="dropdown-bookmarks-list" >';
|
||||||
// Menu with all bookmarks
|
// Menu with list of bookmarks
|
||||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU))
|
|
||||||
{
|
|
||||||
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
|
||||||
$sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
$sql .= " WHERE (fk_user = ".$user->id." OR fk_user is NULL OR fk_user = 0)";
|
||||||
$sql .= " AND entity IN (".getEntity('bookmarks').")";
|
$sql .= " AND entity IN (".getEntity('bookmarks').")";
|
||||||
@ -216,7 +86,7 @@ function printDropdownBookmarksList()
|
|||||||
if ($resql = $db->query($sql))
|
if ($resql = $db->query($sql))
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $conf->global->BOOKMARKS_SHOW_IN_MENU && $obj = $db->fetch_object($resql))
|
while (($conf->global->BOOKMARKS_SHOW_IN_MENU == 0 || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
|
$bookmarkList .= '<a class="dropdown-item bookmark-item" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
|
||||||
$bookmarkList .= dol_escape_htmltag($obj->title);
|
$bookmarkList .= dol_escape_htmltag($obj->title);
|
||||||
@ -228,18 +98,14 @@ function printDropdownBookmarksList()
|
|||||||
{
|
{
|
||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$bookmarkList .= '</div>';
|
$bookmarkList .= '</div>';
|
||||||
|
|
||||||
$html= '';
|
$html = '
|
||||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
|
|
||||||
$html.= '
|
|
||||||
<!-- search input -->
|
<!-- search input -->
|
||||||
<div class="dropdown-header bookmark-header">
|
<div class="dropdown-header bookmark-header">
|
||||||
' . $searchForm.'
|
' . $searchForm.'
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
}
|
|
||||||
|
|
||||||
$html .= '
|
$html .= '
|
||||||
<!-- Menu Body -->
|
<!-- Menu Body -->
|
||||||
@ -256,7 +122,6 @@ function printDropdownBookmarksList()
|
|||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) {
|
|
||||||
$html .= '<script>
|
$html .= '<script>
|
||||||
$( document ).on("keyup", "#top-bookmark-search-input", function () {
|
$( document ).on("keyup", "#top-bookmark-search-input", function () {
|
||||||
|
|
||||||
@ -273,7 +138,6 @@ function printDropdownBookmarksList()
|
|||||||
$("#top-bookmark-search-filter-count").text(count);
|
$("#top-bookmark-search-filter-count").text(count);
|
||||||
});
|
});
|
||||||
</script>';
|
</script>';
|
||||||
}
|
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ for ($i = 0; $i < $nbtoshow; $i++)
|
|||||||
|
|
||||||
$buyer = new Societe($db);
|
$buyer = new Societe($db);
|
||||||
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
if ($_SESSION["CASHDESK_ID_THIRDPARTY"] > 0) $buyer->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]);
|
||||||
echo $form->load_tva('selTva', (isset($_POST["selTva"])?GETPOST("selTva", 'alpha', 2):$vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
|
echo $form->load_tva('selTva', (GETPOSTISSET("selTva") ? GETPOST("selTva", 'alpha', 2) : $vatrate), $mysoc, $buyer, 0, 0, '', false, -1);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|||||||
@ -48,6 +48,11 @@ class Categories extends DolibarrApi
|
|||||||
3 => 'member',
|
3 => 'member',
|
||||||
4 => 'contact',
|
4 => 'contact',
|
||||||
5 => 'account',
|
5 => 'account',
|
||||||
|
//6 => 'project',
|
||||||
|
//7 => 'user',
|
||||||
|
//8 => 'bank_line',
|
||||||
|
//9 => 'warehouse',
|
||||||
|
//10 => 'actioncomm',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -54,6 +54,7 @@ class Categorie extends CommonObject
|
|||||||
const TYPE_ACCOUNT = 'bank_account';
|
const TYPE_ACCOUNT = 'bank_account';
|
||||||
const TYPE_BANK_LINE = 'bank_line';
|
const TYPE_BANK_LINE = 'bank_line';
|
||||||
const TYPE_WAREHOUSE = 'warehouse';
|
const TYPE_WAREHOUSE = 'warehouse';
|
||||||
|
const TYPE_ACTIONCOMM = 'actioncomm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||||
@ -77,6 +78,7 @@ class Categorie extends CommonObject
|
|||||||
'user' => 7,
|
'user' => 7,
|
||||||
'bank_line' => 8,
|
'bank_line' => 8,
|
||||||
'warehouse' => 9,
|
'warehouse' => 9,
|
||||||
|
'actioncomm' => 10,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,6 +95,7 @@ class Categorie extends CommonObject
|
|||||||
7 => 'user',
|
7 => 'user',
|
||||||
8 => 'bank_line',
|
8 => 'bank_line',
|
||||||
9 => 'warehouse',
|
9 => 'warehouse',
|
||||||
|
10 => 'actioncomm',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,6 +114,7 @@ class Categorie extends CommonObject
|
|||||||
'bank_account' => 'account',
|
'bank_account' => 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
'warehouse'=> 'warehouse',
|
'warehouse'=> 'warehouse',
|
||||||
|
'actioncomm' => 'actioncomm',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,6 +133,7 @@ class Categorie extends CommonObject
|
|||||||
'bank_account'=> 'account',
|
'bank_account'=> 'account',
|
||||||
'project' => 'project',
|
'project' => 'project',
|
||||||
'warehouse'=> 'warehouse',
|
'warehouse'=> 'warehouse',
|
||||||
|
'actioncomm' => 'actioncomm',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,6 +152,7 @@ class Categorie extends CommonObject
|
|||||||
'bank_account' => 'Account',
|
'bank_account' => 'Account',
|
||||||
'project' => 'Project',
|
'project' => 'Project',
|
||||||
'warehouse'=> 'Entrepot',
|
'warehouse'=> 'Entrepot',
|
||||||
|
'actioncomm' => 'ActionComm',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,6 +170,7 @@ class Categorie extends CommonObject
|
|||||||
'account' => 'bank_account',
|
'account' => 'bank_account',
|
||||||
'project' => 'projet',
|
'project' => 'projet',
|
||||||
'warehouse'=> 'entrepot',
|
'warehouse'=> 'entrepot',
|
||||||
|
'actioncomm' => 'actioncomm',
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -214,6 +221,7 @@ class Categorie extends CommonObject
|
|||||||
* @see Categorie::TYPE_PROJECT
|
* @see Categorie::TYPE_PROJECT
|
||||||
* @see Categorie::TYPE_BANK_LINE
|
* @see Categorie::TYPE_BANK_LINE
|
||||||
* @see Categorie::TYPE_WAREHOUSE
|
* @see Categorie::TYPE_WAREHOUSE
|
||||||
|
* @see Categorie::TYPE_ACTIONCOMM
|
||||||
*/
|
*/
|
||||||
public $type;
|
public $type;
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,13 @@ elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCate
|
|||||||
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
|
||||||
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
|
||||||
elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; }
|
elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; }
|
||||||
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
|
elseif ($type == Categorie::TYPE_ACTIONCOMM) {
|
||||||
|
$title = $langs->trans("ActionCommCategoriesArea");
|
||||||
|
$typetext = 'actioncomm';
|
||||||
|
} else {
|
||||||
|
$title = $langs->trans("CategoriesArea");
|
||||||
|
$typetext = 'unknown';
|
||||||
|
}
|
||||||
|
|
||||||
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
|
||||||
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
|
||||||
@ -155,6 +161,15 @@ $cate_arbo = $categstatic->get_full_arbo($typetext);
|
|||||||
// Define fulltree array
|
// Define fulltree array
|
||||||
$fulltree = $cate_arbo;
|
$fulltree = $cate_arbo;
|
||||||
|
|
||||||
|
// Load possible missing includes
|
||||||
|
if($conf->global->CATEGORY_SHOW_COUNTS)
|
||||||
|
{
|
||||||
|
if ($type == Categorie::TYPE_MEMBER) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
if ($type == Categorie::TYPE_ACCOUNT) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
if ($type == Categorie::TYPE_PROJECT) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
if ($type == Categorie::TYPE_USER) require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
}
|
||||||
|
|
||||||
// Define data (format for treeview)
|
// Define data (format for treeview)
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
|
$data[] = array('rowid'=>0, 'fk_menu'=>-1, 'title'=>"racine", 'mainmenu'=>'', 'leftmenu'=>'', 'fk_mainmenu'=>'', 'fk_leftmenu'=>'');
|
||||||
@ -167,10 +182,29 @@ foreach ($fulltree as $key => $val)
|
|||||||
$li = $categstatic->getNomUrl(1, '', 60);
|
$li = $categstatic->getNomUrl(1, '', 60);
|
||||||
$desc = dol_htmlcleanlastbr($val['description']);
|
$desc = dol_htmlcleanlastbr($val['description']);
|
||||||
|
|
||||||
|
if($conf->global->CATEGORY_SHOW_COUNTS)
|
||||||
|
{
|
||||||
|
// we need only a count of the elements, so it is enough to consume only the id's from the database
|
||||||
|
if ($type == Categorie::TYPE_PRODUCT) $elements = $categstatic->getObjectsInCateg("product", 1);
|
||||||
|
if ($type == Categorie::TYPE_SUPPLIER) $elements = $categstatic->getObjectsInCateg("supplier", 1);
|
||||||
|
if ($type == Categorie::TYPE_CUSTOMER) $elements = $categstatic->getObjectsInCateg("customer", 1);
|
||||||
|
if ($type == Categorie::TYPE_MEMBER) $elements = $categstatic->getObjectsInCateg("member", 1);
|
||||||
|
if ($type == Categorie::TYPE_CONTACT) $elements = $categstatic->getObjectsInCateg("contact", 1);
|
||||||
|
if ($type == Categorie::TYPE_ACCOUNT) $elements = $categstatic->getObjectsInCateg("account", 1);
|
||||||
|
if ($type == Categorie::TYPE_PROJECT) $elements = $categstatic->getObjectsInCateg("project", 1);
|
||||||
|
if ($type == Categorie::TYPE_USER) $elements = $categstatic->getObjectsInCateg("user", 1);
|
||||||
|
|
||||||
|
$counter = "<td class='left' width='40px;'>".count($elements)."</td>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$counter = "";
|
||||||
|
}
|
||||||
|
|
||||||
$data[] = array(
|
$data[] = array(
|
||||||
'rowid'=>$val['rowid'],
|
'rowid'=>$val['rowid'],
|
||||||
'fk_menu'=>$val['fk_parent'],
|
'fk_menu'=>$val['fk_parent'],
|
||||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'.
|
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'.$counter.
|
||||||
//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
|
//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
|
||||||
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
||||||
'</tr></table>'
|
'</tr></table>'
|
||||||
|
|||||||
@ -144,6 +144,13 @@ if ($id > 0 && $removeelem > 0)
|
|||||||
$result = $tmpobject->fetch($removeelem);
|
$result = $tmpobject->fetch($removeelem);
|
||||||
$elementtype = 'project';
|
$elementtype = 'project';
|
||||||
}
|
}
|
||||||
|
elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
$tmpobject = new User($db);
|
||||||
|
$result = $tmpobject->fetch($removeelem);
|
||||||
|
$elementtype = 'user';
|
||||||
|
}
|
||||||
|
|
||||||
$result = $object->del_type($tmpobject, $elementtype);
|
$result = $object->del_type($tmpobject, $elementtype);
|
||||||
if ($result < 0) dol_print_error('', $object->error);
|
if ($result < 0) dol_print_error('', $object->error);
|
||||||
@ -214,8 +221,8 @@ $head = categories_prepare_head($object, $type);
|
|||||||
|
|
||||||
|
|
||||||
dol_fiche_head($head, 'card', $title, -1, 'category');
|
dol_fiche_head($head, 'card', $title, -1, 'category');
|
||||||
|
$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type);
|
||||||
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
|
$linkback = '<a href="'.$backtolist.'\">'.$langs->trans("BackToList").'</a>';
|
||||||
$object->next_prev_filter=" type = ".$object->type;
|
$object->next_prev_filter=" type = ".$object->type;
|
||||||
$object->ref = $object->label;
|
$object->ref = $object->label;
|
||||||
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||||
@ -834,6 +841,53 @@ if ($type == Categorie::TYPE_PROJECT)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// List of users
|
||||||
|
if ($type == Categorie::TYPE_USER)
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
|
||||||
|
$users = $object->getObjectsInCateg("user");
|
||||||
|
if ($users < 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db, $object->error, $object->errors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<br>";
|
||||||
|
print "<table class='noborder' width='100%'>\n";
|
||||||
|
print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Users").' <span class="badge">'.count($users).'</span></td></tr>'."\n";
|
||||||
|
|
||||||
|
if (count($users) > 0)
|
||||||
|
{
|
||||||
|
// Use "$userentry" here, because "$user" is the current user
|
||||||
|
foreach ($users as $key => $userentry)
|
||||||
|
{
|
||||||
|
print "\t".'<tr class="oddeven">'."\n";
|
||||||
|
print '<td class="nowrap" valign="top">';
|
||||||
|
print $userentry->getNomUrl(1);
|
||||||
|
print "</td>\n";
|
||||||
|
print '<td class="tdtop">'.$userentry->job."</td>\n";
|
||||||
|
|
||||||
|
// Link to delete from category
|
||||||
|
print '<td class="right">';
|
||||||
|
if ($user->rights->user->user->creer)
|
||||||
|
{
|
||||||
|
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&type=".$type."&removeelem=".$userentry->id."'>";
|
||||||
|
print $langs->trans("DeleteFromCat");
|
||||||
|
print img_picto($langs->trans("DeleteFromCat"), 'unlink');
|
||||||
|
print "</a>";
|
||||||
|
}
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("ThisCategoryHasNoUsers").'</td></tr>';
|
||||||
|
}
|
||||||
|
print "</table>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda"));
|
$langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda"));
|
||||||
@ -374,6 +375,10 @@ if (empty($reshook) && $action == 'add')
|
|||||||
{
|
{
|
||||||
if (!$object->error)
|
if (!$object->error)
|
||||||
{
|
{
|
||||||
|
// Category association
|
||||||
|
$categories = GETPOST('categories', 'array');
|
||||||
|
$object->setCategories($categories);
|
||||||
|
|
||||||
unset($_SESSION['assignedtouser']);
|
unset($_SESSION['assignedtouser']);
|
||||||
|
|
||||||
$moreparam = '';
|
$moreparam = '';
|
||||||
@ -595,6 +600,10 @@ if (empty($reshook) && $action == 'update')
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
// Category association
|
||||||
|
$categories = GETPOST('categories', 'array');
|
||||||
|
$object->setCategories($categories);
|
||||||
|
|
||||||
unset($_SESSION['assignedtouser']);
|
unset($_SESSION['assignedtouser']);
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -1000,6 +1009,14 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($conf->categorie->enabled) {
|
||||||
|
// Categories
|
||||||
|
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
|
||||||
|
print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%');
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
@ -1411,6 +1428,19 @@ if ($id > 0)
|
|||||||
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
|
print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
// Tags-Categories
|
||||||
|
if ($conf->categorie->enabled) {
|
||||||
|
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1);
|
||||||
|
$c = new Categorie($db);
|
||||||
|
$cats = $c->containing($object->id, Categorie::TYPE_ACTIONCOMM);
|
||||||
|
$arrayselected = array();
|
||||||
|
foreach ($cats as $cat) {
|
||||||
|
$arrayselected[] = $cat->id;
|
||||||
|
}
|
||||||
|
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
@ -1717,6 +1747,12 @@ if ($id > 0)
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
// Categories
|
||||||
|
if ($conf->categorie->enabled) {
|
||||||
|
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||||
|
print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1);
|
||||||
|
print "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@ -455,6 +455,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= "durationp,"; // deprecated
|
$sql .= "durationp,"; // deprecated
|
||||||
$sql .= "fk_action,";
|
$sql .= "fk_action,";
|
||||||
$sql .= "code,";
|
$sql .= "code,";
|
||||||
|
$sql .= "ref_ext,";
|
||||||
$sql .= "fk_soc,";
|
$sql .= "fk_soc,";
|
||||||
$sql .= "fk_project,";
|
$sql .= "fk_project,";
|
||||||
$sql .= "note,";
|
$sql .= "note,";
|
||||||
@ -484,6 +485,7 @@ class ActionComm extends CommonObject
|
|||||||
$sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated
|
$sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated
|
||||||
$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
|
$sql .= (isset($this->type_id) ? $this->type_id : "null").",";
|
||||||
$sql .= ($code ? ("'".$code."'") : "null").", ";
|
$sql .= ($code ? ("'".$code."'") : "null").", ";
|
||||||
|
$sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", ";
|
||||||
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
|
$sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", ";
|
||||||
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
|
$sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", ";
|
||||||
$sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', ";
|
$sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', ";
|
||||||
@ -1381,7 +1383,7 @@ class ActionComm extends CommonObject
|
|||||||
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
|
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
|
||||||
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
|
* @param int $maxlength Max number of charaters into label. If negative, use the ref as label.
|
||||||
* @param string $classname Force style class on a link
|
* @param string $classname Force style class on a link
|
||||||
* @param string $option ''=Link to action, 'birthday'=Link to contact
|
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
|
||||||
* @param int $overwritepicto 1 = Overwrite picto
|
* @param int $overwritepicto 1 = Overwrite picto
|
||||||
* @param int $notooltip 1 = Disable tooltip
|
* @param int $notooltip 1 = Disable tooltip
|
||||||
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
|
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
|
||||||
@ -1455,6 +1457,8 @@ class ActionComm extends CommonObject
|
|||||||
$url = '';
|
$url = '';
|
||||||
if ($option == 'birthday')
|
if ($option == 'birthday')
|
||||||
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/contact/perso.php?id='.$this->id;
|
||||||
|
elseif ($option == 'holiday')
|
||||||
|
$url = DOL_URL_ROOT.'/holiday/card.php?id='.$this->id;
|
||||||
else
|
else
|
||||||
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
|
$url = DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id;
|
||||||
if ($option !== 'nolink')
|
if ($option !== 'nolink')
|
||||||
@ -1514,19 +1518,64 @@ class ActionComm extends CommonObject
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets object to supplied categories.
|
||||||
|
*
|
||||||
|
* Deletes object from existing categories not supplied.
|
||||||
|
* Adds it to non existing supplied categories.
|
||||||
|
* Existing categories are left untouch.
|
||||||
|
*
|
||||||
|
* @param int[]|int $categories Category or categories IDs
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setCategories($categories)
|
||||||
|
{
|
||||||
|
// Handle single category
|
||||||
|
if (!is_array($categories)) {
|
||||||
|
$categories = array($categories);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get current categories
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
$c = new Categorie($this->db);
|
||||||
|
$existing = $c->containing($this->id, Categorie::TYPE_ACTIONCOMM, 'id');
|
||||||
|
|
||||||
|
// Diff
|
||||||
|
if (is_array($existing)) {
|
||||||
|
$to_del = array_diff($existing, $categories);
|
||||||
|
$to_add = array_diff($categories, $existing);
|
||||||
|
} else {
|
||||||
|
$to_del = array(); // Nothing to delete
|
||||||
|
$to_add = $categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process
|
||||||
|
foreach ($to_del as $del) {
|
||||||
|
if ($c->fetch($del) > 0) {
|
||||||
|
$c->del_type($this, Categorie::TYPE_ACTIONCOMM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($to_add as $add) {
|
||||||
|
if ($c->fetch($add) > 0) {
|
||||||
|
$c->add_type($this, Categorie::TYPE_ACTIONCOMM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Export events from database into a cal file.
|
* Export events from database into a cal file.
|
||||||
*
|
*
|
||||||
* @param string $format 'vcal', 'ical/ics', 'rss'
|
* @param string $format The format of the export 'vcal', 'ical/ics' or 'rss'
|
||||||
* @param string $type 'event' or 'journal'
|
* @param string $type The type of the export 'event' or 'journal'
|
||||||
* @param int $cachedelay Do not rebuild file if date older than cachedelay seconds
|
* @param integer $cachedelay Do not rebuild file if date older than cachedelay seconds
|
||||||
* @param string $filename Force filename
|
* @param string $filename The name for the exported file.
|
||||||
* @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
|
* @param array $filters Array of filters. Example array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
|
||||||
* @return int <0 if error, nb of events in new file if ok
|
* @param integer $exportholiday 0 = don't integrate holidays into the export, 1 = integrate holidays into the export
|
||||||
|
* @return integer -1 = error on build export file, 0 = export okay
|
||||||
*/
|
*/
|
||||||
public function build_exportfile($format, $type, $cachedelay, $filename, $filters)
|
public function build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholiday = 0)
|
||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
@ -1729,6 +1778,13 @@ class ActionComm extends CommonObject
|
|||||||
}
|
}
|
||||||
$diff++;
|
$diff++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parameters = array('filters' => $filters, 'eventarray' => &$eventarray);
|
||||||
|
$reshook = $hookmanager->executeHooks('addMoreEventsExport', $parameters); // Note that $action and $object may have been modified by hook
|
||||||
|
if ($reshook > 0)
|
||||||
|
{
|
||||||
|
$eventarray = $hookmanager->resArray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1736,6 +1792,91 @@ class ActionComm extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($exportholiday == 1)
|
||||||
|
{
|
||||||
|
$langs->load("holidays");
|
||||||
|
$title = $langs->trans("Holidays");
|
||||||
|
|
||||||
|
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.email, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||||
|
$sql.= " WHERE u.rowid = x.fk_user";
|
||||||
|
$sql.= " AND u.statut = '1'"; // Show only active users (0 = inactive user, 1 = active user)
|
||||||
|
$sql.= " AND (x.statut = '2' OR x.statut = '3')"; // Show only public leaves (2 = leave wait for approval, 3 = leave approved)
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
$event = array();
|
||||||
|
|
||||||
|
if($obj->halfday == -1)
|
||||||
|
{
|
||||||
|
$event['fulldayevent'] = false;
|
||||||
|
|
||||||
|
$timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0);
|
||||||
|
$timestampEnd = dol_stringtotime($obj->date_end." 12:00:00", 0);
|
||||||
|
}
|
||||||
|
elseif($obj->halfday == 1)
|
||||||
|
{
|
||||||
|
$event['fulldayevent'] = false;
|
||||||
|
|
||||||
|
$timestampStart = dol_stringtotime($obj->date_start." 12:00:00", 0);
|
||||||
|
$timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event['fulldayevent'] = true;
|
||||||
|
|
||||||
|
$timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0);
|
||||||
|
$timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($conf->global->AGENDA_EXPORT_FIX_TZ))
|
||||||
|
{
|
||||||
|
$timestampStart =- ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||||
|
$timestampEnd =- ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
|
||||||
|
}
|
||||||
|
|
||||||
|
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||||
|
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
|
||||||
|
$url = $urlwithroot.'/holiday/card.php?id='.$obj->rowid;
|
||||||
|
|
||||||
|
$event['uid'] = 'dolibarrholiday-'.$this->db->database_name.'-'.$obj->rowid."@".$_SERVER["SERVER_NAME"];
|
||||||
|
$event['author'] = dolGetFirstLastname($obj->firstname, $obj->lastname);
|
||||||
|
$event['type'] = 'event';
|
||||||
|
$event['category'] = "Holiday";
|
||||||
|
$event['transparency'] = 'OPAQUE';
|
||||||
|
$event['email'] = $obj->email;
|
||||||
|
$event['created'] = $timestampStart;
|
||||||
|
$event['modified'] = $timestampStart;
|
||||||
|
$event['startdate'] = $timestampStart;
|
||||||
|
$event['enddate'] = $timestampEnd;
|
||||||
|
$event['duration'] = $timestampEnd - $timestampStart;
|
||||||
|
$event['url'] = $url;
|
||||||
|
|
||||||
|
if($obj->status == 2)
|
||||||
|
{
|
||||||
|
// 2 = leave wait for approval
|
||||||
|
$event['summary'] = $title." - ".$obj->lastname." (wait for approval)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 3 = leave approved
|
||||||
|
$event['summary'] = $title." - ".$obj->lastname;
|
||||||
|
}
|
||||||
|
|
||||||
|
$eventarray[] = $event;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$langs->load("agenda");
|
$langs->load("agenda");
|
||||||
|
|
||||||
// Define title and desc
|
// Define title and desc
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user