- Timestamp:
- 11/06/09 09:50:22 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contactcenter/inc/class.bo_global_ldap_catalog.inc.php
r1419 r1598 41 41 'pgp_key' => true, 42 42 'notes' => true, 43 44 /* Array fields */45 43 'companies' => true, 46 44 'relations' => true, … … 115 113 116 114 */ 117 function find($what, $rules=false, $other=false )115 function find($what, $rules=false, $other=false, $area=false) 118 116 { 119 117 $restric_fields = $this->get_restrictions_without_branch($rules); … … 128 126 } 129 127 } 130 128 131 129 $fields = array_unique($fields); 132 133 $filter = $this->process_restrictions($rules, $trans_f); 134 // Find objects where 'mail' attribute is not null. 130 131 //Testa se a busca foi realizada com aspas 132 $rules_search = $rules[3]['value']; 133 $rules_len = (strlen($rules_search)) -1; 134 135 if((($rules_search{1}) == "\"") && (($rules_search{$rules_len -1}) == "\"")){ 136 $rules_search = substr($rules_search,2,$rules_len-3); 137 $filter = "(&(|(objectClass=phpgwAccount))(&(!(phpgwAccountVisible=-1)))(|(cn=* $rules_search *)(cn=$rules_search *)(cn=* $rules_search)))"; 138 } 139 else{ 140 $filter = $this->process_restrictions($rules, $trans_f); 141 } 142 143 if ($area) 144 { 145 $obj = CreateObject('phpgwapi.config','contactcenter'); 146 $opts = $obj->read_repository(); 147 $filter = substr($filter,0,-1) .'(' . $opts['cc_ldap_atrib'] . '=*' . $area . '*))'; 148 $opts = null; 149 $obj = null; 150 } 151 // Find objects where 'mail' attribute is not null. 135 152 $filter = "(&".$filter."(mail=*))"; 136 if("ou" === strtolower(substr($this->src_info['context'], 0, 2)) || 137 (trim($rules[0]['value']) == "phpgwAccount")) 138 { 139 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); 140 $result_r = ldap_search($ldap , $this->src_info['context'], $filter, $fields, 0, $this->src_info['max_results']); 141 } 153 154 if(strstr($this->src_info['context'], "ldap://")) { 155 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $this->src_info['context'])); 156 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $this->src_info['context']); 157 $this->src_info['host'] = $host; 158 } 159 if($refer_context || "ou" === strtolower(substr($this->src_info['context'], 0, 2))) 160 { 161 $followReferral = false; 162 } 163 elseif(trim($rules[4]['value']) != "inetOrgPerson") 164 { 165 $followReferral = true; 166 } 142 167 else 143 168 { … … 145 170 } 146 171 172 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], $followReferral); 173 $result_r = ldap_search($ldap ,($refer_context ? $refer_context : $this->src_info['context']), $filter, $fields, 0, $this->src_info['max_results']); 147 174 148 175 if (!$result_r) … … 192 219 $i++; 193 220 } 194 usort($return, array($this, "compareObjects")); 221 usort($return, array($this, "compareObjects")); 195 222 return $return; 196 223 } 197 224 // Compare function for usort. 198 function compareObjects($a, $b) { 225 function compareObjects($a, $b) { 199 226 return strnatcasecmp($a['names_ordered'], $b['names_ordered']); 200 227 } … … 580 607 } 581 608 582 609 // print_r($contact); 583 610 584 611 // $contact_data = $this->fields; … … 598 625 $l_fields['company_name'] = $this->trans_table['contact.company.company_name']; 599 626 $l_fields['title'] = $this->trans_table['contact.business_info.title']; 600 $l_fields['department'] = $this->trans_table['contact.business_info.department'];627 //$l_fields['department'] = $this->trans_table['contact.business_info.department']; 601 628 $l_fields['company_notes'] = $this->trans_table['contact.company.company_notes']; 602 629 630 //Relaciona o array com o atributo 'ou' do RHDS; tambem verifica se a 631 //preferencia esta configurada para exibir o campo 632 if(isset($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['departmentShow']) && $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['departmentShow']) 633 { 634 $l_fields['department'] = $this->trans_table['contact.business_info.department']; 635 } 636 //Relaciona o array com o atributo 'employeeNumber' do RHDS; tambem verifica se a 637 //preferencia esta configurada para exibir o campo 638 if(isset($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['empNumShow']) && $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['empNumShow']) 639 { 640 $l_fields['empNumber'] = $this->trans_table['contact.business_info.empNumber']; 641 } 642 //Relaciona o array com o atributo 'mobile' do RHDS; tambem verifica se a 643 //preferencia esta configurada para exibir o campo 644 if(isset($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['cellShow']) && $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['cellShow']) 645 { 646 $l_fields['celPhone'] = $this->trans_table['contact.business_info.celPhone']; 647 } 648 603 649 $contact_data['companies'] = array(); 604 650 foreach($l_fields as $l_field => $l_value) … … 920 966 $l_fields['company_notes'] = $this->trans_table['contact.company.company_notes']; 921 967 968 //Relaciona o array com o atributo 'employeeNumber' do RHDS 969 if(isset($_SESSION['phpgw_info']['user']['preferences']['contactcenter']['empNumberShow']) && $_SESSION['phpgw_info']['user']['preferences']['contactcenter']['empNumberShow']) 970 { 971 $l_fields['empNumber'] = $this->trans_table['contact.business_info.empNumber']; 972 } 973 //Relaciona o array com o atributo 'mobile' do RHDS 974 $l_fields['celPhone'] = $this->trans_table['contact.business_info.celPhone']; 975 976 //Relaciona o array com o atributo 'mobile' do RHDS 977 $l_fields['celPhone'] = $this->trans_table['contact.business_info.celPhone']; 978 922 979 $contact_data['companies'] = array(); 923 980 foreach($l_fields as $l_field => $l_value)
Note: See TracChangeset
for help on using the changeset viewer.