// Form data are not valid } else { $display['msg'] = display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_company_form($action, $params); } } elseif ($action == 'update') { /////////////////////////////////////////////////////////////////////////////// if (check_user_defined_rules() && check_company_data_form($params['company_id'], $params)) { $retour = run_query_company_update($params['company_id'], $params); if ($retour) { $addressbooks = OBM_AddressBook::search(); $contacts = $addressbooks->searchContacts("companyId:$params[company_id]"); foreach($contacts as $contact) { OBM_Contact::solrStore($contact); } OBM_IndexingService::commit('contact'); $display['msg'] .= display_ok_msg("$l_company : $l_update_ok"); } else { $display['msg'] .= display_err_msg("$l_company : $l_update_error"); } $display['detail'] = dis_company_consult($params); } else { $display['msg'] .= display_warn_msg($l_invalid_data . ' : ' . $err['msg']); $display['detail'] = dis_company_form($action, $params); } } elseif ($action == 'check_delete') { /////////////////////////////////////////////////////////////////////////////// if (check_can_delete_company($params['company_id'])) {
public function countContacts($pattern) { if(!empty($this->addressbooks)) { if(trim($pattern)) $pattern = "($pattern ".$this->queryFilter.") AND ".$this->queryFilter; else $pattern = $this->queryFilter; return OBM_Contact::count($pattern, $offset, $limit); } }
public static function __setwebsite($value=null) { static $websiteIndex = 0; if(!$value) $value['label'] = 'URL'; else $value['label'] = OBM_Contact::labelToString($value['label'], null, false, '_'); $return = ' <table class="coordinate websites" id="websites['.$websiteIndex.']"> <tbody> <tr> <th><select name="websites['.$websiteIndex.'][label]">'; foreach($GLOBALS['l_website_labels'] as $label => $locale) { if($value['label'] == $label) $return .= '<option selected="selected" value="'.$label.'">'.$locale.'</option>'; else $return .= '<option value="'.$label.'">'.$locale.'</option>'; } $return .= ' </select></th> <th><input type="text" name="websites['.$websiteIndex.'][url]" alt="'.__('Website').'" title="'.__('Website').'" value="'.$value['url'].'"/></th> </tr> </tbody> </table>'; $websiteIndex++; return $return; }
echo $template->render(); } exit(); } else { contact_export_js_labels(); $template = new OBM_Template('main'); if(!$current['addressbook']) $current['addressbook'] = $addressbooks->getMyContacts()->id; if(!$contacts) $contacts = $addressbooks->searchContacts("addressbookId:$current[addressbook] -is:archive"); $template->set('searchpattern', $params['searchpattern']); $template->set('contactfilter', $params['contactfilter']); $template->set('contacts', $contacts); $template->set('contact', $contact); $template->set('addressbooks', $addressbooks); $template->set('current', $current); $template->set('searchfields', OBM_Contact::fieldsMap()); $template->set('customFields', OBM_Contact::getUserCategory()); //FIXME : Already set in some actions $template->set('fields', get_display_pref($GLOBALS['obm']['uid'], 'contact')); $template->set('template', $subTemplate); $display['detail'] = $template->render(); } } /////////////////////////////////////////////////////////////////////////////// // Display /////////////////////////////////////////////////////////////////////////////// $display['head'] = display_head($l_contact); $display['end'] = display_end(); if (! $params['popup']) { update_contact_action();
private static function getKindId($kind) { if (self::$kinds === null) { self::$kinds = self::fetchKinds(); } return array_search($kind, self::$kinds); }