Progress Bar : use GET , which is faster than POST, use 2 decimal in progress because if the step is < 1 , it doesn't work

This commit is contained in:
Dany De Bontridder 2018-02-03 16:18:02 +01:00
parent 83404ed02e
commit 40cbb89f93
4 changed files with 7 additions and 3 deletions

View file

@ -3438,6 +3438,7 @@ function progress_bar_check(p_idx, p_taskid)
new Ajax.Request("ajax_misc.php", {
parameters: {gDossier: 0, task_id: p_taskid,op:"progressBar"},
method:"get",
onSuccess: function (req) {
try
{

View file

@ -127,7 +127,7 @@ class Document_Export
$cnt_feedback=0;
global $cn;
// follow progress
$step=round(20/count($p_array));
$step=round(16/count($p_array),2);
$cn->start();
foreach ($p_array as $value)
@ -244,6 +244,7 @@ class Document_Export
// concatenate detail operation with the output
$stmt = PDFTK . " " . $detail_operation->get_pdf_filename()." ".$output.
' output ' . $output2;
$progress->increment($step);
passthru($stmt, $status);
if ($status <> 0)
@ -264,15 +265,16 @@ class Document_Export
// Move the PDF into another temp directory
$this->move_file($output, 'stamp_' . $file_pdf);
}
$progress->set_value(93);
// concatenate all pdf into one
$this->concatenate_pdf();
$progress->set_value(100);
ob_clean();
$this->send_pdf();
$progress->set_value(100);
// remove files from "conversion folder"
$this->clean_folder();

View file

@ -67,6 +67,7 @@ class Progress_Bar
$this->value=0;
$this->db->exec_sql("insert into progress(p_id,p_value) values ($1,0)",
[$p_task_id]);
$this->db->exec_sql("delete from progress where p_created < now() - interval '3 hours' ");
}
}
/**

View file

@ -13,7 +13,7 @@ alter table jnt_use_dos add CONSTRAINT use_id_dos_id_uniq UNIQUE (use_id,dos_id)
create table progress
(
p_id varchar(16) primary key,
p_value integer not null ,
p_value numeric (5,2) not null ,
p_created timestamp default now()
);