uploadfile)) { $this->filename = $this->uploadfile; } return parent::save($check_notify); } /** * @see SugarBean::fill_in_additional_detail_fields() */ public function fill_in_additional_detail_fields() { global $app_list_strings; global $img_name; global $img_name_bare; $this->uploadfile = $this->filename; // Bug 41453 - Make sure we call the parent method as well parent::fill_in_additional_detail_fields(); if (!$this->file_ext) { $img_name = SugarThemeRegistry::current()->getImageURL(strtolower($this->file_ext)."_image_inline.gif"); $img_name_bare = strtolower($this->file_ext)."_image_inline"; } //set default file name. if (!empty ($img_name) && file_exists($img_name)) { $img_name = $img_name_bare; } else { $img_name = "def_image_inline"; //todo change the default image. } $this->file_url_noimage = $this->id; if(!empty($this->status_id)) { $this->status = $app_list_strings['document_status_dom'][$this->status_id]; } } /** * @see SugarBean::retrieve() */ public function retrieve($id = -1, $encode=true, $deleted=true) { $ret_val = parent::retrieve($id, $encode, $deleted); $this->name = $this->document_name; return $ret_val; } /** * Method to delete an attachment * * @param string $isduplicate * @return bool */ public function deleteAttachment($isduplicate = "false") { if ($this->ACLAccess('edit')) { if ($isduplicate == "true") { return true; } $removeFile = "upload://{$this->id}"; } if (file_exists($removeFile)) { if (!unlink($removeFile)) { $GLOBALS['log']->error("*** Could not unlink() file: [ {$removeFile} ]"); } else { $this->uploadfile = '';$this->uploadfile = ''; $this->filename = ''; $this->file_mime_type = ''; $this->file_ext = ''; $this->save(); return true; } } else { $this->uploadfile = ''; $this->filename = ''; $this->file_mime_type = ''; $this->file_ext = ''; $this->save(); return true; } return false; } }