Commit 9b5c1013 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #946 Cleaned up CSN handling

Conflicts:
	include/class_plugin.inc
parent 1435976f
......@@ -108,8 +108,7 @@ class plugin
* an error message will be shown.
* To configure this check correctly read the FAQ.
*/
var $entryCSN = '';
var $CSN_check_active = FALSE;
var $entryCSN = '';
/*!
* \brief plugin constructor
......@@ -386,6 +385,7 @@ class plugin
/*!
<<<<<<< HEAD
* \brief Save HTML posted data to object
*/
function save_object()
......@@ -424,6 +424,8 @@ class plugin
/*!
=======
>>>>>>> de6fccf... Fixes #946 Cleaned up CSN handling
* \brief Save data to LDAP, depending on is_account we save or delete
*/
function save()
......@@ -546,9 +548,9 @@ class plugin
}
/* Check entryCSN */
if ($this->CSN_check_active) {
if (!empty($this->entryCSN)) {
$current_csn = getEntryCSN($this->dn);
if (($current_csn != $this->entryCSN) && !empty($this->entryCSN) && !empty($current_csn)) {
if (($current_csn != $this->entryCSN) && !empty($current_csn)) {
$this->entryCSN = $current_csn;
$message[] = _('The object has changed since opened in FusionDirectory. All changes that may be done by others will get lost if you save this entry!');
}
......@@ -1702,19 +1704,6 @@ class plugin
}
}
/*!
* \brief Enable the Serial ID check
*
* This function enables the entry Serial ID check. If an entry was edited while
* we have edited the entry too, an error message will be shown.
* To configure this check correctly read the FAQ.
*/
function enable_CSN_check()
{
$this->CSN_check_active = TRUE;
$this->entryCSN = getEntryCSN($this->dn);
}
function is_modal_dialog()
{
return (isset($this->dialog) && $this->dialog);
......
......@@ -123,6 +123,8 @@ class simplePlugin extends plugin
if ($this->mainTab) {
$this->is_account = TRUE;
/* TODO: When merging plugin and simplePlugin we should find a way to avoid doing a separate LDAP fetch for this */
$this->entryCSN = getEntryCSN($this->dn);
}
if (!isset($this->templatePath)) {
......@@ -808,7 +810,6 @@ class simplePlugin extends plugin
}
} else {
$account = new $classname($config, $entry_dn);
$account->enable_CSN_check();
$account->set_acl_category($plCategory);
if ($edit_mode) {
$account->setNeedEditMode(TRUE);
......
......@@ -103,7 +103,6 @@ class simpleTabs
if ($baseobject === NULL) {
$baseobject = new $tab['CLASS']($this->config, $this->dn, $attrs_object);
$baseobject->enable_CSN_check();
$this->by_object[$tab['CLASS']] = $baseobject;
$this->baseclass = $tab['CLASS'];
} else {
......@@ -149,7 +148,6 @@ class simpleTabs
}
if ($baseobject === NULL) {
$baseobject = new $class($this->config, $this->dn);
$baseobject->enable_CSN_check();
$this->by_object[$name] = $baseobject;
} else {
$this->by_object[$name] = new $class($this->config, $this->dn, $baseobject);
......
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