mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
N°5904 - Use attribute linked set edit mode to enable actions (#440)
* Add corresponding buttons depending on old edit mode (need to check with piR pour récuperer l'ancienne valeur. * N°5904 - Handle attribute linked set edit_mode * N°5904 Move calls to private jquery widget methods to public * N°5904 - Worker improvements add button on link tagset * Change itop set widget to new set block UI (5) * Change itop set widget to new set block UI (5) * Renommage variables JS avec le prefix combodo * Search dialog block id conflict with form id * add moved js files in iTopWebPage compatibility list --------- Co-authored-by: Stephen Abello <stephen.abello@combodo.com>
This commit is contained in:
@@ -140,19 +140,8 @@ class ObjectRepository
|
||||
$oDbObjectSet->Rewind();
|
||||
while ($oObject = $oDbObjectSet->Fetch()) {
|
||||
|
||||
// Prepare objet data
|
||||
$aObjectData = [];
|
||||
|
||||
// Object key
|
||||
$aObjectData['key'] = $oObject->GetKey();
|
||||
|
||||
// Fill loaded columns...
|
||||
foreach ($aFieldsToLoad as $sField) {
|
||||
$aObjectData[$sField] = $oObject->Get($sField);
|
||||
}
|
||||
|
||||
// Compute others data
|
||||
$aResult[] = ObjectRepository::ComputeOthersData($oObject, $sObjectClass, $aObjectData, $aComplementAttributeSpec, $sObjectImageAttCode);
|
||||
$aResult[] = self::ConvertObjectToArray($oObject, $sObjectClass, $aFieldsToLoad, $aComplementAttributeSpec, $sObjectImageAttCode);
|
||||
}
|
||||
|
||||
return $aResult;
|
||||
@@ -199,6 +188,9 @@ class ObjectRepository
|
||||
{
|
||||
try {
|
||||
|
||||
// object class
|
||||
$aData['class_name'] = get_class($oDbObject);
|
||||
|
||||
// Obsolescence flag
|
||||
$aData['obsolescence_flag'] = $oDbObject->IsObsolete();
|
||||
|
||||
@@ -260,4 +252,50 @@ class ObjectRepository
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ConvertObjectToArray.
|
||||
*
|
||||
* @param DBObject $oObject
|
||||
* @param string $sObjectClass
|
||||
* @param array|null $aFieldsToLoad
|
||||
* @param array|null $aComplementAttributeSpec
|
||||
* @param string|null $sObjectImageAttCode
|
||||
*
|
||||
* @return array
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
public static function ConvertObjectToArray(DBObject $oObject, string $sObjectClass, array $aFieldsToLoad = null, array $aComplementAttributeSpec = null, string $sObjectImageAttCode = null): array
|
||||
{
|
||||
// Retrieve friendly name complementary specification
|
||||
if ($aComplementAttributeSpec === null) {
|
||||
$aComplementAttributeSpec = MetaModel::GetNameSpec($sObjectClass, FriendlyNameType::COMPLEMENTARY);
|
||||
}
|
||||
|
||||
// Retrieve image attribute code
|
||||
if ($sObjectImageAttCode === null) {
|
||||
$sObjectImageAttCode = MetaModel::GetImageAttributeCode($sObjectClass);
|
||||
}
|
||||
|
||||
// Fields to load
|
||||
if ($aFieldsToLoad === null) {
|
||||
$aFieldsToLoad = self::GetDefaultFieldsToLoad($aComplementAttributeSpec, $sObjectImageAttCode);
|
||||
}
|
||||
|
||||
// Prepare objet data
|
||||
$aObjectData = [];
|
||||
|
||||
// Object key
|
||||
$aObjectData['key'] = $oObject->GetKey();
|
||||
|
||||
// Fill loaded columns...
|
||||
foreach ($aFieldsToLoad as $sField) {
|
||||
$aObjectData[$sField] = $oObject->Get($sField);
|
||||
}
|
||||
|
||||
// Compute others data
|
||||
return ObjectRepository::ComputeOthersData($oObject, $sObjectClass, $aObjectData, $aComplementAttributeSpec, $sObjectImageAttCode);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user