Bug : exception instead of new exception
This commit is contained in:
parent
60b757d40d
commit
1032e7a6b4
2 changed files with 8 additions and 5 deletions
|
|
@ -81,7 +81,11 @@ function new_fiche($p_cn,$p_type) {
|
|||
|
||||
if ( isset($_POST['add_fiche'])) {
|
||||
$fiche=new fiche($cn);
|
||||
$fiche->Save($_POST['fiche']);
|
||||
try {
|
||||
$fiche->Save($_POST['fiche']);
|
||||
} catch (Exception $e) {
|
||||
alert ($e->getMessage());
|
||||
}
|
||||
|
||||
?>
|
||||
<SCRIPT>
|
||||
|
|
|
|||
|
|
@ -451,6 +451,7 @@ class fiche {
|
|||
StartSql($this->cn);
|
||||
try
|
||||
{
|
||||
|
||||
$sql=sprintf("insert into fiche(f_id,fd_id)".
|
||||
" values (%d,%d)",
|
||||
$fiche_id,$p_fiche_def);
|
||||
|
|
@ -480,7 +481,7 @@ class fiche {
|
|||
if ( $st == 0 ) {
|
||||
$user=new User($this->cn);
|
||||
$exercice=$user->get_exercice();
|
||||
if ( $exercice == 0 ) throw Exception ('Annee invalide erreur');
|
||||
if ( $exercice == 0 ) throw new Exception ('Veuillez choisir une période dans vos préférences ',1);
|
||||
|
||||
$str_stock=sprintf('insert into stock_goods(f_id,sg_quantity,sg_comment,sg_code,sg_type,sg_exercice) '.
|
||||
' values (%d,0,\'%s\',upper(\'%s\'),\'d\',\'%s\')',
|
||||
|
|
@ -561,10 +562,8 @@ class fiche {
|
|||
}
|
||||
} catch (Exception $e)
|
||||
{
|
||||
echo '<span class="error">'.
|
||||
$e->getMessage().
|
||||
'</span>';
|
||||
Rollback($this->cn);
|
||||
throw ($e);
|
||||
return;
|
||||
}
|
||||
Commit($this->cn);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue