forked from extern/egroupware
Disable delete using checkboxes too
This commit is contained in:
parent
1053267a96
commit
d0d105b937
@ -43,11 +43,14 @@ class importexport_definitions_bo {
|
|||||||
public function get_rows(&$query, &$rows, &$readonlys)
|
public function get_rows(&$query, &$rows, &$readonlys)
|
||||||
{
|
{
|
||||||
$total = $this->so_sql->get_rows($query, $rows, $readonlys);
|
$total = $this->so_sql->get_rows($query, $rows, $readonlys);
|
||||||
|
$ro_count = 0;
|
||||||
foreach($rows as $row) {
|
foreach($rows as $row) {
|
||||||
$readonlys["edit[{$row['definition_id']}]"] = $readonlys["delete[{$row['definition_id']}]"] =
|
$readonlys["edit[{$row['definition_id']}]"] = $readonlys["delete[{$row['definition_id']}]"] =
|
||||||
($row['owner'] != $GLOBALS['egw_info']['user']['account_id']) &&
|
($row['owner'] != $GLOBALS['egw_info']['user']['account_id']) &&
|
||||||
!$GLOBALS['egw_info']['user']['apps']['admin'];
|
!$GLOBALS['egw_info']['user']['apps']['admin'];
|
||||||
|
if($readonlys["edit[{$row['definition_id']}]"]) $ro_count++;
|
||||||
}
|
}
|
||||||
|
$readonlys['delete_selected'] = $ro_count == count($rows);
|
||||||
return $total;
|
return $total;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,8 +63,13 @@ class importexport_definitions_bo {
|
|||||||
return $this->definitions;
|
return $this->definitions;
|
||||||
}
|
}
|
||||||
public function read($definition_id) {
|
public function read($definition_id) {
|
||||||
$definition = new importexport_definition( $definition_id['name'] );
|
if(is_numeric($definition_id)) {
|
||||||
return $definition->get_record_array();
|
$this->so_sql->read($definition_id);
|
||||||
|
$definition = new importexport_definition($this->so_sql->data['name']);
|
||||||
|
} else {
|
||||||
|
$definition = new importexport_definition( $definition_id['name'] );
|
||||||
|
}
|
||||||
|
return $definition->get_record_array();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* deletes a defintion
|
* deletes a defintion
|
||||||
@ -69,10 +77,18 @@ class importexport_definitions_bo {
|
|||||||
* @param array $keys
|
* @param array $keys
|
||||||
*/
|
*/
|
||||||
public function delete($keys) {
|
public function delete($keys) {
|
||||||
$this->so_sql->delete(array('definition_id' => $keys));
|
foreach ($keys as $index => $key) {
|
||||||
// clear private cache
|
// Check for ownership
|
||||||
foreach ($keys as $key) {
|
$definition = $this->read($key);
|
||||||
unset($this->definitions[array_search($key,$this->definitions)]);
|
if($definition['owner'] && $definition['owner'] == $GLOBALS['egw_info']['user']['account_id'] || $GLOBALS['egw_info']['user']['apps']['admin']) {
|
||||||
|
// clear private cache
|
||||||
|
unset($this->definitions[array_search($key,$this->definitions)]);
|
||||||
|
} else {
|
||||||
|
unset($keys[$index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($keys) > 0) {
|
||||||
|
$this->so_sql->delete(array('definition_id' => $keys));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user