* Addressbook - Disable merge contacts action if more than one account is selected

This commit is contained in:
nathangray 2018-06-12 13:49:59 -06:00
parent baa2807606
commit 835ad5b322
2 changed files with 17 additions and 1 deletions

View File

@ -585,7 +585,8 @@ class addressbook_ui extends addressbook_bo
'hint' => 'Merge into first or account, deletes all other!', 'hint' => 'Merge into first or account, deletes all other!',
'allowOnMultiple' => 'only', 'allowOnMultiple' => 'only',
'group' => $group, 'group' => $group,
'hideOnMobile' => true 'hideOnMobile' => true,
'enabled' => 'javaScript:app.addressbook.can_merge'
); );
// Duplicates view // Duplicates view
$actions['merge_duplicates'] = array( $actions['merge_duplicates'] = array(

View File

@ -1247,5 +1247,20 @@ app.classes.addressbook = AppJS.extend(
var geo_url = egw.config('geolocation_url'); var geo_url = egw.config('geolocation_url');
if (geo_url) geo_url = geo_url[0]; if (geo_url) geo_url = geo_url[0];
return geo_url || default_url; return geo_url || default_url;
},
/**
* Check to see if the selection contains at most one account
*
* @param {egwAction} action
* @param {egwActionObject[]} selected Selected rows
*/
can_merge: function(action, selected)
{
return selected.filter(function (row) {
var data = egw.dataGetUIDdata(row.id);
return data && data.data.account_id;
}).length <= 1;
} }
}); });