diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index 7cf64e4800d..5b7a9845c10 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -381,7 +381,7 @@ foreach ($dirmodels as $reldir) {
if (in_array($name, $def)) {
print '
'."\n";
if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") {
- print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">';
+ print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '';
} else {
diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php
index 5a4097b089b..09bb46ed98e 100644
--- a/htdocs/api/class/api_access.class.php
+++ b/htdocs/api/class/api_access.class.php
@@ -1,6 +1,7 @@
* Copyright (C) 2016 Laurent Destailleur
+ * Copyright (C) 2023 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
@@ -147,6 +148,9 @@ class DolibarrApiAccess implements iAuthenticate
if ($result <= 0) {
throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')');
}
+ if ($fuser->statut == 0) {
+ throw new RestException(503, 'Error when fetching user. This user has been locked or disabled');
+ }
$fuser->getrights();
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 769bd9ddd50..f5e1fe40b1f 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -708,6 +708,8 @@ class ActionComm extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index da4c756705f..e575195799c 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -567,6 +567,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index f36b8027461..edd443c1b58 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -1412,6 +1412,8 @@ class Propal extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index d394df997ff..e099aafc9ca 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -445,6 +445,7 @@ if (empty($reshook)) {
// Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action);
if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 33de271b45d..c636b4e905d 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1252,6 +1252,8 @@ class Commande extends CommonOrder
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
@@ -1406,6 +1408,8 @@ class Commande extends CommonOrder
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 862a86e9e16..2af2b35240d 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1299,6 +1299,8 @@ class Facture extends CommonInvoice
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
@@ -1432,6 +1434,8 @@ class Facture extends CommonInvoice
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 624d59b0d94..a63e8d7c6ca 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -341,6 +341,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 309df80605e..f16b26646bc 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2564,6 +2564,8 @@ class Contrat extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index 21c290b595d..4195dee8dc1 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -344,6 +344,7 @@ function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir)
$filearray[$key]['position_name'] = ($filearrayindatabase[$key2]['position'] ? $filearrayindatabase[$key2]['position'] : '0').'_'.$filearrayindatabase[$key2]['name'];
$filearray[$key]['position'] = $filearrayindatabase[$key2]['position'];
$filearray[$key]['cover'] = $filearrayindatabase[$key2]['cover'];
+ $filearray[$key]['keywords'] = $filearrayindatabase[$key2]['keywords'];
$filearray[$key]['acl'] = $filearrayindatabase[$key2]['acl'];
$filearray[$key]['rowid'] = $filearrayindatabase[$key2]['rowid'];
$filearray[$key]['label'] = $filearrayindatabase[$key2]['label'];
diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php
index 3f62087dd0b..a0fe9fa8335 100644
--- a/htdocs/expensereport/class/expensereport.class.php
+++ b/htdocs/expensereport/class/expensereport.class.php
@@ -455,6 +455,8 @@ class ExpenseReport extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 000b654bf72..0205fec9e39 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -1211,6 +1211,8 @@ class Fichinter extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index e78dd9dd02a..112708a92b7 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -1654,6 +1654,8 @@ class CommandeFournisseur extends CommonOrder
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index 86e34ce39a1..a8ee29fc974 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -1314,6 +1314,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {
diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php
index 25034194119..052b1189b3d 100644
--- a/htdocs/modulebuilder/index.php
+++ b/htdocs/modulebuilder/index.php
@@ -1295,33 +1295,35 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
- }
- if (!$error) {
- $addfieldentry = array(
- 'name'=>GETPOST('propname', 'aZ09'),
- 'label'=>GETPOST('proplabel', 'alpha'),
- 'type'=>GETPOST('proptype', 'alpha'),
- 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
- 'visible'=>GETPOST('propvisible', 'int'),
- 'enabled'=>GETPOST('propenabled', 'int'),
- 'position'=>GETPOST('propposition', 'int'),
- 'notnull'=>GETPOST('propnotnull', 'int'),
- 'index'=>GETPOST('propindex', 'int'),
- 'searchall'=>GETPOST('propsearchall', 'int'),
- 'isameasure'=>GETPOST('propisameasure', 'int'),
- 'comment'=>GETPOST('propcomment', 'alpha'),
- 'help'=>GETPOST('prophelp', 'alpha'),
- 'css'=>GETPOST('propcss', 'aZ09'),
- 'cssview'=>GETPOST('propcssview', 'aZ09'),
- 'csslist'=>GETPOST('propcsslist', 'aZ09'),
- 'default'=>GETPOST('propdefault', 'restricthtml'),
- 'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
- );
+ if (!$error && !GETPOST('regenerateclasssql') && !GETPOST('regeneratemissing')) {
+ $addfieldentry = array(
+ 'name'=>GETPOST('propname', 'aZ09'),
+ 'label'=>GETPOST('proplabel', 'alpha'),
+ 'type'=>GETPOST('proptype', 'alpha'),
+ 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
+ 'visible'=>GETPOST('propvisible', 'int'),
+ 'enabled'=>GETPOST('propenabled', 'int'),
+ 'position'=>GETPOST('propposition', 'int'),
+ 'notnull'=>GETPOST('propnotnull', 'int'),
+ 'index'=>GETPOST('propindex', 'int'),
+ 'searchall'=>GETPOST('propsearchall', 'int'),
+ 'isameasure'=>GETPOST('propisameasure', 'int'),
+ 'comment'=>GETPOST('propcomment', 'alpha'),
+ 'help'=>GETPOST('prophelp', 'alpha'),
+ 'css'=>GETPOST('propcss', 'aZ09'),
+ 'cssview'=>GETPOST('propcssview', 'aZ09'),
+ 'csslist'=>GETPOST('propcsslist', 'aZ09'),
+ 'default'=>GETPOST('propdefault', 'restricthtml'),
+ 'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
+ );
- if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
- $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
+ if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
+ $addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
+ }
}
+ } else {
+ $addfieldentry = array();
}
/*if (GETPOST('regeneratemissing'))
diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php
index 4ad5fa9ff56..01f9ad5e2dd 100644
--- a/htdocs/supplier_proposal/card.php
+++ b/htdocs/supplier_proposal/card.php
@@ -407,6 +407,7 @@ if (empty($reshook)) {
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
} else {
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index 78fc1c7fd15..088594f6ab4 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -1160,6 +1160,8 @@ class SupplierProposal extends CommonObject
$action = '';
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
+ $this->errors += $hookmanager->errors;
+ $this->error = $hookmanager->error;
$error++;
}
}
|