Order/Form: documents can be uploaded even if order is closed already
This commit is contained in:
@@ -40,26 +40,18 @@ class File extends mfBaseModel {
|
||||
|
||||
public function delete() {
|
||||
if($this->id) {
|
||||
$id = $this->id;
|
||||
$id = $this->id;
|
||||
|
||||
// delete file in store
|
||||
if($this->subfolder) {
|
||||
$path = MFUPLOAD_FILE_SAVE_PATH."/".$this->subfolder."/".$this->store_filename;
|
||||
} else {
|
||||
$path = MFUPLOAD_FILE_SAVE_PATH."/".$this->store_filename;
|
||||
}
|
||||
if(!unlink($path)) {
|
||||
$this->log->warn(__CLASS__."::delete(): Error unlinking file ($path)");
|
||||
}
|
||||
// delete physical file
|
||||
if(!unlink($this->getFullPath())) {
|
||||
$this->log->warn(__CLASS__."::delete(): Error unlinking file ({$this->getFullPath()})");
|
||||
}
|
||||
|
||||
$where = "id=$id";
|
||||
if($this->fieldprefix && !strstr($field,"_")) {
|
||||
$where = $this->fieldprefix."_id=$id";
|
||||
}
|
||||
if($this->db->delete($this->table,$where)) {
|
||||
if(method_exists($this, "afterDelete")) {
|
||||
$this->afterDelete();
|
||||
}
|
||||
$where = "id=$id";
|
||||
if($this->db->delete($this->table,$where)) {
|
||||
if(method_exists($this, "afterDelete")) {
|
||||
$this->afterDelete();
|
||||
}
|
||||
$this->data = new stdClass();
|
||||
$this->id = "";
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user