Add php files
This commit is contained in:
35
modules/Documents/autocomplete.php
Normal file
35
modules/Documents/autocomplete.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
if($_REQUEST['to_pdf']==1 && $_REQUEST['search_module']!="" && $_REQUEST['term']!=""){
|
||||
|
||||
|
||||
$search_in =array(
|
||||
'Accounts'=>array('name'),
|
||||
'Contacts'=> array(
|
||||
'first_name',
|
||||
'last_name'
|
||||
),
|
||||
'EcmSales'=>array('document_no'),
|
||||
'EcmStockDocIns'=>array('document_no'),
|
||||
'EcmInvoiceOuts'=>array('document_no'),
|
||||
'EcmProducts'=>array('name'),
|
||||
|
||||
);
|
||||
|
||||
$query="select id,concat(".implode(",' ',",$search_in[$_REQUEST['search_module']]).") as value
|
||||
from ".strtolower($_REQUEST['search_module'])."
|
||||
where concat(".implode(",' ',",$search_in[$_REQUEST['search_module']]).") like '%".$_REQUEST['term']."%' and deleted=0 limit 10";
|
||||
|
||||
$db=$GLOBALS['db'];
|
||||
|
||||
$res=$db->query($query);
|
||||
$output=array();
|
||||
while($dane=$db->fetchByAssoc($res)){
|
||||
$dane['value']=html_entity_decode($dane['value']);
|
||||
$output[]=$dane;
|
||||
}
|
||||
|
||||
echo json_encode($output);
|
||||
return "";
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user