Issue #0001415: Edition des informations boursières

This commit is contained in:
Aram HARUTYUNYAN 2014-06-17 07:17:41 +00:00
parent 7829c48320
commit 55d4a3b63f
3 changed files with 65 additions and 6 deletions

View File

@ -2177,10 +2177,26 @@ class SaisieController extends Zend_Controller_Action
$ws = new WsScores();
$result = $ws->getSaisieBourse($isin);
$infos = json_decode($result, true);
$dateFields = array(
'dateIntroduction',
'dateIntroYmd',
'dateRadiation',
'dateNbTitres',
'dateDerAG');
if ( $infos === null ) {
$this->view->assign('error', $result);
} else {
foreach ( $infos as $key => $val ) {
if(in_array($key, $dateFields))
{
if ($val=="0000-00-00") {
$val = "";
} else {
$date = new Zend_Date($val, 'yyyy-MM-dd');
$val = $date->toString('dd/MM/yyyy');
}
}
$this->view->assign($key, $val);
}
}
@ -2191,8 +2207,32 @@ class SaisieController extends Zend_Controller_Action
public function boursesaveAction()
{
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
if ( $request->isPost() ){
$infos = $request->getParams();
$dateFields = array(
'dateIntroduction',
'dateIntroYmd',
'dateRadiation',
'dateNbTitres',
'dateDerAG');
foreach($dateFields as $dateField)
{
$date = new Zend_Date($infos[$dateField], 'dd/MM/yyyy');
$infos[$dateField] = $date->toString('yyyy-MM-dd');
}
$filtre = array('controller'=>'', 'action'=>'', 'module'=>'', 'id'=>'', 'submit'=>'', 'dateIntroYmd'=>'');
$infos = array_diff_key($infos, $filtre);
$ws = new WsScores();
$result = $ws->setBourse($infos['code_isin'], json_encode($infos));
$this->view->assign('message', $result);
}
}
public function lienidentiteAction()

View File

@ -26,6 +26,7 @@
<input type="hidden" name="id" value="<?=$this->id?>"/>
<div class="paragraph">
<div class="message"></div>
<div class="fieldgrp">
<label>Siren de la société coté si France</label>
@ -118,21 +119,21 @@
<div class="fieldgrp">
<label>dateIntroduction</label>
<div class="field">
<input type="text" name="dateIntroduction" value="<?=$this->dateIntroduction?>" />
<input type="text" name="dateIntroduction" value="<?=$this->dateIntroduction?>" placeholder="JJ/MM/AAAA" />
</div>
</div>
<div class="fieldgrp">
<label>dateIntroYmd</label>
<div class="field">
<input type="text" name="dateIntroYmd" value="<?=$this->dateIntroYmd?>" /> (AAAAMMJJ)
<input type="text" name="dateIntroYmd" value="<?=$this->dateIntroYmd?>" placeholder="JJ/MM/AAAA" />
</div>
</div>
<div class="fieldgrp">
<label>dateDerAG</label>
<div class="field">
<input type="text" name="dateDerAG" value="<?=$this->dateDerAG?>" />
<input type="text" name="dateDerAG" value="<?=$this->dateDerAG?>" placeholder="JJ/MM/AAAA" />
</div>
</div>
@ -146,7 +147,7 @@
<div class="fieldgrp">
<label>dateRadiation</label>
<div class="field">
<input type="text" name="dateRadiation" value="<?=$this->dateRadiation?>" /> (AAAAMMJJ)
<input type="text" name="dateRadiation" value="<?=$this->dateRadiation?>" placeholder="JJ/MM/AAAA" />
</div>
</div>
@ -187,7 +188,7 @@
<div class="fieldgrp">
<label>dateNbTitres</label>
<div class="field">
<input type="text" name="dateNbTitres" value="<?=$this->dateNbTitres?>" /> (AAAAMMJJ)
<input type="text" name="dateNbTitres" value="<?=$this->dateNbTitres?>" placeholder="JJ/MM/AAAA" />
</div>
</div>
@ -299,3 +300,13 @@
</div>
</form>
</div>
<script>
$("form").on('submit', function(e){
e.preventDefault();
var form = $('form[name=form_saisie]');
$.post(form.attr('action'), form.serialize(), function(data){
$('div.message').text(data);
$('div.message').css({'background-color':'LightYellow', 'padding':'10px', 'margin-bottom':'10px', 'border-radius':'5px'});
});
});
</script>

View File

@ -0,0 +1,8 @@
<?php if ($this->message===0) {?>
<?=$this->translate('Aucune modification');?>
<?php } elseif ($this->message >= 1) {?>
<?=$this->translate('Modification enregistrée');?>
<?=json_encode($this->message);?>
<?php } else {?>
<?=json_encode($this->message);?>
<?php }?>