unserialize_task_params(); if (method_exists($this->proxy, "pmbesScanDocnum_get_doc_num")) { if ($parameters["upload_folder"] && $parameters["upload_repertoire"]) { //on liste les documents dans le fichier upload_folder $list_docnum=$this->list_docnum($parameters["upload_folder"]); if (!empty($list_docnum)) { //il y en a $percent = 0; $p_value = (int) 100/count($list_docnum); $this->report[] = "".$this->msg["planificateur_scan_docnum_doc_a_traiter"]."".count($list_docnum).""; foreach ($list_docnum as $docnum){ $this->listen_commande(array(&$this, 'traite_commande')); //fonction a rappeller (traite commande) if($this->statut == WAITING) { $this->send_command(RUNNING); } if($this->statut == RUNNING) { $explnum=array(); $explnum['explnum_nomfichier']=$docnum; $explnum['explnum_repertoire']=$parameters["upload_repertoire"]; $match=array(); if(preg_match('/^b([0-9]+)(\.|\-).+$/', $docnum, $match)){ $explnum['explnum_bulletin']=$match[1]; }elseif(preg_match('/^a([0-9]+)(\.|\-).+$/', $docnum, $match)){ $explnum['explnum_notice']=$match[1]; }elseif(preg_match('/^n([0-9]+)(\.|\-).+$/', $docnum, $match)){ $explnum['explnum_notice']=$match[1]; } $report = $this->proxy->pmbesScanDocnum_get_doc_num($explnum, $parameters["upload_folder"]); foreach ($report as $msg_type=>$values){ switch ($msg_type){ case 'error': foreach($values as $error_msg){ if($errors[$error_msg]){ $errors[$error_msg]++; }else{ $errors[$error_msg]=1; } $error_count++; } break; case 'info': $reussi=$reussi+$values; break; } } $percent+=$p_value; $this->update_progression($percent); } } }else { $this->update_progression(100); $this->report[] = "".$this->msg["planificateur_scan_docnum_no_docnum"].""; } } else { $this->report[] = "".$this->msg["planificateur_scan_docnum_bad_params"].""; } } else { $this->report[] = "".sprintf($msg["planificateur_function_rights"],"get_doc_num","pmbesScanDocnum",$PMBusername).""; } } else { $this->add_rights_bad_user_report(); } if($reussi){ $this->report[] = "".$this->msg['planificateur_scan_docnum_doc_traites']."$reussi"; } if($errors){ $this->report[] = "".$this->msg['planificateur_scan_docnum_doc_non_traites']."$error_count"; foreach($errors as $error_msg=>$error_nb){ $this->report[] = "$error_msg$error_nb"; } } } }