소스 검색

Fix missing the src type and id when uploading a file as a message of
ticket

Laurent Destailleur 1 년 전
부모
커밋
69642e1048
2개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      htdocs/core/lib/files.lib.php
  2. 2 1
      htdocs/ticket/class/ticket.class.php

+ 1 - 1
htdocs/core/lib/files.lib.php

@@ -1037,7 +1037,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
 					$ecmfile->filepath = $rel_dir;
 					$ecmfile->filename = $filename;
 					$ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file
-					$ecmfile->fullpath_orig = $srcfile;
+					$ecmfile->fullpath_orig = basename($srcfile);
 					$ecmfile->gen_or_uploaded = 'uploaded';
 					if (!empty($moreinfo) && !empty($moreinfo['description'])) {
 						$ecmfile->description = $moreinfo['description']; // indexed content

+ 2 - 1
htdocs/ticket/class/ticket.class.php

@@ -2448,7 +2448,8 @@ class Ticket extends CommonObject
 				$destfile = $destdir.'/'.$pathinfo['filename'].' - '.dol_print_date($now, 'dayhourlog').'.'.$pathinfo['extension'];
 			}
 
-			$res = dol_move($filepath[$i], $destfile, 0, 1, 0, 1);
+			$moreinfo = array('description'=>'File saved by copyFilesForTicket', 'src_object_type' => $this->element, 'src_object_id' => $this->id);
+			$res = dol_move($filepath[$i], $destfile, 0, 1, 0, 1, $moreinfo);
 			if (!$res) {
 				// Move has failed
 				$this->error = "Failed to move file ".dirbasename($filepath[$i])." into ".dirbasename($destfile);