mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-17 15:04:17 +01:00
Compare commits
18 Commits
feature/68
...
feature/li
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a9960235 | ||
|
|
336b5da2a7 | ||
|
|
2d8ecd465b | ||
|
|
34ba4fa0ce | ||
|
|
6f39ae5d76 | ||
|
|
08d22219f4 | ||
|
|
8a3d81c430 | ||
|
|
83a70daf68 | ||
|
|
078fc7bfb8 | ||
|
|
d5a8a3bb09 | ||
|
|
eaeb114754 | ||
|
|
a67d095c70 | ||
|
|
cfd32581b7 | ||
|
|
85a6bd0a05 | ||
|
|
92cd1e3f19 | ||
|
|
647f43882b | ||
|
|
b54022e2ad | ||
|
|
eaa80c5396 |
@@ -446,6 +446,12 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
||||
UR_ACTION_BULK_DELETE => 'bd',
|
||||
);
|
||||
|
||||
/**
|
||||
* @var array $aUsersProfilesList Cache of users' profiles. Hash array of user ID => [profile ID => profile friendlyname, profile ID => profile friendlyname, ...]
|
||||
* @since 2.7.10 3.0.4 3.1.1 3.2.0 N°6887
|
||||
*/
|
||||
private $aUsersProfilesList = [];
|
||||
|
||||
// Installation: create the very first user
|
||||
public function CreateAdministrator($sAdminUser, $sAdminPwd, $sLanguage = 'EN US')
|
||||
{
|
||||
@@ -758,8 +764,12 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
||||
$sAction = self::$m_aActionCodes[$iActionCode];
|
||||
|
||||
$bStatus = null;
|
||||
// Cache user's profiles
|
||||
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
|
||||
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
||||
}
|
||||
// Call the API of UserRights because it caches the list for us
|
||||
foreach(UserRights::ListProfiles($oUser) as $iProfile => $oProfile)
|
||||
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
||||
{
|
||||
$bGrant = $this->GetProfileActionGrant($iProfile, $sClass, $sAction);
|
||||
if (!is_null($bGrant))
|
||||
@@ -885,11 +895,16 @@ class UserRightsProfile extends UserRightsAddOnAPI
|
||||
// Note: this code is VERY close to the code of IsActionAllowed()
|
||||
$iUser = $oUser->GetKey();
|
||||
|
||||
// Cache user's profiles
|
||||
if(false === array_key_exists($iUser, $this->aUsersProfilesList)){
|
||||
$this->aUsersProfilesList[$iUser] = UserRights::ListProfiles($oUser);
|
||||
}
|
||||
|
||||
// Note: The object set is ignored because it was interesting to optimize for huge data sets
|
||||
// and acceptable to consider only the root class of the object set
|
||||
$bStatus = null;
|
||||
// Call the API of UserRights because it caches the list for us
|
||||
foreach(UserRights::ListProfiles($oUser) as $iProfile => $oProfile)
|
||||
foreach($this->aUsersProfilesList[$iUser] as $iProfile => $oProfile)
|
||||
{
|
||||
$bGrant = $this->GetClassStimulusGrant($iProfile, $sClass, $sStimulusCode);
|
||||
if (!is_null($bGrant))
|
||||
|
||||
@@ -335,7 +335,6 @@ abstract class AbstractPreferencesExtension implements iPreferencesExtension
|
||||
* A recommended pattern is to cache data by the mean of static members.
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method
|
||||
* @package UIExtensibilityAPI
|
||||
*/
|
||||
interface iApplicationUIExtension
|
||||
@@ -487,7 +486,6 @@ interface iApplicationUIExtension
|
||||
* @api
|
||||
* @package UIExtensibilityAPI
|
||||
* @since 2.7.0
|
||||
* @deprecated
|
||||
*/
|
||||
abstract class AbstractApplicationUIExtension implements iApplicationUIExtension
|
||||
{
|
||||
@@ -560,6 +558,7 @@ abstract class AbstractApplicationUIExtension implements iApplicationUIExtension
|
||||
* or through the GUI.
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method. More details on each method PHPDoc.
|
||||
* @package ORMExtensibilityAPI
|
||||
*/
|
||||
interface iApplicationObjectExtension
|
||||
@@ -574,6 +573,7 @@ interface iApplicationObjectExtension
|
||||
* Otherwise, the answer is definitively "yes, the object has changed".
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 No alternative available, this API was unstable and is abandoned
|
||||
* @param \cmdbAbstractObject $oObject The target object
|
||||
*
|
||||
* @return boolean True if something has changed for the target object
|
||||
@@ -587,6 +587,7 @@ interface iApplicationObjectExtension
|
||||
* Anyhow, this API can be called in other contexts such as the CSV import tool.
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_CHECK_TO_WRITE event instead
|
||||
* @param \cmdbAbstractObject $oObject The target object
|
||||
*
|
||||
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
|
||||
@@ -601,6 +602,7 @@ interface iApplicationObjectExtension
|
||||
* Please not that it is not possible to cascade deletion by this mean: only stopper issues can be handled.
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_CHECK_TO_DELETE event instead
|
||||
* @param \cmdbAbstractObject $oObject The target object
|
||||
*
|
||||
* @return string[] A list of errors message. An error message is made of one line and it can be displayed to the end-user.
|
||||
@@ -617,6 +619,7 @@ interface iApplicationObjectExtension
|
||||
* * {@see DBObject::Get()} : for a given attribute the new value that was persisted
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_WRITE event instead
|
||||
* @param \cmdbAbstractObject $oObject The target object
|
||||
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
|
||||
* once for all the changes made within the current page
|
||||
@@ -633,6 +636,7 @@ interface iApplicationObjectExtension
|
||||
* The method is called right <b>after</b> the object has been written to the database.
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_WRITE event instead
|
||||
* @param \cmdbAbstractObject $oObject The target object
|
||||
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
|
||||
* once for all the changes made within the current page
|
||||
@@ -647,6 +651,7 @@ interface iApplicationObjectExtension
|
||||
* The method is called right <b>before</b> the object will be deleted from the database.
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 Use EVENT_DB_AFTER_DELETE event instead
|
||||
* @param \cmdbAbstractObject $oObject The target object
|
||||
* @param CMDBChange|null $oChange A change context. Since 2.0 it is fine to ignore it, as the framework does maintain this information
|
||||
* once for all the changes made within the current page
|
||||
@@ -660,6 +665,7 @@ interface iApplicationObjectExtension
|
||||
* Extend this class instead of iApplicationObjectExtension if you don't need to overload all methods
|
||||
*
|
||||
* @api
|
||||
* @deprecated 3.1.0 N°4756 use the new event service instead, see {@see DBObject::FireEvent()} method
|
||||
* @package ORMExtensibilityAPI
|
||||
* @since 2.7.0
|
||||
*/
|
||||
|
||||
@@ -746,7 +746,9 @@ HTML
|
||||
$aArgs = array('this' => $this);
|
||||
|
||||
$sEditWhen = $oAttDef->GetEditWhen();
|
||||
$bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS || $sEditWhen === LINKSET_EDITWHEN_ON_HOST_EDITION);
|
||||
// Calculate if edit_when allows to edit based on current $bEditMode
|
||||
$bIsEditableBasedOnEditWhen = ($sEditWhen === LINKSET_EDITWHEN_ALWAYS) ||
|
||||
($bEditMode ? $sEditWhen === LINKSET_EDITWHEN_ON_HOST_EDITION : $sEditWhen === LINKSET_EDITWHEN_ON_HOST_DISPLAY);
|
||||
|
||||
$bReadOnly = ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE)) || !$bIsEditableBasedOnEditWhen;
|
||||
if ($bEditMode && (!$bReadOnly)) {
|
||||
@@ -758,9 +760,9 @@ HTML
|
||||
$oPage->add($sHTMLValue);
|
||||
} else {
|
||||
if ($oAttDef->IsIndirect()) {
|
||||
$oBlockLinkSetViewTable = new BlockIndirectLinkSetViewTable($oPage, $this, $sClass, $sAttCode, $oAttDef);
|
||||
$oBlockLinkSetViewTable = new BlockIndirectLinkSetViewTable($oPage, $this, $sClass, $sAttCode, $oAttDef, $bReadOnly);
|
||||
} else {
|
||||
$oBlockLinkSetViewTable = new BlockDirectLinkSetViewTable($oPage, $this, $sClass, $sAttCode, $oAttDef);
|
||||
$oBlockLinkSetViewTable = new BlockDirectLinkSetViewTable($oPage, $this, $sClass, $sAttCode, $oAttDef, $bReadOnly);
|
||||
}
|
||||
$oPage->AddUiBlock($oBlockLinkSetViewTable);
|
||||
}
|
||||
|
||||
@@ -1911,6 +1911,7 @@ class MenuBlock extends DisplayBlock
|
||||
// Check concurrent lock (can only be lock if we are handling a single object
|
||||
$bLocked = false;
|
||||
if ($iSetCount === 1) {
|
||||
$oSet->OptimizeColumnLoad(array($this->GetFilter()->GetClassAlias() => array()));
|
||||
$oObj = $oSet->Fetch();
|
||||
if (false === is_null($oObj)) {
|
||||
if (MetaModel::GetConfig()->Get('concurrent_lock_enabled')) {
|
||||
|
||||
@@ -248,6 +248,7 @@ class LoginWebPage extends NiceWebPage
|
||||
$oEmail = new Email();
|
||||
$oEmail->SetRecipientTO($sTo);
|
||||
$sFrom = MetaModel::GetConfig()->Get('forgot_password_from');
|
||||
$sFrom = utils::IsNullOrEmptyString($sFrom) ? MetaModel::GetConfig()->Get('email_default_sender_address') : $sFrom;
|
||||
$oEmail->SetRecipientFrom($sFrom);
|
||||
$oEmail->SetSubject(Dict::S('UI:ResetPwd-EmailSubject', $oUser->Get('login')));
|
||||
$sResetUrl = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?loginop=reset_pwd&auth_user='.urlencode($oUser->Get('login')).'&token='.urlencode($sToken);
|
||||
|
||||
@@ -976,7 +976,7 @@ HTML
|
||||
FormHelper::DisableAttributeBlobInputs($this->sTargetClass, $aFormExtraParams);
|
||||
|
||||
if(FormHelper::HasMandatoryAttributeBlobInputs($oNewObj)){
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal());
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE));
|
||||
}
|
||||
|
||||
cmdbAbstractObject::DisplayCreationForm($oPage, $this->sTargetClass, $oNewObj, array(), $aFormExtraParams);
|
||||
|
||||
@@ -145,7 +145,7 @@ JS
|
||||
FormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams);
|
||||
|
||||
if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal());
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE));
|
||||
}
|
||||
|
||||
cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aFormExtraParams);
|
||||
|
||||
@@ -8599,7 +8599,7 @@ class AttributeBlob extends AttributeDefinition
|
||||
public function RecordAttChange(DBObject $oObject, $original, $value): void
|
||||
{
|
||||
// N°6502 Don't record history if only the download count has changed
|
||||
if ($original->EqualsExceptDownloadsCount($value)) {
|
||||
if ((null !== $original) && (null !== $value) && $original->EqualsExceptDownloadsCount($value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1241,7 +1241,7 @@ abstract class MetaModel
|
||||
}
|
||||
$sTable = self::DBGetTable($sClass);
|
||||
|
||||
// Could be completed later with all the classes that are using a given table
|
||||
// Could be completed later with all the classes that are using a given table
|
||||
if (!array_key_exists($sTable, $aTables)) {
|
||||
$aTables[$sTable] = array();
|
||||
}
|
||||
@@ -3522,7 +3522,7 @@ abstract class MetaModel
|
||||
}
|
||||
|
||||
// Set the "host class" as soon as possible, since HierarchicalKeys use it for their 'target class' as well
|
||||
// and this needs to be know early (for Init_IsKnowClass 19 lines below)
|
||||
// and this needs to be know early (for Init_IsKnowClass 19 lines below)
|
||||
$oAtt->SetHostClass($sTargetClass);
|
||||
|
||||
// Some attributes could refer to a class
|
||||
@@ -3564,7 +3564,7 @@ abstract class MetaModel
|
||||
|
||||
self::$m_aAttribDefs[$sTargetClass][$oAtt->GetCode()] = $oAtt;
|
||||
self::$m_aAttribOrigins[$sTargetClass][$oAtt->GetCode()] = $sTargetClass;
|
||||
// Note: it looks redundant to put targetclass there, but a mix occurs when inheritance is used
|
||||
// Note: it looks redundant to put targetclass there, but a mix occurs when inheritance is used
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3764,7 +3764,7 @@ abstract class MetaModel
|
||||
self::$m_aStimuli[$sTargetClass][$oStimulus->GetCode()] = $oStimulus;
|
||||
|
||||
// I wanted to simplify the syntax of the declaration of objects in the biz model
|
||||
// Therefore, the reference to the host class is set there
|
||||
// Therefore, the reference to the host class is set there
|
||||
$oStimulus->SetHostClass($sTargetClass);
|
||||
}
|
||||
|
||||
@@ -4219,40 +4219,77 @@ abstract class MetaModel
|
||||
}
|
||||
else
|
||||
{
|
||||
$aCurrentUser = array();
|
||||
$aCurrentContact = array();
|
||||
$aCurrentUser = [];
|
||||
$aCurrentContact = [];
|
||||
foreach ($aExpectedArgs as $expression)
|
||||
{
|
||||
$aName = explode('->', $expression->GetName());
|
||||
if ($aName[0] == 'current_contact_id') {
|
||||
$aPlaceholders['current_contact_id'] = UserRights::GetContactId();
|
||||
}
|
||||
if ($aName[0] == 'current_user') {
|
||||
} else if ($aName[0] == 'current_user') {
|
||||
array_push($aCurrentUser, $aName[1]);
|
||||
}
|
||||
if ($aName[0] == 'current_contact') {
|
||||
} else if ($aName[0] == 'current_contact') {
|
||||
array_push($aCurrentContact, $aName[1]);
|
||||
}
|
||||
}
|
||||
if (count($aCurrentUser) > 0) {
|
||||
$oUser = UserRights::GetUserObject();
|
||||
$aPlaceholders['current_user->object()'] = $oUser;
|
||||
foreach ($aCurrentUser as $sField) {
|
||||
$aPlaceholders['current_user->'.$sField] = $oUser->Get($sField);
|
||||
}
|
||||
static::FillObjectPlaceholders($aPlaceholders, 'current_user', UserRights::GetUserObject(), $aCurrentUser);
|
||||
}
|
||||
if (count($aCurrentContact) > 0) {
|
||||
$oPerson = UserRights::GetContactObject();
|
||||
$aPlaceholders['current_contact->object()'] = $oPerson;
|
||||
foreach ($aCurrentContact as $sField) {
|
||||
$aPlaceholders['current_contact->'.$sField] = $oPerson->Get($sField);
|
||||
}
|
||||
static::FillObjectPlaceholders($aPlaceholders, 'current_contact', UserRights::GetContactObject(), $aCurrentContact);
|
||||
}
|
||||
}
|
||||
|
||||
return $aPlaceholders;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.1.1 N°6824
|
||||
* @param array $aPlaceholders
|
||||
* @param string $sPlaceHolderPrefix
|
||||
* @param ?\DBObject $oObject
|
||||
* @param array $aCurrentUser
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
private static function FillObjectPlaceholders(array &$aPlaceholders, string $sPlaceHolderPrefix, ?\DBObject $oObject, array $aCurrentUser) : void {
|
||||
$sPlaceHolderKey = $sPlaceHolderPrefix."->object()";
|
||||
if (is_null($oObject)){
|
||||
$aContext = [
|
||||
"current_user_id" => UserRights::GetUserId(),
|
||||
"null object type" => $sPlaceHolderPrefix,
|
||||
"fields" => $aCurrentUser,
|
||||
];
|
||||
IssueLog::Warning("Unresolved placeholders due to null object in current context", null,
|
||||
$aContext);
|
||||
$aPlaceholders[$sPlaceHolderKey] = \Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey);
|
||||
foreach ($aCurrentUser as $sField) {
|
||||
$sPlaceHolderKey = $sPlaceHolderPrefix . "->$sField";
|
||||
$aPlaceholders[$sPlaceHolderKey] = \Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey);
|
||||
}
|
||||
} else {
|
||||
$aPlaceholders[$sPlaceHolderKey] = $oObject;
|
||||
foreach ($aCurrentUser as $sField) {
|
||||
$sPlaceHolderKey = $sPlaceHolderPrefix . "->$sField";
|
||||
if (false === MetaModel::IsValidAttCode(get_class($oObject), $sField)){
|
||||
$aContext = [
|
||||
"current_user_id" => UserRights::GetUserId(),
|
||||
"obj_class" => get_class($oObject),
|
||||
"placeholder" => $sPlaceHolderKey,
|
||||
"invalid_field" => $sField,
|
||||
];
|
||||
IssueLog::Warning("Unresolved placeholder due to invalid attribute", null,
|
||||
$aContext);
|
||||
$aPlaceholders[$sPlaceHolderKey] = \Dict::Format("Core:Placeholder:CannotBeResolved", $sPlaceHolderKey);
|
||||
continue;
|
||||
}
|
||||
|
||||
$aPlaceholders[$sPlaceHolderKey] = $oObject->Get($sField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DBSearch $oFilter
|
||||
*
|
||||
@@ -6479,7 +6516,7 @@ abstract class MetaModel
|
||||
$aCache['m_aExtensionClassNames'] = self::$m_aExtensionClassNames;
|
||||
$aCache['m_Category2Class'] = self::$m_Category2Class;
|
||||
$aCache['m_aRootClasses'] = self::$m_aRootClasses; // array of "classname" => "rootclass"
|
||||
$aCache['m_aParentClasses'] = self::$m_aParentClasses; // array of ("classname" => array of "parentclass")
|
||||
$aCache['m_aParentClasses'] = self::$m_aParentClasses; // array of ("classname" => array of "parentclass")
|
||||
$aCache['m_aChildClasses'] = self::$m_aChildClasses; // array of ("classname" => array of "childclass")
|
||||
$aCache['m_aClassParams'] = self::$m_aClassParams; // array of ("classname" => array of class information)
|
||||
$aCache['m_aAttribDefs'] = self::$m_aAttribDefs; // array of ("classname" => array of attributes)
|
||||
|
||||
@@ -49,6 +49,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Core:AttributeTagSet' => 'List of tags',
|
||||
'Core:AttributeTagSet+' => '',
|
||||
'Core:AttributeSet:placeholder' => 'click to add',
|
||||
'Core:Placeholder:CannotBeResolved' => '(%1$s : cannot be resolved)',
|
||||
'Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromClass' => '%1$s (%2$s)',
|
||||
'Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromOneChildClass' => '%1$s (%2$s from %3$s)',
|
||||
'Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromSeveralChildClasses' => '%1$s (%2$s from child classes)',
|
||||
|
||||
@@ -248,7 +248,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
Dict::Add('EN US', 'English', 'English', array(
|
||||
'Class:URP_UserOrg' => 'User organizations',
|
||||
'Class:URP_UserOrg+' => 'Allowed organizations',
|
||||
'Class:URP_UserOrg/Name' => 'LinkGG between %1$s and %2$s',
|
||||
'Class:URP_UserOrg/Name' => 'Link between %1$s and %2$s',
|
||||
'Class:URP_UserOrg/Attribute:userid' => 'User',
|
||||
'Class:URP_UserOrg/Attribute:userid+' => 'user account',
|
||||
'Class:URP_UserOrg/Attribute:userlogin' => 'Login',
|
||||
|
||||
@@ -39,6 +39,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Core:AttributeTagSet' => 'Liste d\'étiquettes',
|
||||
'Core:AttributeTagSet+' => '',
|
||||
'Core:AttributeSet:placeholder' => 'cliquer pour ajouter',
|
||||
'Core:Placeholder:CannotBeResolved' => '(%1$s : non remplacé)',
|
||||
'Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromClass' => '%1$s (%2$s)',
|
||||
'Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromOneChildClass' => '%1$s (%2$s de la classe %3$s)',
|
||||
'Core:AttributeClassAttCodeSet:ItemLabel:AttributeFromSeveralChildClasses' => '%1$s (%2$s d\'une sous-classe)',
|
||||
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('CS CZ', 'Czech', 'Čeština', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('DA DA', 'Danish', 'Dansk', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('DE DE', 'German', 'Deutsch', array(
|
||||
'UI:Object:Modal:Title' => 'Ein Objekt erstellen',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -19,5 +19,7 @@
|
||||
|
||||
Dict::Add('EN US', 'English', 'English', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui n\'est pas supporté en mode pop-up. La création/modification de cet objet risque d\'être incomplète et pourra être complété dans un formulaire en pleine page.',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être renseigné en mode pop-up. La création de cet objet sera incomplète et pourra être complétée dans un formulaire en pleine page.',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être renseigné en mode pop-up. Cet objet est incomplet, il peut être complété dans un formulaire en pleine page.',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'Ce formulaire contient un attribut fichier obligatoire qui ne peut pas être modifié en mode pop-up.',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('IT IT', 'Italian', 'Italiano', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('JA JP', 'Japanese', '日本語', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('PL PL', 'Polish', 'Polski', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('RU RU', 'Russian', 'Русский', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('SK SK', 'Slovak', 'Slovenčina', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('TR TR', 'Turkish', 'Türkçe', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -18,5 +18,7 @@
|
||||
*/
|
||||
Dict::Add('ZH CN', 'Chinese', '简体中文', array(
|
||||
'UI:Object:Modal:Title' => 'Create an object~~',
|
||||
'UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which is not supported in modal mode. The creation/modification of this object may be incomplete and may be completed in a full-page form.~~',
|
||||
'UI:Object:Modal:Create:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. The creation of this object will be incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains a mandatory file attribute which cannot be set in modal mode. This object is incomplete, edit it in a full-page form to complete it.~~',
|
||||
'UI:Object:Modal:Modify:Filled:MandatoryAttributeBlobInputs:Warning:Text' => 'This form contains mandatory file attribute which cannot be modified in modal mode.~~',
|
||||
));
|
||||
@@ -25,6 +25,23 @@ use utils;
|
||||
*/
|
||||
class FormHelper
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.1 N°6861
|
||||
*/
|
||||
public const ENUM_MANDATORY_BLOB_MODE_CREATE = 'Create';
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.1 N°6861
|
||||
*/
|
||||
public const ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY = 'Modify';
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.1 N°6861
|
||||
*/
|
||||
public const ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED = 'Modify:Filled';
|
||||
|
||||
|
||||
/**
|
||||
* DisableAttributeBlobInputs.
|
||||
*
|
||||
@@ -58,6 +75,26 @@ class FormHelper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an attribute code if the object has a mandatory attribute blob, null otherwise
|
||||
*
|
||||
* @see N°6861 - Display warning when creating/editing a mandatory blob in modal
|
||||
*
|
||||
* @param \DBObject $oObject
|
||||
*
|
||||
* @return string|null
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public static function GetMandatoryAttributeBlobInputs(DBObject $oObject): ?string
|
||||
{
|
||||
foreach (MetaModel::ListAttributeDefs(get_class($oObject)) as $sAttCode => $oAttDef) {
|
||||
if ($oAttDef instanceof AttributeBlob && (!$oAttDef->IsNullAllowed() || ($oObject->GetFormAttributeFlags($sAttCode) & OPT_ATT_MANDATORY))) {
|
||||
return $sAttCode;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the object has a mandatory attribute blob
|
||||
*
|
||||
@@ -70,25 +107,29 @@ class FormHelper
|
||||
*/
|
||||
public static function HasMandatoryAttributeBlobInputs(DBObject $oObject): bool
|
||||
{
|
||||
foreach (MetaModel::ListAttributeDefs(get_class($oObject)) as $sAttCode => $oAttDef) {
|
||||
if ($oAttDef instanceof AttributeBlob && (!$oAttDef->IsNullAllowed() || ($oObject->GetFormAttributeFlags($sAttCode) & OPT_ATT_MANDATORY))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return self::GetMandatoryAttributeBlobInputs($oObject) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Alert explaining what will happen when a mandatory attribute blob is displayed in a form
|
||||
*
|
||||
* @see N°6861 - Display warning when creating/editing a mandatory blob in modal
|
||||
* @see self::ENUM_MANDATORY_BLOB_MODE_XXX
|
||||
*
|
||||
* @param string $sMode
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Alert\Alert
|
||||
*/
|
||||
public static function GetAlertForMandatoryAttributeBlobInputsInModal(): Alert
|
||||
public static function GetAlertForMandatoryAttributeBlobInputsInModal(string $sMode = self::ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY): Alert
|
||||
{
|
||||
$oAlert = AlertUIBlockFactory::MakeForWarning('',Dict::S('UI:Object:Modal:MandatoryAttributeBlobInputs:Warning:Text'));
|
||||
return $oAlert;
|
||||
$sMessage = Dict::S('UI:Object:Modal:'.$sMode.':MandatoryAttributeBlobInputs:Warning:Text');
|
||||
|
||||
// If the mandatory attribute is already filled, there's no risk to make an object incomplete so we display an information level alert
|
||||
if($sMode === self::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED){
|
||||
return AlertUIBlockFactory::MakeForInformation('', $sMessage);
|
||||
}
|
||||
|
||||
return AlertUIBlockFactory::MakeForWarning('', $sMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,11 +91,11 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
* @param string $sObjectClass
|
||||
* @param string $sAttCode
|
||||
* @param AttributeLinkedSet $oAttDef
|
||||
* @param bool $bIsReadOnly
|
||||
*
|
||||
* @throws CoreException
|
||||
* @throws Exception
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function __construct(WebPage $oPage, DBObject $oDbObject, string $sObjectClass, string $sAttCode, AttributeLinkedSet $oAttDef)
|
||||
public function __construct(WebPage $oPage, DBObject $oDbObject, string $sObjectClass, string $sAttCode, AttributeLinkedSet $oAttDef, bool $bIsReadOnly = false)
|
||||
{
|
||||
parent::__construct("links_view_table_$sAttCode", ["ibo-block-links-table"]);
|
||||
|
||||
@@ -105,6 +105,7 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
$this->sObjectClass = $sObjectClass;
|
||||
$this->oDbObject = $oDbObject;
|
||||
$this->sTableId = 'rel_'.$this->sAttCode;
|
||||
$this->bIsAttEditable = !$bIsReadOnly;
|
||||
$this->SetDataAttributes(['role' => 'ibo-block-links-table', 'link-attcode' => $sAttCode, 'link-class' => $this->oAttDef->GetLinkedClass()]);
|
||||
// Initialization
|
||||
$this->Init();
|
||||
@@ -122,7 +123,6 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
private function Init()
|
||||
{
|
||||
$this->sTargetClass = $this->GetTargetClass();
|
||||
$this->InitIsAttEditable();
|
||||
|
||||
// User rights
|
||||
$this->bIsAllowCreate = $this->bIsAttEditable && UserRights::IsActionAllowed($this->oAttDef->GetLinkedClass(), UR_ACTION_CREATE) == UR_ALLOWED_YES;
|
||||
@@ -199,38 +199,8 @@ abstract class AbstractBlockLinkSetViewTable extends UIContentBlock
|
||||
$oBlock = new DisplayBlock($oLinkSet->GetFilter(), DisplayBlock::ENUM_STYLE_LIST_IN_OBJECT, false);
|
||||
$this->AddSubBlock($oBlock->GetRenderContent($oPage, $this->GetExtraParam(), $this->sTableId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws \CoreException
|
||||
*/
|
||||
private function InitIsAttEditable(): void
|
||||
{
|
||||
$iFlags = OPT_ATT_NORMAL;
|
||||
|
||||
if ($this->oDbObject->IsNew())
|
||||
{
|
||||
$iFlags = $this->oDbObject->GetInitialStateAttributeFlags($this->sAttCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
$iFlags = $this->oDbObject->GetAttributeFlags($this->sAttCode);
|
||||
}
|
||||
|
||||
$bEditWhen = $this->IsEditableBasedOnEditWhen();
|
||||
|
||||
$this->bIsAttEditable = !($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE | OPT_ATT_HIDDEN)) && $bEditWhen;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares Linkset attribute edit_when values with its usage requirements
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.1.1 3.2.0 N°6385
|
||||
*/
|
||||
protected function IsEditableBasedOnEditWhen(): bool{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* GetTableId.
|
||||
|
||||
@@ -179,13 +179,4 @@ class BlockDirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
|
||||
return $aDefaults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function IsEditableBasedOnEditWhen(): bool
|
||||
{
|
||||
$sEditWhen = $this->oAttDef->GetEditWhen();
|
||||
return $sEditWhen === LINKSET_EDITWHEN_ALWAYS || $sEditWhen === LINKSET_EDITWHEN_ON_HOST_DISPLAY;
|
||||
}
|
||||
}
|
||||
@@ -126,13 +126,4 @@ class BlockIndirectLinkSetViewTable extends AbstractBlockLinkSetViewTable
|
||||
|
||||
return $sAttCodesToDisplay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function IsEditableBasedOnEditWhen(): bool
|
||||
{
|
||||
$sEditWhen = $this->oAttDef->GetEditWhen();
|
||||
return $sEditWhen === LINKSET_EDITWHEN_ALWAYS || $sEditWhen === LINKSET_EDITWHEN_ON_HOST_DISPLAY;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ JS;
|
||||
FormHelper::DisableAttributeBlobInputs($sRealClass, $aFormExtraParams);
|
||||
|
||||
if(FormHelper::HasMandatoryAttributeBlobInputs($oObjToClone)){
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal());
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE));
|
||||
}
|
||||
|
||||
$aFormExtraParams['js_handlers']['cancel_button_on_click'] =
|
||||
@@ -210,13 +210,14 @@ JS
|
||||
}
|
||||
return $oPage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \iTopWebPage|\AjaxPage Object edit form in its webpage
|
||||
* @throws \ApplicationException
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @throws \SecurityException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function OperationModify()
|
||||
{
|
||||
@@ -298,7 +299,14 @@ JS;
|
||||
FormHelper::DisableAttributeBlobInputs($sClass, $aFormExtraParams);
|
||||
|
||||
if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal());
|
||||
$sMandatoryBlobAttCode = FormHelper::GetMandatoryAttributeBlobInputs($oObj);
|
||||
$sAlertFormMandatoryAttMessageMode = FormHelper::ENUM_MANDATORY_BLOB_MODE_MODIFY_EMPTY;
|
||||
$oMandatoryBlobAttCodeValue = $oObj->Get($sMandatoryBlobAttCode);
|
||||
// If the current value of the mandatory attribute is not empty, display a different message
|
||||
if($oMandatoryBlobAttCodeValue instanceof \ormDocument && !$oMandatoryBlobAttCodeValue->IsEmpty()){
|
||||
$sAlertFormMandatoryAttMessageMode = FormHelper::ENUM_MANDATORY_BLOB_MODE_MODIFY_FILLED;
|
||||
}
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal($sAlertFormMandatoryAttMessageMode));
|
||||
}
|
||||
} else {
|
||||
$oPage = new iTopWebPage('', $bPrintable);
|
||||
|
||||
@@ -230,7 +230,7 @@ JS
|
||||
FormHelper::DisableAttributeBlobInputs($sRealClass, $aExtraParams);
|
||||
|
||||
if(FormHelper::HasMandatoryAttributeBlobInputs($oObj)){
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal());
|
||||
$oPage->AddUiBlock(FormHelper::GetAlertForMandatoryAttributeBlobInputsInModal(FormHelper::ENUM_MANDATORY_BLOB_MODE_CREATE));
|
||||
}
|
||||
|
||||
cmdbAbstractObject::DisplayCreationForm($oPage, $sRealClass, $oObj, array(), $aExtraParams);
|
||||
|
||||
@@ -38,7 +38,7 @@ class ObjectRepository
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
static public function Search(string $sObjectClass, array $aFieldsToLoad, string $sSearch): ?array
|
||||
public static function Search(string $sObjectClass, array $aFieldsToLoad, string $sSearch): ?array
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -82,7 +82,7 @@ class ObjectRepository
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
static public function SearchFromOql(string $sObjectClass, array $aFieldsToLoad, string $sOql, string $sSearch, DBObject $oThisObject = null): ?array
|
||||
public static function SearchFromOql(string $sObjectClass, array $aFieldsToLoad, string $sOql, string $sSearch, DBObject $oThisObject = null): ?array
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -117,7 +117,7 @@ class ObjectRepository
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
static private function DBSetToObjectArray(iDBObjectSetIterator $oDbObjectSet, string $sObjectClass, array $aFieldsToLoad): array
|
||||
private static function DBSetToObjectArray(iDBObjectSetIterator $oDbObjectSet, string $sObjectClass, array $aFieldsToLoad): array
|
||||
{
|
||||
// Retrieve friendly name complementary specification
|
||||
$aComplementAttributeSpec = MetaModel::GetNameSpec($sObjectClass, FriendlyNameType::COMPLEMENTARY);
|
||||
@@ -158,7 +158,7 @@ class ObjectRepository
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
static public function GetDefaultFieldsToLoad(array $aComplementAttributeSpec, string $sObjectImageAttCode)
|
||||
public static function GetDefaultFieldsToLoad(array $aComplementAttributeSpec, string $sObjectImageAttCode)
|
||||
{
|
||||
// Friendly name complementary fields
|
||||
$aFieldsToLoad = $aComplementAttributeSpec[1];
|
||||
@@ -185,7 +185,7 @@ class ObjectRepository
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
static public function ComputeOthersData(DBObject $oDbObject, string $sClass, array $aData, array $aComplementAttributeSpec, string $sObjectImageAttCode): array
|
||||
public static function ComputeOthersData(DBObject $oDbObject, string $sClass, array $aData, array $aComplementAttributeSpec, string $sObjectImageAttCode): array
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -196,6 +196,7 @@ class ObjectRepository
|
||||
$aData['obsolescence_flag'] = $oDbObject->IsObsolete();
|
||||
|
||||
// Additional fields
|
||||
$sFriendlynameForHtml = utils::EscapeHtml($aData['friendlyname']);
|
||||
if (count($aComplementAttributeSpec[1]) > 0) {
|
||||
$aData['has_additional_field'] = true;
|
||||
$aArguments = [];
|
||||
@@ -203,9 +204,10 @@ class ObjectRepository
|
||||
$aArguments[] = $oDbObject->Get($sAdditionalField);
|
||||
}
|
||||
$aData['additional_field'] = vsprintf($aComplementAttributeSpec[0], $aArguments);
|
||||
$aData['full_description'] = "{$aData['friendlyname']}<br><i><small>{$aData['additional_field']}</small></i>";
|
||||
$sAdditionalFieldForHtml = utils::EscapeHtml($aData['additional_field']);
|
||||
$aData['full_description'] = "{$sFriendlynameForHtml}<br><i><small>{$sAdditionalFieldForHtml}</small></i>";
|
||||
} else {
|
||||
$aData['full_description'] = $aData['friendlyname'];
|
||||
$aData['full_description'] = $sFriendlynameForHtml;
|
||||
}
|
||||
|
||||
// Image
|
||||
@@ -308,7 +310,7 @@ class ObjectRepository
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static public function DeleteFromOql(string $sOql): bool
|
||||
public static function DeleteFromOql(string $sOql): bool
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Core;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use MetaModel;
|
||||
use PHPUnit\Framework\ExpectationFailedException;
|
||||
use UserRights;
|
||||
use VariableExpression;
|
||||
|
||||
/**
|
||||
* Class MetaModelMagicPlaceholderTest
|
||||
* @since 3.1.1 N°6824
|
||||
* @covers MetaModel::AddMagicPlaceholders()
|
||||
* @package Combodo\iTop\Test\UnitTest\Core
|
||||
*/
|
||||
class MetaModelMagicPlaceholderTest extends ItopDataTestCase
|
||||
{
|
||||
/**
|
||||
* Asserts that two array with DBObjects are equal (the important is to check the {class,id} couple
|
||||
*
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
* @throws ExpectationFailedException
|
||||
*/
|
||||
public static function assertEqualsShallow($expected, $actual, string $message = ''): void
|
||||
{
|
||||
if (is_array($expected)) {
|
||||
foreach ($expected as $key => $value) {
|
||||
if ($value instanceof \DBObject) {
|
||||
$expected[$key] = get_class($value).'::'.$value->GetKey();
|
||||
}
|
||||
}
|
||||
foreach ($actual as $key => $value) {
|
||||
if ($value instanceof \DBObject) {
|
||||
$actual[$key] = get_class($value).'::'.$value->GetKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
parent::assertEquals($expected, $actual, $message);
|
||||
}
|
||||
|
||||
public function testAddMagicPlaceholdersWhenLoggedInUserHasAContact()
|
||||
{
|
||||
// Create data fixture => User + Person
|
||||
$iNum = uniqid();
|
||||
$sLogin = "AddMagicPlaceholders".$iNum;
|
||||
$this->CreateTestOrganization();
|
||||
$oPerson = $this->CreatePerson($iNum);
|
||||
$sContactId = $oPerson->GetKey();
|
||||
$oUser = $this->CreateUser($sLogin, 1, "Abcdef@12345678", $oPerson->GetKey());
|
||||
UserRights::Login($sLogin);
|
||||
|
||||
// Test legacy behavior (no expected args)
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"]);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
'current_contact_id' => $sContactId,
|
||||
'current_user->object()' => $oUser,
|
||||
'current_contact->object()' => $oPerson,
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders without second parameter (legacy) should add "curent_contact_id/current_user->object()/current_contact->object()"'
|
||||
);
|
||||
|
||||
// With expected arguments explicitly given as "none"
|
||||
$aExpectedArgs = [];
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders should add only expected arguments'
|
||||
);
|
||||
|
||||
// Test new behavior (with expected args)
|
||||
$aExpectedArgs = [
|
||||
new VariableExpression('current_user->login'),
|
||||
new VariableExpression('current_user->not_existing_attribute'),
|
||||
new VariableExpression('current_contact_id'),
|
||||
new VariableExpression('current_contact->org_id'),
|
||||
new VariableExpression('current_contact->not_existing_attribute'),
|
||||
];
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
'current_contact_id' => $sContactId,
|
||||
'current_user->object()' => $oUser,
|
||||
'current_user->not_existing_attribute' => '(current_user->not_existing_attribute : cannot be resolved)',
|
||||
'current_user->login' => $sLogin,
|
||||
'current_contact->object()' => $oPerson,
|
||||
'current_contact->org_id' => $oPerson->Get('org_id'),
|
||||
'current_contact->not_existing_attribute' => '(current_contact->not_existing_attribute : cannot be resolved)',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders should add expected arguments and render them with an explicit error when the information could not be known'
|
||||
);
|
||||
}
|
||||
|
||||
public function testAddMagicPlaceholdersWhenLoggedInUserHasNoContact()
|
||||
{
|
||||
// Create data fixture => User without contact
|
||||
$iNum = uniqid();
|
||||
$sLogin = "AddMagicPlaceholders".$iNum;
|
||||
$oUser = $this->CreateContactlessUser($sLogin, 1, "Abcdef@12345678");
|
||||
UserRights::Login($sLogin);
|
||||
|
||||
// Test legacy behavior (no expected args)
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"]);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
'current_contact_id' => 0,
|
||||
'current_user->object()' => $oUser,
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders without second parameter (legacy) should add "current_contact_id=0/current_user->object()"'
|
||||
);
|
||||
|
||||
// Test with expected arguments explicitly given as "none"
|
||||
$aExpectedArgs = [];
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders should add only expected arguments'
|
||||
);
|
||||
|
||||
// Test with a few expected arguments, some of which being invalid attributes
|
||||
$aExpectedArgs = [
|
||||
new VariableExpression('current_user->login'),
|
||||
new VariableExpression('current_user->not_existing_attribute'),
|
||||
new VariableExpression('current_contact_id'),
|
||||
new VariableExpression('current_contact->org_id'),
|
||||
new VariableExpression('current_contact->not_existing_attribute'),
|
||||
];
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
'current_contact_id' => 0,
|
||||
'current_user->object()' => $oUser,
|
||||
'current_user->not_existing_attribute' => '(current_user->not_existing_attribute : cannot be resolved)',
|
||||
'current_user->login' => $sLogin,
|
||||
'current_contact->object()' => '(current_contact->object() : cannot be resolved)',
|
||||
'current_contact->org_id' => '(current_contact->org_id : cannot be resolved)',
|
||||
'current_contact->not_existing_attribute' => '(current_contact->not_existing_attribute : cannot be resolved)',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders should add expected arguments and render them with an explicit error when the information could not be known'
|
||||
);
|
||||
}
|
||||
|
||||
public function testAddMagicPlaceholdersWhenThereIsNoLoggedInUser()
|
||||
{
|
||||
// Test legacy behavior (no expected args)
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"]);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
'current_contact_id' => '',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders without second parameter (legacy) should add "curent_contact_id"'
|
||||
);
|
||||
|
||||
// Test with expected arguments explicitly given as "none"
|
||||
$aExpectedArgs = [];
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders should add only expected arguments'
|
||||
);
|
||||
|
||||
// Test with a few expected arguments, some of which being invalid attributes
|
||||
$aExpectedArgs = [
|
||||
new VariableExpression('current_user->login'),
|
||||
new VariableExpression('current_user->not_existing_attribute'),
|
||||
new VariableExpression('current_contact_id'),
|
||||
new VariableExpression('current_contact->org_id'),
|
||||
new VariableExpression('current_contact->not_existing_attribute'),
|
||||
];
|
||||
$aPlaceholders = MetaModel::AddMagicPlaceholders(['gabu' => "zomeu"], $aExpectedArgs);
|
||||
$this->assertEqualsShallow(
|
||||
[
|
||||
'gabu' => 'zomeu',
|
||||
'current_contact_id' => '',
|
||||
'current_user->object()' => '(current_user->object() : cannot be resolved)',
|
||||
'current_user->not_existing_attribute' => '(current_user->not_existing_attribute : cannot be resolved)',
|
||||
'current_user->login' => '(current_user->login : cannot be resolved)',
|
||||
'current_contact->object()' => '(current_contact->object() : cannot be resolved)',
|
||||
'current_contact->org_id' => '(current_contact->org_id : cannot be resolved)',
|
||||
'current_contact->not_existing_attribute' => '(current_contact->not_existing_attribute : cannot be resolved)',
|
||||
],
|
||||
$aPlaceholders,
|
||||
'AddMagicPlaceholders should add expected arguments and render them with an explicit error when the information could not be known'
|
||||
);
|
||||
}
|
||||
}
|
||||
142
tests/php-unit-tests/unitary-tests/core/ormDocumentTest.php
Normal file
142
tests/php-unit-tests/unitary-tests/core/ormDocumentTest.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/*!
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Core;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use ormDocument;
|
||||
|
||||
/**
|
||||
* Tests of the ormDocument class
|
||||
*/
|
||||
class ormDocumentTest extends ItopDataTestCase
|
||||
{
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
protected function LoadRequiredItopFiles(): void
|
||||
{
|
||||
parent::LoadRequiredItopFiles();
|
||||
|
||||
$this->RequireOnceItopFile('core/ormdocument.class.inc.php');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $aDocAData
|
||||
* @param array $aDocBData
|
||||
* @param bool $bExpectedResult
|
||||
*
|
||||
* @dataProvider EqualsExceptDownloadsCountProvider
|
||||
*/
|
||||
public function testEqualsExceptDownloadsCount(array $aDocAData, array $aDocBData, bool $bExpectedResult)
|
||||
{
|
||||
$oDocA = new ormDocument(base64_decode($aDocAData[0]), $aDocAData[1], $aDocAData[2], $aDocAData[3]);
|
||||
$oDocB = new ormDocument(base64_decode($aDocBData[0]), $aDocBData[1], $aDocBData[2], $aDocBData[3]);
|
||||
|
||||
$bTestedResult = $oDocA->EqualsExceptDownloadsCount($oDocB);
|
||||
$this->assertSame($bExpectedResult, $bTestedResult);
|
||||
}
|
||||
|
||||
public function EqualsExceptDownloadsCountProvider(): array
|
||||
{
|
||||
$sFirstDummyTextFileContentBase64 = "Rmlyc3Q=";
|
||||
$sSecondDummyTextFileContentBase64 = "U2Vjb25k";
|
||||
|
||||
return [
|
||||
'Total different files' => [
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
[
|
||||
$sSecondDummyTextFileContentBase64,
|
||||
"image/png",
|
||||
"b.png",
|
||||
1
|
||||
],
|
||||
false,
|
||||
],
|
||||
'Different data only' => [
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
[
|
||||
$sSecondDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
false,
|
||||
],
|
||||
'Different mime types only' => [
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"image/png",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
false,
|
||||
],
|
||||
'Different file names only' => [
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"b.txt",
|
||||
0
|
||||
],
|
||||
false,
|
||||
],
|
||||
'Different download counts only' => [
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
1
|
||||
],
|
||||
true,
|
||||
],
|
||||
'Identical files, different object instances' => [
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
[
|
||||
$sFirstDummyTextFileContentBase64,
|
||||
"text/plain",
|
||||
"a.txt",
|
||||
0
|
||||
],
|
||||
false,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user