parent
a732ab2248
commit
8730264859
@ -116,7 +116,7 @@ HTML;
|
||||
class DeploymentSurveyPage_Controller extends Page_Controller
|
||||
{
|
||||
|
||||
static $allowed_actions = array(
|
||||
private static $allowed_actions = array(
|
||||
'Login',
|
||||
'OrgInfo',
|
||||
'AppDevSurvey',
|
||||
@ -290,7 +290,7 @@ class DeploymentSurveyPage_Controller extends Page_Controller
|
||||
if (isset($data['Organization'])) {
|
||||
$org_data = Convert::raw2sql(trim($data['Organization']));
|
||||
if (!empty($org_data)) {
|
||||
$org = DataObject::get_one('Org', " Name = '{$org_data}' ");
|
||||
$org = Org::get()->filter(array('Name' => $org_data))->first();
|
||||
if (!$org) {
|
||||
$org = new Org;
|
||||
$org->Name = $org_data;
|
||||
|
@ -183,17 +183,27 @@ class MemberDecorator extends DataExtension {
|
||||
|
||||
public function hasCurrentAffiliation($org){
|
||||
$org = Convert::raw2sql($org);
|
||||
$affiliations = $this->owner->Affiliations();
|
||||
|
||||
$affiliations = $affiliations->filterAny(array(
|
||||
'Current' => '1',
|
||||
'EndDate' => 'NULL',
|
||||
));
|
||||
|
||||
if(is_numeric($org)){
|
||||
$org = intval($org);
|
||||
$org_filter = " OrganizationID = {$org}";
|
||||
|
||||
$affiliations = $affiliations->filter(array(
|
||||
'OrganizationID' => intval($org)
|
||||
));
|
||||
}
|
||||
else{
|
||||
$org_filter = " Org.Name = '{$org}' ";
|
||||
|
||||
$affiliations->innerJoin('Org','Org.ID = Affiliation.OrganizationID','O');
|
||||
$affiliations = $affiliations->filter(array(
|
||||
'O.Name' => $org
|
||||
));
|
||||
}
|
||||
$res = $this->owner->Affiliations("(Current=1 OR EndDate IS NULL ) AND {$org_filter}");
|
||||
if(!is_numeric($org))
|
||||
$res->leftJoin('Org','Org.ID = Affiliation.OrganizationID');
|
||||
return $res->count() > 0;
|
||||
return $affiliations->count() > 0;
|
||||
}
|
||||
|
||||
public function getCurrentOrganization(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user