Fix filter

This commit is contained in:
Laurent Destailleur
2022-03-14 16:20:57 +01:00
parent 9961fc6369
commit f789fc24f7
2 changed files with 8 additions and 4 deletions

View File

@@ -1167,7 +1167,7 @@ $(document).ready(function() {
});
<?php } ?>
// Force to hide menus when page is inside an iFrame
// Force to hide menus when page is inside an iFrame so we can show any page into a dialog popup
$(document).ready(function() {
if (window.location !== window.parent.location ) {
console.log("Page is detected to be into an iframe, we hide by CSS the menus");

View File

@@ -369,7 +369,7 @@ class EcmFiles extends CommonObject
* @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' 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 $hashforshare Hash of file sharing.
* @param string $hashforshare Hash of file sharing or 'shared'
* @param string $src_object_type src_object_type to search (value of object->table_element)
* @param string $src_object_id src_object_id to search
* @return int <0 if KO, 0 if not found, >0 if OK
@@ -425,12 +425,16 @@ class EcmFiles extends CommonObject
$sql .= " AND t.label = '".$this->db->escape($hashoffile)."'";
$sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index
} elseif (!empty($hashforshare)) {
if ($hashforshare != 'shared') {
$sql .= " AND t.share = '".$this->db->escape($hashforshare)."'";
} else {
$sql .= " AND t.share IS NOT NULL AND t.share <> ''";
}
//$sql .= " AND t.entity = ".$conf->entity; // hashforshare already unique
} elseif ($src_object_type && $src_object_id) {
// Warning: May return several record, and only first one is returned !
$sql .= " AND t.src_object_type = '".$this->db->escape($src_object_type)."' AND t.src_object_id = ".((int) $src_object_id);
$sql .= " AND t.entity = ".$conf->entity;
$sql .= " AND t.entity = ".((int) $conf->entity);
} else {
$sql .= ' AND t.rowid = '.((int) $id); // rowid already unique
}