Beispiel #1
0
 public function getAllowedRecords($uid, $fields = '*', $orderby = '', $index = null, $extra = null)
 {
     global $AppUI;
     $oTsk = new CTask();
     $aTasks = $oTsk->getAllowedRecords($uid, 'task_id, task_name');
     if (count($aTasks)) {
         $buffer = '(task_log_task IN (' . implode(',', array_keys($aTasks)) . ') OR task_log_task IS NULL OR task_log_task = \'\' OR task_log_task = 0)';
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND ' . $buffer;
         } else {
             $extra['where'] = $buffer;
         }
     } else {
         // There are no allowed tasks, so don't allow task_logs.
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND 1 = 0 ';
         } else {
             $extra['where'] = '1 = 0';
         }
     }
     return parent::getAllowedRecords($uid, $fields, $orderby, $index, $extra);
 }
Beispiel #2
0
 /**
  **	Overload of the w2PObject::getAllowedRecords
  **	to ensure that the allowed projects are owned by allowed companies.
  **
  **	@author	handco <*****@*****.**>
  **	@see	w2PObject::getAllowedRecords
  **/
 public function getAllowedRecords($uid, $fields = '*', $orderby = '', $index = null, $extra = null)
 {
     global $AppUI;
     $oCpy = new CCompany();
     $aCpies = $oCpy->getAllowedRecords($uid, 'company_id, company_name');
     if (count($aCpies)) {
         $buffer = '(contact_company IN (' . implode(',', array_keys($aCpies)) . ') OR contact_company IS NULL OR contact_company = \'\' OR contact_company = 0)';
         //Department permissions
         $oDpt = new CDepartment();
         $aDpts = $oDpt->getAllowedRecords($uid, 'dept_id, dept_name');
         if (count($aDpts)) {
             $dpt_buffer = '(contact_department IN (' . implode(',', array_keys($aDpts)) . ') OR contact_department = 0)';
         } else {
             // There are no allowed departments, so allow projects with no department.
             $dpt_buffer = '(contact_department = 0)';
         }
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND ' . $buffer . ' AND ' . $dpt_buffer;
         } else {
             $extra['where'] = $buffer . ' AND ' . $dpt_buffer;
         }
     } else {
         // There are no allowed companies, so don't allow projects.
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND (contact_company IS NULL OR contact_company = \'\' OR contact_company = 0) ';
         } else {
             $extra['where'] = 'contact_company IS NULL OR contact_company = \'\' OR contact_company = 0';
         }
     }
     return parent::getAllowedRecords($uid, $fields, $orderby, $index, $extra);
 }
Beispiel #3
0
 public function getAllowedRecords($uid, $fields = '*', $orderby = '', $index = null, $extra = null)
 {
     global $AppUI;
     $oPrj = new CProject();
     $aPrjs = $oPrj->getAllowedRecords($uid, 'projects.project_id, project_name', '', null, null, 'projects');
     if (count($aPrjs)) {
         $buffer = '(forum_project IN (' . implode(',', array_keys($aPrjs)) . ') OR forum_project IS NULL OR forum_project = \'\' OR forum_project = 0)';
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND ' . $buffer;
         } else {
             $extra['where'] = $buffer;
         }
     } else {
         // There are no allowed projects, so only allow forums with no project associated.
         if ($extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND (forum_project IS NULL OR forum_project = \'\' OR forum_project = 0) ';
         } else {
             $extra['where'] = '(forum_project IS NULL OR forum_project = \'\' OR forum_project = 0)';
         }
     }
     return parent::getAllowedRecords($uid, $fields, $orderby, $index, $extra);
 }
Beispiel #4
0
 /**
  **	Overload of the w2PObject::getAllowedRecords
  **	to ensure that the allowed projects are owned by allowed companies.
  **
  **	@author	handco <*****@*****.**>
  **	@see	w2PObject::getAllowedRecords
  **/
 public function getAllowedRecords($uid, $fields = '*', $orderby = '', $index = null, $extra = null, $table_alias = '')
 {
     $oCpy = new CCompany();
     $aCpies = $oCpy->getAllowedRecords($uid, 'company_id, company_name');
     if (count($aCpies)) {
         $buffer = '(project_company IN (' . implode(',', array_keys($aCpies)) . '))';
         if (!isset($extra['from']) && !isset($extra['join'])) {
             $extra['join'] = 'project_departments';
             $extra['on'] = 'projects.project_id = project_departments.project_id';
         } elseif ($extra['from'] != 'project_departments' && !isset($extra['join'])) {
             $extra['join'] = 'project_departments';
             $extra['on'] = 'projects.project_id = project_departments.project_id';
         }
         //Department permissions
         $oDpt = new CDepartment();
         $aDpts = $oDpt->getAllowedRecords($uid, 'dept_id, dept_name');
         if (count($aDpts)) {
             $dpt_buffer = '(department_id IN (' . implode(',', array_keys($aDpts)) . ') OR department_id IS NULL)';
         } else {
             // There are no allowed departments, so allow projects with no department.
             $dpt_buffer = '(department_id IS NULL)';
         }
         if (isset($extra['where']) && $extra['where'] != '') {
             $extra['where'] = $extra['where'] . ' AND ' . $buffer . ' AND ' . $dpt_buffer;
         } else {
             $extra['where'] = $buffer . ' AND ' . $dpt_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, $table_alias);
 }