FREC : upload file properly and cancel operation if it fails
This commit is contained in:
parent
b090355ef3
commit
7b0104c86d
1 changed files with 18 additions and 9 deletions
|
|
@ -202,7 +202,7 @@ if (isset($_POST['save']))
|
||||||
$cn->start();
|
$cn->start();
|
||||||
for ($i = 0; $i < count($array); $i++)
|
for ($i = 0; $i < count($array); $i++)
|
||||||
{
|
{
|
||||||
$cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($_POST['ext'], $array[$i]));
|
$cn->exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2', array($receipt_nb, $array[$i]));
|
||||||
$tot = bcadd($tot, $cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($array[$i])));
|
$tot = bcadd($tot, $cn->get_value('select qf_amount from quant_fin where jr_id=$1', array($array[$i])));
|
||||||
}
|
}
|
||||||
$diff = bcsub($end_extrait, $start_extrait);
|
$diff = bcsub($end_extrait, $start_extrait);
|
||||||
|
|
@ -210,22 +210,30 @@ if (isset($_POST['save']))
|
||||||
{
|
{
|
||||||
$remain=bcsub($tot,$diff);
|
$remain=bcsub($tot,$diff);
|
||||||
$cn->rollback();
|
$cn->rollback();
|
||||||
alert("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, mise à jour annulée, la différence est de $remain");
|
$str_message=_("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, mise à jour annulée, la différence est de $remain");
|
||||||
|
alert($str_message);
|
||||||
echo '<div class="error">';
|
echo '<div class="error">';
|
||||||
echo '<p>'.$g_failed._("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il y a $tot rapprochés, la différence est de $remain <br>mise à jour annulée").'</p>';
|
echo '<p>'.$g_failed.$str_message.'</p>';
|
||||||
/* if file : warning that file is not uploaded*/
|
/* if file : warning that file is not uploaded*/
|
||||||
echo '<p>'.
|
echo '<p>'.
|
||||||
_('Attention : Fichier non chargé').
|
_('Attention : Fichier non chargé et rapprochement annulé').
|
||||||
'</p>';
|
'</p>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo '<div class="content">'.$g_succeed.' Mise à jour extrait '.$_POST['ext'].'</div>';
|
echo '<div class="content">'.$g_succeed._(' Mise à jour extrait')." ".$receipt_nb.'</div>';
|
||||||
// -- chargement fichier
|
// -- chargement fichier
|
||||||
$oid=$cn->upload('file_receipt',true);
|
$oid=null;
|
||||||
|
if ( $_FILES['file_receipt']['name'] != "" && $_FILES['file_receipt']['error'] == 0)
|
||||||
if ( $oid != false ) {
|
{
|
||||||
|
$oid=$cn->upload('file_receipt',true);
|
||||||
|
echo _("Fichier sauvé");
|
||||||
|
}
|
||||||
|
if( $_FILES['file_receipt']['error'] != 4 && $_FILES['file_receipt']['error'] !=0 )
|
||||||
|
echo_warning(_("Fichier non chargé: mise à jour annulée"));
|
||||||
|
else
|
||||||
|
{
|
||||||
for ($i = 0; $i < count($array); $i++)
|
for ($i = 0; $i < count($array); $i++)
|
||||||
{
|
{
|
||||||
$cn->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2,
|
$cn->exec_sql("update jrn set jr_pj=$1 , jr_pj_name=$2,
|
||||||
|
|
@ -411,6 +419,7 @@ echo '</tr>';
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
||||||
$receipt=new IFile('file_receipt');
|
$receipt=new IFile('file_receipt');
|
||||||
|
$receipt->setAlertOnSize(true);
|
||||||
echo _("Pièce justificative")," " ,
|
echo _("Pièce justificative")," " ,
|
||||||
$receipt->input();
|
$receipt->input();
|
||||||
echo '<p class="text-align:center">';
|
echo '<p class="text-align:center">';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue