From fab2732e70f4a4ae0ed7ef93630ee7abd81144b9 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 5 Dec 2022 19:23:33 +0100 Subject: [PATCH 1/6] Fix doxygen --- htdocs/core/class/html.form.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 From d676dab136d1396f803d7d361db139d6a9f5801f Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 6 Dec 2022 12:23:32 +0100 Subject: [PATCH 2/6] FIx : KnowledgeRecordTest --- test/phpunit/KnowledgeRecordTest.php | 52 +++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) 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) From 91fab7db5ba5ea70b97c2ccf499d128bccb00130 Mon Sep 17 00:00:00 2001 From: hystepik Date: Tue, 6 Dec 2022 14:11:09 +0100 Subject: [PATCH 3/6] Fix : KnowledgeRecord back to draft --- htdocs/knowledgemanagement/knowledgerecord_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 81bf68471ddb28e13f5c1ebb34a92907ced2f85b Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Tue, 6 Dec 2022 15:13:44 +0100 Subject: [PATCH 4/6] Fix #23120 dol_syslog argument bug. --- htdocs/core/class/ldap.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 7b3c6c4ac2c..b62e4f69885 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) { From dbebd7afb243ccdb38479d89818044db7fda94bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 6 Dec 2022 16:01:14 +0100 Subject: [PATCH 5/6] add parameter --- htdocs/fourn/commande/dispatch.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c639e622337..e9cd23e9049 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 @@ -1016,7 +1016,8 @@ 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 + 'objp' => $objp, ); $reshook = $hookmanager->executeHooks( 'printFieldListValue', From c29fd09cbd714761fbb5f6993fdab46d93075faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 6 Dec 2022 16:46:04 +0100 Subject: [PATCH 6/6] add parameters --- htdocs/fourn/commande/dispatch.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index e9cd23e9049..9e3a9ba7808 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -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', @@ -1017,6 +1019,8 @@ if ($id > 0 || !empty($ref)) { // Enable hooks to append additional columns $parameters = array( 'is_information_row' => false, // this is a dispatch form row + 'i' => $i, + 'suffix' => $suffix, 'objp' => $objp, ); $reshook = $hookmanager->executeHooks(