35 lines
883 B
PHP
35 lines
883 B
PHP
<?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 "";
|
|
}
|
|
?>
|