\n";
// Use vat for invoice creation
-if ($conf->facture->enabled) {
+if (!empty($conf->facture->enabled)) {
print '
'.$langs->trans("VATToUseForSubscriptions").'
';
if (!empty($conf->banque->enabled)) {
print '
';
diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index d01b160ca31..50e3faa7d51 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -1,5 +1,6 @@
+ * Copyright (C) 2022 Charlene Benke
*
* 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
@@ -592,15 +593,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
'recordjoinpiece'=>'AttachJoinedDocumentsToObject',
'recordevent'=>'RecordEvent');
$arrayoftypesnocondition = $arrayoftypes;
- if ($conf->projet->enabled) {
+ if (!empty($conf->projet->enabled)) {
$arrayoftypes['project'] = 'CreateLeadAndThirdParty';
}
$arrayoftypesnocondition['project'] = 'CreateLeadAndThirdParty';
- if ($conf->ticket->enabled) {
+ if (!empty($conf->ticket->enabled)) {
$arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
}
$arrayoftypesnocondition['ticket'] = 'CreateTicketAndThirdParty';
- if ($conf->recruitment->enabled) {
+ if (!empty($conf->recruitment->enabled)) {
$arrayoftypes['candidature'] = 'CreateCandidature';
}
$arrayoftypesnocondition['candidature'] = 'CreateCandidature';
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index e8f59727c07..a5e83155f03 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -394,7 +394,7 @@ print "
\n";
print "
\n";
// Option to force stock to be enough before adding a line into document
-if ($conf->invoice->enabled) {
+if (!empty($conf->invoice->enabled)) {
print '
';
print '
'.$langs->trans("StockMustBeEnoughForInvoice").'
';
print '
';
@@ -408,7 +408,7 @@ if ($conf->invoice->enabled) {
print "
';
if (!empty($conf->use_javascript_ajax)) {
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 578e1afa497..ef4ca462008 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -1,6 +1,7 @@
- * Copyright (C) 2017-2020 Laurent Destailleur
+/* Copyright (C) 2017 ATM Consulting
+ * Copyright (C) 2017-2020 Laurent Destailleur
+ * Copyright (C) 2022 charlene benke
*
* 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
@@ -139,76 +140,53 @@ class BlockedLog
$this->trackedevents = array();
- if ($conf->facture->enabled) {
+ if (!empty($conf->facture->enabled)) {
$this->trackedevents['BILL_VALIDATE'] = 'logBILL_VALIDATE';
- }
- if ($conf->facture->enabled) {
$this->trackedevents['BILL_DELETE'] = 'logBILL_DELETE';
- }
- if ($conf->facture->enabled) {
$this->trackedevents['BILL_SENTBYMAIL'] = 'logBILL_SENTBYMAIL';
- }
- if ($conf->facture->enabled) {
$this->trackedevents['DOC_DOWNLOAD'] = 'BlockedLogBillDownload';
- }
- if ($conf->facture->enabled) {
$this->trackedevents['DOC_PREVIEW'] = 'BlockedLogBillPreview';
- }
- if ($conf->facture->enabled) {
$this->trackedevents['PAYMENT_CUSTOMER_CREATE'] = 'logPAYMENT_CUSTOMER_CREATE';
- }
- if ($conf->facture->enabled) {
$this->trackedevents['PAYMENT_CUSTOMER_DELETE'] = 'logPAYMENT_CUSTOMER_DELETE';
}
/* Supplier
- if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
- if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
- if ($conf->fournisseur->enabled) $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
- if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
- if ($conf->fournisseur->enabled) $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
+ if (!empty($conf->fournisseur->enabled)) {
+ $this->trackedevents['BILL_SUPPLIER_VALIDATE']='BlockedLogSupplierBillValidate';
+ $this->trackedevents['BILL_SUPPLIER_DELETE']='BlockedLogSupplierBillDelete';
+ $this->trackedevents['BILL_SUPPLIER_SENTBYMAIL']='BlockedLogSupplierBillSentByEmail'; // Trigger key does not exists, we want just into array to list it as done
+ $this->trackedevents['SUPPLIER_DOC_DOWNLOAD']='BlockedLogSupplierBillDownload'; // Trigger key does not exists, we want just into array to list it as done
+ $this->trackedevents['SUPPLIER_DOC_PREVIEW']='BlockedLogSupplierBillPreview'; // Trigger key does not exists, we want just into array to list it as done
- if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
- if ($conf->fournisseur->enabled) $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
+ $this->trackedevents['PAYMENT_SUPPLIER_CREATE']='BlockedLogSupplierBillPaymentCreate';
+ $this->trackedevents['PAYMENT_SUPPLIER_DELETE']='BlockedLogsupplierBillPaymentCreate';
+ }
*/
- if ($conf->don->enabled) {
+ if (!empty($conf->don->enabled)) {
$this->trackedevents['DON_VALIDATE'] = 'logDON_VALIDATE';
- }
- if ($conf->don->enabled) {
$this->trackedevents['DON_DELETE'] = 'logDON_DELETE';
- }
- //if ($conf->don->enabled) $this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
-
- if ($conf->don->enabled) {
+ //$this->trackedevents['DON_SENTBYMAIL']='logDON_SENTBYMAIL';
$this->trackedevents['DONATION_PAYMENT_CREATE'] = 'logDONATION_PAYMENT_CREATE';
- }
- if ($conf->don->enabled) {
$this->trackedevents['DONATION_PAYMENT_DELETE'] = 'logDONATION_PAYMENT_DELETE';
}
/*
- if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
- if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
- if ($conf->salary->enabled) $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
+ if (!empty($conf->salary->enabled)) {
+ $this->trackedevents['PAYMENT_SALARY_CREATE']='BlockedLogSalaryPaymentCreate';
+ $this->trackedevents['PAYMENT_SALARY_MODIFY']='BlockedLogSalaryPaymentCreate';
+ $this->trackedevents['PAYMENT_SALARY_DELETE']='BlockedLogSalaryPaymentCreate';
+ }
*/
- if ($conf->adherent->enabled) {
+ if (!empty($conf->adherent->enabled)) {
$this->trackedevents['MEMBER_SUBSCRIPTION_CREATE'] = 'logMEMBER_SUBSCRIPTION_CREATE';
- }
- if ($conf->adherent->enabled) {
$this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY'] = 'logMEMBER_SUBSCRIPTION_MODIFY';
- }
- if ($conf->adherent->enabled) {
$this->trackedevents['MEMBER_SUBSCRIPTION_DELETE'] = 'logMEMBER_SUBSCRIPTION_DELETE';
}
- if ($conf->banque->enabled) {
+ if (!empty($conf->banque->enabled)) {
$this->trackedevents['PAYMENT_VARIOUS_CREATE'] = 'logPAYMENT_VARIOUS_CREATE';
- }
- if ($conf->banque->enabled) {
$this->trackedevents['PAYMENT_VARIOUS_MODIFY'] = 'logPAYMENT_VARIOUS_MODIFY';
- }
- if ($conf->banque->enabled) {
$this->trackedevents['PAYMENT_VARIOUS_DELETE'] = 'logPAYMENT_VARIOUS_DELETE';
}
// $conf->global->BANK_ENABLE_POS_CASHCONTROL must be set to 1 by all external POS modules
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index dc4b56b2763..b7fc682d2c6 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -153,16 +153,16 @@ print '
';
if ($object->thirdparty->client) {
$thirdTypeArray['customer'] = $langs->trans("customer");
- if ($conf->propal->enabled && $user->rights->propal->lire) {
+ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
- if ($conf->commande->enabled && $user->rights->commande->lire) {
+ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
- if ($conf->facture->enabled && $user->rights->facture->lire) {
+ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
- if ($conf->contrat->enabled && $user->rights->contrat->lire) {
+ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index 5600f51f5e2..31a48f38cf4 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -346,7 +346,7 @@ class FormTicket
}
}
- if ($conf->knowledgemanagement->enabled) {
+ if (!empty($conf->knowledgemanagement->enabled)) {
// KM Articles
print '
';
print '
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 556ee3e609a..ea6d21fe457 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -339,7 +339,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
$newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0), 'auguria', $tabMenu);
// We update newmenu for special dynamic menus
- if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') { // Entry for each bank account
+ if (!empty($conf->banque->enabled) && $user->rights->banque->lire && $mainmenu == 'bank') { // Entry for each bank account
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required for to get Account::TYPE_CASH for example
$sql = "SELECT rowid, label, courant, rappro, courant";
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 16568288aa4..08eb9a6f42d 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -819,11 +819,18 @@ class ImportCsv extends ModeleImports
$updatedone = false;
$insertdone = false;
+ $is_table_category_link = false;
+ $fname = 'rowid';
+ if (strpos($tablename, '_categorie_') !== false) {
+ $is_table_category_link = true;
+ $fname='*';
+ }
+
if (!empty($updatekeys)) {
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
if (empty($lastinsertid)) { // No insert done yet for a parent table
- $sqlSelect = "SELECT rowid FROM ".$tablename;
+ $sqlSelect = "SELECT ".$fname." FROM ".$tablename;
$data = array_combine($listfields, $listvalues);
$where = array();
@@ -842,6 +849,7 @@ class ImportCsv extends ModeleImports
if ($num_rows == 1) {
$res = $this->db->fetch_object($resql);
$lastinsertid = $res->rowid;
+ if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
$last_insert_id_array[$tablename] = $lastinsertid;
} elseif ($num_rows > 1) {
$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
@@ -903,6 +911,10 @@ class ImportCsv extends ModeleImports
}
$sqlend = " WHERE ".$keyfield." = ".((int) $lastinsertid);
+ if ($is_table_category_link) {
+ $sqlend = " WHERE " . implode(' AND ', $where);
+ }
+
$sql = $sqlstart.$sqlend;
// Run update request
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index d16a9a764eb..7be4ee8894a 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -863,11 +863,19 @@ class ImportXlsx extends ModeleImports
if (!empty($listfields)) {
$updatedone = false;
$insertdone = false;
+
+ $is_table_category_link = false;
+ $fname = 'rowid';
+ if (strpos($tablename, '_categorie_') !== false) {
+ $is_table_category_link = true;
+ $fname='*';
+ }
+
if (!empty($updatekeys)) {
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
if (empty($lastinsertid)) { // No insert done yet for a parent table
- $sqlSelect = "SELECT rowid FROM " . $tablename;
+ $sqlSelect = "SELECT ".$fname." FROM " . $tablename;
$data = array_combine($listfields, $listvalues);
$where = array();
@@ -886,6 +894,7 @@ class ImportXlsx extends ModeleImports
if ($num_rows == 1) {
$res = $this->db->fetch_object($resql);
$lastinsertid = $res->rowid;
+ if ($is_table_category_link) $lastinsertid = 'linktable'; // used to apply update on tables like llx_categorie_product and avoid being blocked for all file content if at least one entry already exists
$last_insert_id_array[$tablename] = $lastinsertid;
} elseif ($num_rows > 1) {
$this->errors[$error]['lib'] = $langs->trans('MultipleRecordFoundWithTheseFilters', implode(', ', $filters));
@@ -947,6 +956,10 @@ class ImportXlsx extends ModeleImports
}
$sqlend = " WHERE " . $keyfield . " = ".((int) $lastinsertid);
+ if ($is_table_category_link) {
+ $sqlend = " WHERE " . implode(' AND ', $where);
+ }
+
$sql = $sqlstart . $sqlend;
// Run update request
diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php
index 6ee294eff58..9e138c6ccef 100644
--- a/htdocs/core/modules/modCategorie.class.php
+++ b/htdocs/core/modules/modCategorie.class.php
@@ -481,6 +481,7 @@ class modCategorie extends DolibarrModules
'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
);
$this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"rowid or label", 'cp.fk_product'=>"rowid or ref");
+ $this->import_updatekeys_array[$r] = array('cp.fk_categorie' => 'Category', 'cp.fk_product' => 'ProductRef');
}
// 1 Suppliers
diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang
index 8f44b999a3a..c4a964b6b62 100644
--- a/htdocs/langs/en_US/companies.lang
+++ b/htdocs/langs/en_US/companies.lang
@@ -163,14 +163,14 @@ ProfId5CL=-
ProfId6CL=-
ProfId1CM=Id. prof. 1 (Trade Register)
ProfId2CM=Id. prof. 2 (Taxpayer No.)
-ProfId3CM=Id. prof. 3 (Decree of creation)
-ProfId4CM=Id. prof. 4 (Certificate of deposits)
+ProfId3CM=Id. prof. 3 (No. of creation decree)
+ProfId4CM=Id. prof. 4 (Deposit certificate No.)
ProfId5CM=Id. prof. 5 (Others)
ProfId6CM=-
ProfId1ShortCM=Trade Register
ProfId2ShortCM=Taxpayer No.
-ProfId3ShortCM=Decree of creation
-ProfId4ShortCM=Certificate of deposits
+ProfId3ShortCM=No. of creation decree
+ProfId4ShortCM=Deposit certificate No.
ProfId5ShortCM=Others
ProfId6ShortCM=-
ProfId1CO=Prof Id 1 (R.U.T.)