SD-29 Ajout des boutons reprise/reset

This commit is contained in:
Claire DELBOS 2017-04-05 14:47:50 +02:00
parent f64f74b903
commit f16b444ca8
4 changed files with 37 additions and 6 deletions

View File

@ -107,17 +107,28 @@ class IndexController extends Zend_Controller_Action
{
$request = $this->getRequest();
$id = $request->getParam('id');
$option = $request->getParam('option');
if (!empty($id)){
$commandesM = new Application_Model_Commandes();
if($option=='last'){
$data = array(
'error' => 'Demande de reprise',
'dateStop' => '0000-00-00 00:00:00',
'fichierOut' => '',
);
}else{
$data = array(
'nbLigneT' => 0,
'error' => '',
'dateStart' => '0000-00-00 00:00:00',
'fichierOut' => '',
);
}
$commandesM->update($data, "id=$id");
}
$this->view->request=$request;
$this->redirect('/index');
}
public function repriseAction()
@ -134,6 +145,7 @@ class IndexController extends Zend_Controller_Action
$commandesM->update($data, "id=$id");
}
exec("php ".APPLICATION_PATH."/../batch/enrichissement.php --reprise --id ".$id." &");
$this->redirect('/index');
}
}

View File

@ -70,10 +70,13 @@ Le séparateur utilisé est la virgule (,).
<td><?=$file->nbLigne?></td>
<td><?=$file->error?></td>
<td>
<a class="restart" href="<?=$this->url(array('action'=>'restart', 'id'=>$file->id))?>">Remise à zéro et redémarrage</a>
<?php if ( !empty($file->error) ) {?>
| <a class="reprise" href="<?=$this->url(array('action'=>'reprise', 'id'=>$file->id))?>">Reprise manuelle sur erreur</a>
<?php }?>
<a class="restart btn btn-sm btn-danger" href="<?=$this->url(array('action'=>'restart', 'id'=>$file->id,'option' => 'zero'))?>">Relance<br>complet</a>
<?php if ( empty($file->error ) ):?>
<a class="restart btn btn-sm btn-warning" href="<?=$this->url(array('action'=>'restart', 'id'=>$file->id, 'option' => 'last'))?>">Reprise<br>derniere ligne</a>
<?php endif;?>
<?php if ( !empty($file->error && $file->error!="Demande de reprise") ) :?>
<a class="reprise btn btn-sm btn-warning" href="<?=$this->url(array('action'=>'reprise', 'id'=>$file->id))?>">Reprise<br>sur erreur</a>
<?php endif;?>
</td>
</tr>
<?php }?>

View File

@ -59,6 +59,21 @@ if ( count($result)==0 ) {
$c = new Zend_Config($application->getOptions());
$log = $c->profil->path->data.'/log/'.$info->id.'.log';
exec('php '.__DIR__."/jobs/enrichissement.php --id ".$info->id." 2>&1 >> ".$log." &");
}else{
//Si pas de traitement en attente on fait les demandes de relances
$sql = $commandesM->select()
->where('idProfil != ?', 0)
->where("error = 'Demande de reprise'")
->where("dateStop = '0000-00-00 00:00:00'")
->order('dateAdded ASC')->limit(1);
$result = $commandesM->fetchAll($sql);
if (count($result)>0) {
$info = $result->current();
echo date('Y-m-d H:i:s')." - Lancement enrichissement $info->id\n";
$c = new Zend_Config($application->getOptions());
$log = $c->profil->path->data.'/log/'.$info->id.'.log';
exec('php '.__DIR__."/jobs/enrichissement.php --reprise --id ".$info->id." 2>&1 >> ".$log." &");
}
}
}

View File

@ -2236,12 +2236,13 @@ function contentieuxlisteMultiple($siren, $nic=0, $values = false,$qualite='')
$tabData[$k]['Parties']=$text;
}
if(isset($row['Representants']) && !empty($row['Representants'])){
$text='';
$parties=(array)json_decode($row['Representants']);
if(is_array($parties)){
foreach($parties as $p){
$text=isset($p->nom)?$p->nom.' - ':'';
$text.=isset($p->nom)?$p->nom.' ':'';
}}else{
$text=isset($parties['nom'])?$parties['nom']:$row['Representants'];
$text.=isset($parties['nom'])?$parties['nom']:$row['Representants'];
}
$tabData[$k]['Representants']=$text;
}