Changeset 3225
- Timestamp:
- 09/09/10 15:56:47 (14 years ago)
- Location:
- branches/2.2/workflow
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/workflow/doc/change_log.txt
r3221 r3225 22 22 [2.2.000] 23 23 24 #1186 - Exibição dos atributos mobile e homePhone, do Ldap, no cartão de visita do organograma (pereira.jair) 25 #1177 - Correção da máscara de ano no componete wf_calendar (adeildosantos) 24 26 #1176 - Otimização da query de busca ldap na classe WorkflowLDAP, e prevenção contra loop infinito (fabianok) 25 27 #1172 - Ajustar a preparação do ambiente do Workflow para chamadas de webservices (asaikawa) -
branches/2.2/workflow/inc/class.CachedLDAP.inc.php
r3212 r3225 72 72 */ 73 73 private $entryAttributes = array('uid', 'cn', 'givenname', 'mail', 'sn', 'accountstatus', 'uidnumber', 'dn', 'employeenumber', 'cpf', 'telephonenumber'); 74 75 /** 76 * @var array $entryAttributesLDAP Os atributos que serão buscados somente no LDAP. 77 * (Alguns campos não são armazenados no banco, e o campo mobile pode ser mais do que um por funcionário) 74 75 /** 76 * @var array $entryAttributesLDAP Attributes thats only exists in LDAP. 77 * The attributes mobile and homePhone are not present in databaseCache, because they may have more 78 * This is not the very best approach because the best solution should be store all attributes 79 * from Ldap into databaseCache 80 * than one value 78 81 * @access private 79 82 * */ … … 135 138 /* load the information and establish the connection */ 136 139 $this->loadLDAP(); 137 140 138 141 $ldapfields = array(); 139 142 143 // Merge the arrays os attributes from databaseCache and Ldap 140 144 $ldapfields = array_merge($this->entryAttributes,$this->entryAttributesLDAP); 141 145 142 146 /* perform the search */ 143 147 $resourceIdentifier = ldap_search($this->dataSource, $this->userContext, $ldapQuery, $ldapfields); … … 147 151 if ($entries['count'] != 1) 148 152 return false; 149 150 //print_r($entries);151 153 152 154 /* format the output */ 153 155 $output = array(); 154 156 foreach ($ldapfields as $attribute) 155 if ($attribute == 'dn') 157 if ($attribute == 'dn' or $attribute == 'mobile' or $attribute == 'homePhone') 158 // Retrieve all occurrencies of mobile and homePhone 156 159 $output[$attribute] = $entries[0][$attribute]; 157 160 else 158 $output[$attribute] = $entries[0][$attribute];159 161 // Retrieve first occurrence of other attributes 162 $output[$attribute] = $entries[0][$attribute][0]; 160 163 161 164 /* insert the timestamp of the last update */ -
branches/2.2/workflow/inc/class.so_orgchart.inc.php
r3212 r3225 1104 1104 $cachedLDAP->setOperationMode($cachedLDAP->OPERATION_MODE_LDAP_DATABASE); 1105 1105 1106 1107 1106 /* here we need fresh information. Let's access ldap first */ 1108 1107 $employeeEntry = $cachedLDAP->getEntryByID($employeeID); 1109 1108 1110 1109 if ($entry === false) 1111 1110 return array('error' => 'Funcionário não encontrado.'); 1112 1113 $employeeInfo = $orgchart->getEmployee($employeeID); 1114 $employeeStatusInfo = $orgchart->getEmployeeStatus($employeeInfo['funcionario_status_id']); 1115 $account_id = $_SESSION['phpgw_info']['workflow']['account_id']; 1116 $organization_supervisors = $orgchart->getOrganizationSupervisors($employeeInfo['organizacao_id']); 1117 1118 /* 1119 * Verify the supervisor of the organization 1120 * if the logged user is the supervisor of the selected user 1121 * then will show the mobile and homePhone number. 1122 */ 1111 1112 $employeeInfo = $orgchart->getEmployee($employeeID); 1113 $employeeStatusInfo = $orgchart->getEmployeeStatus($employeeInfo['funcionario_status_id']); 1114 $account_id = $_SESSION['phpgw_info']['workflow']['account_id']; 1115 $organization_supervisors = $orgchart->getOrganizationSupervisors($employeeInfo['organizacao_id']); 1116 1117 // Make an array with all supervisors and their substitures 1123 1118 $arr_supervisores = array(); 1124 1119 foreach ($organization_supervisors as $supervisor) { … … 1128 1123 } 1129 1124 } 1130 1125 1131 1126 $mobile = ''; 1132 1127 $homePhone = ''; 1133 1128 1129 /* 1130 * Check if the current user can view the mobile and homePhone of the employee 1131 * This condition is true if the current user is a supervisor or is the same user 1132 * that's being retrieved 1133 */ 1134 1134 if (in_array($account_id,$arr_supervisores) || ($account_id == $employeeID)) { 1135 1135 $mobile = $employeeEntry['mobile']; 1136 1136 $homePhone = $employeeEntry['homephone']; 1137 } 1138 1137 } 1138 1139 1139 $outputInfo[] = array( 1140 1140 'name' => 'Mobile', 1141 1141 'value' => ( ! empty( $mobile ) ? $mobile : '' ) ); 1142 1142 1143 1143 $outputInfo[] = array( 1144 1144 'name' => 'homePhone', … … 1164 1164 'name' => 'UIDNumber', 1165 1165 'value' => $employeeID); 1166 1167 1168 1166 1169 1167 $outputInfo[] = array( … … 1430 1428 * I'm not supose to be here.. (date validations speaking) 1431 1429 * move me to some validation class! 1432 */ 1430 */ 1433 1431 1434 1432 /* validating dates */ … … 1505 1503 $result = $this -> db -> query( $query, array( $areaID, $substituteID, $date_start, $date_end ) ); 1506 1504 $this->_checkError( $result ); 1507 1505 1508 1506 return ( ( $result === false ) ? false : true ); 1509 1507 } … … 1533 1531 $result = $this -> db -> query( $query, array( $substituteID, $date_start, $date_end, $substitutionID ) ); 1534 1532 $this->_checkError( $result ); 1535 1533 1536 1534 return ( ( $result === false ) ? false : true ); 1537 1535 } … … 1575 1573 * @param int $organizationID Organization's ID 1576 1574 * @param int $telephoneID Substitution's ID 1577 * @return bool 1575 * @return bool 1578 1576 * @access public 1579 1577 */ -
branches/2.2/workflow/inc/local/classes/class.wf_orgchart.php
r3212 r3225 157 157 return $output; 158 158 } 159 159 160 160 /** 161 161 * Searches for all the supervisors of an organization. 162 162 * 163 * This method will search in table areas for all the supervisors and replacement in the organization. , todas as áreas que pertencem à organização solicitada.163 * This method will search in table areas for all the supervisors and replacement in the organization. 164 164 * @param int $organizationID the ID of the Organization. 165 165 * @return array Uma array seqüencial contendo as áreas de uma organização e seus titulares e substitutos. Cada linha do array conterá: … … 170 170 */ 171 171 function getOrganizationSupervisors($organizationID) { 172 $query = " SELECT 173 a.titular_funcionario_id, 174 s.funcionario_id as substituto_funcionario_id, 172 $query = " SELECT 173 a.titular_funcionario_id, 174 s.funcionario_id as substituto_funcionario_id, 175 175 a.area_id 176 FROM 177 area a 178 LEFT OUTER JOIN substituicao s 176 FROM 177 area a 178 LEFT OUTER JOIN substituicao s 179 179 ON ((a.area_id = s.area_id) AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) 180 WHERE 181 a.titular_funcionario_id is not null 182 and a.ativa = 'S' 183 AND organizacao_id = ?184 GROUP BY 180 WHERE 181 a.titular_funcionario_id is not null 182 and a.ativa = 'S' 183 AND a.organizacao_id = ? 184 GROUP BY 185 185 a.titular_funcionario_id, 186 s.funcionario_id, 186 s.funcionario_id, 187 187 a.area_id"; 188 188 $result = $this->db->query($query, array($organizationID)); … … 518 518 return $output; 519 519 } 520 520 521 521 /** 522 522 * Return all areas that the employee is a supervisor. 523 * 523 * 524 524 * Search in the organization for all areas that the employee is a supervisor. 525 525 * @param int $employeeID The ID of employee … … 533 533 } 534 534 535 $query = "SELECT 535 $query = "SELECT 536 536 a.area_id 537 FROM 538 area a 539 LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) 540 AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) 541 WHERE 542 a.titular_funcionario_id = ? OR 537 FROM 538 area a 539 LEFT OUTER JOIN substituicao s ON ((a.area_id = s.area_id) 540 AND (CURRENT_DATE BETWEEN s.data_inicio AND s.data_fim)) 541 WHERE 542 a.titular_funcionario_id = ? OR 543 543 s.funcionario_id = ? 544 544 GROUP BY 545 545 a.area_id"; 546 546 547 547 $result = $this->db->query($query, array($employeeID,$employeeID)); 548 548 if (!$result) 549 549 return false; 550 550 551 551 $output = $result->GetArray(-1); 552 552 return $output;
Note: See TracChangeset
for help on using the changeset viewer.