';
//print '';
$htmltext = $langs->transnoentitiesnoconv("OperationParamDesc");
diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php
index 1cb418cb6c9..c9434f216bb 100644
--- a/htdocs/admin/mails_templates.php
+++ b/htdocs/admin/mails_templates.php
@@ -680,17 +680,27 @@ if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu
}
-// Confirmation de la suppression de la ligne
+// Confirm deletion of record
if ($action == 'delete') {
- print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((int) $rowid).'&code='.urlencode($code).'&id='.((int) $id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
}
-
-
$fieldlist = explode(',', $tabfield[$id]);
if ($action == 'create') {
+ // If data was already input, we define them in obj to populate input fields.
+ $obj = new stdClass();
+ $obj->label = GETPOST('label');
+ $obj->lang = GETPOST('lang');
+ $obj->type_template = GETPOST('type_template');
+ $obj->fk_user = GETPOST('fk_user', 'int');
+ $obj->private = GETPOST('private', 'int');
+ $obj->position = GETPOST('position');
+ $obj->topic = GETPOST('topic');
+ $obj->joinfiles = GETPOST('joinfiles');
+ $obj->content = GETPOST('content', 'restricthtml');
+
// Form to add a new line
print '
';
- $obj = new stdClass();
- // If data was already input, we define them in obj to populate input fields.
- if (GETPOST('actionadd')) {
- foreach ($fieldlist as $key => $val) {
- if (GETPOST($val) != '') {
- $obj->$val = GETPOST($val);
- }
- }
- }
-
$tmpaction = 'create';
$parameters = array(
'fieldlist' => $fieldlist,
@@ -836,7 +836,6 @@ if ($action == 'create') {
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
$okforextended = false;
}
-
$doleditor = new DolEditor($tmpfieldlist, (!empty($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : ''), '', 180, 'dolibarr_mailings', 'In', false, $acceptlocallinktomedia, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1);
}
@@ -856,7 +855,7 @@ if ($action == 'create') {
print '';
print '';
print '
';
-} // END IF not edit
+}
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php
index 60736d085da..f6644590a2e 100644
--- a/htdocs/bom/bom_net_needs.php
+++ b/htdocs/bom/bom_net_needs.php
@@ -218,6 +218,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '
';
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 87834ffe7df..e29c5ca1bb3 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -119,9 +119,9 @@ $usercanreopen = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights
$usercanunvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($usercancreate)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->unvalidate)));
$usercanproductignorepricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS));
-$usercancreatemargin = $user->rights->margins->creer;
-$usercanreadallmargin = $user->rights->margins->liretous;
-$usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
+$usercancreatemargin = $user->hasRight("margins", "creer");
+$usercanreadallmargin = $user->hasRight("margins", "liretous");
+$usercancreatewithdrarequest = $user->hasRight("prelevement", "bons", "creer");
$now = dol_now();
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index ec4bfb8e0f5..d657d296fce 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -3118,7 +3118,11 @@ if ($action == 'create') {
}
// when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
- $fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
+ if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account
+ $fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company
+ } else { // No company forced
+ $fk_account = GETPOST("fk_account", 'int');
+ }
if (!empty($soc->id)) {
$absolute_discount = $soc->getAvailableDiscounts();
diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php
index 38c363654d3..d2379f46966 100644
--- a/htdocs/core/ajax/selectsearchbox.php
+++ b/htdocs/core/ajax/selectsearchbox.php
@@ -58,7 +58,6 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) {
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
-//global $hookmanager;
$hookmanager->initHooks(array('searchform'));
$search_boxvalue = GETPOST('q', 'restricthtml');
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index ab4228769e1..18e61c0779c 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1371,12 +1371,13 @@ abstract class CommonObject
*
* @param int $statusoflink Status of links to get (-1=all). Not used.
* @param string $source Source of contact: 'external' or 'thirdparty' (llx_socpeople) or 'internal' (llx_user)
- * @param int $list 0:Return array contains all properties, 1:Return array contains just id
+ * @param int $list 0:Returned array contains all properties, 1:Return array contains just id
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @param int $status Status of user or company
+ * @param array $arrayoftcids Array with ID of type of contacts. If we provide this, we can make a ec.fk_c_type_contact in ($arrayoftcids) to avoid link on tc table. TODO Not implemented.
* @return array|int Array of contacts, -1 if error
*/
- public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1)
+ public function liste_contact($statusoflink = -1, $source = 'external', $list = 0, $code = '', $status = -1, $arrayoftcids = array())
{
// phpcs:enable
global $langs;
@@ -1418,7 +1419,7 @@ abstract class CommonObject
$sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople
}
}
- $sql .= " AND tc.active=1";
+ $sql .= " AND tc.active = 1";
if ($statusoflink >= 0) {
$sql .= " AND ec.statut = ".((int) $statusoflink);
}
diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php
index bcd5a506946..1cbf4ed22d3 100644
--- a/htdocs/core/class/hookmanager.class.php
+++ b/htdocs/core/class/hookmanager.class.php
@@ -127,6 +127,7 @@ class HookManager
}
}
}
+ // Log the init of hook but only for hooks thare are declared to be managed
if (count($arraytolog) > 0) {
dol_syslog(get_class($this)."::initHooks Loading hooks: ".join(', ', $arraytolog), LOG_DEBUG);
}
@@ -237,7 +238,10 @@ class HookManager
$actionclassinstance->error = 0;
$actionclassinstance->errors = array();
- dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG);
+ if (getDolGlobalInt('MAIN_DEBUG_SHOW_EACH_QUALIFIED_HOOK_CALL') >= 2) {
+ // This his too much verbose, enabled in develop only
+ dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG);
+ }
// Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
// Note: The hook can use the $currentcontext in its code to avoid to be ran twice or be ran for one given context only
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 7de2938e299..1255586b2dc 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5130,10 +5130,12 @@ class Form
$i = 0;
foreach ($input['values'] as $selkey => $selval) {
$more .= '
';
- if ($i == 0) {
- $more .= '
'.$input['label'].'
';
- } else {
- $more .= '
';
+ if (isset($input['label'])) {
+ if ($i == 0) {
+ $more .= '