コード例 #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
ファイル: 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;
     }
 }