diff --git a/ChangeLog b/ChangeLog
index a618b8a14fe..bb44e0fa0be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@ NEW: Add a security center page with all information and advices related to the
NEW: Add a performance center page with all information and advices related to the performance of your instance
NEW: A lot of fix into english text after a small proofreading campaign (still not perfect, but really better)
NEW: All main menu entries are using the picto of the module
+NEW: Add a copy to clipboard button on some fields
NEW: Add an example of scheduled job to send email reminder for unpayed invoices
NEW: Accountancy - Add FEC import
NEW: Accountancy - Add a confirmation form with options on export
@@ -135,7 +136,6 @@ NEW: Add data-eec=1 for EEC countries on select for js interaction
NEW: Add experimental repair script to switch to dynamic row format and utf8mb4 encoding
NEW: add form confirm hook on company card
NEW: Add function showValueWithClipboardCPButton() to add a copy/paste
-NEW: Add function showValueWithCopyAndPasteButton() to add a copy/paste
NEW: Add hook addSectionECMAuto method to add custom diretory into ECM auto files
NEW: Add native compression in rest apis
NEW: Product Variants API, add variant stock to response by parameter
diff --git a/dev/setup/codesniffer/README b/dev/setup/codesniffer/README
index 087fb318f6f..2fdc66b9d1f 100644
--- a/dev/setup/codesniffer/README
+++ b/dev/setup/codesniffer/README
@@ -10,6 +10,11 @@ To run phpcs:
> cd dolibarrgitrepo
> phpcs --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 .
+To fix with phpcbf:
+> cd dolibarrgitrepo
+> phpcbf --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 .
+
+
Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with:
* tab value to 4
* path of code sniffer standard to dev/codesniffer
diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
index 0064e8c4715..8669cae7c2f 100644
--- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
+++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php
@@ -281,7 +281,7 @@ if ($resql) {
$journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $obj->code_journal);
print '
'.$journaltoshow.'
';
- if (empty($obj->lettering_code)) {
+ if (empty($obj->lettering_code) && empty($obj->date_validated)) {
print '
\n";
-
// Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc)) {
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
@@ -1694,13 +1690,13 @@ if ($action == 'create' || $action == 'adduserldap') {
print "\n";
-
+ // Credentials
print '
';
print '';
diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php
index cb908416535..b739b387a74 100644
--- a/test/phpunit/ActionCommTest.php
+++ b/test/phpunit/ActionCommTest.php
@@ -84,7 +84,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->agenda->enabled)) {
- print __METHOD__." module agenda must be enabled.\n"; die();
+ print __METHOD__." module agenda must be enabled.\n"; die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php
index 63b55dd37aa..0e4956e3a12 100644
--- a/test/phpunit/AdherentTest.php
+++ b/test/phpunit/AdherentTest.php
@@ -87,13 +87,13 @@ class AdherentTest extends PHPUnit\Framework\TestCase
if (! empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) {
print "\n".__METHOD__." Company must be setup to have name-firstname in order 'Firstname Lastname'\n";
- die();
+ die(1);
}
if (! empty($conf->global->MAIN_MODULE_LDAP)) {
- print "\n".__METHOD__." module LDAP must be disabled.\n"; die();
+ print "\n".__METHOD__." module LDAP must be disabled.\n"; die(1);
}
if (! empty($conf->global->MAIN_MODULE_MAILMANSPIP)) {
- print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die();
+ print "\n".__METHOD__." module MailmanSpip must be disabled.\n"; die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/BuildDocTest.php b/test/phpunit/BuildDocTest.php
index 455f2ce513a..18a737ec50b 100644
--- a/test/phpunit/BuildDocTest.php
+++ b/test/phpunit/BuildDocTest.php
@@ -113,25 +113,25 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (! $conf->facture->enabled) {
- print __METHOD__." invoice module not enabled\n"; die();
+ print __METHOD__." invoice module not enabled\n"; die(1);
}
if (! $conf->commande->enabled) {
- print __METHOD__." order module not enabled\n"; die();
+ print __METHOD__." order module not enabled\n"; die(1);
}
if (! $conf->propal->enabled) {
- print __METHOD__." propal module not enabled\n"; die();
+ print __METHOD__." propal module not enabled\n"; die(1);
}
if (! $conf->projet->enabled) {
- print __METHOD__." project module not enabled\n"; die();
+ print __METHOD__." project module not enabled\n"; die(1);
}
if (! $conf->expedition->enabled) {
- print __METHOD__." shipment module not enabled\n"; die();
+ print __METHOD__." shipment module not enabled\n"; die(1);
}
if (! $conf->ficheinter->enabled) {
- print __METHOD__." intervention module not enabled\n"; die();
+ print __METHOD__." intervention module not enabled\n"; die(1);
}
if (! $conf->expensereport->enabled) {
- print __METHOD__." expensereport module not enabled\n"; die();
+ print __METHOD__." expensereport module not enabled\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php
index b050005bcf1..bf5922460a2 100644
--- a/test/phpunit/CommandeFournisseurTest.php
+++ b/test/phpunit/CommandeFournisseurTest.php
@@ -147,7 +147,7 @@ class CommandeFournisseurTest extends PHPUnit\Framework\TestCase
$product=new ProductFournisseur($db);
$product->fetch(0, 'PIDRESS');
if ($product->id <= 0) {
- print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die();
+ print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(1);
}
$quantity=10;
diff --git a/test/phpunit/CommandeTest.php b/test/phpunit/CommandeTest.php
index 4ab81d63524..064c205c0e9 100644
--- a/test/phpunit/CommandeTest.php
+++ b/test/phpunit/CommandeTest.php
@@ -84,7 +84,7 @@ class CommandeTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->commande->enabled)) {
- print __METHOD__." module customer order must be enabled.\n"; die();
+ print __METHOD__." module customer order must be enabled.\n"; die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php
index 63eadc1a98f..4b63450c332 100644
--- a/test/phpunit/DateLibTzFranceTest.php
+++ b/test/phpunit/DateLibTzFranceTest.php
@@ -83,7 +83,7 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') {
- print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die();
+ print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php
index 6be9b5ba349..691b3039744 100644
--- a/test/phpunit/EntrepotTest.php
+++ b/test/phpunit/EntrepotTest.php
@@ -83,7 +83,7 @@ class EntrepotTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (empty($conf->stock->enabled)) {
- print __METHOD__." Module Stock must be enabled.\n"; die();
+ print __METHOD__." Module Stock must be enabled.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php
index ddb895d1b96..efa7d43a269 100644
--- a/test/phpunit/FactureTest.php
+++ b/test/phpunit/FactureTest.php
@@ -84,10 +84,10 @@ class FactureTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (empty($conf->facture->enabled)) {
- print __METHOD__." module customer invoice must be enabled.\n"; die();
+ print __METHOD__." module customer invoice must be enabled.\n"; die(1);
}
if (! empty($conf->ecotaxdeee->enabled)) {
- print __METHOD__." ecotaxdeee module must not be enabled.\n"; die();
+ print __METHOD__." ecotaxdeee module must not be enabled.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php
index b68a8c90d0a..749f94ab20f 100644
--- a/test/phpunit/MouvementStockTest.php
+++ b/test/phpunit/MouvementStockTest.php
@@ -115,7 +115,7 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase
$db=$this->savdb;
if (empty($conf->productbatch->enabled)) {
- print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; die();
+ print "\n".__METHOD__." module Lot/Serial must be enabled.\n"; die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/PaypalTest.php b/test/phpunit/PaypalTest.php
index 3177e5555ed..61027d02710 100644
--- a/test/phpunit/PaypalTest.php
+++ b/test/phpunit/PaypalTest.php
@@ -84,7 +84,7 @@ class PaypalTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (empty($conf->paypal->enabled)) {
- print __METHOD__." Module Paypal must be enabled.\n"; die();
+ print __METHOD__." Module Paypal must be enabled.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/PdfDocTest.php b/test/phpunit/PdfDocTest.php
index 4c07f970c24..e744aef3c2f 100644
--- a/test/phpunit/PdfDocTest.php
+++ b/test/phpunit/PdfDocTest.php
@@ -141,10 +141,13 @@ class PdfDocTest extends PHPUnit\Framework\TestCase
$db=$this->savdb;
$localproduct=new Product($this->savdb);
- $localproduct->fetch(0, 'PIDRESS');
- $product_id=$localproduct->id;
+ $result = $localproduct->fetch(0, 'PIDRESS');
+ if ($result < 0) {
+ print "\n".__METHOD__." Failed to make the fetch of product PIDRESS. ".$localproduct->error; die(1);
+ }
+ $product_id = $localproduct->id;
if ($product_id <= 0) {
- print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die();
+ print "\n".__METHOD__." A product with ref PIDRESS must exists into database"; die(1);
}
$localobject=new Facture($this->savdb);
diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php
index a7267251ed0..7eb6de57c02 100644
--- a/test/phpunit/ProductTest.php
+++ b/test/phpunit/ProductTest.php
@@ -83,7 +83,7 @@ class ProductTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (empty($conf->produit->enabled)) {
- print __METHOD__." Module Product must be enabled.\n"; die();
+ print __METHOD__." Module Product must be enabled.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/RestAPIUserTest.php b/test/phpunit/RestAPIUserTest.php
index a534c5f5910..c908b631df8 100644
--- a/test/phpunit/RestAPIUserTest.php
+++ b/test/phpunit/RestAPIUserTest.php
@@ -74,7 +74,7 @@ class RestAPIUserTest extends PHPUnit\Framework\TestCase
$this->savdb=$db;
if (empty($conf->api->enabled)) {
- print __METHOD__." module api must be enabled.\n"; die();
+ print __METHOD__." module api must be enabled.\n"; die(1);
}
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
diff --git a/test/phpunit/SocieteTest.php b/test/phpunit/SocieteTest.php
index 12f24290413..73363140acd 100755
--- a/test/phpunit/SocieteTest.php
+++ b/test/phpunit/SocieteTest.php
@@ -84,15 +84,15 @@ class SocieteTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if ($conf->global->SOCIETE_CODECLIENT_ADDON != 'mod_codeclient_monkey') {
- print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die();
+ print "\n".__METHOD__." third party ref checker must be setup to 'mod_codeclient_monkey' not to '".$conf->global->SOCIETE_CODECLIENT_ADDON."'.\n"; die(1);
}
if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) {
- print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die();
+ print "\n".__METHOD__." constant MAIN_DISABLEPROFIDRULES must be empty (if a module set it, disable module).\n"; die(1);
}
if ($langs->defaultlang != 'en_US') {
- print "\n".__METHOD__." default language of company must be set to autodetect.\n"; die();
+ print "\n".__METHOD__." default language of company must be set to autodetect.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/StripeTest.php b/test/phpunit/StripeTest.php
index 9425cc47aa0..bb769e83e80 100644
--- a/test/phpunit/StripeTest.php
+++ b/test/phpunit/StripeTest.php
@@ -84,7 +84,7 @@ class StripeTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (empty($conf->stripe->enabled)) {
- print __METHOD__." Module Stripe must be enabled.\n"; die();
+ print __METHOD__." Module Stripe must be enabled.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
diff --git a/test/phpunit/SupplierProposalTest.php b/test/phpunit/SupplierProposalTest.php
index bc9263f410c..ebcf30c29e6 100644
--- a/test/phpunit/SupplierProposalTest.php
+++ b/test/phpunit/SupplierProposalTest.php
@@ -87,7 +87,7 @@ class SupplierProposalTest extends PHPUnit\Framework\TestCase
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->global->MAIN_MODULE_SUPPLIERPROPOSAL)) {
- print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; die();
+ print "\n".__METHOD__." module Supplier proposal must be enabled.\n"; die(1);
}
print __METHOD__."\n";
diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php
index ca889fdbc96..5a09e4c9864 100644
--- a/test/phpunit/UserTest.php
+++ b/test/phpunit/UserTest.php
@@ -83,7 +83,7 @@ class UserTest extends PHPUnit\Framework\TestCase
global $conf,$user,$langs,$db;
if (! empty($conf->global->MAIN_MODULE_LDAP)) {
- print "\n".__METHOD__." module LDAP must be disabled.\n"; die();
+ print "\n".__METHOD__." module LDAP must be disabled.\n"; die(1);
}
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.