Marius Cramer
2013-10-14 d9bcf68e395d6156645a7974b1a992aa6e6c00aa
interface/lib/classes/listform.inc.php
@@ -180,9 +180,10 @@
        if(@is_array($this->listDef['item'])) { 
            foreach($this->listDef['item'] as $i) {
                $field = $i['field'];
            $table = $i['table'];
                // if($_REQUEST[$search_prefix.$field] != '') $sql_where .= " $field ".$i["op"]." '".$i["prefix"].$_REQUEST[$search_prefix.$field].$i["suffix"]."' and";
              if(isset($_SESSION['search'][$list_name][$search_prefix.$field]) && $_SESSION['search'][$list_name][$search_prefix.$field] != ''){
                    $sql_where .= " $field ".$i['op']." '".$app->db->quote($i['prefix'].$_SESSION['search'][$list_name][$search_prefix.$field].$i['suffix'])."' and";
                    $sql_where .= " ".($table != ''? $table.'.' : $this->listDef['table'].'.')."$field ".$i['op']." '".$app->db->quote($i['prefix'].$_SESSION['search'][$list_name][$search_prefix.$field].$i['suffix'])."' and";
                }
            }
        }
@@ -192,11 +193,16 @@
    public function getPagingSQL($sql_where = '1') 
    {
        global $app, $conf;
        //* Add Global Limit from selectbox
        if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit'])){
      //* Add Global Limit from selectbox
        if(!empty($_POST['search_limit']) AND $app->functions->intval($_POST['search_limit']) > 0){
         $_SESSION['search']['limit'] = $app->functions->intval($_POST['search_limit']);
      }
      //if(preg_match('{^[0-9]$}',$_SESSION['search']['limit'])){
      //   $_SESSION['search']['limit'] = 15;
      //}
      if(intval($_SESSION['search']['limit']) < 1) $_SESSION['search']['limit'] = 15;
        //* Get Config variables
        $list_name          = $this->listDef['name'];
@@ -216,7 +222,7 @@
        if($this->searchChanged == 1) $_SESSION['search'][$list_name]['page'] = 0;
        $sql_von = $app->functions->intval($_SESSION['search'][$list_name]['page'] * $records_per_page);
        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table WHERE $sql_where");
        $record_count = $app->db->queryOneRecord("SELECT count(*) AS anzahl FROM $table".($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')." WHERE $sql_where");
        $pages = $app->functions->intval(($record_count['anzahl'] - 1) / $records_per_page);