/**
  * Remove company from project
  *
  * @param void
  * @return null
  */
 function remove_company()
 {
     if (!active_project()->canChangePermissions(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $project = Projects::findById(get_id('project_id'));
     if (!$project instanceof Project) {
         flash_error(lang('project dnx'));
         ajx_current("empty");
         return;
     }
     // if
     $company = Companies::findById(get_id('company_id'));
     if (!$company instanceof Company) {
         flash_error(lang('company dnx'));
         ajx_current("empty");
         return;
     }
     // if
     $project_company = ProjectCompanies::findById(array('project_id' => $project->getId(), 'company_id' => $company->getId()));
     if (!$project_company instanceof ProjectCompany) {
         flash_error(lang('company not on project'));
         ajx_current("empty");
         return;
     }
     // if
     try {
         DB::beginWork();
         $project_company->delete();
         $users = ProjectUsers::getCompanyUsersByProject($company, $project);
         if (is_array($users)) {
             foreach ($users as $user) {
                 $project_user = ProjectUsers::findById(array('project_id' => $project->getId(), 'user_id' => $user->getId()));
                 if ($project_user instanceof ProjectUser) {
                     $project_user->delete();
                 }
             }
             // foreach
         }
         // if
         DB::commit();
         flash_success(lang('success remove company from project'));
         ajx_current("reload");
     } catch (Exception $e) {
         DB::rollback();
         flash_error(lang('error remove company from project'));
         ajx_current("empty");
     }
     // try
 }
 /**
  * Return array of company users on specific project
  *
  * @access public
  * @param Project $project
  * @return array
  */
 function getUsersOnProject(Project $project)
 {
     return ProjectUsers::getCompanyUsersByProject($this, $project);
 }