Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0
This commit is contained in:
commit
5a89da8876
@ -17,6 +17,7 @@
|
|||||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||||
|
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -1166,6 +1167,9 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
$object->fetch($fromid);
|
$object->fetch($fromid);
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$objFrom = clone $object;
|
||||||
|
|
||||||
// Change socid if needed
|
// Change socid if needed
|
||||||
if (!empty($this->socid) && $this->socid != $object->socid) {
|
if (!empty($this->socid) && $this->socid != $object->socid) {
|
||||||
$objsoc = new Societe($this->db);
|
$objsoc = new Societe($this->db);
|
||||||
@ -1246,13 +1250,13 @@ class Facture extends CommonInvoice
|
|||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
} else {
|
} else {
|
||||||
// copy internal contacts
|
// copy internal contacts
|
||||||
if ($object->copy_linked_contact($this, 'internal') < 0) {
|
if ($object->copy_linked_contact($objFrom, 'internal') < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
} elseif ($this->socid == $object->socid) {
|
} elseif ($object->socid == $objFrom->socid) {
|
||||||
// copy external contacts if same company
|
// copy external contacts if same company
|
||||||
if ($object->copy_linked_contact($this, 'external') < 0) {
|
if ($object->copy_linked_contact($objFrom, 'external') < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
$this->error = $object->error;
|
$this->error = $object->error;
|
||||||
$this->errors = $object->errors;
|
$this->errors = $object->errors;
|
||||||
@ -1263,7 +1267,7 @@ class Facture extends CommonInvoice
|
|||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Hook of thirdparty module
|
// Hook of thirdparty module
|
||||||
if (is_object($hookmanager)) {
|
if (is_object($hookmanager)) {
|
||||||
$parameters = array('objFrom'=>$this);
|
$parameters = array('objFrom'=>$objFrom);
|
||||||
$action = '';
|
$action = '';
|
||||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user