public function query_by_indi_id($id, $batch_id) { $sql = 'SELECT * FROM rp_indi_note WHERE indi_id = ? AND indi_batch_id = ?'; $sql_query = new RP_Sql_Query($sql, $this->prefix); $sql_query->set($id); $sql_query->set_number($batch_id); $notes = $this->get_list($sql_query); if (isset($notes) && count($notes) > 0) { foreach ($notes as $note) { if ((!isset($note->note) || empty($note->note)) && isset($note->note_rec_id)) { $rec = RP_Dao_Factory::get_rp_note_dao($this->prefix)->load($note->note_rec_id, $batch_id); $note->note = $rec->submitter_text; } } } return $notes; }
/** * * @param RP_Note_Record $note */ function add_note_rec($note) { $need_update = false; $note_rec = new RP_Note_Rec(); $note_rec->id = $note->id; $note_rec->batch_id = $this->batch_id; $note_rec->submitter_text = $note->text; try { RP_Dao_Factory::get_rp_note_dao($this->credentials->prefix)->insert($note_rec); } catch (Exception $e) { if (stristr($e->getMessage(), 'Duplicate entry') >= 0) { $need_update = true; } else { error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0); echo $e->getMessage(); throw $e; } } if ($need_update) { try { RP_Dao_Factory::get_rp_note_dao($this->credentials->prefix)->update($note_rec); } catch (Exception $e) { error_log($e->getMessage() . "::" . RP_Persona_Helper::trace_caller(), 0); echo $e->getMessage(); throw $e; } } }