diff --git a/html/js/managetable.js b/html/js/managetable.js index ba54f184e..5d8081bde 100644 --- a/html/js/managetable.js +++ b/html/js/managetable.js @@ -128,7 +128,17 @@ var ManageTable = function (p_table_name) // value if less than insert before var i = 0; for (i = 1;i p_element_row.cells[sort_column].getAttribute('sort_value')) { + var table_value=p_table.rows[i].cells[sort_column].getAttribute('sort_value') ; + var element_value=p_element_row.cells[sort_column].getAttribute('sort_value'); + + // if both are numeric so we force a numeric comparison + if ( ! isNaN(parseFloat(table_value)) && ! isNaN(parseFloat(element_value)) ) { + table_value=parseFloat(table_value); + element_value=parseFloat(element_value); + } + + if (table_value > element_value) { + var row=p_table.insertRow(i); row.innerHTML=p_element_row.innerHTML; row.id=p_element_row.id; diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index fc14cb026..5b9ea64ef 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -997,7 +997,10 @@ function check() * to be appended or modified. Can be override if you need * a more complex form or add elements with "set_order" before * calling this function. - * This function does not add the form , only the table, + * This function does not add the form , only the table. + * + * It returns true , if it is not readyonly and the form will have a "save" button, if it returns nothing or false + * then there is no save button, nor form, the content is then readonly * */ function input() @@ -1089,6 +1092,7 @@ function check() echo ""; } echo ""; + return true; } /** * @brief this function let you create your own input , for example for a ITEXT , a IRADIO , ... @@ -1179,7 +1183,10 @@ function check() } /** - * @brief send an xml with input of the object, create an xml answer. + * @brief send an xml with input of the object, create an xml answer. It will call Manage_Table_SQL.input to + * display the input , but if that function returns false, the "save" button will disappear but the form can be + * submitted with enter. + * * XML Tag * - status : OK , NOK * - ctl : Dom id to update @@ -1201,7 +1208,8 @@ function check() $this->object_name, $this->table->get_pk_value(), $this->object_name, $this->object_name, $this->table->get_pk_value()); - $this->input(); + $can_update=$this->input(); + $can_update =( $can_update===false) ? false:true; // JSON param to hidden echo HtmlInput::json_to_hidden($this->json_parameter); echo HtmlInput::hidden("p_id", $this->table->get_pk_value()); @@ -1209,11 +1217,14 @@ function check() $close=sprintf("\$('%s').remove()", $this->dialog_box); // display error if any $this->display_error(); - echo '