Merge branch '599-csv_divider_selector' into 'develop'

599 csv divider selector

See merge request !359
This commit is contained in:
vgilc 2017-05-22 17:11:52 +02:00
commit 6bded36a60
2 changed files with 49 additions and 1 deletions

View File

@ -756,6 +756,26 @@ $table_other->data[$row][1] .= html_print_input_hidden ('interval_to_delete', ''
//----------------------------------------------------------------------
$row++;
$common_dividers = array(
";" => ";",
"," => ",",
"|" => "|");
$table_other->data[$row][0] = __('CSV divider');
if ($config['csv_divider'] != ";" && $config['csv_divider'] != "," && $config['csv_divider'] != "|") {
$table_other->data[$row][1] = html_print_input_text ('csv_divider', $config['csv_divider'], "", 20, 255, true);
$table_other->data[$row][1] .= '<a id="csv_divider_custom" onclick="javascript: edit_csv_divider();">' .
html_print_image('images/default_list.png', true, array('id' => 'select')) .
"</a>";
}
else {
$table_other->data[$row][1] = html_print_select ($common_dividers, 'csv_divider', $config['csv_divider'], "", '', '', true, false, false);
$table_other->data[$row][1] .= '<a id="csv_divider_custom" onclick="javascript: edit_csv_divider();">' .
html_print_image('images/pencil.png', true, array('id' => 'pencil')) .
"</a>";
}
$row++;
echo "<fieldset>";
echo "<legend>" . __('Other configuration') . "</legend>";
html_print_table ($table_other);
@ -792,6 +812,27 @@ ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
?>
<script language="javascript" type="text/javascript">
function edit_csv_divider () {
if ($("#csv_divider_custom img").attr("id") == "pencil") {
$("#csv_divider_custom img").attr("src", "images/default_list.png");
$("#csv_divider_custom img").attr("id", "select");
var value = $("#csv_divider").val();
$("#csv_divider").replaceWith("<input id='text-csv_divider' name='csv_divider' type='text'>");
$("#text-csv_divider").val(value);
}
else {
$("#csv_divider_custom img").attr("src", "images/pencil.png");
$("#csv_divider_custom img").attr("id", "pencil");
$("#text-csv_divider").replaceWith("<select id='csv_divider' name='csv_divider'>");
var o = new Option(";", ";");
var o1 = new Option(",", ",");
var o2 = new Option("|", "|");
$("#csv_divider").append(o);
$("#csv_divider").append(o1);
$("#csv_divider").append(o2);
}
}
// Juanma (07/05/2014) New feature: Custom front page for reports
function display_custom_report_front (show,table) {

View File

@ -655,7 +655,10 @@ function config_update_config () {
$error_update[] = __('Custom report front') . ' - ' . __('First page');
if (!config_update_value ('custom_report_front_footer', get_parameter('custom_report_front_footer')))
$error_update[] = __('Custom report front') . ' - ' . __('Footer');
$error_update[] = __('Custom report front') . ' - ' . __('Footer');
if (!config_update_value ('csv_divider', (string) get_parameter('csv_divider', ';')))
$error_update[] = __('CSV divider');
break;
case 'net':
@ -1620,6 +1623,10 @@ function config_process_config () {
config_update_value ('classic_menu', 0);
}
if (!isset($config["csv_divider"])) {
config_update_value ('csv_divider', ";");
}
if (!isset($config['command_snapshot'])) {
config_update_value ('command_snapshot', 1);
}