fix but major bug on date name, as to seach a solution

This commit is contained in:
Alexis Algoud 2016-12-16 16:28:10 +01:00
parent 79867a85d0
commit 41ddaf5d9b
3 changed files with 15 additions and 13 deletions

View File

@ -103,7 +103,7 @@ class Listview {
return $this->db->jdate($date);
}
private function addSqlFromTypeDate(&$TSQLMore, &$value, $sKey, $sBindKey)
private function addSqlFromTypeDate(&$TSQLMore, &$value, $sKey)
{
if(is_array($value))
{
@ -135,7 +135,8 @@ class Listview {
private function addSqlFromOther(&$TSQLMore, &$value, &$TParam, $sKey, $key)
{
if($value==-1) return false;
if(isset($TParam['operator'][$key]))
{
if($TParam['operator'][$key] == '<' || $TParam['operator'][$key] == '>' || $TParam['operator'][$key]=='=')
@ -154,16 +155,18 @@ class Listview {
}
else
{
if(strpos($value,'%')===false) $value = '%'.$value.'%';
$TSQLMore[]=$sKey." LIKE '".addslashes($value)."'" ;
if(strpos($value,'%')===false) $value = '%'.$value.'%';
$TSQLMore[]=$sKey." LIKE '".addslashes($value)."'" ;
}
return true;
}
private function search($sql,&$TParam) {
if(!empty($_REQUEST['Listview'][$this->id]['search'])) {
$ListPOST = GETPOST('Listview');
if(!empty($ListPOST[$this->id]['search'])) {
$sqlGROUPBY='';
if(strpos($sql,'GROUP BY')!==false) { //TODO regex
list($sql, $sqlGROUPBY) = explode('GROUP BY', $sql);
@ -171,7 +174,7 @@ class Listview {
if(strpos($sql,'WHERE ')===false)$sql.=' WHERE 1 '; //TODO regex
foreach($_REQUEST['Listview'][$this->id]['search'] as $key=>$value)
foreach($ListPOST[$this->id]['search'] as $key=>$value)
{
$TsKey = $this->getSearchKey($key, $TParam);
@ -183,7 +186,7 @@ class Listview {
foreach ($TsKey as $i => &$sKey)
{
if($allow_is_null && !empty($_REQUEST['Listview'][$this->id]['search_on_null'][$key]))
if($allow_is_null && !empty($ListPOST[$this->id]['search_on_null'][$key]))
{
$TSQLMore[] = $sKey.' IS NULL ';
$search_on_null = true;

View File

@ -270,7 +270,7 @@ function _action()
$inventory = new Inventory($db);
$inventory->fetch($id);
exportCSV($inventory);
_exportCSV($inventory);
exit;
break;
@ -476,7 +476,7 @@ function _card_line(&$inventory, &$lines, $mode)
}
function exportCSV(&$inventory) {
function _exportCSV(&$inventory) {
global $conf;
header('Content-Type: application/octet-stream');

View File

@ -83,9 +83,8 @@ function _list()
,'rowid'=>'Inventory::getLink(@val@)'
)
,'search'=>array(
'date_inventory'=>'calendar'
,'title'=>true
'date_inventory'=>'calendars'
,'status'=>array(1=>$langs->trans("inventoryValidate"), 0=>$langs->trans("inventoryDraft"))
)
));