diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 438ec07e8..580bab4f4 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -279,7 +279,7 @@ abstract class AttributeDefinition */ public function CheckValue(DBObject $oHostObject, $value) { - // todo: factorize here the cases implemented into DBObject + // later: factorize here the cases implemented into DBObject return true; } @@ -5898,8 +5898,10 @@ class AttributeExternalField extends AttributeDefinition * @see TagSetFieldData * @since 2.6 N°931 tag fields */ -class AttributeTagSet extends AttributeString +class AttributeTagSet extends AttributeDBField { + const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_STRING; + public function GetEditClass() { return "String"; } @@ -5920,11 +5922,16 @@ class AttributeTagSet extends AttributeString protected function GetSQLCol($bFullSpec = false) { - return 'VARCHAR(1024)' + return 'VARCHAR(255)' .CMDBSource::GetSqlStringColumnDefinition() .($bFullSpec ? $this->GetSQLColSpec() : ''); } + public function GetMaxSize() + { + return 255; + } + public function RequiresIndex() {return true;} public function RequiresFullTextIndex() {return true;} @@ -5937,16 +5944,6 @@ class AttributeTagSet extends AttributeString return ($val1 == $val2); } - public function GetType() - { - return Dict::S('Core:TagSetFieldData'); - } - - public function GetTypeDesc() - { - return Dict::S('Core:TagSetFieldData+'); - } - /** * force an allowed value (type conversion and possibly forces a value as mySQL would do upon writing! * @@ -5964,9 +5961,43 @@ class AttributeTagSet extends AttributeString $aTagCodes = explode(' ', "$proposedValue"); $oTagSet->SetValue($aTagCodes); } + elseif ($proposedValue instanceof ormTagSet) + { + $oTagSet = $proposedValue; + } return $oTagSet; } + + public function GetNullValue() { + return new ormTagSet(MetaModel::GetAttributeOrigin($this->GetHostClass(), $this->GetCode()), $this->GetCode()); + } + + public function IsNull($proposedValue) + { + /** @var \ormTagSet $proposedValue */ + return count($proposedValue->GetValue()) == 0; + } + + /** + * To be overloaded for localized enums + * + * @param $sValue + * + * @return string label corresponding to the given value (in plain text) + */ + public function GetValueLabel($sValue) + { + // TODO + return $sValue; + } + + /** + * @param $value + * + * @return string + * @throws \CoreWarning + */ public function ScalarToSQL($value) { if (empty($value)) @@ -5992,6 +6023,7 @@ class AttributeTagSet extends AttributeString */ public function GetAsHTML($value, $oHostObject = null, $bLocalize = true) { + // TODO $bLocalize = true if (is_object($value) && ($value instanceof ormTagSet)) { $aValues = $value->GetValue(); @@ -6010,6 +6042,7 @@ class AttributeTagSet extends AttributeString */ public function GetAsXML($value, $oHostObject = null, $bLocalize = true) { + // TODO $bLocalize = true if (is_object($value) && ($value instanceof ormTagSet)) { $sRes = "\n"; @@ -6040,19 +6073,16 @@ class AttributeTagSet extends AttributeString */ public function GetAsCSV($value, $sSeparator = ',', $sTextQualifier = '"', $oHostObject = null, $bLocalize = true, $bConvertToPlainText = false) { - $sSepItem = MetaModel::GetConfig()->Get('link_set_item_separator'); - + // TODO $bLocalize = true if (is_object($value) && ($value instanceof ormTagSet)) { $aValues = $value->GetValue(); - $sRes = implode($sSepItem, $aValues); + $sRes = implode(' ', $aValues); } else { $sRes = ''; } - $sRes = str_replace($sTextQualifier, $sTextQualifier.$sTextQualifier, $sRes); - $sRes = $sTextQualifier.$sRes.$sTextQualifier; return $sRes; } @@ -6080,6 +6110,7 @@ class AttributeTagSet extends AttributeString */ public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true) { + // TODO $bLocalize = true if (is_object($value) && ($value instanceof ormTagSet)) { $aValues = $value->GetValue(); @@ -6087,7 +6118,7 @@ class AttributeTagSet extends AttributeString switch ($sVerb) { case '': - return implode("\n", $aValues); + return implode(' ', $aValues); case 'html': return ''; diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php index 3664f03bc..a46a8c531 100644 --- a/dictionaries/en.dictionary.itop.core.php +++ b/dictionaries/en.dictionary.itop.core.php @@ -37,6 +37,12 @@ Dict::Add('EN US', 'English', 'English', array( 'Core:AttributeTagSet' => 'List of tags', 'Core:AttributeTagSet+' => '', + 'Core:AttributeCaseLog' => 'Log', + 'Core:AttributeCaseLog+' => '', + + 'Core:AttributeMetaEnum' => 'Computed enum', + 'Core:AttributeMetaEnum+' => '', + 'Core:AttributeLinkedSetIndirect' => 'Array of objects (N-N)', 'Core:AttributeLinkedSetIndirect+' => 'Any kind of objects [subclass] of the same class', @@ -620,7 +626,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SynchroDataSource/Attribute:name' => 'Name', 'Class:SynchroDataSource/Attribute:name+' => 'Name', 'Class:SynchroDataSource/Attribute:description' => 'Description', - 'Class:SynchroDataSource/Attribute:status' => 'Status', //TODO: enum values + 'Class:SynchroDataSource/Attribute:status' => 'Status', 'Class:SynchroDataSource/Attribute:scope_class' => 'Target class', 'Class:SynchroDataSource/Attribute:user_id' => 'User', 'Class:SynchroDataSource/Attribute:notify_contact_id' => 'Contact to notify', @@ -629,7 +635,7 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SynchroDataSource/Attribute:url_icon+' => 'Hyperlink a (small) image representing the application with which iTop is synchronized', 'Class:SynchroDataSource/Attribute:url_application' => 'Application\'s hyperlink', 'Class:SynchroDataSource/Attribute:url_application+' => 'Hyperlink to the iTop object in the external application with which iTop is synchronized (if applicable). Possible placeholders: $this->attribute$ and $replica->primary_key$', - 'Class:SynchroDataSource/Attribute:reconciliation_policy' => 'Reconciliation policy', //TODO enum values + 'Class:SynchroDataSource/Attribute:reconciliation_policy' => 'Reconciliation policy', 'Class:SynchroDataSource/Attribute:full_load_periodicity' => 'Full load interval', 'Class:SynchroDataSource/Attribute:full_load_periodicity+' => 'A complete reload of all data must occur at least as often as specified here', 'Class:SynchroDataSource/Attribute:action_on_zero' => 'Action on zero', @@ -640,7 +646,6 @@ Dict::Add('EN US', 'English', 'English', array( 'Class:SynchroDataSource/Attribute:action_on_multiple+' => 'Action taken when the search returns more than one object', 'Class:SynchroDataSource/Attribute:user_delete_policy' => 'Users allowed', 'Class:SynchroDataSource/Attribute:user_delete_policy+' => 'Who is allowed to delete synchronized objects', - 'Class:SynchroDataSource/Attribute:user_delete_policy' => 'Users allowed', 'Class:SynchroDataSource/Attribute:delete_policy/Value:never' => 'Nobody', 'Class:SynchroDataSource/Attribute:delete_policy/Value:depends' => 'Administrators only', 'Class:SynchroDataSource/Attribute:delete_policy/Value:always' => 'All allowed users', @@ -691,7 +696,6 @@ Dict::Add('EN US', 'English', 'English', array( 'Core:Synchro:label_obj_new_updated' => 'Updated (%1$s)', 'Core:Synchro:label_obj_created' => 'Created (%1$s)', 'Core:Synchro:label_obj_new_errors' => 'Errors (%1$s)', - 'Core:Synchro:History' => 'Synchronization History', 'Core:SynchroLogTitle' => '%1$s - %2$s', 'Core:Synchro:Nb_Replica' => 'Replica processed: %1$s', 'Core:Synchro:Nb_Class:Objects' => '%1$s: %2$s', @@ -905,3 +909,11 @@ Dict::Add('EN US', 'English', 'English', array( 'Core:Validator:MustBeInteger' => 'Must be an integer', 'Core:Validator:MustSelectOne' => 'Please, select one', )); + +// +// Class: TagSetFieldData +// +Dict::Add('EN US', 'English', 'English', array( + 'Class:TagSetFieldData' => 'List of tags', + 'Class:TagSetFieldData+' => '', +)); diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 1099bde05..e64074cb0 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -1395,7 +1395,7 @@ EOF $aParameters['sql'] = $this->GetMandatoryPropString($oField, 'sql'); $aParameters['is_null_allowed'] = $this->GetPropBoolean($oField, 'is_null_allowed', false); $aParameters['depends_on'] = $sDependencies; - $aParameters['default_value'] = $this->GetPropString($oField, 'default_value', ''); + $aParameters['default_value'] = ''; } else { @@ -1406,8 +1406,6 @@ EOF $aParameters['depends_on'] = $sDependencies; } - - // Optional parameters (more for historical reasons) // Added if present... //