diff --git a/webui/model/search/search.php b/webui/model/search/search.php index 4e98a08..0408e00 100644 --- a/webui/model/search/search.php +++ b/webui/model/search/search.php @@ -261,7 +261,7 @@ if($match) { $match .= " & "; } $match .= "(@subject " . $data['subject'] . ") "; } - if($data['attachment_type'] && $data['attachment_type'] != "any") { if($match) { $match .= " & "; } $match .= "(@attachment_types " . $data['attachment_type'] . ") "; } + if($data['attachment_type'] && !strstr($data['attachment_type'], "any")) { if($match) { $match .= " & "; } $match .= "(@attachment_types " . preg_replace("/\,/", "|", $data['attachment_type']) . ") "; } if($data['any']) { @@ -287,7 +287,7 @@ if(preg_match("/^(\>|\<)\={0,}\d{1,}$/", $data['size'])) { $size = "size " . $data['size'] . " AND "; } } - if(isset($data['attachment_type']) && $data['attachment_type'] == 'any') { $a = "attachments > 0 AND "; } + if(isset($data['attachment_type']) && strstr($data['attachment_type'], 'any')) { $a = "attachments > 0 AND "; } else if(isset($data['has_attachment']) && $data['has_attachment'] == 1) { $attachment = "attachments > 0 AND "; } diff --git a/webui/view/javascript/piler-in.js b/webui/view/javascript/piler-in.js index aff6cda..15057b8 100644 --- a/webui/view/javascript/piler-in.js +++ b/webui/view/javascript/piler-in.js @@ -559,6 +559,16 @@ Piler.assemble_folder_restrictions(); + var attachments_type = ''; + + if($('input#xhas_attachment_any', z)[0].checked) { attachments_type += ',any'; } + if($('input#xhas_attachment_doc', z)[0].checked) { attachments_type += ',word'; } + if($('input#xhas_attachment_xls', z)[0].checked) { attachments_type += ',excel'; } + if($('input#xhas_attachment_pdf', z)[0].checked) { attachments_type += ',pdf'; } + if($('input#xhas_attachment_image', z)[0].checked) { attachments_type += ',image'; } + + if(attachments_type) { attachments_type = attachments_type.substring(1, attachments_type.length); } + Piler.Searches.Complex = { from : $.trim($('input#xfrom', z).val()), to : $.trim($('input#xto', z).val()), @@ -566,7 +576,7 @@ body : $.trim($('input#xbody', z).val()), tag : $.trim($('input#xtag', z).val()), note : $.trim($('input#xnote', z).val()), - attachment_type : $('input#xhas_attachment', z)[0].checked ? 'any' : '', + attachment_type : attachments_type, date1 : $.trim($('input#date1', z).val()), date2 : $.trim($('input#date2', z).val()), searchtype : 'simple', diff --git a/webui/view/theme/default/templates/search/popup.tpl b/webui/view/theme/default/templates/search/popup.tpl index e40658f..f26df8a 100644 --- a/webui/view/theme/default/templates/search/popup.tpl +++ b/webui/view/theme/default/templates/search/popup.tpl @@ -60,6 +60,18 @@