echo _('Add Note (use : for loading the emoji and @ for users)'); ?> <br /> <?php $e_add_notes = new Event("Notes->eventAddNotes"); $e_add_notes->addParam("idmodule",$module_id); $e_add_notes->addParam("module",$module); $e_add_notes->addParam("sqrecord",$sqcrm_record_id); echo '<form class="form-horizontal" id="Notes__eventAddNotes" name="Notes__eventAddNotes" method="post" enctype="multipart/form-data">'; echo $e_add_notes->getFormEvent(); ?> <?php FieldType200::display_field('entity_notes','','expand_text_area'); ?> <br /><br /> <?php FieldType21::display_field('note_files'); ?> <br /><br /> <div id="notes_submit"> <input type="submit" class="btn btn-primary" value="<?php echo _('Save');?>"/> </div> </form> </div> <hr class="form_hr"> <?php } ?> <?php if ($_SESSION["do_crm_action_permission"]->action_permitted('view',8) === true) { ?> <div id="notes_entry"> <!-- note content section loading with ajax -->
/** * event function to delete the notes * @param object $evctl * first it will delete the note and then check if there are some document attached with it. * if documents are attached then delete from the database and then from physical location * @see class/core/CRMFilesAndAttachments.class.php * @see class/fields/fieldtypes/FieldType21.class.php */ function eventAjaxDeleteNotes(\EventControler $evctl) { if ((int) $evctl->idnotes > 0) { $this->getId($evctl->idnotes); if ($_SESSION["do_cpaneluser"]->idcpanel_user === $this->idcpanel_user) { $qry = "\n\t\t\t\tdelete from `" . $this->getTable() . "`\n\t\t\t\twhere \n\t\t\t\t`idnotes` = ?\n\t\t\t\t"; $this->query($qry, array((int) $evctl->idnotes)); $do_files_and_attachment = new \CRMFilesAndAttachments(); $do_files_and_attachment->get_uploaded_files(8, (int) $evctl->idnotes); if ($do_files_and_attachment->getNumRows() > 0) { while ($do_files_and_attachment->next()) { $file_name = $do_files_and_attachment->file_name; $file_extension = $do_files_and_attachment->file_extension; $do_files_and_attachment->delete_record($do_files_and_attachment->idfile_uploads); \FieldType21::remove_file($file_name, $file_extension); } } echo '1'; } else { echo '0'; } } }