|
|
@@ -297,7 +297,39 @@ class Core_AclSimpleSchemaBase extends Core_AclBase {
|
|
|
? $this->_simpleSchema['root'][$fieldName]['@alias']
|
|
|
: $fieldName;
|
|
|
}
|
|
|
- public function getID() { return 0; }
|
|
|
+ public function getID() {
|
|
|
+ list($databaseName) = explode('/', $this->_namespace);
|
|
|
+ if ('default_db' == $databaseName) {
|
|
|
+ $idZasobDatabase = (int)DB::getPDO($databaseName)->getZasobId();
|
|
|
+ if ($idZasobDatabase <= 0) throw new Exception("Missing database id");
|
|
|
+ $sqlNamespace = DB::getPDO()->quote($this->_namespace, PDO::PARAM_STR);
|
|
|
+ $zasob = DB::getPDO()->fetchFirst("
|
|
|
+ select z.ID, z.`DESC`, z.`TYPE`
|
|
|
+ from CRM_LISTA_ZASOBOW z
|
|
|
+ where z.`TYPE` = 'TABELA'
|
|
|
+ and z.`DESC` = {$sqlNamespace}
|
|
|
+ and z.PARENT_ID = {$idZasobDatabase}
|
|
|
+ and z.A_STATUS not in('DELETED')
|
|
|
+ ");
|
|
|
+ if ($zasob) return $zasob['ID'];
|
|
|
+ $id = DB::getPDO()->insert('CRM_LISTA_ZASOBOW', [
|
|
|
+ 'PARENT_ID' => $idZasobDatabase,
|
|
|
+ 'DESC' => $this->_namespace,
|
|
|
+ 'TYPE' => "TABELA",
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => "NOW()"
|
|
|
+ ]);
|
|
|
+ DB::getPDO()->insert('CRM_LISTA_ZASOBOW_HIST', [
|
|
|
+ 'ID_USERS2' => $id,
|
|
|
+ 'PARENT_ID' => $idZasobDatabase,
|
|
|
+ 'DESC' => $this->_namespace,
|
|
|
+ 'TYPE' => "TABELA",
|
|
|
+ 'A_RECORD_CREATE_AUTHOR' => User::getLogin(),
|
|
|
+ 'A_RECORD_CREATE_DATE' => "NOW()"
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
public function getAttributesFromZasoby() { return array(); }
|
|
|
public function isEnumerationField($fieldName) { return false; }
|
|
|
public function getEnumerations($fieldName) { return null; }
|