Qual: Uniformize code. Errors
This commit is contained in:
parent
dbb2d464db
commit
893240ce21
@ -1,19 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||||
|
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 3 of the License, or
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file htdocs/compta/salaries/class/paymentsalary.class.php
|
* \file htdocs/compta/salaries/class/paymentsalary.class.php
|
||||||
@ -278,6 +279,8 @@ class PaymentSalary extends CommonObject
|
|||||||
function create($user)
|
function create($user)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$error=0;
|
||||||
|
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
$this->amount=price2num(trim($this->amount));
|
$this->amount=price2num(trim($this->amount));
|
||||||
@ -351,7 +354,6 @@ class PaymentSalary extends CommonObject
|
|||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$ok=1;
|
|
||||||
|
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
|
||||||
|
|
||||||
@ -387,10 +389,10 @@ class PaymentSalary extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$acc->error;
|
$this->error=$acc->error;
|
||||||
$ok=0;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ok)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
// Add link 'payment_salary' in bank_url between payment and bank transaction
|
||||||
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
|
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
|
||||||
@ -399,7 +401,7 @@ class PaymentSalary extends CommonObject
|
|||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$this->error=$acc->error;
|
$this->error=$acc->error;
|
||||||
$ok=0;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,19 +421,19 @@ class PaymentSalary extends CommonObject
|
|||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
$this->error=$acc->error;
|
$this->error=$acc->error;
|
||||||
$ok=0;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user);
|
$result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user);
|
||||||
if ($result < 0) $ok=0;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
}
|
}
|
||||||
else $ok=0;
|
else $error++;
|
||||||
|
|
||||||
if ($ok)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user