/** * Overriding add() method from the parent class */ function add() { $do_NoteDraft = new NoteDraft(); $idnote_draft = $do_NoteDraft->isDraftExist($this->idproject_task, 'project_discuss'); if ($idnote_draft) { $do_NoteDraft->getId($idnote_draft); $do_NoteDraft->delete(); } if (get_magic_quotes_gpc()) { $project_discuss = $this->discuss; } else { $project_discuss = addslashes($this->discuss); } $this->query("INSERT INTO project_discuss (idproject_task,discuss,date_added,document,hours_work,iduser,discuss_edit_access,type)\n VALUES \n (" . $this->idproject_task . ",'" . $project_discuss . "','" . $this->date_added . "','" . $this->document . "'," . $this->hours_work . "," . $this->iduser . ",'" . $this->discuss_edit_access . "','Note')"); $this->setPrimaryKeyValue($this->getInsertId($this->getTable(), $this->getPrimaryKey())); }
/** * eventFormatNoteInsert * This event format the note upon insert in the database. * Should be run before eventAdd or eventUpdate * It will modify the event_controler values. */ function eventFormatNoteInsert(EventControler $event_controler) { $Parsedown = new Parsedown(); $do_NoteDraft = new NoteDraft(); $idnote_draft = $do_NoteDraft->isDraftExist($this->idcontact, 'contact_note'); if ($idnote_draft) { $do_NoteDraft->getId($idnote_draft); $do_NoteDraft->delete(); } $fields = $event_controler->fields; $fields['note'] = $Parsedown->text(htmlentities($fields['note'])); $event_controler->fields = $fields; }