mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
#166 Allow the definition of persistent classes having no table defined, and added a sample code for a null password authentication scheme
SVN:trunk[627]
This commit is contained in:
@@ -761,6 +761,10 @@ abstract class DBObject
|
||||
|
||||
private function DBInsertSingleTable($sTableClass)
|
||||
{
|
||||
$sTable = MetaModel::DBGetTable($sTableClass);
|
||||
// Abstract classes or classes having no specific attribute do not have an associated table
|
||||
if ($sTable == '') return;
|
||||
|
||||
$sClass = get_class($this);
|
||||
|
||||
// fields in first array, values in the second
|
||||
@@ -788,7 +792,6 @@ abstract class DBObject
|
||||
|
||||
if (count($aValuesToWrite) == 0) return false;
|
||||
|
||||
$sTable = MetaModel::DBGetTable($sTableClass);
|
||||
$sInsertSQL = "INSERT INTO `$sTable` (".join(",", $aFieldsToWrite).") VALUES (".join(", ", $aValuesToWrite).")";
|
||||
|
||||
$iNewKey = CMDBSource::InsertInto($sInsertSQL);
|
||||
@@ -850,7 +853,6 @@ abstract class DBObject
|
||||
foreach(MetaModel::EnumParentClasses($sClass) as $sParentClass)
|
||||
{
|
||||
if ($sParentClass == $sRootClass) continue;
|
||||
if (MetaModel::DBGetTable($sParentClass) == "") continue;
|
||||
$this->DBInsertSingleTable($sParentClass);
|
||||
}
|
||||
|
||||
|
||||
@@ -1727,7 +1727,7 @@ abstract class MetaModel
|
||||
// Then we join the queries of the eventual parent classes (compound model)
|
||||
foreach(self::EnumParentClasses($sClass) as $sParentClass)
|
||||
{
|
||||
if (self::DBGetTable($sParentClass) == "") continue;
|
||||
if (!self::HasTable($sParentClass)) continue;
|
||||
self::DbgTrace("Parent class: $sParentClass... let's call MakeQuerySingleTable()");
|
||||
$oSelectParentTable = self::MakeQuerySingleTable($aSelectedClasses, $oConditionTree, $aClassAliases, $aTableAliases, $aTranslation, $oFilter, $sParentClass, $aExpectedAtts, $aExtKeys, $aValues);
|
||||
if (is_null($oSelectBase))
|
||||
|
||||
@@ -98,7 +98,7 @@ abstract class User extends cmdbAbstractObject
|
||||
|
||||
// Display lists
|
||||
MetaModel::Init_SetZListItems('details', array('contactid', 'first_name', 'email', 'login', 'language', 'profile_list')); // Attributes to be displayed for the complete details
|
||||
MetaModel::Init_SetZListItems('list', array('first_name', 'last_name', 'login')); // Attributes to be displayed for a list
|
||||
MetaModel::Init_SetZListItems('list', array('finalclass', 'first_name', 'last_name', 'login')); // Attributes to be displayed for a list
|
||||
// Search criteria
|
||||
MetaModel::Init_SetZListItems('standard_search', array('login', 'contactid')); // Criteria of the std search form
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('login', 'contactid')); // Criteria of the advanced search form
|
||||
|
||||
Reference in New Issue
Block a user