issue #0001264 : Add verification

This commit is contained in:
Michael RICOIS 2012-09-21 19:40:45 +00:00
parent cfd9b5f952
commit 9f6914415d
3 changed files with 77 additions and 49 deletions

View File

@ -1417,7 +1417,8 @@ class SaisieController extends Zend_Controller_Action
$params['dateCloturePre'],
$params['dureeMoisPre'],
$params['typeBilan'],
$params['postes']
$params['postes'],
$params['step']
);
Zend_Registry::get('firebug')->info($response);

View File

@ -49,54 +49,13 @@ span.poste input { width:50px; }
?>
</div>
<div id="saveMsg" style="text-align:center;"></div>
<div style="text-align:center;"><input type="submit" class="button" id="save" name="save" value="Enregistrer" /></div>
<div style="text-align:center;">
<input type="button" class="button" id=onlycheck name="onlycheck" value="Verifier" />
<input type="submit" class="button" id="normal" name="normal" value="Enregistrer" />
<input style="display:none;" type="button" class="button" id="nocheck" name="nocheck" value="Forcer" />
</div>
<?=$this->partial()->view->inlineScript();?>
<script>
$('input#save').click(function(e){
e.preventDefault();
var strPostes = '';
$('span.poste').each(function(){
id = $(this).attr('id');
val = $(this).html();
if (val != id && val != '' && val != '-') {
if (strPostes!='') strPostes = strPostes + ';';
strPostes = strPostes + id + '=' + val;
}
});
$('input#save').css('display', 'none');
$('div#saveMsg').html('Enregistrement en cours....');
$.post('/saisie/liassesave/siren/<?=$this->siren?>', {
unite: $('span#unit').html(),
dateCloture: $('span#dateCloture').html(),
dureeMois: $('span#dureeMois').html(),
dateCloturePre: $('span#dateCloturePre').html(),
dureeMoisPre: $('span#dureeMoisPre').html(),
typeBilan: $('span#typeBilan').html(),
postes: strPostes
}, function(data) {
$('span.poste').removeClass('editable-error editable-change').addClass('editable');
if (data.status=='OK') {
$('div#saveMsg').html('Bilan saisie.');
} else if (data.status=='ERR' && data.postes.length>0) {
for (i in data.postes) {
$('span#'+data.postes[i]).removeClass('editable').addClass('editable-error');
}
$('div#saveMsg').html(data.message);
$('input#save').css('display', 'block');
} else if (data.status=='ERR') {
$('div#saveMsg').html(data.message);
$('input#save').css('display', 'block');
} else {
$('div#saveMsg').html('Error');
$('input#save').css('display', 'block');
}
}, 'json'
).error(function(){
$('div#saveMsg').html('Error Timeout');
$('input#save').css('display', 'block');
});
});
$('span.unit').editable(function(value, settings) {
return value;
}, {
@ -152,6 +111,73 @@ span.poste input { width:50px; }
};
});
$('input#onlycheck').click(function(e){
e.preventDefault();
$('div#saveMsg').html('Vérification en cours....');
sendInfo('onlycheck');
});
$('input#normal').click(function(e){
e.preventDefault();
$('div#saveMsg').html('Enregistrement en cours....');
sendInfo('normal');
});
$('input#nocheck').click(function(e){
e.preventDefault();
$('div#saveMsg').html('Enregistrement en cours....');
sendInfo('nocheck');
});
function sendInfo(step)
{
$('input#'+step).css('display', 'none');
var strPostes = '';
$('span.poste').each(function(){
id = $(this).attr('id');
val = $(this).html();
if (val != id && val != '' && val != '-') {
if (strPostes!='') strPostes = strPostes + ';';
strPostes = strPostes + id + '=' + val;
}
});
$.post('/saisie/liassesave/siren/<?=$this->siren?>', {
step: step,
unite: $('span#unit').html(),
dateCloture: $('span#dateCloture').html(),
dureeMois: $('span#dureeMois').html(),
dateCloturePre: $('span#dateCloturePre').html(),
dureeMoisPre: $('span#dureeMoisPre').html(),
typeBilan: $('span#typeBilan').html(),
postes: strPostes
}, function(data) {
$('span.editable-error').addClass('editable-change').removeClass('editable-error');
if (data.status=='OK') {
var msg = 'Bilan saisie.';
if (step == 'onlycheck') {
msg = 'Vérification OK.';
}
$('div#saveMsg').html('Bilan saisie.');
} else {
var msg='Unknow Error';
if (data.status=='ERR') {
if (data.postes.length>0) {
for (i in data.postes) {
$('span#'+data.postes[i]).removeClass('editable-change').addClass('editable-error');
}
}
msg=data.message;
}
$('div#saveMsg').html(msg);
$('input#'+step).css('display', 'block');
}
}, 'json'
).error(function(){
$('div#saveMsg').html('Error Timeout');
$('input#'+step).css('display', 'block');
});
}
function isInteger(number)
{
var exp = new RegExp("^[\-0-9]+$","g");

View File

@ -33,7 +33,7 @@ class WsScores
}
}
public function setBilan($siren, $unite, $dateCloture, $dureeMois, $dateCloturePre, $dureeMoisPre, $typeBilan, $postes)
public function setBilan($siren, $unite, $dateCloture, $dureeMois, $dateCloturePre, $dureeMoisPre, $typeBilan, $postes, $step = 'normal')
{
$params = new stdClass();
$params->siren = $siren;
@ -44,6 +44,7 @@ class WsScores
$params->data->dureeMoisPre = $dureeMoisPre;
$params->data->typeBilan = $typeBilan;
$params->data->postes = $postes;
$params->step = $step;
$client = $this->loadClient('saisie');
try {
$reponse = $client->setBilan($params);