Performance: Make sure that after contact update we call get_record() only once

pull/323/head
Aleksander Machniak 9 years ago
parent d686b57c72
commit a62ff159f0

@ -164,9 +164,12 @@ if (!empty($cid)) {
$_POST['_cid'] = $newcid;
}
// define list of cols to be displayed
// refresh contact data for list update and 'show' action
$CONTACT_RECORD = $CONTACTS->get_record($newcid ?: $cid, true);
// Update contacts list
$a_js_cols = array();
$record = $CONTACTS->get_record($newcid ?: $cid, true);
$record = $CONTACT_RECORD;
$record['email'] = reset($CONTACTS->get_col_values('email', $record, true));
$record['name'] = rcube_addressbook::compose_list_name($record);

@ -28,8 +28,8 @@ $cid = $cids ? array_shift($cids[$source]) : null;
$CONTACTS = rcmail_contact_source($source, true);
$SOURCE_ID = $source;
// read contact record
if ($cid && ($record = $CONTACTS->get_record($cid, true))) {
// read contact record (or get the one defined in 'save' action)
if ($cid && ($record = ($CONTACT_RECORD ?: $CONTACTS->get_record($cid, true)))) {
$OUTPUT->set_env('readonly', $CONTACTS->readonly || $record['readonly']);
$OUTPUT->set_env('cid', $record['ID']);

Loading…
Cancel
Save