* Addressbook: fixed not working changing of organisation members, also place this feature more prominent beside buttons

This commit is contained in:
Ralf Becker 2012-05-15 15:52:11 +00:00
parent 6d650d6abf
commit feb64d5b16
5 changed files with 27 additions and 15 deletions

View File

@ -1215,10 +1215,17 @@ class addressbook_bo extends addressbook_so
foreach($this->org_fields as $name)
{
if (isset($fields[$name]))
{
if (empty($fields[$name]))
{
$criteria[] = "($name IS NULL OR $name='')";
}
else
{
$criteria[$name] = $fields[$name];
}
}
}
return parent::search($criteria,false,'n_family,n_given','','',false,'OR',false,array('org_name'=>$org_name));
}
@ -1232,6 +1239,15 @@ class addressbook_bo extends addressbook_so
*/
function changed_fields($from,$to,$only_org_fields=true)
{
// we only care about countryname, if contrycode is empty
foreach(array(
'adr_one_countryname' => 'adr_one_countrycode',
'adr_two_countryname' => 'adr_one_countrycode',
) as $name => $code)
{
if (!empty($from[$code])) $from[$name] = '';
if (!empty($to[$code])) $to[$name] = '';
}
$changed = array();
foreach($only_org_fields ? $this->org_fields : array_keys($this->contact_fields) as $name)
{

View File

@ -2005,7 +2005,6 @@ class addressbook_ui extends addressbook_bo
}
$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content);
$readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT,$content);
$content['disable_change_org'] = true;
// how to display addresses
$content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']);
@ -2038,6 +2037,7 @@ class addressbook_ui extends addressbook_bo
{
$content['owner'] .= 'p';
}
$this->tmpl->set_cell_attribute('change_org','disabled',true);
// Prevent double countries - invalid code blanks it, disabling doesn't work
$content['adr_one_countrycode'] = '-';

View File

@ -94,7 +94,7 @@ function org_fileds_to_update($config)
foreach($bocontacts->contact_fields as $field => $label)
{
// some fields never making sense for an organisation
if (!in_array($field,array('id','tid','owner','created','creator','modified','modifier','private','n_prefix','n_given','n_middle','n_family','n_suffix','n_fn')))
if (!in_array($field,array('id','tid','owner','created','creator','modified','modifier','private','n_prefix','n_given','n_middle','n_family','n_suffix','n_fn','account_id')))
{
$fields[$field] = $label;
}

File diff suppressed because one or more lines are too long

View File

@ -110,7 +110,7 @@
<textbox id="org_unit" size="45" maxlength="64"/>
</row>
<row>
<image/>
<image src="gohome"/>
<description value="street" for="adr_one_street"/>
<textbox id="adr_one_street" size="45" maxlength="64"/>
</row>
@ -259,7 +259,7 @@
</rows>
</grid>
</template>
<template id="addressbook.edit.details" template="" lang="" group="0" version="1.9.001">
<template id="addressbook.edit.details" template="" lang="" group="0" version="1.9.002">
<grid width="100%" height="286" overflow="auto">
<columns>
<column/>
@ -277,11 +277,6 @@
<description value="Notes"/>
<textbox multiline="true" id="note" rows="6" cols="50"/>
</row>
<row class="row_on" disabled="@disable_change_org">
<image src="check"/>
<description/>
<checkbox statustext="Apply changes to all members, whose fields have the same previous content" label="change all organisation members" id="change_org" span="all"/>
</row>
<row>
<image src="home"/>
<description value="Last date"/>
@ -491,7 +486,7 @@
</rows>
</grid>
</template>
<template id="addressbook.edit" template="" lang="" group="0" version="1.9.001">
<template id="addressbook.edit" template="" lang="" group="0" version="1.9.002">
<grid>
<columns>
<column width="450"/>
@ -633,6 +628,7 @@
<button accesskey="s" label="Save" id="button[save]"/>
<button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]" onclick="if($cont[view]0) return true; self.close(); return false;"/>
<checkbox statustext="Apply changes to all members, whose fields have the same previous content" label="change all organisation members" id="change_org" span="all"/>
</hbox>
<button align="right" label="Delete" id="button[delete]" onclick="return confirm('Are you shure you want to delete this contact?');" tabindex="25"/>
</row>