function insertIntoAttachment($id, $module) { global $log, $adb; $log->debug("Entering into insertIntoAttachment({$id},{$module}) method."); $file_saved = false; //Added to send generated Invoice PDF with mail $pdfAttached = $_REQUEST['pdf_attachment']; //created Invoice pdf is attached with the mail if (isset($_REQUEST['pdf_attachment']) && $_REQUEST['pdf_attachment'] != '') { $file_saved = pdfAttach($this, $module, $pdfAttached, $id); } //This is to added to store the existing attachment id of the contact where we should delete this when we give new image foreach ($_FILES as $fileindex => $files) { if ($files['name'] != '' && $files['size'] > 0) { $files['original_name'] = vtlib_purify($_REQUEST[$fileindex . '_hidden']); $file_saved = $this->uploadAndSaveFile($id, $module, $files); } } if ($module == 'Emails' && isset($_REQUEST['att_id_list']) && $_REQUEST['att_id_list'] != '') { $att_lists = explode(";", $_REQUEST['att_id_list'], -1); $id_cnt = count($att_lists); if ($id_cnt != 0) { for ($i = 0; $i < $id_cnt; $i++) { $sql_rel = 'insert into vtiger_seattachmentsrel values(?,?)'; $adb->pquery($sql_rel, array($id, $att_lists[$i])); } } } if ($_REQUEST['att_module'] == 'Webmails') { require_once "modules/Webmails/Webmails.php"; require_once "modules/Webmails/MailParse.php"; require_once 'modules/Webmails/MailBox.php'; //$mailInfo = getMailServerInfo($current_user); //$temprow = $adb->fetch_array($mailInfo); $MailBox = new MailBox($_REQUEST["mailbox"]); $mbox = $MailBox->mbox; $webmail = new Webmails($mbox, $_REQUEST['mailid']); $array_tab = array(); $webmail->loadMail($array_tab); if (isset($webmail->att_details)) { foreach ($webmail->att_details as $fileindex => $files) { if ($files['name'] != '' && $files['size'] > 0) { //print_r($files); $file_saved = $this->saveForwardAttachments($id, $module, $files); } } } } $log->debug("Exiting from insertIntoAttachment({$id},{$module}) method."); }
function insertIntoAttachment($id, $module) { $adb = PearDatabase::getInstance(); $log = vglobal('log'); $log->debug("Entering into insertIntoAttachment({$id},{$module}) method."); $file_saved = false; //Added to send generated Invoice PDF with mail $pdfAttached = $_REQUEST['pdf_attachment']; //created Invoice pdf is attached with the mail if (isset($_REQUEST['pdf_attachment']) && $_REQUEST['pdf_attachment'] != '') { $file_saved = pdfAttach($this, $module, $pdfAttached, $id); } //This is to added to store the existing attachment id of the contact where we should delete this when we give new image foreach ($_FILES as $fileindex => $files) { if ($files['name'] != '' && $files['size'] > 0) { $files['original_name'] = vtlib_purify($_REQUEST[$fileindex . '_hidden']); $file_saved = $this->uploadAndSaveFile($id, $module, $files); } } if ($module == 'Emails' && isset($_REQUEST['att_id_list']) && $_REQUEST['att_id_list'] != '') { $att_lists = explode(";", $_REQUEST['att_id_list'], -1); $id_cnt = count($att_lists); if ($id_cnt != 0) { for ($i = 0; $i < $id_cnt; $i++) { $sql_rel = 'insert into vtiger_seattachmentsrel values(?,?)'; $adb->pquery($sql_rel, array($id, $att_lists[$i])); } } } $log->debug("Exiting from insertIntoAttachment({$id},{$module}) method."); }