diff --git a/.travis.yml b/.travis.yml
index 5d7eb7a1678..44d784ea091 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -50,7 +50,7 @@ jobs:
env: DB=postgresql
- stage: PHP 5.6-7.4
if: type = pull_request OR type = push
- php: '7.4'
+ php: '7.4.22'
env: DB=mysql
- stage: PHP Dev
if: type = push AND branch = develop
@@ -106,7 +106,7 @@ install:
php-parallel-lint/php-console-highlighter ^0 \
squizlabs/php_codesniffer ^3
fi
- if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ]; then
+ if [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ]; then
composer -n require phpunit/phpunit ^7 \
php-parallel-lint/php-parallel-lint ^1.2 \
php-parallel-lint/php-console-highlighter ^0 \
@@ -241,7 +241,7 @@ before_script:
# enable php-fpm
- sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
- |
- if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
+ if [ "$TRAVIS_PHP_VERSION" = '7.0' ] || [ "$TRAVIS_PHP_VERSION" = '7.1' ] || [ "$TRAVIS_PHP_VERSION" = '7.2' ] || [ "$TRAVIS_PHP_VERSION" = '7.3' ] || [ "$TRAVIS_PHP_VERSION" = '7.4' ] || [ "$TRAVIS_PHP_VERSION" = '7.4.22' ] || [ "$TRAVIS_PHP_VERSION" = 'nightly' ]; then
# Copy the included pool
sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.d/www.conf
fi
@@ -276,7 +276,7 @@ script:
set -e
#parallel-lint --exclude htdocs/includes --blame .
# Exclusions are defined in the ruleset.xml file
- if [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
+ if [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; then
parallel-lint -e php --exclude dev/tools/test/namespacemig --exclude htdocs/includes/composer --exclude htdocs/includes/myclabs --exclude htdocs/includes/phpspec --exclude dev/initdata/dbf/includes \
--exclude htdocs/includes/sabre --exclude htdocs/includes/phpoffice/PhpSpreadsheet --exclude htdocs/includes/sebastian \
--exclude htdocs/includes/squizlabs/php_codesniffer --exclude htdocs/includes/jakub-onderka --exclude htdocs/includes/php-parallel-lint --exclude htdocs/includes/symfony \
@@ -291,7 +291,7 @@ script:
# Ensure we catch errors
set -e
# Exclusions are defined in the ruleset.xml file
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4" ]; then
+ if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_PHP_VERSION" = "7.4.22" ]; 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
set +e
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 0d0d013a69f..3c30200c130 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -64,6 +64,10 @@ class AccountancyExport
public static $EXPORT_TYPE_FEC = 1000;
public static $EXPORT_TYPE_FEC2 = 1010;
+ /**
+ * @var DoliDB Database handler
+ */
+ public $db;
/**
* @var string[] Error codes (or messages)
diff --git a/htdocs/accountancy/class/accountancyimport.class.php b/htdocs/accountancy/class/accountancyimport.class.php
index ea88534b6ed..8ca60e37796 100644
--- a/htdocs/accountancy/class/accountancyimport.class.php
+++ b/htdocs/accountancy/class/accountancyimport.class.php
@@ -39,6 +39,24 @@
*/
class AccountancyImport
{
+ /**
+ * @var DoliDB Database handler
+ */
+ public $db;
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDb $db Database handler
+ */
+ public function __construct(DoliDB $db)
+ {
+ global $conf;
+
+ $this->db = $db;
+ }
+
/**
* Compute amount
*
diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php
index 931b5e6420c..96a7ae50dfd 100644
--- a/htdocs/accountancy/customer/lines.php
+++ b/htdocs/accountancy/customer/lines.php
@@ -497,7 +497,7 @@ if ($result) {
print '';
print '
';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
print ' | ';
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 80b7bdf2217..bc6713f0846 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -637,7 +637,7 @@ if ($result) {
// Description
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc);
print ' | ';
diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php
index ff7b9295693..005783ed7a8 100644
--- a/htdocs/accountancy/expensereport/lines.php
+++ b/htdocs/accountancy/expensereport/lines.php
@@ -405,7 +405,7 @@ if ($result) {
// Fees description -- Can be null
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print ' | ';
diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php
index d95f4ff67b9..033f1164dc7 100644
--- a/htdocs/accountancy/expensereport/list.php
+++ b/htdocs/accountancy/expensereport/list.php
@@ -481,7 +481,7 @@ if ($result) {
// Fees description -- Can be null
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments);
print ' | ';
diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php
index 9f769ae13b4..7d1960459bc 100644
--- a/htdocs/accountancy/supplier/lines.php
+++ b/htdocs/accountancy/supplier/lines.php
@@ -502,7 +502,7 @@ if ($result) {
print '';
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description);
print ' | ';
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 24d0ed08a0a..0af840e3599 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -644,7 +644,7 @@ if ($result) {
// Description
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc));
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1));
$trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc);
print ' | ';
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 74d26e29da5..05699347806 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -669,8 +669,8 @@ if ($id == 11) {
asort($elementList);
$sourceList = array(
- 'internal' => $langs->trans('Internal'),
- 'external' => $langs->trans('External')
+ 'internal' => $langs->trans('Internal'),
+ 'external' => $langs->trans('External')
);
}
@@ -737,12 +737,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
}
if ((!GETPOSTISSET($value) || GETPOST($value) == '')
&& (!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
- && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10
- )
- ) {
- $ok = 0;
- $fieldnamekey = $value;
- // We take translate key of field
+ && ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10
+ )
+ ) {
+ $ok = 0;
+ $fieldnamekey = $value;
+ // We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
$fieldnamekey = 'Label';
}
@@ -792,7 +792,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) {
$fieldnamekey = 'UseByDefault';
}
- setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
+ setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Other checks
@@ -2411,10 +2411,10 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
} elseif ($value == 'unit') {
print '';
$units = array(
- 'mm' => $langs->trans('SizeUnitmm'),
- 'cm' => $langs->trans('SizeUnitcm'),
- 'point' => $langs->trans('SizeUnitpoint'),
- 'inch' => $langs->trans('SizeUnitinch')
+ 'mm' => $langs->trans('SizeUnitmm'),
+ 'cm' => $langs->trans('SizeUnitcm'),
+ 'point' => $langs->trans('SizeUnitpoint'),
+ 'inch' => $langs->trans('SizeUnitinch')
);
print $form->selectarray('unit', $units, (!empty($obj->{$value}) ? $obj->{$value}:''), 0, 0, 0);
print ' | ';
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index e5cb43d9e1f..f065760f62d 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -46,11 +46,12 @@ if ($action == 'test' || $action == 'send') {
$substitutionarrayfortest = array(
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
+ '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '
' : '',
+ '__USER_LOGIN__' => $user->login,
+ '__USER_EMAIL__' => $user->email,
+ '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
'__ID__' => 'RecipientIdRecord',
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
- '__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '
' : '',
- '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
- '__LOGIN__' => $user->login,
'__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname',
'__ADDRESS__'=> 'RecipientAddress',
@@ -762,9 +763,18 @@ if ($action == 'edit') {
print '| '.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").' | ';
print '';
if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
- print $conf->global->MAIN_MAIL_AUTOCOPY_TO;
- if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
- print img_warning($langs->trans("ErrorBadEMail"));
+ $listofemail = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
+ $i = 0;
+ foreach ($listofemail as $key => $val) {
+ if ($i) {
+ print ', ';
+ }
+ $val = trim($val);
+ print $val;
+ if (!isValidEmail($val, 0, 1)) {
+ print img_warning($langs->trans("ErrorBadEMail", $val));
+ }
+ $i++;
}
} else {
print ' ';
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index dcf7fe18d6f..cb3b16fcc0e 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -205,7 +205,7 @@ if (!empty($conf->expedition->enabled)) {
$elementList['shipping_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendShipment'));
}
if (!empty($conf->reception->enabled)) {
- $elementList['reception_send'] = img_picto('', 'dolly', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
+ $elementList['reception_send'] = img_picto('', 'dollyrevert', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendReception'));
}
if (!empty($conf->ficheinter->enabled)) {
$elementList['fichinter_send'] = img_picto('', 'intervention', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendIntervention'));
diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php
index db79a1503c9..f6d71fe6817 100644
--- a/htdocs/admin/notification.php
+++ b/htdocs/admin/notification.php
@@ -267,6 +267,7 @@ $constantes = array();
foreach ($listofnotifiedevents as $notifiedevent) {
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
+ $model = $notifiedevent['elementtype'].'_send';
if ($notifiedevent['elementtype'] == 'order_supplier') {
$elementLabel = $langs->trans('SupplierOrder');
diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php
index 82df4bed430..67c6914f1cf 100644
--- a/htdocs/admin/security_file.php
+++ b/htdocs/admin/security_file.php
@@ -36,6 +36,14 @@ if (!$user->admin) {
}
$action = GETPOST('action', 'aZ09');
+$sortfield = GETPOST('sortfield', 'aZ09');
+$sortorder = GETPOST('sortorder', 'aZ09');
+if (empty($sortfield)) {
+ $sortfield = 'date';
+}
+if (empty($sortorder)) {
+ $sortorder = 'desc';
+}
$upload_dir = $conf->admin->dir_temp;
@@ -73,8 +81,6 @@ if ($action == 'updateform') {
} else {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors');
}
- Header('Location: '.$_SERVER["PHP_SELF"]);
- exit;
}
@@ -190,7 +196,7 @@ $formfile = new FormFile($db);
$formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestFileUploadForm"), 0, 0, 1, 50, '', '', 1, '', 0);
// List of document
-$filearray = dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);
+$filearray = dol_dir_list($upload_dir, "files", 0, '', '', $sortfield, $sortorder == 'desc' ? SORT_DESC : SORT_ASC, 1);
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
// End of page
diff --git a/htdocs/cache.manifest b/htdocs/cache.manifest
deleted file mode 100644
index 5e514a32a47..00000000000
--- a/htdocs/cache.manifest
+++ /dev/null
@@ -1,36 +0,0 @@
-CACHE MANIFEST
-# version 2013-05-21 13:30:21
-# Note: If this file is dynamic, it must return MIME text/cache-manifest
-# Note: Order of CACHE, NETWORK and FALLBACK section does not change behaviour
-" Note:
-
-
-# Files listed under CACHE will be ALWAYS cached after they are loaded.
-# And they will be always used from Cache after (even after refresh).
-CACHE:
-theme/dolibarr_logo.svg
-support/
-support/index.php
-
-support/default.css
-support/helpcenter.png
-support/internet.png
-support/mail.png
-support/pagemaster.png
-support/redstar.png
-support/star.png
-support/who.png
-
-
-# The NETWORK section contains the path to a folder to ensure that requests
-# to load resources will use internet.
-# CACHE has priority on NETWORK, so usage is useless
-NETWORK:
-/
-
-# The FALLBACK section contains entries that provide a backup strategy.
-# If the browser is unable to retrieve the original content, the fallback resource will be used.
-# In the example above, we display a static image in case the dynamic one is unavailable.
-FALLBACK:
-#/ public/notice.php
-#theme/eldy/img/* theme/md/img/*
diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php
index 04f2288ae08..f4456ed79bf 100644
--- a/htdocs/categories/index.php
+++ b/htdocs/categories/index.php
@@ -133,7 +133,9 @@ if (empty($nosearch)) {
print '';
print " | \n";
print "\t\t";
- print dolGetFirstLineOfText($cat->description);
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($cat->description, 1));
+ $trunclength = 48;
+ print $form->textwithtooltip(dol_trunc($text, $trunclength), $cat->description);
print " | \n";
print "\t
\n";
}
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index e2b412e15db..f6932cc4bef 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -943,8 +943,8 @@ while ($i < min($num, $limit)) {
// Description
if (!empty($arrayfields['a.note']['checked'])) {
print '';
- $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0));
- print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private);
+ $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 1));
+ print $form->textwithtooltip(dol_trunc($text, 48), $actionstatic->note_private);
print ' | ';
}
diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index eabcb1a55bf..9e5ef8be35c 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -10,6 +10,7 @@
* Copyright (C) 2015-2021 Frédéric France
* Copyright (C) 2015 Marcos García
* Copyright (C) 2020 Open-Dsi
+ * Copyright (C) 2022 Anthony Berton
*
* 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
@@ -38,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
if (!empty($conf->facture->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
}
@@ -112,6 +114,7 @@ $cancel = GETPOST('cancel', 'alpha');
$object = new Client($db);
$extrafields = new ExtraFields($db);
+$formfile = new FormFile($db);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
@@ -859,6 +862,36 @@ if ($object->id > 0) {
$propal_static->total_tva = $objp->total_tva;
$propal_static->total_ttc = $objp->total_ttc;
print $propal_static->getNomUrl(1);
+
+ // Preview
+ $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $file_list = null;
+ if (!empty($filedir)) {
+ $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
+ }
+ if (is_array($file_list)) {
+ // Defined relative dir to DOL_DATA_ROOT
+ $relativedir = '';
+ if ($filedir) {
+ $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
+ $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
+ }
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($file_list, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
+ }
+ }
+ $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
+ print $formfile->showPreview($file_list, $propal_static->element, $relativepath, 0, $param);
+ }
+ // $filename = dol_sanitizeFileName($objp->ref);
+ // $filedir = $conf->propal->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ // $urlsource = '/comm/propal/card.php?id='.$objp->cid;
+ // print $formfile->getDocumentsLink($propal_static->element, $filename, $filedir);
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
print " ".img_warning();
}
@@ -940,7 +973,38 @@ if ($object->id > 0) {
print '';
print '| ';
print $commande_static->getNomUrl(1);
- print ' | '.dol_print_date($db->jdate($objp->dc), 'day')." | \n";
+ // Preview
+ $filedir = $conf->commande->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $file_list = null;
+ if (!empty($filedir)) {
+ $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
+ }
+ if (is_array($file_list)) {
+ // Defined relative dir to DOL_DATA_ROOT
+ $relativedir = '';
+ if ($filedir) {
+ $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
+ $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
+ }
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($file_list, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
+ }
+ }
+ $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
+ print $formfile->showPreview($file_list, $commande_static->element, $relativepath, 0, $param);
+ }
+ // $filename = dol_sanitizeFileName($objp->ref);
+ // $filedir = $conf->order->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ // $urlsource = '/commande/card.php?id='.$objp->cid;
+ // print $formfile->getDocumentsLink($commande_static->element, $filename, $filedir);
+ print '';
+
+ print ''.dol_print_date($db->jdate($objp->dc), 'day')." | \n";
print ''.price($objp->total_ht).' | ';
print ''.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).' |
';
$i++;
@@ -1003,6 +1067,35 @@ if ($object->id > 0) {
print '';
print '| ';
print $sendingstatic->getNomUrl(1);
+ // Preview
+ $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $file_list = null;
+ if (!empty($filedir)) {
+ $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
+ }
+ if (is_array($file_list)) {
+ // Defined relative dir to DOL_DATA_ROOT
+ $relativedir = '';
+ if ($filedir) {
+ $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
+ $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
+ }
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($file_list, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
+ }
+ }
+ $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
+ print $formfile->showPreview($file_list, $sendingstatic->element, $relativepath, 0, $param);
+ }
+ // $filename = dol_sanitizeFileName($objp->ref);
+ // $filedir = $conf->expedition->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ // $urlsource = '/expedition/card.php?id='.$objp->cid;
+ // print $formfile->getDocumentsLink($sendingstatic->element, $filename, $filedir);
print ' | ';
if ($objp->date_creation > 0) {
print ''.dol_print_date($db->jdate($objp->date_creation), 'day').' | ';
@@ -1076,6 +1169,35 @@ if ($object->id > 0) {
print '
';
print '| ';
print $contrat->getNomUrl(1, 12);
+ // Preview
+ $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $file_list = null;
+ if (!empty($filedir)) {
+ $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
+ }
+ if (is_array($file_list)) {
+ // Defined relative dir to DOL_DATA_ROOT
+ $relativedir = '';
+ if ($filedir) {
+ $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
+ $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
+ }
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($file_list, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
+ }
+ }
+ $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
+ print $formfile->showPreview($file_list, $contrat->element, $relativepath, 0, $param);
+ }
+ // $filename = dol_sanitizeFileName($objp->ref);
+ // $filedir = $conf->contrat->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ // $urlsource = '/contrat/card.php?id='.$objp->cid;
+ // print $formfile->getDocumentsLink($contrat->element, $filename, $filedir);
print $late;
print " | \n";
print ''.dol_trunc($objp->refsup, 12)." | \n";
@@ -1137,6 +1259,35 @@ if ($object->id > 0) {
print '
';
print '| ';
print $fichinter_static->getNomUrl(1);
+ // Preview
+ $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $file_list = null;
+ if (!empty($filedir)) {
+ $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
+ }
+ if (is_array($file_list)) {
+ // Defined relative dir to DOL_DATA_ROOT
+ $relativedir = '';
+ if ($filedir) {
+ $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
+ $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
+ }
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($file_list, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
+ }
+ }
+ $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
+ print $formfile->showPreview($file_list, $fichinter_static->element, $relativepath, 0, $param);
+ }
+ // $filename = dol_sanitizeFileName($objp->ref);
+ // $filedir = $conf->fichinter->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ // $urlsource = '/fichinter/card.php?id='.$objp->cid;
+ // print $formfile->getDocumentsLink($fichinter_static->element, $filename, $filedir);
print ' | '."\n";
//print ''.dol_print_date($db->jdate($objp->startdate)).' | '."\n";
print ''.convertSecondToTime($objp->duration).' | '."\n";
@@ -1213,6 +1364,7 @@ if ($object->id > 0) {
print '';
print $invoicetemplate->getNomUrl(1);
print ' | ';
+
if ($objp->frequency && $objp->date_last_gen > 0) {
print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').' | ';
} else {
@@ -1301,6 +1453,35 @@ if ($object->id > 0) {
print '
';
print '| ';
print $facturestatic->getNomUrl(1);
+ // Preview
+ $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ $file_list = null;
+ if (!empty($filedir)) {
+ $file_list = dol_dir_list($filedir, 'files', 0, '', '(\.meta|_preview.*.*\.png)$', 'date', SORT_DESC);
+ }
+ if (is_array($file_list)) {
+ // Defined relative dir to DOL_DATA_ROOT
+ $relativedir = '';
+ if ($filedir) {
+ $relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filedir);
+ $relativedir = preg_replace('/^[\\/]/', '', $relativedir);
+ }
+ // Get list of files stored into database for same relative directory
+ if ($relativedir) {
+ completeFileArrayWithDatabaseInfo($file_list, $relativedir);
+
+ //var_dump($sortfield.' - '.$sortorder);
+ if (!empty($sortfield) && !empty($sortorder)) { // If $sortfield is for example 'position_name', we will sort on the property 'position_name' (that is concat of position+name)
+ $file_list = dol_sort_array($file_list, $sortfield, $sortorder);
+ }
+ }
+ $relativepath = dol_sanitizeFileName($objp->ref).'/'.dol_sanitizeFileName($objp->ref).'.pdf';
+ print $formfile->showPreview($file_list, $facturestatic->element, $relativepath, 0, $param);
+ }
+ // $filename = dol_sanitizeFileName($objp->ref);
+ // $filedir = $conf->facture->multidir_output[$objp->entity].'/'.dol_sanitizeFileName($objp->ref);
+ // $urlsource = '/compta/facture/card.php?id='.$objp->cid;
+ //print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print ' | ';
if ($objp->df > 0) {
print ''.dol_print_date($db->jdate($objp->df), 'day').' | ';
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 0c43cc4ad2d..234f2fba627 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3723,7 +3723,7 @@ class Commande extends CommonOrder
$label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
}
if (!empty($this->date)) {
- $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'dayhour');
+ $label .= '
'.$langs->trans('Date').': '.dol_print_date($this->date, 'day');
}
if (!empty($this->delivery_date)) {
$label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour');
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index a4d85c257f8..2bfbe368aa8 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4818,6 +4818,7 @@ if ($action == 'create') {
// List of previous situation invoices
if (($object->situation_cycle_ref > 0) && !empty($conf->global->INVOICE_USE_SITUATION)) {
+ print '';
print '';
print '';
@@ -4956,15 +4957,16 @@ if ($action == 'create') {
// List of payments already done
+ print '';
print '';
print '
';
print '';
print '| '.($object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("PaymentsBack") : $langs->trans('Payments')).' | ';
- print ''.$langs->trans('Date').' | ';
- print ''.$langs->trans('Type').' | ';
+ print ''.$langs->trans('Date').' | ';
+ print ''.$langs->trans('Type').' | ';
if (!empty($conf->banque->enabled)) {
- print ''.$langs->trans('BankAccount').' | ';
+ print ''.$langs->trans('BankAccount').' | ';
}
print ''.$langs->trans('Amount').' | ';
print ' | ';
diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
index 03b410466f0..14bb45f0687 100644
--- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
@@ -45,7 +45,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
$trclass .= ' liste_sub_total';
}
print '
';
- print '| ';
+ print ' | ';
switch ($objectlink->type) {
case Facture::TYPE_REPLACEMENT:
echo $langs->trans("InvoiceReplacement");
diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php
index d2ef4657586..d7e68e274fa 100644
--- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php
+++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php
@@ -46,7 +46,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
}
?>
|
- | trans("RepeatableInvoice"); ?> |
+ trans("RepeatableInvoice"); ?> |
getNomUrl(1); ?> |
|
date_when, 'day'); ?> |
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 87d6b98475b..7265a69d1af 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -2027,62 +2027,73 @@ if ($action == 'create') {
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
+ $params = array(
+ 'attr' => array(
+ 'title' => '',
+ 'class' => 'classfortooltip'
+ )
+ );
+
// Send
if (empty($user->socid)) {
if ($object->statut == 1) {
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->contrat->creer)) {
- print '';
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
} else {
- print '';
+ print dolGetButtonAction($langs->trans('SendMail'), '', 'default', '#', '', false, $params);
}
}
}
if ($object->statut == 0 && $nbofservices) {
if ($user->rights->contrat->creer) {
- print '';
+ print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid&token='.newToken(), '', true, $params);
} else {
- print '';
+ $params['attr']['title'] = $langs->trans("NotEnoughPermissions");
+ print dolGetButtonAction($langs->trans('Validate'), '', 'default', '#', '', false, $params);
}
}
if ($object->statut == 1) {
if ($user->rights->contrat->creer) {
- print '';
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen&token='.newToken(), '', true, $params);
} else {
- print '';
+ $params['attr']['title'] = $langs->trans("NotEnoughPermissions");
+ print dolGetButtonAction($langs->trans('Modify'), '', 'default', '#', '', false, $params);
}
}
if (!empty($conf->commande->enabled) && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) {
$langs->load("orders");
if ($user->rights->commande->creer) {
- print '';
+ print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params);
} else {
- print '';
+ $params['attr']['title'] = $langs->trans("NotEnoughPermissions");
+ print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', '#', '', false, $params);
}
}
if (!empty($conf->facture->enabled) && $object->statut > 0) {
$langs->load("bills");
if ($user->rights->facture->creer) {
- print '';
+ print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', DOL_URL_ROOT.'/compta/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params);
} else {
- print '';
+ $params['attr']['title'] = $langs->trans("NotEnoughPermissions");
+ print dolGetButtonAction($langs->trans('CreateBill'), '', 'default', '#', '', false, $params);
}
}
if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) {
if ($user->rights->contrat->activer) {
- print '';
+ print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=activate&token='.newToken(), '', true, $params);
} else {
- print '';
+ print dolGetButtonAction($langs->trans('ActivateAllContracts'), '', 'default', '#', '', false, $params);
}
}
if ($object->nbofservicesclosed < $nbofservices) {
if ($user->rights->contrat->desactiver) {
- print '';
+ print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', true, $params);
} else {
- print '';
+ print dolGetButtonAction($langs->trans('CloseAllContracts'), '', 'default', '#', '', false, $params);
}
//if (! $numactive)
@@ -2104,16 +2115,17 @@ if ($action == 'create') {
// Clone
if ($user->rights->contrat->creer) {
- print '';
+ print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', true, $params);
}
// On peut supprimer entite si
// - Droit de creer + mode brouillon (erreur creation)
// - Droit de supprimer
if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) {
- print '';
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', true, $params);
} else {
- print '';
+ $params['attr']['title'] = $langs->trans("NotAllowed");
+ print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), '', false, $params);
}
}
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 5a4ec3bf02f..d32418d7550 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -635,6 +635,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
$TFact = array();
$TFactThird = array();
+ $TFactThirdNbLines = array();
$nb_bills_created = 0;
$lastid= 0;
@@ -685,6 +686,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
$lastid = $objecttmp->id;
$TFactThird[$cmd->socid] = $objecttmp;
+ $TFactThirdNbLines[$cmd->socid] = 0; //init nblines to have lines ordered by expedition and rang
} else {
$langs->load("errors");
$errors[] = $cmd->ref.' : '.$langs->trans($objecttmp->error);
@@ -774,6 +776,11 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
$objecttmp->context['createfromclone'];
+ $rang = $lines[$i]->rang;
+ //there may already be rows from previous orders
+ if (!empty($createbills_onebythird))
+ $rang = $TFactThirdNbLines[$cmd->socid];
+
$result = $objecttmp->addline(
$desc,
$lines[$i]->subprice,
@@ -791,7 +798,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
'HT',
0,
$product_type,
- $lines[$i]->rang,
+ $rang,
$lines[$i]->special_code,
$objecttmp->origin,
$lines[$i]->rowid,
@@ -806,6 +813,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
);
if ($result > 0) {
$lineid = $result;
+ if (!empty($createbills_onebythird)) //increment rang to keep order
+ $TFactThirdNbLines[$rcp->socid]++;
} else {
$lineid = 0;
$error++;
diff --git a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
index 9a40c3f9aec..403c6c9fc6d 100644
--- a/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
+++ b/htdocs/core/boxes/box_supplier_orders_awaiting_reception.php
@@ -162,7 +162,7 @@ class box_supplier_orders_awaiting_reception extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
- 'text' => $delayIcon.' '.($delivery_date ? dol_print_date($delivery_date, 'day', 'tzuserrel') : '').'',
+ 'text' => $delayIcon.' '.($delivery_date ? dol_print_date($delivery_date, 'day', 'tzuserrel') : '').'',
'asis' => 1
);
diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php
index 8030c2f58ec..b6acbbbfbc9 100644
--- a/htdocs/core/class/CMailFile.class.php
+++ b/htdocs/core/class/CMailFile.class.php
@@ -140,7 +140,7 @@ class CMailFile
*/
public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '')
{
- global $conf, $dolibarr_main_data_root;
+ global $conf, $dolibarr_main_data_root, $user;
// Clean values of $mimefilename_list
if (is_array($mimefilename_list)) {
@@ -251,9 +251,31 @@ class CMailFile
}
}
- // Add autocopy to if not already in $to (Note: Adding bcc for specific modules are also done from pages)
- if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && !preg_match('/'.preg_quote($conf->global->MAIN_MAIL_AUTOCOPY_TO, '/').'/i', $to)) {
- $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO;
+ // Add auto copy to if not already in $to (Note: Adding bcc for specific modules are also done from pages)
+ // For example MAIN_MAIL_AUTOCOPY_TO can be 'email@example.com, __USER_EMAIL__, ...'
+ if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) {
+ $listofemailstoadd = explode(',', $conf->global->MAIN_MAIL_AUTOCOPY_TO);
+ foreach ($listofemailstoadd as $key => $val) {
+ $emailtoadd = $listofemailstoadd[$key];
+ if (trim($emailtoadd) == '__USER_EMAIL__') {
+ if (!empty($user) && !empty($user->email)) {
+ $emailtoadd = $user->email;
+ } else {
+ $emailtoadd = '';
+ }
+ }
+ if ($emailtoadd && preg_match('/'.preg_quote($emailtoadd, '/').'/i', $to)) {
+ $emailtoadd = ''; // Email already in the "To"
+ }
+ if ($emailtoadd) {
+ $listofemailstoadd[$key] = $emailtoadd;
+ } else {
+ unset($listofemailstoadd[$key]);
+ }
+ }
+ if (!empty($listofemailstoadd)) {
+ $addr_bcc .= ($addr_bcc ? ', ' : '').join(', ', $listofemailstoadd);
+ }
}
$this->subject = $subject;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 5e67d293e3d..51bfc09d44d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -7067,6 +7067,8 @@ abstract class CommonObject
$paramforthenewlink = '';
$paramforthenewlink .= (GETPOSTISSET('action') ? '&action='.GETPOST('action', 'aZ09') : '');
$paramforthenewlink .= (GETPOSTISSET('id') ? '&id='.GETPOST('id', 'int') : '');
+ $paramforthenewlink .= (GETPOSTISSET('origin') ? '&origin='.GETPOST('origin', 'aZ09') : '');
+ $paramforthenewlink .= (GETPOSTISSET('originid') ? '&originid='.GETPOST('originid', 'int') : '');
$paramforthenewlink .= '&fk_'.strtolower($class).'=--IDFORBACKTOPAGE--';
// TODO Add Javascript code to add input fields already filled into $paramforthenewlink so we won't loose them when going back to main page
$out .= '';
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index f59441eb8d4..1494e9b991d 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -616,15 +616,15 @@ class Conf
if (!empty($this->productbatch->enabled)) {
$this->global->STOCK_CALCULATE_ON_BILL = 0;
$this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER = 0;
- $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
- $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 0;
+ if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) $this->global->STOCK_CALCULATE_ON_SHIPMENT = 1;
+ if (empty($this->global->STOCK_CALCULATE_ON_SHIPMENT)) $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE = 1;
$this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL = 0;
$this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER = 0;
if (empty($this->reception->enabled)) {
$this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER = 1;
} else {
- $this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
- $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 0;
+ if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) $this->global->STOCK_CALCULATE_ON_RECEPTION = 1;
+ if (empty($this->global->STOCK_CALCULATE_ON_RECEPTION)) $this->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE = 1;
}
}
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 428de442786..ea6d145641a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -16,7 +16,7 @@
* Copyright (C) 2012 Cedric Salvador
* Copyright (C) 2012-2015 Raphaël Doursenaud
* Copyright (C) 2014-2020 Alexandre Spangaro
- * Copyright (C) 2018-2021 Ferran Marcet
+ * Copyright (C) 2018-2022 Ferran Marcet
* Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2018 Nicolas ZABOURI
* Copyright (C) 2018 Christophe Battarel
@@ -1320,6 +1320,7 @@ class Form
{
// phpcs:enable
global $conf, $user, $langs;
+ global $hookmanager;
$out = '';
$num = 0;
@@ -1367,6 +1368,10 @@ class Form
if (!empty($excludeids)) {
$sql .= " AND s.rowid NOT IN (".$this->db->sanitize(join(',', $excludeids)).")";
}
+ // Add where from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectThirdpartyListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ $sql .= $hookmanager->resPrint;
// Add criteria
if ($filterkey && $filterkey != '') {
$sql .= " AND (";
@@ -1679,6 +1684,10 @@ class Form
if (!empty($conf->global->CONTACT_HIDE_INACTIVE_IN_COMBOBOX)) {
$sql .= " AND sp.statut <> 0";
}
+ // Add where from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectContactListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ $sql .= $hookmanager->resPrint;
$sql .= " ORDER BY sp.lastname ASC";
dol_syslog(get_class($this)."::selectcontacts", LOG_DEBUG);
@@ -2462,6 +2471,7 @@ class Form
{
// phpcs:enable
global $langs, $conf;
+ global $hookmanager;
$out = '';
$outarray = array();
@@ -2607,6 +2617,10 @@ class Form
} elseif (empty($conf->service->enabled)) { // when service module is disabled, show products only
$sql .= " AND p.fk_product_type = 0";
}
+ // Add where from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ $sql .= $hookmanager->resPrint;
// Add criteria on ref/label
if ($filterkey != '') {
$sql .= ' AND (';
@@ -3180,6 +3194,7 @@ class Form
{
// phpcs:enable
global $langs, $conf, $user;
+ global $hookmanager;
$out = '';
$outarray = array();
@@ -3229,6 +3244,10 @@ class Form
if (!empty($filtre)) {
$sql .= " ".$filtre;
}
+ // Add where from hooks
+ $parameters = array();
+ $reshook = $hookmanager->executeHooks('selectSuppliersProductsListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ $sql .= $hookmanager->resPrint;
// Add criteria on ref/label
if ($filterkey != '') {
$sql .= ' AND (';
@@ -8587,6 +8606,7 @@ class Form
print '