Merge remote-tracking branch 'upstream/develop' into Squiz.Scope.MethodScope.Missing

This commit is contained in:
Frédéric FRANCE 2019-03-01 19:24:27 +01:00
commit be8db31388
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 53 additions and 2 deletions

View File

@ -312,6 +312,57 @@ class FactureRec extends CommonInvoice
}
/**
* Update a line to invoice_rec.
*
* @param User $user User
* @param int $notrigger No trigger
* @return int <0 if KO, Id of line if OK
*/
function update(User $user, $notrigger = 0)
{
global $conf;
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_rec SET";
$sql.= " fk_soc = ".$this->fk_soc;
// TODO Add missing fields
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BILLREC_UPDATE', $user);
if ($result < 0)
{
$this->db->rollback();
return -2;
}
// End call triggers
}
$this->db->commit();
return 1;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -2;
}
}
/**
* Load object and lines
*
@ -1873,7 +1924,7 @@ class FactureLigneRec extends CommonInvoiceLine
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('LINEBILL_REC_UPDATE', $user);
$result=$this->call_trigger('LINEBILLREC_UPDATE', $user);
if ($result < 0)
{
$this->db->rollback();

View File

@ -28,7 +28,7 @@ namespace test\unit;
* Class BillOfMaterialsTest
* @package Testbillofmaterials
*/
class BillOfMaterialsTest extends \PHPUnit_Framework_TestCase
class BOMTest extends \PHPUnit_Framework_TestCase
{
/**
* Global test setup