Feature 5388: Print Invoices (documents) list gets too long. Fixed by default 180...
[fa-stable.git] / admin / security_roles.php
index bce6661f2e2cc88a414f68f4238f33c38ee44b10..4b438091f237794d6cfce657ea247aed74b7f2a1 100644 (file)
@@ -85,15 +85,15 @@ if (get_post('addupdate'))
                $sections = array();
                $areas = array();
                foreach($_POST as $p =>$val) {
-                       if (substr($p,0,4) == 'Area') {
+                       if (substr($p,0,4) == 'Area' && $val == 1) {
                                $a = substr($p, 4);
                                if (($a&~0xffff) && (($a&0xff00)<(99<<8))) {
                                        $sections[] = $a&~0xff; // add extended section for plugins
                                }
-                               $areas[] = $a;
+                               $areas[] = (int)$a;
                        }
-                       if (substr($p,0,7) == 'Section')
-                               $sections[] = substr($p, 7);
+                       if (substr($p,0,7) == 'Section' && $val == 1)
+                               $sections[] = (int)substr($p, 7);
                }
 //             $areas = sort_areas($areas);
 
@@ -147,9 +147,6 @@ if (!isset($_POST['role']) || get_post('clone') || list_updated('role')) {
                $row = get_security_role($id);
                $_POST['description'] = $row['description'];
                $_POST['name'] = $row['role'];
-//     if ($row['inactive']
-//             $_POST['inactive'] = 1;
-       
                $_POST['inactive'] = $row['inactive'];
                $access = $row['areas'];
                $sections = $row['sections'];
@@ -173,7 +170,7 @@ if (!isset($_POST['role']) || get_post('clone') || list_updated('role')) {
 
 start_form();
 
-start_table("class='tablestyle_noborder'");
+start_table(TABLESTYLE_NOBORDER);
 start_row();
 security_roles_list_cells(_("Role:"). "&nbsp;", 'role', null, true, true, check_value('show_inactive'));
 $new_role = get_post('role')=='';
@@ -191,13 +188,13 @@ if (find_submit('_Section')) {
 }
 //-----------------------------------------------------------------------------------------------
 div_start('details');
-start_table($table_style2);
+start_table(TABLESTYLE2);
        text_row(_("Role name:"), 'name', null, 20, 22);
        text_row(_("Role description:"), 'description', null, 50, 52);
        record_status_list_row(_("Current status:"), 'inactive');
 end_table(1);
 
-       start_table("$table_style width=40%");
+       start_table(TABLESTYLE, "width='40%'");
 
        $k = $j = 0; //row colour counter
        $ext = $sec = $m = -1;
@@ -214,8 +211,6 @@ end_table(1);
                        $ext = $newext; 
                        $sec = $newsec;
                        $m = $parms[0] & ~0xff;
-//                     if(!isset($security_sections[$m]))
-//                      display_error(sprintf("Bad section %X:", $m));
                        label_row($security_sections[$m].':', 
                                checkbox( null, 'Section'.$m, null, true, 
                                        _("On/off set of features")),
@@ -254,4 +249,3 @@ div_end();
 end_form();
 end_page();
 
-?>