fix merging
This commit is contained in:
commit
95228ae01c
13
.github/workflows/greetings-pr.yml.disabled
vendored
Normal file
13
.github/workflows/greetings-pr.yml.disabled
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
name: Greetings PR
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
pr-message: 'Welcome to the Dolibarr army. You are on the road to become an Admiral (see https://wiki.dolibarr.org/index.php/Dolibarr_Project)'
|
||||
23
.github/workflows/stale-issues.yml
vendored
Normal file
23
.github/workflows/stale-issues.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
||||
name: "Close stale issues (bugs and feature requests)"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
stale-issue-label: 'Issue Stale (automatic label)'
|
||||
exempt-issue-label: 'Priority High / Blocking'
|
||||
days-before-stale: 365
|
||||
days-before-close: 10
|
||||
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
|
||||
#stale-pr-label: 'PR Stale (automatic label)'
|
||||
#exempt-pr-label: 'Priority Top Strategic'
|
||||
|
||||
68
.travis.yml
68
.travis.yml
@ -2,8 +2,8 @@
|
||||
# from Dolibarr GitHub repository.
|
||||
# For syntax, see http://about.travis-ci.org/docs/user/languages/php/
|
||||
|
||||
# We use dist: trusty to have php 5.4+ available
|
||||
dist: trusty
|
||||
# We use dist: xenial to have php 5.6+ available
|
||||
dist: xenial
|
||||
sudo: required
|
||||
|
||||
language: php
|
||||
@ -11,14 +11,16 @@ language: php
|
||||
# Start on every boot
|
||||
services:
|
||||
- memcached
|
||||
- mysql
|
||||
- postgresql
|
||||
|
||||
addons:
|
||||
mariadb: '10.0'
|
||||
postgresql: '9.3'
|
||||
# Force postgresql to 9.4 (the oldest availablable on xenial)
|
||||
postgresql: '9.4'
|
||||
apt:
|
||||
sources:
|
||||
# To use the last version of pgloader, we add repo of postgresql
|
||||
- pgdg-trusty
|
||||
# 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-xenial
|
||||
packages:
|
||||
# We need a webserver to test the webservices
|
||||
# Let's install Apache with.
|
||||
@ -43,11 +45,9 @@ env:
|
||||
- DEBUG=false
|
||||
matrix:
|
||||
# MariaDB overrides MySQL installation so it's not possible to test both yet
|
||||
#- DB=mysql
|
||||
- DB=mariadb
|
||||
#- DB=mariadb
|
||||
- DB=mysql
|
||||
- DB=postgresql
|
||||
# TODO
|
||||
#- DB=sqlite
|
||||
# See https://docs.travis-ci.com/user/languages/php/#Apache-%2B-PHP
|
||||
#- WS=apache
|
||||
# See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test
|
||||
@ -60,13 +60,13 @@ matrix:
|
||||
# We exclude some combinations not usefull to save Travis CPU
|
||||
exclude:
|
||||
- php: '7.0'
|
||||
env: DB=mariadb
|
||||
env: DB=mysql
|
||||
- php: '7.1'
|
||||
env: DB=mariadb
|
||||
env: DB=mysql
|
||||
- php: '7.2'
|
||||
env: DB=mariadb
|
||||
env: DB=mysql
|
||||
- php: '7.3'
|
||||
env: DB=mariadb
|
||||
env: DB=mysql
|
||||
- php: '7.0'
|
||||
env: DB=postgresql
|
||||
- php: '7.1'
|
||||
@ -183,32 +183,31 @@ before_script:
|
||||
# Check Apache version
|
||||
echo "Apache version"
|
||||
apache2 -v | head -
|
||||
# Check MariaDb
|
||||
echo "MariaDb version"
|
||||
# Check Database
|
||||
echo "Database version"
|
||||
mysql --version | head -
|
||||
mysql -e "SELECT VERSION();" | head -
|
||||
psql --version
|
||||
echo
|
||||
|
||||
- |
|
||||
echo "Setting up database"
|
||||
if [ "$DB" = 'mysql' ] || [ "$DB" = 'mariadb' ] || [ "$DB" = 'postgresql' ]; then
|
||||
echo "MySQL"
|
||||
mysql -e 'DROP DATABASE IF EXISTS travis;'
|
||||
mysql -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||
mysql -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
mysql -e 'FLUSH PRIVILEGES;'
|
||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
mysql -u root -e 'DROP DATABASE IF EXISTS travis;'
|
||||
mysql -u root -e 'CREATE DATABASE IF NOT EXISTS travis;'
|
||||
mysql -u root -e 'GRANT ALL PRIVILEGES ON travis.* TO travis@127.0.0.1;'
|
||||
mysql -u root -e 'FLUSH PRIVILEGES;'
|
||||
mysql -u root -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
#pgloader mysql://root:pass@127.0.0.1/dolibarr_9 postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dev
|
||||
echo pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||
echo 'ALTER SEQUENCE llx_accountingaccount_rowid_seq RENAME TO llx_accounting_account_rowid_seq' | psql travis
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql travis
|
||||
#echo 'select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'llx_accountingaccount' | psql travis
|
||||
#echo 'select * from information_schema.table_constraints;' | psql travis
|
||||
#echo 'ALTER TABLE "llx_accounting_account" DROP CONSTRAINT "idx_16390_primary"' | psql travis
|
||||
#psql -c 'create database travis;' -U postgres
|
||||
#psql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
#pgloader mysql://root:pass@127.0.0.1/dolibarr_src postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dest
|
||||
echo pgloader mysql://root@127.0.0.1/travis postgresql://postgres@/travis
|
||||
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 -U postgres travis
|
||||
echo 'ALTER SEQUENCE llx_accounting_account_rowid_seq RESTART WITH 1000001;' | psql -U postgres travis
|
||||
fi
|
||||
echo
|
||||
|
||||
@ -257,10 +256,7 @@ before_script:
|
||||
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
|
||||
- sudo chown -R travis:travis /var/lib/apache2/fastcgi
|
||||
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
|
||||
# configure apache virtual hosts for precise
|
||||
#- 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
|
||||
# configure apache virtual hosts
|
||||
- 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 cat /etc/apache2/sites-available/000-default.conf
|
||||
@ -285,7 +281,7 @@ script:
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
#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 --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/ --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
|
||||
echo
|
||||
|
||||
@ -453,7 +449,7 @@ after_failure:
|
||||
# Dolibarr log file
|
||||
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
# MariaDB log file
|
||||
# Database log file
|
||||
echo "Debugging informations for file mysql error.log"
|
||||
sudo tail -n 50 /var/log/mysql/error.log
|
||||
# TODO: PostgreSQL log file
|
||||
|
||||
82
ChangeLog
82
ChangeLog
@ -5,7 +5,7 @@ English Dolibarr ChangeLog
|
||||
|
||||
***** ChangeLog for 12.0.0 compared to 11.0.0 *****
|
||||
For Users:
|
||||
|
||||
NEW: Module MO (Manufacturing Order) is available as stable module.
|
||||
|
||||
For Developers or integrators:
|
||||
|
||||
@ -15,9 +15,85 @@ WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* PHP 5.5 is no more supported. Minimum PHP is now 5.6+.
|
||||
* Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests
|
||||
with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing
|
||||
the HTML into content (in such a case, sanitize data later)
|
||||
* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless.
|
||||
|
||||
|
||||
***** ChangeLog for 11.0.1 compared to 11.0.0 *****
|
||||
FIX: advanced target emailing sql and ergonomy.
|
||||
FIX: After import of a website template, home page was not set.
|
||||
FIX: Avoid deletion of bank record if in accounting
|
||||
FIX: compatibility with multicompany (avoid duplicate data)
|
||||
FIX: Confusion between 'bank reconciled' and 'accounted'. Show both data.
|
||||
FIX: Count of Stripe payment mode must take test/live into account
|
||||
FIX: Creation of Stripe card from backoffice must return a clean message
|
||||
FIX: CVE-2019–17223
|
||||
FIX: CVE-2019–17223
|
||||
FIX: CVE-2020-7994
|
||||
FIX: CVE Need permission to be able to develop modules
|
||||
FIX: #13053
|
||||
FIX: Disable ticket status change if ticket closed
|
||||
FIX: doc of dictionnary API
|
||||
FIX: expedition ceate line new parameter is not required.
|
||||
FIX: export ledger
|
||||
FIX: FEC export have specific name
|
||||
FIX: Filenames must not contains non ascii char or we will get non ascii
|
||||
FIX: Filter on list of events were lost after "Back to list"
|
||||
FIX: hasDelay for retained warranty
|
||||
FIX: If we can change vendor status, we must be able to chane vendor code
|
||||
FIX: links in products/services index
|
||||
FIX: Log of authentication ok or ko + CVE-2020-7996
|
||||
FIX: Look and feel v11
|
||||
FIX: Mail smtps truncated if content has a line with single .
|
||||
FIX: missing hook parameter
|
||||
FIX: Missing include
|
||||
FIX: need weight short label in shipping doc
|
||||
FIX: Picture of contact not visible in tooltip
|
||||
FIX: Problem with column label in subscription list
|
||||
FIX: ref_client not visible in tooltip.
|
||||
FIX: search filter on extrafields were not restored after "Back to list"
|
||||
FIX: situation invoice: allow excess paid to be converted to discount
|
||||
FIX: situation invoice: bad amount for previous payments because of local variable overwriting a more global one
|
||||
FIX: situation invoice: can't convert excess received to discount & bad previous payment amount
|
||||
FIX: SQL request and phpunit
|
||||
FIX: Update export_files.php
|
||||
FIX: Use ref into label of ticket message
|
||||
FIX: use "usergroup" instead of "user"
|
||||
FIX: Warning on admin/export_files
|
||||
FIX: #10203
|
||||
FIX: default filtering for 'select' extrafields should use "=", not "LIKE"
|
||||
FIX: #11975 When a product is split between multiple pages in a document, prices/quantity/etc appear on the last relevant page
|
||||
FIX: #12760 #12763 #12755 #12765 #12751
|
||||
FIX: #12874
|
||||
FIX: #12892
|
||||
FIX: #12908 User login with credentials from self-subscription form fails
|
||||
FIX: #12932
|
||||
FIX: #12966
|
||||
FIX: #12973
|
||||
FIX: #12974
|
||||
FIX: #12975
|
||||
FIX: #12978
|
||||
FIX: #12986
|
||||
FIX: #12991
|
||||
FIX: #12992
|
||||
FIX: #12995
|
||||
FIX: #13018 Extrafields Supplier invoice
|
||||
FIX: #13019
|
||||
FIX: #13022
|
||||
FIX: #13028
|
||||
FIX: #13038 ExpenseReport PDF - custom category description is not correct
|
||||
FIX: #13046 More complete
|
||||
FIX: #13048
|
||||
FIX: #13050
|
||||
FIX: #13077 Replace left join with inner join (left join was useless)
|
||||
FIX: #13085
|
||||
FIX: #13094
|
||||
FIX: #13096
|
||||
FIX: #13100
|
||||
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 11.0.0 compared to 10.0.0 *****
|
||||
For Users:
|
||||
|
||||
|
||||
@ -151,6 +151,7 @@ La documentation utilisateur, développeur et traducteur est disponible sous for
|
||||
## CONTRIBUER
|
||||
|
||||
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
||||
|
||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
## CREDITS
|
||||
|
||||
@ -170,7 +170,8 @@ Administrator, user, developer and translator's documentations are available alo
|
||||
|
||||
## CONTRIBUTING
|
||||
|
||||
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
|
||||
This project exists thanks to all the people who contribute. [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
|
||||
|
||||
<a href="https://github.com/Dolibarr/dolibarr/graphs/contributors"><img src="https://opencollective.com/dolibarr/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
## CREDITS
|
||||
|
||||
@ -213,6 +213,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/reception
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/salaries
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/stripe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
@ -224,6 +225,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -293,6 +293,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/reception
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/salaries
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/stripe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
@ -304,6 +305,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -210,6 +210,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/reception
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/salaries
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/stripe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
@ -221,6 +222,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -221,6 +221,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/public
|
||||
%_datadir/dolibarr/htdocs/reception
|
||||
%_datadir/dolibarr/htdocs/resource
|
||||
%_datadir/dolibarr/htdocs/salaries
|
||||
%_datadir/dolibarr/htdocs/societe
|
||||
%_datadir/dolibarr/htdocs/stripe
|
||||
%_datadir/dolibarr/htdocs/supplier_proposal
|
||||
@ -232,6 +233,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/variants
|
||||
%_datadir/dolibarr/htdocs/webservices
|
||||
%_datadir/dolibarr/htdocs/website
|
||||
%_datadir/dolibarr/htdocs/zapier
|
||||
%_datadir/dolibarr/htdocs/*.ico
|
||||
%_datadir/dolibarr/htdocs/*.patch
|
||||
%_datadir/dolibarr/htdocs/*.php
|
||||
|
||||
@ -63,10 +63,49 @@ with
|
||||
|
||||
if (isset($this->imagekeys)) {
|
||||
foreach($this->imagekeys as $file) {
|
||||
// unlink($file);
|
||||
// DOL CHANGE If we keep this, source image files are physically destroyed
|
||||
// unlink($file);
|
||||
}
|
||||
}
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
$preserve = array(
|
||||
'file_id',
|
||||
'internal_encoding',
|
||||
'state',
|
||||
'bufferlen',
|
||||
'buffer',
|
||||
'cached_files',
|
||||
|
||||
with
|
||||
|
||||
$preserve = array(
|
||||
'file_id',
|
||||
'internal_encoding',
|
||||
'state',
|
||||
'bufferlen',
|
||||
'buffer',
|
||||
'cached_files',
|
||||
// @CHANGE DOL
|
||||
'imagekeys',
|
||||
|
||||
* Replace in tcpdf.php
|
||||
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
with
|
||||
|
||||
if (!@TCPDF_STATIC::file_exists($file)) {
|
||||
// DOL CHANGE If we keep this, the image is not visible on pages after the first one.
|
||||
//var_dump($file.' '.(!@TCPDF_STATIC::file_exists($file)));
|
||||
//return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace
|
||||
|
||||
if (strpos($filename, '://') === false) {
|
||||
@ -102,7 +141,7 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
TCPDI:
|
||||
------
|
||||
@ -214,6 +253,24 @@ PARSEDOWN
|
||||
$shortage = 4 - $len % 4;
|
||||
|
||||
|
||||
|
||||
OAUTH
|
||||
-----
|
||||
Add into Class Google of file OAuth2/Service/Google:
|
||||
|
||||
// LDR CHANGE Add approval_prompt to force the prompt if value is set to 'force' so it force return of a "refresh token" in addition to "standard token"
|
||||
public $approvalPrompt='auto';
|
||||
public function setApprouvalPrompt($prompt)
|
||||
{
|
||||
if (!in_array($prompt, array('auto', 'force'), true)) {
|
||||
// @todo Maybe could we rename this exception
|
||||
throw new InvalidAccessTypeException('Invalid approuvalPrompt, expected either auto or force.');
|
||||
}
|
||||
$this->approvalPrompt = $prompt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
JEDITABLE.JS
|
||||
------------
|
||||
|
||||
|
||||
@ -66,8 +66,9 @@ $obj = new Facture($db);
|
||||
|
||||
$obj->ref = 'ABCDE';
|
||||
$obj->socid = 4; // Put id of third party (rowid in llx_societe table)
|
||||
$obj->date = mktime();
|
||||
$obj->note = 'A comment';
|
||||
$obj->date = dol_now();
|
||||
$obj->note_public = 'A public comment';
|
||||
$obj->note_private = 'A private comment';
|
||||
$obj->cond_reglement_id = 1;
|
||||
|
||||
$line1=new FactureLigne($db);
|
||||
|
||||
@ -66,8 +66,9 @@ $com = new Commande($db);
|
||||
|
||||
$com->ref = 'ABCDE';
|
||||
$com->socid = 4; // Put id of third party (rowid in llx_societe table)
|
||||
$com->date_commande = mktime();
|
||||
$com->note = 'A comment';
|
||||
$com->date = dol_now();
|
||||
$com->note_public = 'A public comment';
|
||||
$com->note_private = 'A private comment';
|
||||
$com->source = 1;
|
||||
$com->remise_percent = 0;
|
||||
|
||||
|
||||
231
dev/initdata/dbf/import-dbf.php
Normal file
231
dev/initdata/dbf/import-dbf.php
Normal file
@ -0,0 +1,231 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-dbf.php
|
||||
* \brief Script example to create a table from a large DBF file (openoffice)
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
|
||||
$path = dirname(__FILE__) . '/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path = dirname($_SERVER["PHP_SELF"]);
|
||||
require $path . "./../htdocs/master.inc.php";
|
||||
require $path . "/includes/dbase.class.php";
|
||||
|
||||
// Global variables
|
||||
$version = DOL_VERSION;
|
||||
$confirmed = 1;
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
@set_time_limit(0);
|
||||
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||
|
||||
|
||||
$filepath = $argv[1];
|
||||
$filepatherr = $filepath . '.err';
|
||||
$startchar = empty($argv[2]) ? 0 : (int) $argv[2];
|
||||
$deleteTable = empty($argv[3]) ? 1 : 0;
|
||||
$startlinenb = empty($argv[3]) ? 1 : (int) $argv[3];
|
||||
$endlinenb = empty($argv[4]) ? 0 : (int) $argv[4];
|
||||
|
||||
if (empty($filepath)) {
|
||||
print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n";
|
||||
print "Example: php $script_file myfilepath.dbf 0 2 1002\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
if (!file_exists($filepath)) {
|
||||
print "Error: File " . $filepath . " not found.\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$ret = $user->fetch('', 'admin');
|
||||
if (!$ret > 0) {
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||
exit;
|
||||
}
|
||||
$user->getrights();
|
||||
|
||||
// Ask confirmation
|
||||
if (!$confirmed) {
|
||||
print "Hit Enter to continue or CTRL+C to stop...\n";
|
||||
$input = trim(fgets(STDIN));
|
||||
}
|
||||
|
||||
// Open input and output files
|
||||
$fhandle = dbase_open($filepath, 0);
|
||||
if (!$fhandle) {
|
||||
print 'Error: Failed to open file ' . $filepath . "\n";
|
||||
exit(1);
|
||||
}
|
||||
$fhandleerr = fopen($filepatherr, 'w');
|
||||
if (!$fhandleerr) {
|
||||
print 'Error: Failed to open file ' . $filepatherr . "\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$langs->setDefaultLang($defaultlang);
|
||||
|
||||
$record_numbers = dbase_numrecords($fhandle);
|
||||
$table_name = substr(basename($filepath), 0, strpos(basename($filepath), '.'));
|
||||
print 'Info: ' . $record_numbers . " lines in file \n";
|
||||
$header = dbase_get_header_info($fhandle);
|
||||
if ($deleteTable) {
|
||||
$db->query("DROP TABLE IF EXISTS `$table_name`");
|
||||
}
|
||||
$sqlCreate = "CREATE TABLE IF NOT EXISTS `$table_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT ";
|
||||
$fieldArray = array("`id`");
|
||||
foreach ($header as $value) {
|
||||
$fieldName = substr(str_replace('_', '', $value['name']), $startchar);
|
||||
$fieldArray[] = "`$fieldName`";
|
||||
$sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL ";
|
||||
}
|
||||
$sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB";
|
||||
$resql = $db->query($sqlCreate);
|
||||
if ($resql !== false) {
|
||||
print "Table $table_name created\n";
|
||||
} else {
|
||||
var_dump($db->errno());
|
||||
print "Impossible : " . $sqlCreate . "\n";
|
||||
die();
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$nboflines++;
|
||||
|
||||
$fields = implode(',', $fieldArray);
|
||||
//var_dump($fieldArray);die();
|
||||
$maxLength = 0;
|
||||
for ($i = 1; $i <= $record_numbers; $i++) {
|
||||
if ($startlinenb && $i < $startlinenb)
|
||||
continue;
|
||||
if ($endlinenb && $i > $endlinenb)
|
||||
continue;
|
||||
$row = dbase_get_record_with_names($fhandle, $i);
|
||||
if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1'))
|
||||
continue;
|
||||
$sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,";
|
||||
array_shift($row); // remove delete column
|
||||
foreach ($row as $value) {
|
||||
$sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', ";
|
||||
}
|
||||
replaceable_echo(implode("\t", $row));
|
||||
$sqlInsert = rtrim($sqlInsert, ', ');
|
||||
$sqlInsert .= ")";
|
||||
$resql = $db->query($sqlInsert);
|
||||
if ($resql === false) {
|
||||
print "Impossible : " . $sqlInsert . "\n";
|
||||
var_dump($row, $db->errno());
|
||||
die();
|
||||
}
|
||||
// $fields = (object) $row;
|
||||
// var_dump($fields);
|
||||
continue;
|
||||
}
|
||||
die();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// commit or rollback
|
||||
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||
print "Nb of errors: " . $error . "\n";
|
||||
if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) {
|
||||
print "Rollback any changes.\n";
|
||||
$db->rollback();
|
||||
} else {
|
||||
print "Commit all changes.\n";
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
$db->close();
|
||||
fclose($fhandle);
|
||||
fclose($fhandleerr);
|
||||
|
||||
exit($error);
|
||||
|
||||
|
||||
/**
|
||||
* replaceable_echo
|
||||
*
|
||||
* @param string $message Message
|
||||
* @param int $force_clear_lines Force clear messages
|
||||
* @return void
|
||||
*/
|
||||
function replaceable_echo($message, $force_clear_lines = null)
|
||||
{
|
||||
static $last_lines = 0;
|
||||
|
||||
if (!is_null($force_clear_lines)) {
|
||||
$last_lines = $force_clear_lines;
|
||||
}
|
||||
|
||||
$toss = array();
|
||||
$status = 0;
|
||||
$term_width = exec('tput cols', $toss, $status);
|
||||
if ($status) {
|
||||
$term_width = 64; // Arbitrary fall-back term width.
|
||||
}
|
||||
|
||||
$line_count = 0;
|
||||
foreach (explode("\n", $message) as $line) {
|
||||
$line_count += count(str_split($line, $term_width));
|
||||
}
|
||||
|
||||
// Erasure MAGIC: Clear as many lines as the last output had.
|
||||
for ($i = 0; $i < $last_lines; $i++) {
|
||||
// Return to the beginning of the line
|
||||
echo "\r";
|
||||
// Erase to the end of the line
|
||||
echo "\033[K";
|
||||
// Move cursor Up a line
|
||||
echo "\033[1A";
|
||||
// Return to the beginning of the line
|
||||
echo "\r";
|
||||
// Erase to the end of the line
|
||||
echo "\033[K";
|
||||
// Return to the beginning of the line
|
||||
echo "\r";
|
||||
// Can be consolodated into
|
||||
// echo "\r\033[K\033[1A\r\033[K\r";
|
||||
}
|
||||
|
||||
$last_lines = $line_count;
|
||||
|
||||
echo $message . "\n";
|
||||
}
|
||||
241
dev/initdata/dbf/importdb-products.php
Normal file
241
dev/initdata/dbf/importdb-products.php
Normal file
@ -0,0 +1,241 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-product.php
|
||||
* \brief Script example to insert products from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = dirname(__FILE__) . '/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path = preg_replace('/importdb-products.php/i', '', $_SERVER["PHP_SELF"]);
|
||||
require $path . "../../htdocs/master.inc.php";
|
||||
require $path . "includes/dbase.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
//$delimiter = ',';
|
||||
//$enclosure = '"';
|
||||
//$linelength = 10000;
|
||||
//$escape = '/';
|
||||
// Global variables
|
||||
$version = DOL_VERSION;
|
||||
$confirmed = 1;
|
||||
$error = 0;
|
||||
|
||||
$tvas = [
|
||||
'1' => "20.00",
|
||||
'2' => "5.50",
|
||||
'3' => "0.00",
|
||||
'4' => "20.60",
|
||||
'5' => "19.60",
|
||||
];
|
||||
$tvasD = [
|
||||
'1' => "20",
|
||||
'2' => "5.5",
|
||||
'3' => "0",
|
||||
'4' => "20",
|
||||
'5' => "20",
|
||||
];
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
@set_time_limit(0);
|
||||
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||
|
||||
$table = $argv[1];
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Error: Which table ?\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$ret = $user->fetch('', 'admin');
|
||||
if (!$ret > 0) {
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `$table` WHERE 1";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
while ($fields = $db->fetch_array($resql)) {
|
||||
$errorrecord = 0;
|
||||
if ($fields === false)
|
||||
continue;
|
||||
$nboflines++;
|
||||
|
||||
$produit = new Product($db);
|
||||
$produit->type = 0;
|
||||
$produit->status = 1;
|
||||
$produit->ref = trim($fields['REF']);
|
||||
if ($produit->ref == '')
|
||||
continue;
|
||||
print "Process line nb " . $j . ", ref " . $produit->ref;
|
||||
$produit->label = trim($fields['LIBELLE']);
|
||||
if ($produit->label == '')
|
||||
$produit->label = $produit->ref;
|
||||
if (empty($produit->label))
|
||||
continue;
|
||||
//$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : ''));
|
||||
// $produit->volume = price2num($fields[8]);
|
||||
// $produit->volume_unit = 0;
|
||||
$produit->weight = price2num($fields['MASSE']);
|
||||
$produit->weight_units = 0; // -3 = g
|
||||
//$produit->customcode = $fields[10];
|
||||
$produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT);
|
||||
$produit->barcode_type = '2';
|
||||
$produit->import_key = $fields['CODE'];
|
||||
|
||||
$produit->status = 1;
|
||||
$produit->status_buy = 1;
|
||||
|
||||
$produit->finished = 1;
|
||||
|
||||
// $produit->multiprices[0] = price2num($fields['TARIF0']);
|
||||
// $produit->multiprices[1] = price2num($fields['TARIF1']);
|
||||
// $produit->multiprices[2] = price2num($fields['TARIF2']);
|
||||
// $produit->multiprices[3] = price2num($fields['TARIF3']);
|
||||
// $produit->multiprices[4] = price2num($fields['TARIF4']);
|
||||
// $produit->multiprices[5] = price2num($fields['TARIF5']);
|
||||
// $produit->multiprices[6] = price2num($fields['TARIF6']);
|
||||
// $produit->multiprices[7] = price2num($fields['TARIF7']);
|
||||
// $produit->multiprices[8] = price2num($fields['TARIF8']);
|
||||
// $produit->multiprices[9] = price2num($fields['TARIF9']);
|
||||
// $produit->price_min = null;
|
||||
// $produit->price_min_ttc = null;
|
||||
// $produit->price = price2num($fields[11]);
|
||||
// $produit->price_ttc = price2num($fields[12]);
|
||||
// $produit->price_base_type = 'TTC';
|
||||
// $produit->tva_tx = price2num($fields[13]);
|
||||
$produit->tva_tx = (int) ($tvas[$fields['CODTVA']]);
|
||||
$produit->tva_npr = 0;
|
||||
// $produit->cost_price = price2num($fields[16]);
|
||||
//compta
|
||||
|
||||
$produit->accountancy_code_buy = trim($fields['COMACH']);
|
||||
$produit->accountancy_code_sell = trim($fields['COMVEN']);
|
||||
// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']);
|
||||
// $produit->accountancy_code_sell_export=trim($fields['COMVEN']);
|
||||
// Extrafields
|
||||
// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]);
|
||||
|
||||
$produit->seuil_stock_alerte = $fields['STALERTE'];
|
||||
$ret = $produit->create($user, 0);
|
||||
if ($ret < 0) {
|
||||
print " - Error in create result code = " . $ret . " - " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - Creation OK with ref " . $produit->ref . " - id = " . $ret;
|
||||
}
|
||||
|
||||
dol_syslog("Add prices");
|
||||
|
||||
// If we use price level, insert price for each level
|
||||
if (!$errorrecord && 1) {
|
||||
//$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array());
|
||||
$ret1 = false;
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
if ($fields['TARIF' . ($i)] == 0)
|
||||
continue;
|
||||
$ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0;
|
||||
}
|
||||
if ($ret1) {
|
||||
print " - Error in updatePrice result " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - updatePrice OK";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// dol_syslog("Add multilangs");
|
||||
// Add alternative languages
|
||||
// if (!$errorrecord && 1) {
|
||||
// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private);
|
||||
// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private);
|
||||
//
|
||||
// $ret = $produit->setMultiLangs($user);
|
||||
// if ($ret < 0) {
|
||||
// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString();
|
||||
// $errorrecord++;
|
||||
// } else {
|
||||
// print " - setMultiLangs OK";
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
dol_syslog("Add stocks");
|
||||
// stocks
|
||||
if (!$errorrecord && $fields['STOCK'] != 0) {
|
||||
$rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé');
|
||||
if ($rets < 0) {
|
||||
print " - Error in correct_stock result " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - correct_stock OK";
|
||||
}
|
||||
}
|
||||
|
||||
//update date créa
|
||||
if (!$errorrecord) {
|
||||
$date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2);
|
||||
$retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id");
|
||||
if ($retd < 1) {
|
||||
print " - Error in update date créa result " . $produit->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - update date créa OK";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
|
||||
if ($errorrecord) {
|
||||
print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n");
|
||||
var_dump($db);
|
||||
die();
|
||||
$error++; // $errorrecord will be reset
|
||||
}
|
||||
$j++;
|
||||
} else
|
||||
die("error : $sql");
|
||||
|
||||
|
||||
|
||||
|
||||
// commit or rollback
|
||||
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||
print "Nb of errors: " . $error . "\n";
|
||||
$db->close();
|
||||
|
||||
exit($error);
|
||||
355
dev/initdata/dbf/importdb-thirdparties.php
Normal file
355
dev/initdata/dbf/importdb-thirdparties.php
Normal file
@ -0,0 +1,355 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-product.php
|
||||
* \brief Script example to insert products from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = dirname(__FILE__) . '/';
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Recupere root dolibarr
|
||||
$path = preg_replace('/importdb-thirdparties.php/i', '', $_SERVER["PHP_SELF"]);
|
||||
require $path . "../../htdocs/master.inc.php";
|
||||
require $path . "includes/dbase.class.php";
|
||||
include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
//$delimiter = ',';
|
||||
//$enclosure = '"';
|
||||
//$linelength = 10000;
|
||||
//$escape = '/';
|
||||
// Global variables
|
||||
$version = DOL_VERSION;
|
||||
$confirmed = 1;
|
||||
$error = 0;
|
||||
|
||||
$civilPrivate = array("MLLE",
|
||||
"MM",
|
||||
"MM/MADAME",
|
||||
"MME",
|
||||
"MME.",
|
||||
"MME²",
|
||||
"MMONSIEUR",
|
||||
"MMR",
|
||||
"MOBNSIEUR",
|
||||
"MOMSIEUR",
|
||||
"MON SIEUR",
|
||||
"MONDIAL",
|
||||
"MONIEUR",
|
||||
"MONJSIEUR",
|
||||
"MONNSIEUR",
|
||||
"MONRIEUR",
|
||||
"MONS",
|
||||
"MONSIEÕR",
|
||||
"MONSIER",
|
||||
"MONSIERU",
|
||||
"MONSIEU",
|
||||
"monsieue",
|
||||
"MONSIEUR",
|
||||
"Monsieur \"",
|
||||
"MONSIEUR \"",
|
||||
"MONSIEUR E",
|
||||
"MONSIEUR DENIS",
|
||||
"MONSIEUR ET MME",
|
||||
"MONSIEUR!",
|
||||
"MONSIEUR.",
|
||||
"MONSIEUR.MADAME",
|
||||
"MONSIEUR3",
|
||||
"MONSIEURN",
|
||||
"MONSIEURT",
|
||||
"MONSIEUR£",
|
||||
"MONSIEYR",
|
||||
"Monsigur",
|
||||
"MONSIIEUR",
|
||||
"MONSIUER",
|
||||
"MONSIZEUR",
|
||||
"MOPNSIEUR",
|
||||
"MOSIEUR",
|
||||
"MR",
|
||||
"Mr Mme",
|
||||
"Mr - MME",
|
||||
"MR BLANC",
|
||||
"MR ET MME",
|
||||
"mr mm",
|
||||
"MR OU MME",
|
||||
"Mr.",
|
||||
"MR/MME",
|
||||
"MRME",
|
||||
"MRR",
|
||||
"Mrs",
|
||||
"Mademoiselle",
|
||||
"MADAOME",
|
||||
"madamme",
|
||||
"MADAME",
|
||||
"M0NSIEUR",
|
||||
"M.et Madame",
|
||||
"M. ET MR",
|
||||
"M.",
|
||||
"M%",
|
||||
"M MME",
|
||||
"M ET MME",
|
||||
"M",
|
||||
"M CROCE",
|
||||
"M DIEVART",
|
||||
);
|
||||
|
||||
/*
|
||||
* Main
|
||||
*/
|
||||
|
||||
@set_time_limit(0);
|
||||
print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n";
|
||||
dol_syslog($script_file . " launched with arg " . implode(',', $argv));
|
||||
|
||||
$table = $argv[1];
|
||||
|
||||
if (empty($argv[1])) {
|
||||
print "Error: Quelle table ?\n";
|
||||
print "\n";
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
$ret = $user->fetch('', 'admin');
|
||||
if (!$ret > 0) {
|
||||
print 'A user with login "admin" and all permissions must be created to use this script.' . "\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC";
|
||||
$resql = $db->query($sql);
|
||||
//$db->begin();
|
||||
if ($resql)
|
||||
while ($fields = $db->fetch_array($resql)) {
|
||||
$i++;
|
||||
$errorrecord = 0;
|
||||
|
||||
if ($startlinenb && $i < $startlinenb)
|
||||
continue;
|
||||
if ($endlinenb && $i > $endlinenb)
|
||||
continue;
|
||||
|
||||
$nboflines++;
|
||||
|
||||
$object = new Societe($db);
|
||||
$object->import_key = $fields['CODE'];
|
||||
$object->state = 1;
|
||||
$object->client = 3;
|
||||
$object->fournisseur = 0;
|
||||
|
||||
$object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM'];
|
||||
//$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : '';
|
||||
|
||||
$date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101');
|
||||
$object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT);
|
||||
|
||||
|
||||
$object->address = trim($fields['FADR1']);
|
||||
if ($fields['FADR2'])
|
||||
$object->address .= "\n" . trim($fields['FADR2']);
|
||||
if ($fields['FADR3'])
|
||||
$object->address .= "\n" . trim($fields['FADR3']);
|
||||
|
||||
$object->zip = trim($fields['FPOSTE']);
|
||||
$object->town = trim($fields['FVILLE']);
|
||||
if ($fields['FPAYS'])
|
||||
$object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid');
|
||||
else
|
||||
$object->country_id = 1;
|
||||
$object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']);
|
||||
$object->phone = substr($object->phone, 0, 20);
|
||||
$object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']);
|
||||
$object->fax = substr($object->fax, 0, 20);
|
||||
$object->email = trim($fields['FMAIL']);
|
||||
// $object->idprof2 = trim($fields[29]);
|
||||
$object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']);
|
||||
$object->tva_intra = substr($object->tva_intra, 0, 20);
|
||||
$object->default_lang = 'fr_FR';
|
||||
|
||||
$object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1);
|
||||
$object->multicurrency_code = 'EUR';
|
||||
|
||||
if ($fields['REMISE'] != '0.00') {
|
||||
$object->remise_percent = abs($fields['REMISE']);
|
||||
}
|
||||
|
||||
// $object->code_client = $fields[9];
|
||||
// $object->code_fournisseur = $fields[10];
|
||||
|
||||
|
||||
if ($fields['FCIVIL']) {
|
||||
$labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL';
|
||||
$object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code');
|
||||
}
|
||||
|
||||
// Set price level
|
||||
$object->price_level = $fields['TARIF'] + 1;
|
||||
// if ($labeltype == 'Revendeur')
|
||||
// $object->price_level = 2;
|
||||
|
||||
print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name;
|
||||
|
||||
|
||||
// Extrafields
|
||||
$object->array_options['options_banque'] = $fields['BANQUE'];
|
||||
$object->array_options['options_banque2'] = $fields['BANQUE2'];
|
||||
$object->array_options['options_banquevalid'] = $fields['VALID'];
|
||||
|
||||
if (!$errorrecord) {
|
||||
$ret = $object->create($user);
|
||||
if ($ret < 0) {
|
||||
print " - Error in create result code = " . $ret . " - " . $object->errorsToString();
|
||||
$errorrecord++;
|
||||
var_dump($object->code_client, $db);
|
||||
die();
|
||||
} else {
|
||||
print " - Creation OK with name " . $object->name . " - id = " . $ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$errorrecord) {
|
||||
dol_syslog("Set price level");
|
||||
$object->set_price_level($object->price_level, $user);
|
||||
}
|
||||
if (!$errorrecord && @$object->remise_percent) {
|
||||
dol_syslog("Set remise client");
|
||||
$object->set_remise_client($object->remise_percent, 'Importé', $user);
|
||||
}
|
||||
|
||||
dol_syslog("Add contact");
|
||||
// Insert an invoice contact if there is an invoice email != standard email
|
||||
if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) {
|
||||
$madame = array("MADAME",
|
||||
"MADEMOISELLE",
|
||||
"MELLE",
|
||||
"MLLE",
|
||||
"MM",
|
||||
"Mme",
|
||||
"MNE",
|
||||
);
|
||||
$monsieur = array("M",
|
||||
"M ET MME",
|
||||
"M MME",
|
||||
"M.",
|
||||
"M. MME",
|
||||
"M. OU Mme",
|
||||
"M.ou Madame",
|
||||
"MONSEUR",
|
||||
"MONSIER",
|
||||
"MONSIEU",
|
||||
"MONSIEUR",
|
||||
"monsieur:mme",
|
||||
"MONSIEUR¨",
|
||||
"MONSIEZUR",
|
||||
"MONSIUER",
|
||||
"MONSKIEUR",
|
||||
"MR",
|
||||
);
|
||||
$ret1 = $ret2 = 0;
|
||||
|
||||
$contact = new Contact($db);
|
||||
if (in_array($fields['LCIVIL'], $madame)) {
|
||||
// une dame
|
||||
$contact->civility_id = 'MME';
|
||||
$contact->lastname = $fields['LNOM'];
|
||||
} elseif (in_array($fields['LCIVIL'], $monsieur)) {
|
||||
// un monsieur
|
||||
$contact->civility_id = 'MR';
|
||||
$contact->lastname = $fields['LNOM'];
|
||||
} elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) {
|
||||
// un monsieur
|
||||
$contact->civility_id = 'DR';
|
||||
$contact->lastname = $fields['LNOM'];
|
||||
} else {
|
||||
// un a rattraper
|
||||
$contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM'];
|
||||
}
|
||||
$contact->address = trim($fields['LADR1']);
|
||||
if ($fields['LADR2'])
|
||||
$contact->address .= "\n" . trim($fields['LADR2']);
|
||||
if ($fields['LADR3'])
|
||||
$contact->address .= "\n" . trim($fields['LADR3']);
|
||||
|
||||
$contact->zip = trim($fields['LPOSTE']);
|
||||
$contact->town = trim($fields['LVILLE']);
|
||||
if ($fields['FPAYS'])
|
||||
$contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid');
|
||||
else
|
||||
$contact->country_id = 1;
|
||||
$contact->email = $fields['LMAIL'];
|
||||
$contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']);
|
||||
$contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']);
|
||||
$contact->socid = $object->id;
|
||||
|
||||
$ret1 = $contact->create($user);
|
||||
if ($ret1 > 0) {
|
||||
//$ret2=$contact->add_contact($object->id, 'BILLING');
|
||||
}
|
||||
if ($ret1 < 0 || $ret2 < 0) {
|
||||
print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - create contact OK";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//update date créa
|
||||
if (!$errorrecord) {
|
||||
$datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2);
|
||||
$retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id");
|
||||
if ($retd < 1) {
|
||||
print " - Error in update date créa result " . $object->errorsToString();
|
||||
$errorrecord++;
|
||||
} else {
|
||||
print " - update date créa OK";
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
|
||||
if ($errorrecord) {
|
||||
print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n");
|
||||
var_dump($db, $object, $contact);
|
||||
// $db->rollback();
|
||||
die();
|
||||
$error++; // $errorrecord will be reset
|
||||
}
|
||||
$j++;
|
||||
} else
|
||||
die("error : $sql");
|
||||
|
||||
$db->commit();
|
||||
|
||||
|
||||
|
||||
// commit or rollback
|
||||
print "Nb of lines qualified: " . $nboflines . "\n";
|
||||
print "Nb of errors: " . $error . "\n";
|
||||
$db->close();
|
||||
|
||||
exit($error);
|
||||
402
dev/initdata/dbf/includes/dbase.class.php
Normal file
402
dev/initdata/dbf/includes/dbase.class.php
Normal file
@ -0,0 +1,402 @@
|
||||
<?php
|
||||
/**
|
||||
* \file dev/initdata/dbf/includes/dbase.class.php
|
||||
* \ingroup dev
|
||||
* \brief Class to manage DBF databases
|
||||
*/
|
||||
|
||||
// source : https://github.com/donfbecker/php-dbase
|
||||
|
||||
define('DBASE_RDONLY', 0);
|
||||
define('DBASE_WRONLY', 1);
|
||||
define('DBASE_RDWR', 2);
|
||||
define('DBASE_TYPE_DBASE', 0);
|
||||
define('DBASE_TYPE_FOXPRO', 1);
|
||||
|
||||
/**
|
||||
* Class for DBase
|
||||
*/
|
||||
class DBase
|
||||
{
|
||||
private $fd;
|
||||
private $headerLength = 0;
|
||||
private $fields = array();
|
||||
private $fieldCount = 0;
|
||||
private $recordLength = 0;
|
||||
private $recordCount = 0;
|
||||
|
||||
//resource dbase_open ( string $filename , int $mode )
|
||||
public static function open($filename, $mode)
|
||||
{
|
||||
if (!file_exists($filename))
|
||||
return false;
|
||||
$modes = array('r', 'w', 'r+');
|
||||
$mode = $modes[$mode];
|
||||
$fd = fopen($filename, $mode);
|
||||
if (!$fd)
|
||||
return false;
|
||||
return new DBase($fd);
|
||||
}
|
||||
|
||||
//resource dbase_create ( string $filename , array $fields [, int $type = DBASE_TYPE_DBASE ] )
|
||||
public static function create($filename, $fields, $type = DBASE_TYPE_DBASE)
|
||||
{
|
||||
if (file_exists($filename))
|
||||
return false;
|
||||
$fd = fopen($filename, 'c+');
|
||||
if (!$fd)
|
||||
return false;
|
||||
// Byte 0 (1 byte): Valid dBASE for DOS file; bits 0-2 indicate version number, bit 3
|
||||
// indicates the presence of a dBASE for DOS memo file, bits 4-6 indicate the
|
||||
// presence of a SQL table, bit 7 indicates the presence of any memo file
|
||||
// (either dBASE m PLUS or dBASE for DOS)
|
||||
self::putChar8($fd, 5);
|
||||
// Byte 1-3 (3 bytes): Date of last update; formatted as YYMMDD
|
||||
self::putChar8($fd, date('Y') - 1900);
|
||||
self::putChar8($fd, date('m'));
|
||||
self::putChar8($fd, date('d'));
|
||||
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
|
||||
self::putInt32($fd, 0);
|
||||
// Byte 8-9 (16-bit number): Number of bytes in the header.
|
||||
self::putInt16($fd, 32 + (32 * count($fields)) + 1);
|
||||
// Byte 10-11 (16-bit number): Number of bytes in record.
|
||||
// Make sure the include the byte for deleted flag
|
||||
$len = 1;
|
||||
foreach ($fields as &$field)
|
||||
$len += self::length($field);
|
||||
self::putInt16($fd, $len);
|
||||
// Byte 12-13 (2 bytes): Reserved, 0 filled.
|
||||
self::putInt16($fd, 0);
|
||||
// Byte 14 (1 byte): Flag indicating incomplete transaction
|
||||
// The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 15 (1 byte): Encryption flag. If this flag is set to 1, the message Database encrypted appears. Changing this flag to 0 removes the message, but does not decrypt the file.
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 16-27 (12 bytes): Reserved for dBASE for DOS in a multi-user environment
|
||||
self::putInt32($fd, 0);
|
||||
self::putInt32($fd, 0);
|
||||
self::putInt32($fd, 0);
|
||||
// Byte 28 (1 byte): Production .mdx file flag; 0x01 if there is a production .mdx file, 0x00 if not
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 29 (1 byte): Language driver ID
|
||||
// (no clue what this is)
|
||||
self::putChar8($fd, 0);
|
||||
// Byte 30-31 (2 bytes): Reserved, 0 filled.
|
||||
self::putInt16($fd, 0);
|
||||
// Byte 32 - n (32 bytes each): Field descriptor array
|
||||
foreach ($fields as &$field) {
|
||||
self::putString($fd, $field[0], 11); // Byte 0 - 10 (11 bytes): Field name in ASCII (zero-filled)
|
||||
self::putString($fd, $field[1], 1); // Byte 11 (1 byte): Field type in ASCII (C, D, F, L, M, or N)
|
||||
self::putInt32($fd, 0); // Byte 12 - 15 (4 bytes): Reserved
|
||||
self::putChar8($fd, self::length($field)); // Byte 16 (1 byte): Field length in binary. The maximum length of a field is 254 (0xFE).
|
||||
self::putChar8($fd, $field[3]); // Byte 17 (1 byte): Field decimal count in binary
|
||||
self::putInt16($fd, 0); // Byte 18 - 19 (2 bytes): Work area ID
|
||||
self::putChar8($fd, 0); // Byte 20 (1 byte): Example (??)
|
||||
self::putInt32($fd, 0); // Byte 21 - 30 (10 bytes): Reserved
|
||||
self::putInt32($fd, 0);
|
||||
self::putInt16($fd, 0);
|
||||
self::putChar8($fd, 0); // Byte 31 (1 byte): Production MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not
|
||||
}
|
||||
// Byte n + 1 (1 byte): 0x0D as the field descriptor array terminator
|
||||
self::putChar8($fd, 0x0D);
|
||||
return new DBase($fd);
|
||||
}
|
||||
|
||||
// Create DBase instance
|
||||
private function __construct($fd)
|
||||
{
|
||||
$this->fd = $fd;
|
||||
// Byte 4-7 (32-bit number): Number of records in the database file. Currently 0
|
||||
fseek($this->fd, 4, SEEK_SET);
|
||||
$this->recordCount = self::getInt32($fd);
|
||||
// Byte 8-9 (16-bit number): Number of bytes in the header.
|
||||
fseek($this->fd, 8, SEEK_SET);
|
||||
$this->headerLength = self::getInt16($fd);
|
||||
// Number of fields is (headerLength - 33) / 32)
|
||||
$this->fieldCount = ($this->headerLength - 33) / 32;
|
||||
// Byte 10-11 (16-bit number): Number of bytes in record.
|
||||
fseek($this->fd, 10, SEEK_SET);
|
||||
$this->recordLength = self::getInt16($fd);
|
||||
// Byte 32 - n (32 bytes each): Field descriptor array
|
||||
fseek($fd, 32, SEEK_SET);
|
||||
for ($i = 0; $i < $this->fieldCount; $i++) {
|
||||
$data = fread($this->fd, 32);
|
||||
$field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data));
|
||||
$this->fields[] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
//bool dbase_close ( resource $dbase_identifier )
|
||||
public function close()
|
||||
{
|
||||
fclose($this->fd);
|
||||
}
|
||||
|
||||
//array dbase_get_header_info ( resource $dbase_identifier )
|
||||
public function get_header_info()
|
||||
{
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
//int dbase_numfields ( resource $dbase_identifier )
|
||||
public function numfields()
|
||||
{
|
||||
return $this->fieldCount;
|
||||
}
|
||||
|
||||
//int dbase_numrecords ( resource $dbase_identifier )
|
||||
public function numrecords()
|
||||
{
|
||||
return $this->recordCount;
|
||||
}
|
||||
|
||||
//bool dbase_add_record ( resource $dbase_identifier , array $record )
|
||||
public function add_record($record)
|
||||
{
|
||||
if (count($record) != $this->fieldCount)
|
||||
return false;
|
||||
// Seek to end of file, minus the end of file marker
|
||||
fseek($this->fd, 0, SEEK_END);
|
||||
// Put the deleted flag
|
||||
self::putChar8($this->fd, 0x20);
|
||||
// Put the record
|
||||
if (!$this->putRecord($record))
|
||||
return false;
|
||||
// Update the record count
|
||||
fseek($this->fd, 4);
|
||||
self::putInt32($this->fd, ++$this->recordCount);
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number )
|
||||
public function replace_record($record, $record_number)
|
||||
{
|
||||
if (count($record) != $this->fieldCount)
|
||||
return false;
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
// Skip to the record location, plus the 1 byte for the deleted flag
|
||||
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1);
|
||||
return $this->putRecord($record);
|
||||
}
|
||||
|
||||
//bool dbase_delete_record ( resource $dbase_identifier , int $record_number )
|
||||
public function delete_record($record_number)
|
||||
{
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
|
||||
self::putChar8($this->fd, 0x2A);
|
||||
return true;
|
||||
}
|
||||
|
||||
//array dbase_get_record ( resource $dbase_identifier , int $record_number )
|
||||
public function get_record($record_number)
|
||||
{
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)));
|
||||
$record = array(
|
||||
'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0
|
||||
);
|
||||
foreach ($this->fields as $i => &$field) {
|
||||
$value = trim(fread($this->fd, $field['length']));
|
||||
if ($field['type'] == 'L') {
|
||||
$value = strtolower($value);
|
||||
if ($value == 't' || $value == 'y')
|
||||
$value = true;
|
||||
elseif ($value == 'f' || $value == 'n')
|
||||
$value = false;
|
||||
else
|
||||
$value = null;
|
||||
}
|
||||
$record[$i] = $value;
|
||||
}
|
||||
return $record;
|
||||
}
|
||||
|
||||
//array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number )
|
||||
public function get_record_with_names($record_number)
|
||||
{
|
||||
if ($record_number < 1 || $record_number > $this->recordCount)
|
||||
return false;
|
||||
$record = $this->get_record($record_number);
|
||||
foreach ($this->fields as $i => &$field) {
|
||||
$record[$field['name']] = $record[$i];
|
||||
unset($record[$i]);
|
||||
}
|
||||
return $record;
|
||||
}
|
||||
|
||||
//bool dbase_pack ( resource $dbase_identifier )
|
||||
public function pack()
|
||||
{
|
||||
$in_offset = $out_offset = $this->headerLength;
|
||||
$new_count = 0;
|
||||
$rec_count = $this->recordCount;
|
||||
while ($rec_count > 0) {
|
||||
fseek($this->fd, $in_offset, SEEK_SET);
|
||||
$record = fread($this->fd, $this->recordLength);
|
||||
$deleted = substr($record, 0, 1);
|
||||
if ($deleted != '*') {
|
||||
fseek($this->fd, $out_offset, SEEK_SET);
|
||||
fwrite($this->fd, $record);
|
||||
$out_offset += $this->recordLength;
|
||||
$new_count++;
|
||||
}
|
||||
$in_offset += $this->recordLength;
|
||||
$rec_count--;
|
||||
}
|
||||
ftruncate($this->fd, $out_offset);
|
||||
// Update the record count
|
||||
fseek($this->fd, 4);
|
||||
self::putInt32($this->fd, $new_count);
|
||||
}
|
||||
|
||||
/*
|
||||
* A few utilitiy functions
|
||||
*/
|
||||
|
||||
private static function length($field)
|
||||
{
|
||||
switch ($field[1]) {
|
||||
case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
|
||||
return 8;
|
||||
case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro)
|
||||
return 18;
|
||||
case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
|
||||
case 'N': // Number: -.0123456789 (right justified, padded with whitespaces)
|
||||
case 'F': // Float: -.0123456789 (right justified, padded with whitespaces)
|
||||
case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length)
|
||||
return $field[2];
|
||||
case 'L': // Boolean: YyNnTtFf? (? when not initialized)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions for reading and writing bytes
|
||||
*/
|
||||
|
||||
private static function getChar8($fd)
|
||||
{
|
||||
return ord(fread($fd, 1));
|
||||
}
|
||||
|
||||
private static function putChar8($fd, $value)
|
||||
{
|
||||
return fwrite($fd, chr($value));
|
||||
}
|
||||
|
||||
private static function getInt16($fd, $n = 1)
|
||||
{
|
||||
$data = fread($fd, 2 * $n);
|
||||
$i = unpack("S$n", $data);
|
||||
if ($n == 1)
|
||||
return (int) $i[1];
|
||||
else
|
||||
return array_merge($i);
|
||||
}
|
||||
|
||||
private static function putInt16($fd, $value)
|
||||
{
|
||||
return fwrite($fd, pack('S', $value));
|
||||
}
|
||||
|
||||
private static function getInt32($fd, $n = 1)
|
||||
{
|
||||
$data = fread($fd, 4 * $n);
|
||||
$i = unpack("L$n", $data);
|
||||
if ($n == 1)
|
||||
return (int) $i[1];
|
||||
else
|
||||
return array_merge($i);
|
||||
}
|
||||
|
||||
private static function putInt32($fd, $value)
|
||||
{
|
||||
return fwrite($fd, pack('L', $value));
|
||||
}
|
||||
|
||||
private static function putString($fd, $value, $length = 254)
|
||||
{
|
||||
$ret = fwrite($fd, pack('A' . $length, $value));
|
||||
}
|
||||
|
||||
private function putRecord($record)
|
||||
{
|
||||
foreach ($this->fields as $i => &$field) {
|
||||
$value = $record[$i];
|
||||
// Number types are right aligned with spaces
|
||||
if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) {
|
||||
$value = str_repeat(' ', $field['length'] - strlen($value)) . $value;
|
||||
}
|
||||
self::putString($this->fd, $value, $field['length']);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('dbase_open')) {
|
||||
|
||||
function dbase_open($filename, $mode)
|
||||
{
|
||||
return DBase::open($filename, $mode);
|
||||
}
|
||||
|
||||
function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE)
|
||||
{
|
||||
return DBase::create($filename, $fields, $type);
|
||||
}
|
||||
|
||||
function dbase_close($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->close();
|
||||
}
|
||||
|
||||
function dbase_get_header_info($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->get_header_info();
|
||||
}
|
||||
|
||||
function dbase_numfields($dbase_identifier)
|
||||
{
|
||||
$dbase_identifier->numfields();
|
||||
}
|
||||
|
||||
function dbase_numrecords($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->numrecords();
|
||||
}
|
||||
|
||||
function dbase_add_record($dbase_identifier, $record)
|
||||
{
|
||||
return $dbase_identifier->add_record($record);
|
||||
}
|
||||
|
||||
function dbase_delete_record($dbase_identifier, $record_number)
|
||||
{
|
||||
return $dbase_identifier->delete_record($record_number);
|
||||
}
|
||||
|
||||
function dbase_replace_record($dbase_identifier, $record, $record_number)
|
||||
{
|
||||
return $dbase_identifier->replace_record($record, $record_number);
|
||||
}
|
||||
|
||||
function dbase_get_record($dbase_identifier, $record_number)
|
||||
{
|
||||
return $dbase_identifier->get_record($record_number);
|
||||
}
|
||||
|
||||
function dbase_get_record_with_names($dbase_identifier, $record_number)
|
||||
{
|
||||
return $dbase_identifier->get_record_with_names($record_number);
|
||||
}
|
||||
|
||||
function dbase_pack($dbase_identifier)
|
||||
{
|
||||
return $dbase_identifier->pack();
|
||||
}
|
||||
}
|
||||
@ -23,10 +23,14 @@
|
||||
* \brief Script example to inject random customer invoices (for load tests)
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "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;
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,14 @@
|
||||
* \brief Script example to inject random orders (for load tests)
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,14 @@
|
||||
* \brief Script example to inject random products (for load tests)
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,14 @@
|
||||
* \brief Script example to inject random proposals (for load tests)
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -24,10 +24,14 @@
|
||||
* \brief Script example to inject random thirdparties (for load tests)
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/initdata/import-thirdparties.php
|
||||
* \file dev/initdata/import-users.php
|
||||
* \brief Script example to insert thirdparties from a csv file.
|
||||
* To purge data, you can have a look at purge-data.php
|
||||
*/
|
||||
@ -30,7 +30,7 @@ $sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!ELEMENT ruleset (description,exclude-pattern*,rule+)>
|
||||
<!ELEMENT ruleset (description,arg*,exclude-pattern*,rule+)>
|
||||
<!ATTLIST ruleset name CDATA "">
|
||||
<!ELEMENT description (#PCDATA)>
|
||||
<!ELEMENT arg (#PCDATA)>
|
||||
<!ATTLIST arg name CDATA "">
|
||||
<!ATTLIST arg value CDATA "">
|
||||
<!ELEMENT exclude-pattern (#PCDATA)>
|
||||
<!ATTLIST exclude-pattern type CDATA "">
|
||||
<!ELEMENT rule (properties*,severity*)>
|
||||
<!ELEMENT rule (properties*,severity*,exclude*)>
|
||||
<!ATTLIST rule ref CDATA "">
|
||||
<!ELEMENT properties (property+)>
|
||||
<!ELEMENT property (#PCDATA)>
|
||||
<!ATTLIST property name CDATA "">
|
||||
<!ATTLIST property value CDATA "">
|
||||
<!ELEMENT severity (#PCDATA)>
|
||||
<!ELEMENT exclude (#PCDATA)>
|
||||
<!ATTLIST exclude name CDATA "">
|
||||
|
||||
@ -2,10 +2,12 @@
|
||||
<!DOCTYPE ruleset SYSTEM "ruleset.dtd">
|
||||
<ruleset name="Dolibarr">
|
||||
<description>Dolibarr coding standard.</description>
|
||||
<arg name="tab-width" value="4"/>
|
||||
|
||||
<exclude-pattern type="relative">build/html</exclude-pattern>
|
||||
<exclude-pattern type="relative">build/aps</exclude-pattern>
|
||||
<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">htdocs/core/class/lessc.class.php</exclude-pattern>
|
||||
<exclude-pattern type="relative">htdocs/custom</exclude-pattern>
|
||||
@ -187,7 +189,6 @@
|
||||
<!-- Disabled as this does not support tab -->
|
||||
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
|
||||
|
||||
<arg name="tab-width" value="4"/>
|
||||
<rule ref="Generic.WhiteSpace.ScopeIndent">
|
||||
<properties>
|
||||
<property name="indent" value="4"/>
|
||||
|
||||
578
dev/tools/dolibarr-postgres2mysql.php
Normal file
578
dev/tools/dolibarr-postgres2mysql.php
Normal file
@ -0,0 +1,578 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2005-2011 James Grant <james@lightbox.org> Lightbox Technologies Inc.
|
||||
* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This file is base on pg2mysql provided as Open source by lightbox.org.
|
||||
* It was enhanced and updated by the Dolibarr team.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file dev/tools/dolibarr-postgres2mysql.php
|
||||
* \brief Script to migrate a postgresql dump into a mysql dump
|
||||
*/
|
||||
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path = dirname(__FILE__) . '/';
|
||||
|
||||
// Test si mode batch
|
||||
$sapi_type = php_sapi_name();
|
||||
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||
echo "Error: You are using PHP for CGI. To execute " . $script_file . " from command line, you must use PHP for CLI mode.\n";
|
||||
exit();
|
||||
}
|
||||
|
||||
error_reporting(E_ALL & ~ E_DEPRECATED);
|
||||
define('PRODUCT', "pg2mysql");
|
||||
define('VERSION', "2.0");
|
||||
|
||||
// this is the default, it can be overridden here, or specified as the third parameter on the command line
|
||||
$config['engine'] = "InnoDB";
|
||||
|
||||
if (! ($argv[1] && $argv[2])) {
|
||||
echo "Usage: php pg2mysql_cli.php <inputfilename> <outputfilename> [engine]\n";
|
||||
exit();
|
||||
} else {
|
||||
if (isset($argv[3]))
|
||||
$config['engine'] = $argv[3];
|
||||
pg2mysql_large($argv[1], $argv[2]);
|
||||
|
||||
echo <<<XHTML
|
||||
Notes:
|
||||
- No its not perfect
|
||||
- Yes it discards ALL stored procedures
|
||||
- Yes it discards ALL queries except for CREATE TABLE and INSERT INTO
|
||||
- If you're having problems creating your postgres dump, make sure you use "--format p --inserts"
|
||||
- Default output engine if not specified is InnoDB
|
||||
|
||||
XHTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* getfieldname
|
||||
*
|
||||
* @param string $l String
|
||||
* @return string|null Field name
|
||||
*/
|
||||
function getfieldname($l)
|
||||
{
|
||||
// first check if its in nice quotes for us
|
||||
$regs = array();
|
||||
if (preg_match("/`(.*)`/", $l, $regs)) {
|
||||
if ($regs[1])
|
||||
return $regs[1];
|
||||
else
|
||||
return null;
|
||||
} // if its not in quotes, then it should (we hope!) be the first "word" on the line, up to the first space.
|
||||
elseif (preg_match("/([^\ ]*)/", trim($l), $regs)) {
|
||||
if ($regs[1])
|
||||
return $regs[1];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* formatsize
|
||||
*
|
||||
* @param string $s Size to format
|
||||
* @return string Formated size
|
||||
*/
|
||||
function formatsize($s)
|
||||
{
|
||||
if ($s < pow(2, 14))
|
||||
return "{$s}B";
|
||||
elseif ($s < pow(2, 20))
|
||||
return sprintf("%.1f", round($s / 1024, 1)) . "K";
|
||||
elseif ($s < pow(2, 30))
|
||||
return sprintf("%.1f", round($s / 1024 / 1024, 1)) . "M";
|
||||
else
|
||||
return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G";
|
||||
}
|
||||
|
||||
/**
|
||||
* pg2mysql_large
|
||||
*
|
||||
* @param string $infilename Input filename
|
||||
* @param string $outfilename Output filename
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function pg2mysql_large($infilename, $outfilename)
|
||||
{
|
||||
$infp = fopen($infilename, "rt");
|
||||
$outfp = fopen($outfilename, "wt");
|
||||
|
||||
$outputatend = '';
|
||||
$arrayofprimaryalreadyintabledef = array();
|
||||
|
||||
// we read until we get a semicolon followed by a newline (;\n);
|
||||
$pgsqlchunk = array();
|
||||
$chunkcount = 1;
|
||||
$linenum = 0;
|
||||
$inquotes = false;
|
||||
$first = true;
|
||||
|
||||
if (empty($infp)) {
|
||||
print 'Failed to open file '.$infilename."\n";
|
||||
return -1;
|
||||
}
|
||||
|
||||
$fs = filesize($infilename);
|
||||
echo "Filesize: " . formatsize($fs) . "\n";
|
||||
|
||||
while ($instr = fgets($infp)) {
|
||||
$linenum ++;
|
||||
$memusage = round(memory_get_usage(true) / 1024 / 1024);
|
||||
$len = strlen($instr);
|
||||
$pgsqlchunk[] = $instr;
|
||||
$c = substr_count($instr, "'");
|
||||
// we have an odd number of ' marks
|
||||
if ($c % 2 != 0) {
|
||||
if ($inquotes)
|
||||
$inquotes = false;
|
||||
else
|
||||
$inquotes = true;
|
||||
}
|
||||
|
||||
if ($linenum % 10000 == 0) {
|
||||
$currentpos = ftell($infp);
|
||||
$percent = round($currentpos / $fs * 100);
|
||||
$position = formatsize($currentpos);
|
||||
printf("Reading progress: %3d%% position: %7s line: %9d sql chunk: %9d mem usage: %4dM\r", $percent, $position, $linenum, $chunkcount, $memusage);
|
||||
}
|
||||
|
||||
if (strlen($instr) > 3 && ($instr[$len - 3] == ")" && $instr[$len - 2] == ";" && $instr[$len - 1] == "\n") && $inquotes == false) {
|
||||
$chunkcount ++;
|
||||
|
||||
if ($linenum % 10000 == 0) {
|
||||
$currentpos = ftell($infp);
|
||||
$percent = round($currentpos / $fs * 100);
|
||||
$position = formatsize($currentpos);
|
||||
printf("Processing progress: %3d%% position: %7s line: %9d sql chunk: %9d mem usage: %4dM\r", $percent, $position, $linenum, $chunkcount, $memusage);
|
||||
}
|
||||
/*
|
||||
* echo "sending chunk:\n";
|
||||
* echo "=======================\n";
|
||||
* print_r($pgsqlchunk);
|
||||
* echo "=======================\n";
|
||||
*/
|
||||
|
||||
/*
|
||||
* foreach ($pgsqlchunk as $aaa) {
|
||||
* if (preg_match('/MAIN_ENABLE_DEFAULT|MAIN_MAIL_SMTP_SE/', $aaa)) {
|
||||
* var_dump($pgsqlchunk);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
|
||||
$mysqlchunk = pg2mysql($pgsqlchunk, $arrayofprimaryalreadyintabledef, $first);
|
||||
fputs($outfp, $mysqlchunk['output']);
|
||||
|
||||
/*
|
||||
* $break = false;
|
||||
* foreach ($pgsqlchunk as $aaa) {
|
||||
* if (preg_match('/MAIN_ENABLE_DEFAULT|MAIN_MAIL_SMTP_SE/', $aaa)) {
|
||||
* var_dump($mysqlchunk);
|
||||
* }
|
||||
* if (preg_match('/MAIN_MAIL_SMTP_SE/', $aaa)) {
|
||||
* $break = true;
|
||||
* }
|
||||
* }
|
||||
* if ($break) break;
|
||||
*/
|
||||
|
||||
$outputatend .= $mysqlchunk['outputatend'];
|
||||
|
||||
$first = false;
|
||||
$pgsqlchunk = array();
|
||||
$mysqlchunk = "";
|
||||
}
|
||||
}
|
||||
echo "\n\n";
|
||||
|
||||
fputs($outfp, $outputatend);
|
||||
|
||||
fputs($outfp, "\n");
|
||||
|
||||
fputs($outfp, '/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;' . "\n");
|
||||
fputs($outfp, '/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;' . "\n");
|
||||
fputs($outfp, '/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;' . "\n");
|
||||
fputs($outfp, '/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;' . "\n");
|
||||
fputs($outfp, '/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;' . "\n");
|
||||
fputs($outfp, '/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;' . "\n");
|
||||
fputs($outfp, '/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;' . "\n");
|
||||
|
||||
printf("Completed! %9d lines %9d sql chunks\n\n", $linenum, $chunkcount);
|
||||
|
||||
fclose($infp);
|
||||
fclose($outfp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* pg2mysql
|
||||
*
|
||||
* @param array $input Array of input
|
||||
* @param array $arrayofprimaryalreadyintabledef Array of table already output with a primary key set into definition
|
||||
* @param boolean $header Boolean
|
||||
* @return string[] Array of output
|
||||
*/
|
||||
function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (is_array($input)) {
|
||||
$lines = $input;
|
||||
} else {
|
||||
$lines = split("\n", $input);
|
||||
}
|
||||
|
||||
if ($header) {
|
||||
$output = "-- Converted with " . PRODUCT . "-" . VERSION . "\n";
|
||||
$output .= "-- Converted on " . date("r") . "\n";
|
||||
$output .= "\n";
|
||||
|
||||
$output .= "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n";
|
||||
$output .= "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n";
|
||||
$output .= "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n";
|
||||
$output .= "/*!40101 SET NAMES utf8 */;\n";
|
||||
$output .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n";
|
||||
$output .= "/*!40103 SET TIME_ZONE='+00:00' */;\n";
|
||||
$output .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n";
|
||||
$output .= "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n";
|
||||
$output .= "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n";
|
||||
$output .= "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n";
|
||||
$output .= "\n";
|
||||
|
||||
$outputatend = "";
|
||||
} else {
|
||||
$output = "";
|
||||
$outputatend = "";
|
||||
}
|
||||
|
||||
$in_create_table = $in_insert = false;
|
||||
|
||||
$linenumber = 0;
|
||||
$tbl_extra = "";
|
||||
while (isset($lines[$linenumber])) {
|
||||
$line = $lines[$linenumber];
|
||||
// $line =str_replace('ALTER TABLE public\.', '', $line);
|
||||
|
||||
$reg = array();
|
||||
if (preg_match('/CREATE SEQUENCE (?:public\.)(.*)_(id|rowid|id_comment)_seq/', $line, $reg)) {
|
||||
$outputatend .= '-- Make field ' . $reg[2] . ' auto_increment for table ' . $reg[1] . "\n";
|
||||
$outputatend .= 'ALTER TABLE ' . $reg[1] . ' CHANGE COLUMN ' . $reg[2] . ' ' . $reg[2] . ' INTEGER NOT NULL AUTO_INCREMENT;' . "\n\n";
|
||||
// var_dump($outputatend);
|
||||
}
|
||||
|
||||
if (substr($line, 0, 12) == "CREATE TABLE") {
|
||||
$in_create_table = true;
|
||||
$line = str_replace("\"", "`", $line);
|
||||
$line = str_replace('public.', '', $line);
|
||||
|
||||
$reg2 = array();
|
||||
if (preg_match('/CREATE TABLE ([^\s]+)/', $line, $reg2)) {
|
||||
$in_create_table = $reg2[1];
|
||||
}
|
||||
|
||||
$reg2 = array();
|
||||
if (preg_match('/CREATE TABLE ([^\s]+)/', $line, $reg2)) {
|
||||
$output .= 'DROP TABLE IF EXISTS `' . $reg2[1] . '`;' . "\n";
|
||||
}
|
||||
$output .= $line;
|
||||
$linenumber ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (substr($line, 0, 2) == ");" && $in_create_table) {
|
||||
$in_create_table = false;
|
||||
$line = ") ENGINE={$config['engine']};\n\n";
|
||||
|
||||
$output .= $tbl_extra;
|
||||
$output .= $line;
|
||||
|
||||
$linenumber ++;
|
||||
$tbl_extra = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($in_create_table) {
|
||||
$regs = array();
|
||||
$line = str_replace("\"", "`", $line);
|
||||
$line = str_replace(" integer", " int(11)", $line);
|
||||
$line = str_replace(" int_unsigned", " int(11) UNSIGNED", $line);
|
||||
$line = str_replace(" smallint_unsigned", " smallint UNSIGNED", $line);
|
||||
$line = str_replace(" bigint_unsigned", " bigint UNSIGNED", $line);
|
||||
$line = str_replace(" serial ", " int(11) auto_increment ", $line);
|
||||
$line = str_replace(" bytea", " BLOB", $line);
|
||||
$line = str_replace(" boolean", " bool", $line);
|
||||
$line = str_replace(" bool DEFAULT true", " bool DEFAULT 1", $line);
|
||||
$line = str_replace(" bool DEFAULT false", " bool DEFAULT 0", $line);
|
||||
if (preg_match("/ character varying\(([0-9]*)\)/", $line, $regs)) {
|
||||
$num = $regs[1];
|
||||
if ($num <= 255)
|
||||
$line = preg_replace("/ character varying\([0-9]*\)/", " varchar($num)", $line);
|
||||
else
|
||||
$line = preg_replace("/ character varying\([0-9]*\)/", " text", $line);
|
||||
}
|
||||
// character varying with no size, we will default to varchar(255)
|
||||
if (preg_match("/ character varying/", $line)) {
|
||||
$line = preg_replace("/ character varying/", " varchar(255)", $line);
|
||||
}
|
||||
|
||||
if (preg_match("/ DEFAULT \('([0-9]*)'::int/", $line, $regs) || preg_match("/ DEFAULT \('([0-9]*)'::smallint/", $line, $regs) || preg_match("/ DEFAULT \('([0-9]*)'::bigint/", $line, $regs)) {
|
||||
$num = $regs[1];
|
||||
$line = preg_replace("/ DEFAULT \('([0-9]*)'[^ ,]*/", " DEFAULT $num ", $line);
|
||||
}
|
||||
if (preg_match("/ DEFAULT \(([0-9\-]*)\)/", $line, $regs)) {
|
||||
$num = $regs[1];
|
||||
$line = preg_replace("/ DEFAULT \(([0-9\-]*)\)/", " DEFAULT $num ", $line);
|
||||
}
|
||||
$line = preg_replace("/ DEFAULT nextval\(.*\) /", " auto_increment ", $line);
|
||||
$line = preg_replace("/::.*,/", ",", $line);
|
||||
$line = preg_replace("/::.*$/", "\n", $line);
|
||||
if (preg_match("/character\(([0-9]*)\)/", $line, $regs)) {
|
||||
$num = $regs[1];
|
||||
if ($num <= 255)
|
||||
$line = preg_replace("/ character\([0-9]*\)/", " varchar($num)", $line);
|
||||
else
|
||||
$line = preg_replace("/ character\([0-9]*\)/", " text", $line);
|
||||
}
|
||||
// timestamps
|
||||
$line = str_replace(" timestamp with time zone", " datetime", $line);
|
||||
$line = str_replace(" timestamp without time zone", " datetime", $line);
|
||||
|
||||
// time
|
||||
$line = str_replace(" time with time zone", " time", $line);
|
||||
$line = str_replace(" time without time zone", " time", $line);
|
||||
|
||||
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||
|
||||
if (strstr($line, "auto_increment") || preg_match('/ rowid int/', $line) || preg_match('/ id int/', $line)) {
|
||||
$field = getfieldname($line);
|
||||
$tbl_extra .= ", PRIMARY KEY(`$field`)\n";
|
||||
$arrayofprimaryalreadyintabledef[$in_create_table] = $in_create_table;
|
||||
}
|
||||
|
||||
$specialfields = array("repeat","status","type","call");
|
||||
|
||||
$field = getfieldname($line);
|
||||
if (in_array($field, $specialfields)) {
|
||||
$line = str_replace("$field ", "`$field` ", $line);
|
||||
}
|
||||
|
||||
// text/blob fields are not allowed to have a default, so if we find a text DEFAULT, change it to varchar(255) DEFAULT
|
||||
if (strstr($line, "text DEFAULT")) {
|
||||
$line = str_replace(" text DEFAULT ", " varchar(255) DEFAULT ", $line);
|
||||
}
|
||||
|
||||
// just skip a CONSTRAINT line
|
||||
if (strstr($line, " CONSTRAINT ")) {
|
||||
$line = "";
|
||||
// and if the previous output ended with a , remove the ,
|
||||
$lastchr = substr($output, - 2, 1);
|
||||
// echo "lastchr=$lastchr";
|
||||
if ($lastchr == ",") {
|
||||
$output = substr($output, 0, - 2) . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
$output .= $line;
|
||||
}
|
||||
|
||||
if (substr($line, 0, 11) == "INSERT INTO") {
|
||||
$line = str_replace('public.', '', $line);
|
||||
|
||||
if (substr($line, - 3, - 1) == ");") {
|
||||
// we have a complete insert on one line
|
||||
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||
|
||||
$before = str_replace("\"", "`", $before);
|
||||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string'), but could also be (number, E'string'); so we cant search for the previoous '
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||
$after = str_replace(" (E'", " ('", $after);
|
||||
$after = str_replace(", E'", ", '", $after);
|
||||
|
||||
$output .= $before . " VALUES " . $after;
|
||||
$linenumber ++;
|
||||
continue;
|
||||
} else {
|
||||
// this insert spans multiple lines, so keep dumping the lines until we reach a line
|
||||
// that ends with ");"
|
||||
|
||||
list ($before, $after) = explode(" VALUES ", $line, 2);
|
||||
// we only replace the " with ` in what comes BEFORE the VALUES
|
||||
// (ie, field names, like INSERT INTO table ("bla","bla2") VALUES ('s:4:"test"','bladata2');
|
||||
// should convert to INSERT INTO table (`bla`,`bla2`) VALUES ('s:4:"test"','bladata2');
|
||||
|
||||
$before = str_replace("\"", "`", $before);
|
||||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||
$after = str_replace(" (E'", " ('", $after);
|
||||
$after = str_replace(", E'", ", '", $after);
|
||||
|
||||
$c = substr_count($line, "'");
|
||||
// we have an odd number of ' marks
|
||||
if ($c % 2 != 0) {
|
||||
$inquotes = true;
|
||||
} else {
|
||||
$inquotes = false;
|
||||
}
|
||||
|
||||
$output .= $before . " VALUES " . $after;
|
||||
do {
|
||||
$linenumber ++;
|
||||
|
||||
// in after, we need to watch out for escape format strings, ie (E'escaped \r in a string'), and ('bla',E'escaped \r in a string')
|
||||
// ugh i guess its possible these strings could exist IN the data as well, but the only way to solve that is to process these lines one character
|
||||
// at a time, and thats just stupid, so lets just hope this doesnt appear anywhere in the actual data
|
||||
|
||||
// after the first line, we only need to check for it in the middle, not at the beginning of an insert (becuase the beginning will be on the first line)
|
||||
// $after=str_replace(" (E'","' ('",$after);
|
||||
$line = $lines[$linenumber];
|
||||
$line = str_replace("', E'", "', '", $line);
|
||||
$output .= $line;
|
||||
|
||||
// printf("inquotes: %d linenumber: %4d line: %s\n",$inquotes,$linenumber,$lines[$linenumber]);
|
||||
|
||||
$c = substr_count($line, "'");
|
||||
// we have an odd number of ' marks
|
||||
if ($c % 2 != 0) {
|
||||
if ($inquotes)
|
||||
$inquotes = false;
|
||||
else
|
||||
$inquotes = true;
|
||||
// echo "inquotes=$inquotes\n";
|
||||
}
|
||||
} while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes);
|
||||
}
|
||||
}
|
||||
if (substr($line, 0, 16) == "ALTER TABLE ONLY") {
|
||||
$line = preg_replace('/ ONLY/', '', $line);
|
||||
$line = str_replace("\"", "`", $line);
|
||||
$line = str_replace("public.", "", $line);
|
||||
$pkey = $line;
|
||||
|
||||
$linenumber ++;
|
||||
if (! empty($lines[$linenumber])) {
|
||||
$line = $lines[$linenumber];
|
||||
} else {
|
||||
$line = '';
|
||||
}
|
||||
|
||||
if (strstr($line, " PRIMARY KEY ") && substr($line, - 3, - 1) == ");") {
|
||||
$reg2 = array();
|
||||
if (preg_match('/ALTER TABLE ([^\s]+)/', $pkey, $reg2)) {
|
||||
if (empty($arrayofprimaryalreadyintabledef[$reg2[1]])) {
|
||||
// looks like we have a single line PRIMARY KEY definition, lets go ahead and add it
|
||||
$output .= str_replace("\n", "", $pkey);
|
||||
// the postgres and mysql syntax for this is (at least, in the example im looking at)
|
||||
// identical, so we can just add it as is.
|
||||
$output .= $line . "\n";
|
||||
} else {
|
||||
$output .= '-- ' . str_replace("\n", "", $pkey);
|
||||
$output .= '-- ' . $line . "\n";
|
||||
}
|
||||
} else {
|
||||
$output .= '-- ' . str_replace("\n", "", $pkey);
|
||||
$output .= '-- ' . $line . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// while we're here, we might as well catch CREATE INDEX as well
|
||||
if (substr($line, 0, 12) == "CREATE INDEX") {
|
||||
$matches = array();
|
||||
preg_match('/CREATE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
|
||||
if (! empty($matches[3])) {
|
||||
$indexname = $matches[1];
|
||||
$tablename = str_replace('public.', '', $matches[2]);
|
||||
$columns = $matches[3];
|
||||
if ($tablename && $columns) {
|
||||
$output .= "ALTER TABLE `" . $tablename . "` ADD INDEX " . $indexname . "( {$columns} ) ;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (substr($line, 0, 19) == "CREATE UNIQUE INDEX") {
|
||||
$matches = array();
|
||||
preg_match('/CREATE UNIQUE INDEX "?([a-zA-Z0-9_]*)"? ON "?([a-zA-Z0-9_\.]*)"? USING btree \((.*)\);/', $line, $matches);
|
||||
if (! empty($matches[3])) {
|
||||
$indexname = $matches[1];
|
||||
$tablename = str_replace('public.', '', $matches[2]);
|
||||
$columns = str_replace('"', '', $matches[3]);
|
||||
if ($tablename && $columns) {
|
||||
$output .= "ALTER TABLE `" . $tablename . "` ADD UNIQUE INDEX " . $indexname . " ( {$columns} ) ;\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (substr($line, 0, 13) == 'DROP DATABASE')
|
||||
$output .= $line;
|
||||
|
||||
if (substr($line, 0, 15) == 'CREATE DATABASE') {
|
||||
$matches = array();
|
||||
preg_match('/CREATE DATABASE ([a-zA-Z0-9_]*) .* ENCODING = \'(.*)\'/', $line, $matches);
|
||||
$output .= "CREATE DATABASE `$matches[1]` DEFAULT CHARACTER SET $matches[2];\n\n";
|
||||
}
|
||||
|
||||
if (substr($line, 0, 8) == '\\connect') {
|
||||
$matches = array();
|
||||
preg_match('/connect ([a-zA-Z0-9_]*)/', $line, $matches);
|
||||
$output .= "USE `$matches[1]`;\n\n";
|
||||
}
|
||||
|
||||
if (substr($line, 0, 5) == 'COPY ') {
|
||||
$matches = array();
|
||||
preg_match('/COPY (.*) FROM stdin/', $line, $matches);
|
||||
$heads = str_replace('"', "`", $matches[1]);
|
||||
$values = array();
|
||||
$in_insert = true;
|
||||
} elseif ($in_insert) {
|
||||
if ($line == "\\.\n") {
|
||||
$in_insert = false;
|
||||
if ($values) {
|
||||
$output .= "INSERT INTO $heads VALUES\n" . implode(",\n", $values) . ";\n\n";
|
||||
}
|
||||
} else {
|
||||
$vals = explode(' ', $line);
|
||||
foreach ($vals as $i => $val) {
|
||||
$vals[$i] = ($val == '\\N') ? 'NULL' : "'" . str_replace("'", "\\'", trim($val)) . "'";
|
||||
}
|
||||
$values[] = '(' . implode(',', $vals) . ')';
|
||||
if (count($values) >= 1000) {
|
||||
$output .= "INSERT INTO $heads VALUES\n" . implode(",\n", $values) . ";\n";
|
||||
$values = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$linenumber ++;
|
||||
}
|
||||
|
||||
return array('output' => $output,'outputatend' => $outputatend);
|
||||
}
|
||||
@ -54,3 +54,5 @@ fi
|
||||
|
||||
echo Think to launch also:
|
||||
echo "> dev/tools/fixaltlanguages.sh fix all"
|
||||
echo "For v11: Replace also regex \(.*(sponge|cornas|eratosthene|cyan).*\) with ''"
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 357 KiB After Width: | Height: | Size: 281 KiB |
@ -49,10 +49,10 @@ $search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
||||
if (!$user->rights->accounting->chartofaccount) accessforbidden();
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
@ -211,7 +211,7 @@ if (strlen(trim($search_account))) {
|
||||
$search_account_tmp = $search_account;
|
||||
$weremovedsomezero = 0;
|
||||
if (strlen($search_account_tmp) <= $lengthpaddingaccount) {
|
||||
for($i = 0; $i < $lengthpaddingaccount; $i++) {
|
||||
for ($i = 0; $i < $lengthpaddingaccount; $i++) {
|
||||
if (preg_match('/0$/', $search_account_tmp)) {
|
||||
$weremovedsomezero++;
|
||||
$search_account_tmp = preg_replace('/0$/', '', $search_account_tmp);
|
||||
@ -238,6 +238,7 @@ if (strlen(trim($search_account))) {
|
||||
}
|
||||
}
|
||||
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_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype);
|
||||
if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype);
|
||||
@ -270,12 +271,17 @@ if ($resql)
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($search_account) $param .= '&search_account='.urlencode($search_account);
|
||||
if ($search_label) $param .= '&search_label='.urlencode($search_label);
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
if ($search_labelshort) $param.= '&search_labelshort='.urlencode($search_labelshort);
|
||||
if ($search_accountparent) $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
=======
|
||||
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
>>>>>>> upstream/11.0
|
||||
=======
|
||||
if ($search_labelshort) $param .= '&search_labelshort='.urlencode($search_labelshort);
|
||||
if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent);
|
||||
>>>>>>> upstream/develop
|
||||
if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype);
|
||||
if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype);
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
@ -359,18 +365,25 @@ if ($resql)
|
||||
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.label']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="'.$search_label.'"></td>';
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
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'])) print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_accountparent" value="'.$search_accountparent.'"></td>';
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
=======
|
||||
=======
|
||||
if (!empty($arrayfields['aa.labelshort']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_labelshort" value="'.$search_labelshort.'"></td>';
|
||||
>>>>>>> upstream/develop
|
||||
if (!empty($arrayfields['aa.account_parent']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print $formaccounting->select_account($search_accountparent, 'search_accountparent', 2);
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['aa.pcg_type']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgtype" value="'.$search_pcgtype.'"></td>';
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> upstream/11.0
|
||||
=======
|
||||
>>>>>>> upstream/develop
|
||||
if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print '<td class="liste_titre"><input type="text" class="flat" size="6" name="search_pcgsubtype" value="'.$search_pcgsubtype.'"></td>';
|
||||
if (!empty($arrayfields['aa.active']['checked'])) print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
@ -424,12 +437,12 @@ if ($resql)
|
||||
}
|
||||
|
||||
// Account label to show (label short)
|
||||
if (! empty($arrayfields['aa.labelshort']['checked']))
|
||||
if (!empty($arrayfields['aa.labelshort']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->labelshort;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account parent
|
||||
|
||||
@ -39,31 +39,31 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("errors","admin","companies","resource","holiday","compta","accountancy","hrm"));
|
||||
$langs->loadLangs(array("errors", "admin", "companies", "resource", "holiday", "compta", "accountancy", "hrm"));
|
||||
|
||||
$action=GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view';
|
||||
$confirm=GETPOST('confirm', 'alpha');
|
||||
$id=31;
|
||||
$rowid=GETPOST('rowid', 'alpha');
|
||||
$code=GETPOST('code', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = 31;
|
||||
$rowid = GETPOST('rowid', 'alpha');
|
||||
$code = GETPOST('code', 'alpha');
|
||||
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$actl[1] = img_picto($langs->trans("Activated"), 'switch_on');
|
||||
|
||||
$listoffset=GETPOST('listoffset', 'alpha');
|
||||
$listlimit=GETPOST('listlimit', 'int')>0?GETPOST('listlimit', 'int'):1000;
|
||||
$listoffset = GETPOST('listoffset', 'alpha');
|
||||
$listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000;
|
||||
$active = 1;
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'aZ09comma');
|
||||
$sortorder = GETPOST("sortorder", 'aZ09comma');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $listlimit * $page ;
|
||||
$offset = $listlimit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
@ -72,7 +72,7 @@ $search_country_id = GETPOST('search_country_id', 'int');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) accessforbidden();
|
||||
if (! $user->rights->accounting->chartofaccount) accessforbidden();
|
||||
if (!$user->rights->accounting->chartofaccount) accessforbidden();
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
@ -82,56 +82,56 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
$tabname = array();
|
||||
|
||||
$tabname[31]= MAIN_DB_PREFIX."accounting_system";
|
||||
$tabname[31] = MAIN_DB_PREFIX."accounting_system";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
$tablib[31]= "Pcg_version";
|
||||
$tablib = array();
|
||||
$tablib[31] = "Pcg_version";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
|
||||
$tabsql = array();
|
||||
$tabsql[31] = "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[31]="pcg_version ASC";
|
||||
$tabsqlsort = array();
|
||||
$tabsqlsort[31] = "pcg_version ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[31]= "pcg_version,label,country_id,country";
|
||||
$tabfield = array();
|
||||
$tabfield[31] = "pcg_version,label,country_id,country";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[31]= "pcg_version,label,country";
|
||||
$tabfieldvalue = array();
|
||||
$tabfieldvalue[31] = "pcg_version,label,country";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[31]= "pcg_version,label,fk_country";
|
||||
$tabfieldinsert = array();
|
||||
$tabfieldinsert[31] = "pcg_version,label,fk_country";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
// "nameoffield" if id field is not "rowid" or has not autoincrement on
|
||||
$tabrowid=array();
|
||||
$tabrowid[31]= "";
|
||||
$tabrowid = array();
|
||||
$tabrowid[31] = "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
$tabcond[31]= ! empty($conf->accounting->enabled);
|
||||
$tabcond = array();
|
||||
$tabcond[31] = !empty($conf->accounting->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
$tabhelp = array();
|
||||
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
$tabfieldcheck = array();
|
||||
$tabfieldcheck[31] = array();
|
||||
|
||||
|
||||
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
|
||||
$elementList = array();
|
||||
$sourceList=array();
|
||||
$sourceList = array();
|
||||
|
||||
|
||||
|
||||
@ -147,38 +147,38 @@ if (GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x',
|
||||
// Actions add or modify an entry into a dictionary
|
||||
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
$listfield=explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||
$listfieldinsert=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify=explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue=explode(',', $tabfieldvalue[$id]);
|
||||
$listfield = explode(',', str_replace(' ', '', $tabfield[$id]));
|
||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
|
||||
|
||||
// Check that all fields are filled
|
||||
$ok=1;
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]==''))
|
||||
if ($value == 'country_id' && in_array($tablib[$id], array('Pcg_version'))) continue; // For some pages, country is not mandatory
|
||||
if ((!GETPOSTISSET($value)) || GETPOST($value) == '')
|
||||
{
|
||||
$ok=0;
|
||||
$fieldnamekey=$listfield[$f];
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
// We take translate key of field
|
||||
|
||||
if ($fieldnamekey == 'pcg_version') $fieldnamekey='Pcg_version';
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
|
||||
if ($fieldnamekey == 'pcg_version') $fieldnamekey = 'Pcg_version';
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey = 'Label';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
// Other checks
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && isset($_POST["type"]) && in_array($_POST["type"], array('system','systemauto'))) {
|
||||
$ok=0;
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_actioncomm" && GETPOSTISSET("type") && in_array($_POST["type"], array('system', 'systemauto'))) {
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||
}
|
||||
if (isset($_POST["pcg_version"]))
|
||||
if (GETPOSTISSET("pcg_version"))
|
||||
{
|
||||
if ($_POST["pcg_version"]=='0')
|
||||
if (GETPOST("pcg_version") == '0')
|
||||
{
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
}
|
||||
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
|
||||
@ -187,9 +187,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"]=='0') && ($id != 2))
|
||||
if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2))
|
||||
{
|
||||
$ok=0;
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
|
||||
}
|
||||
|
||||
@ -199,13 +199,13 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($tabrowid[$id])
|
||||
{
|
||||
// Recupere id libre pour insertion
|
||||
$newid=0;
|
||||
$newid = 0;
|
||||
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$newid=($obj->newid + 1);
|
||||
$newid = ($obj->newid + 1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
@ -214,16 +214,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
// Add new entry
|
||||
$sql = "INSERT INTO ".$tabname[$id]." (";
|
||||
// List of fields
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql.= $tabrowid[$id].",";
|
||||
$sql.= $tabfieldinsert[$id];
|
||||
$sql.=",active)";
|
||||
$sql.= " VALUES(";
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $tabrowid[$id].",";
|
||||
$sql .= $tabfieldinsert[$id];
|
||||
$sql .= ",active)";
|
||||
$sql .= " VALUES(";
|
||||
|
||||
// List of values
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql.= $newid.",";
|
||||
$i=0;
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldinsert))
|
||||
$sql .= $newid.",";
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
|
||||
@ -232,19 +232,19 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
elseif ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.=",1)";
|
||||
$sql .= ",1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -260,16 +260,16 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
// Modify entry
|
||||
$sql = "UPDATE ".$tabname[$id]." SET ";
|
||||
// Modifie valeur des champs
|
||||
if ($tabrowid[$id] && ! in_array($tabrowid[$id], $listfieldmodify))
|
||||
if ($tabrowid[$id] && !in_array($tabrowid[$id], $listfieldmodify))
|
||||
{
|
||||
$sql.= $tabrowid[$id]."=";
|
||||
$sql.= "'".$db->escape($rowid)."', ";
|
||||
$sql .= $tabrowid[$id]."=";
|
||||
$sql .= "'".$db->escape($rowid)."', ";
|
||||
}
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
@ -280,18 +280,18 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql.=",";
|
||||
$sql.= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
|
||||
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql)
|
||||
if (!$resql)
|
||||
{
|
||||
setEventMessages($db->error(), null, 'errors');
|
||||
}
|
||||
@ -306,14 +306,14 @@ if (GETPOST('actioncancel', 'alpha'))
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
|
||||
|
||||
dol_syslog("delete", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (! $result)
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
@ -329,8 +329,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
@ -349,8 +349,8 @@ if ($action == $acts[0])
|
||||
// disable
|
||||
if ($action == $acts[1])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
@ -369,8 +369,8 @@ if ($action == $acts[1])
|
||||
// favorite
|
||||
if ($action == 'activate_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
|
||||
@ -389,8 +389,8 @@ if ($action == 'activate_favorite')
|
||||
// disable favorite
|
||||
if ($action == 'disable_favorite')
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
|
||||
else { $rowidcol="rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; }
|
||||
else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
|
||||
@ -412,12 +412,12 @@ if ($action == 'disable_favorite')
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formadmin=new FormAdmin($db);
|
||||
$formadmin = new FormAdmin($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$titre=$langs->trans($tablib[$id]);
|
||||
$linkback='';
|
||||
$titre = $langs->trans($tablib[$id]);
|
||||
$linkback = '';
|
||||
|
||||
print load_fiche_titre($titre, $linkback, 'title_accountancy');
|
||||
|
||||
@ -425,7 +425,7 @@ print load_fiche_titre($titre, $linkback, 'title_accountancy');
|
||||
// Confirmation de la suppression de la ligne
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.urlencode($page).'&':'').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.urlencode($page).'&' : '').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@ -435,22 +435,22 @@ if ($action == 'delete')
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql=$tabsql[$id];
|
||||
$sql = $tabsql[$id];
|
||||
|
||||
if ($search_country_id > 0)
|
||||
{
|
||||
if (preg_match('/ WHERE /', $sql)) $sql.= " AND ";
|
||||
else $sql.=" WHERE ";
|
||||
$sql.= " c.rowid = ".$search_country_id;
|
||||
if (preg_match('/ WHERE /', $sql)) $sql .= " AND ";
|
||||
else $sql .= " WHERE ";
|
||||
$sql .= " c.rowid = ".$search_country_id;
|
||||
}
|
||||
|
||||
// If sort order is "country", we use country_code instead
|
||||
if ($sortfield == 'country') $sortfield='country_code';
|
||||
$sql.=$db->order($sortfield, $sortorder);
|
||||
$sql.=$db->plimit($listlimit+1, $offset);
|
||||
if ($sortfield == 'country') $sortfield = 'country_code';
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($listlimit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -461,10 +461,10 @@ if ($id)
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused=0;
|
||||
$var=false;
|
||||
$alabelisused = 0;
|
||||
$var = false;
|
||||
|
||||
$fieldlist=explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
// Line for title
|
||||
print '<tr class="liste_titre">';
|
||||
@ -472,33 +472,33 @@ if ($id)
|
||||
{
|
||||
// Determine le nom du champ par rapport aux noms possibles
|
||||
// dans les dictionnaires de donnees
|
||||
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class="left";
|
||||
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
$class = "left";
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label')
|
||||
{
|
||||
$valuetoshow=$langs->trans("Label");
|
||||
$valuetoshow = $langs->trans("Label");
|
||||
}
|
||||
if ($fieldlist[$field]=='country') {
|
||||
if ($fieldlist[$field] == 'country') {
|
||||
if (in_array('region_id', $fieldlist)) { print '<td> </td>'; continue; } // For region page, we do not show the country input
|
||||
$valuetoshow=$langs->trans("Country");
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
if ($fieldlist[$field]=='country_id') { $valuetoshow=''; }
|
||||
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
|
||||
if ($fieldlist[$field] == 'country_id') { $valuetoshow = ''; }
|
||||
if ($fieldlist[$field] == 'pcg_version' || $fieldlist[$field] == 'fk_pcg_version') { $valuetoshow = $langs->trans("Pcg_version"); }
|
||||
|
||||
if ($valuetoshow != '') {
|
||||
print '<td class="'.$class.'">';
|
||||
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
||||
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
||||
} elseif (! empty($tabhelp[$id][$value])) {
|
||||
} elseif (!empty($tabhelp[$id][$value])) {
|
||||
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else {
|
||||
print $valuetoshow;
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
@ -518,14 +518,14 @@ if ($id)
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val))
|
||||
$obj->$val=GETPOST($val);
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
@ -537,32 +537,32 @@ if ($id)
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan=count($fieldlist)+3;
|
||||
$colspan = count($fieldlist) + 3;
|
||||
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
print '<tr><td colspan="'.$colspan.'"> </td></tr>'; // Keep to have a line with enough height
|
||||
}
|
||||
|
||||
|
||||
|
||||
// List of available values in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '&id='.$id;
|
||||
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
|
||||
if ($search_country_id > 0) $param .= '&search_country_id='.$search_country_id;
|
||||
$paramwithsearch = $param;
|
||||
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
|
||||
if ($sortorder) $paramwithsearch .= '&sortorder='.$sortorder;
|
||||
if ($sortfield) $paramwithsearch .= '&sortfield='.$sortfield;
|
||||
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
print '<tr class="none"><td class="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -570,9 +570,9 @@ if ($id)
|
||||
print '<tr class="liste_titre liste_titre_add">';
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1; // By defaut
|
||||
$showfield = 1; // By defaut
|
||||
|
||||
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; }
|
||||
if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; }
|
||||
|
||||
if ($showfield)
|
||||
{
|
||||
@ -590,17 +590,17 @@ if ($id)
|
||||
}
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre right" colspan="2">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Title of lines
|
||||
print '<tr class="liste_titre">';
|
||||
print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, '');
|
||||
print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, '');
|
||||
print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, '');
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList($langs->trans("Pcg_version"), 0, $_SERVER["PHP_SELF"], "pcg_version", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
|
||||
print getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], "label", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
|
||||
print getTitleFieldOfList($langs->trans("Country"), 0, $_SERVER["PHP_SELF"], "country_code", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, '');
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center ');
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
@ -613,81 +613,81 @@ if ($id)
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code)))
|
||||
{
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
$tmpaction='edit';
|
||||
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldListAccountModel($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
|
||||
print '<td colspan="3" class="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$tmpaction = 'view';
|
||||
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield=1;
|
||||
$class="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
$showfield = 1;
|
||||
$class = "left";
|
||||
$valuetoshow = $obj->{$fieldlist[$field]};
|
||||
if ($value == 'type_template')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
if ($value == 'element')
|
||||
{
|
||||
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
|
||||
$valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
elseif ($value == 'source')
|
||||
{
|
||||
$valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow;
|
||||
$valuetoshow = isset($sourceList[$valuetoshow]) ? $sourceList[$valuetoshow] : $valuetoshow;
|
||||
}
|
||||
elseif ($valuetoshow=='all') {
|
||||
$valuetoshow=$langs->trans('All');
|
||||
elseif ($valuetoshow == 'all') {
|
||||
$valuetoshow = $langs->trans('All');
|
||||
}
|
||||
elseif ($fieldlist[$field]=='country') {
|
||||
elseif ($fieldlist[$field] == 'country') {
|
||||
if (empty($obj->country_code))
|
||||
{
|
||||
$valuetoshow='-';
|
||||
$valuetoshow = '-';
|
||||
}
|
||||
else
|
||||
{
|
||||
$key=$langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
$key = $langs->trans("Country".strtoupper($obj->country_code));
|
||||
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
|
||||
}
|
||||
}
|
||||
elseif ($fieldlist[$field]=='country_id') {
|
||||
$showfield=0;
|
||||
elseif ($fieldlist[$field] == 'country_id') {
|
||||
$showfield = 0;
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
||||
$class = 'tddict';
|
||||
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
|
||||
// Show value for field
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
|
||||
$iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
||||
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
if ($param) $url .= '&'.$param;
|
||||
$url.='&';
|
||||
$url .= '&';
|
||||
|
||||
// Active
|
||||
print '<td class="center nowrap">';
|
||||
@ -737,10 +737,10 @@ $db->close();
|
||||
*/
|
||||
function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
global $conf, $langs, $db;
|
||||
global $form;
|
||||
global $region_id;
|
||||
global $elementList,$sourceList;
|
||||
global $elementList, $sourceList;
|
||||
|
||||
$formadmin = new FormAdmin($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
@ -758,15 +758,15 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
||||
continue;
|
||||
} // For state page, we do not show the country input (we link to region, not country)
|
||||
print '<td>';
|
||||
$fieldname='country';
|
||||
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
$fieldname = 'country';
|
||||
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : '')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'country_id')
|
||||
{
|
||||
if (! in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
if (!in_array('country', $fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
|
||||
{
|
||||
$country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
|
||||
$country_id = (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0);
|
||||
print '<td>';
|
||||
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$country_id.'">';
|
||||
print '</td>';
|
||||
@ -776,24 +776,24 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
|
||||
if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
|
||||
else print '<td>';
|
||||
if ($fieldlist[$field] == 'type_cdr') {
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
|
||||
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''));
|
||||
} else {
|
||||
print $form->selectyesno($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1);
|
||||
print $form->selectyesno($fieldlist[$field], (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
|
||||
print '<td><input type="text" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size=''; $class='';
|
||||
if ($fieldlist[$field]=='code') $size='size="8" ';
|
||||
if ($fieldlist[$field]=='position') $size='size="4" ';
|
||||
if ($fieldlist[$field]=='libelle') $size='centpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
$size = ''; $class = '';
|
||||
if ($fieldlist[$field] == 'code') $size = 'size="8" ';
|
||||
if ($fieldlist[$field] == 'position') $size = 'size="4" ';
|
||||
if ($fieldlist[$field] == 'libelle') $size = 'centpercent';
|
||||
if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'sens' || $fieldlist[$field] == 'category_type') $size = 'size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat'.($class ? ' '.$class : '').'" value="'.(isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ($value == 'range_account' && empty($_POST['range_account'])) continue;
|
||||
if ($value == 'country' || $value == 'country_id') continue;
|
||||
if (!isset($_POST[$value]) || $_POST[$value] == '')
|
||||
if (!GETPOSTISSET($value) || GETPOST($value) == '')
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
|
||||
@ -165,9 +165,9 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
|
||||
}
|
||||
// Other checks
|
||||
if (isset($_POST["code"]))
|
||||
if (GETPOSTISSET("code"))
|
||||
{
|
||||
if ($_POST["code"] == '0')
|
||||
if (GETPOST("code") == '0')
|
||||
{
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
|
||||
@ -42,7 +42,6 @@ $page = GETPOST("page", 'int');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
if (GETPOST("exportcsv", 'alpha')) $action = 'export_csv';
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -99,10 +98,8 @@ if (empty($search_date_start) && !GETPOSTISSET('formfilteraction'))
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
}
|
||||
}
|
||||
if ($sortorder == "")
|
||||
$sortorder = "ASC";
|
||||
if ($sortfield == "")
|
||||
$sortfield = "t.numero_compte";
|
||||
if ($sortorder == "") $sortorder = "ASC";
|
||||
if ($sortfield == "") $sortfield = "t.numero_compte";
|
||||
|
||||
|
||||
$param = '';
|
||||
@ -198,12 +195,24 @@ if ($action != 'export_csv')
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="action" id="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
$button = '<input type="submit" name="exportcsv" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function() {
|
||||
jQuery("#exportcsvbutton").click(function() {
|
||||
event.preventDefault();
|
||||
console.log("Set action to export_csv");
|
||||
jQuery("#action").val("export_csv");
|
||||
jQuery("#searchFormList").submit();
|
||||
jQuery("#action").val("list");
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $button, $result, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
@ -228,7 +237,7 @@ if ($action != 'export_csv')
|
||||
print '<table class="liste '.($moreforfilter ? "listwithfilterbefore" : "").'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre" colspan="5">';
|
||||
print '<td class="liste_titre" colspan="6">';
|
||||
print $langs->trans('From');
|
||||
print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, '');
|
||||
print ' ';
|
||||
@ -245,6 +254,7 @@ if ($action != 'export_csv')
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre("Opening Balance", $_SERVER['PHP_SELF'], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
|
||||
@ -257,6 +267,16 @@ if ($action != 'export_csv')
|
||||
$sous_total_credit = 0;
|
||||
$displayed_account = "";
|
||||
|
||||
$sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity;
|
||||
$sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte";
|
||||
$resql = $db->query($sql);
|
||||
$nrows = $resql->num_rows;
|
||||
$opening_balances = Array();
|
||||
for ($i = 0; $i < $nrows; $i++) {
|
||||
$arr = $resql->fetch_array();
|
||||
$opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance'];
|
||||
}
|
||||
|
||||
foreach ($object->lines as $line)
|
||||
{
|
||||
$link = '';
|
||||
@ -274,14 +294,14 @@ if ($action != 'export_csv')
|
||||
{
|
||||
// Affiche un Sous-Total par compte comptable
|
||||
if ($displayed_account != "") {
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">' . $langs->trans("SubTotal") . ':</td><td class="nowrap right">' . price($sous_total_debit) . '</td><td class="nowrap right">' . price($sous_total_credit) . '</td><td class="nowrap right">' . price(price2num($sous_total_credit - $sous_total_debit)) . '</td>';
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_credit - $sous_total_debit)).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="6" style="font-weight:bold; border-bottom: 1pt solid black;">' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . '</td>';
|
||||
print '<td colspan="7" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_description;
|
||||
@ -293,6 +313,7 @@ if ($action != 'export_csv')
|
||||
|
||||
print '<td>'.length_accountg($line->numero_compte).'</td>';
|
||||
print '<td>'.$description.'</td>';
|
||||
print '<td class="nowraponall right">'.price($opening_balances["'".$line->numero_compte."'"]).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->debit).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->credit).'</td>';
|
||||
print '<td class="nowraponall right">'.price($line->debit - $line->credit).'</td>';
|
||||
@ -305,11 +326,11 @@ if ($action != 'export_csv')
|
||||
$sous_total_credit += $line->credit;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td><td class="nowrap right">'.price(price2num($sous_total_debit - $sous_total_credit)).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_total"><td class="right" colspan="2">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
|
||||
print '<tr class="liste_total"><td class="right" colspan="3">'.$langs->trans("AccountBalance").':</td><td class="nowrap right">'.price($total_debit).'</td><td class="nowrap right">'.price($total_credit).'</td><td class="nowrap right">'.price(price2num($total_debit - $total_credit)).'</td>';
|
||||
print "<td> </td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* 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) 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_ledger_code = GETPOST('search_ledger_code', 'alpha');
|
||||
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
|
||||
$search_not_reconciled = GETPOST('search_reconciled_option', 'alpha');
|
||||
|
||||
// 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);
|
||||
@ -202,6 +203,7 @@ if (empty($reshook))
|
||||
$search_debit = '';
|
||||
$search_credit = '';
|
||||
$search_lettering_code = '';
|
||||
$search_not_reconciled='';
|
||||
}
|
||||
|
||||
// Must be after the remove filter action, before the export.
|
||||
@ -312,6 +314,10 @@ if (empty($reshook))
|
||||
$filter['t.lettering_code'] = $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) {
|
||||
@ -444,6 +450,8 @@ if (count($filter) > 0) {
|
||||
$sqlwhere[] = $key.'\''.$db->idate($value).'\'';
|
||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} elseif ($key == 't.reconciled_option') {
|
||||
$sqlwhere[] = 't.lettering_code IS NULL';
|
||||
} else {
|
||||
$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 '<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>';
|
||||
}
|
||||
// Code journal
|
||||
|
||||
@ -260,9 +260,9 @@ if ($resql) {
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td class="nowrap right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="nowrap right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="nowrap right">' . price(round($solde, 2)) . '</td>';
|
||||
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
@ -285,15 +285,15 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td class="nowrap right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="nowrap right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="4"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
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 "</tr>\n";
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ dol_fiche_end();
|
||||
|
||||
$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.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 .= " 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)) {
|
||||
@ -257,9 +257,9 @@ if ($resql) {
|
||||
print '<td class="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
|
||||
print '<td>' . $obj->doc_ref . '</td>';
|
||||
print '<td>' . $obj->label_compte . '</td>';
|
||||
print '<td class="right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="right">' . price(round($solde, 2)) . '</td>';
|
||||
print '<td class="nowrap right">' . price($obj->debit) . '</td>';
|
||||
print '<td class="nowrap right">' . price($obj->credit) . '</td>';
|
||||
print '<td class="nowrap right">' . price(round($solde, 2)) . '</td>';
|
||||
|
||||
// Journal
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
@ -267,7 +267,7 @@ if ($resql) {
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
|
||||
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><a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $obj->piece_num . '">';
|
||||
print img_edit();
|
||||
@ -282,15 +282,15 @@ if ($resql) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Total").':</td>' . "\n";
|
||||
print '<td class="right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td class="nowrap right"><strong>' . price($debit) . '</strong></td>';
|
||||
print '<td class="nowrap right"><strong>' . price($credit) . '</strong></td>';
|
||||
print '<td colspan="6"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="right" colspan="3">'.$langs->trans("Balancing").':</td>' . "\n";
|
||||
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 "</tr>\n";
|
||||
|
||||
|
||||
@ -125,7 +125,7 @@ class AccountancyExport
|
||||
* @param int $type Format id
|
||||
* @return string Format code
|
||||
*/
|
||||
private static function getFormatCode($type)
|
||||
public static function getFormatCode($type)
|
||||
{
|
||||
$formatcode = array(
|
||||
self::$EXPORT_TYPE_CONFIGURABLE => 'csv',
|
||||
@ -239,6 +239,7 @@ class AccountancyExport
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
global $db; // The tpl file use $db
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
@ -935,6 +936,7 @@ class AccountancyExport
|
||||
foreach ($objectLines as $line) {
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_lim_reglement = dol_print_date($line->date_lim_reglement, '%Y%m%d');
|
||||
|
||||
// TYPE
|
||||
$type_enregistrement = 'E'; // For write movement
|
||||
@ -950,7 +952,7 @@ class AccountancyExport
|
||||
// LIBE
|
||||
print $line->label_operation.$separator;
|
||||
// DATH
|
||||
print $line->date_lim_reglement.$separator;
|
||||
print $date_lim_reglement.$separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
@ -969,21 +971,19 @@ class AccountancyExport
|
||||
}
|
||||
print $nature_piece.$separator;
|
||||
// RACI
|
||||
/*
|
||||
if (! empty($line->subledger_account)) {
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
$racine_subledger_account = '40';
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
$racine_subledger_account = '41';
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $racine_subledger_account . $separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
*/
|
||||
print $separator; // deprecated CPTG & CPTA use instead
|
||||
// if (! empty($line->subledger_account)) {
|
||||
// if ($line->doc_type == 'supplier_invoice') {
|
||||
// $racine_subledger_account = '40';
|
||||
// } elseif ($line->doc_type == 'customer_invoice') {
|
||||
// $racine_subledger_account = '41';
|
||||
// } else {
|
||||
// $racine_subledger_account = '';
|
||||
// }
|
||||
// } else {
|
||||
$racine_subledger_account = ''; // for records of type E leave this field blank
|
||||
// }
|
||||
|
||||
print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead
|
||||
// MONT
|
||||
print price(abs($line->montant), 0, '', 1, 2).$separator;
|
||||
// CODC
|
||||
|
||||
@ -176,6 +176,7 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " a.rowid = " . (int) $rowid;
|
||||
} elseif ($account_number) {
|
||||
$sql .= " a.account_number = '" . $this->db->escape($account_number) . "'";
|
||||
$sql .= " AND a.entity = ".$conf->entity;
|
||||
}
|
||||
if (! empty($limittocurrentchart)) {
|
||||
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
|
||||
|
||||
@ -926,6 +926,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.debit,";
|
||||
$sql .= " t.credit,";
|
||||
$sql .= " t.lettering_code,";
|
||||
$sql .= " t.date_lettering,";
|
||||
$sql .= " t.montant,";
|
||||
$sql .= " t.sens,";
|
||||
$sql .= " t.fk_user_author,";
|
||||
@ -934,6 +935,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_lim_reglement,";
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
@ -1006,12 +1008,14 @@ class BookKeeping extends CommonObject
|
||||
$line->montant = $obj->montant;
|
||||
$line->sens = $obj->sens;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->date_lettering = $obj->date_lettering;
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
|
||||
@ -1550,7 +1554,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " WHERE piece_num = ".$piecenum;
|
||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -1564,7 +1568,7 @@ class BookKeeping extends CommonObject
|
||||
$this->date_creation = $obj->date_creation;
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
|
||||
dol_syslog(__METHOD__.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1618,7 +1622,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " WHERE piece_num = ".$piecenum;
|
||||
$sql .= " AND entity IN (".getEntity('accountancy').")";
|
||||
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
@ -1650,7 +1654,7 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
|
||||
dol_syslog(__METHOD__.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -76,6 +76,7 @@ class Lettering extends BookKeeping
|
||||
|
||||
$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.date_validated IS NULL ';
|
||||
$sql .= $this->db->order('bk.doc_date', 'DESC');
|
||||
|
||||
// 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 .= " rowid IN (" . implode(',', $ids) . ") ";
|
||||
$sql .= " rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -275,7 +276,7 @@ class Lettering extends BookKeeping
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
|
||||
$sql .= " lettering_code='" . $lettre . "'";
|
||||
$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();
|
||||
|
||||
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
@ -152,6 +152,8 @@ if ($action == 'validatehistory') {
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$isBuyerInEEC = isInEEC($objp);
|
||||
|
||||
// Search suggested account for product/service
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
|
||||
@ -230,7 +230,7 @@ if (strlen(trim($search_country))) {
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code", "co.label"), $search_country);
|
||||
else $sql .= natural_search("co.code", $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
|
||||
@ -262,7 +262,7 @@ if (strlen(trim($search_country))) {
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code", "co.label"), $search_country);
|
||||
else $sql .= natural_search("co.code", $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
|
||||
@ -663,7 +663,7 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
} elseif ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->subledger_account = $k;
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"];
|
||||
$bookkeeping->numero_compte = $tabpay[$key]["account_various"];
|
||||
|
||||
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
@ -968,8 +968,8 @@ if (empty($action) || $action == 'view') {
|
||||
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
|
||||
|
||||
|
||||
// Test that setup is complete
|
||||
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE fk_accountancy_journal IS NULL AND clos=0';
|
||||
// Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed)
|
||||
$sql = 'SELECT COUNT(rowid) as nb FROM '.MAIN_DB_PREFIX.'bank_account WHERE entity = '.$conf->entity.' AND fk_accountancy_journal IS NULL AND clos=0';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -141,12 +141,14 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$num_lines = $db->num_rows($result);
|
||||
|
||||
$isSellerInEEC = isInEEC($mysoc);
|
||||
$isBuyerInEEC = isInEEC($mysoc);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$isSellerInEEC = isInEEC($objp);
|
||||
|
||||
// Search suggested account for product/service
|
||||
$suggestedaccountingaccountfor = '';
|
||||
if (($objp->country_code == $mysoc->country_code) || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country)
|
||||
|
||||
@ -225,7 +225,7 @@ if (strlen(trim($search_country))) {
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code", "co.label"), $search_country);
|
||||
else $sql .= natural_search("co.code", $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
|
||||
@ -263,7 +263,7 @@ if (strlen(trim($search_country))) {
|
||||
elseif ($search_country == 'special_eec') $sql .= " AND co.code IN (".$country_code_in_EEC.")";
|
||||
elseif ($search_country == 'special_eecnotme') $sql .= " AND co.code IN (".$country_code_in_EEC_without_me.")";
|
||||
elseif ($search_country == 'special_noteec') $sql .= " AND co.code NOT IN (".$country_code_in_EEC.")";
|
||||
else $sql .= natural_search(array("co.code", "co.label"), $search_country);
|
||||
else $sql .= natural_search("co.code", $search_country);
|
||||
}
|
||||
if (strlen(trim($search_tvaintra))) {
|
||||
$sql .= natural_search("s.tva_intra", $search_tvaintra);
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
if (empty($conf) || ! is_object($conf))
|
||||
if (empty($conf) || !is_object($conf))
|
||||
{
|
||||
print "Error, template page can't be called as URL";
|
||||
exit;
|
||||
@ -29,13 +29,15 @@ $format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
||||
$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME;
|
||||
$siren = $conf->global->MAIN_INFO_SIREN;
|
||||
|
||||
$date_export = "_" . dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
||||
|
||||
header('Content-Type: text/csv');
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11" && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
|
||||
if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$EXPORT_TYPE_FEC && $type_export == "general_ledger") // Specific filename for FEC model export into the general ledger
|
||||
{
|
||||
// FEC format is defined here: https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000027804775&cidTexte=LEGITEXT000006069583&dateTexte=20130802&oldAction=rechCodeArticle
|
||||
if (empty($search_date_end))
|
||||
@ -44,22 +46,22 @@ if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == "11" && $type_export == "genera
|
||||
$search_date_end = dol_now();
|
||||
}
|
||||
$datetouseforfilename = $search_date_end;
|
||||
$tmparray=dol_getdate($datetouseforfilename);
|
||||
$fiscalmonth=empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START;
|
||||
$tmparray = dol_getdate($datetouseforfilename);
|
||||
$fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START;
|
||||
// Define end of month to use
|
||||
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon']=$fiscalmonth;
|
||||
if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon'] = $fiscalmonth;
|
||||
else {
|
||||
$tmparray['mon'] = $fiscalmonth;
|
||||
$tmparray['mon'] = $fiscalmonth;
|
||||
$tmparray['year']++;
|
||||
}
|
||||
|
||||
$endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard');
|
||||
|
||||
$completefilename = $siren . "FEC" . $endaccountingperiod . "." . $format;
|
||||
$completefilename = $siren."FEC".$endaccountingperiod.".txt";
|
||||
}
|
||||
else
|
||||
{
|
||||
$completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format;
|
||||
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
|
||||
}
|
||||
|
||||
header('Content-Disposition: attachment;filename=' . $completefilename);
|
||||
header('Content-Disposition: attachment;filename='.$completefilename);
|
||||
|
||||
@ -202,7 +202,7 @@ if (empty($reshook))
|
||||
{
|
||||
// Creation user
|
||||
$nuser = new User($db);
|
||||
$result = $nuser->create_from_member($object, GETPOST('login'));
|
||||
$result = $nuser->create_from_member($object, GETPOST('login', 'alphanohtml'));
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -1747,7 +1747,7 @@ else
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, 'member', 1);
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,11 @@ class Subscription extends CommonObject
|
||||
*/
|
||||
public $table_element='subscription';
|
||||
|
||||
/**
|
||||
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table
|
||||
*/
|
||||
public $ismultientitymanaged = 'fk_adherent@adherent';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
@ -88,6 +93,21 @@ class Subscription extends CommonObject
|
||||
*/
|
||||
public $fk_bank;
|
||||
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
|
||||
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
|
||||
'fk_adherent' =>array('type'=>'integer', 'label'=>'Member', 'enabled'=>1, 'visible'=>-1, 'position'=>25),
|
||||
'dateadh' =>array('type'=>'datetime', 'label'=>'DateSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>30),
|
||||
'datef' =>array('type'=>'date', 'label'=>'DateEndSubscription', 'enabled'=>1, 'visible'=>-1, 'position'=>35),
|
||||
'subscription' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>-1, 'position'=>40, 'isameasure'=>1),
|
||||
'fk_bank' =>array('type'=>'integer', 'label'=>'BankId', 'enabled'=>1, 'visible'=>-1, 'position'=>45),
|
||||
'note' =>array('type'=>'text', 'label'=>'Note', 'enabled'=>1, 'visible'=>-1, 'position'=>50),
|
||||
'fk_type' =>array('type'=>'integer', 'label'=>'MemberType', 'enabled'=>1, 'visible'=>-1, 'position'=>55),
|
||||
'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>60),
|
||||
'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>65),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -229,7 +229,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
|
||||
// Payment informations
|
||||
$accountid = $_POST["accountid"];
|
||||
$operation = $_POST["operation"]; // Payment mode
|
||||
$num_chq = $_POST["num_chq"];
|
||||
$num_chq = GETPOST("num_chq", "alphanohtml");
|
||||
$emetteur_nom = $_POST["chqemetteur"];
|
||||
$emetteur_banque = $_POST["chqbank"];
|
||||
$option = $_POST["paymentsave"];
|
||||
@ -531,7 +531,7 @@ if ($rowid > 0)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showCategories($object->id, 'member', 1);
|
||||
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("Type").'</td><td class="valeur" colspan="3">';
|
||||
print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"]) ? $_POST["typeid"] : $object->fk_type));
|
||||
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid") : $object->fk_type));
|
||||
print'</td></tr>';
|
||||
|
||||
// Date start subscription
|
||||
|
||||
@ -35,8 +35,8 @@ $action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
|
||||
|
||||
$filter = GETPOST("filter", "alpha");
|
||||
$statut = (GETPOSTISSET("statut") ?GETPOST("statut", "alpha") : 1);
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_type = GETPOST('search_type', 'alpha');
|
||||
@ -47,6 +47,7 @@ $search_note = GETPOST('search_note', 'alpha');
|
||||
$search_account = GETPOST('search_account', 'int');
|
||||
$search_amount = GETPOST('search_amount', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$sall = '';
|
||||
|
||||
$date_select = GETPOST("date_select", 'alpha');
|
||||
|
||||
@ -76,21 +77,21 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen
|
||||
$fieldstosearchall = array(
|
||||
);
|
||||
$arrayfields = array(
|
||||
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'd.fk_type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
|
||||
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
|
||||
't.libelle'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
'c.dateadh'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
|
||||
'c.datef'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
|
||||
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
|
||||
'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
|
||||
'd.ref'=>array('label'=>"Ref", 'checked'=>1),
|
||||
'd.fk_type'=>array('label'=>"Type", 'checked'=>1),
|
||||
'd.lastname'=>array('label'=>"Lastname", 'checked'=>1),
|
||||
'd.firstname'=>array('label'=>"Firstname", 'checked'=>1),
|
||||
'd.login'=>array('label'=>"Login", 'checked'=>1),
|
||||
't.libelle'=>array('label'=>"Label", 'checked'=>1),
|
||||
'd.bank'=>array('label'=>"BankAccount", 'checked'=>1, 'enabled'=>(!empty($conf->banque->enabled))),
|
||||
/*'d.note_public'=>array('label'=>"NotePublic", 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>"NotePrivate", 'checked'=>0),*/
|
||||
'c.dateadh'=>array('label'=>"DateSubscription", 'checked'=>1, 'position'=>100),
|
||||
'c.datef'=>array('label'=>"EndSubscription", 'checked'=>1, 'position'=>101),
|
||||
'd.amount'=>array('label'=>"Amount", 'checked'=>1, 'position'=>102),
|
||||
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
|
||||
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
// 'd.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000)
|
||||
);
|
||||
|
||||
// Security check
|
||||
@ -256,7 +257,6 @@ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$opt
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
@ -388,46 +388,17 @@ print "</tr>\n";
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['d.ref']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.fk_type']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.lastname']['checked']))
|
||||
{
|
||||
print_liste_field_titre("LastName", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.firstname']['checked']))
|
||||
{
|
||||
print_liste_field_titre("FirstName", $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.login']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['t.libelle']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['c.dateadh']['checked']))
|
||||
{
|
||||
print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
||||
}
|
||||
if (!empty($arrayfields['c.datef']['checked']))
|
||||
{
|
||||
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
||||
}
|
||||
if (!empty($arrayfields['d.amount']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
if (!empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
||||
if (!empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall ');
|
||||
if (!empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right ');
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
|
||||
@ -441,12 +412,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], '', '', '', 'alig
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$total = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$total += $obj->subscription;
|
||||
|
||||
$subscription->ref = $obj->crowid;
|
||||
$subscription->id = $obj->crowid;
|
||||
|
||||
@ -65,7 +65,7 @@ $subscription = GETPOST("subscription", "int");
|
||||
$duration_value = GETPOST('duration_value', 'int');
|
||||
$duration_unit = GETPOST('duration_unit', 'alpha');
|
||||
$vote = GETPOST("vote", "int");
|
||||
$comment = GETPOST("comment", 'alphanohtml');
|
||||
$comment = GETPOST("comment", 'none');
|
||||
$mail_valid = GETPOST("mail_valid", 'none');
|
||||
|
||||
// Security check
|
||||
@ -364,7 +364,9 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
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>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -790,7 +792,7 @@ if ($rowid > 0)
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"]) ? $_POST["morphy"] : $object->morphy);
|
||||
print $form->selectarray("morphy", $morphys, GETPOSTISSET("morphy") ? GETPOST("morphy") : $object->morphy);
|
||||
print "</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
@ -807,10 +809,12 @@ if ($rowid > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
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>';
|
||||
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->Create();
|
||||
print "</td></tr>";
|
||||
|
||||
@ -235,7 +235,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/action/doc/");
|
||||
$dir = dol_buildpath($reldir."core/modules/action/doc");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -257,7 +257,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info'))
|
||||
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("AgendaUrlOptionsProject", $user->login, $user->login).'<br>';
|
||||
$message .= $langs->trans("AgendaUrlOptionsNotAutoEvent", 'systemauto', 'systemauto').'<br>';
|
||||
$message .= $langs->trans("AgendaUrlOptionsIncludeHolidays", '1', '1').'<br>';
|
||||
|
||||
print info_admin($message);
|
||||
|
||||
|
||||
@ -350,7 +350,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -382,7 +383,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
@ -425,7 +425,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 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)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/commande".$valdir);
|
||||
$realpath = $reldir."core/modules/commande".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -471,20 +472,22 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
//$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||
//$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -95,15 +95,15 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha'))
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FAX", GETPOST("fax", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MAIL", GETPOST("mail", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB", GETPOST("web", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD", GETPOST("barcode", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$dirforimage = $conf->mycompany->dir_output.'/logos/';
|
||||
|
||||
@ -415,17 +415,17 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
|
||||
|
||||
// Name
|
||||
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";
|
||||
|
||||
// Address
|
||||
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 '<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 '<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
|
||||
print '<tr class="oddeven"><td class="fieldrequired"><label for="selectcountry_id">'.$langs->trans("Country").'</label></td><td class="maxwidthonsmartphone">';
|
||||
|
||||
@ -40,7 +40,7 @@ $update=GETPOST('update', 'alpha');
|
||||
$delete=GETPOST('delete', 'none'); // Do not use alpha here
|
||||
$debug=GETPOST('debug', 'int');
|
||||
$consts=GETPOST('const', 'array');
|
||||
$constname=GETPOST('constname', 'alpha');
|
||||
$constname=GETPOST('constname', 'alphanohtml');
|
||||
$constvalue=GETPOST('constvalue', 'none'); // We shoul dbe able to send everything here
|
||||
$constnote=GETPOST('constnote', 'alpha');
|
||||
|
||||
|
||||
@ -339,7 +339,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -407,18 +408,20 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2017-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017-2018 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -52,15 +52,15 @@ $pagenext = $page + 1;
|
||||
if (!$sortfield) $sortfield = 'page,param';
|
||||
if (!$sortorder) $sortorder = 'ASC';
|
||||
|
||||
$defaulturl = GETPOST('defaulturl');
|
||||
$defaultkey = GETPOST('defaultkey', 'alpha');
|
||||
$defaultvalue = GETPOST('defaultvalue');
|
||||
$defaulturl = GETPOST('defaulturl', 'alphanohtml');
|
||||
$defaultkey = GETPOST('defaultkey', 'alphanohtml');
|
||||
$defaultvalue = GETPOST('defaultvalue', 'none');
|
||||
|
||||
$defaulturl = preg_replace('/^\//', '', $defaulturl);
|
||||
|
||||
$urlpage = GETPOST('urlpage');
|
||||
$key = GETPOST('key');
|
||||
$value = GETPOST('value');
|
||||
$urlpage = GETPOST('urlpage', 'alphanohtml');
|
||||
$key = GETPOST('key', 'alphanohtml');
|
||||
$value = GETPOST('value', 'none');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('admindefaultvalues', 'globaladmin'));
|
||||
@ -210,9 +210,9 @@ print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'titl
|
||||
print '<span class="opacitymedium">'.$langs->trans("DefaultValuesDesc")."</span><br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
if ($defaulturl) $param .= '&defaulturl='.urlencode($defaulturl);
|
||||
if ($defaultkey) $param .= '&defaultkey='.urlencode($defaultkey);
|
||||
if ($defaultvalue) $param .= '&defaultvalue='.urlencode($defaultvalue);
|
||||
@ -359,7 +359,7 @@ if ($result)
|
||||
|
||||
// Page
|
||||
print '<td>';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->page;
|
||||
if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) print $obj->page;
|
||||
else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
|
||||
print '</td>'."\n";
|
||||
|
||||
@ -378,7 +378,7 @@ if ($result)
|
||||
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
|
||||
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
*/
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value;
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -107,6 +107,10 @@ $modules = array(
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_MEMBERS',
|
||||
'img' => 'user'
|
||||
),
|
||||
array(
|
||||
'code' => 'MAIN_DELAY_MEMBERS_SHIFT',
|
||||
'img' => 'user'
|
||||
)
|
||||
),
|
||||
'expensereport' => array(
|
||||
|
||||
@ -58,6 +58,7 @@ if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1
|
||||
if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account
|
||||
if (!$allowed) accessforbidden();
|
||||
|
||||
$acts =array(); $actl =array();
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
@ -76,7 +77,7 @@ $pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
$search_country_id = GETPOST('search_country_id', 'int');
|
||||
if ($search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
|
||||
if (! GETPOSTISSET('search_country_id') && $search_country_id == '' && ($id == 2 || $id == 3 || $id == 10)) // Not a so good idea to force on current country for all dictionaries. Some tables have entries that are for all countries, we must be able to see them, so this is done for dedicated dictionaries only.
|
||||
{
|
||||
$search_country_id = $mysoc->country_id;
|
||||
}
|
||||
@ -178,7 +179,7 @@ $tablib[38] = "DictionarySocialNetworks";
|
||||
$tabsql = array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
|
||||
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite FROM ".MAIN_DB_PREFIX."c_country AS c";
|
||||
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
|
||||
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
|
||||
@ -677,9 +678,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorReservedTypeSystemSystemAuto'), null, 'errors');
|
||||
}
|
||||
if (isset($_POST["code"]))
|
||||
if (GETPOSTISSET("code"))
|
||||
{
|
||||
if ($_POST["code"] == '0')
|
||||
if (GETPOST("code") == '0')
|
||||
{
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
@ -690,7 +691,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br>';
|
||||
}*/
|
||||
}
|
||||
if (isset($_POST["country"]) && ($_POST["country"] == '0') && ($id != 2))
|
||||
if (GETPOSTISSET("country") && ($_POST["country"] == '0') && ($id != 2))
|
||||
{
|
||||
if (in_array($tablib[$id], array('DictionaryCompanyType', 'DictionaryHolidayTypes'))) // Field country is no mandatory for such dictionaries
|
||||
{
|
||||
@ -752,19 +753,33 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
$keycode = $listfieldvalue[$i];
|
||||
if (empty($keycode)) $keycode = $value;
|
||||
|
||||
if ($value == 'price' || preg_match('/^amount/i', $value) || $value == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
|
||||
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
|
||||
}
|
||||
elseif ($value == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
|
||||
$_POST[$keycode] = getEntity($tabname[$id]);
|
||||
}
|
||||
|
||||
if ($i) $sql .= ",";
|
||||
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
|
||||
if ($keycode == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
{
|
||||
$sql .= "'".(int) $db->escape($_POST['position'])."'";
|
||||
$sql .= "'".(int) GETPOST('position', 'int');
|
||||
}
|
||||
elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
elseif ($keycode == 'content') {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
|
||||
}
|
||||
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
|
||||
$sql .= (int) GETPOST($keycode, 'int');
|
||||
}
|
||||
else {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sql .= ",1)";
|
||||
@ -804,23 +819,36 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
$i = 0;
|
||||
foreach ($listfieldmodify as $field)
|
||||
{
|
||||
$keycode = $listfieldvalue[$i];
|
||||
if (empty($keycode)) $keycode = $field;
|
||||
|
||||
if ($field == 'price' || preg_match('/^amount/i', $field) || $field == 'taux') {
|
||||
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]], 'MU');
|
||||
$_POST[$keycode] = price2num($_POST[$keycode], 'MU');
|
||||
}
|
||||
elseif ($field == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]);
|
||||
$_POST[$keycode] = getEntity($tabname[$id]);
|
||||
}
|
||||
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($listfieldvalue[$i] == 'sortorder') // For column name 'sortorder', we use the field name 'position'
|
||||
{
|
||||
$sql .= "'".(int) $db->escape($_POST['position'])."'";
|
||||
$sql .= (int) GETPOST('position', 'int');
|
||||
}
|
||||
elseif ($_POST[$listfieldvalue[$i]] == '' && !($listfieldvalue[$i] == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
elseif ($_POST[$keycode] == '' && !($keycode == 'code' && $id == 10)) $sql .= "null"; // For vat, we want/accept code = ''
|
||||
elseif ($keycode == 'content') {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
|
||||
}
|
||||
elseif (in_array($keycode, array('private', 'position', 'scale'))) {
|
||||
$sql .= (int) GETPOST($keycode, 'int');
|
||||
}
|
||||
else {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sql .= " WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
|
||||
$sql .= " WHERE ".$rowidcol." = ".(int) $db->escape($rowid);
|
||||
if (in_array('entity', $listfieldmodify)) $sql .= " AND entity = '".getEntity($tabname[$id])."'";
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
@ -1011,6 +1039,7 @@ if ($id)
|
||||
if ($search_code != '' && $id == 9) $sql .= natural_search("code_iso", $search_code);
|
||||
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
|
||||
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
|
||||
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
|
||||
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
|
||||
|
||||
if ($sortfield)
|
||||
@ -1146,7 +1175,7 @@ if ($id)
|
||||
if ($fieldlist[$field] == 'revenuestamp_type') { $valuetoshow = $langs->trans('TypeOfRevenueStamp'); }
|
||||
if ($fieldlist[$field] == 'use_default') { $valuetoshow = $langs->trans('Default'); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
if ($id == 2) // Special case for state page
|
||||
{
|
||||
if ($fieldlist[$field] == 'region_id') { $valuetoshow = ' '; $showfield = 1; }
|
||||
if ($fieldlist[$field] == 'region') { $valuetoshow = $langs->trans("Country").'/'.$langs->trans("Region"); $showfield = 1; }
|
||||
@ -1228,6 +1257,7 @@ if ($id)
|
||||
|
||||
// List of available record in database
|
||||
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -1620,7 +1650,9 @@ if ($id)
|
||||
$key = $langs->trans($obj->label);
|
||||
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
elseif ($fieldlist[$field] == 'code' && $id == 3) {
|
||||
$valuetoshow = $obj->state_code;
|
||||
}
|
||||
$class .= ($class ? ' ' : '').'tddict';
|
||||
if ($fieldlist[$field] == 'note' && $id == 10) $class .= ' tdoverflowmax200';
|
||||
if ($fieldlist[$field] == 'tracking') $class .= ' tdoverflowauto';
|
||||
|
||||
@ -349,7 +349,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
$parameters = array('lineid' => $lineid);
|
||||
$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
|
||||
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
|
||||
|
||||
@ -32,13 +32,13 @@ if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("users","admin","other"));
|
||||
$langs->loadLangs(array("users", "admin", "other"));
|
||||
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
$securityevent=new Events($db);
|
||||
$eventstolog=$securityevent->eventstolog;
|
||||
$securityevent = new Events($db);
|
||||
$eventstolog = $securityevent->eventstolog;
|
||||
|
||||
|
||||
/*
|
||||
@ -46,15 +46,14 @@ $eventstolog=$securityevent->eventstolog;
|
||||
*/
|
||||
if ($action == "save")
|
||||
{
|
||||
$i=0;
|
||||
$i = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
foreach ($eventstolog as $key => $arr)
|
||||
{
|
||||
$param='MAIN_LOGEVENTS_'.$arr['id'];
|
||||
//print "param=".$param." - ".$_POST[$param];
|
||||
if (! empty($_POST[$param])) dolibarr_set_const($db, $param, $_POST[$param], 'chaine', 0, '', $conf->entity);
|
||||
$param = 'MAIN_LOGEVENTS_'.$arr['id'];
|
||||
if (GETPOST($param, 'alphanohtml')) dolibarr_set_const($db, $param, GETPOST($param, 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_del_const($db, $param, $conf->entity);
|
||||
}
|
||||
|
||||
@ -68,7 +67,7 @@ if ($action == "save")
|
||||
* View
|
||||
*/
|
||||
|
||||
$wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
|
||||
$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
|
||||
llxHeader('', $langs->trans("Audit"), $wikihelp);
|
||||
|
||||
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
@ -82,7 +81,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="save">';
|
||||
|
||||
$head=security_prepare_head();
|
||||
$head = security_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);
|
||||
|
||||
@ -98,9 +97,9 @@ foreach ($eventstolog as $key => $arr)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$arr['id'].'</td>';
|
||||
print '<td>';
|
||||
$key='MAIN_LOGEVENTS_'.$arr['id'];
|
||||
$value=$conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value?' checked':'').'>';
|
||||
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
|
||||
$value = $conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>';
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'sending');
|
||||
|
||||
// Shipment numbering model
|
||||
|
||||
print load_fiche_titre($langs->trans("SendingsNumberingModules"));
|
||||
print load_fiche_titre($langs->trans("SendingsNumberingModules"), '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -304,7 +304,7 @@ print '</table><br>';
|
||||
/*
|
||||
* Documents models for Sendings Receipt
|
||||
*/
|
||||
print load_fiche_titre($langs->trans("SendingsReceiptModel"));
|
||||
print load_fiche_titre($langs->trans("SendingsReceiptModel"), '', '');
|
||||
|
||||
// Defini tableau def de modele invoice
|
||||
$type="shipping";
|
||||
@ -463,7 +463,7 @@ print '<br>';
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
print load_fiche_titre($langs->trans("OtherOptions"));
|
||||
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='invoice';
|
||||
$type = 'invoice';
|
||||
|
||||
|
||||
/*
|
||||
@ -53,22 +53,22 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstinvoice=GETPOST('maskconstinvoice', 'alpha');
|
||||
$maskconstreplacement=GETPOST('maskconstreplacement', 'alpha');
|
||||
$maskconstcredit=GETPOST('maskconstcredit', 'alpha');
|
||||
$maskconstdeposit=GETPOST('maskconstdeposit', 'alpha');
|
||||
$maskinvoice=GETPOST('maskinvoice', 'alpha');
|
||||
$maskreplacement=GETPOST('maskreplacement', 'alpha');
|
||||
$maskcredit=GETPOST('maskcredit', 'alpha');
|
||||
$maskdeposit=GETPOST('maskdeposit', 'alpha');
|
||||
$maskconstinvoice = GETPOST('maskconstinvoice', 'alpha');
|
||||
$maskconstreplacement = GETPOST('maskconstreplacement', 'alpha');
|
||||
$maskconstcredit = GETPOST('maskconstcredit', 'alpha');
|
||||
$maskconstdeposit = GETPOST('maskconstdeposit', 'alpha');
|
||||
$maskinvoice = GETPOST('maskinvoice', 'alpha');
|
||||
$maskreplacement = GETPOST('maskreplacement', 'alpha');
|
||||
$maskcredit = GETPOST('maskcredit', 'alpha');
|
||||
$maskdeposit = GETPOST('maskdeposit', 'alpha');
|
||||
if ($maskconstinvoice) $res = dolibarr_set_const($db, $maskconstinvoice, $maskinvoice, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconstreplacement) $res = dolibarr_set_const($db, $maskconstreplacement, $maskreplacement, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconstcredit) $res = dolibarr_set_const($db, $maskconstcredit, $maskcredit, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconstdeposit) $res = dolibarr_set_const($db, $maskconstdeposit, $maskdeposit, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -79,20 +79,20 @@ if ($action == 'updateMask')
|
||||
}
|
||||
elseif ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$facture = new Facture($db);
|
||||
$facture->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/facture/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@ -167,9 +167,9 @@ elseif ($action == 'setribchq')
|
||||
$res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
|
||||
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -184,9 +184,9 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
|
||||
|
||||
$res = dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -198,13 +198,13 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
|
||||
|
||||
elseif ($action == 'set_INVOICE_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -219,9 +219,9 @@ elseif ($action == 'setforcedate')
|
||||
|
||||
$res = dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION", $forcedate, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -232,19 +232,19 @@ elseif ($action == 'setforcedate')
|
||||
}
|
||||
elseif ($action == 'setDefaultPDFModulesByType')
|
||||
{
|
||||
$invoicetypemodels = GETPOST('invoicetypemodels');
|
||||
$invoicetypemodels = GETPOST('invoicetypemodels');
|
||||
|
||||
if(!empty($invoicetypemodels) && is_array($invoicetypemodels))
|
||||
if (!empty($invoicetypemodels) && is_array($invoicetypemodels))
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
foreach ($invoicetypemodels as $type => $value)
|
||||
{
|
||||
$res = dolibarr_set_const($db, 'FACTURE_ADDON_PDF_'.intval($type), $value, 'chaine', 0, '', $conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -260,14 +260,14 @@ elseif ($action == 'setDefaultPDFModulesByType')
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", $langs->trans("BillsSetup"), 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura');
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = invoice_admin_prepare_head();
|
||||
@ -298,24 +298,24 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
if (!is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
{
|
||||
$filebis = $file;
|
||||
$classname = preg_replace('/\.php$/', '', $file);
|
||||
// For compatibility
|
||||
if (! is_file($dir.$filebis))
|
||||
if (!is_file($dir.$filebis))
|
||||
{
|
||||
$filebis = $file."/".$file.".modules.php";
|
||||
$classname = "mod_facture_".$file;
|
||||
}
|
||||
// Check if there is a filter on country
|
||||
preg_match('/\-(.*)_(.*)$/', $classname, $reg);
|
||||
if (! empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
if (!empty($reg[2]) && $reg[2] != strtoupper($mysoc->country_code)) continue;
|
||||
|
||||
$classname = preg_replace('/\-.*$/', '', $classname);
|
||||
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
|
||||
if (!class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/', $filebis) || preg_match('/mod_/', $classname)) && substr($filebis, dol_strlen($filebis) - 3, 3) == 'php')
|
||||
{
|
||||
// Charging the numbering class
|
||||
require_once $dir.$filebis;
|
||||
@ -323,7 +323,7 @@ foreach ($dirmodels as $reldir)
|
||||
$module = new $classname($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@ -338,9 +338,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering module
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@ -356,62 +356,62 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$facture=new Facture($db);
|
||||
$facture = new Facture($db);
|
||||
$facture->initAsSpecimen();
|
||||
|
||||
// Example for standard invoice
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$facture->type=0;
|
||||
$nextval=$module->getNextValue($mysoc, $facture);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$facture->type = 0;
|
||||
$nextval = $module->getNextValue($mysoc, $facture);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValueForInvoices").': ';
|
||||
$htmltooltip .= $langs->trans("NextValueForInvoices").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
// Example for remplacement
|
||||
$facture->type=1;
|
||||
$nextval=$module->getNextValue($mysoc, $facture);
|
||||
$facture->type = 1;
|
||||
$nextval = $module->getNextValue($mysoc, $facture);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValueForReplacements").': ';
|
||||
$htmltooltip .= $langs->trans("NextValueForReplacements").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
// Example for credit invoice
|
||||
$facture->type=2;
|
||||
$nextval=$module->getNextValue($mysoc, $facture);
|
||||
$facture->type = 2;
|
||||
$nextval = $module->getNextValue($mysoc, $facture);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
|
||||
$htmltooltip .= $langs->trans("NextValueForCreditNotes").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
// Example for deposit invoice
|
||||
$facture->type=3;
|
||||
$nextval=$module->getNextValue($mysoc, $facture);
|
||||
$facture->type = 3;
|
||||
$nextval = $module->getNextValue($mysoc, $facture);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=$langs->trans("NextValueForDeposit").': ';
|
||||
$htmltooltip .= $langs->trans("NextValueForDeposit").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval;
|
||||
$htmltooltip .= $nextval;
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error);
|
||||
$htmltooltip .= $langs->trans($module->error);
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($conf->global->FACTURE_ADDON.'.php' == $file) // If module is the one used, we show existing errors
|
||||
{
|
||||
if (! empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
|
||||
if (!empty($module->error)) dol_htmloutput_mesg($module->error, '', 'error', 1);
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
@ -445,17 +445,17 @@ print '<br>';
|
||||
print load_fiche_titre($langs->trans("BillsPDFModules"), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
$type='invoice';
|
||||
$type = 'invoice';
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@ -484,42 +484,43 @@ $activatedModels = array();
|
||||
|
||||
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))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
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";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -554,20 +555,22 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
@ -597,7 +600,7 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
{
|
||||
/*
|
||||
* Document templates generators
|
||||
@ -614,13 +617,13 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$listtype=array(
|
||||
$listtype = array(
|
||||
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
|
||||
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
|
||||
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
|
||||
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
|
||||
);
|
||||
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
$listtype[Facture::TYPE_SITUATION] = $langs->trans("InvoiceSituation");
|
||||
}
|
||||
@ -628,7 +631,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf
|
||||
foreach ($listtype as $type => $trans)
|
||||
{
|
||||
$thisTypeConfName = 'FACTURE_ADDON_PDF_'.$type;
|
||||
$current = !empty($conf->global->{$thisTypeConfName})?$conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
|
||||
$current = !empty($conf->global->{$thisTypeConfName}) ? $conf->global->{$thisTypeConfName}:$conf->global->FACTURE_ADDON_PDF;
|
||||
print '<tr >';
|
||||
print '<td>'.$trans.'</td>';
|
||||
print '<td colspan="2" >'.$form->selectarray('invoicetypemodels['.$type.']', ModelePDFFactures::liste_modeles($db), $current, 0, 0, 0).'</td>';
|
||||
@ -660,14 +663,14 @@ print "</tr>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
|
||||
print "<td>";
|
||||
if (! empty($conf->banque->enabled))
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE clos = 0";
|
||||
$sql.= " AND courant = 1";
|
||||
$sql.= " AND entity IN (".getEntity('bank_account').")";
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " WHERE clos = 0";
|
||||
$sql .= " AND courant = 1";
|
||||
$sql .= " AND entity IN (".getEntity('bank_account').")";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -681,7 +684,7 @@ if (! empty($conf->banque->enabled))
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<option value="'.$row[0].'"';
|
||||
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected':'';
|
||||
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected' : '';
|
||||
print '>'.$row[1].'</option>';
|
||||
|
||||
$i++;
|
||||
@ -705,15 +708,15 @@ print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
|
||||
print "<td>";
|
||||
print '<select class="flat" name="chq" id="chq">';
|
||||
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
|
||||
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER?' selected':'').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name?$mysoc->name:$langs->trans("NotDefined")).')</option>';
|
||||
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER ? ' selected' : '').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name ? $mysoc->name : $langs->trans("NotDefined")).')</option>';
|
||||
|
||||
$sql = "SELECT rowid, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " WHERE clos = 0";
|
||||
$sql.= " AND courant = 1";
|
||||
$sql.= " AND entity IN (".getEntity('bank_account').")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql .= " WHERE clos = 0";
|
||||
$sql .= " AND courant = 1";
|
||||
$sql .= " AND entity IN (".getEntity('bank_account').")";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
@ -723,7 +726,7 @@ if ($resql)
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<option value="'.$row[0].'"';
|
||||
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected':'';
|
||||
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected' : '';
|
||||
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
|
||||
|
||||
$i++;
|
||||
@ -758,18 +761,18 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
|
||||
print "</td></tr>\n";
|
||||
print '</form>';
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='INVOICE_FREE_TEXT';
|
||||
$variablename = 'INVOICE_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@ -777,7 +780,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
|
||||
@ -239,13 +239,6 @@ else
|
||||
jsdump(CKEDITOR.env, "divforlog");
|
||||
</script>';
|
||||
}
|
||||
|
||||
/*
|
||||
print '<!-- Result -->';
|
||||
print $_POST["formtestfield"];
|
||||
print '<!-- Result -->';
|
||||
print $conf->global->FCKEDITOR_TEST;
|
||||
*/
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -409,7 +409,8 @@ clearstatcache();
|
||||
|
||||
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))
|
||||
{
|
||||
@ -480,6 +481,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 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)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/holiday".$valdir);
|
||||
$realpath = $reldir."core/modules/holiday".$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -429,7 +430,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -248,7 +248,6 @@ print '</tr>';
|
||||
|
||||
// Multilingual GUI
|
||||
print '<tr class="oddeven"><td class="titlefield">'.$langs->trans("EnableMultilangInterface").'</td><td>';
|
||||
//print $form->selectyesno('MAIN_MULTILANGS', $conf->global->MAIN_MULTILANGS, 1);
|
||||
print ajax_constantonoff('MAIN_MULTILANGS');
|
||||
print '</td>';
|
||||
print '<td width="20"> </td>';
|
||||
|
||||
@ -51,14 +51,14 @@ if ($action == 'setvalue' && $user->admin)
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_DN', GETPOST("group"), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass"), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_DN', GETPOST("group", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_OBJECT_CLASS', GETPOST("objectclass", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname"), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',$_POST["fieldname"],'chaine',0,'',$conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION', GETPOST("fielddescription"), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS', GETPOST("fieldgroupmembers"), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid"), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_FULLNAME', GETPOST("fieldfullname", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
//if (! dolibarr_set_const($db, 'LDAP_GROUP_FIELD_NAME',GETPOST("fieldname", 'alphanohtml'),'chaine',0,'',$conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_DESCRIPTION', GETPOST("fielddescription", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPMEMBERS', GETPOST("fieldgroupmembers", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
if (!dolibarr_set_const($db, 'LDAP_GROUP_FIELD_GROUPID', GETPOST("fieldgroupid", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++;
|
||||
|
||||
// This one must be after the others
|
||||
$valkey = '';
|
||||
|
||||
@ -134,9 +134,8 @@ $head = email_admin_prepare_head();
|
||||
// List of sending methods
|
||||
$listofmethods = array();
|
||||
$listofmethods['mail'] = 'PHP mail function';
|
||||
//$listofmethods['simplemail']='Simplemail class';
|
||||
$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
|
||||
$listofmethods['swiftmailer'] = 'Swift Mailer socket library';
|
||||
if (version_compare(phpversion(), '7.0', '>=')) $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
@ -638,7 +637,7 @@ else
|
||||
$liste['user'] = $langs->trans('UserEmail');
|
||||
$liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? $langs->trans("NotDefined") : $conf->global->MAIN_INFO_SOCIETE_MAIL).')';
|
||||
$sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
|
||||
$sql.= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -758,13 +757,31 @@ else
|
||||
$text = '';
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
$text .= $langs->trans("WarningPHPMail");
|
||||
$text .= $langs->trans("WarningPHPMail"); // To encourage to use SMTPS
|
||||
}
|
||||
//$conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS='1.2.3.4';
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
|
||||
|
||||
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
|
||||
{
|
||||
$text .= ($text ? '<br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
// MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS is list of IPs where email is sent from. Example: '1.2.3.4, [aaaa:bbbb:cccc:dddd]'.
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
|
||||
{
|
||||
// List of IP show as record to add in SPF if we use the mail method
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
} else {
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS))
|
||||
{
|
||||
// List of IP show as record to add as allowed IP if we use the smtp method
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMail2", $conf->global->MAIN_EXTERNAL_SMTP_CLIENT_IP_ADDRESS);
|
||||
}
|
||||
if (!empty($conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD))
|
||||
{
|
||||
// List of string to add in SPF if we use the smtp method
|
||||
$text .= ($text ? '<br><br>' : '').$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($text) print info_admin($text);
|
||||
}
|
||||
|
||||
@ -840,6 +857,11 @@ else
|
||||
print $formmail->get_form('addfile', 'removefile');
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// References
|
||||
print '<span class="opacitymedium">'.$langs->trans("EMailsWillHaveMessageID").': ';
|
||||
print dol_escape_htmltag('<timestamp.*@'.dol_getprefix('email').'>');
|
||||
print '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -108,9 +108,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
||||
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),
|
||||
'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])
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -451,7 +451,7 @@ foreach ($object->fields as $key => $val)
|
||||
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]).'">';
|
||||
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>';
|
||||
}
|
||||
}
|
||||
@ -555,10 +555,10 @@ while ($i < ($limit ? min($num, $limit) : $num))
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
$url = $_SERVER["PHP_SELF"].'?action=list&id='.$obj->rowid;
|
||||
if ($limit) $url.='&limit='.urlencode($limit);
|
||||
if ($page) $url.='&page='.urlencode($page);
|
||||
if ($sortfield) $url.='&sortfield='.urlencode($sortfield);
|
||||
if ($sortorder) $url.='&page='.urlencode($sortorder);
|
||||
if ($limit) $url .= '&limit='.urlencode($limit);
|
||||
if ($page) $url .= '&page='.urlencode($page);
|
||||
if ($sortfield) $url .= '&sortfield='.urlencode($sortfield);
|
||||
if ($sortorder) $url .= '&page='.urlencode($sortorder);
|
||||
//print '<a class="reposition" href="'.$url.'&action=edit">'.img_edit().'</a>';
|
||||
//print ' ';
|
||||
print '<a href="'.$url.'&action=delete">'.img_delete().'</a> ';
|
||||
|
||||
@ -58,6 +58,8 @@ $search_topic = GETPOST('search_topic', 'alpha');
|
||||
|
||||
if (!empty($user->socid)) accessforbidden();
|
||||
|
||||
$acts = array();
|
||||
$actl = array();
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
@ -261,28 +263,39 @@ if (empty($reshook))
|
||||
$i = 0;
|
||||
foreach ($listfieldinsert as $f => $value)
|
||||
{
|
||||
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
|
||||
$keycode = $listfieldvalue[$i];
|
||||
if ($value == 'label') $_POST[$keycode] = dol_escape_htmltag($_POST[$keycode]);
|
||||
if ($value == 'lang') $keycode = 'langcode';
|
||||
if (empty($keycode)) $keycode = $value;
|
||||
|
||||
if ($value == 'entity') $_POST[$keycode] = $conf->entity;
|
||||
if ($i) $sql .= ",";
|
||||
if ($value == 'fk_user' && !($_POST[$keycode] > 0)) $_POST[$keycode] = '';
|
||||
if ($value == 'private' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '0';
|
||||
if ($value == 'position' && !is_numeric($_POST[$keycode])) $_POST[$keycode] = '1';
|
||||
if ($_POST[$keycode] == '' && $keycode != 'langcode') $sql .= "null"; // lang must be '' if not defined so the unique key that include lang will work
|
||||
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql .= "''"; // lang must be '' if not defined so the unique key that include lang will work
|
||||
else $sql .= "'".$db->escape($_POST[$keycode])."'";
|
||||
//var_dump($keycode.' '.$value);
|
||||
|
||||
if ($i) $sql .= ", ";
|
||||
if (GETPOST($keycode) == '' && $keycode != 'langcode') $sql .= "null"; // langcode must be '' if not defined so the unique key that include lang will work
|
||||
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
|
||||
elseif ($keycode == 'content') {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
|
||||
}
|
||||
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
|
||||
$sql .= (int) GETPOST($keycode, 'int');
|
||||
}
|
||||
else {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sql .= ",1)";
|
||||
$sql .= ", 1)";
|
||||
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only id
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -308,6 +321,7 @@ if (empty($reshook))
|
||||
{
|
||||
$keycode = $listfieldvalue[$i];
|
||||
if ($field == 'lang') $keycode = 'langcode';
|
||||
if (empty($keycode)) $keycode = $field;
|
||||
|
||||
if ($field == 'fk_user' && !($_POST['fk_user'] > 0)) $_POST['fk_user'] = '';
|
||||
if ($field == 'topic') $_POST['topic'] = $_POST['topic-'.$rowid];
|
||||
@ -315,15 +329,22 @@ if (empty($reshook))
|
||||
if ($field == 'content') $_POST['content'] = $_POST['content-'.$rowid];
|
||||
if ($field == 'content_lines') $_POST['content_lines'] = $_POST['content_lines-'.$rowid];
|
||||
if ($field == 'entity') $_POST[$keycode] = $conf->entity;
|
||||
if ($i) $sql .= ",";
|
||||
|
||||
if ($i) $sql .= ", ";
|
||||
$sql .= $field."=";
|
||||
|
||||
//print $keycode.' - '.$_POST[$keycode].'<br>';
|
||||
if ($_POST[$keycode] == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && empty($_POST[$keycode]))) $sql .= "null"; // lang must be '' if not defined so the unique key that include lang will work
|
||||
elseif ($_POST[$keycode] == '0' && $keycode == 'langcode') $sql .= "''"; // lang must be '' if not defined so the unique key that include lang will work
|
||||
elseif ($keycode == 'private') $sql .= ((int) $_POST[$keycode]); // private must be 0 or 1
|
||||
elseif ($keycode == 'position') $sql .= ((int) $_POST[$keycode]);
|
||||
else $sql .= "'".$db->escape($_POST[$keycode])."'";
|
||||
if (GETPOST($keycode) == '' || ($keycode != 'langcode' && $keycode != 'position' && $keycode != 'private' && !GETPOST($keycode))) $sql .= "null"; // langcode,... must be '' if not defined so the unique key that include lang will work
|
||||
elseif (GETPOST($keycode) == '0' && $keycode == 'langcode') $sql .= "''"; // langcode must be '' if not defined so the unique key that include lang will work
|
||||
elseif ($keycode == 'content') {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
|
||||
}
|
||||
elseif (in_array($keycode, array('joinfile', 'private', 'position', 'scale'))) {
|
||||
$sql .= (int) GETPOST($keycode, 'int');
|
||||
}
|
||||
else {
|
||||
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
$sql .= " WHERE ".$rowidcol." = '".$rowid."'";
|
||||
|
||||
@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("other", "admin"));
|
||||
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$dirstandard = array();
|
||||
@ -64,12 +66,12 @@ if (GETPOST("menu_handler")) $menu_handler = GETPOST("menu_handler");
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
if (!$_POST['cancel'])
|
||||
if (!$cancel)
|
||||
{
|
||||
$leftmenu = ''; $mainmenu = '';
|
||||
if (!empty($_POST['menuIdParent']) && !is_numeric($_POST['menuIdParent']))
|
||||
if (GETPOST('menuIdParent', 'alpha') && !is_numeric(GETPOST('menuIdParent', 'alpha')))
|
||||
{
|
||||
$tmp = explode('&', $_POST['menuIdParent']);
|
||||
$tmp = explode('&', GETPOST('menuIdParent', 'alpha'));
|
||||
foreach ($tmp as $s)
|
||||
{
|
||||
if (preg_match('/fk_mainmenu=/', $s))
|
||||
@ -138,7 +140,7 @@ if ($action == 'update')
|
||||
|
||||
if ($action == 'add')
|
||||
{
|
||||
if ($_POST['cancel'])
|
||||
if ($cancel)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
|
||||
exit;
|
||||
|
||||
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
@ -48,14 +48,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstmrp=GETPOST('maskconstMo', 'alpha');
|
||||
$maskmrp=GETPOST('maskMo', 'alpha');
|
||||
$maskconstmrp = GETPOST('maskconstMo', 'alpha');
|
||||
$maskmrp = GETPOST('maskMo', 'alpha');
|
||||
|
||||
if ($maskconstmrp) $res = dolibarr_set_const($db, $maskconstmrp, $maskmrp, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -67,20 +67,20 @@ if ($action == 'updateMask')
|
||||
|
||||
elseif ($action == 'specimen')
|
||||
{
|
||||
$modele=GETPOST('module', 'alpha');
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$mo = new MO($db);
|
||||
$mrp->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file=''; $classname=''; $filefound=0;
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach($dirmodels as $reldir)
|
||||
$file = ''; $classname = ''; $filefound = 0;
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file=dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
|
||||
$file = dol_buildpath($reldir."core/modules/mrp/doc/pdf_".$modele.".modules.php", 0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$filefound = 1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
@ -156,9 +156,9 @@ elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
|
||||
$draft = GETPOST("MRP_MO_DRAFT_WATERMARK");
|
||||
$res = dolibarr_set_const($db, "MRP_MO_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -170,13 +170,13 @@ elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK')
|
||||
|
||||
elseif ($action == 'set_MRP_MO_FREE_TEXT')
|
||||
{
|
||||
$freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string
|
||||
$freetext = GETPOST("MRP_MO_FREE_TEXT", 'none'); // No alpha here, we want exact string
|
||||
|
||||
$res = dolibarr_set_const($db, "MRP_MO_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -191,13 +191,13 @@ elseif ($action == 'set_MRP_MO_FREE_TEXT')
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader("", $langs->trans("MrpSetupPage"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("MrpSetupPage"), $linkback, 'title_setup');
|
||||
|
||||
$head = mrpAdminPrepareHead();
|
||||
@ -230,18 +230,18 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
if (substr($file, 0, 7) == 'mod_mo_' && substr($file, dol_strlen($file) - 3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||
|
||||
if ($module->isEnabled())
|
||||
@ -252,9 +252,9 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||
elseif ($tmp == 'NotConfigured') print $langs->trans($tmp);
|
||||
else print $tmp;
|
||||
print '</td>'."\n";
|
||||
|
||||
@ -271,22 +271,22 @@ foreach ($dirmodels as $reldir)
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$mrp=new MO($db);
|
||||
$mrp = new MO($db);
|
||||
$mrp->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$mrp->type=0;
|
||||
$nextval=$module->getNextValue($mysoc, $mrp);
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$mrp->type = 0;
|
||||
$nextval = $module->getNextValue($mysoc, $mrp);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured')
|
||||
$nextval = $langs->trans($nextval);
|
||||
$htmltooltip.=$nextval.'<br>';
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,14 +314,14 @@ print load_fiche_titre($langs->trans("MOsModelModule"), '', '');
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql .= " WHERE type = '".$type."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num_rows=$db->num_rows($resql);
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows)
|
||||
{
|
||||
$array = $db->fetch_array($resql);
|
||||
@ -349,43 +349,43 @@ clearstatcache();
|
||||
|
||||
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))
|
||||
{
|
||||
$handle=opendir($dir);
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
foreach ($filelist as $file)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db);
|
||||
|
||||
$modulequalified=1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0;
|
||||
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0;
|
||||
|
||||
if ($modulequalified)
|
||||
{
|
||||
$var = !$var;
|
||||
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";
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -420,15 +420,17 @@ foreach ($dirmodels as $reldir)
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf')
|
||||
{
|
||||
$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><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("WatermarkOnDraftMOs").': '.yn($module->option_draft_watermark, 1, 1);
|
||||
|
||||
|
||||
print '<td class="center">';
|
||||
@ -472,18 +474,18 @@ print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "<td> </td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
foreach ($substitutionarray as $key => $val) $htmltext .= $key.'<br>';
|
||||
$htmltext .= '</i>';
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set_MRP_MO_FREE_TEXT">';
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnMOs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
|
||||
$variablename='MRP_MO_FREE_TEXT';
|
||||
$variablename = 'MRP_MO_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
@ -491,7 +493,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
$doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td><td class="right">';
|
||||
|
||||
@ -53,6 +53,7 @@ if ($action == 'setvalue' && $user->admin)
|
||||
if (!$error && is_array($_POST))
|
||||
{
|
||||
//var_dump($_POST);
|
||||
$reg = array();
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
if (!preg_match('/^NOTIF_(.*)_key$/', $key, $reg)) continue;
|
||||
@ -113,10 +114,12 @@ llxHeader('', $langs->trans("NotificationSetup"));
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("NotificationSetup"), $linkback, 'title_setup');
|
||||
|
||||
print '<span class="opacitymedium">';
|
||||
print $langs->trans("NotificationsDesc").'<br>';
|
||||
print $langs->trans("NotificationsDescUser").'<br>';
|
||||
if (!empty($conf->societe->enabled)) print $langs->trans("NotificationsDescContact").'<br>';
|
||||
print $langs->trans("NotificationsDescGlobal").'<br>';
|
||||
print '</span>';
|
||||
print '<br>';
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
use OAuth\Common\Storage\DoliStorage;
|
||||
|
||||
@ -59,9 +59,18 @@ if ($action == 'setconst' && $user->admin)
|
||||
{
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
foreach ($_POST['setupdriver'] as $setupconst) {
|
||||
|
||||
$setupconstarray = GETPOST('setupdriver', 'array');
|
||||
|
||||
foreach ($setupconstarray as $setupconst) {
|
||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||
$result = dolibarr_set_const($db, $setupconst['varname'], $setupconst['value'], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
$constname = dol_escape_htmltag($setupconst['varname']);
|
||||
$constvalue = dol_escape_htmltag($setupconst['value']);
|
||||
$consttype = dol_escape_htmltag($setupconst['type']);
|
||||
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||
|
||||
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
}
|
||||
|
||||
@ -119,6 +128,9 @@ $head = oauthadmin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
||||
|
||||
if (GETPOST('error')) {
|
||||
setEventMessages(GETPOST('error'), null, 'errors');
|
||||
}
|
||||
|
||||
if ($mode == 'setup' && $user->admin)
|
||||
{
|
||||
@ -135,17 +147,21 @@ if ($mode == 'setup' && $user->admin)
|
||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'GitHub';
|
||||
$state='user,public_repo'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
}
|
||||
elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'Google';
|
||||
$state='userinfo_email,userinfo_profile,cloud_print'; // List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service)
|
||||
//$state.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state='.$state.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
}
|
||||
|
||||
@ -41,13 +41,13 @@ $extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='commande'; //Must be the $table_element of the class that manage extrafield
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'commande'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@ -64,11 +64,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Orders");
|
||||
$textobject = $langs->transnoentitiesnoconv("Orders");
|
||||
|
||||
llxHeader('', $langs->trans("OrdersSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = order_admin_prepare_head();
|
||||
@ -108,7 +108,7 @@ if ($action == 'create')
|
||||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
@ -42,13 +42,13 @@ $extrafields = new ExtraFields($db);
|
||||
$form = new Form($db);
|
||||
|
||||
// List of supported format
|
||||
$tmptype2label=ExtraFields::$type2label;
|
||||
$type2label=array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
|
||||
$tmptype2label = ExtraFields::$type2label;
|
||||
$type2label = array('');
|
||||
foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$attrname=GETPOST('attrname', 'alpha');
|
||||
$elementtype='commandedet'; //Must be the $table_element of the class that manage extrafield
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$attrname = GETPOST('attrname', 'alpha');
|
||||
$elementtype = 'commandedet'; //Must be the $table_element of the class that manage extrafield
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
@ -65,11 +65,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
$textobject=$langs->transnoentitiesnoconv("Orders");
|
||||
$textobject = $langs->transnoentitiesnoconv("Orders");
|
||||
|
||||
llxHeader('', $langs->trans("OrdersSetup"));
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("OrdersSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = order_admin_prepare_head();
|
||||
@ -109,7 +109,7 @@ if ($action == 'create')
|
||||
/* Edition of an optional field */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && ! empty($attrname))
|
||||
if ($action == 'edit' && !empty($attrname))
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
|
||||
@ -58,12 +58,13 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", $_POST["MAIN_PDF_MARGIN_TOP"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", $_POST["MAIN_PDF_MARGIN_BOTTOM"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", $_POST["MAIN_PROFID1_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", $_POST["MAIN_PROFID2_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", $_POST["MAIN_PROFID3_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", $_POST["MAIN_PROFID4_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", $_POST["MAIN_PROFID5_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", $_POST["MAIN_PROFID6_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID2_IN_ADDRESS", GETPOST("MAIN_PROFID2_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID3_IN_ADDRESS", GETPOST("MAIN_PROFID3_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID4_IN_ADDRESS", GETPOST("MAIN_PROFID4_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID5_IN_ADDRESS", GETPOST("MAIN_PROFID5_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PROFID6_IN_ADDRESS", GETPOST("MAIN_PROFID6_IN_ADDRESS", "nohtml"), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT", $_POST["MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_TVAINTRA_NOT_IN_ADDRESS", $_POST["MAIN_TVAINTRA_NOT_IN_ADDRESS"], 'chaine', 0, '', $conf->entity);
|
||||
@ -79,6 +80,9 @@ if ($action == 'update')
|
||||
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_SECOND_TAX", $_POST["MAIN_PDF_MAIN_HIDE_SECOND_TAX"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_PDF_MAIN_HIDE_THIRD_TAX", $_POST["MAIN_PDF_MAIN_HIDE_THIRD_TAX"], 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "PDF_USE_ALSO_LANGUAGE_CODE", GETPOST('PDF_USE_ALSO_LANGUAGE_CODE', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
}
|
||||
@ -295,6 +299,16 @@ print '<tr class="oddeven"><td>'.$langs->trans("ShowDetailsInPDFPageFoot").'</td
|
||||
print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PDF_USE_ALSO_LANGUAGE_CODE").'</td><td>';
|
||||
//if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
//{
|
||||
print $formadmin->select_language(GETPOSTISSET('PDF_USE_ALSO_LANGUAGE_CODE') ? GETPOST('PDF_USE_ALSO_LANGUAGE_CODE') : $conf->global->PDF_USE_ALSO_LANGUAGE_CODE, 'PDF_USE_ALSO_LANGUAGE_CODE', 0, null, 1);
|
||||
//} else {
|
||||
// print '<span class="opacitymedium">'.$langs->trans("MultiLangNotEnabled").'</span>';
|
||||
//}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$entity=$conf->entity;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -70,14 +72,12 @@ print '<span class="opacitymedium">'.$langs->trans("DefaultRightsDesc")." ".$lan
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Charge les modules soumis a permissions
|
||||
// Search all modules with permission and reload permissions def.
|
||||
$modules = array();
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
foreach ($modulesdir as $dir)
|
||||
{
|
||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
||||
//print $dir."\n<br>";
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
@ -102,7 +102,7 @@ foreach ($modulesdir as $dir)
|
||||
// Load all permissions
|
||||
if ($objMod->rights_class)
|
||||
{
|
||||
$ret = $objMod->insert_permissions(0);
|
||||
$ret = $objMod->insert_permissions(0, $entity);
|
||||
$modules[$objMod->rights_class] = $objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
@ -122,35 +122,58 @@ dol_fiche_head($head, 'default', $langs->trans("Security"), -1);
|
||||
// Show warning about external users
|
||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
|
||||
print "\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Show permissions lines
|
||||
$sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td class="center"> </td>';
|
||||
print '<td class="center">'.$langs->trans("Default").'</td>';
|
||||
print '<td>'.$langs->trans("Permissions").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
//print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS;
|
||||
$sql = "SELECT r.id, r.libelle as label, r.module, r.module_position, r.perms, r.subperms, r.bydefault";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$sql .= " AND r.entity = ".$entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
$sql .= " ORDER BY r.module, r.id";
|
||||
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$oldmod = "";
|
||||
$oldmod = '';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||
if (!$modules[$obj->module])
|
||||
// If line is for a module that doe snot existe anymore (absent of includes/module), we ignore it
|
||||
if (empty($modules[$obj->module]))
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Save field module_position in database if value is still zero
|
||||
if (empty($obj->module_position))
|
||||
{
|
||||
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
|
||||
{
|
||||
// TODO Define familyposition
|
||||
$family = $modules[$obj->module]->family_position;
|
||||
$familyposition = 0;
|
||||
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.",";
|
||||
$sqlupdate.= " family_position = ".$familyposition;
|
||||
$sqlupdate.= " WHERE module_position = 0 AND module = '".$db->escape($obj->module)."'";
|
||||
$db->query($sqlupdate);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if permission we found is inside a module definition. If not, we discard it.
|
||||
$found = false;
|
||||
foreach ($modules[$obj->module]->rights as $key => $val)
|
||||
@ -169,49 +192,65 @@ if ($result)
|
||||
}
|
||||
|
||||
// Break found, it's a new module to catch
|
||||
if ($oldmod <> $obj->module)
|
||||
if (isset($obj->module) && ($oldmod <> $obj->module))
|
||||
{
|
||||
$oldmod = $obj->module;
|
||||
|
||||
// Break detected, we get objMod
|
||||
$objMod = $modules[$obj->module];
|
||||
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
print '<td>'.$langs->trans("Permission").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Default").'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print "</tr>\n";
|
||||
// Show break line
|
||||
print '<tr class="oddeven trforbreak">';
|
||||
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
|
||||
print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"></a>';
|
||||
print '</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->label));
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"> </a>';
|
||||
|
||||
// Picto and label of module
|
||||
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
|
||||
//print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName();
|
||||
//print '<a name="'.$objMod->getName().'"> </a>';
|
||||
print '</td>';
|
||||
|
||||
$perm_libelle = ($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id) != ("PermissionAdvanced".$obj->id)) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != ("Permission".$obj->id)) ? $langs->trans("Permission".$obj->id) : $obj->libelle));
|
||||
// Tick
|
||||
if ($obj->bydefault == 1)
|
||||
{
|
||||
print '<td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||
print '</td>';
|
||||
print '<td class="center">';
|
||||
print ' ';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Permission and tick
|
||||
print '<td>'.$perm_libelle.'</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($obj->bydefault == 1)
|
||||
{
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
print '</td><td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=remove">'.img_edit_remove().'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print ' ';
|
||||
print '</td><td>';
|
||||
print '<a class="reposition" href="perms.php?pid='.$obj->id.'&action=add">'.img_edit_add().'</a>';
|
||||
}
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
else dol_print_error($db);
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -271,7 +271,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/propale/");
|
||||
$dir = dol_buildpath($reldir."core/modules/propale");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -399,7 +399,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -474,7 +475,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -221,7 +221,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/reception/");
|
||||
$dir = dol_buildpath($reldir."core/modules/reception");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -234,7 +234,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -353,7 +353,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -427,7 +428,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("users","admin","other"));
|
||||
$langs->loadLangs(array("users", "admin", "other"));
|
||||
|
||||
if (! $user->admin)
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
|
||||
|
||||
@ -44,8 +44,8 @@ $action=GETPOST('action', 'alpha');
|
||||
|
||||
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
$value=(GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
$code = $reg[1];
|
||||
$value = (GETPOST($code, 'alpha') ? GETPOST($code, 'alpha') : 1);
|
||||
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -56,7 +56,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
dol_print_error($db);
|
||||
}
|
||||
} elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) {
|
||||
$code=$reg[1];
|
||||
$code = $reg[1];
|
||||
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
@ -70,8 +70,8 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
|
||||
|
||||
elseif ($action == 'updateform')
|
||||
{
|
||||
$res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"], 'chaine', 0, '', $conf->entity);
|
||||
$res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"], 'chaine', 0, '', $conf->entity);
|
||||
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
$res2 = dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", GETPOST("MAIN_SESSION_TIMEOUT", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
if ($res1 && $res2) setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ elseif ($action == 'updateform')
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
|
||||
$wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
|
||||
llxHeader('', $langs->trans("Miscellaneous"), $wikihelp);
|
||||
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"), '', 'title_setup');
|
||||
@ -97,7 +97,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateform">';
|
||||
|
||||
$head=security_prepare_head();
|
||||
$head = security_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'misc', $langs->trans("Security"), -1);
|
||||
|
||||
@ -115,7 +115,7 @@ print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
|
||||
print '<td class="right">';
|
||||
if (function_exists("imagecreatefrompng"))
|
||||
{
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA');
|
||||
}
|
||||
@ -142,7 +142,7 @@ print '</td></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
|
||||
print '<td class="right">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
if (!empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS');
|
||||
}
|
||||
@ -173,8 +173,8 @@ print '<td>'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$sessiontimeout=ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout;
|
||||
$sessiontimeout = ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT = $sessiontimeout;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SessionTimeOut").'</td><td class="right">';
|
||||
print $form->textwithpicto('', $langs->trans("SessionExplanation", ini_get("session.gc_probability"), ini_get("session.gc_divisor")));
|
||||
@ -185,8 +185,8 @@ print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$sessiontimeout=ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE="";
|
||||
$sessiontimeout = ini_get("session.gc_maxlifetime");
|
||||
if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE = "";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("MAIN_APPLICATION_TITLE").'</td><td class="right">';
|
||||
print '</td>';
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "admin", "products", "sms", "other", "errors"));
|
||||
|
||||
$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
@ -46,14 +48,13 @@ $action = GETPOST('action', 'aZ09');
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && empty($_POST["cancel"]))
|
||||
if ($action == 'update' && !$cancel)
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", $_POST["MAIN_DISABLE_ALL_SMS"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_DISABLE_ALL_SMS", GETPOST("MAIN_DISABLE_ALL_SMS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", $_POST["MAIN_SMS_SENDMODE"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_SMS_SENDMODE", GETPOST("MAIN_SMS_SENDMODE", 'alphahtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", $_POST["MAIN_MAIL_SMS_FROM"], 'chaine', 0, '', $conf->entity);
|
||||
//dolibarr_set_const($db, "MAIN_MAIL_AUTOCOPY_TO", $_POST["MAIN_MAIL_AUTOCOPY_TO"], 'chaine', 0, '', $conf->entity);
|
||||
dolibarr_set_const($db, "MAIN_MAIL_SMS_FROM", GETPOST("MAIN_MAIL_SMS_FROM", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
|
||||
exit;
|
||||
@ -68,15 +69,15 @@ if ($action == 'send' && !$_POST['cancel'])
|
||||
$error = 0;
|
||||
|
||||
$smsfrom = '';
|
||||
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms");
|
||||
if (empty($smsfrom)) $smsfrom = GETPOST("fromname");
|
||||
$sendto = GETPOST("sendto");
|
||||
$body = GETPOST('message');
|
||||
$deliveryreceipt = GETPOST("deliveryreceipt");
|
||||
$deferred = GETPOST('deferred');
|
||||
$priority = GETPOST('priority');
|
||||
$class = GETPOST('class');
|
||||
$errors_to = GETPOST("errorstosms");
|
||||
if (!empty($_POST["fromsms"])) $smsfrom = GETPOST("fromsms", 'alphanohtml');
|
||||
if (empty($smsfrom)) $smsfrom = GETPOST("fromname", 'alphanohtml');
|
||||
$sendto = GETPOST("sendto", 'alphanohtml');
|
||||
$body = GETPOST('message', 'alphanohtml');
|
||||
$deliveryreceipt = GETPOST("deliveryreceipt", 'alphanohtml');
|
||||
$deferred = GETPOST('deferred', 'alphanohtml');
|
||||
$priority = GETPOST('priority', 'alphanohtml');
|
||||
$class = GETPOST('class', 'alphanohtml');
|
||||
$errors_to = GETPOST("errorstosms", 'alphanohtml');
|
||||
|
||||
// Create form object
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formsms.class.php';
|
||||
|
||||
@ -35,10 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("admin", "members", "mailmanspip"));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
|
||||
$type=array('yesno','texte','chaine');
|
||||
$type = array('yesno', 'texte', 'chaine');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@ -50,25 +50,27 @@ $action = GETPOST('action', 'aZ09');
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
$constname=GETPOST("constname");
|
||||
$constvalue=GETPOST("constvalue");
|
||||
$constnamearray = GETPOST("constname", 'array');
|
||||
$constvaluearray = GETPOST("constvalue", 'array');
|
||||
$consttypearray = GETPOST("consttype", 'array');
|
||||
$constnotearray = GETPOST("constnote", 'array');
|
||||
|
||||
// Action mise a jour ou ajout d'une constante
|
||||
if ($action == 'update' || $action == 'add')
|
||||
{
|
||||
foreach($_POST['constname'] as $key => $val)
|
||||
foreach ($constnamearray as $key => $val)
|
||||
{
|
||||
$constname=$_POST["constname"][$key];
|
||||
$constvalue=$_POST["constvalue"][$key];
|
||||
$consttype=$_POST["consttype"][$key];
|
||||
$constnote=$_POST["constnote"][$key];
|
||||
$constname = dol_escape_htmltag($constnamearray[$key]);
|
||||
$constvalue = dol_escape_htmltag($constvaluearray[$key]);
|
||||
$consttype = dol_escape_htmltag($consttypearray[$key]);
|
||||
$constnote = dol_escape_htmltag($constnotearray[$key]);
|
||||
|
||||
$res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
|
||||
$res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
if (!$res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
if (!$error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
@ -82,7 +84,7 @@ if ($action == 'update' || $action == 'add')
|
||||
// Action activation d'un sous module du module adherent
|
||||
if ($action == 'set')
|
||||
{
|
||||
$result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
|
||||
$result = dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
@ -92,7 +94,7 @@ if ($action == 'set')
|
||||
// Action desactivation d'un sous module du module adherent
|
||||
if ($action == 'unset')
|
||||
{
|
||||
$result=dolibarr_del_const($db, $_GET["name"], $conf->entity);
|
||||
$result = dolibarr_del_const($db, $_GET["name"], $conf->entity);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
@ -105,12 +107,12 @@ if ($action == 'unset')
|
||||
* View
|
||||
*/
|
||||
|
||||
$help_url='';
|
||||
$help_url = '';
|
||||
|
||||
llxHeader('', $langs->trans("MailmanSpipSetup"), $help_url);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("MailmanSpipSetup"), $linkback, 'title_setup');
|
||||
|
||||
|
||||
@ -120,7 +122,7 @@ $head = mailmanspip_admin_prepare_head();
|
||||
/*
|
||||
* Spip
|
||||
*/
|
||||
if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
if (!empty($conf->global->ADHERENT_USE_SPIP))
|
||||
{
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
@ -129,12 +131,12 @@ if (! empty($conf->global->ADHERENT_USE_SPIP))
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), -1, 'user');
|
||||
|
||||
//$link=img_picto($langs->trans("Active"),'tick').' ';
|
||||
$link='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
$link = '<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Disable");
|
||||
$link.=img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$link.='</a>';
|
||||
$link .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$link .= '</a>';
|
||||
// Edition des varibales globales
|
||||
$constantes=array(
|
||||
$constantes = array(
|
||||
'ADHERENT_SPIP_SERVEUR',
|
||||
'ADHERENT_SPIP_DB',
|
||||
'ADHERENT_SPIP_USER',
|
||||
@ -156,10 +158,10 @@ else
|
||||
{
|
||||
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
|
||||
|
||||
$link='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
$link = '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=set&value=1&name=ADHERENT_USE_SPIP">';
|
||||
//$link.=$langs->trans("Activate");
|
||||
$link.=img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$link.='</a>';
|
||||
$link .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$link .= '</a>';
|
||||
print load_fiche_titre($langs->trans('SPIPTitle'), $link, '');
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -461,6 +461,7 @@ print "</tr>\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
/*
|
||||
print '<br>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
@ -471,7 +472,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Example with a yes / no select
|
||||
/*print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
|
||||
print '<td class="center">';
|
||||
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 '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// 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 class="center">';
|
||||
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 '</td></tr>';
|
||||
*/
|
||||
|
||||
|
||||
// Example with a yes / no select
|
||||
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 '</td></tr>';
|
||||
|
||||
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.
|
||||
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']);
|
||||
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))
|
||||
{
|
||||
$filefound = 1;
|
||||
@ -171,7 +171,7 @@ if ($action == 'setmod')
|
||||
if ($action == 'addcat')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->CreateCategory($user, $_POST["cat"]);
|
||||
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
|
||||
}
|
||||
|
||||
if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
|
||||
@ -230,7 +230,7 @@ clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice/");
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_invoice");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -243,7 +243,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -360,7 +360,8 @@ clearstatcache();
|
||||
|
||||
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))
|
||||
{
|
||||
@ -385,7 +386,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -434,6 +435,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -54,6 +54,8 @@ $specimenthirdparty->initAsSpecimen();
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
@ -86,7 +88,7 @@ elseif ($action == 'specimen') // For orders
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
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))
|
||||
{
|
||||
$filefound = 1;
|
||||
@ -163,7 +165,7 @@ elseif ($action == 'setmod')
|
||||
elseif ($action == 'addcat')
|
||||
{
|
||||
$fourn = new Fournisseur($db);
|
||||
$fourn->CreateCategory($user, $_POST["cat"]);
|
||||
$fourn->CreateCategory($user, GETPOST('cat', 'alphanohtml'));
|
||||
}
|
||||
|
||||
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
|
||||
@ -388,7 +390,8 @@ clearstatcache();
|
||||
|
||||
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))
|
||||
{
|
||||
@ -411,7 +414,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -456,6 +459,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
|
||||
|
||||
@ -332,7 +332,8 @@ clearstatcache();
|
||||
|
||||
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))
|
||||
{
|
||||
@ -356,7 +357,7 @@ foreach ($dirmodels as $reldir)
|
||||
print (empty($module->name) ? $name : $module->name);
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
require_once $dir.$file;
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $classname($db, $specimenthirdparty);
|
||||
if (method_exists($module, 'info')) print $module->info($langs);
|
||||
else print $module->description;
|
||||
@ -405,6 +406,8 @@ foreach ($dirmodels as $reldir)
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$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("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
print '<td class="center">';
|
||||
|
||||
@ -239,7 +239,7 @@ print '</tr>'."\n";
|
||||
clearstatcache();
|
||||
foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal/");
|
||||
$dir = dol_buildpath($reldir."core/modules/supplier_proposal");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
@ -252,7 +252,7 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
@ -366,7 +366,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@ -440,7 +441,9 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$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("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
|
||||
|
||||
@ -49,12 +49,15 @@ $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]);
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.$_SERVER['HTTP_USER_AGENT'].'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("UserAgent").'</td><td colspan="2">'.dol_escape_htmltag($_SERVER['HTTP_USER_AGENT']).'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserName").'</td><td colspan="2">'.$tmp['browsername'].'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("BrowserOS").'</td><td colspan="2">'.$tmp['browseros'].'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("Version").'</td><td colspan="2">'.$tmp['browserversion'].'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("Layout").' (phone/tablet/classic)</td><td colspan="2">'.$tmp['layout'].'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.$_SERVER['REMOTE_ADDR'].'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.dol_escape_htmltag($_SERVER['REMOTE_ADDR']);
|
||||
if (! empty($_SERVER['HTTP_CLIENT_IP'])) print ' (HTTP_CLIENT_IP='.dol_escape_htmltag($_SERVER['HTTP_CLIENT_IP']).')';
|
||||
if (! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) print ' (HTTP_X_FORWARDED_FOR='.dol_escape_htmltag($_SERVER['HTTP_X_FORWARDED_FOR']).')';
|
||||
print '</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
|
||||
print '<tr class="oddeven"><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
|
||||
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("install");
|
||||
$langs->load("errors");
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
@ -66,21 +68,123 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print "\n";
|
||||
|
||||
$ErrorPicturePath = "../../theme/eldy/img/error.png";
|
||||
$WarningPicturePath = "../../theme/eldy/img/warning.png";
|
||||
$OkayPicturePath = "../../theme/eldy/img/tick.png";
|
||||
|
||||
// Get PHP version
|
||||
$phpversion=version_php();
|
||||
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
||||
print '<tr><td width="220">'.$langs->trans("Version").'</td><td>';
|
||||
|
||||
$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 '<br>';
|
||||
|
||||
|
||||
|
||||
// Get php_info array
|
||||
$phparray=phpinfo_array();
|
||||
foreach($phparray as $key => $value)
|
||||
|
||||
@ -209,7 +209,7 @@ print "</tr>\n";
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/ticket/");
|
||||
$dir = dol_buildpath($reldir."core/modules/ticket");
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
@ -219,7 +219,7 @@ foreach ($dirmodels as $reldir) {
|
||||
$file = $reg[1];
|
||||
$classname = substr($file, 4);
|
||||
|
||||
include_once $dir.$file.'.php';
|
||||
include_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user