Merge branch 'develop' into patch-301
This commit is contained in:
commit
b66c2a29a2
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: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
15
ChangeLog
15
ChangeLog
@ -3,6 +3,21 @@ English Dolibarr ChangeLog
|
|||||||
--------------------------------------------------------------
|
--------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
|
||||||
|
For Users:
|
||||||
|
|
||||||
|
|
||||||
|
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+.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
||||||
For Users:
|
For Users:
|
||||||
|
|
||||||
|
|||||||
@ -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 \
|
||||||
|
|||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -26,7 +26,7 @@
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
<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>
|
||||||
|
|||||||
@ -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']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -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)) {
|
||||||
|
|||||||
@ -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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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';
|
||||||
@ -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(
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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,15 @@ 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 $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>';
|
||||||
|
|||||||
@ -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();
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
@ -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);
|
||||||
|
|||||||
@ -86,7 +86,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;
|
||||||
@ -388,7 +388,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))
|
||||||
{
|
{
|
||||||
@ -411,7 +412,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;
|
||||||
@ -456,6 +457,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;
|
||||||
|
|
||||||
|
|||||||
@ -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();
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -757,6 +757,95 @@ if ($showbirthday)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($conf->global->AGENDA_SHOW_HOLIDAYS)
|
||||||
|
{
|
||||||
|
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, 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)
|
||||||
|
|
||||||
|
if ($action == 'show_day')
|
||||||
|
{
|
||||||
|
// Request only leaves for the current selected day
|
||||||
|
$sql .= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin";
|
||||||
|
}
|
||||||
|
elseif ($action == 'show_week')
|
||||||
|
{
|
||||||
|
// TODO: Add filter to reduce database request
|
||||||
|
}
|
||||||
|
elseif ($action == 'show_month')
|
||||||
|
{
|
||||||
|
// TODO: Add filter to reduce database request
|
||||||
|
}
|
||||||
|
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
$dateStartArray = dol_getdate(dol_stringtotime($obj->date_start, 1), true);
|
||||||
|
$dateEndArray = dol_getdate(dol_stringtotime($obj->date_end, 1), true);
|
||||||
|
|
||||||
|
$event = new ActionComm($db);
|
||||||
|
|
||||||
|
// Need the id of the leave object for link to it
|
||||||
|
$event->id = $obj->rowid;
|
||||||
|
|
||||||
|
$event->type_code = 'HOLIDAY';
|
||||||
|
$event->datep = dol_mktime(0, 0, 0, $dateStartArray['mon'], $dateStartArray['mday'], $dateStartArray['year'], true);
|
||||||
|
$event->datef = dol_mktime(0, 0, 0, $dateEndArray['mon'], $dateEndArray['mday'], $dateEndArray['year'], true);
|
||||||
|
$event->date_start_in_calendar = $event->datep;
|
||||||
|
$event->date_end_in_calendar = $event->datef;
|
||||||
|
|
||||||
|
if ($obj->status == 3)
|
||||||
|
{
|
||||||
|
// Show no symbol for leave with state "leave approved"
|
||||||
|
$event->percentage = -1;
|
||||||
|
}
|
||||||
|
elseif ($obj->status == 2)
|
||||||
|
{
|
||||||
|
// Show TO-DO symbol for leave with state "leave wait for approval"
|
||||||
|
$event->percentage = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($obj->halfday == 1)
|
||||||
|
{
|
||||||
|
$event->label = $obj->lastname.' ('.$langs->trans("Morning").')';
|
||||||
|
}
|
||||||
|
elseif ($obj->halfday == -1)
|
||||||
|
{
|
||||||
|
$event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$event->label = $obj->lastname;
|
||||||
|
}
|
||||||
|
|
||||||
|
$annee = date('Y', $event->date_start_in_calendar);
|
||||||
|
$mois = date('m', $event->date_start_in_calendar);
|
||||||
|
$jour = date('d', $event->date_start_in_calendar);
|
||||||
|
$daykey = dol_mktime(0, 0, 0, $mois, $jour, $annee);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$eventarray[$daykey][] = $event;
|
||||||
|
|
||||||
|
$daykey += 60 * 60 * 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ($daykey <= $event->date_end_in_calendar);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Complete $eventarray with external import Ical
|
// Complete $eventarray with external import Ical
|
||||||
if (count($listofextcals))
|
if (count($listofextcals))
|
||||||
{
|
{
|
||||||
@ -1512,7 +1601,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|||||||
{
|
{
|
||||||
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
|
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact');
|
||||||
}
|
}
|
||||||
if ($event->type_code != 'BIRTHDAY')
|
elseif ($event->type_code == 'HOLIDAY')
|
||||||
|
{
|
||||||
|
print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user');
|
||||||
|
}
|
||||||
|
elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY')
|
||||||
{
|
{
|
||||||
// Picto
|
// Picto
|
||||||
if (empty($event->fulldayevent))
|
if (empty($event->fulldayevent))
|
||||||
@ -1741,6 +1834,17 @@ function dol_color_minus($color, $minus, $minusunit = 16)
|
|||||||
*/
|
*/
|
||||||
function sort_events_by_date($a, $b)
|
function sort_events_by_date($a, $b)
|
||||||
{
|
{
|
||||||
|
// Sort holidays at first
|
||||||
|
if ($a->type_code === 'HOLIDAY')
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($b->type_code === 'HOLIDAY')
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// datep => Event start time
|
// datep => Event start time
|
||||||
// datef => Event end time
|
// datef => Event end time
|
||||||
|
|
||||||
|
|||||||
@ -491,7 +491,7 @@ if ($object->id > 0)
|
|||||||
$langs->load("categories");
|
$langs->load("categories");
|
||||||
print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
|
print '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->showCategories($object->id, 'customer', 1);
|
print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,7 +1032,7 @@ if ($object->id > 0)
|
|||||||
*/
|
*/
|
||||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
|
$sql = 'SELECT f.rowid as id, f.titre as ref';
|
||||||
$sql .= ', f.total as total_ht';
|
$sql .= ', f.total as total_ht';
|
||||||
$sql .= ', f.tva as total_tva';
|
$sql .= ', f.tva as total_tva';
|
||||||
$sql .= ', f.total_ttc';
|
$sql .= ', f.total_ttc';
|
||||||
@ -1045,7 +1045,7 @@ if ($object->id > 0)
|
|||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||||
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||||
$sql .= " AND f.entity = ".$conf->entity;
|
$sql .= " AND f.entity = ".$conf->entity;
|
||||||
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
|
$sql .= ' GROUP BY f.rowid, f.titre, f.total, f.tva, f.total_ttc,';
|
||||||
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
|
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
|
||||||
$sql .= ' f.suspended, f.date_when,';
|
$sql .= ' f.suspended, f.date_when,';
|
||||||
$sql .= ' s.nom, s.rowid';
|
$sql .= ' s.nom, s.rowid';
|
||||||
@ -1140,7 +1140,7 @@ if ($object->id > 0)
|
|||||||
*/
|
*/
|
||||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
|
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||||
$sql .= ', f.total as total_ht';
|
$sql .= ', f.total as total_ht';
|
||||||
$sql .= ', f.tva as total_tva';
|
$sql .= ', f.tva as total_tva';
|
||||||
$sql .= ', f.total_ttc';
|
$sql .= ', f.total_ttc';
|
||||||
@ -1151,7 +1151,7 @@ if ($object->id > 0)
|
|||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
|
||||||
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||||
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
|
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total, f.tva, f.total_ttc,';
|
||||||
$sql .= ' f.datef, f.datec, f.paye, f.fk_statut,';
|
$sql .= ' f.datef, f.datec, f.paye, f.fk_statut,';
|
||||||
$sql .= ' s.nom, s.rowid';
|
$sql .= ' s.nom, s.rowid';
|
||||||
$sql .= " ORDER BY f.datef DESC, f.datec DESC";
|
$sql .= " ORDER BY f.datef DESC, f.datec DESC";
|
||||||
|
|||||||
@ -636,7 +636,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD
|
|||||||
|
|
||||||
$sql = "SELECT s.nom as name, s.rowid, s.canvas, ";
|
$sql = "SELECT s.nom as name, s.rowid, s.canvas, ";
|
||||||
$sql .= ", s.code_client";
|
$sql .= ", s.code_client";
|
||||||
$sql .= " c.statut, c.rowid as contratid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo";
|
$sql .= " c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
|
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
|
||||||
$sql .= ", ".MAIN_DB_PREFIX."product as p";
|
$sql .= ", ".MAIN_DB_PREFIX."product as p";
|
||||||
|
|||||||
@ -3549,10 +3549,10 @@ class Propal extends CommonObject
|
|||||||
* @param string $get_params Parametres added to url
|
* @param string $get_params Parametres added to url
|
||||||
* @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 $addlinktonotes Add linkt to notes
|
* @param int $addlinktonotes -1=Disable, 0=Just add label show notes, 1=Add private note (only internal user), 2=Add public note (internal or external user), 3=Add private (internal user) and public note (internal and external user)
|
||||||
* @return string String with URL
|
* @return string String with URL
|
||||||
*/
|
*/
|
||||||
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = 0)
|
public function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1, $addlinktonotes = -1)
|
||||||
{
|
{
|
||||||
global $langs, $conf, $user;
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
@ -3618,18 +3618,42 @@ class Propal extends CommonObject
|
|||||||
if ($withpicto != 2) $result .= $this->ref;
|
if ($withpicto != 2) $result .= $this->ref;
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
|
|
||||||
if ($addlinktonotes)
|
if ($addlinktonotes >= 0) {
|
||||||
{
|
$txttoshow = '';
|
||||||
$txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private);
|
|
||||||
if ($txttoshow)
|
if ($addlinktonotes == 0) {
|
||||||
{
|
if (!empty($this->note_private) || !empty($this->note_public)) {
|
||||||
$notetoshow = $langs->trans("ViewPrivateNote").':<br>'.dol_string_nohtmltag($txttoshow, 1);
|
$txttoshow = $langs->trans('ViewPrivateNote');
|
||||||
|
}
|
||||||
|
} elseif ($addlinktonotes == 1) {
|
||||||
|
if (!empty($this->note_private)) {
|
||||||
|
$txttoshow .= ($user->socid > 0 ? '' : dol_string_nohtmltag($this->note_private, 1));
|
||||||
|
}
|
||||||
|
} elseif ($addlinktonotes == 2) {
|
||||||
|
if (!empty($this->note_public)) {
|
||||||
|
$txttoshow .= dol_string_nohtmltag($this->note_public, 1);
|
||||||
|
}
|
||||||
|
} elseif ($addlinktonotes == 3) {
|
||||||
|
if ($user->socid > 0) {
|
||||||
|
if (!empty($this->note_public)) {
|
||||||
|
$txttoshow .= dol_string_nohtmltag($this->note_public, 1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!empty($this->note_public)) {
|
||||||
|
$txttoshow .= dol_string_nohtmltag($this->note_public, 1);
|
||||||
|
}
|
||||||
|
if (!empty($this->note_private)) {
|
||||||
|
if (!empty($txttoshow)) $txttoshow .= '<br><br>';
|
||||||
|
$txttoshow .= dol_string_nohtmltag($this->note_private, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($txttoshow) {
|
||||||
$result .= ' <span class="note inline-block">';
|
$result .= ' <span class="note inline-block">';
|
||||||
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($notetoshow).'">';
|
$result .= '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$this->id.'" class="classfortooltip" title="'.dol_escape_htmltag($txttoshow).'">';
|
||||||
$result .= img_picto('', 'note');
|
$result .= img_picto('', 'note');
|
||||||
$result .= '</a>';
|
$result .= '</a>';
|
||||||
//$result.=img_picto($langs->trans("ViewNote"),'object_generic');
|
|
||||||
//$result.='</a>';
|
|
||||||
$result .= '</span>';
|
$result .= '</span>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -75,15 +76,12 @@ $search_zip = GETPOST('search_zip', 'alpha');
|
|||||||
$search_state = trim(GETPOST("search_state"));
|
$search_state = trim(GETPOST("search_state"));
|
||||||
$search_country = GETPOST("search_country", 'int');
|
$search_country = GETPOST("search_country", 'int');
|
||||||
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
||||||
$search_day = GETPOST("search_day", "int");
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
$search_month = GETPOST("search_month", "int");
|
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
$search_year = GETPOST("search_year", "int");
|
$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int'));
|
||||||
$search_dayfin = GETPOST("search_dayfin", "int");
|
$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int'));
|
||||||
$search_month_end = GETPOST("search_month_end", "int");
|
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
|
||||||
$search_yearfin = GETPOST("search_yearfin", "int");
|
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||||
$search_daydelivery = GETPOST("search_daydelivery", "int");
|
|
||||||
$search_monthdelivery = GETPOST("search_monthdelivery", "int");
|
|
||||||
$search_yeardelivery = GETPOST("search_yeardelivery", "int");
|
|
||||||
$search_availability = GETPOST('search_availability', 'int');
|
$search_availability = GETPOST('search_availability', 'int');
|
||||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||||
$search_btn = GETPOST('button_search', 'alpha');
|
$search_btn = GETPOST('button_search', 'alpha');
|
||||||
@ -219,15 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
$search_type = '';
|
$search_type = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_type_thirdparty = '';
|
$search_type_thirdparty = '';
|
||||||
$search_year = '';
|
$search_date_start = '';
|
||||||
$search_month = '';
|
$search_date_end = '';
|
||||||
$search_day = '';
|
$search_dateend_start = '';
|
||||||
$search_yearfin = '';
|
$search_dateend_end = '';
|
||||||
$search_month_end = '';
|
$search_datedelivery_start = '';
|
||||||
$search_dayfin = '';
|
$search_datedelivery_end = '';
|
||||||
$search_yeardelivery = '';
|
|
||||||
$search_monthdelivery = '';
|
|
||||||
$search_daydelivery = '';
|
|
||||||
$search_availability = '';
|
$search_availability = '';
|
||||||
$viewstatut = '';
|
$viewstatut = '';
|
||||||
$object_statut = '';
|
$object_statut = '';
|
||||||
@ -314,6 +309,7 @@ if (!$user->rights->societe->client->voir && !$socid) //restriction
|
|||||||
{
|
{
|
||||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||||
@ -342,9 +338,12 @@ if ($viewstatut != '' && $viewstatut != '-1')
|
|||||||
{
|
{
|
||||||
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
$sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')';
|
||||||
}
|
}
|
||||||
$sql .= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year);
|
if ($search_date_start) $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'";
|
||||||
$sql .= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin);
|
if ($search_date_end) $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'";
|
||||||
$sql .= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery);
|
if ($search_dateend_start) $sql .= " AND p.fin_validite >= '".$db->idate($search_dateend_start)."'";
|
||||||
|
if ($search_dateend_end) $sql .= " AND p.fin_validite <= '".$db->idate($search_dateend_end)."'";
|
||||||
|
if ($search_datedelivery_start) $sql .= " AND p.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||||
|
if ($search_datedelivery_end) $sql .= " AND p.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||||
if ($search_user > 0)
|
if ($search_user > 0)
|
||||||
{
|
{
|
||||||
@ -416,9 +415,12 @@ if ($resql)
|
|||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||||
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start);
|
||||||
|
if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end);
|
||||||
|
if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start);
|
||||||
|
if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end);
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
||||||
if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject);
|
if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject);
|
||||||
@ -595,34 +597,43 @@ if ($resql)
|
|||||||
// Date
|
// Date
|
||||||
if (!empty($arrayfields['p.date']['checked']))
|
if (!empty($arrayfields['p.date']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
//print $langs->trans('Month').': ';
|
print '<div class="nowrap">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
print $langs->trans('From').' ';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
//print ' '.$langs->trans('Year').': ';
|
print '</div>';
|
||||||
$formother->select_year($search_year, 'search_year', 1, 20, 5);
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date end
|
// Date end
|
||||||
if (!empty($arrayfields['p.fin_validite']['checked']))
|
if (!empty($arrayfields['p.fin_validite']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
//print $langs->trans('Month').': ';
|
print '<div class="nowrap">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" maxlength="2" name="search_dayfin" value="'.dol_escape_htmltag($search_dayfin).'">';
|
print $langs->trans('From').' ';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month_end" value="'.dol_escape_htmltag($search_month_end).'">';
|
print $form->selectDate($search_dateend_start ? $search_dateend_start : -1, 'search_dateend_start', 0, 0, 1);
|
||||||
//print ' '.$langs->trans('Year').': ';
|
print '</div>';
|
||||||
$formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5);
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_dateend_end ? $search_dateend_end : -1, 'search_dateend_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date delivery
|
// Date delivery
|
||||||
if (!empty($arrayfields['p.date_livraison']['checked']))
|
if (!empty($arrayfields['p.date_livraison']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
//print $langs->trans('Month').': ';
|
print '<div class="nowrap">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25" type="text" size="1" maxlength="2" name="search_daydelivery" value="'.dol_escape_htmltag($search_daydelivery).'">';
|
print $langs->trans('From').' ';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_monthdelivery" value="'.dol_escape_htmltag($search_monthdelivery).'">';
|
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||||
//print ' '.$langs->trans('Year').': ';
|
print '</div>';
|
||||||
$formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5);
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Availability
|
// Availability
|
||||||
@ -765,8 +776,8 @@ if ($resql)
|
|||||||
|
|
||||||
$objectstatic->id = $obj->rowid;
|
$objectstatic->id = $obj->rowid;
|
||||||
$objectstatic->ref = $obj->ref;
|
$objectstatic->ref = $obj->ref;
|
||||||
$objectstatic->note_public = $obj->note_public;
|
|
||||||
$objectstatic->note_private = $obj->note_private;
|
$objectstatic->note_private = $obj->note_private;
|
||||||
|
$objectstatic->note_public = $obj->note_public;
|
||||||
|
|
||||||
$companystatic->id = $obj->socid;
|
$companystatic->id = $obj->socid;
|
||||||
$companystatic->name = $obj->name;
|
$companystatic->name = $obj->name;
|
||||||
@ -787,7 +798,7 @@ if ($resql)
|
|||||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
// Picto + Ref
|
// Picto + Ref
|
||||||
print '<td class="nobordernopadding nowrap">';
|
print '<td class="nobordernopadding nowrap">';
|
||||||
print $objectstatic->getNomUrl(1, '', '', 0, 1, 1);
|
print $objectstatic->getNomUrl(1, '', '', 0, 1, (isset($conf->global->PROPAL_LIST_SHOW_NOTES) ? $conf->global->PROPAL_LIST_SHOW_NOTES : 1));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Warning
|
// Warning
|
||||||
$warnornote = '';
|
$warnornote = '';
|
||||||
@ -941,7 +952,7 @@ if ($resql)
|
|||||||
// Amount HT
|
// Amount HT
|
||||||
if (!empty($arrayfields['p.total_ht']['checked']))
|
if (!empty($arrayfields['p.total_ht']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht';
|
||||||
$totalarray['val']['p.total_ht'] += $obj->total_ht;
|
$totalarray['val']['p.total_ht'] += $obj->total_ht;
|
||||||
@ -949,7 +960,7 @@ if ($resql)
|
|||||||
// Amount VAT
|
// Amount VAT
|
||||||
if (!empty($arrayfields['p.total_vat']['checked']))
|
if (!empty($arrayfields['p.total_vat']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_vat)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_vat)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_vat';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_vat';
|
||||||
$totalarray['val']['p.total_vat'] += $obj->total_vat;
|
$totalarray['val']['p.total_vat'] += $obj->total_vat;
|
||||||
@ -957,7 +968,7 @@ if ($resql)
|
|||||||
// Amount TTC
|
// Amount TTC
|
||||||
if (!empty($arrayfields['p.total_ttc']['checked']))
|
if (!empty($arrayfields['p.total_ttc']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ttc';
|
||||||
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
$totalarray['val']['p.total_ttc'] += $obj->total_ttc;
|
||||||
@ -978,7 +989,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_ht_invoiced';
|
||||||
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
$totalarray['val']['p.total_ht_invoiced'] += $obj->total_ht_invoiced;
|
||||||
@ -999,7 +1010,7 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="right">'.price($totalInvoiced)."</td>\n";
|
print '<td class="nowrap right">'.price($totalInvoiced)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.total_invoiced';
|
||||||
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
$totalarray['val']['p.total_invoiced'] += $obj->total_invoiced;
|
||||||
|
|||||||
@ -56,12 +56,10 @@ $confirm = GETPOST('confirm', 'alpha');
|
|||||||
$toselect = GETPOST('toselect', 'array');
|
$toselect = GETPOST('toselect', 'array');
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist';
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist';
|
||||||
|
|
||||||
$search_orderyear = GETPOST("search_orderyear", "int");
|
$search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int'));
|
||||||
$search_ordermonth = GETPOST("search_ordermonth", "int");
|
$search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int'));
|
||||||
$search_orderday = GETPOST("search_orderday", "int");
|
$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int'));
|
||||||
$search_deliveryyear = GETPOST("search_deliveryyear", "int");
|
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
|
||||||
$search_deliverymonth = GETPOST("search_deliverymonth", "int");
|
|
||||||
$search_deliveryday = GETPOST("search_deliveryday", "int");
|
|
||||||
$search_product_category = GETPOST('search_product_category', 'int');
|
$search_product_category = GETPOST('search_product_category', 'int');
|
||||||
$search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha');
|
$search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha') : GETPOST('sref', 'alpha');
|
||||||
$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
|
$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
|
||||||
@ -77,6 +75,7 @@ $search_user = GETPOST('search_user', 'int');
|
|||||||
$search_sale = GETPOST('search_sale', 'int');
|
$search_sale = GETPOST('search_sale', 'int');
|
||||||
$search_total_ht = GETPOST('search_total_ht', 'alpha');
|
$search_total_ht = GETPOST('search_total_ht', 'alpha');
|
||||||
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
|
$search_total_ttc = GETPOST('search_total_ttc', 'alpha');
|
||||||
|
$search_login = GETPOST('search_login', 'alpha');
|
||||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||||
$optioncss = GETPOST('optioncss', 'alpha');
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
$billed = GETPOST('billed', 'int');
|
$billed = GETPOST('billed', 'int');
|
||||||
@ -142,6 +141,7 @@ $arrayfields = array(
|
|||||||
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1),
|
||||||
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0),
|
||||||
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0),
|
||||||
|
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10),
|
||||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||||
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>500),
|
||||||
@ -197,12 +197,11 @@ if (empty($reshook))
|
|||||||
$search_total_ht = '';
|
$search_total_ht = '';
|
||||||
$search_total_vat = '';
|
$search_total_vat = '';
|
||||||
$search_total_ttc = '';
|
$search_total_ttc = '';
|
||||||
$search_orderyear = '';
|
$search_login = '';
|
||||||
$search_ordermonth = '';
|
$search_dateorder_start = '';
|
||||||
$search_orderday = '';
|
$search_dateorder_end = '';
|
||||||
$search_deliveryday = '';
|
$search_datedelivery_start = '';
|
||||||
$search_deliverymonth = '';
|
$search_datedelivery_end = '';
|
||||||
$search_deliveryyear = '';
|
|
||||||
$search_project_ref = '';
|
$search_project_ref = '';
|
||||||
$search_project = '';
|
$search_project = '';
|
||||||
$viewstatut = '';
|
$viewstatut = '';
|
||||||
@ -250,10 +249,11 @@ if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
|||||||
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
$sql .= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||||
$sql .= " typent.code as typent_code,";
|
$sql .= " typent.code as typent_code,";
|
||||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||||
$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
|
$sql .= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
|
||||||
$sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
$sql .= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
|
||||||
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
$sql .= ' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
|
||||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||||
|
$sql .= " u.login";
|
||||||
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
if (!empty($extrafields->attributes[$object->table_element]['label']))
|
||||||
@ -272,6 +272,8 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
|||||||
if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
|
||||||
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
|
||||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
||||||
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||||
|
|
||||||
// We'll need this table joined to the select in order to filter by sale
|
// We'll need this table joined to the select in order to filter by sale
|
||||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
if ($search_user > 0)
|
if ($search_user > 0)
|
||||||
@ -311,8 +313,11 @@ if ($viewstatut <> '')
|
|||||||
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
|
$sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sql .= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear);
|
|
||||||
$sql .= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear);
|
if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'";
|
||||||
|
if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'";
|
||||||
|
if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'";
|
||||||
|
if ($search_datedelivery_end) $sql .= " AND c.date_livraison <= '".$db->idate($search_datedelivery_end)."'";
|
||||||
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
if ($search_town) $sql .= natural_search('s.town', $search_town);
|
||||||
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
||||||
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
||||||
@ -323,10 +328,12 @@ if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$sear
|
|||||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||||
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
if ($search_total_ht != '') $sql .= natural_search('c.total_ht', $search_total_ht, 1);
|
||||||
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
if ($search_total_ttc != '') $sql .= natural_search('c.total_ttc', $search_total_ttc, 1);
|
||||||
|
if ($search_login) $sql .= natural_search("u.login", $search_login);
|
||||||
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref);
|
||||||
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
if ($search_project != '') $sql .= natural_search("p.title", $search_project);
|
||||||
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
if ($search_categ_cus > 0) $sql .= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
|
||||||
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL";
|
||||||
|
|
||||||
// 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
|
||||||
@ -405,12 +412,10 @@ if ($resql)
|
|||||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||||
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
||||||
if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut);
|
if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut);
|
||||||
if ($search_orderday) $param .= '&search_orderday='.urlencode($search_orderday);
|
if ($search_dateorder_start) $param .= '&search_dateorder_start='.urlencode($search_dateorder_start);
|
||||||
if ($search_ordermonth) $param .= '&search_ordermonth='.urlencode($search_ordermonth);
|
if ($search_dateorder_end) $param .= '&search_dateorder_end='.urlencode($search_dateorder_end);
|
||||||
if ($search_orderyear) $param .= '&search_orderyear='.urlencode($search_orderyear);
|
if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start);
|
||||||
if ($search_deliveryday) $param .= '&search_deliveryday='.urlencode($search_deliveryday);
|
if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end);
|
||||||
if ($search_deliverymonth) $param .= '&search_deliverymonth='.urlencode($search_deliverymonth);
|
|
||||||
if ($search_deliveryyear) $param .= '&search_deliveryyear='.urlencode($search_deliveryyear);
|
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
||||||
if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||||
@ -419,6 +424,7 @@ if ($resql)
|
|||||||
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
||||||
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
||||||
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
||||||
|
if ($search_login) $param .= '&search_login='.urlencode($search_login);
|
||||||
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
||||||
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
|
if ($search_town != '') $param .= '&search_town='.urlencode($search_town);
|
||||||
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
|
if ($search_zip != '') $param .= '&search_zip='.urlencode($search_zip);
|
||||||
@ -646,18 +652,28 @@ if ($resql)
|
|||||||
// Date order
|
// Date order
|
||||||
if (!empty($arrayfields['c.date_commande']['checked']))
|
if (!empty($arrayfields['c.date_commande']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_orderday" value="'.$search_orderday.'">';
|
print '<div class="nowrap">';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_ordermonth" value="'.$search_ordermonth.'">';
|
print $langs->trans('From').' ';
|
||||||
$formother->select_year($search_orderyear ? $search_orderyear : -1, 'search_orderyear', 1, 20, 5);
|
print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1, 'search_dateorder_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1, 'search_dateorder_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['c.date_delivery']['checked']))
|
if (!empty($arrayfields['c.date_delivery']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_deliveryday" value="'.$search_deliveryday.'">';
|
print '<div class="nowrap">';
|
||||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_deliverymonth" value="'.$search_deliverymonth.'">';
|
print $langs->trans('From').' ';
|
||||||
$formother->select_year($search_deliveryyear ? $search_deliveryyear : -1, 'search_deliveryyear', 1, 20, 5);
|
print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
if (!empty($arrayfields['c.total_ht']['checked']))
|
if (!empty($arrayfields['c.total_ht']['checked']))
|
||||||
@ -681,6 +697,13 @@ if ($resql)
|
|||||||
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
|
print '<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
|
if (!empty($arrayfields['u.login']['checked']))
|
||||||
|
{
|
||||||
|
// Author
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
print '<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'">';
|
||||||
|
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';
|
||||||
// Fields from hook
|
// Fields from hook
|
||||||
@ -752,6 +775,8 @@ if ($resql)
|
|||||||
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
if (!empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||||
|
if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||||
|
|
||||||
// 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';
|
||||||
// Hook fields
|
// Hook fields
|
||||||
@ -773,7 +798,7 @@ if ($resql)
|
|||||||
|
|
||||||
$generic_commande = new Commande($db);
|
$generic_commande = new Commande($db);
|
||||||
$generic_product = new Product($db);
|
$generic_product = new Product($db);
|
||||||
|
$userstatic = new User($db);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
while ($i < min($num, $limit))
|
while ($i < min($num, $limit))
|
||||||
@ -1050,7 +1075,7 @@ if ($resql)
|
|||||||
// Amount HT
|
// Amount HT
|
||||||
if (!empty($arrayfields['c.total_ht']['checked']))
|
if (!empty($arrayfields['c.total_ht']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_ht)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_ht)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht';
|
||||||
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
$totalarray['val']['c.total_ht'] += $obj->total_ht;
|
||||||
@ -1058,7 +1083,7 @@ if ($resql)
|
|||||||
// Amount VAT
|
// Amount VAT
|
||||||
if (!empty($arrayfields['c.total_vat']['checked']))
|
if (!empty($arrayfields['c.total_vat']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_tva)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_tva)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva';
|
||||||
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
$totalarray['val']['c.total_tva'] += $obj->total_tva;
|
||||||
@ -1066,12 +1091,25 @@ if ($resql)
|
|||||||
// Amount TTC
|
// Amount TTC
|
||||||
if (!empty($arrayfields['c.total_ttc']['checked']))
|
if (!empty($arrayfields['c.total_ttc']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="right">'.price($obj->total_ttc)."</td>\n";
|
print '<td class="nowrap right">'.price($obj->total_ttc)."</td>\n";
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc';
|
||||||
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
$totalarray['val']['c.total_ttc'] += $obj->total_ttc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userstatic->id = $obj->fk_user_author;
|
||||||
|
$userstatic->login = $obj->login;
|
||||||
|
|
||||||
|
// Author
|
||||||
|
if (!empty($arrayfields['u.login']['checked']))
|
||||||
|
{
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print "</td>\n";
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@ -690,7 +690,7 @@ else
|
|||||||
// Categories
|
// Categories
|
||||||
if ($conf->categorie->enabled) {
|
if ($conf->categorie->enabled) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td><td>';
|
||||||
print $form->showCategories($object->id, 'bank_account', 1);
|
print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1);
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
/* Copyright (C) 2017-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 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>
|
||||||
*
|
*
|
||||||
@ -44,11 +44,15 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
|||||||
$search_ref = GETPOST('search_ref', 'int');
|
$search_ref = GETPOST('search_ref', 'int');
|
||||||
$search_user = GETPOST('search_user', 'alpha');
|
$search_user = GETPOST('search_user', 'alpha');
|
||||||
$search_label = GETPOST('search_label', 'alpha');
|
$search_label = GETPOST('search_label', 'alpha');
|
||||||
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
|
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
$search_amount_deb = GETPOST('search_amount_deb', 'alpha');
|
$search_amount_deb = GETPOST('search_amount_deb', 'alpha');
|
||||||
$search_amount_cred = GETPOST('search_amount_cred', 'alpha');
|
$search_amount_cred = GETPOST('search_amount_cred', 'alpha');
|
||||||
$search_account = GETPOST('search_account', 'int');
|
$search_account = GETPOST('search_account', 'int');
|
||||||
$search_date = dol_mktime(0, 0, 0, GETPOST('date_docmonth', 'int'), GETPOST('date_docday', 'int'), GETPOST('date_docyear', 'int'));
|
$search_accountancy_account = GETPOST("search_accountancy_account");
|
||||||
$search_accountancy_code = GETPOST("search_accountancy_code");
|
if ($search_accountancy_account == - 1) $search_accountancy_account = '';
|
||||||
|
$search_accountancy_subledger = GETPOST("search_accountancy_subledger");
|
||||||
|
if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = '';
|
||||||
|
|
||||||
$sortfield = GETPOST("sortfield", 'alpha');
|
$sortfield = GETPOST("sortfield", 'alpha');
|
||||||
$sortorder = GETPOST("sortorder", 'alpha');
|
$sortorder = GETPOST("sortorder", 'alpha');
|
||||||
@ -81,12 +85,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|||||||
{
|
{
|
||||||
$search_ref = "";
|
$search_ref = "";
|
||||||
$search_label = "";
|
$search_label = "";
|
||||||
|
$search_date_start = '';
|
||||||
|
$search_date_end = '';
|
||||||
$search_amount_deb = "";
|
$search_amount_deb = "";
|
||||||
$search_amount_cred = "";
|
$search_amount_cred = "";
|
||||||
$search_account = '';
|
$search_account = '';
|
||||||
|
$search_accountancy_account = '';
|
||||||
|
$search_accountancy_subledger = '';
|
||||||
$typeid = "";
|
$typeid = "";
|
||||||
$search_date = '';
|
|
||||||
$search_accountancy_code = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -100,7 +106,7 @@ $formaccounting = new FormAccounting($db);
|
|||||||
$variousstatic = new PaymentVarious($db);
|
$variousstatic = new PaymentVarious($db);
|
||||||
$accountstatic = new Account($db);
|
$accountstatic = new Account($db);
|
||||||
|
|
||||||
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,";
|
$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,";
|
||||||
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
$sql .= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
|
||||||
$sql .= " pst.code as payment_code";
|
$sql .= " pst.code as payment_code";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
|
||||||
@ -112,11 +118,13 @@ $sql.= " WHERE v.entity IN (".getEntity('payment_various').")";
|
|||||||
// Search criteria
|
// Search criteria
|
||||||
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
if ($search_ref) $sql .= " AND v.rowid=".$db->escape($search_ref);
|
||||||
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
if ($search_label) $sql .= natural_search(array('v.label'), $search_label);
|
||||||
|
if ($search_date_start) $sql .= " AND v.datep >= '".$db->idate($search_date_start)."'";
|
||||||
|
if ($search_date_end) $sql .= " AND v.datep <= '".$db->idate($search_date_end)."'";
|
||||||
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
if ($search_amount_deb) $sql .= natural_search("v.amount", $search_amount_deb, 1);
|
||||||
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
if ($search_amount_cred) $sql .= natural_search("v.amount", $search_amount_cred, 1);
|
||||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
|
if ($search_account > 0) $sql .= " AND b.fk_account=".$db->escape($search_account);
|
||||||
if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'";
|
if ($search_accountancy_account > 0) $sql .= " AND v.accountancy_code=".$db->escape($search_accountancy_account);
|
||||||
if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code);
|
if ($search_accountancy_subledger > 0) $sql .= " AND v.subledger_account=".$db->escape($search_accountancy_subledger);
|
||||||
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid;
|
||||||
if ($filtre) {
|
if ($filtre) {
|
||||||
$filtre = str_replace(":", "=", $filtre);
|
$filtre = str_replace(":", "=", $filtre);
|
||||||
@ -145,12 +153,14 @@ if ($result)
|
|||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||||
|
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||||
|
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||||
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
|
||||||
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
|
||||||
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
|
||||||
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
|
if ($search_account > 0) $param .= '&search_amount='.urlencode($search_account);
|
||||||
//if ($search_date) $param.='&search_date='.$search_date;
|
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
|
||||||
if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code);
|
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);
|
||||||
|
|
||||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||||
|
|
||||||
@ -188,7 +198,13 @@ if ($result)
|
|||||||
// Date
|
// Date
|
||||||
print '<td class="liste_titre center">';
|
print '<td class="liste_titre center">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $form->selectDate($search_date, 'date_doc', 0, 0, 1);
|
print $langs->trans('From').' ';
|
||||||
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
@ -208,9 +224,17 @@ if ($result)
|
|||||||
// Accounting account
|
// Accounting account
|
||||||
if (!empty($conf->accounting->enabled))
|
if (!empty($conf->accounting->enabled))
|
||||||
{
|
{
|
||||||
|
// Accounting account
|
||||||
print '<td class="liste_titre">';
|
print '<td class="liste_titre">';
|
||||||
print '<div class="nowrap">';
|
print '<div class="nowrap">';
|
||||||
print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, array(), 1, 1, 'maxwidth200');
|
print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array(), 1, 1, 'maxwidth200');
|
||||||
|
print '</div>';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Subledger account
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, 'maxwidth200');
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
@ -235,7 +259,8 @@ if ($result)
|
|||||||
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||||
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
|
print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||||
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
if (!empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder);
|
||||||
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
if (!empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||||
|
if (!empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left ');
|
||||||
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
@ -303,6 +328,13 @@ if ($result)
|
|||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Accounting subledger account
|
||||||
|
if (!empty($conf->accounting->enabled))
|
||||||
|
{
|
||||||
|
print '<td>'.length_accounta($obj->subledger_account).'</td>';
|
||||||
|
if (!$i) $totalarray['nbfield']++;
|
||||||
|
}
|
||||||
|
|
||||||
// Debit
|
// Debit
|
||||||
print '<td class="nowrap right">';
|
print '<td class="nowrap right">';
|
||||||
if ($obj->sens == 0)
|
if ($obj->sens == 0)
|
||||||
@ -312,7 +344,7 @@ if ($result)
|
|||||||
}
|
}
|
||||||
if (!$i) $totalarray['nbfield']++;
|
if (!$i) $totalarray['nbfield']++;
|
||||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'total_deb';
|
||||||
print "</td>";
|
print '</td>';
|
||||||
|
|
||||||
// Credit
|
// Credit
|
||||||
print '<td class="nowrap right">';
|
print '<td class="nowrap right">';
|
||||||
|
|||||||
@ -1386,12 +1386,12 @@ if (empty($reshook))
|
|||||||
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines or deposit lines");
|
dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add lines or deposit lines");
|
||||||
$result = $srcobject->fetch($object->origin_id);
|
$result = $srcobject->fetch($object->origin_id);
|
||||||
|
|
||||||
// If deposit invoice
|
$typeamount = GETPOST('typedeposit', 'aZ09');
|
||||||
if ($_POST['type'] == Facture::TYPE_DEPOSIT)
|
|
||||||
{
|
|
||||||
$typeamount = GETPOST('typedeposit', 'alpha');
|
|
||||||
$valuedeposit = GETPOST('valuedeposit', 'int');
|
$valuedeposit = GETPOST('valuedeposit', 'int');
|
||||||
|
|
||||||
|
// If deposit invoice
|
||||||
|
if ($_POST['type'] == Facture::TYPE_DEPOSIT && in_array($typeamount, array('amount', 'variable')))
|
||||||
|
{
|
||||||
$amountdeposit = array();
|
$amountdeposit = array();
|
||||||
if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA))
|
if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA))
|
||||||
{
|
{
|
||||||
@ -1419,7 +1419,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$amountdeposit[0] = $valuedeposit;
|
$amountdeposit[0] = $valuedeposit;
|
||||||
}
|
}
|
||||||
else
|
elseif ($typeamount == 'variable')
|
||||||
{
|
{
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -1449,11 +1449,15 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$amount_ttc_diff = $amountdeposit[0];
|
$amount_ttc_diff = $amountdeposit[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($amountdeposit as $tva => $amount)
|
foreach ($amountdeposit as $tva => $amount)
|
||||||
{
|
{
|
||||||
if (empty($amount)) continue;
|
if (empty($amount)) continue;
|
||||||
|
|
||||||
$arraylist = array('amount' => 'FixAmount', 'variable' => 'VarAmount');
|
$arraylist = array(
|
||||||
|
'amount' => 'FixAmount',
|
||||||
|
'variable' => 'VarAmount'
|
||||||
|
);
|
||||||
$descline = '(DEPOSIT)';
|
$descline = '(DEPOSIT)';
|
||||||
//$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
|
//$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
|
||||||
if ($typeamount == 'amount') {
|
if ($typeamount == 'amount') {
|
||||||
@ -1500,7 +1504,8 @@ if (empty($reshook))
|
|||||||
$object->updateline($object->lines[0]->id, $object->lines[0]->desc, $subprice_diff, $object->lines[0]->qty, $object->lines[0]->remise_percent, $object->lines[0]->date_start, $object->lines[0]->date_end, $object->lines[0]->tva_tx, 0, 0, 'HT', $object->lines[0]->info_bits, $object->lines[0]->product_type, 0, 0, 0, $object->lines[0]->pa_ht, $object->lines[0]->label, 0, array(), 100);
|
$object->updateline($object->lines[0]->id, $object->lines[0]->desc, $subprice_diff, $object->lines[0]->qty, $object->lines[0]->remise_percent, $object->lines[0]->date_start, $object->lines[0]->date_end, $object->lines[0]->tva_tx, 0, 0, 'HT', $object->lines[0]->info_bits, $object->lines[0]->product_type, 0, 0, 0, $object->lines[0]->pa_ht, $object->lines[0]->label, 0, array(), 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if ($_POST['type'] != Facture::TYPE_DEPOSIT || ($_POST['type'] == Facture::TYPE_DEPOSIT && $typeamount == 'variablealllines'))
|
||||||
{
|
{
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@ -1511,6 +1516,16 @@ if (empty($reshook))
|
|||||||
$lines = $srcobject->lines;
|
$lines = $srcobject->lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we create a deposit with all lines and a percent, we change amount
|
||||||
|
if ($_POST['type'] == Facture::TYPE_DEPOSIT && $typeamount == 'variablealllines') {
|
||||||
|
if (is_array($lines)) {
|
||||||
|
foreach($lines as $line) {
|
||||||
|
// We keep ->subprice and ->pa_ht, but we change the qty
|
||||||
|
$line->qty = price2num($line->qty * $valuedeposit / 100, 'MS');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$fk_parent_line = 0;
|
$fk_parent_line = 0;
|
||||||
$num = count($lines);
|
$num = count($lines);
|
||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
@ -2994,8 +3009,12 @@ if ($action == 'create')
|
|||||||
if (($origin == 'propal') || ($origin == 'commande'))
|
if (($origin == 'propal') || ($origin == 'commande'))
|
||||||
{
|
{
|
||||||
print '<td class="nowrap" style="padding-left: 5px">';
|
print '<td class="nowrap" style="padding-left: 5px">';
|
||||||
$arraylist = array('amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')), 'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')));
|
$arraylist = array(
|
||||||
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1);
|
'amount' => $langs->transnoentitiesnoconv('FixAmount', $langs->transnoentitiesnoconv('Deposit')),
|
||||||
|
'variable' => $langs->transnoentitiesnoconv('VarAmountOneLine', $langs->transnoentitiesnoconv('Deposit')),
|
||||||
|
'variablealllines' => $langs->transnoentitiesnoconv('VarAmountAllLines')
|
||||||
|
);
|
||||||
|
print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit', 'int').'"/>';
|
print '<td class="nowrap" style="padding-left: 5px">'.$langs->trans('Value').':<input type="text" id="valuedeposit" name="valuedeposit" size="3" value="'.GETPOST('valuedeposit', 'int').'"/>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,7 +71,6 @@ class FactureRec extends CommonInvoice
|
|||||||
|
|
||||||
public $number;
|
public $number;
|
||||||
public $date;
|
public $date;
|
||||||
public $amount;
|
|
||||||
public $remise;
|
public $remise;
|
||||||
public $tva;
|
public $tva;
|
||||||
public $total;
|
public $total;
|
||||||
@ -93,6 +92,81 @@ class FactureRec extends CommonInvoice
|
|||||||
|
|
||||||
public $suspended; // status
|
public $suspended; // status
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||||
|
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||||
|
* 'label' the translation key.
|
||||||
|
* 'enabled' is a condition when the field must be managed.
|
||||||
|
* 'position' is the sort order of field.
|
||||||
|
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||||
|
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||||
|
* 'noteditable' says if field is not editable (1 or 0)
|
||||||
|
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||||
|
* 'index' if we want an index in database.
|
||||||
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||||
|
* 'help' is a string visible as a tooltip on field
|
||||||
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
|
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||||
|
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||||
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
|
*
|
||||||
|
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
|
/**
|
||||||
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
|
*/
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
|
'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'visible'=>-1, 'position'=>15),
|
||||||
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||||
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25),
|
||||||
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||||
|
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||||
|
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
|
//'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
|
//'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||||
|
'tva' =>array('type'=>'double(24,8)', 'label'=>'Tva', 'enabled'=>1, 'visible'=>-1, 'position'=>55, 'isameasure'=>1),
|
||||||
|
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'isameasure'=>1),
|
||||||
|
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>65, 'isameasure'=>1),
|
||||||
|
'total' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1),
|
||||||
|
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1),
|
||||||
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
|
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||||
|
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||||
|
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||||
|
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||||
|
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||||
|
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||||
|
'last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||||
|
'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||||
|
'date_when' =>array('type'=>'datetime', 'label'=>'Date when', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
|
||||||
|
'date_last_gen' =>array('type'=>'datetime', 'label'=>'Date last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
|
||||||
|
'nb_gen_done' =>array('type'=>'integer', 'label'=>'Nb gen done', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||||
|
'nb_gen_max' =>array('type'=>'integer', 'label'=>'Nb gen max', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
|
||||||
|
'frequency' =>array('type'=>'integer', 'label'=>'Frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||||
|
'usenewprice' =>array('type'=>'integer', 'label'=>'UseNewPrice', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||||
|
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>160, 'isameasure'=>1),
|
||||||
|
'auto_validate' =>array('type'=>'integer', 'label'=>'Auto validate', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||||
|
'generate_pdf' =>array('type'=>'integer', 'label'=>'Generate pdf', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
|
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||||
|
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||||
|
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
|
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency tx', 'enabled'=>1, 'visible'=>-1, 'position'=>190, 'isameasure'=>1),
|
||||||
|
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>1, 'visible'=>-1, 'position'=>195, 'isameasure'=>1),
|
||||||
|
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>1, 'visible'=>-1, 'position'=>200, 'isameasure'=>1),
|
||||||
|
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>205, 'isameasure'=>1),
|
||||||
|
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>210),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>215),
|
||||||
|
'suspended' =>array('type'=>'integer', 'label'=>'Suspended', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||||
|
);
|
||||||
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
const STATUS_NOTSUSPENDED = 0;
|
const STATUS_NOTSUSPENDED = 0;
|
||||||
const STATUS_SUSPENDED = 1;
|
const STATUS_SUSPENDED = 1;
|
||||||
|
|
||||||
@ -377,7 +451,7 @@ class FactureRec extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
|
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
|
||||||
{
|
{
|
||||||
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
||||||
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
|
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||||
$sql .= ', f.date_lim_reglement as dlr';
|
$sql .= ', f.date_lim_reglement as dlr';
|
||||||
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
|
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
|
||||||
@ -419,7 +493,6 @@ class FactureRec extends CommonInvoice
|
|||||||
$this->type = $obj->type;
|
$this->type = $obj->type;
|
||||||
$this->datep = $obj->dp;
|
$this->datep = $obj->dp;
|
||||||
$this->date = $obj->df;
|
$this->date = $obj->df;
|
||||||
$this->amount = $obj->amount;
|
|
||||||
$this->remise_percent = $obj->remise_percent;
|
$this->remise_percent = $obj->remise_percent;
|
||||||
$this->remise_absolue = $obj->remise_absolue;
|
$this->remise_absolue = $obj->remise_absolue;
|
||||||
$this->remise = $obj->remise;
|
$this->remise = $obj->remise;
|
||||||
@ -1602,7 +1675,7 @@ class FactureRec extends CommonInvoice
|
|||||||
$xnbp++;
|
$xnbp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->usenewprice = 1;
|
$this->usenewprice = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -221,6 +221,102 @@ class Facture extends CommonInvoice
|
|||||||
*/
|
*/
|
||||||
public $retained_warranty_fk_cond_reglement;
|
public $retained_warranty_fk_cond_reglement;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||||
|
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||||
|
* 'label' the translation key.
|
||||||
|
* 'enabled' is a condition when the field must be managed.
|
||||||
|
* 'position' is the sort order of field.
|
||||||
|
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||||
|
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||||
|
* 'noteditable' says if field is not editable (1 or 0)
|
||||||
|
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||||
|
* 'index' if we want an index in database.
|
||||||
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||||
|
* 'help' is a string visible as a tooltip on field
|
||||||
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
|
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||||
|
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||||
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
|
*
|
||||||
|
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
|
/**
|
||||||
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
|
*/
|
||||||
|
public $fields=array(
|
||||||
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
|
'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15),
|
||||||
|
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1),
|
||||||
|
'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>25),
|
||||||
|
'ref_int' =>array('type'=>'varchar(255)', 'label'=>'Ref int', 'enabled'=>1, 'visible'=>0, 'position'=>30),
|
||||||
|
'type' =>array('type'=>'smallint(6)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||||
|
'ref_client' =>array('type'=>'varchar(255)', 'label'=>'Ref client', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
|
'increment' =>array('type'=>'varchar(10)', 'label'=>'Increment', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50),
|
||||||
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||||
|
'datef' =>array('type'=>'date', 'label'=>'DateInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
||||||
|
'date_valid' =>array('type'=>'date', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||||
|
'date_closing' =>array('type'=>'datetime', 'label'=>'Date closing', 'enabled'=>1, 'visible'=>-1, 'position'=>70),
|
||||||
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>75),
|
||||||
|
'paye' =>array('type'=>'smallint(6)', 'label'=>'InvoicePaidCompletely', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>80),
|
||||||
|
//'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>85),
|
||||||
|
'remise_percent' =>array('type'=>'double', 'label'=>'Remise percent', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||||
|
'remise_absolue' =>array('type'=>'double', 'label'=>'Remise absolue', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||||
|
'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||||
|
'close_code' =>array('type'=>'varchar(16)', 'label'=>'EarlyClosingReason', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||||
|
'close_note' =>array('type'=>'varchar(128)', 'label'=>'EarlyClosingComment', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||||
|
'tva' =>array('type'=>'double(24,8)', 'label'=>'TotalVAT', 'enabled'=>1, 'visible'=>-1, 'position'=>115, 'isameasure'=>1),
|
||||||
|
'localtax1' =>array('type'=>'double(24,8)', 'label'=>'Localtax1', 'enabled'=>1, 'visible'=>-1, 'position'=>120, 'isameasure'=>1),
|
||||||
|
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||||
|
'revenuestamp' =>array('type'=>'double(24,8)', 'label'=>'RevenueStamp', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||||
|
'total' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||||
|
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||||
|
'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Paid', 3=>'Abandonned')),
|
||||||
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>150),
|
||||||
|
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>155),
|
||||||
|
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||||
|
'fk_user_closing' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||||
|
'fk_facture_source' =>array('type'=>'integer', 'label'=>'SourceInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||||
|
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
|
||||||
|
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
|
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||||
|
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||||
|
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateDue', 'enabled'=>1, 'visible'=>-1, 'position'=>200),
|
||||||
|
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||||
|
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||||
|
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
|
||||||
|
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||||
|
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
|
||||||
|
'situation_counter' =>array('type'=>'smallint(6)', 'label'=>'Situation counter', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>235),
|
||||||
|
'situation_final' =>array('type'=>'smallint(6)', 'label'=>'Situation final', 'enabled'=>'empty($conf->global->INVOICE_USE_SITUATION) ? 0 : 1', 'visible'=>-1, 'position'=>240),
|
||||||
|
'retained_warranty' =>array('type'=>'double', 'label'=>'Retained warranty', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>245),
|
||||||
|
'retained_warranty_date_limit' =>array('type'=>'date', 'label'=>'Retained warranty date limit', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>250),
|
||||||
|
'retained_warranty_fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Retained warranty fk cond reglement', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY', 'visible'=>-1, 'position'=>255),
|
||||||
|
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermsCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260),
|
||||||
|
'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermsLocation', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265),
|
||||||
|
'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270),
|
||||||
|
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>275),
|
||||||
|
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCode', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280),
|
||||||
|
'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285),
|
||||||
|
'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ht', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290),
|
||||||
|
'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total tva', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>295),
|
||||||
|
'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Multicurrency total ttc', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>300),
|
||||||
|
'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305),
|
||||||
|
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>310),
|
||||||
|
'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315),
|
||||||
|
'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>320),
|
||||||
|
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>220),
|
||||||
|
);
|
||||||
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard invoice
|
* Standard invoice
|
||||||
*/
|
*/
|
||||||
@ -284,6 +380,7 @@ class Facture extends CommonInvoice
|
|||||||
const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
|
const CLOSECODE_ABANDONED = 'abandon'; // Abandonned - other
|
||||||
const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
|
const CLOSECODE_REPLACED = 'replaced'; // Closed after doing a replacement invoice
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -1354,7 +1451,7 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
|
||||||
|
|
||||||
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
|
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc';
|
||||||
$sql .= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
$sql .= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
|
||||||
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
|
$sql .= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||||
$sql .= ', f.datef as df, f.date_pointoftax';
|
$sql .= ', f.datef as df, f.date_pointoftax';
|
||||||
@ -2035,7 +2132,7 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we decrement stock on invoice validation, we increment
|
// If we decrease stock on invoice validation, we increase back if a warehouse id was provided
|
||||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1)
|
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse != -1)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||||
@ -2646,7 +2743,7 @@ class Facture extends CommonInvoice
|
|||||||
$this->oldcopy = clone $this;
|
$this->oldcopy = clone $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si on decremente le produit principal et ses composants a la validation de facture, on réincrement
|
// If we decrease stock on invoice validation, we increase back
|
||||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php';
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2015-2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
|
||||||
|
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -98,12 +99,10 @@ $search_country = GETPOST("search_country", 'int');
|
|||||||
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
|
||||||
$search_user = GETPOST('search_user', 'int');
|
$search_user = GETPOST('search_user', 'int');
|
||||||
$search_sale = GETPOST('search_sale', 'int');
|
$search_sale = GETPOST('search_sale', 'int');
|
||||||
$search_day = GETPOST('search_day', 'int');
|
$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int'));
|
||||||
$search_month = GETPOST('search_month', 'int');
|
$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int'));
|
||||||
$search_year = GETPOST('search_year', 'int');
|
$search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int'));
|
||||||
$search_day_lim = GETPOST('search_day_lim', 'int');
|
$search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int'));
|
||||||
$search_month_lim = GETPOST('search_month_lim', 'int');
|
|
||||||
$search_year_lim = GETPOST('search_year_lim', 'int');
|
|
||||||
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
$search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
|
||||||
$search_btn = GETPOST('button_search', 'alpha');
|
$search_btn = GETPOST('button_search', 'alpha');
|
||||||
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
|
||||||
@ -248,14 +247,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
|
|||||||
$search_type = '';
|
$search_type = '';
|
||||||
$search_country = '';
|
$search_country = '';
|
||||||
$search_type_thirdparty = '';
|
$search_type_thirdparty = '';
|
||||||
$search_day = '';
|
$search_date_start = '';
|
||||||
$search_year = '';
|
$search_date_end = '';
|
||||||
$search_month = '';
|
$search_datelimit_start = '';
|
||||||
|
$search_datelimit_end = '';
|
||||||
$option = '';
|
$option = '';
|
||||||
$filter = '';
|
$filter = '';
|
||||||
$search_day_lim = '';
|
|
||||||
$search_year_lim = '';
|
|
||||||
$search_month_lim = '';
|
|
||||||
$toselect = '';
|
$toselect = '';
|
||||||
$search_array_options = array();
|
$search_array_options = array();
|
||||||
$search_categ_cus = 0;
|
$search_categ_cus = 0;
|
||||||
@ -478,12 +475,15 @@ if ($search_status != '-1' && $search_status != '')
|
|||||||
$sql .= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example
|
$sql .= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
|
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode);
|
||||||
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
|
if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms);
|
||||||
if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source);
|
if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source);
|
||||||
if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source);
|
if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source);
|
||||||
$sql .= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year);
|
if ($search_date_start) $sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
|
||||||
$sql .= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim);
|
if ($search_date_end) $sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
|
||||||
|
if ($search_datelimit_start) $sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'";
|
||||||
|
if ($search_datelimit_end) $sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";
|
||||||
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'";
|
||||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
|
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".(int) $search_sale;
|
||||||
if ($search_user > 0)
|
if ($search_user > 0)
|
||||||
@ -571,12 +571,10 @@ if ($resql)
|
|||||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||||
if ($sall) $param .= '&sall='.urlencode($sall);
|
if ($sall) $param .= '&sall='.urlencode($sall);
|
||||||
if ($search_day) $param .= '&search_day='.urlencode($search_day);
|
if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start);
|
||||||
if ($search_month) $param .= '&search_month='.urlencode($search_month);
|
if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end);
|
||||||
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
if ($search_datelimit_start) $param .= '&search_datelimit_start='.urlencode($search_datelimit_start);
|
||||||
if ($search_day_lim) $param .= '&search_day_lim='.urlencode($search_day_lim);
|
if ($search_datelimit_end) $param .= '&search_datelimit_end='.urlencode($search_datelimit_end);
|
||||||
if ($search_month_lim) $param .= '&search_month_lim='.urlencode($search_month_lim);
|
|
||||||
if ($search_year_lim) $param .= '&search_year_lim='.urlencode($search_year_lim);
|
|
||||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||||
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer);
|
||||||
if ($search_project_ref) $param .= '&search_project_ref='.urlencode($search_project_ref);
|
if ($search_project_ref) $param .= '&search_project_ref='.urlencode($search_project_ref);
|
||||||
@ -752,20 +750,29 @@ if ($resql)
|
|||||||
// Date invoice
|
// Date invoice
|
||||||
if (!empty($arrayfields['f.date']['checked']))
|
if (!empty($arrayfields['f.date']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
print '<div class="nowrap">';
|
||||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
print $langs->trans('From').' ';
|
||||||
$formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Date due
|
// Date due
|
||||||
if (!empty($arrayfields['f.date_lim_reglement']['checked']))
|
if (!empty($arrayfields['f.date_lim_reglement']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre nowraponall" align="center">';
|
print '<td class="liste_titre center">';
|
||||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
|
print '<div class="nowrap">';
|
||||||
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
|
print $langs->trans('From').' ';
|
||||||
$formother->select_year($search_year_lim ? $search_year_lim : -1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
|
print $form->selectDate($search_datelimit_start ? $search_datelimit_start : -1, 'search_datelimit_start', 0, 0, 1);
|
||||||
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late' ? ' checked' : '').'> '.$langs->trans("Alert");
|
print '</div>';
|
||||||
|
print '<div class="nowrap">';
|
||||||
|
print $langs->trans('to').' ';
|
||||||
|
print $form->selectDate($search_datelimit_end ? $search_datelimit_end : -1, 'search_datelimit_end', 0, 0, 1);
|
||||||
|
print '</div>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
// Project ref
|
// Project ref
|
||||||
@ -778,7 +785,7 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.'"></td>';
|
print '<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_project" value="'.$search_project.'"></td>';
|
||||||
}
|
}
|
||||||
// Thirpdarty
|
// Thirdparty
|
||||||
if (!empty($arrayfields['s.nom']['checked']))
|
if (!empty($arrayfields['s.nom']['checked']))
|
||||||
{
|
{
|
||||||
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_societe" value="'.$search_societe.'"></td>';
|
print '<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_societe" value="'.$search_societe.'"></td>';
|
||||||
@ -1054,7 +1061,6 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1);
|
||||||
}
|
}
|
||||||
print empty($obj->increment) ? '' : ' ('.$obj->increment.')';
|
|
||||||
|
|
||||||
$filename = dol_sanitizeFileName($obj->ref);
|
$filename = dol_sanitizeFileName($obj->ref);
|
||||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||||
|
|||||||
@ -75,6 +75,8 @@ if ($facid > 0)
|
|||||||
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
||||||
$hookmanager->initHooks(array('paiementcard', 'globalcard'));
|
$hookmanager->initHooks(array('paiementcard', 'globalcard'));
|
||||||
|
|
||||||
|
$formquestion = array();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -859,7 +861,7 @@ if (!GETPOST('action', 'aZ09'))
|
|||||||
if (!$sortorder) $sortorder = 'DESC';
|
if (!$sortorder) $sortorder = 'DESC';
|
||||||
if (!$sortfield) $sortfield = 'p.datep';
|
if (!$sortfield) $sortfield = 'p.datep';
|
||||||
|
|
||||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
|
$sql = 'SELECT p.datep as dp, p.amount, f.total_ttc as fa_amount, f.ref';
|
||||||
$sql .= ', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
$sql .= ', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||||
$sql .= ', '.MAIN_DB_PREFIX.'facture as f';
|
$sql .= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||||
@ -882,10 +884,10 @@ if (!GETPOST('action', 'aZ09'))
|
|||||||
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
|
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
|
||||||
print '<table class="noborder centpercent">';
|
print '<table class="noborder centpercent">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'ref', '', '', '', $sortfield, $sortorder);
|
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'f.ref', '', '', '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'dp', '', '', '', $sortfield, $sortorder);
|
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'p.datep', '', '', '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'libelle', '', '', '', $sortfield, $sortorder);
|
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'c.libelle', '', '', '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', '', $sortfield, $sortorder, 'right ');
|
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'p.amount', '', '', '', $sortfield, $sortorder, 'right ');
|
||||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
|||||||
@ -327,28 +327,6 @@ class Paiement extends CommonObject
|
|||||||
|
|
||||||
//var_dump($invoice->total_ttc.' - '.$paiement.' -'.$creditnotes.' - '.$deposits.' - '.$remaintopay);exit;
|
//var_dump($invoice->total_ttc.' - '.$paiement.' -'.$creditnotes.' - '.$deposits.' - '.$remaintopay);exit;
|
||||||
|
|
||||||
/* Why this ? We can remove i think.
|
|
||||||
// If there is withdrawals request to do and not done yet on the invoice the payment is on, we wait before closing.
|
|
||||||
$mustwait=0;
|
|
||||||
$sqlrequest ="SELECT COUNT(rowid) FROM ".MAIN_DB_PREFIX."prelevement_facture_demande";
|
|
||||||
$sqlrequest.="WHERE fk_facture = ".$invoice->id." AND traite = 0";
|
|
||||||
...
|
|
||||||
|
|
||||||
$listofpayments=$invoice->getListOfPayments();
|
|
||||||
foreach($listofpayments as $paym)
|
|
||||||
{
|
|
||||||
// This payment on invoice $invoice might be the one we record or another one
|
|
||||||
if ($paym['type']=='PRE')
|
|
||||||
{
|
|
||||||
if (! empty($conf->prelevement->enabled))
|
|
||||||
{
|
|
||||||
// if not, $mustwait++; // This will disable automatic close on invoice to allow to process
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//Invoice types that are eligible for changing status to paid
|
//Invoice types that are eligible for changing status to paid
|
||||||
$affected_types = array(
|
$affected_types = array(
|
||||||
Facture::TYPE_STANDARD,
|
Facture::TYPE_STANDARD,
|
||||||
|
|||||||
@ -117,7 +117,7 @@ if ($id > 0)
|
|||||||
|
|
||||||
$TData = array();
|
$TData = array();
|
||||||
|
|
||||||
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.amount, f.datef as df,";
|
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.total_ttc, f.datef as df,";
|
||||||
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||||
$sql .= " u.login, u.rowid as userid";
|
$sql .= " u.login, u.rowid as userid";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
|
||||||
|
|||||||
@ -1364,7 +1364,7 @@ else
|
|||||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td>';
|
||||||
print '<td colspan="3">';
|
print '<td colspan="3">';
|
||||||
print $form->showCategories($object->id, 'contact', 1);
|
print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -86,9 +86,9 @@ class Contact extends CommonObject
|
|||||||
'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'Phone mobile', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'Phone mobile', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||||
'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||||
'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||||
'socialnetworks' =>array('type'=>'text', 'label'=>'Socialnetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||||
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||||
'priv' =>array('type'=>'smallint(6)', 'label'=>'Priv', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
|
'priv' =>array('type'=>'smallint(6)', 'label'=>'Private', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
|
||||||
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
|
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
|
||||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||||
@ -181,6 +181,10 @@ class Contact extends CommonObject
|
|||||||
public $phone_mobile;
|
public $phone_mobile;
|
||||||
public $fax;
|
public $fax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private or public
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public $priv;
|
public $priv;
|
||||||
|
|
||||||
public $birthday;
|
public $birthday;
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2015-2018 Ferran Marcet <fmarcet@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
|
||||||
@ -73,6 +73,11 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $ismultientitymanaged = 1;
|
public $ismultientitymanaged = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int Does object support extrafields ? 0=No, 1=Yes
|
||||||
|
*/
|
||||||
|
public $isextrafieldmanaged = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
* 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
|
||||||
* @var integer
|
* @var integer
|
||||||
@ -160,12 +165,6 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public $date_contrat;
|
public $date_contrat;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var integer|string Date of contract closure
|
|
||||||
* @deprecated we close contract lines, not a contract
|
|
||||||
*/
|
|
||||||
public $date_cloture;
|
|
||||||
|
|
||||||
public $commercial_signature_id;
|
public $commercial_signature_id;
|
||||||
public $commercial_suivi_id;
|
public $commercial_suivi_id;
|
||||||
|
|
||||||
@ -189,6 +188,34 @@ class Contrat extends CommonObject
|
|||||||
protected $lines_id_index_mapper = array();
|
protected $lines_id_index_mapper = array();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
|
||||||
|
* Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
|
||||||
|
* 'label' the translation key.
|
||||||
|
* 'enabled' is a condition when the field must be managed.
|
||||||
|
* 'position' is the sort order of field.
|
||||||
|
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||||
|
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||||
|
* 'noteditable' says if field is not editable (1 or 0)
|
||||||
|
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
|
||||||
|
* 'index' if we want an index in database.
|
||||||
|
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||||
|
* 'searchall' is 1 if we want to search in this field when making a search from the quick search button.
|
||||||
|
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||||
|
* 'css' is the CSS style to use on field. For example: 'maxwidth200'
|
||||||
|
* 'help' is a string visible as a tooltip on field
|
||||||
|
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||||
|
* 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
|
||||||
|
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||||
|
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||||
|
*
|
||||||
|
* Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// BEGIN MODULEBUILDER PROPERTIES
|
||||||
|
/**
|
||||||
|
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||||
|
*/
|
||||||
public $fields=array(
|
public $fields=array(
|
||||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||||
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15),
|
'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>15),
|
||||||
@ -198,17 +225,12 @@ class Contrat extends CommonObject
|
|||||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>35),
|
||||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40),
|
||||||
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||||
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
|
'statut' =>array('type'=>'smallint(6)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'position'=>500, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 2=>'Closed')),
|
||||||
'mise_en_service' =>array('type'=>'datetime', 'label'=>'Mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
|
||||||
'fin_validite' =>array('type'=>'datetime', 'label'=>'Fin validite', 'enabled'=>1, 'visible'=>-1, 'position'=>60),
|
|
||||||
'date_cloture' =>array('type'=>'datetime', 'label'=>'Date cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
|
||||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>70),
|
||||||
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>75),
|
||||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||||
'fk_user_mise_en_service' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user mise en service', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
|
||||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
|
||||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||||
@ -218,6 +240,7 @@ class Contrat extends CommonObject
|
|||||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>135),
|
||||||
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'Last main doc', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
|
||||||
);
|
);
|
||||||
|
// END MODULEBUILDER PROPERTIES
|
||||||
|
|
||||||
const STATUS_DRAFT = 0;
|
const STATUS_DRAFT = 0;
|
||||||
const STATUS_VALIDATED = 1;
|
const STATUS_VALIDATED = 1;
|
||||||
@ -662,12 +685,12 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '')
|
public function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '')
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
|
$sql = "SELECT rowid, statut, ref, fk_soc,";
|
||||||
$sql .= " ref_supplier, ref_customer,";
|
$sql .= " ref_supplier, ref_customer,";
|
||||||
$sql .= " ref_ext,";
|
$sql .= " ref_ext,";
|
||||||
$sql .= " entity,";
|
$sql .= " entity,";
|
||||||
$sql .= " fk_user_mise_en_service, date_contrat as datecontrat,";
|
$sql .= " date_contrat as datecontrat,";
|
||||||
$sql .= " fk_user_author, fin_validite, date_cloture,";
|
$sql .= " fk_user_author,";
|
||||||
$sql .= " fk_projet as fk_project,";
|
$sql .= " fk_projet as fk_project,";
|
||||||
$sql .= " fk_commercial_signature, fk_commercial_suivi,";
|
$sql .= " fk_commercial_signature, fk_commercial_suivi,";
|
||||||
$sql .= " note_private, note_public, model_pdf, extraparams";
|
$sql .= " note_private, note_public, model_pdf, extraparams";
|
||||||
@ -710,15 +733,10 @@ class Contrat extends CommonObject
|
|||||||
$this->ref_ext = $obj->ref_ext;
|
$this->ref_ext = $obj->ref_ext;
|
||||||
$this->entity = $obj->entity;
|
$this->entity = $obj->entity;
|
||||||
$this->statut = $obj->statut;
|
$this->statut = $obj->statut;
|
||||||
$this->mise_en_service = $this->db->jdate($obj->datemise);
|
|
||||||
|
|
||||||
$this->date_contrat = $this->db->jdate($obj->datecontrat);
|
$this->date_contrat = $this->db->jdate($obj->datecontrat);
|
||||||
$this->date_creation = $this->db->jdate($obj->datecontrat);
|
$this->date_creation = $this->db->jdate($obj->datecontrat);
|
||||||
|
|
||||||
$this->fin_validite = $this->db->jdate($obj->fin_validite);
|
|
||||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
|
||||||
|
|
||||||
|
|
||||||
$this->user_author_id = $obj->fk_user_author;
|
$this->user_author_id = $obj->fk_user_author;
|
||||||
|
|
||||||
$this->commercial_signature_id = $obj->fk_commercial_signature;
|
$this->commercial_signature_id = $obj->fk_commercial_signature;
|
||||||
@ -738,7 +756,7 @@ class Contrat extends CommonObject
|
|||||||
|
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
// Retreive all extrafields
|
// Retrieve all extrafields
|
||||||
// fetch optionals attributes and labels
|
// fetch optionals attributes and labels
|
||||||
$this->fetch_optionals();
|
$this->fetch_optionals();
|
||||||
|
|
||||||
@ -1333,8 +1351,6 @@ class Contrat extends CommonObject
|
|||||||
if (isset($this->fk_soc)) $this->fk_soc = (int) $this->fk_soc;
|
if (isset($this->fk_soc)) $this->fk_soc = (int) $this->fk_soc;
|
||||||
if (isset($this->fk_commercial_signature)) $this->fk_commercial_signature = trim($this->fk_commercial_signature);
|
if (isset($this->fk_commercial_signature)) $this->fk_commercial_signature = trim($this->fk_commercial_signature);
|
||||||
if (isset($this->fk_commercial_suivi)) $this->fk_commercial_suivi = trim($this->fk_commercial_suivi);
|
if (isset($this->fk_commercial_suivi)) $this->fk_commercial_suivi = trim($this->fk_commercial_suivi);
|
||||||
if (isset($this->fk_user_mise_en_service)) $this->fk_user_mise_en_service = (int) $this->fk_user_mise_en_service;
|
|
||||||
if (isset($this->fk_user_cloture)) $this->fk_user_cloture = (int) $this->fk_user_cloture;
|
|
||||||
if (isset($this->note_private)) $this->note_private = trim($this->note_private);
|
if (isset($this->note_private)) $this->note_private = trim($this->note_private);
|
||||||
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
|
if (isset($this->note_public)) $this->note_public = trim($this->note_public);
|
||||||
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
|
if (isset($this->import_key)) $this->import_key = trim($this->import_key);
|
||||||
@ -1352,15 +1368,10 @@ class Contrat extends CommonObject
|
|||||||
$sql .= " entity=".$conf->entity.",";
|
$sql .= " entity=".$conf->entity.",";
|
||||||
$sql .= " date_contrat=".(dol_strlen($this->date_contrat) != 0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').",";
|
$sql .= " date_contrat=".(dol_strlen($this->date_contrat) != 0 ? "'".$this->db->idate($this->date_contrat)."'" : 'null').",";
|
||||||
$sql .= " statut=".(isset($this->statut) ? $this->statut : "null").",";
|
$sql .= " statut=".(isset($this->statut) ? $this->statut : "null").",";
|
||||||
$sql .= " mise_en_service=".(dol_strlen($this->mise_en_service) != 0 ? "'".$this->db->idate($this->mise_en_service)."'" : 'null').",";
|
|
||||||
$sql .= " fin_validite=".(dol_strlen($this->fin_validite) != 0 ? "'".$this->db->idate($this->fin_validite)."'" : 'null').",";
|
|
||||||
$sql .= " date_cloture=".(dol_strlen($this->date_cloture) != 0 ? "'".$this->db->idate($this->date_cloture)."'" : 'null').",";
|
|
||||||
$sql .= " fk_soc=".($this->fk_soc > 0 ? $this->fk_soc : "null").",";
|
$sql .= " fk_soc=".($this->fk_soc > 0 ? $this->fk_soc : "null").",";
|
||||||
$sql .= " fk_projet=".($this->fk_project > 0 ? $this->fk_project : "null").",";
|
$sql .= " fk_projet=".($this->fk_project > 0 ? $this->fk_project : "null").",";
|
||||||
$sql .= " fk_commercial_signature=".(isset($this->fk_commercial_signature) ? $this->fk_commercial_signature : "null").",";
|
$sql .= " fk_commercial_signature=".(isset($this->fk_commercial_signature) ? $this->fk_commercial_signature : "null").",";
|
||||||
$sql .= " fk_commercial_suivi=".(isset($this->fk_commercial_suivi) ? $this->fk_commercial_suivi : "null").",";
|
$sql .= " fk_commercial_suivi=".(isset($this->fk_commercial_suivi) ? $this->fk_commercial_suivi : "null").",";
|
||||||
$sql .= " fk_user_mise_en_service=".(isset($this->fk_user_mise_en_service) ? $this->fk_user_mise_en_service : "null").",";
|
|
||||||
$sql .= " fk_user_cloture=".(isset($this->fk_user_cloture) ? $this->fk_user_cloture : "null").",";
|
|
||||||
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
|
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
|
||||||
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
|
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
|
||||||
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
|
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
|
||||||
@ -2062,9 +2073,9 @@ class Contrat extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function info($id)
|
public function info($id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.rowid, c.ref, c.datec, c.date_cloture,";
|
$sql = "SELECT c.rowid, c.ref, c.datec,";
|
||||||
$sql .= " c.tms as date_modification,";
|
$sql .= " c.tms as date_modification,";
|
||||||
$sql .= " fk_user_author, fk_user_cloture";
|
$sql .= " fk_user_author";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
$sql .= " FROM ".MAIN_DB_PREFIX."contrat as c";
|
||||||
$sql .= " WHERE c.rowid = ".$id;
|
$sql .= " WHERE c.rowid = ".$id;
|
||||||
|
|
||||||
@ -2083,15 +2094,9 @@ class Contrat extends CommonObject
|
|||||||
$this->user_creation = $cuser;
|
$this->user_creation = $cuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($obj->fk_user_cloture) {
|
|
||||||
$cuser = new User($this->db);
|
|
||||||
$cuser->fetch($obj->fk_user_cloture);
|
|
||||||
$this->user_cloture = $cuser;
|
|
||||||
}
|
|
||||||
$this->ref = (!$obj->ref) ? $obj->rowid : $obj->ref;
|
$this->ref = (!$obj->ref) ? $obj->rowid : $obj->ref;
|
||||||
$this->date_creation = $this->db->jdate($obj->datec);
|
$this->date_creation = $this->db->jdate($obj->datec);
|
||||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||||
$this->date_cloture = $this->db->jdate($obj->date_cloture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
@ -3040,6 +3045,7 @@ class ContratLigne extends CommonObjectLine
|
|||||||
|
|
||||||
$this->oldcopy = new ContratLigne($this->db);
|
$this->oldcopy = new ContratLigne($this->db);
|
||||||
$this->oldcopy->fetch($this->id);
|
$this->oldcopy->fetch($this->id);
|
||||||
|
$this->oldcopy->fetch_optionals();
|
||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET";
|
||||||
|
|||||||
@ -33,6 +33,9 @@ if ($action == 'update' && is_array($arrayofparameters))
|
|||||||
|
|
||||||
$ok = true;
|
$ok = true;
|
||||||
foreach ($arrayofparameters as $key => $val)
|
foreach ($arrayofparameters as $key => $val)
|
||||||
|
{
|
||||||
|
// Modify constant only if key was posted (avoid resetting key to the null value)
|
||||||
|
if (GETPOSTISSET($key))
|
||||||
{
|
{
|
||||||
$result = dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
|
$result = dolibarr_set_const($db, $key, GETPOST($key, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
@ -41,6 +44,7 @@ if ($action == 'update' && is_array($arrayofparameters))
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class box_factures_fourn_imp extends ModeleBoxes
|
|||||||
{
|
{
|
||||||
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
$sql = "SELECT s.nom as name, s.rowid as socid,";
|
||||||
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
|
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
|
||||||
$sql.= " f.amount, f.datef as df,";
|
$sql.= " f.datef as df,";
|
||||||
$sql.= " f.total_ht as total_ht,";
|
$sql.= " f.total_ht as total_ht,";
|
||||||
$sql.= " f.tva as total_tva,";
|
$sql.= " f.tva as total_tva,";
|
||||||
$sql.= " f.total_ttc,";
|
$sql.= " f.total_ttc,";
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class box_factures_imp extends ModeleBoxes
|
|||||||
$sql .= " s.logo,";
|
$sql .= " s.logo,";
|
||||||
$sql .= " f.ref, f.date_lim_reglement as datelimite,";
|
$sql .= " f.ref, f.date_lim_reglement as datelimite,";
|
||||||
$sql .= " f.type,";
|
$sql .= " f.type,";
|
||||||
$sql.= " f.amount, f.datef as df,";
|
$sql .= " f.datef as df,";
|
||||||
$sql .= " f.total as total_ht,";
|
$sql .= " f.total as total_ht,";
|
||||||
$sql .= " f.tva as total_tva,";
|
$sql .= " f.tva as total_tva,";
|
||||||
$sql .= " f.total_ttc,";
|
$sql .= " f.total_ttc,";
|
||||||
@ -110,7 +110,7 @@ class box_factures_imp extends ModeleBoxes
|
|||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||||
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
|
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
|
||||||
$sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
|
$sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
|
||||||
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
|
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
|
||||||
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";
|
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";
|
||||||
$sql .= $this->db->plimit($max, 0);
|
$sql .= $this->db->plimit($max, 0);
|
||||||
|
|||||||
@ -82,15 +82,15 @@ class CMailFile
|
|||||||
public $headers;
|
public $headers;
|
||||||
public $message;
|
public $message;
|
||||||
/**
|
/**
|
||||||
* @var array fullfilenames list
|
* @var array fullfilenames list (full path of filename on file system)
|
||||||
*/
|
*/
|
||||||
public $filename_list = array();
|
public $filename_list = array();
|
||||||
/**
|
/**
|
||||||
* @var array mimetypes of files list
|
* @var array mimetypes of files list (List of MIME type of attached files)
|
||||||
*/
|
*/
|
||||||
public $mimetype_list = array();
|
public $mimetype_list = array();
|
||||||
/**
|
/**
|
||||||
* @var array filenames list
|
* @var array filenames list (List of attached file name in message)
|
||||||
*/
|
*/
|
||||||
public $mimefilename_list = array();
|
public $mimefilename_list = array();
|
||||||
|
|
||||||
@ -137,6 +137,13 @@ class CMailFile
|
|||||||
{
|
{
|
||||||
global $conf, $dolibarr_main_data_root;
|
global $conf, $dolibarr_main_data_root;
|
||||||
|
|
||||||
|
// Clean values of $mimefilename_list
|
||||||
|
if (is_array($mimefilename_list)) {
|
||||||
|
foreach($mimefilename_list as $key => $val) {
|
||||||
|
$mimefilename_list[$key] = dol_string_unaccent($mimefilename_list[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->subject = $subject;
|
$this->subject = $subject;
|
||||||
$this->addr_to = $to;
|
$this->addr_to = $to;
|
||||||
$this->addr_from = $from;
|
$this->addr_from = $from;
|
||||||
@ -156,7 +163,6 @@ class CMailFile
|
|||||||
$this->mimetype_list = $mimetype_list;
|
$this->mimetype_list = $mimetype_list;
|
||||||
$this->mimefilename_list = $mimefilename_list;
|
$this->mimefilename_list = $mimefilename_list;
|
||||||
|
|
||||||
|
|
||||||
// Define this->sendmode
|
// Define this->sendmode
|
||||||
$this->sendmode = '';
|
$this->sendmode = '';
|
||||||
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default')
|
||||||
@ -323,7 +329,13 @@ class CMailFile
|
|||||||
$smtps = new SMTPs();
|
$smtps = new SMTPs();
|
||||||
$smtps->setCharSet($conf->file->character_set_client);
|
$smtps->setCharSet($conf->file->character_set_client);
|
||||||
|
|
||||||
$smtps->setSubject($this->encodetorfc2822($subject));
|
// Encode subject if required.
|
||||||
|
$subjecttouse = $subject;
|
||||||
|
if (! ascii_check($subjecttouse)) {
|
||||||
|
$subjecttouse = $this->encodetorfc2822($subjecttouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
$smtps->setSubject($subjecttouse);
|
||||||
$smtps->setTO($this->getValidAddress($to, 0, 1));
|
$smtps->setTO($this->getValidAddress($to, 0, 1));
|
||||||
$smtps->setFrom($this->getValidAddress($from, 0, 1));
|
$smtps->setFrom($this->getValidAddress($from, 0, 1));
|
||||||
$smtps->setTrackId($trackid);
|
$smtps->setTrackId($trackid);
|
||||||
@ -669,8 +681,14 @@ class CMailFile
|
|||||||
|
|
||||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
if (!empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
|
||||||
|
|
||||||
if (!empty($additionnalparam)) $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $additionnalparam);
|
// Encode subject if required.
|
||||||
else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers);
|
$subjecttouse = $this->subject;
|
||||||
|
if (! ascii_check($subjecttouse)) {
|
||||||
|
$subjecttouse = $this->encodetorfc2822($subjecttouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($additionnalparam)) $res = mail($dest, $subjecttouse, $this->message, $this->headers, $additionnalparam);
|
||||||
|
else $res = mail($dest, $subjecttouse, $this->message, $this->headers);
|
||||||
|
|
||||||
if (!$res)
|
if (!$res)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1090,9 +1090,9 @@ abstract class CommonDocGenerator
|
|||||||
if (!$reshook)
|
if (!$reshook)
|
||||||
{
|
{
|
||||||
if (empty($columnText)) return;
|
if (empty($columnText)) return;
|
||||||
$pdf->SetXY($this->getColumnContentXStart($colKey), $curY); // Set curent position
|
$pdf->SetXY($this->getColumnContentXStart($colKey) - 1, $curY); // Set curent position
|
||||||
$colDef = $this->cols[$colKey];
|
$colDef = $this->cols[$colKey];
|
||||||
$pdf->writeHTMLCell($this->getColumnContentWidth($colKey), 2, $this->getColumnContentXStart($colKey), $curY, $columnText, 0, 0, 0, true, $colDef['content']['align']);
|
$pdf->writeHTMLCell($this->getColumnContentWidth($colKey) + 2, 2, $this->getColumnContentXStart($colKey) - 1, $curY, $columnText, 0, 0, 0, true, $colDef['content']['align']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,7 +1123,7 @@ abstract class CommonDocGenerator
|
|||||||
*/
|
*/
|
||||||
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
|
public function pdfTabTitles(&$pdf, $tab_top, $tab_height, $outputlangs, $hidetop = 0)
|
||||||
{
|
{
|
||||||
global $hookmanager;
|
global $hookmanager, $conf;
|
||||||
|
|
||||||
foreach ($this->cols as $colKey => $colDef) {
|
foreach ($this->cols as $colKey => $colDef) {
|
||||||
$parameters = array(
|
$parameters = array(
|
||||||
@ -1153,6 +1153,14 @@ abstract class CommonDocGenerator
|
|||||||
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0]);
|
||||||
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
$textWidth = $colDef['width'] - $colDef['title']['padding'][3] - $colDef['title']['padding'][1];
|
||||||
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
$pdf->MultiCell($textWidth, 2, $colDef['title']['label'], '', $colDef['title']['align']);
|
||||||
|
|
||||||
|
global $outputlangsbis;
|
||||||
|
if (is_object($outputlangsbis)) {
|
||||||
|
$pdf->SetXY($colDef['xStartPos'] + $colDef['title']['padding'][3], $tab_top + $colDef['title']['padding'][0] + 4);
|
||||||
|
$textbis = $outputlangsbis->transnoentities($colDef['title']['textkey']);
|
||||||
|
$pdf->MultiCell($textWidth, 2, $textbis, '', $colDef['title']['align']);
|
||||||
|
}
|
||||||
|
|
||||||
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
$this->tabTitleHeight = max($pdf->GetY() - $tab_top + $colDef['title']['padding'][2], $this->tabTitleHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -343,6 +343,51 @@ abstract class CommonInvoice extends CommonObject
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->db->free($resql);
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
//look for credit notes and discounts and deposits
|
||||||
|
$sql = '';
|
||||||
|
if ($this->element == 'facture' || $this->element == 'invoice')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f';
|
||||||
|
$sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$this->id;
|
||||||
|
$sql.= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set)
|
||||||
|
}
|
||||||
|
elseif ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier')
|
||||||
|
{
|
||||||
|
$sql = 'SELECT rc.amount_ttc as amount, rc.multicurrency_amount_ttc as multicurrency_amount, rc.datec as date, f.ref as ref, rc.description as type';
|
||||||
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||||
|
$sql.= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$this->id;
|
||||||
|
$sql.= ' AND (f.type = 2 OR f.type = 0 OR f.type = 3)'; // Find discount coming from credit note or excess received or deposits (payments from deposits are always null except if FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is set)
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sql) {
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i=0;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($multicurrency) {
|
||||||
|
$retarray[]=array('amount'=>$obj->multicurrency_amount,'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'0', 'ref'=>$obj->ref);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$retarray[]=array('amount'=>$obj->amount,'type'=>$obj->type, 'date'=>$obj->date, 'num'=>'', 'ref'=>$obj->ref);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
}
|
||||||
|
|
||||||
return $retarray;
|
return $retarray;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1766,19 +1766,22 @@ abstract class CommonObject
|
|||||||
if ($user->socid > 0) $socid = $user->socid;
|
if ($user->socid > 0) $socid = $user->socid;
|
||||||
|
|
||||||
// this->ismultientitymanaged contains
|
// this->ismultientitymanaged contains
|
||||||
// 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
// 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
|
||||||
$alias = 's';
|
$aliastablesociete = 's';
|
||||||
if ($this->element == 'societe') $alias = 'te';
|
if ($this->element == 'societe') $aliastablesociete = 'te'; // te as table_element
|
||||||
|
|
||||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||||
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
$sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged)) {
|
||||||
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
|
$sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||||
|
}
|
||||||
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||||
elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||||
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||||
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
||||||
if ($this->restrictiononfksoc == 2 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND (sc.fk_user = ".$user->id.' OR te.fk_soc IS NULL)';
|
if ($this->restrictiononfksoc == 2 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND (sc.fk_user = ".$user->id.' OR te.fk_soc IS NULL)';
|
||||||
@ -1787,7 +1790,10 @@ abstract class CommonObject
|
|||||||
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
||||||
$sql .= $filter;
|
$sql .= $filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged)) {
|
||||||
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
|
$sql .= ' AND te.'.$tmparray[0].' = '.($tmparray[1] == 'societe' ? 's' : 'parenttable').'.rowid'; // If we need to link to this table to limit select to entity
|
||||||
|
}
|
||||||
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
@ -1801,6 +1807,10 @@ abstract class CommonObject
|
|||||||
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
$sql .= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged) && $this->element != 'societe') {
|
||||||
|
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||||
|
$sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')';
|
||||||
|
}
|
||||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql .= ' AND te.fk_soc = '.$socid;
|
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql .= ' AND te.fk_soc = '.$socid;
|
||||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql .= ' AND (te.fk_soc = '.$socid.' OR te.fk_soc IS NULL)';
|
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql .= ' AND (te.fk_soc = '.$socid.' OR te.fk_soc IS NULL)';
|
||||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql .= ' AND te.rowid = '.$socid;
|
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql .= ' AND te.rowid = '.$socid;
|
||||||
@ -1821,10 +1831,10 @@ abstract class CommonObject
|
|||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
$sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 'fk_soc@societe') $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||||
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||||
elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||||
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc";
|
if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||||
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||||
if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND sc.fk_user = ".$user->id;
|
||||||
if ($this->restrictiononfksoc == 2 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND (sc.fk_user = ".$user->id.' OR te.fk_soc IS NULL)';
|
if ($this->restrictiononfksoc == 2 && !$user->rights->societe->client->voir && !$socid) $sql .= " AND (sc.fk_user = ".$user->id.' OR te.fk_soc IS NULL)';
|
||||||
@ -1833,7 +1843,7 @@ abstract class CommonObject
|
|||||||
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility
|
||||||
$sql .= $filter;
|
$sql .= $filter;
|
||||||
}
|
}
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 'fk_soc@societe') $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||||
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||||
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
@ -6614,7 +6624,7 @@ abstract class CommonObject
|
|||||||
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue;
|
if (is_array($params) && array_key_exists('onlykey', $params) && $key != $params['onlykey']) continue;
|
||||||
|
|
||||||
// @todo Add test also on 'enabled' (different than 'list' that is 'visibility')
|
// @todo Add test also on 'enabled' (different than 'list' that is 'visibility')
|
||||||
$enabled = 1;
|
//$enabled = 1;
|
||||||
|
|
||||||
$visibility = 1;
|
$visibility = 1;
|
||||||
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key]))
|
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key]))
|
||||||
|
|||||||
@ -289,6 +289,8 @@ class Conf
|
|||||||
{
|
{
|
||||||
$rootfordata .= '/'.$this->entity;
|
$rootfordata .= '/'.$this->entity;
|
||||||
}
|
}
|
||||||
|
// Set standard temporary folder name or global override
|
||||||
|
$rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR;
|
||||||
|
|
||||||
// Define default dir_output and dir_temp for directories of modules
|
// Define default dir_output and dir_temp for directories of modules
|
||||||
foreach($this->modules as $module)
|
foreach($this->modules as $module)
|
||||||
@ -296,10 +298,10 @@ class Conf
|
|||||||
//var_dump($module);
|
//var_dump($module);
|
||||||
// For multicompany sharings
|
// For multicompany sharings
|
||||||
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
|
$this->$module->multidir_output = array($this->entity => $rootfordata."/".$module);
|
||||||
$this->$module->multidir_temp = array($this->entity => $rootfordata."/".$module."/temp");
|
$this->$module->multidir_temp = array($this->entity => $rootfortemp."/".$module."/temp");
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$this->$module->dir_output = $rootfordata."/".$module;
|
$this->$module->dir_output = $rootfordata."/".$module;
|
||||||
$this->$module->dir_temp = $rootfordata."/".$module."/temp";
|
$this->$module->dir_temp = $rootfortemp."/".$module."/temp";
|
||||||
}
|
}
|
||||||
|
|
||||||
// External modules storage
|
// External modules storage
|
||||||
@ -311,56 +313,59 @@ class Conf
|
|||||||
{
|
{
|
||||||
foreach($dirs as $type => $name) // $type is 'output' or 'temp'
|
foreach($dirs as $type => $name) // $type is 'output' or 'temp'
|
||||||
{
|
{
|
||||||
$subdir = ($type == 'temp' ? '/temp' : '');
|
$multidirname = 'multidir_'.$type;
|
||||||
|
$dirname = 'dir_'.$type;
|
||||||
|
|
||||||
|
if($type != 'temp')
|
||||||
|
{
|
||||||
// For multicompany sharings
|
// For multicompany sharings
|
||||||
$varname = 'multidir_'.$type;
|
$this->$module->$multidirname = array($this->entity => $rootfordata."/".$name);
|
||||||
$this->$module->$varname = array($this->entity => $rootfordata."/".$name.$subdir);
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$varname = 'dir_'.$type;
|
$this->$module->$dirname = $rootfordata."/".$name;
|
||||||
$this->$module->$varname = $rootfordata."/".$name.$subdir;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// For multicompany sharings
|
||||||
|
$this->$module->$multidirname = array($this->entity => $rootfortemp."/".$name."/temp");
|
||||||
|
|
||||||
|
// For backward compatibility
|
||||||
|
$this->$module->$dirname = $rootfortemp."/".$name."/temp";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For mycompany storage
|
// For mycompany storage
|
||||||
$this->mycompany->multidir_output = array($this->entity => $rootfordata."/mycompany");
|
|
||||||
$this->mycompany->multidir_temp = array($this->entity => $rootfordata."/mycompany/temp");
|
|
||||||
// For backward compatibility
|
|
||||||
$this->mycompany->dir_output = $rootfordata."/mycompany";
|
$this->mycompany->dir_output = $rootfordata."/mycompany";
|
||||||
$this->mycompany->dir_temp = $rootfordata."/mycompany/temp";
|
$this->mycompany->dir_temp = $rootfortemp."/mycompany/temp";
|
||||||
|
|
||||||
// For admin storage
|
// For admin storage
|
||||||
$this->admin->dir_output = $rootfordata.'/admin';
|
$this->admin->dir_output = $rootfordata.'/admin';
|
||||||
$this->admin->dir_temp = $rootfordata.'/admin/temp';
|
$this->admin->dir_temp = $rootfortemp.'/admin/temp';
|
||||||
|
|
||||||
// For user storage
|
// For user storage
|
||||||
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
$this->user->multidir_output = array($this->entity => $rootfordata."/users");
|
||||||
$this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp");
|
$this->user->multidir_temp = array($this->entity => $rootfortemp."/users/temp");
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$this->user->dir_output = $rootforuser."/users";
|
$this->user->dir_output = $rootforuser."/users";
|
||||||
$this->user->dir_temp = $rootforuser."/users/temp";
|
$this->user->dir_temp = $rootfortemp."/users/temp";
|
||||||
|
|
||||||
// For usergroup storage
|
// For usergroup storage
|
||||||
$this->usergroup->dir_output = $rootforuser."/usergroups";
|
$this->usergroup->dir_output = $rootforuser."/usergroups";
|
||||||
$this->usergroup->dir_temp = $rootforuser."/usergroups/temp";
|
$this->usergroup->dir_temp = $rootfortemp."/usergroups/temp";
|
||||||
|
|
||||||
// For proposal storage
|
// For proposal storage
|
||||||
$this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
|
$this->propal->multidir_output = array($this->entity => $rootfordata."/propale");
|
||||||
$this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp");
|
$this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp");
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$this->propal->dir_output = $rootfordata."/propale";
|
$this->propal->dir_output = $rootfordata."/propale";
|
||||||
$this->propal->dir_temp = $rootfordata."/propale/temp";
|
$this->propal->dir_temp = $rootfortemp."/propale/temp";
|
||||||
|
|
||||||
// For bank storage
|
|
||||||
$this->bank->multidir_output = array($this->entity => $rootfordata."/bank");
|
|
||||||
$this->bank->multidir_temp = array($this->entity => $rootfordata."/bank/temp");
|
|
||||||
$this->bank->dir_output = $rootfordata."/bank";
|
|
||||||
$this->bank->dir_temp = $rootfordata."/bank/temp";
|
|
||||||
|
|
||||||
// For medias storage
|
// For medias storage
|
||||||
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
$this->medias->multidir_output = array($this->entity => $rootfordata."/medias");
|
||||||
$this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp");
|
$this->medias->multidir_temp = array($this->entity => $rootfortemp."/medias/temp");
|
||||||
|
|
||||||
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
// Exception: Some dir are not the name of module. So we keep exception here for backward compatibility.
|
||||||
|
|
||||||
@ -370,37 +375,43 @@ class Conf
|
|||||||
$this->livraison_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_LIVRAISON)?$this->global->MAIN_SUBMODULE_LIVRAISON:0);
|
$this->livraison_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_LIVRAISON)?$this->global->MAIN_SUBMODULE_LIVRAISON:0);
|
||||||
|
|
||||||
// Module fournisseur
|
// Module fournisseur
|
||||||
// TODO To split into module supplier_invoice and supplier_order
|
|
||||||
if (! empty($this->fournisseur))
|
if (! empty($this->fournisseur))
|
||||||
{
|
{
|
||||||
$this->fournisseur->commande=new stdClass();
|
$this->fournisseur->commande=new stdClass();
|
||||||
$this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
$this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
||||||
$this->fournisseur->commande->multidir_temp = array($this->entity => $rootfordata."/fournisseur/commande/temp");
|
$this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
|
||||||
$this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
$this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||||
$this->fournisseur->commande->dir_temp = $rootfordata."/fournisseur/commande/temp"; // For backward compatibility
|
$this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
|
||||||
|
|
||||||
$this->fournisseur->facture=new stdClass();
|
$this->fournisseur->facture=new stdClass();
|
||||||
$this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
$this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
||||||
$this->fournisseur->facture->multidir_temp = array($this->entity => $rootfordata."/fournisseur/facture/temp");
|
$this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
|
||||||
$this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
$this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||||
$this->fournisseur->facture->dir_temp = $rootfordata."/fournisseur/facture/temp"; // For backward compatibility
|
$this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
|
||||||
|
|
||||||
|
$this->supplierproposal=new stdClass();
|
||||||
|
$this->supplierproposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal");
|
||||||
|
$this->supplierproposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp");
|
||||||
|
$this->supplierproposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility
|
||||||
|
$this->supplierproposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility
|
||||||
|
|
||||||
$this->fournisseur->payment=new stdClass();
|
$this->fournisseur->payment=new stdClass();
|
||||||
$this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
|
$this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment");
|
||||||
$this->fournisseur->payment->multidir_temp = array($this->entity => $rootfordata."/fournisseur/payment/temp");
|
$this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp");
|
||||||
$this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
|
$this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility
|
||||||
$this->fournisseur->payment->dir_temp = $rootfordata."/fournisseur/payment/temp"; // For backward compatibility
|
$this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility
|
||||||
|
|
||||||
// To prepare split of module vendor(fournisseur) into vendor + supplier_order + supplier_invoice + supplierproposal
|
// To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice
|
||||||
if (!empty($this->fournisseur->enabled)) // By default, if module supplier is on, we set new properties
|
if (! empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties
|
||||||
{
|
{
|
||||||
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
||||||
{
|
{
|
||||||
$this->supplier_order=new stdClass();
|
$this->supplier_order=new stdClass();
|
||||||
$this->supplier_order->enabled = 1;
|
$this->supplier_order->enabled = 1;
|
||||||
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
$this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande");
|
||||||
$this->supplier_order->multidir_temp = array($this->entity => $rootfordata."/fournisseur/commande/temp");
|
$this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp");
|
||||||
$this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
$this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility
|
||||||
$this->supplier_order->dir_temp = $rootfordata."/fournisseur/commande/temp"; // For backward compatibility
|
$this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists
|
||||||
@ -408,39 +419,41 @@ class Conf
|
|||||||
$this->supplier_invoice=new stdClass();
|
$this->supplier_invoice=new stdClass();
|
||||||
$this->supplier_invoice->enabled = 1;
|
$this->supplier_invoice->enabled = 1;
|
||||||
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
$this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture");
|
||||||
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfordata."/fournisseur/facture/temp");
|
$this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp");
|
||||||
$this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
$this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility
|
||||||
$this->supplier_invoice->dir_temp = $rootfordata."/fournisseur/facture/temp"; // For backward compatibility
|
$this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module product/service
|
// Module product/service
|
||||||
$this->product->multidir_output = array($this->entity => $rootfordata."/produit");
|
$this->product->multidir_output = array($this->entity => $rootfordata."/produit");
|
||||||
$this->product->multidir_temp = array($this->entity => $rootfordata."/produit/temp");
|
$this->product->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");
|
||||||
$this->service->multidir_output = array($this->entity => $rootfordata."/produit");
|
$this->service->multidir_output = array($this->entity => $rootfordata."/produit");
|
||||||
$this->service->multidir_temp = array($this->entity => $rootfordata."/produit/temp");
|
$this->service->multidir_temp = array($this->entity => $rootfortemp."/produit/temp");
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$this->product->dir_output = $rootfordata."/produit";
|
$this->product->dir_output = $rootfordata."/produit";
|
||||||
$this->product->dir_temp = $rootfordata."/produit/temp";
|
$this->product->dir_temp = $rootfortemp."/produit/temp";
|
||||||
$this->service->dir_output = $rootfordata."/produit";
|
$this->service->dir_output = $rootfordata."/produit";
|
||||||
$this->service->dir_temp = $rootfordata."/produit/temp";
|
$this->service->dir_temp = $rootfortemp."/produit/temp";
|
||||||
|
|
||||||
// Module productbatch
|
// Module productbatch
|
||||||
$this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot");
|
$this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot");
|
||||||
$this->productbatch->multidir_temp = array($this->entity => $rootfordata."/produitlot/temp");
|
$this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/produitlot/temp");
|
||||||
|
|
||||||
// Module contrat
|
// Module contrat
|
||||||
$this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
|
$this->contrat->multidir_output = array($this->entity => $rootfordata."/contract");
|
||||||
$this->contrat->multidir_temp = array($this->entity => $rootfordata."/contract/temp");
|
$this->contrat->multidir_temp = array($this->entity => $rootfortemp."/contract/temp");
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
$this->contrat->dir_output = $rootfordata."/contract";
|
$this->contrat->dir_output = $rootfordata."/contract";
|
||||||
$this->contrat->dir_temp = $rootfordata."/contract/temp";
|
$this->contrat->dir_temp = $rootfortemp."/contract/temp";
|
||||||
|
|
||||||
// Module bank
|
// Module bank
|
||||||
|
$this->bank->multidir_output = array($this->entity => $rootfordata."/bank");
|
||||||
|
$this->bank->multidir_temp = array($this->entity => $rootfortemp."/bank/temp");
|
||||||
|
// For backward compatibility
|
||||||
$this->bank->dir_output = $rootfordata."/bank";
|
$this->bank->dir_output = $rootfordata."/bank";
|
||||||
$this->bank->dir_temp = $rootfordata."/bank/temp";
|
$this->bank->dir_temp = $rootfortemp."/bank/temp";
|
||||||
|
|
||||||
|
|
||||||
// Set some default values
|
// Set some default values
|
||||||
//$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
|
//$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month
|
||||||
|
|||||||
@ -546,7 +546,7 @@ class DiscountAbsolute
|
|||||||
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
* Should always be empty, except if option FACTURE_DEPOSITS_ARE_JUST_PAYMENTS is on (not recommended).
|
||||||
*
|
*
|
||||||
* @param CommonInvoice $invoice Object invoice (customer of supplier)
|
* @param CommonInvoice $invoice Object invoice (customer of supplier)
|
||||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
* @param int $multicurrency 1=Return multicurrency_amount instead of amount
|
||||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||||
*/
|
*/
|
||||||
public function getSumDepositsUsed($invoice, $multicurrency = 0)
|
public function getSumDepositsUsed($invoice, $multicurrency = 0)
|
||||||
@ -578,7 +578,7 @@ class DiscountAbsolute
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($multicurrency) return $obj->multicurrency_amount;
|
if ($multicurrency == 1) return $obj->multicurrency_amount;
|
||||||
else return $obj->amount;
|
else return $obj->amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -592,7 +592,7 @@ class DiscountAbsolute
|
|||||||
* Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment
|
* Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment
|
||||||
*
|
*
|
||||||
* @param CommonInvoice $invoice Object invoice
|
* @param CommonInvoice $invoice Object invoice
|
||||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
* @param int $multicurrency 1=Return multicurrency_amount instead of amount
|
||||||
* @return int <0 if KO, Sum of credit notes and excess received amount otherwise
|
* @return int <0 if KO, Sum of credit notes and excess received amount otherwise
|
||||||
*/
|
*/
|
||||||
public function getSumCreditNotesUsed($invoice, $multicurrency = 0)
|
public function getSumCreditNotesUsed($invoice, $multicurrency = 0)
|
||||||
@ -624,7 +624,7 @@ class DiscountAbsolute
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
if ($multicurrency) return $obj->multicurrency_amount;
|
if ($multicurrency == 1) return $obj->multicurrency_amount;
|
||||||
else return $obj->amount;
|
else return $obj->amount;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -225,7 +225,8 @@ class DolEditor
|
|||||||
breakAfterClose : true
|
breakAfterClose : true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}';
|
},
|
||||||
|
disableNativeSpellChecker: '.(empty($conf->global->CKEDITOR_NATIVE_SPELLCHECKER) ? 'true' : 'false');
|
||||||
|
|
||||||
if ($this->uselocalbrowser)
|
if ($this->uselocalbrowser)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1127,12 +1127,25 @@ class DolGraph
|
|||||||
$this->stringtoshow .= '</script>'."\n";
|
$this->stringtoshow .= '</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output HTML string to total value
|
||||||
|
*
|
||||||
|
* @return string HTML string to total value
|
||||||
|
*/
|
||||||
|
public function total()
|
||||||
|
{
|
||||||
|
$value = 0;
|
||||||
|
foreach ($this->data as $valarray) // Loop on each x
|
||||||
|
{
|
||||||
|
$value += $valarray[1];
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output HTML string to show graph
|
* Output HTML string to show graph
|
||||||
*
|
*
|
||||||
* @param int $shownographyet Show graph to say there is not enough data
|
* @param int|string $shownographyet Show graph to say there is not enough data or the message in $shownographyet if it is a string.
|
||||||
* @return string HTML string to show graph
|
* @return string HTML string to show graph
|
||||||
*/
|
*/
|
||||||
public function show($shownographyet = 0)
|
public function show($shownographyet = 0)
|
||||||
@ -1142,7 +1155,13 @@ class DolGraph
|
|||||||
if ($shownographyet)
|
if ($shownographyet)
|
||||||
{
|
{
|
||||||
$s = '<div class="nographyet" style="width:'.(preg_match('/%/', $this->width) ? $this->width : $this->width.'px').'; height:'.(preg_match('/%/', $this->height) ? $this->height : $this->height.'px').';"></div>';
|
$s = '<div class="nographyet" style="width:'.(preg_match('/%/', $this->width) ? $this->width : $this->width.'px').'; height:'.(preg_match('/%/', $this->height) ? $this->height : $this->height.'px').';"></div>';
|
||||||
$s .= '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
|
$s .= '<div class="nographyettext">';
|
||||||
|
if (is_numeric($shownographyet)) {
|
||||||
|
$s .= $langs->trans("NotEnoughDataYet");
|
||||||
|
} else {
|
||||||
|
$s .= $shownographyet;
|
||||||
|
}
|
||||||
|
$s .= '</div>';
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,8 @@
|
|||||||
* <dol_use_font_a> Use font A of printer
|
* <dol_use_font_a> Use font A of printer
|
||||||
* <dol_use_font_b> Use font B of printer
|
* <dol_use_font_b> Use font B of printer
|
||||||
* <dol_use_font_c> Use font C of printer
|
* <dol_use_font_c> Use font C of printer
|
||||||
* <dol_bold> </dol_bold> Text Bold
|
* <dol_bold> Text Bold
|
||||||
|
* <dol_bold_disabled> Disable Text Bold
|
||||||
* <dol_double_height> </dol_double_height> Text double height
|
* <dol_double_height> </dol_double_height> Text double height
|
||||||
* <dol_double_width> </dol_double_width> Text double width
|
* <dol_double_width> </dol_double_width> Text double width
|
||||||
* <dol_underline> </dol_underline> Underline text
|
* <dol_underline> </dol_underline> Underline text
|
||||||
@ -105,6 +106,7 @@ require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/autoload.php';
|
|||||||
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
|
||||||
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
|
use Mike42\Escpos\PrintConnectors\NetworkPrintConnector;
|
||||||
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
|
||||||
|
use Mike42\Escpos\PrintConnectors\DummyPrintConnector;
|
||||||
use Mike42\Escpos\CapabilityProfile;
|
use Mike42\Escpos\CapabilityProfile;
|
||||||
use Mike42\Escpos\Printer;
|
use Mike42\Escpos\Printer;
|
||||||
use Mike42\Escpos\EscposImage;
|
use Mike42\Escpos\EscposImage;
|
||||||
@ -161,7 +163,7 @@ class dolReceiptPrinter extends Printer
|
|||||||
'dol_use_font_b',
|
'dol_use_font_b',
|
||||||
'dol_use_font_c',
|
'dol_use_font_c',
|
||||||
'dol_bold',
|
'dol_bold',
|
||||||
'/dol_bold',
|
'dol_bold_disabled',
|
||||||
'dol_double_height',
|
'dol_double_height',
|
||||||
'/dol_double_height',
|
'/dol_double_height',
|
||||||
'dol_double_width',
|
'dol_double_width',
|
||||||
@ -529,7 +531,13 @@ class dolReceiptPrinter extends Printer
|
|||||||
$this->printer->text("Most simple example\n");
|
$this->printer->text("Most simple example\n");
|
||||||
$this->printer->feed();
|
$this->printer->feed();
|
||||||
$this->printer->cut();
|
$this->printer->cut();
|
||||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
|
||||||
|
// If is DummyPrintConnector send to log to debugging
|
||||||
|
if ($this->printer->connector instanceof DummyPrintConnector)
|
||||||
|
{
|
||||||
|
$data = $this->printer->connector-> getData();
|
||||||
|
dol_syslog($data);
|
||||||
|
}
|
||||||
$this->printer->close();
|
$this->printer->close();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->errors[] = $e->getMessage();
|
$this->errors[] = $e->getMessage();
|
||||||
@ -704,6 +712,12 @@ class dolReceiptPrinter extends Printer
|
|||||||
break;
|
break;
|
||||||
case 'DOL_USE_FONT_C':
|
case 'DOL_USE_FONT_C':
|
||||||
$this->printer->setFont(Printer::FONT_C);
|
$this->printer->setFont(Printer::FONT_C);
|
||||||
|
break;
|
||||||
|
case 'DOL_BOLD':
|
||||||
|
$this->printer->setEmphasis(true);
|
||||||
|
break;
|
||||||
|
case 'DOL_BOLD_DISABLED':
|
||||||
|
$this->printer->setEmphasis(false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->printer->text($vals[$tplline]['tag']);
|
$this->printer->text($vals[$tplline]['tag']);
|
||||||
@ -713,9 +727,13 @@ class dolReceiptPrinter extends Printer
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If is DummyPrintConnector send to log to debugging
|
||||||
|
if ($this->printer->connector instanceof DummyPrintConnector)
|
||||||
|
{
|
||||||
|
$data = $this->printer->connector->getData();
|
||||||
|
dol_syslog($data);
|
||||||
|
}
|
||||||
// Close and print
|
// Close and print
|
||||||
// uncomment next line to see content sent to printer
|
|
||||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
|
||||||
$this->printer->close();
|
$this->printer->close();
|
||||||
}
|
}
|
||||||
return $error;
|
return $error;
|
||||||
@ -783,7 +801,6 @@ class dolReceiptPrinter extends Printer
|
|||||||
try {
|
try {
|
||||||
switch ($obj['fk_type']) {
|
switch ($obj['fk_type']) {
|
||||||
case 1:
|
case 1:
|
||||||
require_once DOL_DOCUMENT_ROOT .'/includes/mike42/escpos-php/src/DummyPrintConnector.php';
|
|
||||||
$this->connector = new DummyPrintConnector();
|
$this->connector = new DummyPrintConnector();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
|||||||
@ -208,7 +208,7 @@ class ExtraFields
|
|||||||
*
|
*
|
||||||
* @param string $attrname Code of attribute
|
* @param string $attrname Code of attribute
|
||||||
* @param string $label label of attribute
|
* @param string $label label of attribute
|
||||||
* @param int $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...)
|
* @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...)
|
||||||
* @param int $pos Position of attribute
|
* @param int $pos Position of attribute
|
||||||
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
|
* @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma.
|
||||||
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
|
* @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...)
|
||||||
@ -232,6 +232,7 @@ class ExtraFields
|
|||||||
if (empty($attrname)) return -1;
|
if (empty($attrname)) return -1;
|
||||||
if (empty($label)) return -1;
|
if (empty($label)) return -1;
|
||||||
|
|
||||||
|
if ($type == 'separate') { $unique = 0; $required = 0; } // Force unique and not required if this is a separator field to avoid troubles.
|
||||||
if ($elementtype == 'thirdparty') $elementtype = 'societe';
|
if ($elementtype == 'thirdparty') $elementtype = 'societe';
|
||||||
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
if ($elementtype == 'contact') $elementtype = 'socpeople';
|
||||||
|
|
||||||
@ -1466,7 +1467,7 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We have to join on extrafield table
|
// We have to join on extrafield table
|
||||||
if (strpos($InfoFieldList[4], 'extra') !== false) {
|
if (strpos($InfoFieldList[4], 'extra.') !== false) {
|
||||||
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
$sql .= ' as main, '.MAIN_DB_PREFIX.$InfoFieldList[0].'_extrafields as extra';
|
||||||
$sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4];
|
$sqlwhere .= ' WHERE extra.fk_object=main.'.$InfoFieldList[2].' AND '.$InfoFieldList[4];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -699,9 +699,10 @@ class Form
|
|||||||
* @param int $showempty Show empty choice
|
* @param int $showempty Show empty choice
|
||||||
* @param int $disablefavorites 1=Disable favorites,
|
* @param int $disablefavorites 1=Disable favorites,
|
||||||
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
* @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...)
|
||||||
|
* @param array $exclude_country_code Array of country code (iso2) to exclude
|
||||||
* @return string HTML string with select
|
* @return string HTML string with select
|
||||||
*/
|
*/
|
||||||
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0)
|
public function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0, $exclude_country_code = array())
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $conf, $langs, $mysoc;
|
global $conf, $langs, $mysoc;
|
||||||
@ -733,6 +734,7 @@ class Form
|
|||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$countryArray[$i]['rowid'] = $obj->rowid;
|
$countryArray[$i]['rowid'] = $obj->rowid;
|
||||||
$countryArray[$i]['code_iso'] = $obj->code_iso;
|
$countryArray[$i]['code_iso'] = $obj->code_iso;
|
||||||
$countryArray[$i]['code_iso3'] = $obj->code_iso3;
|
$countryArray[$i]['code_iso3'] = $obj->code_iso3;
|
||||||
@ -765,6 +767,7 @@ class Form
|
|||||||
{
|
{
|
||||||
//if (empty($showempty) && empty($row['rowid'])) continue;
|
//if (empty($showempty) && empty($row['rowid'])) continue;
|
||||||
if (empty($row['rowid'])) continue;
|
if (empty($row['rowid'])) continue;
|
||||||
|
if (is_array($exclude_country_code) && count($exclude_country_code) && in_array($row['code_iso'], $exclude_country_code)) continue; // exclude some countries
|
||||||
|
|
||||||
if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++;
|
if (empty($disablefavorites) && $row['favorite'] && $row['code_iso']) $atleastonefavorite++;
|
||||||
if (empty($row['favorite']) && $atleastonefavorite)
|
if (empty($row['favorite']) && $atleastonefavorite)
|
||||||
@ -6034,16 +6037,23 @@ class Form
|
|||||||
|
|
||||||
// Search data
|
// Search data
|
||||||
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
|
$sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX.$objecttmp->table_element." as t";
|
||||||
if ($objecttmp->ismultientitymanaged == 2)
|
if (isset($objecttmp->ismultientitymanaged) && ! is_numeric($objecttmp->ismultientitymanaged)) {
|
||||||
|
$tmparray = explode('@', $objecttmp->ismultientitymanaged);
|
||||||
|
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON parenttable.rowid = t.'.$tmparray[0];
|
||||||
|
}
|
||||||
|
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe')
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
$sql .= " WHERE 1=1";
|
$sql .= " WHERE 1=1";
|
||||||
if (!empty($objecttmp->ismultientitymanaged)) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
if (isset($objecttmp->ismultientitymanaged) && $objecttmp->ismultientitymanaged == 1) $sql .= " AND t.entity IN (".getEntity($objecttmp->table_element).")";
|
||||||
|
if (isset($objecttmp->ismultientitymanaged) && ! is_numeric($objecttmp->ismultientitymanaged)) {
|
||||||
|
$sql .= ' AND parenttable.entity = t.'.$tmparray[0];
|
||||||
|
}
|
||||||
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
|
if ($objecttmp->ismultientitymanaged == 1 && !empty($user->socid)) {
|
||||||
if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid;
|
if ($objecttmp->element == 'societe') $sql .= " AND t.rowid = ".$user->socid;
|
||||||
else $sql .= " AND t.fk_soc = ".$user->socid;
|
else $sql .= " AND t.fk_soc = ".$user->socid;
|
||||||
}
|
}
|
||||||
if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
|
if ($searchkey != '') $sql .= natural_search(explode(',', $fieldstoshow), $searchkey);
|
||||||
if ($objecttmp->ismultientitymanaged == 2) {
|
if ($objecttmp->ismultientitymanaged == 'fk_soc@societe') {
|
||||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||||
}
|
}
|
||||||
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
if ($objecttmp->filter) { // Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||||
@ -6494,7 +6504,7 @@ class Form
|
|||||||
* @param int $translate Translate and encode value
|
* @param int $translate Translate and encode value
|
||||||
* @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95%
|
* @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95%
|
||||||
* @param string $moreattrib Add more options on select component. Example: 'disabled'
|
* @param string $moreattrib Add more options on select component. Example: 'disabled'
|
||||||
* @param string $elemtype Type of element we show ('category', ...)
|
* @param string $elemtype Type of element we show ('category', ...). Will execute a formating function on it. To use in readonly mode if js component support HTML formatting.
|
||||||
* @param string $placeholder String to use as placeholder
|
* @param string $placeholder String to use as placeholder
|
||||||
* @param int $addjscombo Add js combo
|
* @param int $addjscombo Add js combo
|
||||||
* @return string HTML multiselect string
|
* @return string HTML multiselect string
|
||||||
@ -6549,7 +6559,7 @@ class Form
|
|||||||
templateResult: formatResult, /* For 4.0 */
|
templateResult: formatResult, /* For 4.0 */
|
||||||
// Specify format function for selected item
|
// Specify format function for selected item
|
||||||
formatSelection: formatSelection,
|
formatSelection: formatSelection,
|
||||||
templateResult: formatSelection /* For 4.0 */
|
templateSelection: formatSelection /* For 4.0 */
|
||||||
});
|
});
|
||||||
});'."\n";
|
});'."\n";
|
||||||
}
|
}
|
||||||
@ -7294,13 +7304,22 @@ class Form
|
|||||||
{
|
{
|
||||||
$ret .= '';
|
$ret .= '';
|
||||||
}
|
}
|
||||||
elseif ($fieldref != 'none') $ret .= dol_htmlentities($object->$fieldref);
|
elseif ($fieldref != 'none')
|
||||||
|
{
|
||||||
|
$ret.=dol_htmlentities($object->$fieldref);
|
||||||
|
}
|
||||||
|
|
||||||
if ($morehtmlref)
|
if ($morehtmlref)
|
||||||
{
|
{
|
||||||
$ret .= ' '.$morehtmlref;
|
// don't add a additional space, when "$morehtmlref" starts with a HTML div tag
|
||||||
|
if(substr($morehtmlref, 0, 4) != '<div')
|
||||||
|
{
|
||||||
|
$ret.=' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ret.=$morehtmlref;
|
||||||
|
}
|
||||||
|
|
||||||
$ret.='</div>';
|
$ret.='</div>';
|
||||||
|
|
||||||
$ret .= '</div><!-- End banner content -->';
|
$ret .= '</div><!-- End banner content -->';
|
||||||
@ -7851,4 +7870,220 @@ class Form
|
|||||||
|
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output a combo list with invoices qualified for a third party
|
||||||
|
*
|
||||||
|
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
|
||||||
|
* @param int $selected Id invoice preselected
|
||||||
|
* @param string $htmlname Name of HTML select
|
||||||
|
* @param int $maxlength Maximum length of label
|
||||||
|
* @param int $option_only Return only html options lines without the select tag
|
||||||
|
* @param string $show_empty Add an empty line ('1' or string to show for empty line)
|
||||||
|
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
|
||||||
|
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||||
|
* @param int $disabled Disabled
|
||||||
|
* @param string $morecss More css added to the select component
|
||||||
|
* @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids.
|
||||||
|
* @param string $showproject 'all' = Show project info, ''=Hide project info
|
||||||
|
* @param User $usertofilter User object to use for filtering
|
||||||
|
* @return int Nbr of project if OK, <0 if KO
|
||||||
|
*/
|
||||||
|
public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
|
if (is_null($usertofilter))
|
||||||
|
{
|
||||||
|
$usertofilter = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
$hideunselectables = false;
|
||||||
|
if (!empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||||
|
|
||||||
|
if (empty($projectsListId))
|
||||||
|
{
|
||||||
|
if (empty($usertofilter->rights->projet->all->lire))
|
||||||
|
{
|
||||||
|
$projectstatic = new Project($this->db);
|
||||||
|
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search all projects
|
||||||
|
$sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref,
|
||||||
|
p.title, p.fk_soc, p.fk_statut, p.public,';
|
||||||
|
$sql .= ' s.nom as name';
|
||||||
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'projet as p';
|
||||||
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,';
|
||||||
|
$sql .= ' '.MAIN_DB_PREFIX.'facture as f';
|
||||||
|
$sql .= " WHERE p.entity IN (".getEntity('project').")";
|
||||||
|
$sql .= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement
|
||||||
|
//if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")";
|
||||||
|
//if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
|
||||||
|
//if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||||
|
$sql .= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC";
|
||||||
|
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
// Use select2 selector
|
||||||
|
if (!empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
|
||||||
|
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||||
|
$out .= $comboenhancement;
|
||||||
|
$morecss = 'minwidth200imp maxwidth500';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($option_only)) {
|
||||||
|
$out .= '<select class="valignmiddle flat'.($morecss ? ' '.$morecss : '').'"'.($disabled ? ' disabled="disabled"' : '').' id="'.$htmlname.'" name="'.$htmlname.'">';
|
||||||
|
}
|
||||||
|
if (!empty($show_empty)) {
|
||||||
|
$out .= '<option value="0" class="optiongrey">';
|
||||||
|
if (!is_numeric($show_empty)) $out .= $show_empty;
|
||||||
|
else $out .= ' ';
|
||||||
|
$out .= '</option>';
|
||||||
|
}
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
||||||
|
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($usertofilter->rights->societe->lire))
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$labeltoshow = '';
|
||||||
|
|
||||||
|
if ($showproject == 'all')
|
||||||
|
{
|
||||||
|
$labeltoshow .= dol_trunc($obj->ref, 18); // Invoice ref
|
||||||
|
if ($obj->name) $labeltoshow .= ' - '.$obj->name; // Soc name
|
||||||
|
|
||||||
|
$disabled = 0;
|
||||||
|
if ($obj->fk_statut == Project::STATUS_DRAFT)
|
||||||
|
{
|
||||||
|
$disabled = 1;
|
||||||
|
$labeltoshow .= ' - '.$langs->trans("Draft");
|
||||||
|
}
|
||||||
|
elseif ($obj->fk_statut == Project::STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
if ($discard_closed == 2) $disabled = 1;
|
||||||
|
$labeltoshow .= ' - '.$langs->trans("Closed");
|
||||||
|
}
|
||||||
|
elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||||
|
{
|
||||||
|
$disabled = 1;
|
||||||
|
$labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($selected) && $selected == $obj->rowid)
|
||||||
|
{
|
||||||
|
$out .= '<option value="'.$obj->rowid.'" selected';
|
||||||
|
//if ($disabled) $out.=' disabled'; // with select2, field can't be preselected if disabled
|
||||||
|
$out .= '>'.$labeltoshow.'</option>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($hideunselectables && $disabled && ($selected != $obj->rowid))
|
||||||
|
{
|
||||||
|
$resultat = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$resultat = '<option value="'.$obj->rowid.'"';
|
||||||
|
if ($disabled) $resultat .= ' disabled';
|
||||||
|
//if ($obj->public) $labeltoshow.=' ('.$langs->trans("Public").')';
|
||||||
|
//else $labeltoshow.=' ('.$langs->trans("Private").')';
|
||||||
|
$resultat .= '>';
|
||||||
|
$resultat .= $labeltoshow;
|
||||||
|
$resultat .= '</option>';
|
||||||
|
}
|
||||||
|
$out .= $resultat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (empty($option_only)) {
|
||||||
|
$out .= '</select>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print $out;
|
||||||
|
|
||||||
|
$this->db->free($resql);
|
||||||
|
return $num;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output the component to make advanced search criteries
|
||||||
|
*
|
||||||
|
* @param array $arrayofcriterias Array of available search criterias. Example: array($object->element => $object->fields, 'otherfamily' => otherarrayoffields, ...)
|
||||||
|
* @param array $search_component_params Array of selected search criterias
|
||||||
|
* @param array $arrayofinputfieldsalreadyoutput Array of input fields already inform. The component will not generate a hidden input field if it is in this list.
|
||||||
|
* @return string HTML component for advanced search
|
||||||
|
*/
|
||||||
|
public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array())
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
|
||||||
|
$ret = '';
|
||||||
|
|
||||||
|
$ret .= '<div class="nowrap centpercent">';
|
||||||
|
//$ret .= '<button type="submit" class="liste_titre button_removefilter" name="button_removefilter_x" value="x"><span class="fa fa-remove"></span></button>';
|
||||||
|
$ret .= '<a href="#" class="dropdownsearch-toggle unsetcolor paddingright">';
|
||||||
|
$ret .= '<span class="fas fa-filter linkobject boxfilter" title="Filter" id="idsubimgproductdistribution"></span>';
|
||||||
|
$ret .= $langs->trans("Filters");
|
||||||
|
$ret .= '</a>';
|
||||||
|
//$ret .= '<button type="submit" class="liste_titre button_search paddingleftonly" name="button_search_x" value="x"><span class="fa fa-search"></span></button>';
|
||||||
|
$ret .= '<div name="search_component_params" class="search_component_params inline-block centpercent">';
|
||||||
|
$ret .= '<input type="text" name="search_component_params_input" class="search_component_params_input" placeholder="'.$langs->trans("Search").'" value="'.GETPOST("search_component_params_input").'">';
|
||||||
|
$ret .= '</div>';
|
||||||
|
foreach($arrayofcriterias as $criterias) {
|
||||||
|
foreach($criterias as $criteriafamilykey => $criteriafamilyval) {
|
||||||
|
if (in_array('search_'.$criteriafamilykey, $arrayofinputfieldsalreadyoutput)) continue;
|
||||||
|
if (in_array($criteriafamilykey, array('rowid', 'ref_ext', 'entity', 'extraparams'))) continue;
|
||||||
|
if (in_array($criteriafamilyval['type'], array('date', 'datetime', 'timestamp'))) {
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_start">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startyear">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startmonth">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_startday">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_end">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endyear">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endmonth">';
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'_endday">';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ret .= '<input type="hidden" name="search_'.$criteriafamilykey.'">';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ret .= '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||||
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2016-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -292,7 +292,7 @@ class FormAccounting extends Form
|
|||||||
{
|
{
|
||||||
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
|
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.labelshort, aa.rowid, aa.fk_pcg_version";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||||
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
|
$sql .= " AND asy.rowid = ".$conf->global->CHARTOFACCOUNTS;
|
||||||
@ -312,7 +312,16 @@ class FormAccounting extends Form
|
|||||||
$selected = $selectid; // selectid can be -1, 0, 123
|
$selected = $selectid; // selectid can be -1, 0, 123
|
||||||
while ($obj = $this->db->fetch_object($resql))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
$label = length_accountg($obj->account_number).' - '.$obj->label;
|
if (empty($obj->labelshort))
|
||||||
|
{
|
||||||
|
$labeltoshow = $obj->label;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$labeltoshow = $obj->labelshort;
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = length_accountg($obj->account_number).' - '.$labeltoshow;
|
||||||
$label = dol_trunc($label, $trunclength);
|
$label = dol_trunc($label, $trunclength);
|
||||||
|
|
||||||
$select_value_in = $obj->rowid;
|
$select_value_in = $obj->rowid;
|
||||||
|
|||||||
@ -919,7 +919,7 @@ class FormTicket
|
|||||||
|
|
||||||
print '<tr class="email_line"><td class="titlefieldcreate">'.$langs->trans('Subject').'</td>';
|
print '<tr class="email_line"><td class="titlefieldcreate">'.$langs->trans('Subject').'</td>';
|
||||||
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
$label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE;
|
||||||
print '<td colspan="2"><input type="text" class="text" size="80" name="subject" value="['.$label_title.' - ticket #'.$this->track_id.'] '.$langs->trans('TicketNewMessage').'" />';
|
print '<td colspan="2"><input type="text" class="text" size="80" name="subject" value="['.$label_title.' - '.$langs->trans("Ticket").' #'.$this->ref.'] '.$langs->trans('TicketNewMessage').'" />';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Destinataires
|
// Destinataires
|
||||||
@ -935,13 +935,13 @@ class FormTicket
|
|||||||
if (is_array($contacts) && count($contacts) > 0) {
|
if (is_array($contacts) && count($contacts) > 0) {
|
||||||
foreach ($contacts as $key => $info_sendto) {
|
foreach ($contacts as $key => $info_sendto) {
|
||||||
if ($info_sendto['email'] != '') {
|
if ($info_sendto['email'] != '') {
|
||||||
$sendto[] = dol_escape_htmltag(trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">")." <small>(".dol_escape_htmltag($info_sendto['libelle']).")</small>";
|
$sendto[] = dol_escape_htmltag(trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">").' <small class="opacitymedium">('.dol_escape_htmltag($info_sendto['libelle']).")</small>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ticketstat->origin_email && !in_array($this->dao->origin_email, $sendto)) {
|
if ($ticketstat->origin_email && !in_array($this->dao->origin_email, $sendto)) {
|
||||||
$sendto[] = dol_escape_htmltag($ticketstat->origin_email)." <small>(".$langs->trans("TicketEmailOriginIssuer").")</small>";
|
$sendto[] = dol_escape_htmltag($ticketstat->origin_email).' <small class="opacitymedium">('.$langs->trans("TicketEmailOriginIssuer").")</small>";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ticketstat->fk_soc > 0) {
|
if ($ticketstat->fk_soc > 0) {
|
||||||
@ -949,12 +949,12 @@ class FormTicket
|
|||||||
$ticketstat->fetch_thirdparty();
|
$ticketstat->fetch_thirdparty();
|
||||||
|
|
||||||
if (is_array($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
|
if (is_array($ticketstat->thirdparty->email) && !in_array($ticketstat->thirdparty->email, $sendto)) {
|
||||||
$sendto[] = $ticketstat->thirdparty->email.' <small>('.$langs->trans('Customer').')</small>';
|
$sendto[] = $ticketstat->thirdparty->email.' <small class="opacitymedium">('.$langs->trans('Customer').')</small>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) {
|
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) {
|
||||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO.' <small>(generic email)</small>';
|
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO.' <small class="opacitymedium">(generic email)</small>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print recipient list
|
// Print recipient list
|
||||||
|
|||||||
513
htdocs/core/customreports.php
Normal file
513
htdocs/core/customreports.php
Normal file
@ -0,0 +1,513 @@
|
|||||||
|
<?php
|
||||||
|
/* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/customreports.php
|
||||||
|
* \ingroup sellyoursaas
|
||||||
|
* \brief Page to make custom reports
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/lib/company.lib.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php";
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php";
|
||||||
|
|
||||||
|
// Load traductions files requiredby by page
|
||||||
|
$langs->loadLangs(array("companies", "bills", "other", "exports"));
|
||||||
|
|
||||||
|
// Get parameters
|
||||||
|
$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)
|
||||||
|
|
||||||
|
$mode = GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'graph';
|
||||||
|
$objecttype = GETPOST('objecttype', 'aZ09');
|
||||||
|
$tabfamily = GETPOST('tabfamily', 'aZ09');
|
||||||
|
|
||||||
|
if (empty($objecttype)) $objecttype = 'thirdparty';
|
||||||
|
|
||||||
|
$search_filters = GETPOST('search_filters', 'array');
|
||||||
|
$search_measures = GETPOST('search_measures', 'array');
|
||||||
|
$search_xaxis = GETPOST('search_xaxis', 'array');
|
||||||
|
$search_yaxis = GETPOST('search_yaxis', 'array');
|
||||||
|
$search_graph = GETPOST('search_graph', 'none');
|
||||||
|
|
||||||
|
// Load variable for pagination
|
||||||
|
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||||
|
$sortfield = GETPOST('sortfield', 'alpha');
|
||||||
|
$sortorder = GETPOST('sortorder', 'alpha');
|
||||||
|
$page = GETPOST('page', 'int');
|
||||||
|
if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action
|
||||||
|
$offset = $limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
// Protection if external user
|
||||||
|
if ($user->societe_id > 0)
|
||||||
|
{
|
||||||
|
//accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
|
$diroutputmassaction = $conf->user->dir_temp.'/'.$user->id.'/customreport';
|
||||||
|
$hookmanager->initHooks(array('customreport')); // Note that conf->hooks_modules contains array
|
||||||
|
|
||||||
|
$title = '';
|
||||||
|
$picto = '';
|
||||||
|
$head = array();
|
||||||
|
$object = null;
|
||||||
|
$ObjectClassName = '';
|
||||||
|
$arrayoftype = array(
|
||||||
|
'thirdparty' => array('label' => 'ThirdParties', 'ObjectClassName' => 'Societe', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"),
|
||||||
|
'contact' => array('label' => 'Contacts', 'ObjectClassName' => 'Contact', 'enabled' => $conf->societe->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php"),
|
||||||
|
'contract' => array('label' => 'Contracts', 'ObjectClassName' => 'Contrat', 'enabled' => $conf->contrat->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", 'langs'=>'contract'),
|
||||||
|
'invoice' => array('label' => 'Invoices', 'ObjectClassName' => 'Facture', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"),
|
||||||
|
'invoice_template'=>array('label' => 'PredefinedInvoices', 'ObjectClassName' => 'FactureRec', 'enabled' => $conf->facture->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/compta/class/facturerec.class.php"),
|
||||||
|
'bom' => array('label' => 'BOM', 'ObjectClassName' => 'Bom', 'enabled' => $conf->bom->enabled),
|
||||||
|
'mo' => array('label' => 'MO', 'ObjectClassName' => 'Mo', 'enabled' => $conf->mo->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/mrp/class/mo.class.php"),
|
||||||
|
'ticket' => array('label' => 'Ticket', 'ObjectClassName' => 'Ticket', 'enabled' => $conf->ticket->enabled),
|
||||||
|
'member' => array('label' => 'Adherent', 'ObjectClassName' => 'Adherent', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", 'langs'=>'members'),
|
||||||
|
'cotisation' => array('label' => 'Subscriptions', 'ObjectClassName' => 'Subscription', 'enabled' => $conf->adherent->enabled, 'ClassPath' => DOL_DOCUMENT_ROOT."/adherents/class/subscription.class.php", 'langs'=>'members'),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Complete $arrayoftype
|
||||||
|
$parameters = array('objecttype'=>$objecttype, 'tabfamily'=>$tabfamily);
|
||||||
|
$reshook = $hookmanager->executeHooks('loadDataForCustomReports', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
elseif (is_array($hookmanager->resArray)) {
|
||||||
|
if (! empty($hookmanager->resArray['title'])) { // Add entries for tabs
|
||||||
|
$title = $hookmanager->resArray['title'];
|
||||||
|
}
|
||||||
|
if (! empty($hookmanager->resArray['picto'])) { // Add entries for tabs
|
||||||
|
$picto = $hookmanager->resArray['picto'];
|
||||||
|
}
|
||||||
|
if (! empty($hookmanager->resArray['head'])) { // Add entries for tabs
|
||||||
|
$head = array_merge($head, $hookmanager->resArray['head']);
|
||||||
|
}
|
||||||
|
if (! empty($hookmanager->resArray['arrayoftype'])) { // Add entries from hook
|
||||||
|
foreach($hookmanager->resArray['arrayoftype'] as $key => $val) {
|
||||||
|
$arrayoftype[$key] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($objecttype) {
|
||||||
|
try {
|
||||||
|
if ($arrayoftype[$objecttype]['langs']) {
|
||||||
|
$langs->load($arrayoftype[$objecttype]['langs']);
|
||||||
|
}
|
||||||
|
if ($arrayoftype[$objecttype]['ClassPath']) {
|
||||||
|
include_once $arrayoftype[$objecttype]['ClassPath'];
|
||||||
|
} else {
|
||||||
|
include_once DOL_DOCUMENT_ROOT."/".$objecttype."/class/".$objecttype.".class.php";
|
||||||
|
}
|
||||||
|
$ObjectClassName = $arrayoftype[$objecttype]['ObjectClassName'];
|
||||||
|
$object = new $ObjectClassName($db);
|
||||||
|
}
|
||||||
|
catch(Exception $e) {
|
||||||
|
print 'Failed to load class for type '.$objecttype;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$socid = 0;
|
||||||
|
if ($user->socid > 0) // Protection if external user
|
||||||
|
{
|
||||||
|
//$socid = $user->socid;
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
$result = restrictedArea($user, $object->element, 0, '');
|
||||||
|
|
||||||
|
// Fetch optionals attributes and labels
|
||||||
|
$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_component_params=array('');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
llxHeader('', $langs->transnoentitiesnoconv('CustomReports'), '');
|
||||||
|
|
||||||
|
//print_fiche_titre($langs->trans("DoliCloudArea"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//$head = commande_prepare_head(null);
|
||||||
|
dol_fiche_head($head, 'customreports', $title, -1, $picto);
|
||||||
|
|
||||||
|
|
||||||
|
$tmparray=dol_getdate(dol_now());
|
||||||
|
$endyear=$tmparray['year'];
|
||||||
|
$endmonth=$tmparray['mon'];
|
||||||
|
$datelastday=dol_get_last_day($endyear, $endmonth, 1);
|
||||||
|
$startyear=$endyear-2;
|
||||||
|
|
||||||
|
$param = '';
|
||||||
|
|
||||||
|
$arrayofmesures = array('t.count'=>'Count');
|
||||||
|
$arrayofxaxis = array();
|
||||||
|
$arrayofyaxis = array();
|
||||||
|
|
||||||
|
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="tabfamily" value="'.$tabfamily.'">';
|
||||||
|
|
||||||
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||||
|
|
||||||
|
// Select object
|
||||||
|
print '<div class="divadvancedsearchfield center floatnone">';
|
||||||
|
print '<div class="inline-block"><span class="opacitymedium">'.$langs->trans("StatisticsOn").'</span></div> ';
|
||||||
|
print $form->selectarray('objecttype', $arrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', '', 1);
|
||||||
|
if (empty($conf->use_javascript_ajax)) print '<input type="submit" class="button" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
|
||||||
|
else {
|
||||||
|
print '<script type="text/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
jQuery("#objecttype").change(function() {
|
||||||
|
console.log("Reload for "+jQuery("#objecttype").val());
|
||||||
|
location.href = "'.$_SERVER["PHP_SELF"].'?objecttype="+jQuery("#objecttype").val()+"'.($tabfamily?'&tabfamily='.$tabfamily:'').'";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
}
|
||||||
|
print '</div><div class="clearboth"></div>';
|
||||||
|
|
||||||
|
|
||||||
|
// Add Filter
|
||||||
|
print '<div class="divadvancedsearchfield quatrevingtpercent">';
|
||||||
|
print $form->searchComponent(array($object->element => $object->fields), $search_component_params);
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// Measures
|
||||||
|
print '<div class="divadvancedsearchfield clearboth">';
|
||||||
|
foreach($object->fields as $key => $val) {
|
||||||
|
if ($val['isameasure']) {
|
||||||
|
$arrayofmesures['t.'.$key.'-sum'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||||
|
$arrayofmesures['t.'.$key.'-average'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||||
|
$arrayofmesures['t.'.$key.'-min'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||||
|
$arrayofmesures['t.'.$key.'-max'] = $langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add measure from extrafields
|
||||||
|
if ($object->isextrafieldmanaged) {
|
||||||
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||||
|
$arrayofmesures['te.'.$key.'-sum'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>';
|
||||||
|
$arrayofmesures['te.'.$key.'-average'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Average").')</span>';
|
||||||
|
$arrayofmesures['te.'.$key.'-min'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Minimum").')</span>';
|
||||||
|
$arrayofmesures['te.'.$key.'-max'] = $langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Maximum").')</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '<div class="inline-block opacitymedium"><span class="fas fa-chart-line paddingright" title="'.$langs->trans("Measures").'"></span>'.$langs->trans("Measures").'</div> ';
|
||||||
|
print $form->multiselectarray('search_measures', $arrayofmesures, $search_measures, 0, 0, 'minwidth500', 1);
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// XAxis
|
||||||
|
print '<div class="divadvancedsearchfield">';
|
||||||
|
foreach($object->fields as $key => $val) {
|
||||||
|
if (! $val['measure']) {
|
||||||
|
if (in_array($key, array(
|
||||||
|
'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams',
|
||||||
|
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) continue;
|
||||||
|
if (isset($val['enabled']) && ! dol_eval($val['enabled'], 1)) continue;
|
||||||
|
if (isset($val['visible']) && ! dol_eval($val['visible'], 1)) continue;
|
||||||
|
if (preg_match('/^fk_/', $key) && ! preg_match('/^fk_statu/', $key)) continue;
|
||||||
|
if (preg_match('/^pass/', $key)) continue;
|
||||||
|
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||||
|
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||||
|
$arrayofxaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position']);
|
||||||
|
$arrayofxaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position']);
|
||||||
|
$arrayofxaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position']);
|
||||||
|
} else {
|
||||||
|
$arrayofxaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add measure from extrafields
|
||||||
|
if ($object->isextrafieldmanaged) {
|
||||||
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||||
|
$arrayofxaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$arrayofxaxis = dol_sort_array($arrayofxaxis, 'position');
|
||||||
|
$arrayofxaxislabel = array();
|
||||||
|
foreach($arrayofxaxis as $key => $val) {
|
||||||
|
$arrayofxaxislabel[$key] = $val['label'];
|
||||||
|
}
|
||||||
|
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-horizontal paddingright" title="'.$langs->trans("XAxis").'"></span>'.$langs->trans("XAxis").'</div> ';
|
||||||
|
print $form->multiselectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, 0, 0, 'minwidth500', 1);
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
// YAxis
|
||||||
|
if ($mode == 'grid') {
|
||||||
|
print '<div class="divadvancedsearchfield">';
|
||||||
|
foreach($object->fields as $key => $val) {
|
||||||
|
if (! $val['measure']) {
|
||||||
|
if (in_array($key, array('id', 'rowid', 'entity', 'last_main_doc', 'extraparams'))) continue;
|
||||||
|
if (preg_match('/^fk_/', $key)) continue;
|
||||||
|
if (in_array($val['type'], array('html', 'text'))) continue;
|
||||||
|
if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) {
|
||||||
|
$arrayofyaxis['t.'.$key.'-year'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Year").')', 'position' => $val['position']);
|
||||||
|
$arrayofyaxis['t.'.$key.'-month'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Month").')', 'position' => $val['position']);
|
||||||
|
$arrayofyaxis['t.'.$key.'-day'] = array('label' => $langs->trans($val['label']).' ('.$langs->trans("Day").')', 'position' => $val['position']);
|
||||||
|
} else {
|
||||||
|
$arrayofyaxis['t.'.$key] = array('label' => $val['label'], 'position' => (int) $val['position']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Add measure from extrafields
|
||||||
|
if ($object->isextrafieldmanaged) {
|
||||||
|
foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
|
if (! empty($extrafields->attributes[$object->table_element]['totalizable'][$key])) {
|
||||||
|
$arrayofyaxis['te.'.$key] = array('label' => $extrafields->attributes[$object->table_element]['label'][$key], 'position' => (int) $extrafields->attributes[$object->table_element]['pos'][$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$arrayofyaxis = dol_sort_array($arrayofyaxis, 'position');
|
||||||
|
$arrayofyaxislabel = array();
|
||||||
|
foreach($arrayofyaxis as $key => $val) {
|
||||||
|
$arrayofyaxislabel[$key] = $val['label'];
|
||||||
|
}
|
||||||
|
print '<div class="inline-block opacitymedium"><span class="fas fa-ruler-vertical paddingright" title="'.$langs->trans("YAxis").'"></span>'.$langs->trans("YAxis").'</div> ';
|
||||||
|
print $form->multiselectarray('search_yaxis', $arrayofyaxislabel, $search_yaxis, 0, 0, 'minwidth100', 1);
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == 'graph') {
|
||||||
|
print '<div class="divadvancedsearchfield">';
|
||||||
|
$arrayofgraphs = array('bars', 'line'); // also 'pies'
|
||||||
|
print '<div class="inline-block opacitymedium"><span class="fas fa-chart-area paddingright" title="'.$langs->trans("Graph").'"></span>'.$langs->trans("Graph").'</div> ';
|
||||||
|
print $form->selectarray('search_graph', $arrayofgraphs, $search_graph, 0, 0, 'minwidth100', 1);
|
||||||
|
print '</div>';
|
||||||
|
}
|
||||||
|
print '<div class="divadvancedsearchfield">';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Refresh").'">';
|
||||||
|
print '</div>';
|
||||||
|
print '</div>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
|
// Generate the SQL request
|
||||||
|
$sql = '';
|
||||||
|
if (! empty($search_measures) && ! empty($search_xaxis))
|
||||||
|
{
|
||||||
|
$fieldid = 'rowid';
|
||||||
|
|
||||||
|
$sql = 'SELECT ';
|
||||||
|
foreach($search_xaxis as $key => $val) {
|
||||||
|
if (preg_match('/\-year$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y') as x_".$key.', ';
|
||||||
|
} elseif (preg_match('/\-month$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m') as x_".$key.', ';
|
||||||
|
} elseif (preg_match('/\-day$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d') as x_".$key.', ';
|
||||||
|
}
|
||||||
|
else $sql .= $val.' as x_'.$key.', ';
|
||||||
|
}
|
||||||
|
foreach($search_measures as $key => $val) {
|
||||||
|
if ($val == 't.count') $sql .= 'COUNT(t.'.$fieldid.') as y_'.$key.', ';
|
||||||
|
elseif (preg_match('/\-sum$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-sum$/', '', $val);
|
||||||
|
$sql .= 'SUM('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||||
|
}
|
||||||
|
elseif (preg_match('/\-average$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-average$/', '', $val);
|
||||||
|
$sql .= 'AVG('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||||
|
}
|
||||||
|
elseif (preg_match('/\-min$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-min$/', '', $val);
|
||||||
|
$sql .= 'MIN('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||||
|
}
|
||||||
|
elseif (preg_match('/\-max$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-max$/', '', $val);
|
||||||
|
$sql .= 'MAX('.$db->ifsql($tmpval.' IS NULL', '0', $tmpval).') as y_'.$key.', ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||||
|
$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
|
||||||
|
// Add measure from extrafields
|
||||||
|
if ($object->isextrafieldmanaged) {
|
||||||
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.$object->table_element.'_extrafields as te ON te.fk_object = t.'.$fieldid;
|
||||||
|
}
|
||||||
|
if ($object->ismultientitymanaged) {
|
||||||
|
if ($object->ismultientitymanaged == 1) {
|
||||||
|
// Nothing here
|
||||||
|
} else {
|
||||||
|
$tmparray = explode('@', $object->ismultientitymanaged);
|
||||||
|
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.$tmparray[1].' as parenttable ON t.'.$tmparray[0].' = parenttable.rowid';
|
||||||
|
$sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$sql .= ' WHERE 1 = 1';
|
||||||
|
if ($object->ismultientitymanaged == 1) {
|
||||||
|
$sql .= ' AND entity IN ('.getEntity($object->element).')';
|
||||||
|
}
|
||||||
|
foreach($search_filters as $key => $val) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
$sql .= ' GROUP BY ';
|
||||||
|
foreach($search_xaxis as $key => $val) {
|
||||||
|
if (preg_match('/\-year$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||||
|
} elseif (preg_match('/\-month$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
|
||||||
|
} elseif (preg_match('/\-day$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
|
||||||
|
}
|
||||||
|
else $sql .= $val.', ';
|
||||||
|
}
|
||||||
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||||
|
$sql .= ' ORDER BY ';
|
||||||
|
foreach($search_xaxis as $key => $val) {
|
||||||
|
if (preg_match('/\-year$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-year$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y'), ";
|
||||||
|
} elseif (preg_match('/\-month$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-month$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m'), ";
|
||||||
|
} elseif (preg_match('/\-day$/', $val)) {
|
||||||
|
$tmpval = preg_replace('/\-day$/', '', $val);
|
||||||
|
$sql .= 'DATE_FORMAT('.$tmpval.", '%Y-%m-%d'), ";
|
||||||
|
}
|
||||||
|
else $sql .= $val.', ';
|
||||||
|
}
|
||||||
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$legend=array();
|
||||||
|
foreach($search_measures as $key => $val) {
|
||||||
|
$legend[] = $langs->trans($arrayofmesures[$val]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Execute the SQL request
|
||||||
|
$totalnbofrecord = 0;
|
||||||
|
$data = array();
|
||||||
|
if ($sql) {
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
while($obj = $db->fetch_object($resql)) {
|
||||||
|
// $this->data = array(array(0=>'labelxA',1=>yA1,...,n=>yAn), array('labelxB',yB1,...yBn)); // or when there is n series to show for each x
|
||||||
|
foreach($search_xaxis as $xkey => $xval) {
|
||||||
|
$fieldforxkey = 'x_'.$xkey;
|
||||||
|
$xlabel = $obj->$fieldforxkey;
|
||||||
|
$xvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $xval);
|
||||||
|
if (! empty($object->fields[$xvalwithoutprefix]['arrayofkeyval'])) {
|
||||||
|
$xlabel = $object->fields[$xvalwithoutprefix]['arrayofkeyval'][$obj->$fieldforxkey];
|
||||||
|
}
|
||||||
|
$xarray = array(0 => (($xlabel || $xlabel == '0') ? dol_trunc($xlabel, 20, 'middle') : $langs->trans("NotDefined")));
|
||||||
|
foreach($search_measures as $key => $val) {
|
||||||
|
$fieldfory = 'y_'.$key;
|
||||||
|
$xarray[] = $obj->$fieldfory;
|
||||||
|
}
|
||||||
|
$data[] = $xarray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$totalnbofrecord = count($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '<div class="customreportsoutput'.($totalnbofrecord?'':' customreportsoutputnotdata').'">';
|
||||||
|
|
||||||
|
|
||||||
|
if ($mode == 'grid') {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == 'graph') {
|
||||||
|
$WIDTH = '80%';
|
||||||
|
$HEIGHT = 200;
|
||||||
|
|
||||||
|
// Show graph
|
||||||
|
$px1 = new DolGraph();
|
||||||
|
$mesg = $px1->isGraphKo();
|
||||||
|
if (! $mesg)
|
||||||
|
{
|
||||||
|
$px1->SetData($data);
|
||||||
|
unset($data);
|
||||||
|
|
||||||
|
$arrayoftypes = array();
|
||||||
|
foreach($search_measures as $key => $val) {
|
||||||
|
$arrayoftypes[] = $search_graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
$px1->SetLegend($legend);
|
||||||
|
$px1->SetMinValue($px1->GetFloorMinValue());
|
||||||
|
$px1->SetMaxValue($px1->GetCeilMaxValue());
|
||||||
|
$px1->SetWidth($WIDTH);
|
||||||
|
$px1->SetHeight($HEIGHT);
|
||||||
|
$px1->SetYLabel($langs->trans("Y"));
|
||||||
|
$px1->SetShading(3);
|
||||||
|
$px1->SetHorizTickIncrement(1);
|
||||||
|
$px1->SetCssPrefix("cssboxes");
|
||||||
|
$px1->SetType($arrayoftypes);
|
||||||
|
$px1->mode='depth';
|
||||||
|
$px1->SetTitle('');
|
||||||
|
|
||||||
|
$dir=$conf->user->dir_temp;
|
||||||
|
dol_mkdir($dir);
|
||||||
|
$filenamenb = $dir.'/customreport_'.$object->element.'.png';
|
||||||
|
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=user&file=customreport_'.$object->element.'.png';
|
||||||
|
|
||||||
|
$px1->draw($filenamenb, $fileurlnb);
|
||||||
|
|
||||||
|
print $px1->show($totalnbofrecord ? 0 : $langs->trans("SelectYourGraphOptionsFirst"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sql) {
|
||||||
|
// Show admin info
|
||||||
|
print '<br>'.info_admin($langs->trans("SQLUsedForExport").':<br> '.$sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<div>';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
@ -41,7 +41,7 @@ class DoliDBMssql extends DoliDB
|
|||||||
public $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
|
public $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
|
||||||
//! Version min database
|
//! Version min database
|
||||||
const VERSIONMIN='2000';
|
const VERSIONMIN='2000';
|
||||||
/** @var resource Resultset of last query */
|
/** @var boolean|resource Resultset of last query */
|
||||||
private $_results;
|
private $_results;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -336,6 +336,8 @@ class DoliDBMssql extends DoliDB
|
|||||||
|
|
||||||
$query=preg_replace("/([. ,\t(])(percent|file|public)([. ,=\t)])/", "$1[$2]$3", $query);
|
$query=preg_replace("/([. ,\t(])(percent|file|public)([. ,=\t)])/", "$1[$2]$3", $query);
|
||||||
|
|
||||||
|
$original_query='';
|
||||||
|
|
||||||
if ($type=="auto" || $type='dml')
|
if ($type=="auto" || $type='dml')
|
||||||
{
|
{
|
||||||
$query=preg_replace('/AUTO_INCREMENT/i', 'IDENTITY', $query);
|
$query=preg_replace('/AUTO_INCREMENT/i', 'IDENTITY', $query);
|
||||||
@ -345,7 +347,6 @@ class DoliDBMssql extends DoliDB
|
|||||||
$query=preg_replace('/([ \t])(MEDIUM|TINY|LONG){0,1}TEXT([ \t,])/i', "$1VARCHAR(MAX)$3", $query);
|
$query=preg_replace('/([ \t])(MEDIUM|TINY|LONG){0,1}TEXT([ \t,])/i', "$1VARCHAR(MAX)$3", $query);
|
||||||
|
|
||||||
$matches=array();
|
$matches=array();
|
||||||
$original_query='';
|
|
||||||
if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+(?:(UNIQUE)|INDEX)\h+(?:INDEX)?\h*(\w+?)\h*\((.+)\)/is', $query, $matches))
|
if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+(?:(UNIQUE)|INDEX)\h+(?:INDEX)?\h*(\w+?)\h*\((.+)\)/is', $query, $matches))
|
||||||
{
|
{
|
||||||
$original_query=$query;
|
$original_query=$query;
|
||||||
@ -356,11 +357,13 @@ class DoliDBMssql extends DoliDB
|
|||||||
$fields_clear=array_map('trim', $fields);
|
$fields_clear=array_map('trim', $fields);
|
||||||
$infos=$this->GetFieldInformation(trim($matches[1]), $fields_clear);
|
$infos=$this->GetFieldInformation(trim($matches[1]), $fields_clear);
|
||||||
$query_comp=array();
|
$query_comp=array();
|
||||||
|
if (is_array($infos)) {
|
||||||
foreach($infos as $fld) {
|
foreach($infos as $fld) {
|
||||||
if ($fld->IS_NULLABLE == 'YES') {
|
if ($fld->IS_NULLABLE == 'YES') {
|
||||||
$query_comp[]=$fld->COLUMN_NAME." IS NOT NULL";
|
$query_comp[]=$fld->COLUMN_NAME." IS NOT NULL";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (! empty($query_comp))
|
if (! empty($query_comp))
|
||||||
$query.=" WHERE ".implode(" AND ", $query_comp);
|
$query.=" WHERE ".implode(" AND ", $query_comp);
|
||||||
}
|
}
|
||||||
@ -784,7 +787,8 @@ class DoliDBMssql extends DoliDB
|
|||||||
public function DDLListTables($database, $table = '')
|
public function DDLListTables($database, $table = '')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
$this->_results = mssql_list_tables($database, $this->db);
|
$v = mssql_query("Select name from sysobjects where type like 'u'", $this->db);
|
||||||
|
$this->_results = mssql_fetch_array($v);
|
||||||
return $this->_results;
|
return $this->_results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,6 +829,10 @@ class DoliDBMssql extends DoliDB
|
|||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
// FIXME: $fulltext_keys parameter is unused
|
// FIXME: $fulltext_keys parameter is unused
|
||||||
|
|
||||||
|
$sqlfields = array();
|
||||||
|
$sqluq = array();
|
||||||
|
$sqlk = array();
|
||||||
|
|
||||||
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
|
// cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra
|
||||||
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
// ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment');
|
||||||
$sql = "create table ".$table."(";
|
$sql = "create table ".$table."(";
|
||||||
|
|||||||
@ -961,3 +961,69 @@ function monthArray($outputlangs, $short = 0)
|
|||||||
|
|
||||||
return $montharray;
|
return $montharray;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Return array of week numbers.
|
||||||
|
|
||||||
|
*
|
||||||
|
* @param int $month Month number
|
||||||
|
* @param int $year Year number
|
||||||
|
* @return array Week numbers
|
||||||
|
*/
|
||||||
|
function getWeekNumbersOfMonth($month, $year)
|
||||||
|
{
|
||||||
|
$nb_days = cal_days_in_month(CAL_GREGORIAN, $month, $year);
|
||||||
|
$TWeek = array();
|
||||||
|
for($day = 1; $day < $nb_days; $day++) {
|
||||||
|
$week_number = getWeekNumber($day, $month, $year);
|
||||||
|
$TWeek[$week_number] = $week_number;
|
||||||
|
}
|
||||||
|
return $TWeek;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return array of first day of weeks.
|
||||||
|
|
||||||
|
*
|
||||||
|
* @param array $TWeek array of week numbers
|
||||||
|
* @param int $year Year number
|
||||||
|
* @return array First day of week
|
||||||
|
*/
|
||||||
|
function getFirstDayOfEachWeek($TWeek, $year)
|
||||||
|
{
|
||||||
|
$TFirstDayOfWeek = array();
|
||||||
|
foreach($TWeek as $weekNb) {
|
||||||
|
if(in_array('01', $TWeek) && in_array('52', $TWeek) && $weekNb == '01') $year++;//Si on a la 1re semaine et la semaine 52 c'est qu'on change d'année
|
||||||
|
$TFirstDayOfWeek[$weekNb] = date('d', strtotime($year.'W'.$weekNb));
|
||||||
|
}
|
||||||
|
return $TFirstDayOfWeek;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return array of last day of weeks.
|
||||||
|
|
||||||
|
*
|
||||||
|
* @param array $TWeek array of week numbers
|
||||||
|
* @param int $year Year number
|
||||||
|
* @return array Last day of week
|
||||||
|
*/
|
||||||
|
function getLastDayOfEachWeek($TWeek, $year)
|
||||||
|
{
|
||||||
|
$TLastDayOfWeek = array();
|
||||||
|
foreach($TWeek as $weekNb) {
|
||||||
|
$TLastDayOfWeek[$weekNb] = date('d', strtotime($year.'W'.$weekNb.'+6 days'));
|
||||||
|
}
|
||||||
|
return $TLastDayOfWeek;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Return week number.
|
||||||
|
|
||||||
|
*
|
||||||
|
* @param int $day Day number
|
||||||
|
* @param int $month Month number
|
||||||
|
* @param int $year Year number
|
||||||
|
* @return int Week number
|
||||||
|
*/
|
||||||
|
function getWeekNumber($day, $month, $year)
|
||||||
|
{
|
||||||
|
$date = new DateTime($year.'-'.$month.'-'.$day);
|
||||||
|
$week = $date->format("W");
|
||||||
|
return $week;
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user