forked from extern/egroupware
"fixed fatal error: creating custom fields delete application config:
caused by a missing config::read_repository() before calling config::save_repository(), which then only stores the custom fields, but not the rest of the config"
This commit is contained in:
parent
4245df1f29
commit
9aed38299f
@ -1,28 +1,22 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - admin: Custom fields *
|
||||
* http://www.egroupware.org *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Custiomfields class - manages customfield definitions in egw_config table
|
||||
/**
|
||||
* eGgroupWare admin - UI for adding custom fields
|
||||
*
|
||||
* The repository name (config_name) is 'customfields'.
|
||||
*
|
||||
* @license GPL
|
||||
* @author Ralf Becker <ralfbecker-AT-outdoor-training.de>
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @author Cornelius Weiss <nelius-AT-von-und-zu-weiss.de>
|
||||
* @package admin
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
class customfields
|
||||
{
|
||||
|
||||
/**
|
||||
* Custiomfields class - manages customfield definitions in egw_config table
|
||||
*
|
||||
* The repository name (config_name) is 'customfields'.
|
||||
*/
|
||||
class customfields
|
||||
{
|
||||
|
||||
/**
|
||||
* appname of app which want to add / edit its customfields
|
||||
@ -43,20 +37,23 @@
|
||||
'edit' => True
|
||||
);
|
||||
/**
|
||||
* Instance of the config class for the instancated applications
|
||||
* Instance of etemplate class
|
||||
*
|
||||
* @var config
|
||||
* @var etemplate
|
||||
*/
|
||||
var $config;
|
||||
var $tmpl;
|
||||
|
||||
function customfields($appname='')
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $appname
|
||||
*/
|
||||
function __construct($appname='')
|
||||
{
|
||||
$this->config =& new config($this->appname=$appname);
|
||||
|
||||
if ($appname)
|
||||
if (($this->appname = $appname))
|
||||
{
|
||||
$this->fields = $this->get_customfields(true);
|
||||
$this->content_types = $this->get_content_types();
|
||||
$this->fields = config::get_customfields($this->appname,true);
|
||||
$this->content_types = config::get_content_types($this->appname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,12 +72,11 @@
|
||||
if(!$this->appname) die(lang('Error! No appname found'));
|
||||
|
||||
$GLOBALS['egw']->translation->add_app('infolog'); // til we move the translations
|
||||
$this->tmpl =& CreateObject('etemplate.etemplate');
|
||||
$this->config =& CreateObject('phpgwapi.config',$this->appname);
|
||||
$this->tmpl = new etemplate();
|
||||
// do we manage content-types?
|
||||
if($this->tmpl->read($this->appname.'.admin.types')) $this->manage_content_types = true;
|
||||
|
||||
$this->fields = $this->get_customfields(true);
|
||||
$this->fields = config::get_customfields($this->appname,true);
|
||||
$this->tmpl->read('admin.customfields');
|
||||
|
||||
if($this->manage_content_types) $this->content_types = $this->get_content_types();
|
||||
@ -348,9 +344,11 @@
|
||||
function save_repository()
|
||||
{
|
||||
//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
|
||||
$this->config->value('customfields',$this->fields);
|
||||
$this->config->value('types',$this->content_types);
|
||||
$this->config->save_repository();
|
||||
$config = new config($this->appname);
|
||||
$config->read_repository();
|
||||
$config->value('customfields',$this->fields);
|
||||
$config->value('types',$this->content_types);
|
||||
$config->save_repository();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -378,4 +376,4 @@
|
||||
return config::get_content_types($this->appname);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user