diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 6e098960ddc..866c8be0857 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -1323,7 +1323,7 @@ class BOM extends CommonObject
$outputlangs->load("products");
if (!dol_strlen($modele)) {
- $modele = 'standard';
+ $modele = '';
if ($this->model_pdf) {
$modele = $this->model_pdf;
@@ -1333,8 +1333,11 @@ class BOM extends CommonObject
}
$modelpath = "core/modules/bom/doc/";
-
- return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
+ if (!empty($modele)) {
+ return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
+ } else {
+ return 0;
+ }
}
/**
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 2ce3706d216..320bdc3e7c7 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -490,8 +490,8 @@ $typeid = $type;
// List of products or services (type is type of category)
if ($type == Categorie::TYPE_PRODUCT) {
- if ($user->hasRight("product", "read")) {
- $permission = ($user->rights->produit->creer || $user->hasRight('service', 'creer'));
+ if ($user->hasRight("product", "read") || $user->hasRight("service", "read")) {
+ $permission = ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'));
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($prods < 0) {
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 7af29fdc84a..a6e01af61a5 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -1396,10 +1396,10 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
$ids1 = '';
$ids2 = '';
if (!empty($cases1[$h]) && is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) {
- $ids1 = join(',', array_keys($cases1[$h]));
+ $ids1 = join(', ', array_keys($cases1[$h]));
}
if (!empty($cases2[$h]) && is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) {
- $ids2 = join(',', array_keys($cases2[$h]));
+ $ids2 = join(', ', array_keys($cases2[$h]));
}
if ($h == $begin_h) {
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 4ee0c60b831..e7c22e460c7 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2070,6 +2070,8 @@ if ($action == 'create' && $usercancreate) {
}
}
+ print "\n";
+
print '';
print dol_get_fiche_end();
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index e88aa44b3ee..ab1c3941076 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -540,11 +540,13 @@ class BonPrelevement extends CommonObject
} else {
if ($this->type == 'bank-transfer') {
$modeforaddpayment = 'payment_supplier';
+ $labelforaddpayment = '(BankTransferPayment)';
} else {
$modeforaddpayment = 'payment';
+ $labelforaddpayment = '(WithdrawalPayment)';
}
- $result = $paiement->addPaymentToBank($user, $modeforaddpayment, '(WithdrawalPayment)', $fk_bank_account, '', '');
+ $result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '');
if ($result < 0) {
$error++;
$this->error = $paiement->error;
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index fb5a98968d8..3a4128f01cf 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -470,12 +470,13 @@ class Contact extends CommonObject
/**
* Add a contact into database
*
- * @param User $user Object user that create
- * @return int <0 if KO, >0 if OK
+ * @param User $user Object user that create
+ * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
+ * @return int <0 if KO, >0 if OK
*/
- public function create($user)
+ public function create($user, $notrigger = 0)
{
- global $conf, $langs;
+ global $conf;
$error = 0;
$now = dol_now();
@@ -551,7 +552,7 @@ class Contact extends CommonObject
}
}
- if (!$error) {
+ if (!$error && !$notrigger) {
// Call trigger
$result = $this->call_trigger('CONTACT_CREATE', $user);
if ($result < 0) {
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index c9d8f89703a..7d48fffd7eb 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3640,7 +3640,8 @@ abstract class CommonObject
$diff = price2num($total_tva_by_vats[$obj->vatrate] - $tmpvat, 'MT', 1);
//print 'Line '.$i.' rowid='.$obj->rowid.' vat_rate='.$obj->vatrate.' total_ht='.$obj->total_ht.' total_tva='.$obj->total_tva.' total_ttc='.$obj->total_ttc.' total_ht_by_vats='.$total_ht_by_vats[$obj->vatrate].' total_tva_by_vats='.$total_tva_by_vats[$obj->vatrate].' (new calculation = '.$tmpvat.') total_ttc_by_vats='.$total_ttc_by_vats[$obj->vatrate].($diff?" => DIFF":"")."
\n";
if ($diff) {
- if (abs($diff) > 0.1) {
+ if (abs($diff) > (10 * pow(10, -1 * getDolGlobalInt('MAIN_MAX_DECIMALS_TOT', 0)))) {
+ // If error is more than 10 times the accurancy of rounding. This should not happen.
$errmsg = 'A rounding difference was detected into TOTAL but is too high to be corrected. Some data in your lines may be corrupted. Try to edit each line manually to fix this before restarting.';
dol_syslog($errmsg, LOG_WARNING);
$this->error = $errmsg;
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index 4a48e8b97fd..e89b5ade7ba 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -69,6 +69,7 @@ ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0;
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets';
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Responses_In' WHERE ref = 'Collect_Responses';
+-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
UPDATE llx_document_model set nom = 'standard' where nom = 'Standard' and type ='stock';
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index b335cf7f3f6..76ff0a3e191 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -42,6 +42,8 @@
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_directories FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
-- VPGSQL8.2 CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_ecm_files FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms();
+-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+
ALTER TABLE llx_ecm_files ADD COLUMN note_private text AFTER fk_user_m;
ALTER TABLE llx_ecm_files ADD COLUMN note_public text AFTER note_private;
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index bdc2481cbfa..ab16eadd65b 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -35,6 +35,8 @@
-- VMYSQL4.3 ALTER TABLE llx_partnership MODIFY COLUMN date_partnership_end date NULL;
-- VPGSQL8.2 ALTER TABLE llx_partnership ALTER COLUMN date_partnership_end DROP NOT NULL;
+-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL;
-- VMYSQL4.3 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL USING packaging::real;
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index d3c9afdc267..95fa45588a6 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -51,6 +51,8 @@
-- VPGSQL8.2 ALTER TABLE llx_c_payment_term ALTER COLUMN rowid SET DEFAULT nextval('llx_c_payment_term_rowid_seq');
-- VPGSQL8.2 SELECT setval('llx_c_payment_term_rowid_seq', MAX(rowid)) FROM llx_c_payment_term;
+-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+
ALTER TABLE llx_entrepot ADD COLUMN barcode varchar(180) DEFAULT NULL;
ALTER TABLE llx_entrepot ADD COLUMN fk_barcode_type integer DEFAULT NULL;
diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
index f310d6c6c39..d6345261284 100644
--- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
+++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql
@@ -33,6 +33,9 @@
-- Missing in v16 or lower
+
+-- VMYSQL4.3 ALTER TABLE llx_emailcollector_emailcollector MODIFY COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
+
ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version;
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL;
ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version);
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index da206d457ed..3b8393c402d 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -636,7 +636,7 @@ $listofreferent = array(
'lang'=>'banks',
'buttonnew'=>'AddVariousPayment',
'testnew'=>$user->hasRight('banque', 'modifier'),
- 'test'=>isModEnabled("banque") && $user->hasRight('banque', 'lire') && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)
+ 'test'=>isModEnabled("banque") && $user->hasRight('banque', 'lire') && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)
),
/* No need for this, available on dedicated tab "Agenda/Events"
'agenda'=>array(
diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php
index 3d8687066df..8466d8ebca6 100644
--- a/htdocs/public/members/public_list.php
+++ b/htdocs/public/members/public_list.php
@@ -114,7 +114,6 @@ if (empty($conf->global->MEMBER_PUBLIC_ENABLED)) {
httponly_accessforbidden('Public access of list of members is not enabled');
}
-
$form = new Form($db);
$morehead = '';
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 69f0830f161..c3ec26d3f37 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -875,10 +875,11 @@ class Societe extends CommonObject
* Create third party in database.
* $this->code_client = -1 and $this->code_fournisseur = -1 means automatic assignement.
*
- * @param User $user Object of user that ask creation
- * @return int >=0 if OK, <0 if KO
+ * @param User $user Object of user that ask creation
+ * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
+ * @return int >=0 if OK, <0 if KO
*/
- public function create(User $user)
+ public function create(User $user, $notrigger = 0)
{
global $langs, $conf, $mysoc;
@@ -1016,7 +1017,7 @@ class Societe extends CommonObject
$this->add_commercial($user, $user->id);
}
- if ($ret >= 0) {
+ if ($ret >= 0 && !$notrigger) {
// Call trigger
$result = $this->call_trigger('COMPANY_CREATE', $user);
if ($result < 0) {
@@ -1059,12 +1060,13 @@ class Societe extends CommonObject
/**
* Create a contact/address from thirdparty
*
- * @param User $user Object user
- * @param int $no_email 1=Do not send mailing, 0=Ok to recieve mailling
- * @param array $tags Array of tag to affect to contact
- * @return int <0 if KO, >0 if OK
+ * @param User $user Object user
+ * @param int $no_email 1=Do not send mailing, 0=Ok to recieve mailling
+ * @param array $tags Array of tag to affect to contact
+ * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
+ * @return int <0 if KO, >0 if OK
*/
- public function create_individual(User $user, $no_email = 0, $tags = array())
+ public function create_individual(User $user, $no_email = 0, $tags = array(), $notrigger = 0)
{
global $conf;
@@ -1092,7 +1094,7 @@ class Societe extends CommonObject
$this->setUpperOrLowerCase();
$contact->phone_pro = $this->phone;
- $contactId = $contact->create($user);
+ $contactId = $contact->create($user, $notrigger);
if ($contactId < 0) {
$error++;
$this->error = $contact->error;
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 194bf96c936..857a3f381d3 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -1733,10 +1733,12 @@ while ($i < $imaxinloop) {
// Staff
if (!empty($arrayfields['staff.code']['checked'])) {
print '