diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index 5dc2abd136..ee990cd3c0 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -179,16 +179,30 @@ class boaddressbook * * @internal * @param array $datas array of contact arrays + * @param boolean $read_customfields=false should the customfields be read, default no (contacts::read() does it already) * @return array */ - function data2xmlrpc($datas) + function data2xmlrpc($datas,$read_customfields=false) { if(is_array($datas)) { + if ($read_customfields) + { + $ids = array(); + foreach($datas as $data) + { + $ids[] = $data['id']; + } + $customfields = $this->contacts->read_customfields($ids); + } foreach($datas as $n => $nul) { $data =& $datas[$n]; // $n => &$data is php5 ;-) - + + if ($customfields && isset($customfields[$data['id']])) + { + $data += $customfields[$data['id']]; + } // remove empty or null elements, they dont need to be transfered $data = array_diff($data,array('',null)); @@ -213,6 +227,11 @@ class boaddressbook { $data['cat_id'] = $GLOBALS['server']->cats2xmlrpc(explode(',',$data['cat_id'])); } + // replacing the fieldname in tel_prefer with the actual number, if it exists and is non-empty + if (substr($data['tel_prefer'],0,4) === 'tel_' && $data[$data['tel_prefer']]) + { + $data['tel_prefer'] = $data[$data['tel_prefer']]; + } // translate fieldnames if required foreach($this->mapping as $from => $to) { @@ -286,6 +305,20 @@ class boaddressbook $cats = $GLOBALS['server']->xmlrpc2cats($data['cat_id']); $data['cat_id'] = count($cats) > 1 ? ','.implode(',',$cats).',' : (int)$cats[0]; } + // replacing the number in tel_prefer with the fieldname, if it matches a phone-number, otherwise keep it's content as is + if ($data['tel_prefer']) + { + $prefer = $data['tel_prefer']; + unset($data['tel_prefer']); + if (($key = array_search($prefer,$data)) !== false && substr($key,0,4) === 'tel_') + { + $data['tel_prefer'] = $key; + } + else + { + $data['tel_prefer'] = $prefer; + } + } return $data; } @@ -303,11 +336,14 @@ class boaddressbook * @param string $param['sort']='' sorting: ASC or DESC * @param string $param['order']='' column to order, default ('') n_family,n_given,email ASC * @param int $param['lastmod']=-1 return only values modified after given timestamp, default (-1) return all - * @param string $param['cquery='' return only entries starting with given character, default ('') all + * @param string $param['cquery']='' return only entries starting with given character, default ('') all + * @param string $param['customfields']=true return the customfields too, default yes * @return array of contacts */ function search($param) { + $read_customfields = !isset($param['customfields']) || $param['customfields']; + return $this->data2xmlrpc($this->contacts->old_read( (int) $param['start'], (int) $param['limit'], @@ -318,11 +354,11 @@ class boaddressbook $param['order'], $param['lastmod'] ? $param['lastmod'] : -1, $param['cquery'] - )); + ),$read_customfields); } /** - * Read one contract + * Read one contact * * @param mixed $id $id, $id[0] or $id['id'] contains the id of the contact * @return array contact diff --git a/addressbook/inc/class.uicontacts.inc.php b/addressbook/inc/class.uicontacts.inc.php index a71ab5a42a..537e1bae1c 100644 --- a/addressbook/inc/class.uicontacts.inc.php +++ b/addressbook/inc/class.uicontacts.inc.php @@ -710,7 +710,7 @@ class uicontacts extends bocontacts 'col_filter' => array('tid' => $query['col_filter']['tid']), 'org_view' => $query['org_view'], )); - if ($state != $this->prefs['index_state']) + if ($state != $this->prefs[$do_email ? 'email_state' : 'index_state']) { $GLOBALS['egw']->preferences->add('addressbook',$do_email ? 'email_state' : 'index_state',$state); // save prefs, but do NOT invalid the cache (unnecessary) @@ -821,9 +821,11 @@ class uicontacts extends bocontacts } $rows = parent::search($query['advanced_search'] ? $query['advanced_search'] : $query['search'],$id_only, $order,'',$wildcard,false,$op,array((int)$query['start'],(int) $query['num_rows']),$query['col_filter']); - - // do we need the custom fields - if (!$id_only && $this->prefs['custom_colum'] != 'never' && $rows && $this->customfields) + + // do we need to read the custom fields, depends on the column is enabled and customfields exist + $columselection = $this->prefs['nextmatch-addressbook.'.($do_email ? 'email' : 'index').'.rows']; + if ($columselection) $columselection = explode(',',$columselection); + if (!$id_only && (!$columselection || in_array('customfields',$columselection)) && $rows && $this->customfields) { foreach((array) $rows as $n => $val) { @@ -943,7 +945,7 @@ class uicontacts extends bocontacts if (!$homeaddress) $rows['no_home'] = true; } // disable customfields column, if we have no customefield(s) - if (!$customfields) $rows['no_customfields'] = true; + if (!$this->customfields || !$this->prefs['no_auto_hide'] && !$customfields) $rows['no_customfields'] = true; $rows['order'] = $order; $rows['call_popup'] = $this->config['call_popup']; diff --git a/etemplate/inc/class.nextmatch_widget.inc.php b/etemplate/inc/class.nextmatch_widget.inc.php index b74e54cef7..4f141075c1 100644 --- a/etemplate/inc/class.nextmatch_widget.inc.php +++ b/etemplate/inc/class.nextmatch_widget.inc.php @@ -267,6 +267,9 @@ { $value['template'] =& new etemplate($value['template'],$tmpl->as_array()); } + $extension_data['template'] = $value['template']->name; // used for the column-selection, and might be set in get_rows() + $extension_data['columnselection_pref'] = $value['columnselection_pref']; + if ($total < 1 && $value['template']->rows > 1) { $value['template']->data[0]['h'.$value['template']->rows] .= ',1'; // disable the last data row diff --git a/felamimail/inc/class.uicompose.inc.php b/felamimail/inc/class.uicompose.inc.php index 3222cf0662..5667c49747 100644 --- a/felamimail/inc/class.uicompose.inc.php +++ b/felamimail/inc/class.uicompose.inc.php @@ -550,7 +550,7 @@ $this->t->set_var('lang_max_uploadsize',lang('max uploadsize')); $this->t->set_var('lang_adding_file_please_wait',lang('Adding file to message. Please wait!')); $this->t->set_var('lang_receive_notification',lang('Receive notification')); - + $this->t->set_var('lang_no_address_set',lang('can not send message. no recipient defined!')); $this->t->set_var("th_bg",$GLOBALS['egw_info']["theme"]["th_bg"]); $this->t->set_var("bg01",$GLOBALS['egw_info']["theme"]["bg01"]); diff --git a/felamimail/js/jscode/composeMessage.js b/felamimail/js/jscode/composeMessage.js index 63fcb65961..0558a48755 100644 --- a/felamimail/js/jscode/composeMessage.js +++ b/felamimail/js/jscode/composeMessage.js @@ -548,3 +548,21 @@ function fm_blink_currentInputField() { window.setTimeout("currentInputField.style.border = '1px solid #666666'", 200); window.setTimeout("currentInputField.style.border = ''", 450); } + +function fm_compose_sendEMail() { + var addressTable = document.getElementById('addressRows').rows; + var addressSet = false; + + for (i=0; i... - - - - -
- + +