Merge branch 'master' of ssh://git.code.sf.net/p/frontaccounting/git
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 9 May 2015 21:07:36 +0000 (23:07 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Sat, 9 May 2015 21:07:36 +0000 (23:07 +0200)
admin/users.php
includes/db_pager.inc
includes/ui/ui_lists.inc

index 135e0068cd013819365b6d81c1447f8ec417ab32..2074bc1945c11c424420cfe8cd91a18b5f40cc1c 100644 (file)
@@ -23,7 +23,7 @@ include_once($path_to_root . "/admin/db/users_db.inc");
 simple_page_mode(true);
 //-------------------------------------------------------------------------------------------------
 
-function can_process() 
+function can_process($new
 {
 
        if (strlen($_POST['user_id']) < 4)
@@ -33,7 +33,7 @@ function can_process()
                return false;
        }
 
-       if ($_POST['password'] != "") 
+       if (!$new && ($_POST['password'] != ""))
        {
        if (strlen($_POST['password']) < 4)
        {
@@ -58,7 +58,7 @@ function can_process()
 if (($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM') && check_csrf_token())
 {
 
-       if (can_process())
+       if (can_process($Mode == 'ADD_ITEM'))
        {
        if ($selected_id != -1) 
        {
index c2ae04b6ecbd15b474981232b1fee77c8dfdfc39..522b04b6873eb1aa9da1ca2258fa8c053c6d8574 100644 (file)
@@ -287,11 +287,8 @@ class db_pager {
                }
                if ($where) $where = " WHERE ($where)";
 
-               if ($count) {
-                       $group = $group == '' ? "*" : "DISTINCT $group";
-
-                       return "SELECT COUNT(*) FROM (SELECT $group FROM $from $where) tmp_count";
-               }
+               if ($count)
+                       return "SELECT COUNT(*) FROM ($this->sql) tmp_count";
 
                $sql = "$select FROM $from $where";
                if ($group) $sql.= " GROUP BY $group";
@@ -303,8 +300,8 @@ class db_pager {
                                        if(isset($col['ord_priority'])) {
                                                $columns[$col['ord_priority']] = $col;
                                        }
-                       }
-                       krsort($columns);
+               }
+               krsort($columns);
 
            foreach ($columns as $col) {
                if (isset($col['ord'])) {
@@ -313,7 +310,7 @@ class db_pager {
                            }
                        }
            }
-                               
+
            if (count($ord)) {
                        $ord = array_map(function_exists('mysql_real_escape_string') ? 
                                'mysql_real_escape_string': 'mysql_escape_string', $ord);
index 456f01938aa6e5e5c76162e69a6984327d1713a1..2cc16888e5fdbd15a94e587fccbadc0ca1691843 100644 (file)
@@ -678,7 +678,7 @@ return combo_input($name, $selected_id, $sql, 'id', '',
 function _format_fiscalyears($row)
 {
        return sql2date($row[1]) . "&nbsp;-&nbsp;" . sql2date($row[2])
-       . "&nbsp;&nbsp;" . ($row[3] ? _('Closed') : _('Active')) . "</option>\n";
+       . "&nbsp;&nbsp;" . ($row[3] ? _('Closed') : _('Active'));
 }
 
 function fiscalyears_list_cells($label, $name, $selected_id=null)