Esempio n. 1
0
 /**
  **	Overload of the dpObject::getAllowedRecords
  **	to ensure that the allowed projects are owned by allowed companies.
  **
  **	@author	handco <*****@*****.**>
  **	@see	dpObject::getAllowedRecords
  **/
 function getAllowedRecords($uid, $fields = '*', $orderby = '', $index = null, $extra = null)
 {
     $oCpy = new CCompany();
     $aCpies = $oCpy->getAllowedRecords($uid, 'company_id, company_name');
     $buffer = count($aCpies) ? '(project_company IN (' . implode(',', array_keys($aCpies)) . '))' : '1 = 0';
     $extra['where'] = ($extra['where'] != '' ? $extra['where'] . ' AND ' : '') . $buffer;
     return parent::getAllowedRecords($uid, $fields, $orderby, $index, $extra);
 }
 /**
  **	Overload of the dpObject::getAllowedRecords 
  **	to ensure that the allowed projects are owned by allowed companies.
  **
  **	@author	handco <*****@*****.**>
  **	@see	dpObject::getAllowedRecords
  **/
 function getAllowedRecords($uid, $fields = '*', $orderby = '', $index = null, $extra = null)
 {
     $oCpy = new CCompany();
     $aCpies = $oCpy->getAllowedRecords($uid, "company_id, company_name");
     if (count($aCpies)) {
         $buffer = '(project_company IN (' . implode(',', array_keys($aCpies)) . '))';
         if ($extra['where'] != "") {
             $extra['where'] = $extra['where'] . ' AND ' . $buffer;
         } else {
             $extra['where'] = $buffer;
         }
     } else {
         // There are no allowed companies, so don't allow projects.
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND 1 = 0 ';
         } else {
             $extra['where'] = '1 = 0';
         }
     }
     return parent::getAllowedRecords($uid, $fields, $orderby, $index, $extra);
 }