Merge remote-tracking branch 'Dolibarr/11.0' into 11

This commit is contained in:
Francis Appels 2020-12-01 16:04:11 +01:00
commit 5ec351911d
110 changed files with 1021 additions and 572 deletions

View File

@ -5,13 +5,15 @@
# We use dist: trusty to have php 5.4+ available # We use dist: trusty to have php 5.4+ available
os: linux os: linux
dist: trusty dist: trusty
sudo: required #sudo: required
language: php language: php
# Start on every boot # Start on every boot
services: services:
- memcached - memcached
- mysql
- postgresql
addons: addons:
mariadb: '10.0' mariadb: '10.0'
@ -29,60 +31,25 @@ addons:
# We need pgloader for import mysql database into pgsql # We need pgloader for import mysql database into pgsql
- pgloader - pgloader
php:
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- nightly
env: env:
global: global:
# Set to true for very verbose output # Set to true for very verbose output
- DEBUG=false - DEBUG=false
jobs:
# MariaDB overrides MySQL installation so it's not possible to test both yet
#- DB=mysql
- DB=mariadb
- 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
#- WS=nginx
jobs: jobs:
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- php: nightly - php: nightly
# We exclude some combinations not usefull to save Travis CPU include:
exclude: - if: type = push
- php: '5.6' php: '5.5'
env: DB=mariadb
- php: '7.0'
env: DB=mariadb
- php: '7.1'
env: DB=mariadb
- php: '7.2'
env: DB=mariadb
- php: '7.3'
env: DB=mariadb
- php: '5.6'
env: DB=postgresql
- php: '7.0'
env: DB=postgresql
- php: '7.1'
env: DB=postgresql
- php: '7.2'
env: DB=postgresql
- php: '7.3'
env: DB=postgresql
- php: nightly
env: DB=postgresql env: DB=postgresql
- if: type = pull_request OR type = push
php: '7.4'
env: DB=mysql
- if: type = push AND branch = develop
php: nightly
env: DB=mysql
notifications: notifications:
email: email:
@ -115,11 +82,13 @@ install:
echo "Updating Composer" echo "Updating Composer"
rm $TRAVIS_BUILD_DIR/composer.json rm $TRAVIS_BUILD_DIR/composer.json
rm $TRAVIS_BUILD_DIR/composer.lock rm $TRAVIS_BUILD_DIR/composer.lock
composer -V
composer self-update composer self-update
# To have composer making parallel downloads # To have composer making parallel downloads
composer global require hirak/prestissimo composer global require hirak/prestissimo
composer -n init composer -n init
composer -n config vendor-dir htdocs/includes composer -n config vendor-dir htdocs/includes
composer -n config -g vendor-dir htdocs/includes
echo echo
- | - |
@ -148,6 +117,9 @@ install:
- | - |
echo "Adding path of binaries tools installed by composer to the PATH" echo "Adding path of binaries tools installed by composer to the PATH"
export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH" export PATH="$TRAVIS_BUILD_DIR/htdocs/includes/bin:$PATH"
echo $PATH
ls $TRAVIS_BUILD_DIR/vendor
ls $TRAVIS_BUILD_DIR/htdocs/includes/bin
echo echo
@ -174,15 +146,16 @@ before_script:
- | - |
echo "Versions information" echo "Versions information"
echo
# Check PHP # Check PHP
echo "PHP version" echo "PHP version"
php -i | head - php -i | head -
# Check PHP CodeSniffer installation # Check PHP CodeSniffer version
echo "PHPCS version" echo "PHPCS version"
which phpcs which phpcs
phpcs --version | head - phpcs --version | head -
phpcs -i | head - phpcs -i | head -
# Check PHPUnit installation # Check PHPUnit version
echo "PHPUnit version" echo "PHPUnit version"
which phpunit which phpunit
phpunit --version | head - phpunit --version | head -
@ -263,10 +236,7 @@ before_script:
- sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
- sudo chown -R travis:travis /var/lib/apache2/fastcgi - sudo chown -R travis:travis /var/lib/apache2/fastcgi
- ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
# configure apache virtual hosts for precise # configure apache virtual hosts
#- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/default
#- sudo cat /etc/apache2/sites-available/default
# configure apache virtual hosts for trusty
- sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf - sudo cp -f build/travis-ci/apache.conf /etc/apache2/sites-available/000-default.conf
- sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
- sudo cat /etc/apache2/sites-available/000-default.conf - sudo cat /etc/apache2/sites-available/000-default.conf
@ -291,17 +261,18 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
#parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame . parallel-lint --exclude dev/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/webmozart --exclude htdocs/includes/phpspec --exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/phpexcel/Classes/PHPExcel/Shared --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e set +e
echo echo
- | - |
echo "Checking coding style (excluding Pull Requests builds)" echo "Checking coding style (excluding Pull Requests builds to not overload travis, excluding also some jobs to avoid duplicate tests)"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .;
fi
set +e set +e
echo echo
@ -430,7 +401,7 @@ script:
after_script: after_script:
- | - |
echo "After script - Output lines of dolibarr.log" echo "After script - Output last lines of dolibarr.log"
ls $TRAVIS_BUILD_DIR/documents ls $TRAVIS_BUILD_DIR/documents
#cat $TRAVIS_BUILD_DIR/documents/dolibarr.log #cat $TRAVIS_BUILD_DIR/documents/dolibarr.log
sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log sudo tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
@ -456,7 +427,7 @@ after_failure:
# Dolibarr log file # Dolibarr log file
echo "Debugging informations for file dolibarr.log (latest 50 lines)" echo "Debugging informations for file dolibarr.log (latest 50 lines)"
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
# MariaDB log file # Database log file
echo "Debugging informations for file mysql error.log" echo "Debugging informations for file mysql error.log"
sudo tail -n 50 /var/log/mysql/error.log sudo tail -n 50 /var/log/mysql/error.log
# TODO: PostgreSQL log file # TODO: PostgreSQL log file

View File

@ -8,6 +8,7 @@ ALL:
Check "@CHANGE" Check "@CHANGE"
PrestaShopWebservice: PrestaShopWebservice:
--------------------- ---------------------
Replace Replace
@ -27,6 +28,19 @@ With
DEBUGBAR:
---------
Move
this.options = {
bodyMarginBottom: true,
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
};
few line lower in the
initialize: function() {
ESCPOS: ESCPOS:
------- -------
Replace Replace

View File

@ -365,6 +365,7 @@ class AccountancyExport
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date.$separator; print $date.$separator;
print $line->code_journal.$separator; print $line->code_journal.$separator;
print length_accountg($line->numero_compte).$separator; print length_accountg($line->numero_compte).$separator;
@ -373,7 +374,7 @@ class AccountancyExport
print price($line->debit).$separator; print price($line->debit).$separator;
print price($line->credit).$separator; print price($line->credit).$separator;
print 'E'.$separator; print 'E'.$separator;
print length_accountg($line->subledger_account).$separator; print length_accounta($line->subledger_account).$separator;
print $end_line; print $end_line;
} }
} }
@ -708,8 +709,8 @@ class AccountancyExport
foreach ($objectLines as $line) { foreach ($objectLines as $line) {
$date_creation = dol_print_date($line->date_creation, '%Y%m%d'); $date_creation = dol_print_date($line->date_creation, '%Y%m%d');
$date_doc = dol_print_date($line->doc_date, '%Y%m%d'); $date_document = dol_print_date($line->doc_date, '%Y%m%d');
$date_valid = dol_print_date($line->date_validated, '%Y%m%d'); $date_validation = dol_print_date($line->date_validated, '%Y%m%d');
// FEC:JournalCode // FEC:JournalCode
print $line->code_journal.$separator; print $line->code_journal.$separator;
@ -721,25 +722,25 @@ class AccountancyExport
print $line->piece_num.$separator; print $line->piece_num.$separator;
// FEC:EcritureDate // FEC:EcritureDate
print $date_creation.$separator; print $date_document . $separator;
// FEC:CompteNum // FEC:CompteNum
print $line->numero_compte.$separator; print $line->numero_compte.$separator;
// FEC:CompteLib // FEC:CompteLib
print $line->label_compte.$separator; print dol_string_unaccent($line->label_compte) . $separator;
// FEC:CompAuxNum // FEC:CompAuxNum
print $line->subledger_account.$separator; print $line->subledger_account.$separator;
// FEC:CompAuxLib // FEC:CompAuxLib
print $line->subledger_label.$separator; print dol_string_unaccent($line->subledger_label) . $separator;
// FEC:PieceRef // FEC:PieceRef
print $line->doc_ref.$separator; print $line->doc_ref.$separator;
// FEC:PieceDate // FEC:PieceDate
print $date_doc.$separator; print dol_string_unaccent($date_creation) . $separator;
// FEC:EcritureLib // FEC:EcritureLib
print $line->label_operation.$separator; print $line->label_operation.$separator;
@ -757,7 +758,7 @@ class AccountancyExport
print $line->date_lettering.$separator; print $line->date_lettering.$separator;
// FEC:ValidDate // FEC:ValidDate
print $date_valid.$separator; print $date_validation . $separator;
// FEC:Montantdevise // FEC:Montantdevise
print $line->multicurrency_amount.$separator; print $line->multicurrency_amount.$separator;

View File

@ -863,7 +863,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print " " . $sep; print " " . $sep;
print '"' . $reflabel . '"' . $sep; print '"' . $reflabel . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
@ -893,7 +893,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"' . $key . '"' . $sep; print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
if ($tabtype[$key] == 'payment_supplier') { if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} elseif($tabtype[$key] == 'payment') { } elseif($tabtype[$key] == 'payment') {
@ -903,7 +903,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
} elseif($tabtype[$key] == 'payment_salary') { } elseif($tabtype[$key] == 'payment_salary') {
print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep; print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
} else { } else {
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
} }
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $reflabel . '"' . $sep; print '"' . $reflabel . '"' . $sep;
@ -926,7 +926,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"' . length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print "" . $sep; print "" . $sep;
print '"' . $reflabel . '"' . $sep; print '"' . $reflabel . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
@ -1130,7 +1130,7 @@ if (empty($action) || $action == 'view') {
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT; if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT; if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"]; if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"];
$accounttoshow = length_accounta($account_ledger); $accounttoshow = length_accountg($account_ledger);
if (empty($accounttoshow) || $accounttoshow == 'NotDefined') if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
{ {
if ($tabtype[$key] == 'unknown') if ($tabtype[$key] == 'unknown')

View File

@ -286,7 +286,7 @@ if (empty($reshook))
$object->firstname = trim(GETPOST("firstname", 'alphanohtml')); $object->firstname = trim(GETPOST("firstname", 'alphanohtml'));
$object->lastname = trim(GETPOST("lastname", 'alphanohtml')); $object->lastname = trim(GETPOST("lastname", 'alphanohtml'));
$object->gender = trim(GETPOST("gender", 'alphanohtml')); $object->gender = trim(GETPOST("gender", 'alphanohtml'));
$object->login = trim(GETPOST("login", 'alpha')); $object->login = trim(GETPOST("login", 'alphanohtml'));
$object->pass = trim(GETPOST("pass", 'alpha')); $object->pass = trim(GETPOST("pass", 'alpha'));
$object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated $object->societe = trim(GETPOST("societe", 'alphanohtml')); // deprecated
@ -459,7 +459,7 @@ if (empty($reshook))
// $facebook=GETPOST("member_facebook", 'alpha'); // $facebook=GETPOST("member_facebook", 'alpha');
// $linkedin=GETPOST("member_linkedin", 'alpha'); // $linkedin=GETPOST("member_linkedin", 'alpha');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha'));
$login = GETPOST("member_login", 'alpha'); $login = GETPOST("member_login", 'alphanohtml');
$pass = GETPOST("password", 'alpha'); $pass = GETPOST("password", 'alpha');
$photo = GETPOST("photo", 'alpha'); $photo = GETPOST("photo", 'alpha');
//$comment=GETPOST("comment",'none'); //$comment=GETPOST("comment",'none');
@ -941,7 +941,7 @@ else
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(isset($_POST["member_login"]) ?GETPOST("member_login", 'alpha', 2) : $object->login).'" autofocus="autofocus"></td></tr>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET("member_login") ? GETPOST("member_login", 'alphanohtml', 2) : $object->login).'" autofocus="autofocus"></td></tr>';
} }
// Password // Password
@ -1181,7 +1181,7 @@ else
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"]) ?GETPOST("login", 'alpha', 2) : $object->login).'"></td></tr>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(GETPOSTISSET("login") ? GETPOST("login", 'alphanohtml', 2) : $object->login).'"></td></tr>';
} }
// Password // Password

View File

@ -183,9 +183,9 @@ foreach ($data as $val)
$oldyear--; $oldyear--;
print '<tr class="oddeven" height="24">'; print '<tr class="oddeven" height="24">';
print '<td class="center">'; print '<td class="center">';
print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">'; //print '<a href="month.php?year='.$oldyear.'&amp;mode='.$mode.'">';
print $oldyear; print $oldyear;
print '</a>'; //print '</a>';
print '</td>'; print '</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';
print '<td class="right">0</td>'; print '<td class="right">0</td>';

View File

@ -41,9 +41,28 @@ $action = GETPOST('action', 'alpha');
/* /*
* Action * Action
*/ */
$reg = array();
if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg))
{ {
$code=$reg[1]; $code=$reg[1];
// If constant is for a unique choice, delete other choices
if (in_array($code, array('STOCK_CALCULATE_ON_BILL', 'STOCK_CALCULATE_ON_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_SHIPMENT', 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE', $conf->entity);
}
if (in_array($code, array('STOCK_CALCULATE_ON_SUPPLIER_BILL', 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', 'STOCK_CALCULATE_ON_RECEPTION', 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'))) {
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_BILL', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_RECEPTION_CLOSE', $conf->entity);
dolibarr_del_const($db, 'STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', $conf->entity);
}
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
@ -114,7 +133,7 @@ print '<td class="right">';
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); print ajax_constantonoff('STOCK_CALCULATE_ON_BILL', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
@ -134,7 +153,7 @@ print '<td class="right">';
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
@ -156,7 +175,7 @@ print '<td class="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
@ -176,7 +195,7 @@ print '<td class="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
@ -189,18 +208,12 @@ else
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
/*if (! $found)
{
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans("NoModuleToManageStockDecrease").'</td>';
print "</tr>\n";
}*/
print '</table>'; print '</table>';
print '<br>'; print '<br>';
// Title rule for stock increase // Title rule for stock increase
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -216,7 +229,7 @@ print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
@ -237,7 +250,7 @@ print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
@ -257,7 +270,7 @@ if (!empty($conf->reception->enabled))
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
@ -272,7 +285,7 @@ if (!empty($conf->reception->enabled))
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
@ -288,7 +301,7 @@ else
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER', array(), null, 0, 0, 1);
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);

View File

@ -302,7 +302,7 @@ if (in_array($type, array('mysql', 'mysqli'))) {
print '<br>'; print '<br>';
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>'; print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />'; print '<input type="checkbox" name="nobin_drop"'.(((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':'').' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>'; print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>'; print '<br>';
print '</fieldset>'; print '</fieldset>';

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -42,6 +43,8 @@ $action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'user'; $type = 'user';

View File

@ -32,7 +32,7 @@ class DolibarrApi
/** /**
* @var DoliDb $db Database object * @var DoliDb $db Database object
*/ */
protected static $db; protected $db;
/** /**
* @var Restler $r Restler object * @var Restler $r Restler object

View File

@ -781,8 +781,8 @@ class Categorie extends CommonObject
$objs = array(); $objs = array();
$tmpclass = $this->MAP_OBJ_CLASS[$type]; $classnameforobj = $this->MAP_OBJ_CLASS[$type];
$obj = new $tmpclass($this->db); $obj = new $classnameforobj($this->db);
$sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type]; $sql = "SELECT c.fk_".$this->MAP_CAT_FK[$type];
$sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_".$this->MAP_CAT_TABLE[$type]." as c";
@ -810,8 +810,11 @@ class Categorie extends CommonObject
} }
else else
{ {
$obj = new $this->MAP_OBJ_CLASS[$type]($this->db); $classnameforobj = $this->MAP_OBJ_CLASS[$type];
$obj->fetch($rec['fk_'.$this->MAP_CAT_FK[$type]]);
$obj = new $classnameforobj($this->db);
$obj->fetch($rec['fk_' . $this->MAP_CAT_FK[$type]]);
$objs[] = $obj; $objs[] = $obj;
} }
} }

View File

@ -6,7 +6,7 @@
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2019 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -3011,6 +3011,9 @@ class Propal extends CommonObject
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref)) if ($conf->propal->multidir_output[$this->entity] && !empty($this->ref))

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -3461,6 +3461,9 @@ class Commande extends CommonOrder
if (! $error) if (! $error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// Remove directory with files // Remove directory with files
$comref = dol_sanitizeFileName($this->ref); $comref = dol_sanitizeFileName($this->ref);
if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref)) if ($conf->commande->multidir_output[$this->entity] && !empty($this->ref))

View File

@ -51,8 +51,12 @@ $sens = GETPOST("sens", "int");
$amount = price2num(GETPOST("amount", "alpha")); $amount = price2num(GETPOST("amount", "alpha"));
$paymenttype = GETPOST("paymenttype", "int"); $paymenttype = GETPOST("paymenttype", "int");
$accountancy_code = GETPOST("accountancy_code", "alpha"); $accountancy_code = GETPOST("accountancy_code", "alpha");
$subledger_account = GETPOST("subledger_account", "alpha");
$projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int')); $projectid = (GETPOST('projectid', 'int') ? GETPOST('projectid', 'int') : GETPOST('fk_project', 'int'));
if (!empty($conf->accounting->enabled) && !empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
$subledger_account = GETPOST("subledger_account", "alpha") > 0 ? GETPOST("subledger_account", "alpha") : '';
} else {
$subledger_account = GETPOST("subledger_account", "alpha");
}
// Security check // Security check
$socid = GETPOST("socid", "int"); $socid = GETPOST("socid", "int");
@ -115,7 +119,7 @@ if (empty($reshook))
$object->category_transaction = GETPOST("category_transaction", 'alpha'); $object->category_transaction = GETPOST("category_transaction", 'alpha');
$object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : ""; $object->accountancy_code = GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code", "alpha") : "";
$object->subledger_account = GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""; $object->subledger_account = $subledger_account;
$object->sens = GETPOST('sens'); $object->sens = GETPOST('sens');
$object->fk_project = GETPOST('fk_project', 'int'); $object->fk_project = GETPOST('fk_project', 'int');
@ -219,9 +223,11 @@ if (empty($reshook))
} }
if ($action == 'setsubledger_account') { if ($action == 'setsubledger_account') {
$db->begin();
$result = $object->fetch($id); $result = $object->fetch($id);
$object->subledger_account = (GETPOST("subledger_account") > 0 ? GETPOST("subledger_account", "alpha") : ""); $object->subledger_account = $subledger_account;
$res = $object->update($user); $res = $object->update($user);
if ($res > 0) { if ($res > 0) {
@ -386,7 +392,7 @@ if ($action == 'create')
// Subledger account // Subledger account
if (!empty($conf->accounting->enabled)) if (!empty($conf->accounting->enabled))
{ {
print '<tr><td>'.$langs->trans("SubledgerAccount").'</td>'; print '<tr><td>'.$langs->trans("SubledgerAccount").'aaaa</td>';
print '<td>'; print '<td>';
if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
{ {

View File

@ -58,7 +58,7 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) $sortfield="v.datep,v.rowid"; if (! $sortfield) $sortfield="v.datep,v.rowid";
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC,DESC";
$filtre=GETPOST("filtre", 'alpha'); $filtre=GETPOST("filtre", 'alpha');

View File

@ -439,15 +439,36 @@ if (empty($reshook))
$object->fetch($id); $object->fetch($id);
$object->cond_reglement_code = 0; // To clean property $object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property $object->cond_reglement_id = 0; // To clean property
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) dol_print_error($db, $object->error);
$error = 0;
$db->begin();
if (! $error) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (! $error) {
$old_date_lim_reglement = $object->date_lim_reglement; $old_date_lim_reglement = $object->date_lim_reglement;
$new_date_lim_reglement = $object->calculate_date_lim_reglement(); $new_date_lim_reglement = $object->calculate_date_lim_reglement();
if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement; if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement = $new_date_lim_reglement;
if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date; if ($object->date_lim_reglement < $object->date) $object->date_lim_reglement = $object->date;
$result = $object->update($user); $result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error); if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
} }
elseif ($action == 'setpaymentterm' && $usercancreate) elseif ($action == 'setpaymentterm' && $usercancreate)
@ -976,6 +997,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate) elseif ($action == 'add' && $usercancreate)
{ {
if ($socid > 0) $object->socid = GETPOST('socid', 'int'); if ($socid > 0) $object->socid = GETPOST('socid', 'int');
$selectedLines = GETPOST('toselect', 'array');
$db->begin(); $db->begin();
@ -1565,8 +1587,11 @@ if (empty($reshook))
$fk_parent_line = 0; $fk_parent_line = 0;
$num = count($lines); $num = count($lines);
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
// Don't add lines with qty 0 when coming from a shipment including all order lines // Don't add lines with qty 0 when coming from a shipment including all order lines
if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue; if ($srcobject->element == 'shipping' && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS && $lines[$i]->qty == 0) continue;
// Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines) // Don't add closed lines when coming from a contract (Set constant to '0,5' to exclude also inactive lines)
@ -3626,8 +3651,6 @@ if ($action == 'create')
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">'; print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</div>'; print '</div>';
print "</form>\n";
// Show origin lines // Show origin lines
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
print '<br>'; print '<br>';
@ -3637,12 +3660,12 @@ if ($action == 'create')
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
$objectsrc->printOriginLinesList(); $objectsrc->printOriginLinesList('', $selectedLines);
print '</table>'; print '</table>';
} }
print '<br>'; print "</form>\n";
} }
elseif ($id > 0 || !empty($ref)) elseif ($id > 0 || !empty($ref))
{ {

View File

@ -7,7 +7,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
@ -416,7 +416,7 @@ class Facture extends CommonInvoice
$this->brouillon = 1; $this->brouillon = 1;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
if (empty($this->fk_multicurrency)) if (empty($this->fk_multicurrency))
{ {
@ -2185,6 +2185,9 @@ class Facture extends CommonInvoice
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// On efface le repertoire de pdf provisoire // On efface le repertoire de pdf provisoire
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->facture->dir_output && !empty($this->ref)) if ($conf->facture->dir_output && !empty($this->ref))

View File

@ -53,6 +53,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inv
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
$socid = GETPOST('socid', 'int');
// Security check // Security check
$id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int')); $id = (GETPOST('facid', 'int') ?GETPOST('facid', 'int') : GETPOST('id', 'int'));
$lineid = GETPOST('lineid', 'int'); $lineid = GETPOST('lineid', 'int');
@ -151,6 +153,11 @@ if ($socid > 0) {
} }
if ($socid > 0) {
$tmpthirdparty = new Societe($db);
$res = $tmpthirdparty->fetch($socid);
if ($res > 0) $search_societe = $tmpthirdparty->name;
}
/* /*
* Actions * Actions

View File

@ -180,6 +180,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$limit=5; $limit=5;
$sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " WHERE entity IN (" . getEntity('prelevement') . ")";
$sql.= " ORDER BY datec DESC"; $sql.= " ORDER BY datec DESC";
$sql.= $db->plimit($limit); $sql.= $db->plimit($limit);

View File

@ -56,6 +56,8 @@ $subcat = false;
if (GETPOST('subcat', 'alpha') === 'yes') { if (GETPOST('subcat', 'alpha') === 'yes') {
$subcat = true; $subcat = true;
} }
$categorie = new Categorie($db);
// product/service // product/service
$selected_type = GETPOST('search_type', 'int'); $selected_type = GETPOST('search_type', 'int');
if ($selected_type =='') $selected_type = -1; if ($selected_type =='') $selected_type = -1;
@ -233,10 +235,6 @@ if ($modecompta == 'CREANCES-DETTES')
{ {
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product";
} }
elseif ($selected_cat) // Into a specific category
{
$sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp";
}
$sql.= " WHERE l.fk_facture = f.rowid"; $sql.= " WHERE l.fk_facture = f.rowid";
$sql.= " AND f.fk_statut in (1,2)"; $sql.= " AND f.fk_statut in (1,2)";
$sql.= " AND l.product_type in (0,1)"; $sql.= " AND l.product_type in (0,1)";
@ -257,10 +255,22 @@ if ($modecompta == 'CREANCES-DETTES')
$sql.=" AND cp.fk_product is null"; $sql.=" AND cp.fk_product is null";
} }
elseif ($selected_cat) { // Into a specific category elseif ($selected_cat) { // Into a specific category
$sql.= " AND (c.rowid = ".$selected_cat; if ($subcat) {
if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; $TListOfCats = $categorie->get_full_arbo('product', $selected_cat, 1);
$sql.= ")";
$sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; $listofcatsql = "";
foreach ($TListOfCats as $key => $cat)
{
if ($key !== 0) $listofcatsql .= ",";
$listofcatsql .= $cat['rowid'];
}
}
$sql.= " AND (p.rowid IN ";
$sql .= " (SELECT fk_product FROM ".MAIN_DB_PREFIX."categorie_product cp WHERE ";
if ($subcat) $sql .= "cp.fk_categorie IN (". $listofcatsql.")";
else $sql.="cp.fk_categorie = ".$selected_cat;
$sql.= "))";
} }
if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc;
$sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND f.entity IN (".getEntity('invoice').")";

View File

@ -1254,6 +1254,11 @@ else
} }
} }
// Select mail models is same action as presend
if (GETPOST('modelselected', 'alpha')) {
$action = 'presend';
}
if (!empty($id) && $action != 'edit' && $action != 'create') if (!empty($id) && $action != 'edit' && $action != 'create')
{ {
$objsoc = new Societe($db); $objsoc = new Societe($db);

View File

@ -410,8 +410,8 @@ else
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); $nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{ {
$page = 0; $page = 0;
@ -421,14 +421,14 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$result = $db->query($sql); $resql = $db->query($sql);
if (!$result) if (! $resql)
{ {
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
$num = $db->num_rows($result); $num = $db->num_rows($resql);
$arrayofselected = is_array($toselect) ? $toselect : array(); $arrayofselected = is_array($toselect) ? $toselect : array();
@ -784,7 +784,7 @@ $i = 0;
$totalarray = array(); $totalarray = array();
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($resql);
$arraysocialnetworks = (array) json_decode($obj->socialnetworks, true); $arraysocialnetworks = (array) json_decode($obj->socialnetworks, true);
$contactstatic->lastname = $obj->lastname; $contactstatic->lastname = $obj->lastname;
@ -984,7 +984,7 @@ while ($i < min($num, $limit))
$i++; $i++;
} }
$db->free($result); $db->free($resql);
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook

View File

@ -9,7 +9,7 @@
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1264,7 +1264,7 @@ if ($action == 'create')
// Other attributes // Other attributes
if (empty($reshook)) { if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit', $parameters); print $object->showOptionals($extrafields, 'create', $parameters);
} }
print "</table>\n"; print "</table>\n";

View File

@ -820,7 +820,8 @@ class Contrat extends CommonObject
$sql .= " d.fk_user_author,"; $sql .= " d.fk_user_author,";
$sql .= " d.fk_user_ouverture,"; $sql .= " d.fk_user_ouverture,";
$sql .= " d.fk_user_cloture,"; $sql .= " d.fk_user_cloture,";
$sql .= " d.fk_unit"; $sql .= " d.fk_unit,";
$sql .= " d.product_type";
$sql .= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."contratdet as d LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
$sql .= " WHERE d.fk_contrat = ".$this->id; $sql .= " WHERE d.fk_contrat = ".$this->id;
$sql .= " ORDER by d.rowid ASC"; $sql .= " ORDER by d.rowid ASC";
@ -860,6 +861,7 @@ class Contrat extends CommonObject
$line->total_ttc = $objp->total_ttc; $line->total_ttc = $objp->total_ttc;
$line->fk_product = (($objp->fk_product > 0) ? $objp->fk_product : 0); $line->fk_product = (($objp->fk_product > 0) ? $objp->fk_product : 0);
$line->info_bits = $objp->info_bits; $line->info_bits = $objp->info_bits;
$line->type = $objp->type;
$line->fk_fournprice = $objp->fk_fournprice; $line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
@ -872,6 +874,7 @@ class Contrat extends CommonObject
$line->ref = $objp->product_ref; // deprecated $line->ref = $objp->product_ref; // deprecated
$line->product_ref = $objp->product_ref; // Product Ref $line->product_ref = $objp->product_ref; // Product Ref
$line->product_type = $objp->product_type; // Product Type
$line->product_desc = $objp->product_desc; // Product Description $line->product_desc = $objp->product_desc; // Product Description
$line->product_label = $objp->product_label; // Product Label $line->product_label = $objp->product_label; // Product Label
@ -1234,8 +1237,8 @@ class Contrat extends CommonObject
} }
} }
if (!$error) // Delete lines
{ if (!$error) {
// Delete contratdet extrafields // Delete contratdet extrafields
$main = MAIN_DB_PREFIX . 'contratdet'; $main = MAIN_DB_PREFIX . 'contratdet';
$ef = $main . "_extrafields"; $ef = $main . "_extrafields";
@ -1265,9 +1268,21 @@ class Contrat extends CommonObject
} }
} }
// Delete llx_ecm_files
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$error++;
}
}
// Delete contract
if (!$error) if (!$error)
{ {
// Delete contrat
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."contrat";
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
@ -2674,6 +2689,7 @@ class ContratLigne extends CommonObjectLine
*/ */
public $description; public $description;
public $product_type; // 0 for product, 1 for service
public $product_ref; public $product_ref;
public $product_label; public $product_label;

View File

@ -75,7 +75,7 @@ if ($time >= $_SESSION['auto_check_events_not_before'])
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.$_SESSION['auto_check_events_not_before']); dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.(empty($_SESSION['auto_check_events_not_before']) ? '' : $_SESSION['auto_check_events_not_before']));
$sql = 'SELECT id'; $sql = 'SELECT id';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'actioncomm a, ' . MAIN_DB_PREFIX . 'actioncomm_resources ar'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'actioncomm a, ' . MAIN_DB_PREFIX . 'actioncomm_resources ar';

View File

@ -89,6 +89,7 @@ class box_birthdays extends ModeleBoxes
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth"; $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.entity IN (".getEntity('user').")"; $sql.= " WHERE u.entity IN (".getEntity('user').")";
$sql.= " AND u.statut = 1";
$sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql.= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql.= " ORDER BY u.birth ASC"; $sql.= " ORDER BY u.birth ASC";
$sql.= $this->db->plimit($max, 0); $sql.= $this->db->plimit($max, 0);

View File

@ -105,7 +105,7 @@ class box_commandes extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."commande as c"; $sql.= ", ".MAIN_DB_PREFIX."commande as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity IN (".getEntity('commande').")";
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1"; if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_VALIDATED_ONLY)) $sql.=" AND c.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;

View File

@ -94,7 +94,7 @@ class box_contacts extends ModeleBoxes
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON sp.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND sp.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid; if ($user->socid) $sql .= " AND sp.fk_soc = ".$user->socid;
$sql .= " ORDER BY sp.tms DESC"; $sql .= " ORDER BY sp.tms DESC";
$sql .= $this->db->plimit($max, 0); $sql .= $this->db->plimit($max, 0);

View File

@ -91,7 +91,7 @@ class box_propales extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."propal as p"; $sql.= ", ".MAIN_DB_PREFIX."propal as p";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE p.fk_soc = s.rowid"; $sql.= " WHERE p.fk_soc = s.rowid";
$sql.= " AND p.entity = ".$conf->entity; $sql .= " AND p.entity IN (".getEntity('propal').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->socid) $sql.= " AND s.rowid = ".$user->socid; if($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC ";

View File

@ -91,7 +91,7 @@ class box_services_contracts extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql.= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,"; $sql.= " c.rowid, c.ref, c.statut as contract_status, c.ref_customer, c.ref_supplier,";
$sql.= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,"; $sql.= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as product_type, p.entity";
$sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
@ -121,6 +121,7 @@ class box_services_contracts extends ModeleBoxes
$contractlinestatic->label=$objp->label; $contractlinestatic->label=$objp->label;
$contractlinestatic->description=$objp->description; $contractlinestatic->description=$objp->description;
$contractlinestatic->type=$objp->type; $contractlinestatic->type=$objp->type;
$contractlinestatic->product_type = $objp->product_type;
$contractlinestatic->product_id=$objp->product_id; $contractlinestatic->product_id=$objp->product_id;
$contractlinestatic->product_ref=$objp->product_ref; $contractlinestatic->product_ref=$objp->product_ref;
@ -164,21 +165,21 @@ class box_services_contracts extends ModeleBoxes
$productstatic->type=$objp->ptype; $productstatic->type=$objp->ptype;
$productstatic->ref=$objp->product_ref; $productstatic->ref=$objp->product_ref;
$productstatic->entity=$objp->pentity; $productstatic->entity=$objp->pentity;
$productstatic->label=$objp->plabel; $productstatic->label=$objp->product_label;
$text = $productstatic->getNomUrl(1, '', 20); $text = $productstatic->getNomUrl(1, '', 20);
if ($objp->plabel) if ($objp->product_label)
{ {
$text .= ' - '; $text .= ' - ';
//$productstatic->ref=$objp->label; //$productstatic->ref=$objp->label;
//$text .= $productstatic->getNomUrl(0,'',16); //$text .= $productstatic->getNomUrl(0,'',16);
$text .= $objp->plabel; $text .= $objp->product_label;
} }
$description = $objp->description; $description = $objp->description;
// Add description in form // Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{ {
//$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'<br>'.dol_htmlentitiesbr($objp->description):''; //$text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc $description = ''; // Already added into main visible desc
} }

View File

@ -104,7 +104,7 @@ class box_shipments extends ModeleBoxes
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc";
$sql .= " WHERE e.entity = ".$conf->entity; $sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1"; if (!empty($conf->global->ORDER_BOX_LAST_SHIPMENTS_VALIDATED_ONLY)) $sql .= " AND e.fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= " AND sc.fk_user = ".$user->id;
else $sql .= " ORDER BY e.date_delivery, e.ref DESC "; else $sql .= " ORDER BY e.date_delivery, e.ref DESC ";

View File

@ -95,7 +95,7 @@ class box_supplier_orders extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity IN (".getEntity('supplier_order').")";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; if ($user->socid) $sql.= " AND s.rowid = ".$user->socid;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC "; if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY c.date_commande DESC, c.ref DESC ";

View File

@ -95,7 +95,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE c.fk_soc = s.rowid"; $sql.= " WHERE c.fk_soc = s.rowid";
$sql.= " AND c.entity = ".$conf->entity; $sql .= " AND c.entity IN (".getEntity('supplier_order').")";
$sql.= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT; $sql.= " AND c.fk_statut = ".CommandeFournisseur::STATUS_ORDERSENT;
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com> /* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.com>
* Copyright (C) 2015-2019 Frederic France <frederic.france@netlogic.fr> * Copyright (C) 2015-2020 Frederic France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -184,7 +184,7 @@ class box_task extends ModeleBoxes
$taskstatic->label = $objp->label; $taskstatic->label = $objp->label;
$taskstatic->progress = $objp->progress; $taskstatic->progress = $objp->progress;
$taskstatic->fk_statut = $objp->fk_statut; $taskstatic->fk_statut = $objp->fk_statut;
$taskstatic->date_end = $objp->datee; $taskstatic->date_end = $this->db->jdate($objp->datee);
$taskstatic->planned_workload = $objp->planned_workload; $taskstatic->planned_workload = $objp->planned_workload;
$taskstatic->duration_effective = $objp->duration_effective; $taskstatic->duration_effective = $objp->duration_effective;

View File

@ -486,6 +486,9 @@ class CMailFile
{ {
//$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]));
$attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]); $attachment = Swift_Attachment::fromPath($filename_list[$i], $mimetype_list[$i]);
if (!empty($mimefilename_list[$i])) {
$attachment->setFilename($mimefilename_list[$i]);
}
$this->message->attach($attachment); $this->message->attach($attachment);
} }
} }

View File

@ -513,7 +513,7 @@ abstract class CommonDocGenerator
// Retrieve extrafields // Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options)) if (is_array($object->array_options) && count($object->array_options))
{ {
$extrafieldkey = $object->element; $extrafieldkey = $object->table_element;
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db); $extrafields = new ExtraFields($this->db);

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
@ -6848,6 +6848,9 @@ abstract class CommonObject
var parent = $(this).find("option[parent]:first").attr("parent"); var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":"); var infos = parent.split(":");
var parent_list = infos[0]; var parent_list = infos[0];
showOptions(child_list, parent_list);
/* Activate the handler to call showOptions on each future change */
$("select[name=\""+parent_list+"\"]").change(function() { $("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list); showOptions(child_list, parent_list);
}); });
@ -7543,18 +7546,17 @@ abstract class CommonObject
$now = dol_now(); $now = dol_now();
$fieldvalues = $this->setSaveQuery(); $fieldvalues = $this->setSaveQuery();
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation'] = $this->db->idate($now);
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id; if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat'] = $user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
$keys = array(); $keys = array();
$values = array(); $values = array(); // Array to store string forged for SQL syntax
foreach ($fieldvalues as $k => $v) { foreach ($fieldvalues as $k => $v) {
$keys[$k] = $k; $keys[$k] = $k;
$value = $this->fields[$k]; $value = $this->fields[$k];
$values[$k] = $this->quote($v, $value); $values[$k] = $this->quote($v, $value); // May return string 'NULL' if $value is null
} }
// Clean and check mandatory // Clean and check mandatory
@ -7564,8 +7566,7 @@ abstract class CommonObject
if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = ''; if (preg_match('/^integer:/i', $this->fields[$key]['type']) && $values[$key] == '-1') $values[$key] = '';
if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = ''; if (!empty($this->fields[$key]['foreignkey']) && $values[$key] == '-1') $values[$key] = '';
//var_dump($key.'-'.$values[$key].'-'.($this->fields[$key]['notnull'] == 1)); if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && (!isset($values[$key]) || $values[$key] === 'NULL') && is_null($this->fields[$key]['default']))
if (isset($this->fields[$key]['notnull']) && $this->fields[$key]['notnull'] == 1 && !isset($values[$key]) && is_null($this->fields[$key]['default']))
{ {
$error++; $error++;
$this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']); $this->errors[] = $langs->trans("ErrorFieldRequired", $this->fields[$key]['label']);
@ -7946,6 +7947,18 @@ abstract class CommonObject
} }
} }
// Delete llx_ecm_files
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$error++;
}
}
if (!$error && !empty($this->isextrafieldmanaged)) if (!$error && !empty($this->isextrafieldmanaged))
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields"; $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields";
@ -8252,4 +8265,49 @@ abstract class CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
/**
* Delete related files of object in database
*
* @return bool
*/
public function deleteEcmFiles()
{
global $conf;
$this->db->begin();
switch ($this->element){
case 'propal':
$element = 'propale';
break;
case 'product':
$element = 'produit';
break;
case 'order_supplier':
$element ='fournisseur/commande';
break;
case 'invoice_supplier':
$element = 'fournisseur/facture/' . get_exdir($this->id, 2, 0, 1, $this, 'invoice_supplier');
break;
case 'shipping':
$element = 'expedition/sending';
break;
default:
$element = $this->element;
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ecm_files";
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%'";
$sql.= " AND filepath = '".$element."/".$this->db->escape($this->ref)."' AND entity = ".$conf->entity;
if (!$this->db->query($sql)) {
$this->error = $this->db->lasterror();
$this->db->rollback();
return false;
}
$this->db->commit();
return true;
}
} }

View File

@ -105,7 +105,7 @@ class HookManager
if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) // We instantiate action class only if initialized hook is handled by module if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) // We instantiate action class only if initialized hook is handled by module
{ {
// Include actions class overwriting hooks // Include actions class overwriting hooks
if (! is_object($this->hooks[$context][$module])) // If set, class was already loaded if (empty($this->hooks[$context][$module]) || !is_object($this->hooks[$context][$module])) // If set to an object value, class was already loaded
{ {
$path = '/'.$module.'/class/'; $path = '/'.$module.'/class/';
$actionfile = 'actions_'.$module.'.class.php'; $actionfile = 'actions_'.$module.'.class.php';
@ -166,6 +166,7 @@ class HookManager
'doActions', 'doActions',
'doMassActions', 'doMassActions',
'formatEvent', 'formatEvent',
'formConfirm',
'formCreateThirdpartyOptions', 'formCreateThirdpartyOptions',
'formObjectOptions', 'formObjectOptions',
'formattachOptions', 'formattachOptions',

View File

@ -1172,17 +1172,15 @@ class Form
// On recherche les societes // On recherche les societes
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur";
if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
$sql .= ", s.address, s.zip, s.town"; $sql .= ", s.address, s.zip, s.town";
$sql .= ", dictp.code as country_code"; $sql .= ", dictp.code as country_code";
} }
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) {
$sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid=s.fk_pays"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid = s.fk_pays";
} }
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= " WHERE s.entity IN (".getEntity('societe').")"; $sql .= " WHERE s.entity IN (".getEntity('societe').")";
if (!empty($user->socid)) $sql .= " AND s.rowid = ".$user->socid; if (!empty($user->socid)) $sql .= " AND s.rowid = ".$user->socid;
if ($filter) $sql .= " AND (".$filter.")"; if ($filter) $sql .= " AND (".$filter.")";
@ -5842,7 +5840,7 @@ class Form
} }
elseif ($typehour == 'text' || $typehour == 'textselect') elseif ($typehour == 'text' || $typehour == 'textselect')
{ {
$retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" size="1" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">'; $retstring .= '<input placeholder="'.$langs->trans('HourShort').'" type="number" min="0" name="'.$prefix.'hour"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputhour" value="'.(($hourSelected != '') ? ((int) $hourSelected) : '').'">';
} }
else return 'BadValueForParameterTypeHour'; else return 'BadValueForParameterTypeHour';
@ -5866,7 +5864,7 @@ class Form
} }
elseif ($typehour == 'text') elseif ($typehour == 'text')
{ {
$retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" size="1" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">'; $retstring .= '<input placeholder="'.$langs->trans('MinuteShort').'" type="number" min="0" name="'.$prefix.'min"'.($disabled ? ' disabled' : '').' class="flat maxwidth50 inputminute" value="'.(($minSelected != '') ? ((int) $minSelected) : '').'">';
} }
if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort'); if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort');
@ -5953,7 +5951,7 @@ class Form
$urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php'; $urlforajaxcall = DOL_URL_ROOT.'/core/ajax/selectobject.php';
// No immediate load of all database // No immediate load of all database
$urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter).($moreparams ? $moreparams : ''); $urloption = 'htmlname='.$htmlname.'&outjson=1&objectdesc='.$objectdesc.'&filter='.urlencode($objecttmp->filter);
// Activate the auto complete using ajax call. // Activate the auto complete using ajax call.
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array()); $out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, $conf->global->$confkeyforautocompletemode, 0, array());
$out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>'; $out .= '<style type="text/css">.ui-autocomplete { z-index: 250; }</style>';

View File

@ -354,7 +354,7 @@ class FormFile
// Add entity in $param if not already exists // Add entity in $param if not already exists
if (!preg_match('/entity\=[0-9]+/', $param)) { if (!preg_match('/entity\=[0-9]+/', $param)) {
$param .= 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity); $param .= ($param ? '&' : '').'entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
} }
$printer = 0; $printer = 0;

View File

@ -1248,7 +1248,7 @@ class FormMail extends Form
elseif ($type_template == 'fichinter_send') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template == 'fichinter_send') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter"); }
elseif ($type_template == 'thirdparty') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template == 'thirdparty') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty"); }
elseif ($type_template == 'user') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser"); } elseif ($type_template == 'user') { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser"); }
elseif (!empty($type_template)) { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template)); } elseif (!empty($type_template)) { $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric"); }
$ret->label = 'default'; $ret->label = 'default';
$ret->lang = $outputlangs->defaultlang; $ret->lang = $outputlangs->defaultlang;

View File

@ -171,10 +171,11 @@ class Translate
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed) * @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
* @param int $forcelangdir To force a different lang directory * @param int $forcelangdir To force a different lang directory
* @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf. * @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf.
* @param int $forceloadifalreadynotfound Force attempt to reload lang file if it was previously not found
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK * @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
* @see loadLangs() * @see loadLangs()
*/ */
public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0) public function load($domain, $alt = 0, $stopafterdirection = 0, $forcelangdir = '', $loadfromfileonly = 0, $forceloadifalreadynotfound = 0)
{ {
global $conf,$db; global $conf,$db;
@ -205,7 +206,8 @@ class Translate
} }
// Check cache // Check cache
if (! empty($this->_tab_loaded[$newdomain])) // File already loaded for this domain if (! empty($this->_tab_loaded[$newdomain])
&& ($this->_tab_loaded[$newdomain] != 2 || empty($forceloadifalreadynotfound)) ) // File already loaded and found and not forced for this domain
{ {
//dol_syslog("Translate::Load already loaded for newdomain=".$newdomain); //dol_syslog("Translate::Load already loaded for newdomain=".$newdomain);
return 0; return 0;

View File

@ -229,6 +229,7 @@ abstract class DoliDB implements Database
{ {
if (! empty($sortfield)) if (! empty($sortfield))
{ {
$oldsortorder = '';
$return=''; $return='';
$fields=explode(',', $sortfield); $fields=explode(',', $sortfield);
$orders=explode(',', $sortorder); $orders=explode(',', $sortorder);
@ -238,15 +239,19 @@ abstract class DoliDB implements Database
if (! $return) $return.=' ORDER BY '; if (! $return) $return.=' ORDER BY ';
else $return.=', '; else $return.=', ';
$return.=preg_replace('/[^0-9a-z_\.]/i', '', $val); $return .= preg_replace('/[^0-9a-z_\.]/i', '', $val); // Add field
$tmpsortorder = trim($orders[$i]); $tmpsortorder = trim($orders[$i]);
// Only ASC and DESC values are valid SQL // Only ASC and DESC values are valid SQL
if (strtoupper($tmpsortorder) === 'ASC') { if (strtoupper($tmpsortorder) === 'ASC') {
$oldsortorder = 'ASC';
$return .= ' ASC'; $return .= ' ASC';
} elseif (strtoupper($tmpsortorder) === 'DESC') { } elseif (strtoupper($tmpsortorder) === 'DESC') {
$oldsortorder = 'DESC';
$return .= ' DESC'; $return .= ' DESC';
} else {
$return .= ' '.($oldsortorder ? $oldsortorder : 'ASC');
} }
$i++; $i++;

View File

@ -225,7 +225,7 @@ function show_array_actions_to_do($max = 5)
$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action"; $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE a.entity = ".$conf->entity; $sql .= " WHERE a.entity IN (".getEntity('agenda').")";
$sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;
@ -323,7 +323,7 @@ function show_array_last_actions_done($max = 5)
$sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action "; $sql.= " ".MAIN_DB_PREFIX."c_actioncomm as c ON c.id = a.fk_action ";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE a.entity = ".$conf->entity; $sql .= " WHERE a.entity IN (".getEntity('agenda').")";
$sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; $sql.= " AND (a.percent >= 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$socid;

View File

@ -41,9 +41,10 @@
* - Ex: array('show'=> ) * - Ex: array('show'=> )
* - Ex: array('update_textarea'=> ) * - Ex: array('update_textarea'=> )
* - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax)
* @param string $moreparams More params provided to ajax call
* @return string Script * @return string Script
*/ */
function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array()) function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array(), $moreparams = '')
{ {
if (empty($minLength)) $minLength=1; if (empty($minLength)) $minLength=1;
@ -55,7 +56,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLen
// Input search_htmlname is original field // Input search_htmlname is original field
// Input htmlname is a second input field used when using ajax autocomplete. // Input htmlname is a second input field used when using ajax autocomplete.
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" />'; $script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="'.$selected.'" '.($moreparams ? $moreparams : '').' />';
$script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n"; $script.= '<!-- Javascript code for autocomplete of field '.$htmlname.' -->'."\n";
$script.= '<script>'."\n"; $script.= '<script>'."\n";
@ -478,16 +479,17 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete =
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param int $entity Entity to set * @param int $entity Entity to set
* @param int $revertonoff Revert on/off * @param int $revertonoff Revert on/off
* @param bool $strict Use only "disabled" with delConstant and "enabled" with setConstant * @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
* @param int $forcenoajax 1=Force to use a ahref link instead of ajax code.
* @return string * @return string
*/ */
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0) function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcenoajax = 0)
{ {
global $conf, $langs; global $conf, $langs;
$entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity); $entity = ((isset($entity) && is_numeric($entity) && $entity >= 0) ? $entity : $conf->entity);
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax) || $forcenoajax)
{ {
if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>'; if (empty($conf->global->$code)) print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; else print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_'.$code.'&entity='.$entity.'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@ -2992,8 +2992,12 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1; if ($partofdirinoriginalfile && ($fuser->rights->$modulepart->$partofdirinoriginalfile->{$lire} || $fuser->rights->$modulepart->$partofdirinoriginalfile->{$read})) $accessallowed = 1;
if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1; if ($fuser->rights->$modulepart->{$lire} || $fuser->rights->$modulepart->{$read}) $accessallowed = 1;
//} //}
if (is_array($conf->$modulepart->multidir_output) && !empty($conf->$modulepart->multidir_output[$entity])) {
$original_file = $conf->$modulepart->multidir_output[$entity].'/'.$original_file;
} else {
$original_file = $conf->$modulepart->dir_output.'/'.$original_file; $original_file = $conf->$modulepart->dir_output.'/'.$original_file;
} }
}
// For modules who wants to manage different levels of permissions for documents // For modules who wants to manage different levels of permissions for documents
$subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS'; $subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS';

View File

@ -7928,19 +7928,16 @@ function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata = 0, $param
if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->use_javascript_ajax)) return '';
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml'); $isAllowedForPreview = dolIsAllowedForPreview($relativepath);
//$mime_preview[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview);
if ($alldata == 1) if ($alldata == 1)
{ {
if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime'=>dol_mimetype($relativepath),); if ($isAllowedForPreview) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime'=>dol_mimetype($relativepath));
else return array(); else return array();
} }
// old behavior // old behavior, return a string
if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; if ($isAllowedForPreview) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')';
else return ''; else return '';
} }
@ -7964,6 +7961,31 @@ function ajax_autoselect($htmlname, $addlink = '')
return $out; return $out;
} }
/**
* Return if a file is qualified for preview
*
* @param string $file Filename we looking for information
* @return int 1 If allowed, 0 otherwise
* @see dol_mimetype(), image_format_supported() from images.lib.php
*/
function dolIsAllowedForPreview($file)
{
global $conf;
// Check .noexe extension in filename
if (preg_match('/\.noexe$/i', $file)) return 0;
// Check mime types
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'webp');
if (!empty($conf->global->MAIN_ALLOW_SVG_FILES_AS_IMAGES)) $mime_preview[] = 'svg+xml';
//$mime_preview[]='vnd.oasis.opendocument.presentation';
//$mime_preview[]='archive';
$num_mime = array_search(dol_mimetype($file, '', 1), $mime_preview);
if ($num_mime !== false) return 1;
// By default, not allowed for preview
return 0;
}
/** /**
* Return mime type of a file * Return mime type of a file
@ -7972,7 +7994,7 @@ function ajax_autoselect($htmlname, $addlink = '')
* @param string $default Default mime type if extension not found in known list * @param string $default Default mime type if extension not found in known list
* @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa * @param int $mode 0=Return full mime, 1=otherwise short mime string, 2=image for mime type, 3=source language, 4=css of font fa
* @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive) * @return string Return a mime type family (text/xxx, application/xxx, image/xxx, audio, video, archive)
* @see image_format_supported() from images.lib.php * @see dolIsAllowedForPreview(), image_format_supported() from images.lib.php
*/ */
function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0)
{ {
@ -8507,7 +8529,7 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u
$attr['class'] .= ' classfortooltip'; $attr['class'] .= ' classfortooltip';
} }
if (empty($id)) { if (!empty($id)) {
$attr['id'] = $id; $attr['id'] = $id;
} }

View File

@ -1910,6 +1910,12 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '')
$classpath = 'fourn/class'; $classpath = 'fourn/class';
$module = 'fournisseur'; $module = 'fournisseur';
} }
elseif ($objecttype == 'supplier_proposal') {
$classfile = 'supplier_proposal';
$classname = 'SupplierProposal';
$classpath = 'supplier_proposal/class';
$module = 'supplier_proposal';
}
elseif ($objecttype == 'stock') { elseif ($objecttype == 'stock') {
$classpath = 'product/stock/class'; $classpath = 'product/stock/class';
$classfile = 'entrepot'; $classfile = 'entrepot';

View File

@ -24,26 +24,38 @@
/** /**
* Function to return number in text. * Function to return a number into a text.
* May use module NUMBERWORDS if found.
* *
* * @param float $num Number to convert (must be a numeric value, like reported by price2num())
* @param float $num Number to convert
* @param Translate $langs Language * @param Translate $langs Language
* @param boolean $currency 0=number to translate | 1=currency to translate * @param boolean $currency 0=number to translate | 1=currency to translate
* @param boolean $centimes 0=no centimes | 1=centimes to translate * @param boolean $centimes 0=no cents/centimes | 1=there is cents/centimes to translate
* @return string|false Text of the number * @return string|false Text of the number
*/ */
function dol_convertToWord($num, $langs, $currency = false, $centimes = false) function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
{ {
global $conf; global $conf;
$num = str_replace(array(',', ' '), '', trim($num)); //$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value
if (! $num) { if (!$num) {
return false; return false;
} }
if ($centimes && strlen($num) == 1) { if ($centimes && strlen($num) == 1) {
$num = $num*10; $num = $num * 10;
} }
if (!empty($conf->global->MAIN_MODULE_NUMBERWORDS)) {
if ($currency) {
$type = 1;
} else {
$type = 0;
}
$concatWords = $langs->getLabelFromNumber($num, $type);
return $concatWords;
} else {
$TNum = explode('.', $num); $TNum = explode('.', $num);
$num = (int) $TNum[0]; $num = (int) $TNum[0];
$words = array(); $words = array();
@ -94,24 +106,24 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
$num_length = strlen($num); $num_length = strlen($num);
$levels = (int) (($num_length + 2) / 3); $levels = (int) (($num_length + 2) / 3);
$max_length = $levels * 3; $max_length = $levels * 3;
$num = substr('00' . $num, -$max_length); $num = substr('00'.$num, -$max_length);
$num_levels = str_split($num, 3); $num_levels = str_split($num, 3);
$nboflevels = count($num_levels); $nboflevels = count($num_levels);
for ($i = 0; $i < $nboflevels; $i++) { for ($i = 0; $i < $nboflevels; $i++) {
$levels--; $levels--;
$hundreds = (int) ($num_levels[$i] / 100); $hundreds = (int) ($num_levels[$i] / 100);
$hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' '.$langs->transnoentities('hundred') . ( $hundreds == 1 ? '' : 's' ) . ' ': ''); $hundreds = ($hundreds ? ' '.$list1[$hundreds].' '.$langs->transnoentities('hundred').($hundreds == 1 ? '' : 's').' ' : '');
$tens = (int) ($num_levels[$i] % 100); $tens = (int) ($num_levels[$i] % 100);
$singles = ''; $singles = '';
if ( $tens < 20 ) { if ($tens < 20) {
$tens = ($tens ? ' ' . $list1[$tens] . ' ' : '' ); $tens = ($tens ? ' '.$list1[$tens].' ' : '');
} else { } else {
$tens = (int) ($tens / 10); $tens = (int) ($tens / 10);
$tens = ' ' . $list2[$tens] . ' '; $tens = ' '.$list2[$tens].' ';
$singles = (int) ($num_levels[$i] % 10); $singles = (int) ($num_levels[$i] % 10);
$singles = ' ' . $list1[$singles] . ' '; $singles = ' '.$list1[$singles].' ';
} }
$words[] = $hundreds . $tens . $singles . ( ( $levels && ( int ) ( $num_levels[$i] ) ) ? ' ' . $list3[$levels] . ' ' : '' ); $words[] = $hundreds.$tens.$singles.(($levels && (int) ($num_levels[$i])) ? ' '.$list3[$levels].' ' : '');
} //end for loop } //end for loop
$commas = count($words); $commas = count($words);
if ($commas > 1) { if ($commas > 1) {
@ -121,17 +133,22 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
// Delete multi whitespaces // Delete multi whitespaces
$concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords)); $concatWords = trim(preg_replace('/[ ]+/', ' ', $concatWords));
if(!empty($currency)) { if (!empty($currency)) {
$concatWords .= ' '.$currency; $concatWords .= ' '.$currency;
} }
// If we need to write cents call again this function for cents // If we need to write cents call again this function for cents
if(!empty($TNum[1])) { $decimalpart = $TNum[1];
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and'); $decimalpart = preg_replace('/0+$/', '', $decimalpart);
$concatWords .= ' '.dol_convertToWord($TNum[1], $langs, $currency, true);
if(!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes'); if ($decimalpart) {
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('and');
$concatWords .= ' '.dol_convertToWord($decimalpart, $langs, '', true);
if (!empty($currency)) $concatWords .= ' '.$langs->transnoentities('centimes');
} }
return $concatWords; return $concatWords;
}
} }
@ -146,41 +163,43 @@ function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
*/ */
function dolNumberToWord($numero, $langs, $numorcurrency = 'number') function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
{ {
// If the number is negative convert to positive and return -1 if is too long // If the number is negative convert to positive and return -1 if it is too long
if ($numero < 0) $numero *= -1; if ($numero < 0) $numero *= -1;
if ($numero >= 1000000000001) if ($numero >= 1000000000001) {
return -1; return -1;
}
// Get 2 decimals to cents, another functions round or truncate // Get 2 decimals to cents, another functions round or truncate
$strnumber = number_format($numero, 10); $strnumber = number_format($numero, 10);
$len=strlen($strnumber); $len = strlen($strnumber);
for ($i=0; $i<$len; $i++) for ($i = 0; $i < $len; $i++)
{ {
if ($strnumber[$i]=='.') { if ($strnumber[$i] == '.') {
$parte_decimal = $strnumber[$i+1].$strnumber[$i+2]; $parte_decimal = $strnumber[$i + 1].$strnumber[$i + 2];
break; break;
} }
} }
/*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and /*In dolibarr 3.6.2 (my current version) doesn't have $langs->default and
in case exist why ask $lang like a parameter?*/ in case exist why ask $lang like a parameter?*/
if (((is_object($langs) && $langs->default == 'es_MX') || (! is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency') if (((is_object($langs) && $langs->default == 'es_MX') || (!is_object($langs) && $langs == 'es_MX')) && $numorcurrency == 'currency')
{ {
if ($numero>=1 && $numero<2) { if ($numero >= 1 && $numero < 2) {
return ("UN PESO ".$parte_decimal." / 100 M.N."); return ("UN PESO ".$parte_decimal." / 100 M.N.");
} }
elseif ($numero>=0 && $numero<1){ elseif ($numero >= 0 && $numero < 1) {
return ("CERO PESOS ".$parte_decimal." / 100 M.N."); return ("CERO PESOS ".$parte_decimal." / 100 M.N.");
} }
elseif ($numero>=1000000 && $numero<1000001){ elseif ($numero >= 1000000 && $numero < 1000001) {
return ("UN MILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N."); return ("UN MILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
} }
elseif ($numero>=1000000000000 && $numero<1000000000001){ elseif ($numero >= 1000000000000 && $numero < 1000000000001) {
return ("UN BILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N."); return ("UN BILL&OacuteN DE PESOS ".$parte_decimal." / 100 M.N.");
} }
else { else {
$entexto =""; $entexto = "";
$number = $numero; $number = $numero;
if ($number >= 1000000000){ if ($number >= 1000000000) {
$CdMMillon = (int) ($numero / 100000000000); $CdMMillon = (int) ($numero / 100000000000);
$numero = $numero - $CdMMillon * 100000000000; $numero = $numero - $CdMMillon * 100000000000;
$DdMMillon = (int) ($numero / 10000000000); $DdMMillon = (int) ($numero / 10000000000);
@ -190,7 +209,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
$entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon); $entexto .= hundreds2text($CdMMillon, $DdMMillon, $UdMMillon);
$entexto .= " MIL "; $entexto .= " MIL ";
} }
if ($number >= 1000000){ if ($number >= 1000000) {
$CdMILLON = (int) ($numero / 100000000); $CdMILLON = (int) ($numero / 100000000);
$numero = $numero - $CdMILLON * 100000000; $numero = $numero - $CdMILLON * 100000000;
$DdMILLON = (int) ($numero / 10000000); $DdMILLON = (int) ($numero / 10000000);
@ -198,7 +217,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
$udMILLON = (int) ($numero / 1000000); $udMILLON = (int) ($numero / 1000000);
$numero = $numero - $udMILLON * 1000000; $numero = $numero - $udMILLON * 1000000;
$entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON); $entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON);
if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON==1) if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON == 1)
$entexto .= " MILL&OacuteN "; $entexto .= " MILL&OacuteN ";
else else
$entexto .= " MILLONES "; $entexto .= " MILLONES ";
@ -219,7 +238,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
$d = (int) ($numero / 10); $d = (int) ($numero / 10);
$u = (int) $numero - $d * 10; $u = (int) $numero - $d * 10;
$entexto .= hundreds2text($c, $d, $u); $entexto .= hundreds2text($c, $d, $u);
if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number>1000000) if (!$cdm && !$ddm && !$udm && !$c && !$d && !$u && $number > 1000000)
$entexto .= " DE"; $entexto .= " DE";
$entexto .= " PESOS ".$parte_decimal." / 100 M.N."; $entexto .= " PESOS ".$parte_decimal." / 100 M.N.";
} }
@ -237,40 +256,40 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number')
*/ */
function hundreds2text($hundreds, $tens, $units) function hundreds2text($hundreds, $tens, $units)
{ {
if ($hundreds==1 && $tens==0 && $units==0){ if ($hundreds == 1 && $tens == 0 && $units == 0) {
return "CIEN"; return "CIEN";
} }
$centenas = array("CIENTO","DOSCIENTOS","TRESCIENTOS","CUATROCIENTOS","QUINIENTOS","SEISCIENTOS","SETECIENTOS","OCHOCIENTOS","NOVECIENTOS"); $centenas = array("CIENTO", "DOSCIENTOS", "TRESCIENTOS", "CUATROCIENTOS", "QUINIENTOS", "SEISCIENTOS", "SETECIENTOS", "OCHOCIENTOS", "NOVECIENTOS");
$decenas = array("","","TREINTA ","CUARENTA ","CINCUENTA ","SESENTA ","SETENTA ","OCHENTA ","NOVENTA "); $decenas = array("", "", "TREINTA ", "CUARENTA ", "CINCUENTA ", "SESENTA ", "SETENTA ", "OCHENTA ", "NOVENTA ");
$veintis = array("VEINTE","VEINTIUN","VEINTID&OacuteS","VEINTITR&EacuteS","VEINTICUATRO","VEINTICINCO","VEINTIS&EacuteIS","VEINTISIETE","VEINTIOCHO","VEINTINUEVE"); $veintis = array("VEINTE", "VEINTIUN", "VEINTID&OacuteS", "VEINTITR&EacuteS", "VEINTICUATRO", "VEINTICINCO", "VEINTIS&EacuteIS", "VEINTISIETE", "VEINTIOCHO", "VEINTINUEVE");
$diecis = array("DIEZ","ONCE","DOCE","TRECE","CATORCE","QUINCE","DIECIS&EacuteIS","DIECISIETE","DIECIOCHO","DIECINUEVE"); $diecis = array("DIEZ", "ONCE", "DOCE", "TRECE", "CATORCE", "QUINCE", "DIECIS&EacuteIS", "DIECISIETE", "DIECIOCHO", "DIECINUEVE");
$unidades = array("UN","DOS","TRES","CUATRO","CINCO","SEIS","SIETE","OCHO","NUEVE"); $unidades = array("UN", "DOS", "TRES", "CUATRO", "CINCO", "SEIS", "SIETE", "OCHO", "NUEVE");
$entexto = ""; $entexto = "";
if ($hundreds!=0){ if ($hundreds != 0) {
$entexto .= $centenas[$hundreds-1]; $entexto .= $centenas[$hundreds - 1];
} }
if ($tens>2){ if ($tens > 2) {
if ($hundreds!=0) $entexto .= " "; if ($hundreds != 0) $entexto .= " ";
$entexto .= $decenas[$tens-1]; $entexto .= $decenas[$tens - 1];
if ($units!=0){ if ($units != 0) {
$entexto .= " Y "; $entexto .= " Y ";
$entexto .= $unidades[$units-1]; $entexto .= $unidades[$units - 1];
} }
return $entexto; return $entexto;
} }
elseif ($tens==2){ elseif ($tens == 2) {
if ($hundreds!=0) $entexto .= " "; if ($hundreds != 0) $entexto .= " ";
$entexto .= " ".$veintis[$units]; $entexto .= " ".$veintis[$units];
return $entexto; return $entexto;
} }
elseif ($tens==1){ elseif ($tens == 1) {
if ($hundreds!=0) $entexto .= " "; if ($hundreds != 0) $entexto .= " ";
$entexto .= $diecis[$units]; $entexto .= $diecis[$units];
return $entexto; return $entexto;
} }
if ($units!=0) { if ($units != 0) {
if ($hundreds!=0 || $tens!=0) $entexto .= " "; if ($hundreds != 0 || $tens != 0) $entexto .= " ";
$entexto .= $unidades[$units-1]; $entexto .= $unidades[$units - 1];
} }
return $entexto; return $entexto;
} }

View File

@ -1859,7 +1859,6 @@ function pdf_getlineunit($object, $i, $outputlangs, $hidedetails = 0, $hookmanag
} }
if (empty($reshook)) if (empty($reshook))
{ {
if ($object->lines[$i]->special_code == 3) return '';
if (empty($hidedetails) || $hidedetails > 1) $result .= $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short')); if (empty($hidedetails) || $hidedetails > 1) $result .= $langs->transnoentitiesnoconv($object->lines[$i]->getLabelOfUnit('short'));
} }
return $result; return $result;
@ -2108,7 +2107,7 @@ function pdf_getTotalQty($object, $type, $outputlangs)
*/ */
function pdf_getLinkedObjects($object, $outputlangs) function pdf_getLinkedObjects($object, $outputlangs)
{ {
global $hookmanager; global $db, $hookmanager;
$linkedobjects = array(); $linkedobjects = array();
@ -2175,8 +2174,13 @@ function pdf_getLinkedObjects($object, $outputlangs)
// We concat this record info into fields xxx_value. title is overwrote. // We concat this record info into fields xxx_value. title is overwrote.
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
{ {
$elementobject->fetchObjectLinked(); $elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
if (!empty($elementobject->linkedObjects['commande'])) $order = reset($elementobject->linkedObjects['commande']); if (! empty($elementobject->linkedObjectsIds['commande'])){
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$order = new Commande($db);
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
if ($ret < 1) { $order=null; }
}
} }
if (!is_object($order)) if (!is_object($order))
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2008-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2020 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -575,6 +576,18 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
} }
if ($feature == 'agenda')// Also check myactions rights
{
if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) {
require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
$action = new ActionComm($db);
$action->fetch($objectid);
if ($action->authorid != $user->id && $action->userownerid != $user->id && !(array_key_exists($user->id, $action->userassigned))) {
return false;
}
}
}
} }
elseif (in_array($feature, $checkproject)) elseif (in_array($feature, $checkproject))
{ {

View File

@ -467,15 +467,18 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{ {
$max = strlen($lowercase) - 1; $max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $lowercase{random_int(0, $max)}; $tmp = random_int(0, $max);
$randomCode .= $lowercase[$tmp];
} }
$max = strlen($uppercase) - 1; $max = strlen($uppercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $uppercase{random_int(0, $max)}; $tmp = random_int(0, $max);
$randomCode .= $uppercase[$tmp];
} }
$max = strlen($numbers) - 1; $max = strlen($numbers) - 1;
for ($x = 0; $x < $nbofcharlast; $x++) { for ($x = 0; $x < $nbofcharlast; $x++) {
$randomCode .= $numbers{random_int(0, $max)}; $tmp = random_int(0, $max);
$randomCode .= $numbers[$tmp];
} }
$generated_password=str_shuffle($randomCode); $generated_password=str_shuffle($randomCode);
@ -484,15 +487,18 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
{ {
$max = strlen($lowercase) - 1; $max = strlen($lowercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $lowercase{mt_rand(0, $max)}; $tmp = mt_rand(0, $max);
$randomCode .= $lowercase[$tmp];
} }
$max = strlen($uppercase) - 1; $max = strlen($uppercase) - 1;
for ($x = 0; $x < $nbofchar; $x++) { for ($x = 0; $x < $nbofchar; $x++) {
$randomCode .= $uppercase{mt_rand(0, $max)}; $tmp = mt_rand(0, $max);
$randomCode .= $uppercase[$tmp];
} }
$max = strlen($numbers) - 1; $max = strlen($numbers) - 1;
for ($x = 0; $x < $nbofcharlast; $x++) { for ($x = 0; $x < $nbofcharlast; $x++) {
$randomCode .= $numbers{mt_rand(0, $max)}; $tmp = mt_rand(0, $max);
$randomCode .= $numbers[$tmp];
} }
$generated_password=str_shuffle($randomCode); $generated_password=str_shuffle($randomCode);
@ -516,11 +522,13 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len
$max = strlen($numbers) - 1; $max = strlen($numbers) - 1;
if (function_exists('random_int')) // Cryptographic random if (function_exists('random_int')) // Cryptographic random
{ {
$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); $tmp = random_int(0, $max);
$generated_password=str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
} }
else else
{ {
$generated_password=str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); $tmp = mt_rand(0, $max);
$generated_password=str_replace($replaceambiguouschars, $numbers[$tmp], $generated_password);
} }
} }

View File

@ -239,7 +239,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
!empty($user->rights->supplier_proposal->lire) || !empty($user->rights->supplier_proposal->lire) ||
!empty($user->rights->supplier_order->lire) || !empty($user->rights->supplier_order->lire) ||
!empty($user->rights->contrat->lire) || !empty($user->rights->contrat->lire) ||
!empty($user->rights->ficheinter->lire) !empty($user->rights->ficheinter->lire) ||
!empty($user->rights->supplier_order->lire) ||
!empty($user->rights->fournisseur->commande->lire)
), ),
'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter'
); );
@ -1704,7 +1706,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
if (empty($conf->global->PROJECT_HIDE_TASKS)) if (empty($conf->global->PROJECT_HIDE_TASKS))
{ {
// Project affected to user // Project affected to user
$newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire); $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks');
$newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer);
$newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire);
$newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire);

View File

@ -358,7 +358,7 @@ class pdf_standard extends ModeleExpenseReport
while ($i < $nblines) { while ($i < $nblines) {
$pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage $pdf->SetFont('', '', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0);
if (empty($showpricebeforepagebreak)) { if (empty($showpricebeforepagebreak) && ($i !== ($nblines - 1))) {
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
} else { } else {
$pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter + $heightforfreetext + $heightforinfotot); // The only function to edit the bottom margin of current page to set it.
@ -371,6 +371,7 @@ class pdf_standard extends ModeleExpenseReport
if ($pageposafter > $pageposbefore) { if ($pageposafter > $pageposbefore) {
// There is a pagebreak // There is a pagebreak
$pdf->rollbackTransaction(true); $pdf->rollbackTransaction(true);
$pageposafter = $pageposbefore; $pageposafter = $pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
if (empty($showpricebeforepagebreak)) { if (empty($showpricebeforepagebreak)) {
@ -587,7 +588,7 @@ class pdf_standard extends ModeleExpenseReport
{ {
global $conf; global $conf;
$pdf->SetFont('', '', $default_font_size - 1); $pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetTextColor(0, 0, 0);
// Accountancy piece // Accountancy piece
$pdf->SetXY($this->posxpiece, $curY); $pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment - $this->posxpiece - 0.8, 4, $this->posxpiece - 1, $curY, $linenumber + 1, 0, 1); $pdf->writeHTMLCell($this->posxcomment - $this->posxpiece - 0.8, 4, $this->posxpiece - 1, $curY, $linenumber + 1, 0, 1);

View File

@ -328,6 +328,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetAutoPageBreak(1, 0); $pdf->SetAutoPageBreak(1, 0);
$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
if($heightforinfotot > 220) $heightforinfotot = 220;
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6; if ($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS > 0) $heightforfooter += 6;

View File

@ -664,11 +664,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3; $larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
$pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25); $pdf->Rect($this->marge_gauche, $posy + 1, $larg_sign, 25);
$pdf->SetXY($this->marge_gauche + 2, $posy + 2); $pdf->SetXY($this->marge_gauche + 2, $posy + 2);
$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->name).":", '', 'L'); $pdf->MultiCell($larg_sign, 2, $outputlangs->transnoentities("For") . ' ' . $outputlangs->convToOutputCharset($mysoc->name) . ":", '', 'L');
$pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25); $pdf->Rect(2*$larg_sign+$this->marge_gauche, $posy + 1, $larg_sign, 25);
$pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2); $pdf->SetXY(2*$larg_sign+$this->marge_gauche + 2, $posy + 2);
$pdf->MultiCell($larg_sign, 2, $outputlangs->trans("ForCustomer").':', '', 'L'); $pdf->MultiCell($larg_sign, 2, $outputlangs->transnoentities("ForCustomer") . ':', '', 'L');
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore

View File

@ -777,7 +777,9 @@ class pdf_standard extends ModelePDFSuppliersPayments
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs); $carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $mysoc, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object); $usecontact = 0;
$carac_client = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, ((!empty($object->contact))?$object->contact:null), $usecontact, 'target', $object);
// Show recipient // Show recipient
$widthrecbox=90; $widthrecbox=90;

View File

@ -76,7 +76,7 @@ print '<input type="button" name="savefilter" id="savefilter" value="'.$langs->t
print '</td><td>' . "\n"; print '</td><td>' . "\n";
print '</td></tr>' . "\n"; print '</td></tr>' . "\n";
print '<tr><td>' . $langs->trans('AdvTgtOrCreateNewFilter') . '</td><td>'; print '<tr><td>'.$langs->trans('AdvTgtOrCreateNewFilter').'</td><td>';
print '<input type="text" name="template_name" id="template_name" value=""/>'; print '<input type="text" name="template_name" id="template_name" value=""/>';
print '<input type="button" name="createfilter" id="createfilter" value="'.$langs->trans('AdvTgtCreateFilter').'" class="button"/>'; print '<input type="button" name="createfilter" id="createfilter" value="'.$langs->trans('AdvTgtCreateFilter').'" class="button"/>';
print '</td><td>'."\n"; print '</td><td>'."\n";
@ -510,14 +510,11 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key.'_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key.'_cnct']); print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key.'_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key.'_cnct']);
print '</td><td>'."\n"; print '</td><td>'."\n";
} else { } else {
print '<table class="nobordernopadding"><tr>';
print '<td></td><td>';
if (is_array($array_query['options_'.$key.'_cnct'])) { if (is_array($array_query['options_'.$key.'_cnct'])) {
print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key.'_cnct']), '', '_cnct'); print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key.'_cnct']), '', '_cnct');
} else { } else {
print $extrafields->showInputField($key, $array_query['options_'.$key.'_cnct'], '', '_cnct'); print $extrafields->showInputField($key, $array_query['options_'.$key.'_cnct'], '', '_cnct');
} }
print '</td></tr></table>';
print '</td><td>'."\n"; print '</td><td>'."\n";
} }
print '</td></tr>'."\n"; print '</td></tr>'."\n";

View File

@ -80,7 +80,12 @@ $(document).ready(function(){
console.log("tableDND end of ajax call"); console.log("tableDND end of ajax call");
if (reloadpage == 1) { if (reloadpage == 1) {
//console.log('<?php echo $urltorefreshaftermove.' - '.$_SERVER['PHP_SELF'].' - '.dol_escape_js($_SERVER['QUERY_STRING']); ?>'); //console.log('<?php echo $urltorefreshaftermove.' - '.$_SERVER['PHP_SELF'].' - '.dol_escape_js($_SERVER['QUERY_STRING']); ?>');
location.href = '<?php echo dol_escape_js(empty($urltorefreshaftermove) ? ($_SERVER['PHP_SELF'].'?'.dol_escape_js($_SERVER['QUERY_STRING'])) : $urltorefreshaftermove); ?>'; <?php
$redirectURL = empty($urltorefreshaftermove) ? ($_SERVER['PHP_SELF'].'?'.dol_escape_js($_SERVER['QUERY_STRING'])) : $urltorefreshaftermove;
// remove action parameter from URL
$redirectURL = preg_replace('/(&|\?)action=[^&#]*/', '', $redirectURL);
?>
location.href = '<?php echo dol_escape_js($redirectURL); ?>';
} else { } else {
$("#<?php echo $tagidfortablednd; ?> .drag").each( $("#<?php echo $tagidfortablednd; ?> .drag").each(
function( intIndex ) { function( intIndex ) {

View File

@ -131,6 +131,21 @@ if ($action == 'presend')
{ {
$formmail->fromid = $user->id; $formmail->fromid = $user->id;
} }
if ($object->element === 'facture' && !empty($conf->global->INVOICE_EMAIL_SENDER)) {
$formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER;
$formmail->fromname = '';
$formmail->fromtype = 'special';
}
if ($object->element === 'shipping' && !empty($conf->global->SHIPPING_EMAIL_SENDER)) {
$formmail->frommail = $conf->global->SHIPPING_EMAIL_SENDER;
$formmail->fromname = '';
$formmail->fromtype = 'special';
}
if ($object->element === 'commande' && !empty($conf->global->COMMANDE_EMAIL_SENDER)) {
$formmail->frommail = $conf->global->COMMANDE_EMAIL_SENDER;
$formmail->fromname = '';
$formmail->fromtype = 'special';
}
$formmail->trackid=$trackid; $formmail->trackid=$trackid;
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
{ {

View File

@ -60,7 +60,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e
// we keep position for the first line // we keep position for the first line
$totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield']; $totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield'];
} }
$totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; if (is_numeric($obj->$tmpkey)) $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey;
} }
if (!empty($val['isameasure'])) if (!empty($val['isameasure']))
{ {

View File

@ -214,6 +214,9 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
var parent = $(this).find("option[parent]:first").attr("parent"); var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":"); var infos = parent.split(":");
var parent_list = infos[0]; var parent_list = infos[0];
showOptions(child_list, parent_list);
/* Activate the handler to call showOptions on each future change */
$("select[name=\""+parent_list+"\"]").change(function() { $("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list); showOptions(child_list, parent_list);
}); });

View File

@ -302,6 +302,79 @@ if (!empty($extrafields))
<script type="text/javascript"> <script type="text/javascript">
<?php
if (! empty($usemargins) && $user->rights->margins->creer)
{
?>
/* Some js test when we click on button "Add" */
jQuery(document).ready(function() {
<?php
if (! empty($conf->global->DISPLAY_MARGIN_RATES)) {
?>
$("input[name='np_marginRate']:first").blur(function(e) {
return checkFreeLine(e, "np_marginRate");
});
<?php
}
if (! empty($conf->global->DISPLAY_MARK_RATES)) {
?>
$("input[name='np_markRate']:first").blur(function(e) {
return checkFreeLine(e, "np_markRate");
});
<?php
}
?>
});
/* TODO This does not work for number with thousand separator that is , */
function checkFreeLine(e, npRate)
{
var buying_price = $("input[name='buying_price']:first");
var remise = $("input[name='remise_percent']:first");
var rate = $("input[name='"+npRate+"']:first");
if (rate.val() == '')
return true;
var ratejs = price2numjs(rate.val());
if (! $.isNumeric(ratejs))
{
alert('<?php echo dol_escape_js($langs->transnoentities("rateMustBeNumeric")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
if (npRate == "np_markRate" && rate.val() >= 100)
{
alert('<?php echo dol_escape_js($langs->transnoentities("markRateShouldBeLesserThan100")); ?>');
e.stopPropagation();
setTimeout(function () { rate.focus() }, 50);
return false;
}
var price = 0;
remisejs=price2numjs(remise.val());
if (remisejs != 100) // If a discount not 100 or no discount
{
if (remisejs == '') remisejs=0;
bpjs=price2numjs(buying_price.val());
ratejs=price2numjs(rate.val());
if (npRate == "np_marginRate")
price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100));
else if (npRate == "np_markRate")
price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100));
}
$("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value
return true;
}
<?php
}
?>
jQuery(document).ready(function() jQuery(document).ready(function()
{ {
jQuery("#price_ht").keyup(function(event) { jQuery("#price_ht").keyup(function(event) {

View File

@ -299,6 +299,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
//Build array of quantity ordered by product //Build array of quantity ordered by product
if (is_array($order->lines) && count($order->lines)>0) { if (is_array($order->lines) && count($order->lines)>0) {
foreach($order->lines as $orderline) { foreach($order->lines as $orderline) {
if (empty($conf->global->STOCK_SUPPORTS_SERVICES) && $orderline->product_type > 0) continue;
$qtyordred[$orderline->fk_product]+=$orderline->qty; $qtyordred[$orderline->fk_product]+=$orderline->qty;
} }
} }

View File

@ -1057,7 +1057,8 @@ class Cronjob extends CommonObject
if (!$error) if (!$error)
{ {
$result = $langs->load($this->module_name); $result = $langs->load($this->module_name);
$result = $langs->load($this->module_name.'@'.$this->module_name); // If this->module_name was an existing language file, this will make nothing $result = $langs->load($this->module_name.'@'.$this->module_name, 0, 0, '', 0, 1);
if ($result < 0) // If technical error if ($result < 0) // If technical error
{ {
dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR); dol_syslog(get_class($this)."::run_jobs Cannot load module lang file - ".$langs->error, LOG_ERR);

View File

@ -159,11 +159,13 @@ if (isset($_GET["attachment"])) $attachment = GETPOST("attachment", 'alpha') ?tr
if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false; if (!empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment = false;
// Define mime type // Define mime type
$type = 'application/octet-stream'; $type = 'application/octet-stream'; // By default
if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha'); if (GETPOST('type', 'alpha')) $type = GETPOST('type', 'alpha');
else $type = dol_mimetype($original_file); else $type=dol_mimetype($original_file);
// Security: Force to octet-stream if file is a dangerous file // Security: Force to octet-stream if file is a dangerous file. For example when it is a .noexe file
if (preg_match('/\.noexe$/i', $original_file)) $type = 'application/octet-stream'; if (!in_array($type, array('text/x-javascript')) && !dolIsAllowedForPreview($original_file)) {
$type = 'application/octet-stream';
}
// Security: Delete string ../ into $original_file // Security: Delete string ../ into $original_file
$original_file = str_replace("../", "/", $original_file); $original_file = str_replace("../", "/", $original_file);

View File

@ -312,7 +312,7 @@ class EcmFiles extends CommonObject
* @param string $relativepath Relative path of file from document directory. Example: path/path2/file * @param string $relativepath Relative path of file from document directory. Example: path/path2/file
* @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed. * @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed.
* @param string $hashforshare Hash of file sharing. * @param string $hashforshare Hash of file sharing.
* @param string $src_object_type src_object_type to search * @param string $src_object_type src_object_type to search (value of object->table_element)
* @param string $src_object_id src_object_id to search * @param string $src_object_id src_object_id to search
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */

View File

@ -1524,13 +1524,19 @@ if ($action == 'create')
} }
if ($subj == 0) // Line not shown yet, we show it if ($subj == 0) // Line not shown yet, we show it
{ {
$warehouse_selected_id = GETPOST('entrepot_id', 'int');
print '<!-- line not shown yet, we show it -->'; print '<!-- line not shown yet, we show it -->';
print '<tr class="oddeven"><td colspan="3" ></td><td class="center">'; print '<tr class="oddeven"><td colspan="3"></td><td class="center">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
$disabled = ''; $disabled = '';
if (!empty($conf->productbatch->enabled) && $product->hasbatch()) if (!empty($conf->productbatch->enabled) && $product->hasbatch())
{ {
$disabled = 'disabled="disabled"';
}
if ($warehouse_selected_id <= 0) { // We did not force a given warehouse, so we won't have no warehouse to change qty.
$disabled = 'disabled="disabled"'; $disabled = 'disabled="disabled"';
} }
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> '; print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled ? ' '.$disabled : '').'> ';
@ -1544,7 +1550,6 @@ if ($action == 'create')
print '<td class="left">'; print '<td class="left">';
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
$warehouse_selected_id = GETPOST('entrepot_id', 'int');
if ($warehouse_selected_id > 0) if ($warehouse_selected_id > 0)
{ {
$warehouseObject = new Entrepot($db); $warehouseObject = new Entrepot($db);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
@ -323,10 +323,10 @@ class Expedition extends CommonObject
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null"); $sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:"null");
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null"); $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null");
$sql.= ", '".$this->db->escape($this->tracking_number)."'"; $sql.= ", '".$this->db->escape($this->tracking_number)."'";
$sql.= ", ".$this->weight; $sql.= ", ".(is_numeric($this->weight)?$this->weight:'NULL');
$sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth $sql.= ", ".(is_numeric($this->sizeS)?$this->sizeS:'NULL'); // TODO Should use this->trueDepth
$sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth $sql.= ", ".(is_numeric($this->sizeW)?$this->sizeW:'NULL'); // TODO Should use this->trueWidth
$sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight $sql.= ", ".(is_numeric($this->sizeH)?$this->sizeH:'NULL'); // TODO Should use this->trueHeight
$sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL'); $sql.= ", ".($this->weight_units != '' ? (int) $this->weight_units : 'NULL');
$sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL'); $sql.= ", ".($this->size_units != '' ? (int) $this->size_units : 'NULL');
$sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null");
@ -1325,6 +1325,9 @@ class Expedition extends CommonObject
{ {
$this->db->commit(); $this->db->commit();
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We delete PDFs // We delete PDFs
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if (!empty($conf->expedition->dir_output)) if (!empty($conf->expedition->dir_output))

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (c) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (c) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016-2020 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -600,6 +600,8 @@ class ExpenseReport extends CommonObject
$this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname); $this->user_valid_infos = dolGetFirstLastname($user_valid->firstname, $user_valid->lastname);
} }
$this->fetch_optionals();
$this->lines = array(); $this->lines = array();
$result = $this->fetch_lines(); $result = $this->fetch_lines();
@ -1104,31 +1106,48 @@ class ExpenseReport extends CommonObject
if (!$rowid) $rowid = $this->id; if (!$rowid) $rowid = $this->id;
$error = 0;
// Delete lines
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element_line.' WHERE '.$this->fk_element.' = '.$rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element_line.' WHERE '.$this->fk_element.' = '.$rowid;
if ($this->db->query($sql)) if (!$error && !$this->db->query($sql))
{ {
$this->error = $this->db->error()." sql=".$sql;
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
$error++;
}
// Delete llx_ecm_files
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."ecm_files WHERE src_object_type = '".$this->db->escape($this->table_element.(empty($this->module) ? '' : '@'.$this->module))."' AND src_object_id = ".$this->id;
$resql = $this->db->query($sql);
if (!$resql)
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
$error++;
}
}
// Delete main record
if (!$error) {
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid = '.$rowid; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid = '.$rowid;
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if (!$resql)
{ {
$this->error = $this->db->error()." sql=".$sql;
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
}
}
// Commit or rollback
if ($error) {
$this->db->rollback();
return -1;
} else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
else
{
$this->error = $this->db->error()." sql=".$sql;
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
$this->db->rollback();
return -6;
}
}
else
{
$this->error = $this->db->error()." sql=".$sql;
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
$this->db->rollback();
return -4;
}
} }
/** /**

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
@ -1000,6 +1000,9 @@ class Fichinter extends CommonObject
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// Remove directory with files // Remove directory with files
$fichinterref = dol_sanitizeFileName($this->ref); $fichinterref = dol_sanitizeFileName($this->ref);
if ($conf->ficheinter->dir_output) if ($conf->ficheinter->dir_output)

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -330,9 +330,11 @@ class CommandeFournisseur extends CommonOrder
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_input_method as cm ON cm.rowid = c.fk_input_method";
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
$sql .= " WHERE c.entity IN (".getEntity('supplier_order').")";
if (empty($id)) $sql .= " WHERE c.entity IN (".getEntity('supplier_order').")";
else $sql .= " WHERE c.rowid=".$id;
if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'"; if ($ref) $sql .= " AND c.ref='".$this->db->escape($ref)."'";
else $sql .= " AND c.rowid=".$id;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -1271,11 +1273,15 @@ class CommandeFournisseur extends CommonOrder
$error = 0; $error = 0;
$now = dol_now(); $now = dol_now();
// $date_commande is deprecated
$date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set
if(empty($date)) $date = $now;
// Clean parameters // Clean parameters
if (empty($this->source)) $this->source = 0; if (empty($this->source)) $this->source = 0;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date);
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
if (empty($this->fk_multicurrency)) if (empty($this->fk_multicurrency))
{ {
@ -2056,6 +2062,9 @@ class CommandeFournisseur extends CommonOrder
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
$ref = dol_sanitizeFileName($this->ref); $ref = dol_sanitizeFileName($this->ref);
if ($conf->fournisseur->commande->dir_output) if ($conf->fournisseur->commande->dir_output)

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr> * Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2020 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2019 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2019 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
@ -359,7 +359,7 @@ class FactureFournisseur extends CommonInvoice
$remise = $this->remise; $remise = $this->remise;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code); if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); else $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
if (empty($this->fk_multicurrency)) if (empty($this->fk_multicurrency))
{ {
@ -1217,6 +1217,9 @@ class FactureFournisseur extends CommonInvoice
if (!$error) if (!$error)
{ {
// Delete record into ECM index (Note that delete is also done when deleting files with the dol_delete_dir_recursive
$this->deleteEcmFiles();
// We remove directory // We remove directory
if ($conf->fournisseur->facture->dir_output) if ($conf->fournisseur->facture->dir_output)
{ {
@ -2466,7 +2469,7 @@ class FactureFournisseur extends CommonInvoice
{ {
$this->error=$obj->error; $this->error=$obj->error;
//dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error); //dol_print_error($db,get_class($this)."::getNextNumRef ".$obj->error);
return false; return -1;
} }
} }

View File

@ -1008,7 +1008,7 @@ class ProductFournisseur extends Product
//$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>'; //$out .= '<td class="liste_titre right">'.$langs->trans("QtyMin").'</td>';
$out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>'; $out .= '<td class="liste_titre">'.$langs->trans("User").'</td></tr>';
foreach ($productFournLogList as $productFournLog) { foreach ($productFournLogList as $productFournLog) {
$out .= '<tr><td class="right">'.dol_print_date($this->db->jdate($productFournLog['datec']), 'dayhour', 'tzuser').'</td>'; $out .= '<tr><td class="right">'.dol_print_date($productFournLog['datec'], 'dayhour', 'tzuser').'</td>';
$out .= '<td class="right">'.price($productFournLog['price']).'</td>'; $out .= '<td class="right">'.price($productFournLog['price']).'</td>';
//$out.= '<td class="right">'.$productFournLog['quantity'].'</td>'; //$out.= '<td class="right">'.$productFournLog['quantity'].'</td>';
$out .= '<td>'.$productFournLog['lastname'].'</td></tr>'; $out .= '<td>'.$productFournLog['lastname'].'</td></tr>';

View File

@ -460,11 +460,26 @@ if (empty($reshook))
if ($idprod > 0) if ($idprod > 0)
{ {
$label = $productsupplier->label; $label = $productsupplier->label;
// Define output language
if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs;
$newlang = '';
if (empty($newlang) && GETPOST('lang_id', 'aZ09'))
$newlang = GETPOST('lang_id', 'aZ09');
if (empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (!empty($productsupplier->multilangs [$outputlangs->defaultlang] ["description"])) ? $productsupplier->multilangs [$outputlangs->defaultlang] ["description"] : $productsupplier->description;
} else {
$desc = $productsupplier->description;
}
// if we use supplier description of the products // if we use supplier description of the products
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) { if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
$desc = $productsupplier->desc_supplier; $desc = $productsupplier->desc_supplier;
} else $desc = $productsupplier->description; }
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));

View File

@ -57,7 +57,7 @@ if (!empty($conf->variants->enabled)) {
if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks')); $langs->loadLangs(array('bills', 'compta', 'suppliers', 'companies', 'products', 'banks', 'admin'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
$id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int')); $id = (GETPOST('facid', 'int') ? GETPOST('facid', 'int') : GETPOST('id', 'int'));
@ -331,7 +331,39 @@ if (empty($reshook))
// payments conditions // payments conditions
if ($action == 'setconditions' && $user->rights->fournisseur->facture->creer) if ($action == 'setconditions' && $user->rights->fournisseur->facture->creer)
{ {
$object->fetch($id);
$object->cond_reglement_code = 0; // To clean property
$object->cond_reglement_id = 0; // To clean property
$error = 0;
$db->begin();
if (! $error) {
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if (! $error) {
$old_date_echeance = $object->date_echeance;
$new_date_echeance = $object->calculate_date_lim_reglement();
if ($new_date_echeance > $old_date_echeance) $object->date_echeance = $new_date_echeance;
if ($object->date_echeance < $object->date) $object->date_echeance = $object->date;
$result = $object->update($user);
if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
}
if ($error) {
$db->rollback();
} else {
$db->commit();
}
} }
// Set incoterm // Set incoterm
@ -2297,11 +2329,9 @@ else
// Confirmation de la validation // Confirmation de la validation
if ($action == 'valid') if ($action == 'valid')
{ {
// on verifie si l'objet est en numerotation provisoire // We check if number is temporary number
$objectref = substr($object->ref, 1, 4); if (preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life
if ($objectref == 'PROV')
{ {
$savdate = $object->date;
$numref = $object->getNextNumRef($societe); $numref = $object->getNextNumRef($societe);
} }
else else
@ -2309,6 +2339,13 @@ else
$numref = $object->ref; $numref = $object->ref;
} }
if ($numref < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
else
{
$text = $langs->trans('ConfirmValidateBill', $numref); $text = $langs->trans('ConfirmValidateBill', $numref);
/*if (! empty($conf->notification->enabled)) /*if (! empty($conf->notification->enabled))
{ {
@ -2320,35 +2357,32 @@ else
$formquestion = array(); $formquestion = array();
$qualified_for_stock_change = 0; $qualified_for_stock_change = 0;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
{
$qualified_for_stock_change = $object->hasProductsOrServices(2); $qualified_for_stock_change = $object->hasProductsOrServices(2);
} } else {
else
{
$qualified_for_stock_change = $object->hasProductsOrServices(1); $qualified_for_stock_change = $object->hasProductsOrServices(1);
} }
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change) {
{
$langs->load("stocks"); $langs->load("stocks");
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
$warehouse = new Entrepot($db); $warehouse = new Entrepot($db);
$warehouse_array = $warehouse->list_array(); $warehouse_array = $warehouse->list_array();
if (count($warehouse_array) == 1) { if (count($warehouse_array) == 1) {
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array)); $label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">'; $value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="' . key($warehouse_array) . '">';
} else { } else {
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease"); $label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1); $value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ? GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
} }
$formquestion = array( $formquestion = array(
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value) array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
); );
} }
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1);
}
} }
// Confirmation edit (back to draft) // Confirmation edit (back to draft)

View File

@ -27,10 +27,10 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers')); $langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));
@ -210,7 +210,7 @@ if ($result > 0)
*/ */
// Amount // Amount
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>'; print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{ {

View File

@ -409,12 +409,11 @@ if (typeof(PhpDebugBar) == 'undefined') {
className: "phpdebugbar " + csscls('minimized'), className: "phpdebugbar " + csscls('minimized'),
options: {
bodyMarginBottom: true,
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom'))
},
initialize: function() { initialize: function() {
this.options = {
bodyMarginBottom: true,
bodyMarginBottomHeight: parseInt($('body').css('margin-bottom')),
};
this.controls = {}; this.controls = {};
this.dataMap = {}; this.dataMap = {};
this.datasets = {}; this.datasets = {};

View File

@ -242,7 +242,7 @@ class DoliStorage implements TokenStorageInterface
$sql.= " WHERE service='".$this->db->escape($service)."'"; $sql.= " WHERE service='".$this->db->escape($service)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
$result = $this->db->fetch_array($resql); $result = $this->db->fetch_array($resql);
$states[$service] = $result[state]; $states[$service] = $result['state'];
$this->states[$service] = $states[$service]; $this->states[$service] = $states[$service];
return is_array($states) return is_array($states)

View File

@ -98,7 +98,8 @@ ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN qty_frozen smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0; ALTER TABLE llx_bom_bomline ADD COLUMN disable_stock_change smallint DEFAULT 0;
ALTER TABLE llx_bom_bomline DROP COLUMN rank; -- VMYSQL4.1 ALTER TABLE llx_bom_bomline DROP COLUMN `rank`;
-- VPGSQL8.2 ALTER TABLE llx_bom_bomline DROP COLUMN rank;
create table llx_categorie_warehouse create table llx_categorie_warehouse
( (

View File

@ -315,6 +315,7 @@ ALTER TABLE llx_c_chargesociales ADD COLUMN accountancy_code varchar(15) DEFAULT
-- Tables for accountancy expert -- Tables for accountancy expert
DROP TABLE llx_accountingaccount; DROP TABLE llx_accountingaccount;
DROP TABLE llx_accounting_account;
DROP TABLE llx_accountingsystem; DROP TABLE llx_accountingsystem;
DROP TABLE llx_accounting_system; DROP TABLE llx_accounting_system;

View File

@ -102,6 +102,10 @@ ALTER TABLE llx_expedition DROP FOREIGN KEY fk_expedition_fk_shipping_method;
ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode; ALTER TABLE llx_expedition DROP INDEX idx_expedition_fk_expedition_methode;
ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer; ALTER TABLE llx_expedition CHANGE COLUMN fk_expedition_methode fk_shipping_method integer;
-- This table and constraint should not exists as it appears in more recent version, but we may have it if we load an old dump
-- on a newly created database and we want to be sure upgrade of rowid into autoincrement done later will works.
ALTER TABLE llx_reception DROP FOREIGN KEY fk_reception_fk_shipping_method;
ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description; ALTER TABLE llx_c_shipment_mode ADD COLUMN tracking VARCHAR(255) NOT NULL DEFAULT '' AFTER description;
--ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE; --ALTER TABLE llx_c_shipment_mode DROP COLUMN CASCADE;

View File

@ -185,6 +185,7 @@ delete from llx_categorie_project where fk_categorie not in (select rowid from l
-- Fix: delete orphelins in ecm_files -- Fix: delete orphelins in ecm_files
delete from llx_ecm_files where src_object_type = 'expensereport' and src_object_id NOT IN (select rowid from llx_expensereport); delete from llx_ecm_files where src_object_type = 'expensereport' and src_object_id NOT IN (select rowid from llx_expensereport);
delete from llx_ecm_files where (src_object_type = 'contrat' OR src_object_type = 'contract') and src_object_id NOT IN (select rowid from llx_contrat);
-- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links. -- Fix: delete orphelin deliveries. Note: deliveries are linked to shipment by llx_element_element only. No other links.
delete from llx_livraisondet where fk_livraison not in (select fk_target from llx_element_element where targettype = 'delivery') AND fk_livraison not in (select fk_source from llx_element_element where sourcetype = 'delivery'); delete from llx_livraisondet where fk_livraison not in (select fk_target from llx_element_element where targettype = 'delivery') AND fk_livraison not in (select fk_source from llx_element_element where sourcetype = 'delivery');

View File

@ -53,7 +53,7 @@ create table llx_contratdet
total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne total_localtax1 double(24,8) DEFAULT 0, -- Total Local tax 1 de la ligne
total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne total_localtax2 double(24,8) DEFAULT 0, -- Total Local tax 2 de la ligne
total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale total_ttc double(24,8) DEFAULT 0, -- Total TTC de la ligne toute quantite et incluant remise ligne et globale
product_type integer DEFAULT 1, -- Product type (1=service by default) product_type integer DEFAULT 1, -- Type of line (1=service by default)
info_bits integer DEFAULT 0, -- TVA NPR ou non info_bits integer DEFAULT 0, -- TVA NPR ou non
buy_price_ht double(24,8) DEFAULT NULL, -- buying price buy_price_ht double(24,8) DEFAULT NULL, -- buying price

View File

@ -353,8 +353,8 @@ PriceUTTC=U.P. (inc. tax)
Amount=Amount Amount=Amount
AmountInvoice=Invoice amount AmountInvoice=Invoice amount
AmountInvoiced=Amount invoiced AmountInvoiced=Amount invoiced
AmountInvoicedHT=Amount invoiced (incl. tax) AmountInvoicedHT=Amount invoiced (excl. tax)
AmountInvoicedTTC=Amount invoiced (excl. tax) AmountInvoicedTTC=Amount invoiced (inc. tax)
AmountPayment=Payment amount AmountPayment=Payment amount
AmountHTShort=Amount (excl.) AmountHTShort=Amount (excl.)
AmountTTCShort=Amount (inc. tax) AmountTTCShort=Amount (inc. tax)

View File

@ -97,6 +97,7 @@ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNA
PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n
PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection) ChooseYourDemoProfilMore=...or build your own profile<br>(manual module selection)

View File

@ -353,8 +353,8 @@ PriceUTTC=P.U TTC
Amount=Montant Amount=Montant
AmountInvoice=Montant facture AmountInvoice=Montant facture
AmountInvoiced=Montant facturé AmountInvoiced=Montant facturé
AmountInvoicedHT=Montant facturé (TTC) AmountInvoicedHT=Montant facturé (HT)
AmountInvoicedTTC=Montant facturé (HT) AmountInvoicedTTC=Montant facturé (TTC)
AmountPayment=Montant paiement AmountPayment=Montant paiement
AmountHTShort=Montant HT AmountHTShort=Montant HT
AmountTTCShort=Montant TTC AmountTTCShort=Montant TTC

View File

@ -83,7 +83,7 @@ if (empty($reshook))
if ($result > 0) if ($result > 0)
{ {
setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs'); setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
else else
@ -156,7 +156,7 @@ if (empty($reshook))
} }
else else
{ {
header("Location: index.php"); header("Location: list.php");
exit(); exit();
} }
} }

View File

@ -238,6 +238,7 @@ if (!empty($conf->debugbar->enabled) && ! GETPOST('dol_use_jmobile') && empty($_
include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php'; include_once DOL_DOCUMENT_ROOT.'/debugbar/class/DebugBar.php';
$debugbar = new DolibarrDebugBar(); $debugbar = new DolibarrDebugBar();
$renderer = $debugbar->getRenderer(); $renderer = $debugbar->getRenderer();
if (empty($conf->global->MAIN_HTML_HEADER)) $conf->global->MAIN_HTML_HEADER = '';
$conf->global->MAIN_HTML_HEADER .= $renderer->renderHead(); $conf->global->MAIN_HTML_HEADER .= $renderer->renderHead();
$debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)'); $debugbar['time']->startMeasure('pageaftermaster', 'Page generation (after environment init)');
@ -904,7 +905,7 @@ elseif (!empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER))
} }
// set MAIN_OPTIMIZEFORCOLORBLIND // set MAIN_OPTIMIZEFORCOLORBLIND
$conf->global->MAIN_OPTIMIZEFORCOLORBLIND = $user->conf->MAIN_OPTIMIZEFORCOLORBLIND; $conf->global->MAIN_OPTIMIZEFORCOLORBLIND = empty($user->conf->MAIN_OPTIMIZEFORCOLORBLIND) ? '' : $user->conf->MAIN_OPTIMIZEFORCOLORBLIND;
// Set terminal output option according to conf->browser. // Set terminal output option according to conf->browser.
if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu = 1; if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) $conf->dol_hide_leftmenu = 1;
@ -1145,8 +1146,8 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
// // A default security policy that keep usage of js external component like ckeditor, stripe, google, working // // A default security policy that keep usage of js external component like ckeditor, stripe, google, working
// $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';"; // $contentsecuritypolicy = "font-src *; img-src *; style-src * 'unsafe-inline' 'unsafe-eval'; default-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; script-src 'self' *.stripe.com 'unsafe-inline' 'unsafe-eval'; frame-src 'self' *.stripe.com; connect-src 'self';";
//} //}
//else $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; //else
$contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY; $contentsecuritypolicy = empty($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY) ? '': $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
if (!is_object($hookmanager)) $hookmanager = new HookManager($db); if (!is_object($hookmanager)) $hookmanager = new HookManager($db);
$hookmanager->initHooks(array("main")); $hookmanager->initHooks(array("main"));
@ -1591,6 +1592,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; if (!empty($conf->global->MAIN_FEATURES_LEVEL)) $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
$logouttext = ''; $logouttext = '';
$logouthtmltext = '';
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
//$logouthtmltext=$appli.'<br>'; //$logouthtmltext=$appli.'<br>';

View File

@ -530,7 +530,7 @@ class MultiCurrency extends CommonObject
$sql1.= " AND m.entity IN (".getEntity('multicurrency').")"; $sql1.= " AND m.entity IN (".getEntity('multicurrency').")";
$sql2= ''; $sql2= '';
if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"'; if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) $sql2.= ' AND DATE_FORMAT(mc.date_sync, "%Y-%m-%d") = "'.date('Y-m-d', $date_document).'"';
$sql3.= ' ORDER BY mc.date_sync DESC LIMIT 1'; $sql3 = ' ORDER BY mc.date_sync DESC LIMIT 1';
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $db->query($sql1.$sql2.$sql3); $resql = $db->query($sql1.$sql2.$sql3);

View File

@ -219,15 +219,10 @@ class Productcustomerprice extends CommonObject
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_customer_price"); $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_customer_price");
if (!$notrigger) { if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_CREATE', $user);
// want this action calls a trigger. if ($result < 0) {
$error++;
// // Call triggers }
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
// $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers
} }
} }
@ -708,14 +703,12 @@ class Productcustomerprice extends CommonObject
$this->errors [] = "Error ".$this->db->lasterror(); $this->errors [] = "Error ".$this->db->lasterror();
} }
if (!$error) { if (! $error) {
if (!$notrigger) { if (! $notrigger) {
// Call triggers $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_UPDATE', $user);
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; if ($result < 0) {
$interface = new Interfaces($this->db); $error++;
$result = $interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE', $this, $user, $langs, $conf); }
if ($result < 0) { $error++; $this->errors = $interface->errors; }
// End call triggers
} }
} }
@ -849,17 +842,12 @@ class Productcustomerprice extends CommonObject
$this->db->begin(); $this->db->begin();
if (!$error) { if (! $error) {
if (!$notrigger) { if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you $result = $this->call_trigger('PRODUCT_CUSTOMER_PRICE_DELETE', $user);
// want this action calls a trigger. if ($result < 0) {
$error++;
// // Call triggers }
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
// $result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers
} }
} }

View File

@ -66,12 +66,13 @@ if ($id > 0 || ! empty($ref))
if ($cancel) $action =''; if ($cancel) $action ='';
// Action association d'un sousproduit // Add subproduct to product
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer)) if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
$error=0; $error=0;
for ($i=0; $i < GETPOST("max_prod", 'int'); $i++) $maxprod = GETPOST("max_prod", 'int');
for ($i=0; $i < $maxprod; $i++)
{ {
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS'); $qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
if ($qty > 0) if ($qty > 0)
@ -365,11 +366,12 @@ if ($id > 0 || ! empty($ref))
$fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0);
$fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0);
$totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); $unitline = price2num(($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MU');
$total+=$totalline; $totalline = price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT');
$total += $totalline;
print '<td class="right">'; print '<td class="right">';
print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($unitline, '', '', 0, 0, -1, $conf->currency));
print '</td>'; print '</td>';
// Best selling price // Best selling price

View File

@ -208,7 +208,7 @@ if ($id > 0 || !empty($ref))
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder);
print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "d.total_ht", "", $option, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder);
print "</tr>\n"; print "</tr>\n";

View File

@ -104,6 +104,7 @@ class Entrepot extends CommonObject
*/ */
public $fields=array( public $fields=array(
'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>15),
'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-2, 'position'=>35),
@ -441,6 +442,7 @@ class Entrepot extends CommonObject
} }
$sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id"; $sql = "SELECT rowid, fk_parent, ref as label, description, statut, lieu, address, zip, town, fk_pays as country_id";
$sql .= " , entity";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot";
if ($id) if ($id)
{ {
@ -460,6 +462,7 @@ class Entrepot extends CommonObject
$obj=$this->db->fetch_object($result); $obj=$this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->fk_parent = $obj->fk_parent; $this->fk_parent = $obj->fk_parent;
$this->ref = $obj->label; $this->ref = $obj->label;
$this->label = $obj->label; $this->label = $obj->label;

View File

@ -209,13 +209,13 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as ccount ON ccount.rowid = t.fk
$sql .= " WHERE t.entity IN (".getEntity('stock').")"; $sql .= " WHERE t.entity IN (".getEntity('stock').")";
foreach ($search as $key => $val) foreach ($search as $key => $val)
{ {
if ($key == 'status' && $search[$key] == -1) continue; if (($key == 'status' && $search[$key] == -1) || $key=='entity') continue;
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) { if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') $search[$key] = ''; if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2; $mode_search = 2;
} }
if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search)); if ($search[$key] != '') $sql .= natural_search((($key == 'ref') ? 't.ref' : $key), $search[$key], (($key == 'status') ? 2 : $mode_search));
} }
if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all); if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
// Add where from extra fields // Add where from extra fields

View File

@ -78,6 +78,7 @@ $cancel != $langs->trans("Cancel") &&
$object->label = $_POST["libelle"]; $object->label = $_POST["libelle"];
$object->description = dol_htmlcleanlastbr($_POST["desc"]); $object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]); $object->other = dol_htmlcleanlastbr($_POST["other"]);
$object->update($object->id, $user);
} }
else else
{ {

View File

@ -63,7 +63,7 @@ $search_agenda_label = GETPOST('search_agenda_label');
$id = GETPOST("id", 'int'); $id = GETPOST("id", 'int');
$socid = 0; $socid = 0;
//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. //if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id, ''); $result = restrictedArea($user, 'projet', $id, 'projet&project');
if (!$user->rights->projet->lire) accessforbidden(); if (!$user->rights->projet->lire) accessforbidden();

View File

@ -366,7 +366,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->id; $id = $obj->id;
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1'); header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1');
exit; exit;
} }

View File

@ -552,7 +552,7 @@ if (empty($reshook))
// Links with users // Links with users
$salesreps = GETPOST('commercial', 'array'); $salesreps = GETPOST('commercial', 'array');
$result = $object->setSalesRep($salesreps); $result = $object->setSalesRep($salesreps, true);
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
@ -1570,7 +1570,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).'</td>'; print '<td>'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td colspan="3" class="maxwidthonsmartphone">';
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
// Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record.
$selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array())));
print $form->multiselectarray('commercial', $userlist, $selected, null, null, null, null, "90%"); print $form->multiselectarray('commercial', $userlist, $selected, null, null, null, null, "90%");
@ -2252,7 +2252,7 @@ else
print '<tr>'; print '<tr>';
print '<td>'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).'</td>'; print '<td>'.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).'</td>';
print '<td colspan="3" class="maxwidthonsmartphone">'; print '<td colspan="3" class="maxwidthonsmartphone">';
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
$arrayselected = GETPOST('commercial', 'array'); $arrayselected = GETPOST('commercial', 'array');
if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1); if (empty($arrayselected)) $arrayselected = $object->getSalesRepresentatives($user, 1);
print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%"); print $form->multiselectarray('commercial', $userlist, $arrayselected, null, null, null, null, "90%");

View File

@ -2412,7 +2412,15 @@ class Societe extends CommonObject
global $action; global $action;
$hookmanager->initHooks(array('thirdpartydao')); $hookmanager->initHooks(array('thirdpartydao'));
$parameters = array('id'=>$this->id, 'getnomurl'=>$result); $parameters = array(
'id'=>$this->id,
'getnomurl'=>$result,
'withpicto '=> $withpicto,
'option'=> $option,
'maxlen'=> $maxlen,
'notooltip'=> $notooltip,
'save_lastsearch_value'=> $save_lastsearch_value
);
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook > 0) $result = $hookmanager->resPrint; if ($reshook > 0) $result = $hookmanager->resPrint;
else $result .= $hookmanager->resPrint; else $result .= $hookmanager->resPrint;
@ -4270,9 +4278,10 @@ class Societe extends CommonObject
* Sets sales representatives of the thirdparty * Sets sales representatives of the thirdparty
* *
* @param int[]|int $salesrep User ID or array of user IDs * @param int[]|int $salesrep User ID or array of user IDs
* @param bool $onlyAdd Only add (no delete before)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function setSalesRep($salesrep) public function setSalesRep($salesrep, $onlyAdd = false)
{ {
global $user; global $user;
@ -4281,6 +4290,10 @@ class Societe extends CommonObject
$salesrep = array($salesrep); $salesrep = array($salesrep);
} }
$to_del = array(); // Nothing to delete
$to_add = $salesrep;
if ($onlyAdd === false) {
// Get current users // Get current users
$existing = $this->getSalesRepresentatives($user, 1); $existing = $this->getSalesRepresentatives($user, 1);
@ -4288,9 +4301,7 @@ class Societe extends CommonObject
if (is_array($existing)) { if (is_array($existing)) {
$to_del = array_diff($existing, $salesrep); $to_del = array_diff($existing, $salesrep);
$to_add = array_diff($salesrep, $existing); $to_add = array_diff($salesrep, $existing);
} else { }
$to_del = array(); // Nothing to delete
$to_add = $salesrep;
} }
$error = 0; $error = 0;

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