Merge remote-tracking branch 'origin/support/3.2' into develop

This commit is contained in:
Anne-Cath
2024-02-29 16:57:24 +01:00
42 changed files with 238 additions and 44 deletions

View File

@@ -3592,16 +3592,26 @@ EOF
$oPage->add_ready_script(InlineImage::EnableCKEditorImageUpload($this, $sTempId));
} else {
//we can directly apply the stimuli
$sExceptionMessage = null;
try {
$bApplyStimulus = $this->ApplyStimulus($sStimulus); // will write the object in the DB
if (!$bApplyStimulus) {
throw new ApplicationException(Dict::S('UI:FailedToApplyStimuli'));
} else {
}
catch (Exception $oException) {
// Catch any exception happening during the stimulus
$bApplyStimulus = false;
$sExceptionMessage = ($oException instanceof CoreCannotSaveObjectException) ? $oException->getHtmlMessage() : $oException->getMessage();
}
finally {
if ($sOwnershipToken !== null) {
// Release the concurrent lock, if any
iTopOwnershipLock::ReleaseLock($sClass, $iKey, $sOwnershipToken);
}
return true;
if (!$bApplyStimulus) {
// Throw an application oriented exception if necessary
throw new ApplicationException($sExceptionMessage ?? Dict::S('UI:FailedToApplyStimuli'));
} else {
return true;
}
}
}

View File

@@ -851,11 +851,11 @@ abstract class DBSearch
return;
}
if (count($aColumns) == 0)
{
$aColumns = array_keys(MetaModel::ListAttributeDefs($this->GetClass()));
// Add the standard id (as first column)
array_unshift($aColumns, 'id');
if (count($aColumns) == 0)
{
$aColumns = array_keys(MetaModel::ListAttributeDefs($this->GetClass()));
// Add the standard id (as first column)
array_unshift($aColumns, 'id');
}
$aQueryCols = CMDBSource::GetColumns($resQuery, $sSQL);
@@ -885,6 +885,55 @@ abstract class DBSearch
return $aRes;
}
/**
* Selects a column ($sAttCode) from the specified class ($sClassAlias - default main class) of the DBsearch object and gives the result as an array
* @param string $sAttCode
* @param string|null $sClassAlias
*
* @return array
* @throws ConfigException
* @throws CoreException
* @throws MissingQueryArgument
* @throws MySQLException
* @throws MySQLHasGoneAwayException
*/
public function SelectAttributeToArray(string $sAttCode, ?string $sClassAlias = null):array
{
if(is_null($sClassAlias)) {
$sClassAlias = $this->GetClassAlias();
}
$sClass = $this->GetClass();
if($sAttCode === 'id'){
$aAttToLoad[$sClassAlias]=[];
} else {
$aAttToLoad[$sClassAlias][$sAttCode] = MetaModel::GetAttributeDef($sClass, $sAttCode);
}
$sSQL = $this->MakeSelectQuery([], [], $aAttToLoad);
$resQuery = CMDBSource::Query($sSQL);
if (!$resQuery)
{
return [];
}
$sColName = $sClassAlias.$sAttCode;
$aRes = [];
while ($aRow = CMDBSource::FetchArray($resQuery))
{
$aMappedRow = array();
if($sAttCode === 'id') {
$aMappedRow[$sAttCode] = $aRow[$sColName];
} else {
$aMappedRow[$sAttCode] = $aAttToLoad[$sClassAlias][$sAttCode]->FromSQLToValue($aRow, $sColName);
}
$aRes[] = $aMappedRow;
}
CMDBSource::FreeResult($resQuery);
return $aRes;
}
////////////////////////////////////////////////////////////////////////////
//
// Construction of the SQL queries

View File

@@ -162,7 +162,7 @@ abstract class UserRightsAddOnAPI
$oSearchSharers->AllowAllData();
$oSearchSharers->AddCondition_ReferencedBy($oShareSearch, 'sharing_org_id');
$aSharers = array();
foreach($oSearchSharers->ToDataArray(array('id')) as $aRow)
foreach($oSearchSharers->SelectAttributeToArray('id') as $aRow)
{
$aSharers[] = $aRow['id'];
}
@@ -187,7 +187,7 @@ abstract class UserRightsAddOnAPI
$oOrgField = new FieldExpression('org_id', $sShareClass);
$oSearchShares->AddConditionExpression(new BinaryExpression($oOrgField, 'IN', $oListExpr));
$aShared = array();
foreach($oSearchShares->ToDataArray(array($sShareAttCode)) as $aRow)
foreach($oSearchShares->SelectAttributeToArray($sShareAttCode) as $aRow)
{
$aShared[] = $aRow[$sShareAttCode];
}

View File

@@ -1222,9 +1222,18 @@ class ObjectFormManager extends FormManager
}
}
}
catch (CoreCannotSaveObjectException $e) {
$aData['valid'] = false;
$aData['messages']['error'] += array('_main' => array($e->getHtmlMessage()));
if (false === $bExceptionLogged) {
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage());
}
}
catch (Exception $e) {
$aData['valid'] = false;
$aData['messages']['error'] += array('_main' => array($e->getMessage()));
$aData['messages']['error'] += [
'_main' => [ ($e instanceof CoreCannotSaveObjectException) ? $e->getHtmlMessage() : $e->getMessage()]
];
if (false === $bExceptionLogged) {
IssueLog::Error(__METHOD__.' at line '.__LINE__.' : '.$e->getMessage());
}

View File

@@ -333,6 +333,8 @@ class ObjectFormHandlerHelper
'modal' => true,
);
}
} else {
throw new HttpException(Response::HTTP_INTERNAL_SERVER_ERROR, implode('<br/>', $aFormData['validation']['messages']['error']['_main']));
}
break;

View File

@@ -1623,6 +1623,7 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
'UI:Newsroom:Preferences' => 'Nastavení novinek a upozornění',
'UI:Newsroom:ConfigurationLink' => 'Konfigurace',
'UI:Newsroom:ResetCache' => 'Resetuj cache',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Zobrazit zprávy od %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Zobrazit %1$s zpráv v menu %2$s',
));

View File

@@ -1614,6 +1614,7 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array(
'UI:Newsroom:Preferences' => 'Newsroom preferences~~',
'UI:Newsroom:ConfigurationLink' => 'Configuration~~',
'UI:Newsroom:ResetCache' => 'Reset cache~~',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Display messages from %1$s~~',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Display up to %1$s messages in the %2$s menu.~~',
));

View File

@@ -1612,6 +1612,7 @@ Dict::Add('DE DE', 'German', 'Deutsch', array(
'UI:Newsroom:Preferences' => 'Newsroom-Einstellungen',
'UI:Newsroom:ConfigurationLink' => 'Konfiguration',
'UI:Newsroom:ResetCache' => 'Cache zurücksetzen',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Nachrichten von %1$s anzeigen',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Zeigen Sie höchstens %1$s Beiträge im Menü (%2$s) an.',
));

View File

@@ -1710,6 +1710,7 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:Newsroom:Preferences' => 'Newsroom preferences',
'UI:Newsroom:ConfigurationLink' => 'Configuration',
'UI:Newsroom:ResetCache' => 'Reset cache',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Display messages from %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Display up to %1$s messages in the %2$s menu.',
));

View File

@@ -1631,6 +1631,7 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
'UI:Newsroom:Preferences' => 'Preferencia de Notificaciones',
'UI:Newsroom:ConfigurationLink' => 'Configuración',
'UI:Newsroom:ResetCache' => 'Borrar caché',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Desplegar mensajes de %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Desplegar hasta %1$s mensajes en el menú %2$s.',
));

View File

@@ -1620,6 +1620,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'UI:Newsroom:Preferences' => 'Préférences du centre d\'information',
'UI:Newsroom:ConfigurationLink' => 'Configuration',
'UI:Newsroom:ResetCache' => 'Ràz du cache',
'UI:Newsroom:ResetCache:Success:Message' => 'Le cache a été réinitialisé avec succès',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Afficher les messages de %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Afficher au plus %1$s messages dans le menu %2$s.',
));

View File

@@ -1615,6 +1615,7 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'UI:Newsroom:Preferences' => 'Hírfolyam beállítások',
'UI:Newsroom:ConfigurationLink' => 'Konfiguráció',
'UI:Newsroom:ResetCache' => 'Gyorstár ürítése',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => '%1$s üzeneteinek megjelenítése',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Mutasson %1$s üzenetet a %2$s menüben.',
));

View File

@@ -1631,6 +1631,7 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array(
'UI:Newsroom:Preferences' => 'Preferenze Newsroom',
'UI:Newsroom:ConfigurationLink' => 'Configurazione',
'UI:Newsroom:ResetCache' => 'Resetta la cache',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Mostra messaggi da %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Mostra fino a %1$s messaggi nel menu %2$s.',

View File

@@ -1613,6 +1613,7 @@ Dict::Add('JA JP', 'Japanese', '日本語', array(
'UI:Newsroom:Preferences' => 'Newsroom preferences~~',
'UI:Newsroom:ConfigurationLink' => 'Configuration~~',
'UI:Newsroom:ResetCache' => 'Reset cache~~',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Display messages from %1$s~~',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Display up to %1$s messages in the %2$s menu.~~',
));

View File

@@ -1628,6 +1628,7 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
'UI:Newsroom:Preferences' => 'Voorkeuren voor Newsroom',
'UI:Newsroom:ConfigurationLink' => 'Configuratie',
'UI:Newsroom:ResetCache' => 'Maak cache leeg',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Bekijk berichten van %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Toon maximaal %1$s berichten in het %2$s menu.',
));

View File

@@ -1625,6 +1625,7 @@ Dict::Add('PL PL', 'Polish', 'Polski', array(
'UI:Newsroom:Preferences' => 'Preferencje newsroomu',
'UI:Newsroom:ConfigurationLink' => 'Konfiguracja',
'UI:Newsroom:ResetCache' => 'Zresetuj pamięć podręczną',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Wyświetl wiadomości od %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Wyświetlaj do %1$s wiadomiości w %2$s menu.',
));

View File

@@ -1625,6 +1625,7 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
'UI:Newsroom:Preferences' => 'Preferências da sala de notícias',
'UI:Newsroom:ConfigurationLink' => 'Configuração',
'UI:Newsroom:ResetCache' => 'Redefinir cache',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Exibir mensagens do(a) %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Exibir até %1$s mensagem(ns) no menu %2$s',
));

View File

@@ -1625,6 +1625,7 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
'UI:Newsroom:Preferences' => 'Центр новостей',
'UI:Newsroom:ConfigurationLink' => 'Конфигурация',
'UI:Newsroom:ResetCache' => 'Сбросить кеш',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Показать сообщения от %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Отобразите не более %1$s сообщений в меню %2$s.',
));

View File

@@ -1617,6 +1617,7 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
'UI:Newsroom:Preferences' => 'Newsroom preferences~~',
'UI:Newsroom:ConfigurationLink' => 'Configuration~~',
'UI:Newsroom:ResetCache' => 'Reset cache~~',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Display messages from %1$s~~',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Display up to %1$s messages in the %2$s menu.~~',
));

View File

@@ -1625,6 +1625,7 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
'UI:Newsroom:Preferences' => 'Newsroom preferences~~',
'UI:Newsroom:ConfigurationLink' => 'Configuration~~',
'UI:Newsroom:ResetCache' => 'Reset cache~~',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Display messages from %1$s~~',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Display up to %1$s messages in the %2$s menu.~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scrollable~~',
'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image~~',
'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one~~',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scrollable~~',
'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image~~',
'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one~~',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('DE DE', 'German', 'Deutsch', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'scrollbar',
'UI:Preferences:ChooseAPlaceholder' => 'Platzhalterbild für Profilbild',
'UI:Preferences:ChooseAPlaceholder+' => 'Nutzen Sie ein Platzhalterbild, das angezeigt wird, wenn der Kontakt, der mit dem User verlinkt ist, kein Profilbild gesetzt hat.',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -51,6 +51,7 @@ Dict::Add('EN US', 'English', 'English', array(
'UI:Preferences:General:Toasts:Top' => 'Top',
'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image',
'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated',
'UI:Preferences:Notifications' => 'Notifications',
'UI:Preferences:Notifications+' => 'Configure the notifications you want to receive <a href="%1$s">on this page</a>.',

View File

@@ -47,4 +47,5 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Desplazable',
'UI:Preferences:ChooseAPlaceholder' => 'Imagen de marcador de posición de usuario',
'UI:Preferences:ChooseAPlaceholder+' => 'Elija una imagen de marcador de posición que se mostrará si el contacto vinculado a su usuario no tiene uno',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('FR FR', 'French', 'Français', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Défilement',
'UI:Preferences:ChooseAPlaceholder' => 'Avatar de l\'utilisateur',
'UI:Preferences:ChooseAPlaceholder+' => 'Choisissez un avatar qui sera affiché si le contact associé à votre compte utilisateur n\'en possède pas',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Votre avatar a été mis à jour avec succès',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Görgethető',
'UI:Preferences:ChooseAPlaceholder' => 'Felhasználói helyettesítő kép',
'UI:Preferences:ChooseAPlaceholder+' => 'Válasszon ki egy helyettesítő képet, amely akkor jelenik meg, ha a kapcsolattartói beállításaiban még nem adott meg fényképet.',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,5 +47,5 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scorrevole',
'UI:Preferences:ChooseAPlaceholder' => 'Seleziona un\'immagine placeholder utente',
'UI:Preferences:ChooseAPlaceholder+' => 'Scegli un\'immagine placeholder che verrà visualizzata se il contatto associato al tuo utente non ne ha una',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('JA JP', 'Japanese', '日本語', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scrollable~~',
'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image~~',
'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one~~',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scrollbaar',
'UI:Preferences:ChooseAPlaceholder' => 'Gebruikersafbeelding placeholder',
'UI:Preferences:ChooseAPlaceholder+' => 'Kies een standaard afbeelding die getoond wordt als het contact gelinkt aan jouw gebruiker geen eigen afbeelding heeft.',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('PL PL', 'Polish', 'Polski', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Przewijana',
'UI:Preferences:ChooseAPlaceholder' => 'Obraz zastępczy użytkownika',
'UI:Preferences:ChooseAPlaceholder+' => 'Wybierz obraz zastępczy, który będzie wyświetlany, jeśli kontakt powiązany z Twoim użytkownikiem go nie ma',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Rolável',
'UI:Preferences:ChooseAPlaceholder' => 'Avatar padrão do usuário',
'UI:Preferences:ChooseAPlaceholder+' => 'Escolha uma imagem padrão que será exibida caso o contato associado ao usuário não possuir nenhuma',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Прокручиваемая',
'UI:Preferences:ChooseAPlaceholder' => 'Аватар пользователя',
'UI:Preferences:ChooseAPlaceholder+' => 'Выберите аватар, который будет отображаться, если у связанного с вашей учетной записью контакта нет фотографии',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scrollable~~',
'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image~~',
'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one~~',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => 'Scrollable~~',
'UI:Preferences:ChooseAPlaceholder' => 'User placeholder image~~',
'UI:Preferences:ChooseAPlaceholder+' => 'Choose a placeholder image that will be displayed if the contact linked to your user doesn\'t have one~~',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -47,4 +47,5 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array(
'UI:Preferences:Tabs:Scrollable:Scrollable' => '可滚动',
'UI:Preferences:ChooseAPlaceholder' => '用户的默认头像',
'UI:Preferences:ChooseAPlaceholder+' => '选择一个占位图片, 将在用户联系人没有设定头像图片时显示',
'UI:Preferences:ChooseAPlaceholder:Success:Message' => 'Your placeholder image has been successfully updated~~',
));

View File

@@ -1709,6 +1709,7 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array(
'UI:Newsroom:Preferences' => '消息选项',
'UI:Newsroom:ConfigurationLink' => '配置',
'UI:Newsroom:ResetCache' => '刷新缓存',
'UI:Newsroom:ResetCache:Success:Message' => 'Your newsroom cache has been successfully reset~~',
'UI:Newsroom:DisplayMessagesFor_Provider' => '显示来自%1$s的消息',
'UI:Newsroom:DisplayAtMost_X_Messages' => '在%2$s菜单中最多显示%1$s条消息.',
));

View File

@@ -363,6 +363,7 @@ $(function()
var sKey = this._makeCacheKey(idx);
localStorage.removeItem(sKey);
}
CombodoToast.OpenSuccessToast(Dict.S('UI:Newsroom:ResetCache:Success:Message'));
},
_makeCacheKey: function(idxProvider)
{

View File

@@ -1206,8 +1206,16 @@ try
$bApplyTransition = $oObj->DisplayStimulusForm($oP, $sStimulus, $aPrefillFormParam);
}
catch (ApplicationException $e) {
$bApplyTransition = false;
$sMessage = $e->getMessage();
$sSeverity = 'info';
$sSeverity = 'warning';
ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity);
}
catch (CoreCannotSaveObjectException $e) {
$bApplyTransition = false;
$aIssues = $e->getIssues();
$sMessage = $e->getHtmlMessage();
$sSeverity = 'warning';
ReloadAndDisplay($oP, $oObj, 'stimulus', $sMessage, $sSeverity);
}
if ($bApplyTransition) {

View File

@@ -114,7 +114,7 @@ function GetRuleResultFilter($iRuleId, $oDefinitionFilter, $oAppContext)
{
// The query returns only the valid elements, all the others are invalid
// Warning : we're generating a `WHERE ID IN`... query, and this could be very slow if there are lots of id !
$aValidRows = $oRuleFilter->ToDataArray(array('id'));
$aValidRows = $oRuleFilter->ToDataArray(array('id'));
$aValidIds = array();
foreach($aValidRows as $aRow)
{
@@ -431,7 +431,7 @@ try
} else {
try {
$oFilter = GetRuleResultFilter($oAuditRule->GetKey(), $oDefinitionFilter, $oAppContext);
$aErrors = $oFilter->ToDataArray(array('id'));
$aErrors = $oFilter->SelectAttributeToArray('id');
$iErrorsCount = count($aErrors);
foreach ($aErrors as $aErrorRow) {
$aObjectsWithErrors[$aErrorRow['id']] = true;
@@ -471,7 +471,7 @@ try
$oP->AddUiBlock($oErrorAlert);
continue;
}
$oAuditCategoryPanelBlock->SetColorFromColorSemantic($sClass);
$oAuditCategoryPanelBlock->AddCSSClass('ibo-audit--audit-category--panel');
$aData = [];
@@ -490,7 +490,7 @@ try
'nb_err' => array('label' => Dict::S('UI:Audit:HeaderNbErrors'), 'description' => Dict::S('UI:Audit:HeaderNbErrors')),
'percentage_ok' => array('label' => Dict::S('UI:Audit:PercentageOk'), 'description' => Dict::S('UI:Audit:PercentageOk')),
);
$oAttachmentTableBlock = DataTableUIBlockFactory::MakeForStaticData('', $aAttribs, $aData, null, [], "", array('pageLength' => -1));
$oAuditCategoryPanelBlock->AddSubBlock($oAttachmentTableBlock);
$aAuditCategoryPanels[] = $oAuditCategoryPanelBlock;

View File

@@ -434,6 +434,7 @@ JS
}
$sUserPicturePlaceHolderHtml .= '<a class="ibo-preferences--user-preferences--picture-placeholder--image'.$sAdditionalClass.'" data-image-name="'.$sUserPicture.'" data-role="ibo-preferences--user-preferences--picture-placeholder--image" href="#"> <img src="'.$sUserPicturesFolder.$sUserPicture.'"/> </a>';
}
$sUserPictureChangedSuccessMessage = Dict::S('UI:Preferences:ChooseAPlaceholder:Success:Message');
$oP->add_ready_script(
<<<JS
$('[data-role="ibo-preferences--user-preferences--picture-placeholder--image"]').on('click',function(){
@@ -458,6 +459,9 @@ $('[data-role="ibo-preferences--user-preferences--picture-placeholder--image"]')
// Update navigation menu
$('[data-role="ibo-navigation-menu--user-picture--image"]').attr('src', oData.data.image_url);
// Display success message
CombodoToast.OpenSuccessToast('{$sUserPictureChangedSuccessMessage}');
});
});
JS

View File

@@ -746,30 +746,110 @@ class DBSearchTest extends ItopDataTestCase
$oSearch->MakeSelectQuery();
self::assertTrue(true);
}
/**
* @dataProvider QueriesProvider
* @param $sOQL
*
* @return void
*/
public function testQueries($sOQL)
{
$oSearch = DBSearch::FromOQL($sOQL);
$oSet = new DBObjectSet($oSearch);
if ($oSet->Count() > 0) {
$aSelectedAliases = array_keys($oSearch->GetSelectedClasses());
$aFirstRow = $oSet->FetchAssoc();
$aAliases = array_keys($aFirstRow);
$this->assertEquals($aSelectedAliases, $aAliases);
}
}
/**
* @dataProvider QueriesProvider
* @param $sOQL
*
* @return void
*/
public function testQueries($sOQL)
{
$oSearch = DBSearch::FromOQL($sOQL);
$oSet = new DBObjectSet($oSearch);
if ($oSet->Count() > 0) {
$aSelectedAliases = array_keys($oSearch->GetSelectedClasses());
$aFirstRow = $oSet->FetchAssoc();
$aAliases = array_keys($aFirstRow);
$this->assertEquals($aSelectedAliases, $aAliases);
}
}
public function QueriesProvider()
{
return [
['SELECT L,P FROM Person AS P JOIN Location AS L ON P.location_id=L.id'],
['SELECT P,L FROM Person AS P JOIN Location AS L ON P.location_id=L.id'],
];
}
public function SelectAttributeToArrayProvider()
{
return array(
'select id from FunctionalCI' => array(
'SELECT FunctionalCI',
'id',
),
'select name from FunctionalCI' => array(
'SELECT FunctionalCI',
'name',
),
'select org_id from FunctionalCI' => array(
'SELECT FunctionalCI',
'org_id',
),
'select organization_name from FunctionalCI' => array(
'SELECT FunctionalCI',
'organization_name',
),
'select business_criticity from FunctionalCI' => array(
'SELECT FunctionalCI',
'business_criticity',
),
'select org_id from FunctionalCI' => array(
'SELECT FunctionalCI',
'org_id',
),
'select email from Person' => array(
'SELECT Person',
'email',
),
'select phone from Person' => array(
'SELECT Person',
'phone',
),
'select picture from Person' => array(
'SELECT Person',
'picture',
),
'select description from Ticket' => array(
'SELECT Ticket',
'description',
),
'select start_date from Ticket' => array(
'SELECT Ticket',
'start_date',
),
'select private_log from Ticket' => array(
'SELECT Ticket',
'private_log',
),
);
}
public function QueriesProvider()
{
return [
['SELECT L,P FROM Person AS P JOIN Location AS L ON P.location_id=L.id'],
['SELECT P,L FROM Person AS P JOIN Location AS L ON P.location_id=L.id'],
];
}
}
/**
* @dataProvider SelectAttributeToArrayProvider
*
* @return void
* @throws \ConfigException
* @throws \CoreException
* @throws \MissingQueryArgument
* @throws \MySQLException
* @throws \MySQLHasGoneAwayException
* @throws \OQLException
*/
public function testSelectAttributeToArray($sQuery, $sField){
$oSearch = \DBObjectSearch::FromOQL($sQuery);
$aResToDataArray=[];
$oSet = new \DBObjectSet($oSearch);
while ($oRecord = $oSet->Fetch()) {
$aMappedRow[$sField] =$oRecord->Get($sField);
$aResToDataArray[] = $aMappedRow;
}
array_multisort (array_column($aResToDataArray, $sField), SORT_DESC, $aResToDataArray);
$aResSelectColumnToArray = $oSearch->SelectAttributeToArray($sField);
array_multisort (array_column($aResSelectColumnToArray, $sField), SORT_DESC, $aResSelectColumnToArray);
self::assertEquals( $aResToDataArray, $aResSelectColumnToArray, 'The array constructed using the OQL query and the result of testSelectAttributeToArray must be the same');
}
}