From b03d7c60ff30bc6cecfdce1ded14a5ab9faf962c Mon Sep 17 00:00:00 2001 From: bomuux Date: Mon, 4 Apr 2022 18:06:11 +0200 Subject: [PATCH] Bug: Cannot set thirdparty customer accountancy code to empty string When thirdparty customer accountancy code is set to a non empty string, one cannot set it back to empty string due to thirdparty property deprecation : code_compta to code_compta_client --- htdocs/comm/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index de387ce60f3..4aca208681b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -162,7 +162,8 @@ if (empty($reshook)) { // set accountancy code if ($action == 'setcustomeraccountancycode') { $result = $object->fetch($id); - $object->code_compta = GETPOST("customeraccountancycode"); + $object->code_compta_client = GETPOST("customeraccountancycode"); + $object->code_compta = $object->code_compta_client; // For Backward compatibility $result = $object->update($object->id, $user, 1, 1, 0); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -360,9 +361,9 @@ if ($object->id > 0) { print ''; print ''; - print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); + print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer); print ''; - print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer); + print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta_client, $object, $user->rights->societe->creer); print ''; print ''; }