Пример #1
0
 public function getAndChangeAgentRelationsFromRequest($agentrelationsid = '')
 {
     $result = new agentrelations();
     $ct = new ctrelationshiptypes();
     $agentrelationsid = preg_replace("[^0-9]", '', $agentrelationsid);
     if (strlen($agentrelationsid) > 0) {
         $result->load($agentrelationsid);
     }
     $result->setfromagentid($_REQUEST["fromagentid"]);
     $result->settoagentid($_REQUEST["toagentid"]);
     $result->setrelationship($_REQUEST["relationship"]);
     $result->setnotes($_REQUEST["notes"]);
     if ($ct->isInverse($result->getrelationship())) {
         // if name of an inverse relationship was given, flip to forward
         $result->setrelationship($ct->flipToForward($result->getrelationship()));
         $to = $result->getfromagentid();
         $from = $result->gettoagentid();
         $result->settoagentid($to);
         $result->setfromagentid($from);
     }
     return $result;
 }