Add missing extrafield and trigger in template invoice creation
This commit is contained in:
parent
a6ecf6dbbc
commit
e4922f38ab
@ -199,9 +199,10 @@ class FactureRec extends CommonInvoice
|
|||||||
*
|
*
|
||||||
* @param User $user User object
|
* @param User $user User object
|
||||||
* @param int $facid Id of source invoice
|
* @param int $facid Id of source invoice
|
||||||
|
* @param int $notrigger No trigger
|
||||||
* @return int <0 if KO, id of invoice created if OK
|
* @return int <0 if KO, id of invoice created if OK
|
||||||
*/
|
*/
|
||||||
public function create($user, $facid)
|
public function create($user, $facid, $notrigger = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -221,7 +222,6 @@ class FactureRec extends CommonInvoice
|
|||||||
$this->date_when = null;
|
$this->date_when = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$this->frequency = abs($this->frequency);
|
$this->frequency = abs($this->frequency);
|
||||||
$this->nb_gen_done = 0;
|
$this->nb_gen_done = 0;
|
||||||
$this->nb_gen_max = empty($this->nb_gen_max) ? 0 : $this->nb_gen_max;
|
$this->nb_gen_max = empty($this->nb_gen_max) ? 0 : $this->nb_gen_max;
|
||||||
@ -389,6 +389,26 @@ class FactureRec extends CommonInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$result = $this->insertExtraFields();
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error && !$notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result = $this->call_trigger('BILLREC_CREATE', $user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user