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