diff --git a/ChangeLog b/ChangeLog
index 70e8cd5ad06..5ffb50a73c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1331,6 +1331,8 @@ Following changes may create regressions for some external modules, but were nec
* v14 seems to work correctly on PHP v8 but it generates a lot of verbose warnings. Currently, v14 i snot yet officialy supported with PHP 8.
* To execute shell or command line command, your code must never use method like exec, shell_exec, popen, .. but must use the built-in
method executeCLI() available into core/class/utils.class.php
+* the trigger "*_DELETE_CONTACT" inside "delete_contact()" function from commonobject.class.php is call before delete the object element
+ and a $object->context['contact_id'] is now available for this trigger
***** ChangeLog for 13.0.5 compared to 13.0.4 *****
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 71e40759ea5..7b7389b5f79 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -1986,9 +1986,12 @@ if ($action == 'create') {
/*
* Show object in view mode
*/
-
- $soc = new Societe($db);
- $soc->fetch($object->socid);
+ $object->fetch_thirdparty();
+ if ($object->thirdparty) {
+ $soc = $object->thirdparty;
+ } else {
+ $soc = new Societe($db);
+ }
$head = propal_prepare_head($object);
print dol_get_fiche_head($head, 'comm', $langs->trans('Proposal'), -1, 'propal');
@@ -2225,9 +2228,9 @@ if ($action == 'create') {
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
- $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
- if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
- $morehtmlref .= ' ('.$langs->trans("OtherProposals").')';
+ $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1, 'customer');
+ if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $soc->id > 0) {
+ $morehtmlref .= ' ('.$langs->trans("OtherProposals").')';
}
// Project
if (!empty($conf->project->enabled)) {
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 5a9829881a1..e426087a0e0 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1927,6 +1927,8 @@ if (empty($reshook)) {
$object->mode_reglement_id = GETPOST('mode_reglement_id', 'int');
$object->remise_absolue =price2num(GETPOST('remise_absolue'), 'MU', 2);
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
+ $object->fk_account = GETPOST('fk_account', 'int');
+
// Proprietes particulieres a facture de remplacement
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index feed2b70630..b1ff3b5b4f4 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1164,6 +1164,7 @@ class Facture extends CommonInvoice
$facture->origin = $this->origin;
$facture->origin_id = $this->origin_id;
+ $facture->fk_account = $this->fk_account;
$facture->lines = $this->lines; // Array of lines of invoice
$facture->situation_counter = $this->situation_counter;
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 33ca155d89e..2d288d90c9d 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1271,22 +1271,34 @@ abstract class CommonObject
// phpcs:enable
global $user;
+ $error = 0;
$this->db->begin();
- $sql = "DELETE FROM ".$this->db->prefix()."element_contact";
- $sql .= " WHERE rowid = ".((int) $rowid);
-
- dol_syslog(get_class($this)."::delete_contact", LOG_DEBUG);
- if ($this->db->query($sql)) {
- if (!$notrigger) {
- $result = $this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user);
- if ($result < 0) {
- $this->db->rollback();
- return -1;
- }
+ if (!$error && empty($notrigger)) {
+ // Call trigger
+ $this->context['contact_id'] = ((int) $rowid);
+ $result = $this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user);
+ if ($result < 0) {
+ $error++;
}
+ // End call triggers
+ }
+ if (!$error) {
+ dol_syslog(get_class($this)."::delete_contact", LOG_DEBUG);
+
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
+ $sql .= " WHERE rowid = ".((int) $rowid);
+
+ $result = $this->db->query($sql);
+ if (!$result) {
+ $error++;
+ $this->errors[] = $this->db->lasterror();
+ }
+ }
+
+ if (!$error) {
$this->db->commit();
return 1;
} else {
diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php
index 600f3878a0a..d3365a9b9a7 100644
--- a/htdocs/core/lib/signature.lib.php
+++ b/htdocs/core/lib/signature.lib.php
@@ -77,7 +77,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '', $localorexternal = 1)
$securekeyseed = '';
if ($type == 'proposal') {
- $securekeyseed = isset($conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN) ? $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN : '';
+ $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN');
$out = $urltouse.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '' : '');
if ($mode == 1) {