コード例 #1
0
 function submit_custom_object($candidate)
 {
     $customObj_from_form = $candidate->loadCustomObject();
     $this->log_debug("looking up custom object");
     $custom_data = $this->getClient()->find_custom_object($candidate);
     $customObject_bh = new \Stratum\Model\CustomObject();
     $customObject_bh->setLogger($this->_logger);
     $customObject_bh->populateFromData($custom_data);
     $id = $customObject_bh->get("id");
     $customObject_bh->set("dateAdded", "");
     //dateAdded is automatically put there by Bullhorn
     if ($id) {
         $customObj_from_form->set("id", $id);
     }
     if ($customObject_bh->compare($customObj_from_form)) {
         $this->log_debug("Custom objects are equal: no update required");
     } else {
         $this->log_debug("Custom object needs update");
         $this->getClient()->submit_custom_object($customObj_from_form, $candidate);
     }
 }
コード例 #2
0
 private function loadCustomObjectFromRequest($candidate, $cos)
 {
     foreach ($cos as $index => $co) {
         $obj = new \Stratum\Model\CustomObject();
         foreach ($co as $key => $values) {
             if (is_array($values)) {
                 $value = implode(",", $values);
             } else {
                 $value = $values;
             }
             //if (strpos($value, "Other")===0) {
             //    $otherVal = substr($value, 7);
             //    if ($otherVal) {
             //        $value = "Other";
             //    }
             //}
             $obj->set($key, $value);
             $this->log_debug("Setting custom object " . $index . " {$key} to {$value}");
         }
         $label = "customObject" . $index . "s";
         $candidate->set($label, $obj);
     }
 }
コード例 #3
0
 public function loadCustomObject($index = 1)
 {
     $name = "customObject" . $index . "s";
     $customObject = $this->get($name);
     if ($customObject) {
         return $customObject;
     }
     $this->log_debug("nothing there in {$name}");
     $there = false;
     //are there any relevant fields in the form submission?
     $co = new \Stratum\Model\CustomObject();
     $co->setLogger($this->_logger);
     foreach ($this->expose_set() as $attr => $value) {
         //now we filter based on what we have vs. what Bullhorn knows
         if (preg_match("/customObject" . $index . "\\.(.*)/", $attr, $m)) {
             $there = true;
             $co->set($m[1], $value);
         }
     }
     if ($there) {
         $this->set($name, $co);
         $this->log_debug("Found a custom object {$name}");
         return $co;
     } else {
         $this->log_debug("Still nothing there after traversing CorporateUser " . $this->get("id"));
         return null;
     }
 }
コード例 #4
0
ファイル: Candidate.php プロジェクト: davenorthcreek/stratum
 public function loadCustomObject($index = 1)
 {
     $name = "customObject" . $index . "s";
     $customObject = null;
     //$customObject = $this->get($name);
     if ($customObject) {
         return $customObject;
     }
     $this->log_debug("nothing there in {$name}");
     $there = false;
     //are there any relevant fields in the form submission?
     $co = new \Stratum\Model\CustomObject();
     $co->setLogger($this->_logger);
     foreach ($this->expose_set() as $attr => $value) {
         //now we filter based on what we have vs. what Bullhorn knows
         if (preg_match("/customObject" . $index . "\\.(.*)/", $attr, $m)) {
             $this->log_debug("Custom Object attribute found: {$attr}");
             $there = true;
             if ($m[1] == 'textBlock3') {
                 $value = preg_replace("/Additional Candidate Notes: /", "", $value);
                 $separator = "\n\n";
             } else {
                 $separator = ", ";
             }
             $old = $co->get($m[1]);
             if ($old) {
                 $value = $old . $separator . $value;
             }
             $co->set($m[1], $value);
         }
     }
     if ($there) {
         $this->set($name, $co);
         $this->log_debug("Found a custom object {$name}");
         return $co;
     } else {
         $this->log_debug("No Custom object with index {$index}");
         return null;
         //$this->log_debug("creating a new $name ($index) for ".$this->get("id"));
         //$obj = new \Stratum\Model\CustomObject();
         //$this->setCustomObject($index, $obj);
         //return $obj;
     }
 }