diff --git a/README-FR.md b/README-FR.md
index 81fdff13047..a67bf204076 100644
--- a/README-FR.md
+++ b/README-FR.md
@@ -8,12 +8,10 @@ Il est simple d'utilisation et modulaire, vous permettant de n'activez que les f

-
## LICENCE
Dolibarr est distribué sous les termes de la licence GNU General Public License v3+ ou supérieure.
-
## INSTALLER DOLIBARR
### Configuration simple
@@ -54,7 +52,6 @@ Vous pouvez aussi utiliser un serveur Web et une base de données prise en charg
- Suivez les instructions de l'installateur
-
## METTRE A JOUR DOLIBARR
Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
@@ -65,14 +62,12 @@ Pour mettre à jour Dolibarr depuis une vieille version vers celle ci:
- Au prochain accès, Dolibarr proposera la page de "mise à jour" des données (si nécessaire).
Si un fichier install.lock existe pour verrouiller le processus de mise à jour, il sera demandé de le supprimer manuellement (vous devriez trouver le fichier install.lock dans le répertoire utilisé pour stocker les documents générés ou transférés sur le serveur. Dans la plupart des cas, c'est le répertoire appelé "documents")
-*Note: Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
-
+Note: *Le processus de migration peut être lancé manuellement et plusieurs fois, sans risque, en appelant la page /install/*
## CE QUI EST NOUVEAU
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
-
## CE QUE DOLIBARR PEUT FAIRE
### Modules principaux (tous optionnels)
@@ -122,7 +117,7 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Peux être multi-société par ajout du module externe multi-société.
- Plusieurs thèmes visuels.
- Application simple à utiliser.
-- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur https://wiki.dolibarr.org/index.php/Prérequis).
+- Requiert PHP et MariaDb, Mysql ou Postgresql (Voir versions exactes sur [https://wiki.dolibarr.org/index.php/Prérequis](https://wiki.dolibarr.org/index.php/Prérequis)).
- Compatible avec toutes les offres Cloud du marché respectant les prérequis de base de données et PHP.
- APIs.
- Génération PDF et ODT des éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
@@ -142,7 +137,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
Dolibarr peut aussi être étendu à volonté avec l'ajout de module/applications externes développées par des développeus tiers, disponible sur [DoliStore](https://www.dolistore.com).
-
## CE QUE DOLIBARR NE PEUT PAS (ENCORE) FAIRE
Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
@@ -152,18 +146,15 @@ Voici un liste de fonctionnalités pas encore gérées par Dolibarr:
- Dolibarr n'embarque pas de Webmail intégré nativement.
- Dolibarr ne fait pas le café (pas encore).
-
## DOCUMENTATION
La documentation utilisateur, développeur et traducteur est disponible sous forme de ressources de la communauté via le site [Wiki](https://wiki.dolibarr.org).
-
## CONTRIBUER
Ce projet existe grâce à ses nombreux contributeurs [[Contribuer](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)].
-
-
+[](https://github.com/Dolibarr/dolibarr/graphs/contributors)
## CREDITS
@@ -171,7 +162,6 @@ Dolibarr est le résultat du travail de nombreux contributeurs depuis des année
Voir le fichier [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT)
-
## ACTUALITES ET RESEAUX SOCIAUX
Suivez le projet Dolibarr project sur les réseaux francophones
diff --git a/README.md b/README.md
index 54fdf1e958b..b0f7a2c3761 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ You can use a web server and a supported database (MariaDB, MySQL or PostgreSQL)
On GNU/Linux, first check if your distribution has already packaged Dolibarr.
-#### Generic install steps:
+#### Generic install steps
- Check that your installed PHP version is supported [see PHP support](https://wiki.dolibarr.org/index.php/Releases).
@@ -71,86 +71,87 @@ On GNU/Linux, first check if your distribution has already packaged Dolibarr.
- Follow the installer instructions
-
### Saas/Cloud setup
-If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
-
+If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See [https://saas.dolibarr.org](https://saas.dolibarr.org)). However, this third solution is not free.
## UPGRADING
Dolibarr supports upgrading, usually without the need for any (commercial) support (depending on if you use any commercial extensions). It supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate!
-
+
- At first make a backup of your Dolibarr files & then [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr)
- Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md).
- Overwrite all old files from 'dolibarr' directory with files provided into the new version's package.
- At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process.
If an `install.lock` file exists to lock any other upgrade process, the application will ask you to remove the file manually (you should find the `install.lock` file in the directory used to store generated and uploaded documents, in most cases, it is the directory called "*documents*").
-
## WHAT'S NEW
See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file.
-
## FEATURES
### Main application/modules (all optional)
-- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
-- Members/Membership/Foundation management
+- Third-Parties Management: Customers, Prospects (Leads) and/or Suppliers + Contacts
+- Members/Membership/Foundation management
- Product Management
-- Products and/or Services catalog
-- Stock / Warehouse management + Inventory
-- Barcodes
-- Batches / Lots / Serials
-- Product Variants
+ Product Management
+
+- Products and/or Services catalog
+- Stock / Warehouse management + Inventory
+- Barcodes
+- Batches / Lots / Serials
+- Product Variants
- Bill of Materials (BOM)
-- Manufacturing Orders
+- Manufacturing Orders
- Customer/Sales Management
-- Customers/Prospects + Contacts management
-- Opportunities or Leads management
-- Commercial proposals management
-- Customer Orders management
-- Contracts/Subscription management
-- Interventions management
-- Ticket System
-- Shipping management
-- Customer Invoices/Credit notes and payment management
-- Point of Sale (POS)
+ Customer/Sales Management
- Supplier/Purchase Management
-- Suppliers/Vendors + Contacts
-- Supplier (price) requests
-- Purchase Orders management
-- Delivery/Receiption
-- Supplier Invoices/credit notes and payment management
-- INCOTERMS
+- Customers/Prospects + Contacts management
+- Opportunities or Leads management
+- Commercial proposals management
+- Customer Orders management
+- Contracts/Subscription management
+- Interventions management
+- Ticket System
+- Shipping management
+- Customer Invoices/Credit notes and payment management
+- Point of Sale (POS)
- Finance / Accounting
-- Invoices / Payments
-- Bank accounts management
-- Direct debit orders management (European SEPA)
-- Accounting management
-- Donations management
-- Loan management
-- Margins
-- Reports
+ Supplier/Purchase Management
- Collaboration
-- Shared calendar/agenda (with ical and vcal export for third party tools integration)
-- Projects & Tasks management
-- Ticket System
+- Suppliers/Vendors + Contacts
+- Supplier (price) requests
+- Purchase Orders management
+- Delivery/Receiption
+- Supplier Invoices/credit notes and payment management
+- INCOTERMS
+
+ Finance / Accounting
+
+- Invoices / Payments
+- Bank accounts management
+- Direct debit orders management (European SEPA)
+- Accounting management
+- Donations management
+- Loan management
+- Margins
+- Reports
+
+ Collaboration
+
+- Shared calendar/agenda (with ical and vcal export for third party tools integration)
+- Projects & Tasks management
+- Ticket System
- Surveys
- HR
-- Employee's leave requests management
-- Expense reports
-- Recruitment management
-- Timesheets
+ HR
+- Employee's leave requests management
+- Expense reports
+- Recruitment management
+- Timesheets
### Other application/modules
@@ -171,7 +172,6 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
(around 100 modules available by default, 1000+ on the addon market place)
-
### Other general features
- Localization in most major languages
@@ -190,27 +190,24 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog)
- Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp
- Argentina invoice numbering using A,B,C...
- - Compatible with [European directives] (https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
+ - Compatible with [European directives](https://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- Compatible with European GDPR rules
- ...
- Flexible PDF & ODT generation for invoices, proposals, orders...
- ...
-
### System Environment / Requirements
- PHP
-- MariaDB, MySQL or PostgreSQL
+- MariaDB, MySQL or PostgreSQL
- Compatible with all Cloud solutions that match PHP & MySQL or PostgreSQL prerequisites.
See exact requirements on the [Wiki](https://wiki.dolibarr.org/index.php/Prerequisite)
-
### Extending
Dolibarr can be extended with a lot of other external application or modules from third party developers available at the [DoliStore](https://www.dolistore.com).
-
## WHAT DOLIBARR CAN'T DO YET
These are features that Dolibarr does **not** yet fully support:
@@ -220,21 +217,18 @@ These are features that Dolibarr does **not** yet fully support:
- No native embedded Webmail, but you can send email to contacts in Dolibarr with e.g. offers, invoices, etc.
- Dolibarr can't do coffee (yet)
-
## DOCUMENTATION
Administrator, user, developer and translator's documentations are available along with other community resources in the [Wiki](https://wiki.dolibarr.org).
-
## CONTRIBUTING
-This project exists thanks to all the people who contribute.
+This project exists thanks to all the people who contribute.
Please read the instructions how to contribute (report a bug/error, a feature request, send code ...) [[Contribute](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md)]
A view on Contributors:
-
-
+[](https://github.com/Dolibarr/dolibarr/graphs/contributors)
## CREDITS
@@ -242,7 +236,6 @@ Dolibarr is the work of many contributors over the years and uses some fine PHP
See [COPYRIGHT](https://github.com/Dolibarr/dolibarr/blob/develop/COPYRIGHT) file.
-
## NEWS AND SOCIAL NETWORKS
Follow Dolibarr project on:
@@ -253,8 +246,6 @@ Follow Dolibarr project on:
- [YouTube](https://www.youtube.com/user/DolibarrERPCRM)
- [GitHub](https://github.com/Dolibarr/dolibarr)
-
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here. 🙏 [[Become a sponsor/backer](https://opencollective.com/dolibarr#backer)]
-
diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php
index d98357bc93c..e7616ededf3 100644
--- a/htdocs/accountancy/admin/productaccount.php
+++ b/htdocs/accountancy/admin/productaccount.php
@@ -199,7 +199,7 @@ if ($action == 'update') {
$nb_exists = $db->num_rows($resql_exists);
if ($nb_exists <= 0) {
// insert
- $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, '" . $db->escape($accountancy_field_name) . "')";
+ $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")";
$sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')";
} else {
$obj_exists = $db->fetch_object($resql_exists);
diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php
index 2c4dbfd51cd..07d28b7abdb 100644
--- a/htdocs/accountancy/class/accountancyexport.class.php
+++ b/htdocs/accountancy/class/accountancyexport.class.php
@@ -87,11 +87,11 @@ class AccountancyExport
*
* @param DoliDb $db Database handler
*/
- public function __construct(DoliDB &$db)
+ public function __construct(DoliDB $db)
{
global $conf;
- $this->db = &$db;
+ $this->db = $db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE) ? "\n" : ($conf->global->ACCOUNTING_EXPORT_ENDLINE == 1 ? "\n" : "\r\n");
}
@@ -928,17 +928,18 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
+ $refInvoice = '';
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
- $invoice = new Facture($db);
+ $invoice = new Facture($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
- $invoice = new FactureFournisseur($db);
+ $invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref_supplier;
@@ -1054,17 +1055,18 @@ class AccountancyExport
$date_validation = dol_print_date($line->date_validation, '%Y%m%d');
$date_limit_payment = dol_print_date($line->date_lim_reglement, '%Y%m%d');
+ $refInvoice = '';
if ($line->doc_type == 'customer_invoice') {
// Customer invoice
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
- $invoice = new Facture($db);
+ $invoice = new Facture($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref;
} elseif ($line->doc_type == 'supplier_invoice') {
// Supplier invoice
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
- $invoice = new FactureFournisseur($db);
+ $invoice = new FactureFournisseur($this->db);
$invoice->fetch($line->fk_doc);
$refInvoice = $invoice->ref_supplier;
diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php
index 23958820b64..a264411c501 100644
--- a/htdocs/accountancy/customer/index.php
+++ b/htdocs/accountancy/customer/index.php
@@ -184,6 +184,8 @@ if ($action == 'validatehistory') {
} else {
$num_lines = $db->num_rows($result);
+ $facture_static = new Facture($db);
+
$isSellerInEEC = isInEEC($mysoc);
$thirdpartystatic = new Societe($db);
@@ -266,6 +268,18 @@ if ($action == 'validatehistory') {
}
}
+ // Manage Deposit
+ if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
+ if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
+ $accountdeposittoventilated = new AccountingAccount($db);
+ $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
+ $objp->code_sell_l = $accountdeposittoventilated->ref;
+ $objp->code_sell_p = '';
+ $objp->code_sell_t = '';
+ $objp->aarowid_suggest = $accountdeposittoventilated->rowid;
+ }
+ }
+
if ($objp->aarowid_suggest > 0) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."facturedet";
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php
index 020fbab1e4d..c07f4854b84 100644
--- a/htdocs/accountancy/customer/list.php
+++ b/htdocs/accountancy/customer/list.php
@@ -413,6 +413,9 @@ if ($result) {
if ($search_ref) {
$param .= '&search_ref='.urlencode($search_ref);
}
+ if ($search_label) {
+ $param .= '&search_label='.urlencode($search_label);
+ }
if ($search_desc) {
$param .= '&search_desc='.urlencode($search_desc);
}
@@ -491,7 +494,7 @@ if ($result) {
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '';
- print '';
+ print "\n";
print '
';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
@@ -539,7 +542,7 @@ if ($result) {
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra;
- $thirdpartystatic->code_compta = $objp->company_code_sell;
+ $thirdpartystatic->code_compta_company = $objp->company_code_sell;
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@@ -558,7 +561,7 @@ if ($result) {
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
$facture_static->type = $objp->ftype;
- $facture_static->date = $objp->datef;
+ $facture_static->date = $db->jdate($objp->datef);
$facture_static_det->id = $objp->rowid;
$facture_static_det->total_ht = $objp->total_ht;
@@ -589,7 +592,28 @@ if ($result) {
}
//var_dump($return);
- if (!empty($code_sell_p)) {
+ // Level 3: Search suggested account for this thirdparty (similar code exists in page index.php to make automatic binding)
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ if (!empty($objp->company_code_sell)) {
+ $objp->code_sell_t = $objp->company_code_sell;
+ $objp->aarowid_suggest = $objp->aarowid_thirdparty;
+ $suggestedaccountingaccountfor = '';
+ }
+ }
+
+ // Manage Deposit
+ if (!empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT)) {
+ if ($objp->description == "(DEPOSIT)" || $objp->ftype == $facture_static::TYPE_DEPOSIT) {
+ $accountdeposittoventilated = new AccountingAccount($db);
+ $accountdeposittoventilated->fetch('', $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER_DEPOSIT, 1);
+ $objp->code_sell_l = $accountdeposittoventilated->ref;
+ $objp->code_sell_p = '';
+ $objp->code_sell_t = '';
+ $objp->aarowid_suggest = $accountdeposittoventilated->rowid;
+ }
+ }
+
+ if (!empty($objp->code_sell_p)) {
// Value was defined previously
} else {
$code_sell_p_notset = 'color:orange';
@@ -613,7 +637,7 @@ if ($result) {
// Ref Invoice
print ''.$facture_static->getNomUrl(1).' ';
- print ''.dol_print_date($db->jdate($facture_static->date), 'day').' ';
+ print ''.dol_print_date($facture_static->date, 'day').' ';
// Ref Product
print '';
@@ -707,7 +731,7 @@ if ($result) {
// Column with checkbox
print ' ';
- if (!empty($suggestedid) && $suggestedaccountingaccountfor<>'') {
+ if (!empty($suggestedid) && $suggestedaccountingaccountfor <> '') {
$ischecked=1;
} elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') {
$ischecked = 0;
diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php
index 20230c7cfad..b7e914c381a 100644
--- a/htdocs/accountancy/supplier/list.php
+++ b/htdocs/accountancy/supplier/list.php
@@ -291,7 +291,7 @@ if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
}
if (strlen(trim($search_label))) {
- $sql .= natural_search("f.libelle", $search_label);
+ $sql .= natural_search(array("p.label", "f.libelle"), $search_label);
}
if (strlen(trim($search_desc))) {
$sql .= natural_search("l.description", $search_desc);
@@ -546,7 +546,7 @@ if ($result) {
$thirdpartystatic->email = $objp->email;
$thirdpartystatic->country_code = $objp->country_code;
$thirdpartystatic->tva_intra = $objp->tva_intra;
- $thirdpartystatic->code_compta_fournisseur = $objp->company_code_buy;
+ $thirdpartystatic->code_compta_company = $objp->company_code_buy;
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
@@ -566,10 +566,11 @@ if ($result) {
$facturefourn_static->id = $objp->facid;
$facturefourn_static->type = $objp->ftype;
$facturefourn_static->label = $objp->invoice_label;
+ $facturefourn_static->date = $db->jdate($objp->datef);
$facturefourn_static_det->id = $objp->rowid;
$facturefourn_static_det->total_ht = $objp->total_ht;
- $facturefourn_static_det->tva_tx_line = $objp->tva_tx_line;
+ $facturefourn_static_det->tva_tx = $objp->tva_tx_line;
$facturefourn_static_det->vat_src_code = $objp->vat_src_code;
$facturefourn_static_det->product_type = $objp->type_l;
$facturefourn_static_det->desc = $objp->description;
@@ -608,6 +609,9 @@ if ($result) {
if (empty($code_buy_l) && empty($code_buy_p)) {
$code_buy_p_notset = 'color:red';
}
+ /*if ($suggestedaccountingaccountfor == 'eecwithoutvatnumber' && empty($code_sell_p_notset)) {
+ $code_sell_p_notset = 'color:orange';
+ }*/
// $code_buy_l is now default code of product/service
// $code_buy_p is now code of product/service
@@ -626,15 +630,15 @@ if ($result) {
print ' ';
*/
- print ''.dol_print_date($db->jdate($facturefourn_static_det->datef), 'day').' ';
+ print ''.dol_print_date($facturefourn_static->date, 'day').' ';
// Ref Product
print '';
if ($product_static->id > 0) {
print $product_static->getNomUrl(1);
}
- if ($product_static->product_label) {
- print ''.$product_static->product_label.' ';
+ if ($product_static->label) {
+ print ''.$product_static->label.' ';
}
print ' ';
@@ -650,11 +654,12 @@ if ($result) {
print '';
// Vat rate
+ $code_vat_differ='';
if ($objp->vat_tx_l != $objp->vat_tx_p && ! empty($objp->vat_tx_l)) { // Note: having a vat rate of 0 is often the normal case when sells is intra b2b or to export
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
}
print '';
- print vatrate($facturefourn_static_det->tva_tx_line.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
+ print vatrate($facturefourn_static_det->tva_tx.($facturefourn_static_det->vat_src_code ? ' ('.$facturefourn_static_det->vat_src_code.')' : ''));
print ' ';
// Thirdparty
@@ -671,7 +676,7 @@ if ($result) {
// Found accounts
print '';
- $s = '1. '.(($facturefourn_static_det->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
+ $s = '1. '.(($facturefourn_static_det->product_type == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': ';
$shelp = '';
if ($suggestedaccountingaccountbydefaultfor == 'eec') {
$shelp .= $langs->trans("SaleEEC");
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index cf0d82b2c7b..5b53437a212 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -1788,13 +1788,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '';
- // Birth Date
- print ''.$langs->trans("DateOfBirth").' '.dol_print_date($object->birth, 'day').' ';
-
- // Public
- print ''.$langs->trans("Public").' '.yn($object->public).' ';
-
- // Categories
+ // Tags / Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print ''.$langs->trans("Categories").' ';
print '';
@@ -1802,6 +1796,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
}
+ // Birth Date
+ print ''.$langs->trans("DateOfBirth").' '.dol_print_date($object->birth, 'day').' ';
+
+ // Public
+ print ''.$langs->trans("Public").' '.yn($object->public).' ';
+
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php
index 90b34e604be..cdf021cfa68 100644
--- a/htdocs/adherents/class/adherent_type.class.php
+++ b/htdocs/adherents/class/adherent_type.class.php
@@ -90,7 +90,7 @@ class AdherentType extends CommonObject
public $subscription;
/**
- * @var float amount for subscription
+ * @var float|string Amount for subscription (null or '' means not defined)
*/
public $amount;
diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php
index 983e6d9aada..4b64290f107 100644
--- a/htdocs/adherents/ldap.php
+++ b/htdocs/adherents/ldap.php
@@ -209,7 +209,6 @@ if ($result > 0) {
}
$ldap->unbind();
- $ldap->close();
} else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index fe21b8577ef..4936fadd326 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -314,7 +314,7 @@ if (!empty($search_categ) || !empty($catid)) {
}
$sql .= " d.rowid, d.ref, d.login, d.lastname, d.firstname, d.gender, d.societe as company, d.fk_soc,";
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
-$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
+$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.birth, d.public, d.photo,";
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
$sql .= " d.note_private, d.note_public,";
$sql .= " s.nom,";
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index d0776bc3459..0854b94bff2 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -195,9 +195,7 @@ foreach ($data as $val) {
}
print '';
print '';
- //print '';
- print $year;
- //print ' ';
+ print ''.$year.' ';
print ' ';
print ''.$val['nb'].' ';
print ''.price(price2num($val['total'], 'MT'), 1).' ';
diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php
index f932b65e98c..43902a5e1bf 100644
--- a/htdocs/adherents/type_ldap.php
+++ b/htdocs/adherents/type_ldap.php
@@ -170,7 +170,6 @@ if ($result > 0) {
}
$ldap->unbind();
- $ldap->close();
} else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php
index 6580db4e8f3..e1e468b0cec 100644
--- a/htdocs/admin/bank.php
+++ b/htdocs/admin/bank.php
@@ -275,8 +275,7 @@ print ' ';
/*
* Document templates generators
*/
-//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
-//{
+
print load_fiche_titre($langs->trans("BankAccountModelModule"), '', '');
// Load array def with activated templates
@@ -466,8 +465,7 @@ print ' ';
/*
* Document templates generators
*/
-//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
-//{
+
print load_fiche_titre($langs->trans("Other"), '', '');
print "\n";
diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php
index c370c07b73b..2fbfed35536 100644
--- a/htdocs/admin/barcode.php
+++ b/htdocs/admin/barcode.php
@@ -176,6 +176,71 @@ foreach ($dirbarcode as $reldir) {
}
}
+
+
+// Select barcode numbering module
+if ($conf->product->enabled) {
+ print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
+
+ print '';
+ print '
';
+ print '';
+ print ''.$langs->trans("Name").' ';
+ print ''.$langs->trans("Description").' ';
+ print ''.$langs->trans("Example").' ';
+ print ''.$langs->trans("Status").' ';
+ print ''.$langs->trans("ShortInfo").' ';
+ print " \n";
+
+ $dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
+
+ foreach ($dirbarcodenum as $dirroot) {
+ $dir = dol_buildpath($dirroot, 0);
+
+ $handle = @opendir($dir);
+ if (is_resource($handle)) {
+ while (($file = readdir($handle)) !== false) {
+ if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
+ $file = substr($file, 0, dol_strlen($file) - 4);
+
+ try {
+ dol_include_once($dirroot.$file.'.php');
+ } catch (Exception $e) {
+ dol_syslog($e->getMessage(), LOG_ERR);
+ }
+
+ $modBarCode = new $file();
+
+ print '';
+ print ''.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)." \n";
+ print $modBarCode->info($langs);
+ print ' ';
+ print ''.$modBarCode->getExample($langs)." \n";
+
+ if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
+ print '';
+ print img_picto($langs->trans("Activated"), 'switch_on');
+ print ' ';
+ } else {
+ print '';
+ print img_picto($langs->trans("Disabled"), 'switch_off');
+ print ' ';
+ }
+ print '';
+ $s = $modBarCode->getToolTip($langs, null, -1);
+ print $form->textwithpicto('', $s, 1);
+ print ' ';
+ print " \n";
+ }
+ }
+ closedir($handle);
+ }
+ }
+ print "
\n";
+ print '
';
+}
+
+
/*
* CHOIX ENCODAGE
*/
@@ -189,6 +254,7 @@ if (empty($conf->use_javascript_ajax)) {
print ' ';
}
+print '';
print '
';
print '';
print ''.$langs->trans("Name").' ';
@@ -211,8 +277,9 @@ if ($resql) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
- print ' ';
- print $obj->label;
+ print ' ';
+ print '';
+ print dol_escape_htmltag($obj->label);
print " \n";
print $langs->trans('BarcodeDesc'.$obj->encoding);
//print "L'EAN se compose de 8 caracteres, 7 chiffres plus une cle de controle. ";
@@ -270,6 +337,7 @@ if ($resql) {
}
}
print "
\n";
+print '
';
if (empty($conf->use_javascript_ajax)) {
print $form->buttonsSaveCancel("Save", '');
@@ -287,6 +355,7 @@ print "';
print ' ';
-
-// Select barcode numbering module
-if ($conf->product->enabled) {
- print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', '');
-
- print '';
- print '';
- print ''.$langs->trans("Name").' ';
- print ''.$langs->trans("Description").' ';
- print ''.$langs->trans("Example").' ';
- print ''.$langs->trans("Status").' ';
- print ''.$langs->trans("ShortInfo").' ';
- print " \n";
-
- $dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
-
- foreach ($dirbarcodenum as $dirroot) {
- $dir = dol_buildpath($dirroot, 0);
-
- $handle = @opendir($dir);
- if (is_resource($handle)) {
- while (($file = readdir($handle)) !== false) {
- if (preg_match('/^mod_barcode_product_.*php$/', $file)) {
- $file = substr($file, 0, dol_strlen($file) - 4);
-
- try {
- dol_include_once($dirroot.$file.'.php');
- } catch (Exception $e) {
- dol_syslog($e->getMessage(), LOG_ERR);
- }
-
- $modBarCode = new $file();
-
- print '';
- print ''.(isset($modBarCode->name) ? $modBarCode->name : $modBarCode->nom)." \n";
- print $modBarCode->info($langs);
- print ' ';
- print ''.$modBarCode->getExample($langs)." \n";
-
- if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM) && $conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") {
- print '';
- print img_picto($langs->trans("Activated"), 'switch_on');
- print ' ';
- } else {
- print '';
- print img_picto($langs->trans("Disabled"), 'switch_off');
- print ' ';
- }
- print '';
- $s = $modBarCode->getToolTip($langs, null, -1);
- print $form->textwithpicto('', $s, 1);
- print ' ';
- print " \n";
- }
- }
- closedir($handle);
- }
- }
- print "
\n";
-}
-
-//print '';
-
-print " ";
-
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php
index 026a4315c83..9c80b1f7fa8 100644
--- a/htdocs/admin/defaultvalues.php
+++ b/htdocs/admin/defaultvalues.php
@@ -350,17 +350,15 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) {
$disabled = ' disabled="disabled"';
}
print ' ';
-print "\n";
-print '';
+print ''."\n";
+print ''."\n";
-$result=$object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
+$result = $object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity)));
-if (!is_array($result) && $result<0) {
+if (!is_array($result) && $result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
-} elseif (count($result)>0) {
- foreach ($result as $key=>$defaultvalue) {
- print "\n";
-
+} elseif (is_array($result) && count($result) > 0) {
+ foreach ($result as $key => $defaultvalue) {
print '';
// Page
@@ -378,11 +376,6 @@ if (!is_array($result) && $result<0) {
// Value
if ($mode != 'focus' && $mode != 'mandatory') {
print '';
- /*print ' ';
- print ' ';
- print ' ';
- print ' ';
- */
if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value);
else print ' ';
print ' ';
@@ -405,8 +398,6 @@ if (!is_array($result) && $result<0) {
print '';
print " \n";
- print "\n";
- $i++;
}
}
diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php
index 4a5a09a3461..35fd58980b1 100644
--- a/htdocs/admin/dict.php
+++ b/htdocs/admin/dict.php
@@ -509,8 +509,8 @@ $tabcond[30] = !empty($conf->label->enabled);
$tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled));
$tabcond[33] = !empty($conf->hrm->enabled);
$tabcond[34] = !empty($conf->hrm->enabled);
-$tabcond[35] = !empty($conf->expensereport->enabled);
-$tabcond[36] = !empty($conf->expensereport->enabled);
+$tabcond[35] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
+$tabcond[36] = !empty($conf->expensereport->enabled) && !empty($conf->global->MAIN_USE_EXPENSE_IK);
$tabcond[37] = !empty($conf->product->enabled);
$tabcond[38] = !empty($conf->socialnetworks->enabled);
$tabcond[39] = (!empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && !empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES));
@@ -2107,7 +2107,7 @@ if ($id) {
if ($iserasable) {
print '';
if ($user->admin) {
- print ''.img_delete().' ';
+ print ''.img_delete().' ';
}
//else print ''.img_delete().' '; // Some dictionary can be edited by other profile than admin
print ' ';
diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php
index 8eb2f93c13c..c006688fca1 100644
--- a/htdocs/admin/hrm.php
+++ b/htdocs/admin/hrm.php
@@ -79,10 +79,12 @@ if ($action == 'update') {
if (!empty($max_rank)) {
$static_skill = new Skill($db);
$TAllSkills = $static_skill->fetchAll();
- foreach ($TAllSkills as &$skill) {
- if (empty($skill->lines)) $skill->fetchLines();
- if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
- $skill->createSkills(count($skill->lines) + 1);
+ if (is_array($TAllSkills)) {
+ foreach ($TAllSkills as &$skill) {
+ if (empty($skill->lines)) $skill->fetchLines();
+ if (count($skill->lines) < $conf->global->HRM_MAXRANK) {
+ $skill->createSkills(count($skill->lines) + 1);
+ }
}
}
}
diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php
index 4010d724c1a..abdf6b75073 100644
--- a/htdocs/admin/ldap.php
+++ b/htdocs/admin/ldap.php
@@ -290,24 +290,24 @@ if (function_exists("ldap_connect")) {
print ''.$langs->trans("LDAPTestConnect").' ';
}
- if ($_GET["action"] == 'test') {
+ if ($action == 'test') {
$ldap = new Ldap(); // Les parametres sont passes et recuperes via $conf
$result = $ldap->connect_bind();
if ($result > 0) {
// Test ldap connect and bind
print img_picto('', 'info').' ';
- print ''.$langs->trans("LDAPTCPConnectOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).' ';
+ print ''.$langs->trans("LDAPTCPConnectOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).' ';
print ' ';
- if ($conf->global->LDAP_ADMIN_DN && !empty($conf->global->LDAP_ADMIN_PASS)) {
+ if (!empty($conf->global->LDAP_ADMIN_DN) && !empty($conf->global->LDAP_ADMIN_PASS)) {
if ($result == 2) {
print img_picto('', 'info').' ';
- print ''.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).' ';
+ print ''.$langs->trans("LDAPBindOK", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).' ';
print ' ';
} else {
print img_picto('', 'error').' ';
- print ''.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).' ';
+ print ''.$langs->trans("LDAPBindKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).' ';
print ' ';
print $langs->trans("Error").' '.$ldap->error;
print ' ';
@@ -330,10 +330,10 @@ if (function_exists("ldap_connect")) {
print ' ';
}
- $unbind = $ldap->unbind();
+ $ldap->unbind();
} else {
print img_picto('', 'error').' ';
- print ''.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).' ';
+ print ''.$langs->trans("LDAPTCPConnectKO", $ldap->connectedServer, $conf->global->LDAP_SERVER_PORT).' ';
print ' ';
print $langs->trans("Error").' '.$ldap->error;
print ' ';
diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php
index e6041650d63..33bec1cb2e8 100644
--- a/htdocs/admin/ldap_users.php
+++ b/htdocs/admin/ldap_users.php
@@ -192,7 +192,7 @@ print "\n";
// DN Pour les utilisateurs
print '';
print ''.$langs->trans("LDAPUserDn").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPUserDnExample").' ';
print ' ';
print ' ';
@@ -200,7 +200,7 @@ print '';
// List of object class used to define attributes in structure
print '';
print ''.$langs->trans("LDAPUserObjectClassList").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPUserObjectClassListExample").' ';
print ' ';
print ' ';
@@ -208,7 +208,7 @@ print '';
// Filter, used to filter search
print '';
print ''.$langs->trans("LDAPFilterConnection").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFilterConnectionExample").' ';
print ' ';
print ' ';
@@ -225,168 +225,168 @@ print "\n";
// Common name
print ''.$langs->trans("LDAPFieldFullname").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldFullnameExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FULLNAME) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Name
print ''.$langs->trans("LDAPFieldName").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldNameExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_NAME) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Firstname
print ''.$langs->trans("LDAPFieldFirstName").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldFirstNameExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FIRSTNAME) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Login unix
print ''.$langs->trans("LDAPFieldLoginUnix").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldLoginExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Login samba
print ''.$langs->trans("LDAPFieldLoginSamba").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldLoginSambaExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN_SAMBA) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Password not crypted
print ''.$langs->trans("LDAPFieldPasswordNotCrypted").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldPasswordExample").' ';
print ' ';
print ' ';
// Password crypted
print ''.$langs->trans("LDAPFieldPasswordCrypted").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldPasswordExample").' ';
print ' ';
print ' ';
// Mail
print ''.$langs->trans("LDAPFieldMail").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldMailExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MAIL) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Phone
print ''.$langs->trans("LDAPFieldPhone").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldPhoneExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_PHONE) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Mobile
print ''.$langs->trans("LDAPFieldMobile").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldMobileExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_MOBILE) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Skype
print ''.$langs->trans("LDAPFieldSkype").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldSkypeExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SKYPE) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Fax
print ''.$langs->trans("LDAPFieldFax").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldFaxExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_FAX) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Company
print ''.$langs->trans("LDAPFieldCompany").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldCompanyExample").' ';
print ' ';
print ' ';
// Address
print ''.$langs->trans("LDAPFieldAddress").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldAddressExample").' ';
print ' ';
print ' ';
// ZIP
print ''.$langs->trans("LDAPFieldZip").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldZipExample").' ';
print ' ';
print ' ';
// TOWN
print ''.$langs->trans("LDAPFieldTown").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldTownExample").' ';
print ' ';
print ' ';
// COUNTRY
print ''.$langs->trans("LDAPFieldCountry").' ';
-print ' ';
+print ' ';
print ' ';
print ' ';
print ' ';
// Title
print ''.$langs->trans("LDAPFieldTitle").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldTitleExample").' ';
print ' ';
print ' ';
// Note
print ''.$langs->trans("Note").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldDescriptionExample").' ';
print ' ';
print ' ';
// Sid
print ''.$langs->trans("LDAPFieldSid").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldSidExample").' ';
-print ' global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) ? ' checked' : '')."> ";
+print ' ";
print ' ';
// Group id
print ''.$langs->trans("LDAPFieldGroupid").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldGroupidExample").' ';
print ' ';
print ' ';
// Userid
print ''.$langs->trans("LDAPFieldUserid").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldUseridExample").' ';
print ' ';
print ' ';
// Home Directory
print ''.$langs->trans("LDAPFieldHomedirectory").' ';
-print ' ';
+print ' ';
print ' '.$langs->trans("LDAPFieldHomedirectoryExample").' ';
print ' ';
print ' ';
// Home Directory Prefix
print ''.$langs->trans("LDAPFieldHomedirectoryprefix").' ';
-print ' ';
+print ' ';
print ' ';
print ' ';
print ' ';
@@ -405,20 +405,20 @@ print '';
/*
* Test de la connexion
*/
-if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
+if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'dolibarr2ldap') {
$butlabel = $langs->trans("LDAPTestSynchroUser");
$testlabel = 'testuser';
- $key = $conf->global->LDAP_KEY_USERS;
- $dn = $conf->global->LDAP_USER_DN;
- $objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
+ $key = getDolGlobalString('LDAP_KEY_USERS');
+ $dn = getDolGlobalString('LDAP_USER_DN');
+ $objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
-} elseif ($conf->global->LDAP_SYNCHRO_ACTIVE == 'ldap2dolibarr') {
+} elseif (getDolGlobalString('LDAP_SYNCHRO_ACTIVE') == 'ldap2dolibarr') {
$butlabel = $langs->trans("LDAPTestSearch");
$testlabel = 'testsearchuser';
- $key = $conf->global->LDAP_KEY_USERS;
- $dn = $conf->global->LDAP_USER_DN;
- $objectclass = $conf->global->LDAP_USER_OBJECT_CLASS;
+ $key = getDolGlobalString('LDAP_KEY_USERS');
+ $dn = getDolGlobalString('LDAP_USER_DN');
+ $objectclass = getDolGlobalString('LDAP_USER_OBJECT_CLASS');
show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass);
}
@@ -479,29 +479,29 @@ if (function_exists("ldap_connect")) {
if ($result > 0) {
$required_fields = array(
- $conf->global->LDAP_KEY_USERS,
- $conf->global->LDAP_FIELD_FULLNAME,
- $conf->global->LDAP_FIELD_NAME,
- $conf->global->LDAP_FIELD_FIRSTNAME,
- $conf->global->LDAP_FIELD_LOGIN,
- $conf->global->LDAP_FIELD_LOGIN_SAMBA,
- $conf->global->LDAP_FIELD_PASSWORD,
- $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
- $conf->global->LDAP_FIELD_PHONE,
- $conf->global->LDAP_FIELD_FAX,
- $conf->global->LDAP_FIELD_SKYPE,
- $conf->global->LDAP_FIELD_MOBILE,
- $conf->global->LDAP_FIELD_MAIL,
- $conf->global->LDAP_FIELD_TITLE,
- $conf->global->LDAP_FIELD_DESCRIPTION,
- $conf->global->LDAP_FIELD_SID
+ getDolGlobalString('LDAP_KEY_USERS'),
+ getDolGlobalString('LDAP_FIELD_FULLNAME'),
+ getDolGlobalString('LDAP_FIELD_NAME'),
+ getDolGlobalString('LDAP_FIELD_FIRSTNAME'),
+ getDolGlobalString('LDAP_FIELD_LOGIN'),
+ getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'),
+ getDolGlobalString('LDAP_FIELD_PASSWORD'),
+ getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED'),
+ getDolGlobalString('LDAP_FIELD_PHONE'),
+ getDolGlobalString('LDAP_FIELD_FAX'),
+ getDolGlobalString('LDAP_FIELD_SKYPE'),
+ getDolGlobalString('LDAP_FIELD_MOBILE'),
+ getDolGlobalString('LDAP_FIELD_MAIL'),
+ getDolGlobalString('LDAP_FIELD_TITLE'),
+ getDolGlobalString('LDAP_FIELD_DESCRIPTION'),
+ getDolGlobalString('LDAP_FIELD_SID')
);
// Remove from required_fields all entries not configured in LDAP (empty) and duplicated
$required_fields = array_unique(array_values(array_filter($required_fields, "dol_validElement")));
// Get from LDAP database an array of results
- $ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
+ $ldapusers = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 1);
//$ldapusers = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, '', 1);
if (is_array($ldapusers)) {
@@ -523,8 +523,8 @@ if (function_exists("ldap_connect")) {
print " \n";
print "LDAP search for user: \n";
print "search: * \n";
- print "userDN: ".$conf->global->LDAP_USER_DN." \n";
- print "useridentifier: ".$conf->global->LDAP_KEY_USERS." \n";
+ print "userDN: ".getDolGlobalString('LDAP_USER_DN')." \n";
+ print "useridentifier: ".getDolGlobalString('LDAP_KEY_USERS')." \n";
print "required_fields: ".implode(',', $required_fields)." \n";
print "=> ".count($liste)." records \n";
print "\n ";
diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php
index 6246f9c09c3..74c46112241 100644
--- a/htdocs/admin/limits.php
+++ b/htdocs/admin/limits.php
@@ -237,7 +237,7 @@ if (empty($mysoc->country_code)) {
$sql = "SELECT taux as vat_rate, t.code as vat_code, t.localtax1 as localtax_rate1, t.localtax2 as localtax_rate2";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
- $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <>0 OR t.localtax2 <>0)";
+ $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$db->escape($mysoc->country_code)."' AND (t.taux <> 0 OR t.localtax1 <> '0' OR t.localtax2 <> '0')";
$sql .= " ORDER BY t.taux ASC";
$resql = $db->query($sql);
if ($resql) {
diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php
index 1283c5698d3..d60b4e4ddc6 100644
--- a/htdocs/admin/mails.php
+++ b/htdocs/admin/mails.php
@@ -848,8 +848,22 @@ if ($action == 'edit') {
$text .= ($text ? ' ' : '').''.$langs->trans("WarningPHPMailSPF", $conf->global->MAIN_EXTERNAL_SMTP_SPF_STRING_TO_ADD);
}
}
-
-
+ $companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL');
+ $dnsinfo = false;
+ if (!empty($companyemail) && function_exists('dns_get_record')) {
+ $arrayofemailparts = explode('@', $companyemail);
+ if (count($arrayofemailparts) == 2) {
+ $domain = $arrayofemailparts[1];
+ $dnsinfo = dns_get_record($domain, DNS_TXT);
+ }
+ }
+ if (!empty($dnsinfo) && is_array($dnsinfo)) {
+ foreach ($dnsinfo as $info) {
+ if (strpos($info['txt'], 'v=spf') !== false) {
+ $text .= ($text ? ' ' : '').$langs->trans("ActualMailSPFRecordFound", $info['txt']);
+ }
+ }
+ }
if ($text) {
print info_admin($text);
}
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 9c2b91ec586..2cbb14bb2dd 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -542,7 +542,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
$moreforfilter .= '';
$moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth200', 1);
$moreforfilter .= '
';
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
$array_version['deprecated'] = $langs->trans("Deprecated");
diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php
index 207642fe8e3..88a02e90457 100644
--- a/htdocs/admin/prelevement.php
+++ b/htdocs/admin/prelevement.php
@@ -297,7 +297,7 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db);
$modulequalified=1;
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified) {
diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php
index 06ae59d64a3..ebd1269f74a 100644
--- a/htdocs/admin/resource.php
+++ b/htdocs/admin/resource.php
@@ -100,7 +100,7 @@ if (empty($conf->use_javascript_ajax)) {
print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT", $arrval, $conf->global->RESOURCE_USE_SEARCH_TO_SELECT);
print '';
print '';
- print ' ';
+ print ' ';
print ' ';
}
print '';
@@ -108,7 +108,7 @@ print '';
print '';
print ''.$langs->trans('DisabledResourceLinkUser').' ';
-print '';
+print ' ';
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER');
print ' ';
print ' ';
@@ -117,7 +117,7 @@ print ' ';
print '';
print ''.$langs->trans('DisabledResourceLinkContact').' ';
-print '';
+print ' ';
echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY');
print ' ';
print ' ';
@@ -126,7 +126,7 @@ print ' ';
print '';
print ''.$langs->trans('EnableResourceUsedInEventCheck').' ';
-print '';
+print ' ';
echo ajax_constantonoff('RESOURCE_USED_IN_EVENT_CHECK');
print ' ';
print ' ';
diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php
index 5c9b863ba32..e8f59727c07 100644
--- a/htdocs/admin/stock.php
+++ b/htdocs/admin/stock.php
@@ -683,6 +683,8 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("SOCIETE_ASK_FOR_WAREHOUSE", $arrval, $conf->global->SOCIETE_ASK_FOR_WAREHOUSE);
}
+print "";
+print " \n";
print '';
print ''.$langs->trans("WarehouseAskWarehouseDuringPropal").' ';
@@ -693,6 +695,9 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL);
}
+print "";
+print " \n";
+
print '';
print ''.$langs->trans("WarehouseAskWarehouseDuringOrder").' ';
print '';
@@ -702,10 +707,23 @@ if ($conf->use_javascript_ajax) {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER);
}
-print " ";
print '';
print " \n";
+/*
+print '';
+print ''.$langs->trans("WarehouseAskWarehouseDuringProject").' ';
+print '';
+if ($conf->use_javascript_ajax) {
+ print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT');
+} else {
+ $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
+ print $form->selectarray("WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT", $arrval, $conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT);
+}
+print ' ';
+print " \n";
+*/
+
print '';
print '';
print $form->textwithpicto($langs->trans("StockSupportServices"), $langs->trans("StockSupportServicesDesc"));
diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php
index 10b3d1bd47b..2f272cd986f 100644
--- a/htdocs/admin/syslog.php
+++ b/htdocs/admin/syslog.php
@@ -187,8 +187,6 @@ if (!empty($conf->global->MAIN_MODULE_MULTICOMPANY) && $user->entity) {
}
-//print "conf->global->MAIN_FEATURES_LEVEL = ".$conf->global->MAIN_FEATURES_LEVEL." \n";
-
// Output mode
print load_fiche_titre($langs->trans("SyslogOutput"), '', '');
@@ -207,7 +205,7 @@ foreach ($syslogModules as $moduleName) {
$moduleactive = (int) $module->isActive();
//print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)." \n";
- if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) {
+ if (($moduleactive == -1) && getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0) {
continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them)
}
diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php
index f07623ed5d0..e9a6eaeb390 100644
--- a/htdocs/admin/translation.php
+++ b/htdocs/admin/translation.php
@@ -556,7 +556,7 @@ if ($mode == 'searchkey') {
print ''.img_edit_add($langs->trans("TranslationOverwriteKey")).' ';
}
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
$transifexlangfile = '$'; // $ means 'All'
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php
index 289916a07c2..2637262a5e1 100644
--- a/htdocs/bookmarks/card.php
+++ b/htdocs/bookmarks/card.php
@@ -169,7 +169,11 @@ if ($action == 'create') {
// Target
print ' '.$langs->trans("BehaviourOnClick").' ';
$liste = array(0=>$langs->trans("ReplaceWindow"), 1=>$langs->trans("OpenANewWindow"));
- print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : 1, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
+ $defaulttarget = 1;
+ if ($url && !preg_match('/^http/i', $url)) {
+ $defaulttarget = 0;
+ }
+ print $form->selectarray('target', $liste, GETPOSTISSET('target') ? GETPOST('target', 'int') : $defaulttarget, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
print ' '.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").' ';
// Owner
diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php
index 8a5de8f4d91..642fc4995a9 100644
--- a/htdocs/bookmarks/list.php
+++ b/htdocs/bookmarks/list.php
@@ -62,9 +62,9 @@ $id = GETPOST("id", 'int');
$object = new Bookmark($db);
-$permissiontoread = $user->rights->bookmark->lire;
-$permissiontoadd = $user->rights->bookmark->write;
-$permissiontodelete = $user->rights->bookmark->delete;
+$permissiontoread = !empty($user->rights->bookmark->lire);
+$permissiontoadd = !empty($user->rights->bookmark->creer);
+$permissiontodelete = !empty($user->rights->bookmark->supprimer);
/*
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index e6a94b21701..9a449d63700 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1976,6 +1976,12 @@ class Categorie extends CommonObject
if ($type == 'bank_account') {
$type = 'account';
}
+ if ($type == 'customer') {
+ $type = 'societe';
+ }
+ if ($type == 'supplier') {
+ $type = 'fournisseur';
+ }
if (empty($searchList) && !is_array($searchList)) {
return "";
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 9231e215b7f..5912d63c7cf 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -795,7 +795,7 @@ if ($type == Categorie::TYPE_CONTACT) {
$permission = $user->rights->societe->creer;
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
- if ($contacts < 0) {
+ if (is_numeric($contacts) && $contacts < 0) {
dol_print_error($db, $object->error, $object->errors);
} else {
// Form to add record into a category
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 91ae4345214..74c7a6d272f 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1474,7 +1474,7 @@ if ($id > 0) {
print ' ';
print ' ';
if ($backtopage) {
- print ' ';
+ print ' ';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
print ' ';
@@ -2210,7 +2210,7 @@ if ($id > 0) {
$delallowed = $user->rights->agenda->myactions->create;
- print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang);
+ print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang());
print '';
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index 985a403b086..7ece3fdcb28 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -4,7 +4,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2017 Open-DSI
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2020 Tobias Sekan
*
* This program is free software; you can redistribute it and/or modify
@@ -629,14 +629,17 @@ print $nav;
$s = $newtitle;
// Calendars from hooks
-$parameters = array(); $object = null;
+$parameters = array();
+$object = null;
$reshook = $hookmanager->executeHooks('addCalendarChoice', $parameters, $object, $action);
if (empty($reshook)) {
$s .= $hookmanager->resPrint;
} elseif ($reshook > 1) {
$s = $hookmanager->resPrint;
}
-
+$viewyear = is_object($object) ? dol_print_date($object->datep, '%Y') : '';
+$viewmonth = is_object($object) ? dol_print_date($object->datep, '%m') : '';
+$viewday = is_object($object) ? dol_print_date($object->datep, '%d') : '';
$viewmode = '';
$viewmode .= '';
//$viewmode .= '';
@@ -644,25 +647,25 @@ $viewmode .= img_picto($langs->trans("List"), 'object_list', 'class="imgforviewm
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewList").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewCal").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewWeek").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview block"');
//$viewmode .= ' ';
$viewmode .= ''.$langs->trans("ViewDay").' ';
-$viewmode .= '';
+$viewmode .= ' ';
//$viewmode .= '';
$viewmode .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview block"');
//$viewmode .= ' ';
@@ -671,7 +674,8 @@ $viewmode .= ' ';
// Add more views from hooks
-$parameters = array(); $object = null;
+$parameters = array();
+$object = null;
$reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action);
if (empty($reshook)) {
$viewmode .= $hookmanager->resPrint;
@@ -681,7 +685,7 @@ if (empty($reshook)) {
$tmpforcreatebutton = dol_getdate(dol_now(), true);
-$newparam .= '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
+$newparam = '&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
//$param='month='.$monthshown.'&year='.$year;
$hourminsec = '100000';
diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php
index 7cdb056c595..6b5c262fe6a 100644
--- a/htdocs/comm/action/pertype.php
+++ b/htdocs/comm/action/pertype.php
@@ -377,7 +377,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) {
$s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
- $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s .= '});'."\n";
$s .= ''."\n";
diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php
index 060b4f8d7d1..de9c979c0fb 100644
--- a/htdocs/comm/action/peruser.php
+++ b/htdocs/comm/action/peruser.php
@@ -387,7 +387,6 @@ if ($conf->use_javascript_ajax) {
$s .= 'jQuery(".family_birthday").toggle();'."\n";
if ($action == "show_week" || $action == "show_month" || empty($action)) {
$s .= 'jQuery( "td.sortable" ).sortable({connectWith: ".sortable",placeholder: "ui-state-highlight",items: "div:not(.unsortable)", receive: function( event, ui ) {';
- $s .= 'var frm=jQuery("#move_event");frm.attr("action",ui.item.find("a.cal_event").attr("href")).children("#newdate").val(jQuery(event.target).closest("div").attr("id"));frm.submit();}});'."\n";
}
$s .= '});'."\n";
$s .= ''."\n";
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index c301e054e96..896448d7b9a 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2014,15 +2014,15 @@ if ($action == 'create') {
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
- $morehtmlref .= ' '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
+ $morehtmlref .= ''.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
$morehtmlref .= ' ( '.$langs->trans("OtherProposals").' )';
}
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
- $morehtmlref .= ' '.$langs->trans('Project').' ';
- if (!$usercancreate) {
+ $morehtmlref .= ''.$langs->trans('Project').' ';
+ if ($usercancreate) {
if ($action != 'classify') {
$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : ';
}
@@ -2041,7 +2041,7 @@ if ($action == 'create') {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
- $morehtmlref .= ' : '.$proj->getNomUrl(1);
+ $morehtmlref .= ': '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}
@@ -2679,7 +2679,7 @@ if ($action == 'create') {
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
// Show online signature link
- $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
+ $useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
print ' ';
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 3535ae0cde1..1ccbd22d511 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -1383,10 +1383,24 @@ if ($resql) {
if (!empty($arrayfields['sale_representative']['checked'])) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
+ $totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 'p.total_ht' => 0,
+ 'p.total_tva' => 0,
+ 'p.total_ttc' => 0,
+ ),
+ );
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array(
+ 'arrayfields' => $arrayfields,
+ 'param' => $param,
+ 'sortfield' => $sortfield,
+ 'sortorder' => $sortorder,
+ 'totalarray' => &$totalarray,
+ );
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['p.datec']['checked'])) {
@@ -1412,12 +1426,6 @@ if ($resql) {
$now = dol_now();
$i = 0;
- $totalarray = array();
- $totalarray['nbfield'] = 0;
- $totalarray['val'] = array();
- $totalarray['val']['p.total_ht'] = 0;
- $totalarray['val']['p.total_tva'] = 0;
- $totalarray['val']['p.total_ttc'] = 0;
$typenArray = null;
while ($i < min($num, $limit)) {
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 503c125b59c..b0685b8b64b 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1345,10 +1345,25 @@ if ($resql) {
print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder);
}
+ $totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 'c.total_ht' => 0,
+ 'c.total_tva' => 0,
+ 'c.total_ttc' => 0,
+ ),
+ 'pos' => array(),
+ );
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
- $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+ $parameters = array(
+ 'arrayfields' => $arrayfields,
+ 'param' => $param,
+ 'sortfield' => $sortfield,
+ 'sortorder' => $sortorder,
+ 'totalarray' => &$totalarray,
+ );
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['c.datec']['checked'])) {
@@ -1388,7 +1403,6 @@ if ($resql) {
$generic_product = new Product($db);
$userstatic = new User($db);
$i = 0;
- $totalarray = array('nbfield' => 0, 'val' => array(), 'pos' => array());
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php
index eabe47e54ca..8628e287bd0 100644
--- a/htdocs/compta/bank/bankentries_list.php
+++ b/htdocs/compta/bank/bankentries_list.php
@@ -8,7 +8,7 @@
* Copyright (C) 2016 Juanjo Menent
* Copyright (C) 2017-2019 Alexandre Spangaro
* Copyright (C) 2018 Ferran Marcet
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2021 Gauthier VERDOL
*
* This program is free software; you can redistribute it and/or modify
@@ -64,11 +64,12 @@ $action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$contextpage = 'banktransactionlist'.(empty($object->ref) ? '' : '-'.$object->id);
+$massaction = GETPOST('massaction', 'alpha');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
-if ($fielvalue) {
+if ($fieldvalue) {
if ($user->socid) {
$socid = $user->socid;
}
@@ -97,6 +98,8 @@ $search_thirdparty_user = GETPOST("search_thirdparty", 'alpha') ?GETPOST("search
$search_req_nb = GETPOST("req_nb", 'alpha');
$search_num_releve = GETPOST("search_num_releve", 'alpha');
$search_conciliated = GETPOST("search_conciliated", 'int');
+$optioncss = GETPOST('optioncss', 'alpha');
+$toselect = GETPOST('toselect', 'array');
$num_releve = GETPOST("num_releve", "alpha");
if (empty($dateop)) {
$dateop = -1;
@@ -211,6 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = '';
$search_num_releve = '';
$search_conciliated = '';
+ $toselect = '';
$search_account = "";
if ($id > 0 || !empty($ref)) {
@@ -221,14 +225,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
if (empty($reshook)) {
$objectclass = 'Account';
$objectlabel = 'BankTransaction';
- $permissiontoread = $user->rights->banque->lire;
- $permissiontodelete = $user->rights->banque->supprimer;
+ $permissiontoread = !empty($user->rights->banque->lire);
+ $permissiontodelete = !empty($user->rights->banque->modifier);
$uploaddir = $conf->bank->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
// Conciliation
-if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && $user->rights->banque->consolidate
+if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha')) && !empty($user->rights->banque->consolidate)
&& (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) {
$error = 0;
@@ -310,7 +314,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
}
-if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) {
+if (GETPOST('save') && !$cancel && !empty($user->rights->banque->modifier)) {
$error = 0;
if (price2num(GETPOST("addcredit")) > 0) {
@@ -370,7 +374,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) {
}
}
-if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier) {
+if ($action == 'confirm_delete' && $confirm == 'yes' && !empty($user->rights->banque->modifier)) {
$accline = new AccountLine($db);
$result = $accline->fetch(GETPOST("rowid", "int"));
$result = $accline->delete($user);
@@ -484,6 +488,11 @@ if ($optioncss != '') {
if ($action == 'reconcile') {
$param .= '&action=reconcile';
}
+$totalarray = array(
+ 'nbfield' => 0,
+ 'totalcred' => 0,
+ 'totaldeb' => 0,
+);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@@ -574,7 +583,7 @@ if ($search_bid > 0) {
}
$sql .= " ".MAIN_DB_PREFIX."bank_account as ba,";
$sql .= " ".MAIN_DB_PREFIX."bank as b";
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (b.rowid = ef.fk_object)";
}
$sql .= " WHERE b.fk_account = ba.rowid";
@@ -732,7 +741,7 @@ $resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
- $arrayofselected = is_array($toselect) ? $toselect : array();
+ $arrayofselected = (!empty($toselect) && is_array($toselect)) ? $toselect : array();
// List of mass actions available
$arrayofmassactions = array(
@@ -759,7 +768,9 @@ if ($resql) {
print ' ';
print ' ';
print ' ';
- print ' ';
+ if (!empty($view)) {
+ print ' ';
+ }
print ' ';
print ' ';
print ' ';
@@ -833,7 +844,7 @@ if ($resql) {
}
// Form to add a transaction with no invoice
- if ($user->rights->banque->modifier && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
+ if (!empty($user->rights->banque->modifier) && $action == 'addline' && !empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) {
print load_fiche_titre($langs->trans("AddBankRecordLong"), '', '');
print '';
@@ -939,6 +950,7 @@ if ($resql) {
}
}
+ $morehtml = '';
/*$morehtml = '';
$morehtml .= '
'.$langs->trans("Page")." "; // ' Page ';
$morehtml .= '
';
@@ -1050,7 +1062,7 @@ if ($resql) {
print '
';
}
if (!empty($arrayfields['bu.label']['checked'])) {
- print '
';
+ print '
';
}
if (!empty($arrayfields['ba.ref']['checked'])) {
print '
';
@@ -1160,7 +1172,6 @@ if ($resql) {
// Loop on each record
$sign = 1;
- $totalarray = array();
while ($i < min($num, $limit)) {
$objp = $db->fetch_object($resql);
$links = $bankaccountstatic->get_url($objp->rowid);
@@ -1296,18 +1307,10 @@ if ($resql) {
$backgroundcolor = "class='oddeven'";
} else {
if ($objp->amount < 0) {
- if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR1)) {
- $color = '#fca955';
- } else {
- $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR1;
- }
+ $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR1', 'fca955');
$backgroundcolor = 'style="background: '.$color.';"';
} else {
- if (empty($conf->global->BANK_COLORIZE_MOVEMENT_COLOR2)) {
- $color = '#7fdb86';
- } else {
- $color = '#'.$conf->global->BANK_COLORIZE_MOVEMENT_COLOR2;
- }
+ $color = '#' . getDolGlobalString('BANK_COLORIZE_MOVEMENT_COLOR2', '7fdb86');
$backgroundcolor = 'style="background: '.$color.';"';
}
}
@@ -1333,7 +1336,7 @@ if ($resql) {
$titletoshow = '';
$reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction
- if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) {
+ if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
$labeltoshow = $langs->trans($reg[1]);
} else {
if ($objp->label == '(payment_salary)') {
@@ -1357,6 +1360,7 @@ if ($resql) {
} elseif ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment
+ $paymentstatic->date = $db->jdate($objp->do);
print ' '.$paymentstatic->getNomUrl(2);
} elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php
index 5567678c366..f86c50f31cc 100644
--- a/htdocs/compta/bank/line.php
+++ b/htdocs/compta/bank/line.php
@@ -63,6 +63,7 @@ $cancel = GETPOST('cancel', 'alpha');
// Security check
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
+$socid = 0;
if ($user->socid) {
$socid = $user->socid;
}
@@ -568,6 +569,12 @@ if ($result) {
// Bank line
print ' '.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).' ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
+ $arrayselected = array();
+ $c = new Categorie($db);
+ $cats = $c->containing($bankline->id, Categorie::TYPE_BANK_LINE);
+ foreach ($cats as $cat) {
+ $arrayselected[] = $cat->id;
+ }
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print " ";
}
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 0d777980325..509ab85634d 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -2846,15 +2846,6 @@ if (empty($reshook)) {
* View
*/
-if (empty($object->id)) {
- llxHeader();
- $head = facture_prepare_head($object);
- $langs->load('errors');
- echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
- '
' . $langs->trans("ErrorRecordNotFound") . '
';
- llxFooter();
- exit;
-}
$form = new Form($db);
$formother = new FormOther($db);
@@ -3828,8 +3819,16 @@ if ($action == 'create') {
print '
';
}
- print '';
+ print "\n";
} elseif ($id > 0 || !empty($ref)) {
+ if (empty($object->id)) {
+ llxHeader();
+ $langs->load('errors');
+ echo ''.$langs->trans("ErrorRecordNotFound").'
';
+ llxFooter();
+ exit;
+ }
+
/*
* Show object in view mode
*/
@@ -4092,10 +4091,10 @@ if ($action == 'create') {
}
// Confirmation du classement paye
- if ($action == 'paid' && $resteapayer <= 0) {
+ if ($action == 'paid' && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $resteapayer == $object->total_ttc))) {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?facid='.$object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidBill', $object->ref), 'confirm_paid', '', "yes", 1);
}
- if ($action == 'paid' && $resteapayer > 0) {
+ if ($action == 'paid' && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc)) {
$close = array();
// Code
$i = 0;
@@ -5451,14 +5450,17 @@ if ($action == 'create') {
}
// Classify paid
- if (($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && $resteapayer <= 0) || ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0)))
- || ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $usercanissuepayment && empty($discount->id))
+ if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (
+ ($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) ||
+ ($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
+ ($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer)))
+ )
) {
print ''.$langs->trans('ClassifyPaid').' ';
}
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
- if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && $usercanissuepayment) {
+ if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $resteapayer > 0 && (empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) || $resteapayer != $object->total_ttc) && $usercanissuepayment) {
if ($totalpaye > 0 || $totalcreditnotes > 0) {
// If one payment or one credit note was linked to this invoice
print ''.$langs->trans('ClassifyPaidPartially').' ';
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index c921a9f51b2..6354c0bf5fd 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -102,10 +102,8 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
if (empty($object->id)) {
llxHeader();
- $head = facture_prepare_head($object);
$langs->load('errors');
- echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
- '' . $langs->trans("ErrorRecordNotFound") . '
';
+ echo ''.$langs->trans("ErrorRecordNotFound").'
';
llxFooter();
exit;
}
diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php
index 094a3acf859..89a67e75cb7 100644
--- a/htdocs/compta/facture/document.php
+++ b/htdocs/compta/facture/document.php
@@ -94,10 +94,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
if (empty($object->id)) {
llxHeader();
- $head = facture_prepare_head($object);
$langs->load('errors');
- echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
- '' . $langs->trans("ErrorRecordNotFound") . '
';
+ echo ''.$langs->trans("ErrorRecordNotFound").'
';
llxFooter();
exit;
}
diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php
index b721d958f36..f8dd1418000 100644
--- a/htdocs/compta/facture/info.php
+++ b/htdocs/compta/facture/info.php
@@ -64,10 +64,8 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
if (empty($object->id)) {
llxHeader();
- $head = facture_prepare_head($object);
$langs->load('errors');
- echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
- '' . $langs->trans("ErrorRecordNotFound") . '
';
+ echo ''.$langs->trans("ErrorRecordNotFound").'
';
llxFooter();
exit;
}
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 84ad5bd0f31..52b2fcceee0 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -676,12 +676,6 @@ if (strlen(trim($search_country))) {
if ($search_type_thirdparty != '' && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
}
-if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
-}
-if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
-}
if ($search_montant_ht != '') {
$sql .= natural_search('f.total_ht', $search_montant_ht, 1);
}
diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php
index f67e72ad92c..6f699774d32 100644
--- a/htdocs/compta/facture/note.php
+++ b/htdocs/compta/facture/note.php
@@ -79,10 +79,8 @@ if (empty($reshook)) {
if (empty($object->id)) {
llxHeader();
- $head = facture_prepare_head($object);
$langs->load('errors');
- echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
- '' . $langs->trans("ErrorRecordNotFound") . '
';
+ echo ''.$langs->trans("ErrorRecordNotFound").'
';
llxFooter();
exit;
}
diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php
index 9b235926421..33e14407dd6 100644
--- a/htdocs/compta/paiement/cheque/card.php
+++ b/htdocs/compta/paiement/cheque/card.php
@@ -5,7 +5,7 @@
* Copyright (C) 2011-2016 Juanjo Menent
* Copyright (C) 2013 Philippe Grand
* Copyright (C) 2015-2016 Alexandre Spangaro
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018-2021 Frédéric France
*
* 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
@@ -388,7 +388,7 @@ if ($action == 'new') {
$i = 0;
while ($obj = $db->fetch_object($resql)) {
$accounts[$obj->bid] = $obj->label;
- $lines[$obj->bid][$i]["date"] = $db->jdate($obj->date);
+ $lines[$obj->bid][$i]["date"] = $db->jdate($obj->datec);
$lines[$obj->bid][$i]["amount"] = $obj->amount;
$lines[$obj->bid][$i]["emetteur"] = $obj->emetteur;
$lines[$obj->bid][$i]["numero"] = $obj->num_chq;
@@ -398,6 +398,7 @@ if ($action == 'new') {
$lines[$obj->bid][$i]["label"] = $obj->transactionlabel;
$lines[$obj->bid][$i]["paymentid"] = $obj->paymentid;
$lines[$obj->bid][$i]["paymentref"] = $obj->paymentref;
+ $lines[$obj->bid][$i]["paymentdate"] = $db->jdate($obj->date);
$i++;
}
@@ -468,6 +469,7 @@ if ($action == 'new') {
print '';
$paymentstatic->id = $value["paymentid"];
$paymentstatic->ref = $value["paymentref"];
+ $paymentstatic->date = $value["paymentdate"];
if ($paymentstatic->id) {
print $paymentstatic->getNomUrl(1);
} else {
diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php
index 8babb849e7e..d29aab0386b 100644
--- a/htdocs/contact/ldap.php
+++ b/htdocs/contact/ldap.php
@@ -182,7 +182,6 @@ if ($result > 0) {
}
$ldap->unbind();
- $ldap->close();
} else {
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 82a2161f89f..82c26b559d2 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -1031,6 +1031,7 @@ print "\n";
$i = 0;
$totalarray = array();
+$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index cee0faf95aa..0cfa0b2bf16 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -492,7 +492,7 @@ $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$url = DOL_URL_ROOT.'/contrat/card.php?action=create';
if (!empty($socid)) {
- $url .= '&socid='.$socid;
+ $url .= '&socid='.((int) $socid);
}
$newcardbutton = dolGetButtonTitle($langs->trans('NewContractSubscription'), '', 'fa fa-plus-circle', $url, '', $user->rights->contrat->creer);
@@ -600,11 +600,11 @@ if (!empty($arrayfields['s.email']['checked'])) {
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
- print ' ';
+ print ' ';
}
// Zip
if (!empty($arrayfields['s.zip']['checked'])) {
- print ' ';
+ print ' ';
}
// State
if (!empty($arrayfields['state.nom']['checked'])) {
@@ -795,11 +795,12 @@ while ($i < min($num, $limit)) {
print '';
}
+ // Ref thirdparty
if (!empty($arrayfields['c.ref_customer']['checked'])) {
- print ''.$contracttmp->getFormatedCustomerRef($obj->ref_customer).' ';
+ print ''.$contracttmp->getFormatedCustomerRef($obj->ref_customer).' ';
}
if (!empty($arrayfields['c.ref_supplier']['checked'])) {
- print ''.$obj->ref_supplier.' ';
+ print ''.dol_escape_htmltag($obj->ref_supplier).' ';
}
if (!empty($arrayfields['s.nom']['checked'])) {
print '';
@@ -810,7 +811,7 @@ while ($i < min($num, $limit)) {
print ' ';
}
if (!empty($arrayfields['s.email']['checked'])) {
- print ''.$obj->email.' ';
+ print ''.dol_print_email($obj->email).' ';
}
// Town
if (!empty($arrayfields['s.town']['checked'])) {
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php
index 6fd84f4eda3..10d25b2aa09 100644
--- a/htdocs/core/actions_addupdatedelete.inc.php
+++ b/htdocs/core/actions_addupdatedelete.inc.php
@@ -110,7 +110,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
}
// Validation of fields values
- if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
if (!$object->validateField($object->fields, $key, $value)) {
$error++;
@@ -226,7 +226,7 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
// Validation of fields values
- if ($conf->global->MAIN_FEATURE_LEVEL >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->MAIN_ACTIVATE_VALIDATION_RESULT)) {
if (!$error && !empty($val['validate']) && is_callable(array($object, 'validateField'))) {
if (!$object->validateField($object->fields, $key, $value)) {
$error++;
diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php
index 00bfe865aaa..8ccff0eb017 100644
--- a/htdocs/core/actions_massactions.inc.php
+++ b/htdocs/core/actions_massactions.inc.php
@@ -1556,6 +1556,7 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
}
}
+// Approve for leave only
if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $confirm == 'yes')) && $permissiontoapprove) {
$db->begin();
diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php
index 52cc23faf8f..0b1106ca20a 100644
--- a/htdocs/core/ajax/row.php
+++ b/htdocs/core/ajax/row.php
@@ -99,7 +99,7 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3)
$perm = 1;
} elseif ($table_element_line == 'ecm_files' && $fk_element == 'fk_ticket' && !empty($user->rights->ticket->write)) {
$perm = 1;
- } elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && !empty($user->rights->produit->creer)) {
+ } elseif ($table_element_line == 'product_association' && $fk_element == 'fk_product' && (!empty($user->rights->produit->creer) || !empty($user->rights->service->creer))) {
$perm = 1;
} elseif ($table_element_line == 'projet_task' && $fk_element == 'fk_projet' && $user->rights->projet->creer) {
$perm = 1;
diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php
index af2ba15829c..46c4b38988e 100644
--- a/htdocs/core/bookmarks_page.php
+++ b/htdocs/core/bookmarks_page.php
@@ -20,7 +20,7 @@
/**
* \file htdocs/core/bookmarks_page.php
- * \brief File to return a page with the complete list of bookmarks (all search input fields)
+ * \brief File to return a page with the complete list of bookmarks
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
@@ -45,7 +45,7 @@ if (GETPOST('lang', 'aZ09')) {
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
}
-$langs->load("main");
+$langs->loadLangs(array("bookmarks"));
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
@@ -57,7 +57,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$title = $langs->trans("Bookmarks");
-// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
+// URL http://mydolibarr/core/bookmarks_page?dol_use_jmobile=1 can be used for tests
$head = ''."\n";
$arrayofjs = array();
$arrayofcss = array();
@@ -69,8 +69,6 @@ print ''."\n";
print '';
//print '
';
-$nbofsearch = 0;
-
// Instantiate hooks of thirdparty module
$hookmanager->initHooks(array('bookmarks'));
@@ -78,32 +76,43 @@ $hookmanager->initHooks(array('bookmarks'));
$bookmarkList = '';
$searchForm = '';
-$arrayresult = array();
-//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
-
-
-// Menu with list of bookmarks
-$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
-$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
-$sql .= " AND entity IN (".getEntity('bookmarks').")";
-$sql .= " ORDER BY position";
-if ($resql = $db->query($sql)) {
- $bookmarkList = '
';
-
- $searchForm .= '
';
+if (empty($conf->bookmarks->enabled)) {
+ $langs->load("admin");
+ $bookmarkList .= '
'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).' ';
+ $bookmarkList .= '
';
} else {
- dol_print_error($db);
-}
+ // Menu with list of bookmarks
+ $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
+ $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
+ $sql .= " AND entity IN (".getEntity('bookmarks').")";
+ $sql .= " ORDER BY position";
+ if ($resql = $db->query($sql)) {
+ $bookmarkList = '
';
+
+
+ $searchForm .= '
';
+ } else {
+ dol_print_error($db);
+ }
+}
// Execute hook printBookmarks
$parameters = array('bookmarks'=>$bookmarkList);
diff --git a/htdocs/core/boxes/box_members_subscriptions_by_year.php b/htdocs/core/boxes/box_members_subscriptions_by_year.php
index fe64f37c805..73c71521603 100644
--- a/htdocs/core/boxes/box_members_subscriptions_by_year.php
+++ b/htdocs/core/boxes/box_members_subscriptions_by_year.php
@@ -111,7 +111,7 @@ class box_members_subscriptions_by_year extends ModeleBoxes
$i = 0;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
- $year = dol_print_date($this->db->jdate($objp->dateh), "%Y", 'gmt');
+ $year = dol_print_date($this->db->jdate($objp->dateh), "%Y");
$Total[$year] = (isset($Total[$year]) ? $Total[$year] : 0) + $objp->subscription;
$Number[$year] = (isset($Number[$year]) ? $Number[$year] : 0) + 1;
$tot += $objp->subscription;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 91446f38070..812353591ed 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -7874,11 +7874,6 @@ abstract class CommonObject
$out .= ($display_type=='card' ? '' : '
');
- /*for($ii = 0; $ii < ($colspan - 1); $ii++)
- {
- $out .='';
- }*/
-
if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) {
$out .= ($display_type=='card' ? '' : ' ');
} else {
@@ -8887,7 +8882,7 @@ abstract class CommonObject
$sql = "SELECT ".$objectline->getFieldList('l');
$sql .= " FROM ".MAIN_DB_PREFIX.$objectline->table_element." as l";
- $sql .= " WHERE l.fk_".$this->element." = ".((int) $this->id);
+ $sql .= " WHERE l.fk_".$this->db->escape($this->element)." = ".((int) $this->id);
if ($morewhere) {
$sql .= $morewhere;
}
diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php
index 45bc622b9db..ea8618c8b92 100644
--- a/htdocs/core/class/fileupload.class.php
+++ b/htdocs/core/class/fileupload.class.php
@@ -222,7 +222,7 @@ class FileUpload
protected function setFileDeleteUrl($file)
{
$file->delete_url = $this->options['script_url']
- .'?file='.rawurlencode($file->name).'&fk_element='.$this->fk_element.'&element='.$this->element;
+ .'?file='.urlencode($file->name).'&fk_element='.urlencode($this->fk_element).'&element='.urlencode($this->element);
$file->delete_type = $this->options['delete_type'];
if ($file->delete_type !== 'DELETE') {
$file->delete_url .= '&_method=DELETE';
diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php
index 40610ce5d6f..691c20e10f8 100644
--- a/htdocs/core/class/hookmanager.class.php
+++ b/htdocs/core/class/hookmanager.class.php
@@ -229,7 +229,8 @@ class HookManager
'showLinkToObjectBlock',
'setContentSecurityPolicy',
'setHtmlTitle',
- 'completeTabsHead'
+ 'completeTabsHead',
+ 'formDolBanner'
)
)) {
$hooktype = 'addreplace';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 98ba6ca3cc2..56f7c41994b 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5088,8 +5088,7 @@ class Form
if ($selected) {
$projet = new Project($this->db);
$projet->fetch($selected);
- //print ''.$projet->title.' ';
- $out .= $projet->getNomUrl(0, '', 1);
+ $out .= $projet->getNomUrl(1, '', 1);
} else {
$out .= " ";
}
diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php
index 13619fe5aa3..4196fb32b68 100644
--- a/htdocs/core/class/html.formadmin.class.php
+++ b/htdocs/core/class/html.formadmin.class.php
@@ -304,7 +304,7 @@ class FormAdmin
if (preg_match('/\.lib/i', $filelib)) {
continue;
}
- if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') == 0 && in_array($file, $expdevmenu)) {
continue;
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index ffa441c0527..6f0a79d9383 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1373,7 +1373,7 @@ class FormFile
}
// Preview link
if (!$editline) {
- print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
+ print $this->showPreview($file, $modulepart, $filepath, 0, 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
}
print "\n";
diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php
index 34ea7b0a2e8..022bf55f243 100644
--- a/htdocs/core/class/html.formprojet.class.php
+++ b/htdocs/core/class/html.formprojet.class.php
@@ -514,7 +514,17 @@ class FormProjets
}
$linkedtothirdparty = false;
- if (!in_array($table_element, array('don', 'expensereport_det', 'expensereport', 'loan', 'stock_mouvement', 'payment_salary', 'payment_various', 'chargesociales', 'entrepot'))) {
+ if (!in_array($table_element, array(
+ 'don',
+ 'expensereport_det',
+ 'expensereport', 'loan',
+ 'stock_mouvement',
+ 'payment_salary',
+ 'payment_various',
+ 'salary',
+ 'chargesociales',
+ 'entrepot')
+ )) {
$linkedtothirdparty = true;
}
diff --git a/htdocs/core/class/html.formpropal.class.php b/htdocs/core/class/html.formpropal.class.php
index b78ff5cfa8e..2773ece2569 100644
--- a/htdocs/core/class/html.formpropal.class.php
+++ b/htdocs/core/class/html.formpropal.class.php
@@ -104,6 +104,7 @@ class FormPropal
print ' ';
}
+ $i = 0;
foreach ($listofstatus as $key => $obj) {
if ($excludedraft) {
if ($obj['code'] == 'Draft' || $obj['code'] == 'PR_DRAFT') {
diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php
index b9f320b7db8..7e2154ee309 100644
--- a/htdocs/core/class/html.formticket.class.php
+++ b/htdocs/core/class/html.formticket.class.php
@@ -1,17 +1,18 @@
- * Copyright (C) 2016 Christophe Battarel
- * Copyright (C) 2019 Frédéric France
- * Copyright (C) 2021 Juanjo Menent
+/* Copyright (C) 2013-2015 Jean-François FERRY
+ * Copyright (C) 2016 Christophe Battarel
+ * Copyright (C) 2019 Frédéric France
+ * Copyright (C) 2021 Juanjo Menent
+ * Copyright (C) 2021 Alexandre Spangaro
*
* 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
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@@ -508,11 +509,13 @@ class FormTicket
print '';
}
- if (!empty($conf->projet->enabled) && !$this->ispublic) {
- $formproject = new FormProjets($this->db);
- print ''.$langs->trans("Project").' ';
- print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
- print ' ';
+ if ($subelement != 'project') {
+ if (!empty($conf->projet->enabled) && !$this->ispublic) {
+ $formproject = new FormProjets($this->db);
+ print ''.$langs->trans("Project").' ';
+ print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500');
+ print ' ';
+ }
}
// Other attributes
diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php
index adde51c4974..0cd34e13193 100644
--- a/htdocs/core/class/infobox.class.php
+++ b/htdocs/core/class/infobox.class.php
@@ -37,7 +37,7 @@ class InfoBox
{
global $conf;
- if (empty($conf->global->MAIN_FEATURES_LEVEL) || $conf->global->MAIN_FEATURES_LEVEL < 2) {
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
return array(
0 => 'Home',
1 => 'UsersHome',
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index e2ce33cc45f..4af22683b2c 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -1,8 +1,8 @@
* Copyright (C) 2004 Benoit Mortier
- * Copyright (C) 2005-2017 Regis Houssin
- * Copyright (C) 2006-2015 Laurent Destailleur
+ * Copyright (C) 2005-2021 Regis Houssin
+ * Copyright (C) 2006-2021 Laurent Destailleur
*
* 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
@@ -48,6 +48,11 @@ class Ldap
*/
public $server = array();
+ /**
+ * Current connected server
+ */
+ public $connectedServer;
+
/**
* Base DN (e.g. "dc=foo,dc=com")
*/
@@ -132,35 +137,33 @@ class Ldap
if (!empty($conf->global->LDAP_SERVER_HOST_SLAVE)) {
$this->server[] = $conf->global->LDAP_SERVER_HOST_SLAVE;
}
- $this->serverPort = $conf->global->LDAP_SERVER_PORT;
- $this->ldapProtocolVersion = $conf->global->LDAP_SERVER_PROTOCOLVERSION;
- $this->dn = $conf->global->LDAP_SERVER_DN;
- $this->serverType = $conf->global->LDAP_SERVER_TYPE;
+ $this->serverPort = getDolGlobalInt('LDAP_SERVER_PORT', 389);
+ $this->ldapProtocolVersion = getDolGlobalString('LDAP_SERVER_PROTOCOLVERSION');
+ $this->dn = getDolGlobalString('LDAP_SERVER_DN');
+ $this->serverType = getDolGlobalString('LDAP_SERVER_TYPE');
- $this->domain = $conf->global->LDAP_SERVER_DN;
- $this->searchUser = $conf->global->LDAP_ADMIN_DN;
- $this->searchPassword = $conf->global->LDAP_ADMIN_PASS;
- $this->people = $conf->global->LDAP_USER_DN;
- $this->groups = $conf->global->LDAP_GROUP_DN;
+ $this->domain = getDolGlobalString('LDAP_SERVER_DN');
+ $this->searchUser = getDolGlobalString('LDAP_ADMIN_DN');
+ $this->searchPassword = getDolGlobalString('LDAP_ADMIN_PASS');
+ $this->people = getDolGlobalString('LDAP_USER_DN');
+ $this->groups = getDolGlobalString('LDAP_GROUP_DN');
- $this->filter = $conf->global->LDAP_FILTER_CONNECTION; // Filter on user
- $this->filtergroup = $conf->global->LDAP_GROUP_FILTER; // Filter on groups
- $this->filtermember = $conf->global->LDAP_MEMBER_FILTER; // Filter on member
+ $this->filter = getDolGlobalString('LDAP_FILTER_CONNECTION'); // Filter on user
+ $this->filtergroup = getDolGlobalString('LDAP_GROUP_FILTER'); // Filter on groups
+ $this->filtermember = getDolGlobalString('LDAP_MEMBER_FILTER'); // Filter on member
// Users
- $this->attr_login = $conf->global->LDAP_FIELD_LOGIN; //unix
- $this->attr_sambalogin = $conf->global->LDAP_FIELD_LOGIN_SAMBA; //samba, activedirectory
- $this->attr_name = $conf->global->LDAP_FIELD_NAME;
- $this->attr_firstname = $conf->global->LDAP_FIELD_FIRSTNAME;
- $this->attr_mail = $conf->global->LDAP_FIELD_MAIL;
- $this->attr_phone = $conf->global->LDAP_FIELD_PHONE;
- $this->attr_skype = $conf->global->LDAP_FIELD_SKYPE;
- $this->attr_fax = $conf->global->LDAP_FIELD_FAX;
- $this->attr_mobile = $conf->global->LDAP_FIELD_MOBILE;
+ $this->attr_login = getDolGlobalString('LDAP_FIELD_LOGIN'); //unix
+ $this->attr_sambalogin = getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA'); //samba, activedirectory
+ $this->attr_name = getDolGlobalString('LDAP_FIELD_NAME');
+ $this->attr_firstname = getDolGlobalString('LDAP_FIELD_FIRSTNAME');
+ $this->attr_mail = getDolGlobalString('LDAP_FIELD_MAIL');
+ $this->attr_phone = getDolGlobalString('LDAP_FIELD_PHONE');
+ $this->attr_skype = getDolGlobalString('LDAP_FIELD_SKYPE');
+ $this->attr_fax = getDolGlobalString('LDAP_FIELD_FAX');
+ $this->attr_mobile = getDolGlobalString('LDAP_FIELD_MOBILE');
}
-
-
// Connection handling methods -------------------------------------------
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -178,6 +181,8 @@ class Ldap
$connected = 0;
$this->bind = 0;
+ $this->error = 0;
+ $this->connectedServer = '';
// Check parameters
if (count($this->server) == 0 || empty($this->server[0])) {
@@ -226,7 +231,7 @@ class Ldap
dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING);
$this->error = 'ldap_start_tls Failed to start TLS '.ldap_errno($this->connection).' '.ldap_error($this->connection);
$connected = 0;
- $this->close();
+ $this->unbind();
}
}
@@ -261,7 +266,7 @@ class Ldap
}
// Try in anonymous
if (!$this->bind) {
- dol_syslog(get_class($this)."::connect_bind try bind on ".$host, LOG_DEBUG);
+ dol_syslog(get_class($this)."::connect_bind try bind anonymously on ".$host, LOG_DEBUG);
$result = $this->bind();
if ($result) {
$this->bind = $this->result;
@@ -275,7 +280,9 @@ class Ldap
}
if (!$connected) {
- $this->close();
+ $this->unbind();
+ } else {
+ $this->connectedServer = $host;
}
}
}
@@ -288,16 +295,18 @@ class Ldap
$return = -1;
dol_syslog(get_class($this)."::connect_bind return=".$return.' - '.$this->error, LOG_WARNING);
}
+
return $return;
}
-
/**
- * Simply closes the connection set up earlier.
- * Returns true if OK, false if there was an error.
+ * Simply closes the connection set up earlier. Returns true if OK, false if there was an error.
+ * This method seems a duplicate/alias of unbind().
*
* @return boolean true or false
+ * @deprecated ldap_close is an alias of ldap_unbind
+ * @see unbind()
*/
public function close()
{
@@ -349,16 +358,21 @@ class Ldap
}
/**
- * Unbind du serveur ldap.
+ * Unbind of LDAP server (close connection).
*
* @return boolean true or false
+ * @see close()
*/
public function unbind()
{
- if (!$this->result = @ldap_unbind($this->connection)) {
- return false;
- } else {
+ $this->result = true;
+ if ($this->connection) {
+ $this->result = @ldap_unbind($this->connection);
+ }
+ if ($this->result) {
return true;
+ } else {
+ return false;
}
}
@@ -411,7 +425,7 @@ class Ldap
*/
public function add($dn, $info, $user)
{
- dol_syslog(get_class($this)."::add dn=".$dn." info=".join(',', $info));
+ dol_syslog(get_class($this)."::add dn=".$dn." info=".json_encode($info));
// Check parameters
if (!$this->connection) {
diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php
index c287aae1c2f..dbaaacc2d18 100644
--- a/htdocs/core/class/smtps.class.php
+++ b/htdocs/core/class/smtps.class.php
@@ -464,20 +464,26 @@ class SMTPs
$host = 'tls://'.$host;
}
- $hosth = $host;
+ $hosth = $host; // so for example 'localhost' or 'smtp-relay.gmail.com'
if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
- // If the from to is 'aaa ', we will keep 'ccc.com'
- $hosth = $this->getFrom('addr');
- $hosth = preg_replace('/^.*', '', $hosth);
- $hosth = preg_replace('/>.*$/', '', $hosth);
- $hosth = preg_replace('/.*@/', '', $hosth);
+ if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
+ // If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
+ $hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
+ } else {
+ // If value of MAIL_SMTP_USE_FROM_FOR_HELO is 1, we use the domain in the from.
+ // So if the from to is 'aaa ', we will keep 'ccc.com'
+ $hosth = $this->getFrom('addr');
+ $hosth = preg_replace('/^.*', '', $hosth);
+ $hosth = preg_replace('/>.*$/', '', $hosth);
+ $hosth = preg_replace('/.*@/', '', $hosth);
+ }
}
if ($_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
if ($usetls) {
/*
- The following dialog illustrates how a client and server can start a TLS STARTTLS session
+ The following dialog illustrates how a client and server can start a TLS STARTTLS session:
S:
C:
S: 220 mail.imc.org SMTP service ready
@@ -494,6 +500,39 @@ class SMTPs
S: 250-server-domain.com
S: 250 AUTH LOGIN
C:
+ S: 250 OK
+ C: RCPT TO:
+ S: 250 OK
+ C: DATA
+ S: 354 Send message, end with a "." on a line by itself
+ C:
+ S .
+ S: 250 OK, message accepted for delivery: queued as 12345
+ C: QUIT
+ S: 221 Bye
*/
if (!$_retVal = $this->socket_send_str('STARTTLS', 220)) {
$this->_setErr(131, 'STARTTLS connection is not supported.');
@@ -517,10 +556,10 @@ class SMTPs
$this->_setErr(132, 'STARTTLS connection failed.');
return $_retVal;
}
- // Most server servers expect a 2nd pass of EHLO after TLS is established to get another time
+ // Most servers expect a 2nd pass of EHLO after TLS is established to get another time
// the answer with list of supported AUTH methods. They may differs between non STARTTLS and with STARTTLS.
- if (!$_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
- $this->_setErr(126, '"'.$hosth.'" does not support authenticated connections.');
+ if (! $_retVal = $this->socket_send_str('EHLO '.$hosth, '250')) {
+ $this->_setErr(126, '"'.$hosth.'" does not support authenticated connections. Error after sending EHLO '.$hosth);
return $_retVal;
}
}
@@ -560,7 +599,7 @@ class SMTPs
$this->_setErr(130, 'Invalid Authentication Credentials.');
}
} else {
- $this->_setErr(126, '"'.$host.'" does not support authenticated connections.');
+ $this->_setErr(126, '"'.$host.'" does not support authenticated connections. Error after sending EHLO '.$hosth);
}
return $_retVal;
@@ -603,11 +642,17 @@ class SMTPs
$hosth = $host;
if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
- // If the from to is 'aaa ', we will keep 'ccc.com'
- $hosth = $this->getFrom('addr');
- $hosth = preg_replace('/^.*', '', $hosth);
- $hosth = preg_replace('/>.*$/', '', $hosth);
- $hosth = preg_replace('/.*@/', '', $hosth);
+ if (!is_numeric($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) {
+ // If value of MAIL_SMTP_USE_FROM_FOR_HELO is a string, we use it as domain name
+ $hosth = $conf->global->MAIL_SMTP_USE_FROM_FOR_HELO;
+ } else {
+ // If value of MAIL_SMTP_USE_FROM_FOR_HELO is 1, we use the domain in the from.
+ // If the from to is 'aaa ', we will keep 'ccc.com'
+ $hosth = $this->getFrom('addr');
+ $hosth = preg_replace('/^.*', '', $hosth);
+ $hosth = preg_replace('/>.*$/', '', $hosth);
+ $hosth = preg_replace('/.*@/', '', $hosth);
+ }
}
$_retVal = $this->socket_send_str('HELO '.$hosth, '250');
diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index b535d2b3585..e741adc84b5 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -589,7 +589,7 @@ class Translate
}
/* Disabled. There is too many cases where translation of $newstr is not defined is normal (like when output with setEventMessage an already translated string)
- if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2)
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2)
{
dol_syslog(__METHOD__." MAIN_FEATURES_LEVEL=DEVELOP: missing translation for key '".$newstr."' in ".$_SERVER["PHP_SELF"], LOG_DEBUG);
}*/
diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php
index 29ced10dc35..1aecd205da3 100644
--- a/htdocs/core/db/DoliDB.class.php
+++ b/htdocs/core/db/DoliDB.class.php
@@ -319,28 +319,34 @@ abstract class DoliDB implements Database
* Return first result from query as object
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
* Dont add LIMIT to your query, it will be added by this method
- * @param string $sql the sql query string
- * @return bool| object
- * @deprecated
+ *
+ * @param string $sql The sql query string
+ * @return bool|int|object False on failure, 0 on empty, object on success
*/
public function getRow($sql)
{
- $sql .= ' LIMIT 1;';
+ $sql .= ' LIMIT 1';
$res = $this->query($sql);
if ($res) {
- return $this->fetch_object($res);
+ $obj = $this->fetch_object($res);
+ if ($obj) {
+ return $obj;
+ } else {
+ return 0;
+ }
}
return false;
}
/**
- * return all results from query as an array of objects
+ * Return all results from query as an array of objects
* Note : This method executes a given SQL query and retrieves all row of results as an array of objects. It should only be used with SELECT queries
- * be carefull with this method use it only with some limit of results to avoid performences loss
- * @param string $sql the sql query string
- * @return bool| array
+ * be carefull with this method use it only with some limit of results to avoid performences loss.
+ *
+ * @param string $sql The sql query string
+ * @return bool|array Result
* @deprecated
*/
public function getRows($sql)
diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php
index 70dd0077e57..fc2210eabd8 100644
--- a/htdocs/core/extrafieldsinexport.inc.php
+++ b/htdocs/core/extrafieldsinexport.inc.php
@@ -48,7 +48,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
case 'sellist':
$tmp = '';
$tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null
- if ($tmpparam['options'] && is_array($tmpparam['options'])) {
+ if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys = array_keys($tmpparam['options']);
$tmp = array_shift($tmpkeys);
}
diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php
index 4927be6a005..ee21aac0de3 100644
--- a/htdocs/core/get_info.php
+++ b/htdocs/core/get_info.php
@@ -83,8 +83,8 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli .= " ".DOL_VERSION;
}
-if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
- $appli .= " ".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
+if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
+ $appli .= " ".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
}
$logouttext = '';
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index 30a3d21de90..554d435c471 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -4,6 +4,7 @@
* Copyright (C) 2015 Alexandre Spangaro
* Copyright (C) 2016 Juanjo Menent
* Copyright (C) 2019 Nicolas ZABOURI
+ * Copyright (C) 2021 Ferran Marcet
*
* 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
@@ -66,7 +67,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'graph';
$h++;
- if ($object->courant != Account::TYPE_CASH) {
+ if ($object->courant != Account::TYPE_CASH || !empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) {
$nbReceipts = 0;
// List of all standing receipts
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 084a4a4f25a..53ec09f943b 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -106,7 +106,11 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
*/
function getEntity($element, $shared = 1, $currentobject = null)
{
- global $conf, $mc, $hookmanager, $object, $action;
+ global $conf, $mc, $hookmanager, $object, $action, $db;
+
+ if (! is_object($hookmanager)) {
+ $hookmanager = new HookManager($db);
+ }
// fix different element names (France to English)
switch ($element) {
@@ -140,10 +144,10 @@ function getEntity($element, $shared = 1, $currentobject = null)
$reshook = $hookmanager->executeHooks('hookGetEntity', $parameters, $currentobject, $action); // Note that $action and $object may have been modified by some hooks
if (is_numeric($reshook)) {
- if ($reshook == 0 && !empty($hookmanager->resprints)) {
- $out .= ','.$hookmanager->resprints; // add
+ if ($reshook == 0 && !empty($hookmanager->resPrint)) {
+ $out .= ','.$hookmanager->resPrint; // add
} elseif ($reshook == 1) {
- $out = $hookmanager->resprints; // replace
+ $out = $hookmanager->resPrint; // replace
}
}
@@ -1841,7 +1845,7 @@ function dol_get_fiche_end($notab = 0)
*/
function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $onlybanner = 0, $morehtmlright = '')
{
- global $conf, $form, $user, $langs;
+ global $conf, $form, $user, $langs, $hookmanager, $action;
$error = 0;
@@ -2112,6 +2116,17 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$morehtmlref .= '';
}
+ $parameters=array('morehtmlref'=>$morehtmlref);
+ $reshook = $hookmanager->executeHooks('formDolBanner', $parameters, $object, $action);
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ } elseif (empty($reshook)) {
+ $morehtmlref .= $hookmanager->resPrint;
+ } elseif ($reshook > 0) {
+ $morehtmlref = $hookmanager->resPrint;
+ }
+
+
print '';
print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
print '
';
@@ -2289,6 +2304,11 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
{
global $conf, $langs;
+ // If date undefined or "", we return ""
+ if (dol_strlen($time) == 0) {
+ return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
+ }
+
if ($tzoutput === 'auto') {
$tzoutput = (empty($conf) ? 'tzserver' : (isset($conf->tzuserinputkey) ? $conf->tzuserinputkey : 'tzserver'));
}
@@ -2312,7 +2332,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$user_date_tz = new DateTimeZone($offsettzstring);
$user_dt = new DateTime();
$user_dt->setTimezone($user_date_tz);
- $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : $time);
+ $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time);
$offsettz = $user_dt->getOffset();
} else { // old method (The 'tzuser' was processed like the 'tzuserrel')
$offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
@@ -2380,11 +2400,6 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$format = str_replace('yyyy', 'yy', $format);
}
- // If date undefined or "", we return ""
- if (dol_strlen($time) == 0) {
- return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
- }
-
// Clean format
if (preg_match('/%b/i', $format)) { // There is some text to translate
// We inhibate translation to text made by strftime functions. We will use trans instead later.
@@ -2401,7 +2416,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
// Analyze date
$reg = array();
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
- dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
+ dol_print_error('', "Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
return '';
} elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date
// This part of code should not be used anymore.
@@ -3670,9 +3685,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
- 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
- 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
- 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
+ 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star',
+ 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter',
+ 'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
@@ -3682,7 +3697,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house',
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
- 'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
+ 'supplier'=>'building', 'technic'=>'cogs',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt',
'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card',
@@ -4473,7 +4488,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
$result = ($nodiv ? '' : '').' '.$text.($nodiv ? '' : '
');
if ($textfordropdown) {
- $tmpresult .= ''.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').' ';
+ $tmpresult = ''.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').' ';
$tmpresult .= ''."\n";
}
- /*if (! empty($conf->global->MAIN_FEATURES_LEVEL) && ! defined('JS_JQUERY_MIGRATE_DISABLED'))
- {
- if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print ''."\n";
- else print ''."\n";
- }*/
if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
print ''."\n";
} else {
@@ -1842,8 +1836,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
$appli .= " ".DOL_VERSION;
}
- if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
- $appli .= " ".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
+ if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
+ $appli .= " ".$langs->trans("LevelOfFeature").': '.getDolGlobalInt('MAIN_FEATURES_LEVEL');
}
$logouttext = '';
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index cab90270d64..1ab03743747 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -262,6 +262,7 @@ if ($dirins && $action == 'initmodule' && $modulename) {
// Delete some files related to Object (because the previous dolCopyDir has copied everything)
dol_delete_file($destdir.'/myobject_card.php');
+ dol_delete_file($destdir.'/myobject_contact.php');
dol_delete_file($destdir.'/myobject_note.php');
dol_delete_file($destdir.'/myobject_document.php');
dol_delete_file($destdir.'/myobject_agenda.php');
@@ -337,6 +338,14 @@ if ($dirins && $action == 'initmodule' && $modulename) {
setEventMessages('ModuleInitialized', null);
$module = $modulename;
$modulename = '';
+
+ clearstatcache(true);
+ if (function_exists('opcache_invalidate')) {
+ opcache_reset(); // remove the include cache hell !
+ }
+
+ header("Location: ".$_SERVER["PHP_SELF"].'?module='.$modulename);
+ exit;
}
}
@@ -953,7 +962,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if ($notnull) {
$string .= ", 'notnull'=>".$notnull;
}
- if ($fieldname == 'ref') {
+ if ($fieldname == 'ref' || $fieldname == 'code') {
$string .= ", 'showoncombobox'=>1";
}
$string .= ", 'position'=>".$position;
@@ -1417,6 +1426,14 @@ if ($dirins && $action == 'confirm_deletemodule') {
if ($result > 0) {
setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null);
+
+ clearstatcache(true);
+ if (function_exists('opcache_invalidate')) {
+ opcache_reset(); // remove the include cache hell !
+ }
+
+ header("Location: ".$_SERVER["PHP_SELF"].'?module=deletemodule');
+ exit;
} else {
setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings');
}
@@ -1707,8 +1724,8 @@ print load_fiche_titre($text, '', 'title_setup');
print ''.$langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').' ';
-print $textforlistofdirs;
-print ' ';
+//print $textforlistofdirs;
+//print ' ';
//var_dump($listofmodules);
@@ -1733,7 +1750,7 @@ if ($message) {
}
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).' ';
-$infomodulesfound = ''.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).' ', $langs->trans("ModuleBuilderDesc4", $FILEFLAG)).'
';
+$infomodulesfound = ''.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).' ', $langs->trans("ModuleBuilderDesc4", $FILEFLAG).' '.$textforlistofdirs).'
';
// Load module descriptor
@@ -1757,6 +1774,10 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') {
$loadclasserrormessage = $e->getMessage()." \n";
$loadclasserrormessage .= 'File: '.$e->getFile()." \n";
$loadclasserrormessage .= 'Line: '.$e->getLine()." \n";
+ } catch (Exception $e) {
+ $loadclasserrormessage = $e->getMessage()." \n";
+ $loadclasserrormessage .= 'File: '.$e->getFile()." \n";
+ $loadclasserrormessage .= 'Line: '.$e->getLine()." \n";
}
if (class_exists($class)) {
@@ -1771,6 +1792,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') {
$error++;
}
$langs->load("errors");
+ print '';
print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).' ';
print $loadclasserrormessage;
}
@@ -2423,8 +2445,8 @@ if ($module == 'initmodule') {
print ''.$langs->trans("EnterNameOfObjectDesc").' ';
print ' ';
- print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).' ';
- print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).' ';
+ print ' '.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).' ';
+ print ' '.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).' ';
print ' ';
print ' ';
print ' ';
@@ -2633,6 +2655,7 @@ if ($module == 'initmodule') {
print ' ';
+ clearstatcache(true);
if (function_exists('opcache_invalidate')) {
opcache_invalidate($dirread.'/'.$pathtoclass, true); // remove the include cache hell !
}
@@ -3332,7 +3355,8 @@ if ($module == 'initmodule') {
}
} else {
print '';
- print ' '.$langs->trans("NoTrigger");
+ print ' '.$langs->trans("TriggersFile");
+ print ' : '.$langs->trans("FileNotYetGenerated").' ';
print ''.img_picto('Generate', 'generate', 'class="paddingleft"').' ';
print ' ';
print ' ';
diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php
index 7c6c6b2c04e..8a9937dfd2f 100644
--- a/htdocs/modulebuilder/template/admin/setup.php
+++ b/htdocs/modulebuilder/template/admin/setup.php
@@ -354,13 +354,14 @@ if ($action == 'edit') {
$result = $c->fetch($conf->global->{$constname});
if ($result < 0) {
setEventMessages(null, $c->errors, 'errors');
+ } elseif ($result > 0 ) {
+ $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
+ $toprint = array();
+ foreach ($ways as $way) {
+ $toprint[] = 'color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . ' ';
+ }
+ print '' . implode(' ', $toprint) . ' ';
}
- $ways = $c->print_all_ways(' >> ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
- $toprint = array();
- foreach ($ways as $way) {
- $toprint[] = 'color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . ' ';
- }
- print '' . implode(' ', $toprint) . ' ';
} elseif (preg_match('/thirdparty_type/', $val['type'])) {
if ($conf->global->{$constname}==2) {
print $langs->trans("Prospect");
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 8e316d014d5..6e5d6efcff4 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -767,7 +767,7 @@ class MyObject extends CommonObject
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
$add_save_lastsearch_values = 1;
}
- if ($add_save_lastsearch_values) {
+ if ($url && $add_save_lastsearch_values) {
$url .= '&save_lastsearch_values=1';
}
}
@@ -784,13 +784,13 @@ class MyObject extends CommonObject
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
- if ($option == 'nolink') {
+ if ($option == 'nolink' || empty($url)) {
$linkstart = '';
- if ($option == 'nolink') {
+ if ($option == 'nolink' || empty($url)) {
$linkend = ' ';
} else {
$linkend = '';
diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php
index f2b15735762..4981dde2b45 100644
--- a/htdocs/partnership/class/partnership.class.php
+++ b/htdocs/partnership/class/partnership.class.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2021 NextGestion
+/* Copyright (C) 2017 Laurent Destailleur
+ * Copyright (C) 2021 NextGestion
*
* 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
@@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
+
/**
* Class for Partnership
*/
@@ -66,7 +67,7 @@ class Partnership extends CommonObject
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1; // Validate (no more draft)
- const STATUS_ACCEPTED = 2; // Approved
+ const STATUS_APPROVED = 2; // Approved
const STATUS_REFUSED = 3; // Refused
const STATUS_CANCELED = 9;
@@ -105,7 +106,7 @@ class Partnership extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => 1, 'enabled' => 1, 'visible' => -2, 'notnull' => 1, 'position' => 15, 'index' => 1),
- //'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnershiptype.class.php', 'label' => 'Type', 'default' => 1, 'enabled' => 1, 'visible' => 1, 'position' => 20),
+ 'fk_type' => array('type' => 'integer:PartnershipType:partnership/class/partnership_type.class.php', 'label' => 'Type', 'enabled' => 1, 'visible' => 1, 'position' => 20),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
@@ -366,14 +367,15 @@ class Partnership extends CommonObject
return -1;
}
- $sql = 'SELECT p.rowid, p.ref, p.fk_soc, p.fk_member, p.status';
+ $sql = 'SELECT p.rowid, p.ref, p.fk_type, p.fk_soc, p.fk_member, p.status';
$sql .= ', p.entity, p.date_partnership_start, p.date_partnership_end, p.date_creation';
$sql .= ', p.fk_user_creat, p.tms, p.fk_user_modif, p.fk_user_modif';
$sql .= ', p.note_private, p.note_public';
$sql .= ', p.last_main_doc, p.count_last_url_check_error, p.last_check_backlink, p.reason_decline_or_cancel';
$sql .= ', p.import_key, p.model_pdf';
-
+ $sql .= ', pt.code as type_code, pt.label as type_label';
$sql .= ' FROM '.MAIN_DB_PREFIX.'partnership as p';
+ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_partnership_type as pt ON p.fk_type = pt.rowid';
if ($id) {
$sql .= " WHERE p.rowid=".((int) $id);
@@ -400,8 +402,12 @@ class Partnership extends CommonObject
if ($obj) {
$this->id = $obj->rowid;
$this->entity = $obj->entity;
- $this->rowid = $obj->rowid;
$this->ref = $obj->ref;
+
+ $this->fk_type = $obj->fk_type;
+ $this->type_code = $obj->type_code;
+ $this->type_label = $obj->type_label;
+
$this->fk_soc = $obj->fk_soc;
$this->fk_member = $obj->fk_member;
$this->status = $obj->status;
@@ -701,13 +707,13 @@ class Partnership extends CommonObject
}
/**
- * Accept object
+ * Approve object
*
* @param User $user User making status change
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <=0 if OK, 0=Nothing done, >0 if KO
*/
- public function accept($user, $notrigger = 0)
+ public function approve($user, $notrigger = 0)
{
global $conf, $langs;
@@ -716,7 +722,7 @@ class Partnership extends CommonObject
$error = 0;
// Protection
- if ($this->status == self::STATUS_ACCEPTED) {
+ if ($this->status == self::STATUS_APPROVED) {
dol_syslog(get_class($this)."::accept action abandonned: already acceptd", LOG_WARNING);
return 0;
}
@@ -745,7 +751,7 @@ class Partnership extends CommonObject
// Accept
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
- $sql .= " status = ".self::STATUS_ACCEPTED;
+ $sql .= " status = ".self::STATUS_APPROVED;
// if (!empty($this->fields['date_validation'])) {
// $sql .= ", date_validation = '".$this->db->idate($now)."'";
// }
@@ -812,7 +818,7 @@ class Partnership extends CommonObject
// Set new ref and current status
if (!$error) {
$this->ref = $num;
- $this->status = self::STATUS_ACCEPTED;
+ $this->status = self::STATUS_APPROVED;
}
if (!$error) {
@@ -887,7 +893,7 @@ class Partnership extends CommonObject
public function cancel($user, $notrigger = 0)
{
// Protection
- if ($this->status != self::STATUS_ACCEPTED) {
+ if ($this->status != self::STATUS_APPROVED) {
return 0;
}
@@ -922,7 +928,7 @@ class Partnership extends CommonObject
return -1;
}*/
- return $this->setStatusCommon($user, self::STATUS_ACCEPTED, $notrigger, 'PARTNERSHIP_REOPEN');
+ return $this->setStatusCommon($user, self::STATUS_APPROVED, $notrigger, 'PARTNERSHIP_REOPEN');
}
/**
@@ -1067,18 +1073,18 @@ class Partnership extends CommonObject
//$langs->load("partnership");
$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
- $this->labelStatus[self::STATUS_ACCEPTED] = $langs->transnoentitiesnoconv('Accepted');
+ $this->labelStatus[self::STATUS_APPROVED] = $langs->transnoentitiesnoconv('Approved');
$this->labelStatus[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused');
$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Validated');
- $this->labelStatusShort[self::STATUS_ACCEPTED] = $langs->transnoentitiesnoconv('Accepted');
+ $this->labelStatusShort[self::STATUS_APPROVED] = $langs->transnoentitiesnoconv('Approved');
$this->labelStatusShort[self::STATUS_REFUSED] = $langs->transnoentitiesnoconv('Refused');
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Canceled');
}
$statusType = 'status'.$status;
- if ($status == self::STATUS_ACCEPTED) {
+ if ($status == self::STATUS_APPROVED) {
$statusType = 'status4';
}
if ($status == self::STATUS_REFUSED) {
diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php
new file mode 100644
index 00000000000..6916d95e4f3
--- /dev/null
+++ b/htdocs/partnership/class/partnership_type.class.php
@@ -0,0 +1,562 @@
+
+ * Copyright (C) 2004-2008 Laurent Destailleur
+ * Copyright (C) 2009-2017 Regis Houssin
+ * Copyright (C) 2016 Charlie Benke
+ * Copyright (C) 2018-2019 Thibault Foucart
+ * Copyright (C) 2021 Waël Almoman
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/partnership/class/partnership_type.class.php
+ * \ingroup partnership
+ * \brief File of class to manage partnership types
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
+
+
+/**
+ * Class to manage partnership type
+ */
+class PartnershipType extends CommonObject
+{
+ /**
+ * @var string Name of table without prefix where object is stored
+ */
+ public $table_element = 'c_partnership_type';
+
+ /**
+ * @var string ID to identify managed object
+ */
+ public $element = 'partnership_type';
+
+ /**
+ * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
+ */
+ public $picto = 'generic';
+
+ /**
+ * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
+ * @var int
+ */
+ public $ismultientitymanaged = 1;
+
+ /**
+ * @var string Partnership code
+ */
+ public $code;
+
+ /**
+ * @var string Partnership type label
+ */
+ public $label;
+
+
+ public $fields=array(
+ 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
+ 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1),
+ 'code' =>array('type'=>'varchar(32)', 'label'=>'Code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20, 'showoncombobox'=>1),
+ 'label' =>array('type'=>'varchar(64)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25, 'showoncombobox'=>1),
+ 'active' =>array('type'=>'integer', 'label'=>'Active', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30),
+ );
+
+
+
+ /**
+ * Constructor
+ *
+ * @param DoliDb $db Database handler
+ */
+ public function __construct(DoliDB $db)
+ {
+ global $conf, $langs;
+
+ $this->db = $db;
+
+ if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
+ $this->fields['rowid']['visible'] = 0;
+ }
+ if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
+ $this->fields['entity']['enabled'] = 0;
+ }
+
+ // Example to show how to set values of fields definition dynamically
+ /*if ($user->rights->mymodule->myobject->read) {
+ $this->fields['myfield']['visible'] = 1;
+ $this->fields['myfield']['noteditable'] = 0;
+ }*/
+
+ // Unset fields that are disabled
+ foreach ($this->fields as $key => $val) {
+ if (isset($val['enabled']) && empty($val['enabled'])) {
+ unset($this->fields[$key]);
+ }
+ }
+
+ // Translate some data of arrayofkeyval
+ if (is_object($langs)) {
+ foreach ($this->fields as $key => $val) {
+ if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
+ foreach ($val['arrayofkeyval'] as $key2 => $val2) {
+ $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Create object into database
+ *
+ * @param User $user User that creates
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, Id of created object if OK
+ */
+ public function create(User $user, $notrigger = false)
+ {
+ $resultcreate = $this->createCommon($user, $notrigger);
+
+ //$resultvalidate = $this->validate($user, $notrigger);
+
+ return $resultcreate;
+ }
+
+ /**
+ * Load object in memory from the database
+ *
+ * @param int $id Id object
+ * @param string $ref Ref
+ * @return int <0 if KO, 0 if not found, >0 if OK
+ */
+ public function fetch($id, $ref = null)
+ {
+ $result = $this->fetchCommon($id, $ref);
+ if ($result > 0 && !empty($this->table_element_line)) {
+ $this->fetchLines();
+ }
+ return $result;
+ }
+
+ /**
+ * Load list of objects in memory from the database.
+ *
+ * @param string $sortorder Sort Order
+ * @param string $sortfield Sort field
+ * @param int $limit limit
+ * @param int $offset Offset
+ * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
+ * @param string $filtermode Filter mode (AND or OR)
+ * @return array|int int <0 if KO, array of pages if OK
+ */
+ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
+ {
+ global $conf;
+
+ dol_syslog(__METHOD__, LOG_DEBUG);
+
+ $records = array();
+
+ $sql = "SELECT ";
+ $sql .= $this->getFieldList('t');
+ $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+ if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
+ $sql .= " WHERE t.entity IN (".getEntity($this->table_element).")";
+ } else {
+ $sql .= " WHERE 1 = 1";
+ }
+ // Manage filter
+ $sqlwhere = array();
+ if (count($filter) > 0) {
+ foreach ($filter as $key => $value) {
+ if ($key == 't.rowid') {
+ $sqlwhere[] = $key." = ".((int) $value);
+ } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
+ $sqlwhere[] = $key." = '".$this->db->idate($value)."'";
+ } elseif ($key == 'customsql') {
+ $sqlwhere[] = $value;
+ } elseif (strpos($value, '%') === false) {
+ $sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
+ } else {
+ $sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
+ }
+ }
+ }
+ if (count($sqlwhere) > 0) {
+ $sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
+ }
+
+ if (!empty($sortfield)) {
+ $sql .= $this->db->order($sortfield, $sortorder);
+ }
+ if (!empty($limit)) {
+ $sql .= $this->db->plimit($limit, $offset);
+ }
+
+ $resql = $this->db->query($sql);
+ if ($resql) {
+ $num = $this->db->num_rows($resql);
+ $i = 0;
+ while ($i < ($limit ? min($limit, $num) : $num)) {
+ $obj = $this->db->fetch_object($resql);
+
+ $record = new self($this->db);
+ $record->setVarsFromFetchObj($obj);
+
+ $records[$record->id] = $record;
+
+ $i++;
+ }
+ $this->db->free($resql);
+
+ return $records;
+ } else {
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
+
+ return -1;
+ }
+ }
+
+ /**
+ * Update object into database
+ *
+ * @param User $user User that modifies
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function update(User $user, $notrigger = false)
+ {
+ return $this->updateCommon($user, $notrigger);
+ }
+
+ /**
+ * Delete object in database
+ *
+ * @param User $user User that deletes
+ * @param bool $notrigger false=launch triggers after, true=disable triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function delete(User $user, $notrigger = false)
+ {
+ return $this->deleteCommon($user, $notrigger);
+ //return $this->deleteCommon($user, $notrigger, 1);
+ }
+
+ /**
+ * Set draft status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, >0 if OK
+ */
+ public function setDraft($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status <= self::STATUS_DRAFT) {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'PARTNERSHIPTYPE_UNVALIDATE');
+ }
+
+ /**
+ * Set cancel status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, 0=Nothing done, >0 if OK
+ */
+ public function cancel($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status != self::STATUS_VALIDATED) {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'PARTNERSHIPTYPE_CANCEL');
+ }
+
+ /**
+ * Set back to validated status
+ *
+ * @param User $user Object user that modify
+ * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
+ * @return int <0 if KO, 0=Nothing done, >0 if OK
+ */
+ public function reopen($user, $notrigger = 0)
+ {
+ // Protection
+ if ($this->status != self::STATUS_CANCELED) {
+ return 0;
+ }
+
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->write))
+ || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->mymodule->mymodule_advance->validate))))
+ {
+ $this->error='Permission denied';
+ return -1;
+ }*/
+
+ return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'PARTNERSHIPTYPE_REOPEN');
+ }
+
+ /**
+ * Return a link to the object card (with optionaly the picto)
+ *
+ * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+ * @param string $option On what the link point to ('nolink', ...)
+ * @param int $notooltip 1=Disable tooltip
+ * @param string $morecss Add more css on link
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @return string String with URL
+ */
+ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+ {
+ global $conf, $langs, $hookmanager;
+
+ if (!empty($conf->dol_no_mouse_hover)) {
+ $notooltip = 1; // Force disable tooltips
+ }
+
+ $result = '';
+
+ $label = img_picto('', $this->picto).' '.$langs->trans("PartnershipType").' ';
+ if (isset($this->status)) {
+ $label .= ' '.$this->getLibStatut(5);
+ }
+ $label .= ' ';
+ $label .= ''.$langs->trans('Code').': '.$this->code;
+ $label .= ''.$langs->trans('Label').': '.$this->label;
+
+ //$url = dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$this->id;
+ $url = '';
+
+ if ($option != 'nolink') {
+ // Add param to save lastsearch_values or not
+ $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
+ $add_save_lastsearch_values = 1;
+ }
+ if ($url && $add_save_lastsearch_values) {
+ $url .= '&save_lastsearch_values=1';
+ }
+ }
+
+ $linkclose = '';
+ if (empty($notooltip)) {
+ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ $label = $langs->trans("ShowMyObject");
+ $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
+ }
+ $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ } else {
+ $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+ }
+
+ if ($option == 'nolink' || empty($url)) {
+ $linkstart = '';
+ if ($option == 'nolink' || empty($url)) {
+ $linkend = ' ';
+ } else {
+ $linkend = '';
+ }
+
+ $result .= $linkstart;
+
+ if (empty($this->showphoto_on_popup)) {
+ if ($withpicto) {
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ }
+ } else {
+ if ($withpicto) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+ list($class, $module) = explode('@', $this->picto);
+ $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
+ $filearray = dol_dir_list($upload_dir, "files");
+ $filename = $filearray[0]['name'];
+ if (!empty($filename)) {
+ $pospoint = strpos($filearray[0]['name'], '.');
+
+ $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
+ if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
+ $result .= '';
+ } else {
+ $result .= '';
+ }
+
+ $result .= '';
+ } else {
+ $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ }
+ }
+ }
+
+ if ($withpicto != 2) {
+ $result .= $this->ref;
+ }
+
+ $result .= $linkend;
+ //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
+
+ global $action, $hookmanager;
+ $hookmanager->initHooks(array('myobjectdao'));
+ $parameters = array('id'=>$this->id, 'getnomurl'=>$result);
+ $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;
+ } else {
+ $result .= $hookmanager->resPrint;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Return the label of the status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function getLabelStatus($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
+ /**
+ * Return the label of the status
+ *
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function getLibStatut($mode = 0)
+ {
+ return $this->LibStatut($this->status, $mode);
+ }
+
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return the status
+ *
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
+ */
+ public function LibStatut($status, $mode = 0)
+ {
+ // phpcs:enable
+ if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
+ global $langs;
+ //$langs->load("mymodule@mymodule");
+ $this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
+ $this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
+ $this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
+ $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
+ $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
+ }
+
+ $statusType = 'status'.$status;
+ //if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
+ if ($status == self::STATUS_CANCELED) {
+ $statusType = 'status6';
+ }
+
+ return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
+ }
+
+ /**
+ * Load the info information in the object
+ *
+ * @param int $id Id of object
+ * @return void
+ */
+ public function info($id)
+ {
+ $sql = "SELECT rowid, date_creation as datec, tms as datem,";
+ $sql .= " fk_user_creat, fk_user_modif";
+ $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+ $sql .= " WHERE t.rowid = ".((int) $id);
+
+ $result = $this->db->query($sql);
+ if ($result) {
+ if ($this->db->num_rows($result)) {
+ $obj = $this->db->fetch_object($result);
+ $this->id = $obj->rowid;
+ if ($obj->fk_user_author) {
+ $cuser = new User($this->db);
+ $cuser->fetch($obj->fk_user_author);
+ $this->user_creation = $cuser;
+ }
+
+ if ($obj->fk_user_valid) {
+ $vuser = new User($this->db);
+ $vuser->fetch($obj->fk_user_valid);
+ $this->user_validation = $vuser;
+ }
+
+ if ($obj->fk_user_cloture) {
+ $cluser = new User($this->db);
+ $cluser->fetch($obj->fk_user_cloture);
+ $this->user_cloture = $cluser;
+ }
+
+ $this->date_creation = $this->db->jdate($obj->datec);
+ $this->date_modification = $this->db->jdate($obj->datem);
+ $this->date_validation = $this->db->jdate($obj->datev);
+ }
+
+ $this->db->free($result);
+ } else {
+ dol_print_error($this->db);
+ }
+ }
+
+ /**
+ * Initialise object with example values
+ * Id must be 0 if object instance is a specimen
+ *
+ * @return void
+ */
+ public function initAsSpecimen()
+ {
+ // Set here init that are not commonf fields
+ // $this->property1 = ...
+ // $this->property2 = ...
+
+ $this->initAsSpecimenCommon();
+ }
+}
diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php
index 0588b9e5df2..35b8a3b01e5 100644
--- a/htdocs/partnership/class/partnershiputils.class.php
+++ b/htdocs/partnership/class/partnershiputils.class.php
@@ -101,7 +101,7 @@ class PartnershipUtils
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
$sql .= " WHERE fk_member > 0";
$sql .= " AND (d.datefin < '".$this->db->idate($datetotest)."' AND dty.subscription = 1)";
- $sql .= " AND p.status = ".((int) $partnership::STATUS_ACCEPTED); // Only accepted not yet canceled
+ $sql .= " AND p.status = ".((int) $partnership::STATUS_APPROVED); // Only accepted not yet canceled
$sql .= $this->db->order('d.rowid', 'ASC');
// Limit is managed into loop later
@@ -262,7 +262,7 @@ class PartnershipUtils
$sql .= " WHERE 1 = 1";
$sql .= " AND p.".$fk_partner." > 0";
- $sql .= " AND p.status = ".((int) $partnership::STATUS_ACCEPTED); // Only accepted not yet canceled
+ $sql .= " AND p.status = ".((int) $partnership::STATUS_APPROVED); // Only accepted not yet canceled
$sql .= " AND (p.last_check_backlink IS NULL OR p.last_check_backlink <= '".$this->db->idate($now - 7 * 24 * 3600)."')"; // Every week, check that website contains a link to dolibarr.
$sql .= $this->db->order('p.rowid', 'ASC');
// Limit is managed into loop later
diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php
index fefcafa2350..d5a2bb326b2 100644
--- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php
+++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php
@@ -36,7 +36,7 @@ class mod_partnership_standard extends ModeleNumRefPartnership
*/
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
- public $prefix = 'PARTNERSHIP';
+ public $prefix = 'PSHIP';
/**
* @var string Error code (or message)
diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php
index 99cdb74e264..0f32eb94580 100644
--- a/htdocs/partnership/partnership_card.php
+++ b/htdocs/partnership/partnership_card.php
@@ -153,7 +153,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
} elseif ($action == 'confirm_accept' && $confirm == 'yes' && $permissiontoadd) {
- $result = $object->accept($user);
+ $result = $object->approve($user);
if ($result >= 0) {
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
@@ -232,7 +232,7 @@ if (empty($reshook)) {
// Actions to send emails
$triggersendname = 'PARTNERSHIP_SENTBYMAIL';
$autocopy = 'MAIN_MAIL_AUTOCOPY_PARTNERSHIP_TO';
- $trackid = 'partnership'.$object->id;
+ $trackid = 'pship'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if (!empty($id) && !empty(GETPOST('confirm'))) {
@@ -590,9 +590,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Cancel
if ($permissiontoadd) {
- if ($object->status == $object::STATUS_ACCEPTED) {
+ if ($object->status == $object::STATUS_APPROVED) {
print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
- } elseif ($object->status > $object::STATUS_ACCEPTED) {
+ } elseif ($object->status > $object::STATUS_APPROVED) {
// print 'id.'&action=reopen&token='.newToken().'">'.$langs->trans("Re-Open").' '."\n";
print dolGetButtonAction($langs->trans('Re-Open'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_reopen&confirm=yes&token='.newToken(), '', $permissiontoadd);
}
@@ -600,7 +600,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Refuse
if ($permissiontoadd) {
- if ($object->status != $object::STATUS_DRAFT && $object->status != $object::STATUS_ACCEPTED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) {
+ if ($object->status != $object::STATUS_DRAFT && $object->status != $object::STATUS_APPROVED && $object->status != $object::STATUS_CANCELED && $object->status != $object::STATUS_REFUSED) {
print dolGetButtonAction($langs->trans('Refuse'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=refuse&token='.newToken(), '', $permissiontoadd);
}
}
@@ -664,7 +664,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$modelmail = 'partnership_send';
$defaulttopic = 'InformationMessage';
$diroutput = $conf->partnership->dir_output;
- $trackid = 'partnership'.$object->id;
+ $trackid = 'pship'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
}
diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php
index a5c52609d74..2703d431e1a 100644
--- a/htdocs/partnership/partnership_list.php
+++ b/htdocs/partnership/partnership_list.php
@@ -29,8 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
-
-// load partnership libraries
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
// for other modules
@@ -158,6 +156,8 @@ if ($user->socid > 0) { // Protection if external user
* Actions
*/
+$error = 0;
+
if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
@@ -200,6 +200,43 @@ if (empty($reshook)) {
$uploaddir = $conf->partnership->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
+ // Validate and approve
+ if (!$error && $massaction == 'approve' && $permissiontoadd) {
+ $objecttmp = new Partnership($db);
+
+ $db->begin();
+ $error = 0;
+ $result = 0;
+
+ foreach ($toselect as $checked) {
+ if ($objecttmp->fetch($checked)) {
+ if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
+ //$objecttmp->date = dol_now();
+ $result = $objecttmp->validate($user);
+ }
+
+ if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
+ $result = $objecttmp->approve($user);
+ if ($result > 0) {
+ setEventMessages($langs->trans("PartnershipRefApproved", $objecttmp->ref), null);
+ } else {
+ setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
+ $error++;
+ }
+ } else {
+ setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
+ $error++;
+ }
+ }
+ }
+
+ if (!$error) {
+ $db->commit();
+ } else {
+ $db->rollback();
+ }
+ }
+
// Cancel partnership
if ($massaction == 'cancel' && $permissiontoadd) {
$db->begin();
@@ -208,9 +245,14 @@ if (empty($reshook)) {
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
+ var_dump($objecttmp->status);
if ($result > 0) {
- $result = $objecttmp->cancel($user, 3);
- if ($result <= 0) {
+ $result = $objecttmp->cancel($user, 0);
+ var_dump($result);
+ if ($result == 0) {
+ setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)), null, 'warnings');
+ $error++;
+ } elseif ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
@@ -432,7 +474,9 @@ $param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
-'cancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"),
+ //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
+ 'approve'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ValidateAndApprove"),
+ 'cancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"),
//'generate_doc'=>img_picto('', 'pdf').$langs->trans("ReGeneratePDF"),
//'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"),
'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendMail"),
@@ -440,7 +484,7 @@ $arrayofmassactions = array(
if ($permissiontodelete) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('prevalidate', 'presend', 'predelete'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
@@ -464,7 +508,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
$topicmail = "SendPartnershipRef";
$modelmail = "partnership_send";
$objecttmp = new Partnership($db);
-$trackid = 'partnership'.$object->id;
+$trackid = 'pship'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($search_all) {
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index dd4fd64a28c..b14d4a4efca 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -2178,8 +2178,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ''.$langs->trans("ManageLotSerial").' ';
print $object->getLibStatut(0, 2);
print ' ';
- if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
- || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) {
+ if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
+ || ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) {
print ''.$langs->trans("ManageLotMask").' ';
print $object->batch_mask;
print ' ';
@@ -2689,7 +2689,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
// Documents
$objectref = dol_sanitizeFileName($object->ref);
- $relativepath = $comref.'/'.$objectref.'.pdf';
if (!empty($conf->product->multidir_output[$object->entity])) {
$filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities
} else {
@@ -2699,7 +2698,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
$genallowed = $usercanread;
$delallowed = $usercancreate;
- print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
+ print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $langs->getDefaultLang(), '', $object);
$somethingshown = $formfile->numoffiles;
print '