Can get first image from index using a path without name
This commit is contained in:
parent
6c2d70d43b
commit
6e761d5c98
@ -304,7 +304,7 @@ class EcmFiles extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $id Id object
|
* @param int $id Id object
|
||||||
* @param string $ref Hash of file name (filename+filepath). Not always defined on some version.
|
* @param string $ref Hash of file name (filename+filepath). Not always defined on some version.
|
||||||
* @param string $relativepath Relative path of file from document directory. Example: path/path2/file
|
* @param string $relativepath Relative path of file from document directory. Example: 'path/path2/file' or 'path/path2/*'
|
||||||
* @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed.
|
* @param string $hashoffile Hash of file content. Take the first one found if same file is at different places. This hash will also change if file content is changed.
|
||||||
* @param string $hashforshare Hash of file sharing.
|
* @param string $hashforshare Hash of file sharing.
|
||||||
* @param string $src_object_type src_object_type to search
|
* @param string $src_object_type src_object_type to search
|
||||||
@ -347,7 +347,11 @@ class EcmFiles extends CommonObject
|
|||||||
}*/
|
}*/
|
||||||
if ($relativepath) {
|
if ($relativepath) {
|
||||||
$relativepathwithnoexe = preg_replace('/\.noexe$/', '', $relativepath); // We must never have the .noexe into the database
|
$relativepathwithnoexe = preg_replace('/\.noexe$/', '', $relativepath); // We must never have the .noexe into the database
|
||||||
$sql .= " AND t.filepath = '".$this->db->escape(dirname($relativepath))."' AND t.filename = '".$this->db->escape(basename($relativepathwithnoexe))."'";
|
$sql .= " AND t.filepath = '".$this->db->escape(dirname($relativepath))."'";
|
||||||
|
$filename = basename($relativepathwithnoexe);
|
||||||
|
if ($filename != '*') {
|
||||||
|
$sql .= " AND t.filename = '".$this->db->escape($filename)."'";
|
||||||
|
}
|
||||||
$sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index
|
$sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index
|
||||||
} elseif (!empty($ref)) { // hash of file path
|
} elseif (!empty($ref)) { // hash of file path
|
||||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user