Skip to content

Commit 6559c0c

Browse files
committed
Minor refactor.
1 parent 64315bb commit 6559c0c

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/contact.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -654,36 +654,34 @@ static public function override_conflict($forceShow = null) {
654654
}
655655

656656
public function allowAdminister($prow) {
657-
if ($prow && $prow->has_conflict($this)
658-
&& $prow->managerContactId
659-
&& $prow->managerContactId != $this->contactId)
657+
$manager = $prow ? $prow->managerContactId : 0;
658+
if ($manager && $manager != $this->contactId && $prow->has_conflict($this))
660659
return false;
661-
return $this->privChair
662-
|| ($prow && $prow->managerContactId
663-
&& $prow->managerContactId == $this->contactId);
660+
return $this->privChair || $manager == $this->contactId;
664661
}
665662

666663
public function canAdminister($prow, $forceShow = null) {
664+
$manager = $prow ? $prow->managerContactId : 0;
667665
$conflict = $prow && $prow->has_conflict($this);
668-
if ($conflict && $prow->managerContactId
669-
&& $prow->managerContactId != $this->contactId)
666+
if ($manager && $manager != $this->contactId && $conflict)
667+
return false;
668+
else if (($this->privChair || $manager == $this->contactId)
669+
&& (!$conflict || self::override_conflict($forceShow)))
670+
return true;
671+
else
670672
return false;
671-
return ($this->privChair
672-
|| ($prow && $prow->managerContactId
673-
&& $prow->managerContactId == $this->contactId))
674-
&& (!$conflict || self::override_conflict($forceShow));
675673
}
676674

677675
public function actPC($prow, $forceShow = null) {
676+
$manager = $prow ? $prow->managerContactId : 0;
678677
$conflict = $prow && $prow->has_conflict($this);
679-
if ($conflict && $prow->managerContactId
680-
&& $prow->managerContactId != $this->contactId)
678+
if ($manager && $manager != $this->contactId && $conflict)
681679
return false;
682-
return $this->isPC
683-
&& (!$conflict
684-
|| (($this->privChair
685-
|| $prow->managerContactId == $this->contactId)
686-
&& self::override_conflict($forceShow)));
680+
else if (($this->privChair || $manager == $this->contactId)
681+
&& (!$conflict || self::override_conflict($forceShow)))
682+
return true;
683+
else
684+
return $this->isPC && !$conflict;
687685
}
688686

689687
public function actConflictType($prow) {

0 commit comments

Comments
 (0)