Ejemplo n.º 1
0
 public function HandleAccession($staging, $tosave)
 {
     if (!$this->accession_num) {
         return null;
     }
     switch ($this->accession) {
         case 'code':
             $object = new Codes();
             $object->fromArray(array('code_date' => $this->accession_date ? strtotime($this->accession_date) : null, 'code' => $this->accession_num));
             $staging->addRelated($object);
             break;
         case "igs":
             $staging->setIgDate($this->accession_date);
             $staging->setIgNum($this->accession_num);
             break;
         default:
             return null;
     }
 }
 public function duplicate($id)
 {
     // reembed duplicated comment
     $Comments = Doctrine::getTable('Comments')->findForTable('loan_items', $id);
     foreach ($Comments as $key => $val) {
         $comment = new Comments();
         $comment->fromArray($val->toArray());
         $form = new CommentsSubForm($comment);
         $this->attachEmbedRecord('Comments', $form, $key);
     }
     // reembed duplicated codes
     $Codes = Doctrine::getTable('Codes')->getCodesRelatedArray('loan_items', $id);
     foreach ($Codes as $key => $code) {
         $newCode = new Codes();
         $newCode->fromArray($code->toArray());
         $form = new CodesSubForm($newCode);
         $this->attachEmbedRecord('Codes', $form, $key);
     }
     // reembed duplicated insurances
     $Insurances = Doctrine::getTable('Insurances')->findForTable('loan_items', $id);
     foreach ($Insurances as $key => $val) {
         $insurance = new Insurances();
         $insurance->fromArray($val->toArray());
         $form = new InsurancesSubForm($insurance);
         $this->attachEmbedRecord('Insurances', $form, $key);
     }
 }