Ok. So, I've been customizing the business card form because i want only minimal information to be put in when the contact is submitted. there is a "create note" link in the form and I would find this functionality to be very useful if there was a way to add an attachment to the note.
So, far, I've found that the 'getFormBody' function in modules/notes/noteformbase.php is what calls this form on the click of the link. I've added the html to add the upload file field to the form, but I can't get it to actually save the attachment. Can someone help me figure out how to get the form to actually save the attachment when clicking the save button? I would appreciate it very much.
Here's the code from noteformbase.php: the additions begin about 32 lines down
Code:function getFormBody($prefix, $mod='',$formname='', $size='30',$script=true){ if(!ACLController::checkAccess('Notes', 'edit', true)){ return ''; } global $mod_strings; $temp_strings = $mod_strings; if(!empty($mod)){ global $current_language; $mod_strings = return_module_language($current_language, $mod); } global $app_strings; global $app_list_strings; $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL']; $lbl_note_subject = $mod_strings['LBL_NOTE_SUBJECT']; $lbl_note_description = $mod_strings['LBL_NOTE']; $default_parent_type= $app_list_strings['record_type_default_key']; $form = <<<EOF <input type="hidden" name="${prefix}record" value=""> <input type="hidden" name="${prefix}parent_type" value="${default_parent_type}"> <p> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td class="dataLabel">$lbl_note_subject <span class="required">$lbl_required_symbol</span></td> </tr> <tr> <td class="dataField"><input name='${prefix}name' size='${size}' maxlength='255' type="text" value=""></td> </tr> //BEGINNING OF ADDED CODE <tr> <td class="dataLabel"> Attachment: </td> </tr> <tr> <td class='dataField' colspan='3' NOWRAP> <span id='new_attachment' style='display:'> <input name='${prefix}uploadfile' tabindex="3" type="file" size="60"/> </span> <span id='old_attachment' style='display:none'> <input tabindex="0" type='hidden' name='${prefix}deleteAttachment' value='0'> <input tabindex="0" type='hidden' name='${prefix}old_filename' value=''/><input tabindex="0" type='hidden' name='old_id' value=''/> <input tabindex="0" type='button' class='button' value='Remove' onclick='ajaxStatus.showStatus(SUGAR.language.get("Notes", "LBL_REMOVING_ATTACHMENT"));this.form.deleteAttachment.value=1;this.form.action.value="EditView";SUGAR.dashlets.postForm(this.form, deleteAttachmentCallBack);this.form.deleteAttachment.value=0;this.form.action.value="";' > </span> </tr> //END OF ADDED CODE <tr> <td class="dataLabel">$lbl_note_description</td> </tr> <tr> <td class="dataField"><textarea name='${prefix}description' cols='${size}' rows='4' ></textarea></td> </tr> </table></p> EOF; if ($script) { require_once('include/javascript/javascript.php'); require_once('modules/Notes/Note.php'); $javascript = new javascript(); $javascript->setFormName($formname); $javascript->setSugarBean(new Note()); $javascript->addRequiredFields($prefix); $form .=$javascript->getScript(); } $mod_strings = $temp_strings; return $form; }


LinkBack URL
About LinkBacks



Reply With Quote
Bookmarks