Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-12-06 19:41:51 +01:00
commit 3bf37a5721
5 changed files with 74 additions and 19 deletions

View File

@ -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

View File

@ -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) {

View File

@ -7,7 +7,7 @@
* Copyright (C) 2014 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2016 Florian Henry <florian.henry@atm-consulting.fr>
* Copyright (C) 2017-2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2020 Christophe Battarel <christophe@altairis.fr>
*
* 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',

View File

@ -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);

View File

@ -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)