diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 9f0f55220e7..9e26170f214 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2868,7 +2868,7 @@ class Form
* This define value for &$opt and &$optJson.
* This function is called by select_produits_list().
*
- * @param resource $objp Resultset of fetch
+ * @param object $objp Resultset of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param int $price_level Price level
@@ -7202,7 +7202,7 @@ class Form
* constructTicketListOption.
* This define value for &$opt and &$optJson.
*
- * @param resource $objp Result set of fetch
+ * @param object $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
@@ -7400,7 +7400,7 @@ class Form
* constructProjectListOption.
* This define value for &$opt and &$optJson.
*
- * @param resource $objp Result set of fetch
+ * @param object $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
@@ -7615,7 +7615,7 @@ class Form
* constructMemberListOption.
* This define value for &$opt and &$optJson.
*
- * @param resource $objp Result set of fetch
+ * @param object $objp Result set of fetch
* @param string $opt Option (var used for returned value in string option format)
* @param string $optJson Option (var used for returned value in json format)
* @param string $selected Preselected value
@@ -9583,7 +9583,7 @@ class Form
/**
* Return select list of groups
*
- * @param string $selected Id group preselected
+ * @param string|object $selected Id group or group preselected
* @param string $htmlname Field name in form
* @param int $show_empty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
* @param string|array $exclude Array list of groups id to exclude
diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php
index 426dec37962..011d8a380ef 100644
--- a/htdocs/core/class/ldap.class.php
+++ b/htdocs/core/class/ldap.class.php
@@ -1058,12 +1058,12 @@ class Ldap
if (is_array($attributeArray)) {
// Return list with required fields
$attributeArray = array_values($attributeArray); // This is to force to have index reordered from 0 (not make ldap_search fails)
- dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")");
+ dol_syslog(get_class($this)."::getRecords connection=".$this->connectedServer.":".$this->serverPort." userDn=".$userDn." filter=".$filter." attributeArray=(".join(',', $attributeArray).")");
//var_dump($attributeArray);
$this->result = @ldap_search($this->connection, $userDn, $filter, $attributeArray);
} else {
// Return list with fields selected by default
- dol_syslog(get_class($this)."::getRecords connection=".$this->connection." userDn=".$userDn." filter=".$filter);
+ dol_syslog(get_class($this)."::getRecords connection=".$this->connectedServer.":".$this->serverPort." userDn=".$userDn." filter=".$filter);
$this->result = @ldap_search($this->connection, $userDn, $filter);
}
if (!$this->result) {
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index c639e622337..9e3a9ba7808 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -7,7 +7,7 @@
* Copyright (C) 2014 Cedric Gross
* Copyright (C) 2016 Florian Henry
* Copyright (C) 2017-2022 Ferran Marcet
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2022 Frédéric France
* Copyright (C) 2019-2020 Christophe Battarel
*
* This program is free software; you can redistribute it and/or modify
@@ -873,10 +873,11 @@ if ($id > 0 || !empty($ref)) {
// Enable hooks to append additional columns
$parameters = array(
- 'is_information_row' => true, // allows hook to distinguish between the
- // rows with information and the rows with
- // dispatch form input
- 'objp' => $objp
+ // allows hook to distinguish between the rows with information and the rows with dispatch form input
+ 'is_information_row' => true,
+ 'i' => $i,
+ 'suffix' => $suffix,
+ 'objp' => $objp,
);
$reshook = $hookmanager->executeHooks(
'printFieldListValue',
@@ -935,10 +936,11 @@ if ($id > 0 || !empty($ref)) {
// Enable hooks to append additional columns
$parameters = array(
- 'is_information_row' => true, // allows hook to distinguish between the
- // rows with information and the rows with
- // dispatch form input
- 'objp' => $objp
+ // allows hook to distinguish between the rows with information and the rows with dispatch form input
+ 'is_information_row' => true,
+ 'i' => $i,
+ 'suffix' => $suffix,
+ 'objp' => $objp,
);
$reshook = $hookmanager->executeHooks(
'printFieldListValue',
@@ -1016,7 +1018,10 @@ if ($id > 0 || !empty($ref)) {
// Enable hooks to append additional columns
$parameters = array(
- 'is_information_row' => false // this is a dispatch form row
+ 'is_information_row' => false, // this is a dispatch form row
+ 'i' => $i,
+ 'suffix' => $suffix,
+ 'objp' => $objp,
);
$reshook = $hookmanager->executeHooks(
'printFieldListValue',
diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php
index 908e13852f2..0c182d71f9e 100644
--- a/htdocs/knowledgemanagement/knowledgerecord_card.php
+++ b/htdocs/knowledgemanagement/knowledgerecord_card.php
@@ -478,7 +478,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
- print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd);
+ print dolGetButtonAction('', $langs->trans('SetToDraft'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
}
if (($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) && $permissiontovalidate) {
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
diff --git a/test/phpunit/KnowledgeRecordTest.php b/test/phpunit/KnowledgeRecordTest.php
index 8c3ed03e9b5..ad306ed04b2 100644
--- a/test/phpunit/KnowledgeRecordTest.php
+++ b/test/phpunit/KnowledgeRecordTest.php
@@ -175,13 +175,63 @@ class KnowledgeRecordTest extends PHPUnit\Framework\TestCase
return $result;
}
+ /**
+ * testKnowledgeRecordFetch
+ *
+ * @param int $id Id order
+ * @return KnowledgeRecord
+ *
+ * @depends testKnowledgeRecordCreate
+ * The depends says test is run only if previous is ok
+ */
+ public function testKnowledgeRecordFetch($id)
+ {
+ global $conf,$user,$langs,$db;
+ $conf=$this->savconf;
+ $user=$this->savuser;
+ $langs=$this->savlangs;
+ $db=$this->savdb;
+
+ $localobject=new KnowledgeRecord($this->savdb);
+ $result=$localobject->fetch($id);
+
+ $this->assertLessThan($result, 0);
+ print __METHOD__." id=".$id." result=".$result."\n";
+ return $localobject;
+ }
+
+ /**
+ * testKnowledgeRecordUpdate
+ * @param KnowledgeRecord $localobject KnowledgeRecord
+ * @return int
+ *
+ * @depends testKnowledgeRecordFetch
+ * The depends says test is run only if previous is ok
+ */
+ public function testKnowledgeRecordUpdate($localobject)
+ {
+ global $conf, $user, $langs, $db;
+ $conf = $this->savconf;
+ $user = $this->savuser;
+ $langs = $this->savlangs;
+ $db = $this->savdb;
+
+ $localobject->note_private='New note private after update';
+ $result = $localobject->update($user);
+
+ $this->assertLessThan($result, 0);
+ print __METHOD__." id=".$localobject->id." result=".$result."\n";
+
+ return $result;
+ }
+
/**
* testKnowledgeRecordDelete
*
* @param int $id Id of object
* @return int
*
- * @depends testKnowledgeRecordCreate
+ * @depends testKnowledgeRecordUpdate
* The depends says test is run only if previous is ok
*/
public function testKnowledgeRecordDelete($id)