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

View File

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

View File

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