Commit 78d7af33 authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '6039-askme-is-not-available-in-selectattribute-at-template-creation' into '1.4-dev'

Resolve "%askme% is not available in SelectAttribute at template creation"

See merge request fusiondirectory/fd!696
parents 63a27e77 77e4a8c2
......@@ -391,6 +391,22 @@ class objects
return static::open('new', $type);
}
static function createTemplate ($type)
{
$infos = static::infos($type);
$tabClass = $infos['tabClass'];
/* Pass fake attrs object to force template mode */
$attrsObject = new stdClass();
$attrsObject->attrs = [];
$attrsObject->is_template = TRUE;
$tabObject = new $tabClass($type, 'new', $attrsObject);
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn, "Create template of $type");
return $tabObject;
}
static function &infos ($type)
{
global $config;
......
......@@ -722,9 +722,15 @@ class management
if (static::$skipTemplates) {
return;
}
$action['subaction'] = preg_replace('/^template_/', '', $action['subaction']);
$this->newEntry($action);
$this->tabObject->setTemplateMode('template_cn');
$type = preg_replace('/^template_/', '', $action['subaction']);
$this->currentDn = 'new';
set_object_info($this->currentDn);
// Open object
$this->openTabObject(objects::createTemplate($type));
@DEBUG(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn, 'Create template entry initiated');
}
function newEntryFromTemplate (array $action)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment