Siret extraction
This commit is contained in:
parent
d567502e7d
commit
46a3115524
@ -185,26 +185,27 @@ class GestionController extends Zend_Controller_Action
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract sirets from database
|
||||
* Extract only SIRETs from database
|
||||
* @todo : To csv file
|
||||
*/
|
||||
public function siretscsvAction()
|
||||
public function extractAction()
|
||||
{
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
$table = new Application_Model_EnrichissementIdentifiants();
|
||||
$sql = $table->select()
|
||||
->where('idComptage = ?', $id);
|
||||
$sql = $table->select()->where('idComptage = ?', $id);
|
||||
$result = $table->fetchRow($sql);
|
||||
if(!empty($result)) {
|
||||
$result = $result->toArray();
|
||||
$sirets = json_decode($result['identifiants'], true);
|
||||
$content = '';
|
||||
foreach($sirets as $siret) {
|
||||
echo $siret."\n";
|
||||
}
|
||||
$content.= $siret.",";
|
||||
}
|
||||
$this->view->assign('content', $content);
|
||||
|
||||
}else {
|
||||
echo 'Aucune commande d\'enrichissement sur ce comptage';
|
||||
}
|
||||
exit;
|
||||
$this->view->assign('message', 'Aucune commande d\'enrichissement sur ce comptage');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
12
application/views/default/scripts/gestion/extract.phtml
Normal file
12
application/views/default/scripts/gestion/extract.phtml
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
if ($this->content) {
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
header('Content-Transfer-Encoding: none');
|
||||
header('Content-type: ' . $content_type.'');
|
||||
header('Cache-Control: private, max-age=0, must-revalidate');
|
||||
header('Pragma: public');
|
||||
ini_set('zlib.output_compression', '0');
|
||||
echo $this->content;
|
||||
} else {
|
||||
echo $this->message;
|
||||
}
|
Loading…
Reference in New Issue
Block a user