diff --git a/ChangeLog b/ChangeLog
index ceb62a9bbda..c095075aac4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1745,6 +1745,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 b0ce0bea415..4a2ec91f1d0 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -2101,9 +2101,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');
@@ -2351,9 +2354,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'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1);
// Thirdparty
- $morehtmlref .= '
'.$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 (isModEnabled('project')) {
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 28bc7e4d65e..b56953eef0b 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -1941,6 +1941,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 bbb91441312..3d460c93560 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -1157,6 +1157,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 ce2f9a54bba..abf44b34cb1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1290,22 +1290,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 e88d8dd3635..dc84d98f892 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) {