From bcd5baa62ecf50fc17c3d93b87c9e36672e5d65b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Feb 2024 16:02:21 +0100 Subject: [PATCH] Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 --- htdocs/compta/bank/card.php | 34 ++++++++++---------- htdocs/compta/bank/class/account.class.php | 36 +++++++++++++++++++++- 2 files changed, 52 insertions(+), 18 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index dfe4b572fea..2d2470ea4c1 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -139,10 +139,10 @@ if (empty($reshook)) { $object->cle_rib = trim(GETPOST("cle_rib")); $object->bic = trim(GETPOST("bic")); $object->iban = trim(GETPOST("iban")); - $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml")); $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); + $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml")); $object->owner_address = trim(GETPOST("owner_address", 'alphanohtml')); $object->owner_zip = trim(GETPOST("owner_zip", 'alphanohtml')); $object->owner_town = trim(GETPOST("owner_town", 'alphanohtml')); @@ -252,7 +252,6 @@ if (empty($reshook)) { $object->cle_rib = trim(GETPOST("cle_rib")); $object->bic = trim(GETPOST("bic")); $object->iban = trim(GETPOST("iban")); - $object->domiciliation = trim(GETPOST("domiciliation", "alphanohtml")); $object->pti_in_ctti = empty(GETPOST("pti_in_ctti")) ? 0 : 1; $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); @@ -279,8 +278,9 @@ if (empty($reshook)) { $object->currency_code = trim(GETPOST("account_currency_code")); - $object->state_id = GETPOST("account_state_id", 'int'); - $object->country_id = GETPOST("account_country_id", 'int'); + $object->address = trim(GETPOST("account_address", "alphanohtml")); + $object->state_id = GETPOSTINT("account_state_id"); + $object->country_id = GETPOSTINT("account_country_id"); $object->min_allowed = GETPOST("account_min_allowed", 'int'); $object->min_desired = GETPOST("account_min_desired", 'int'); @@ -462,8 +462,8 @@ if ($action == 'create') { $type = (GETPOSTISSET("type") ? GETPOST('type', 'int') : Account::TYPE_CURRENT); // add default value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''.$langs->trans("BankAccountDomiciliation").''; - print '"; } @@ -681,7 +681,6 @@ if ($action == 'create') { $morehtmlref = ''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; print '
'; print '
'; @@ -848,7 +847,7 @@ if ($action == 'create') { } print ''.$langs->trans("BankAccountOwner").''; - print $object->proprio; + print dol_escape_htmltag($object->proprio); print "\n"; print ''.$langs->trans("BankAccountOwnerAddress").''; @@ -856,11 +855,11 @@ if ($action == 'create') { print "\n"; print ''.$langs->trans("BankAccountOwnerZip").''; - print ''.$object->owner_zip; + print ''.dol_escape_htmltag($object->owner_zip); print ''; print ''.$langs->trans("BankAccountOwnerTown").''; - print ''.$object->owner_town; + print ''.dol_escape_htmltag($object->owner_town); print ''; print ''.$langs->trans("BankAccountOwnerCountry").''; @@ -1003,8 +1002,8 @@ if ($action == 'create') { $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : $object->type); // add default current value if ($type == Account::TYPE_SAVINGS || $type == Account::TYPE_CURRENT) { print ''.$langs->trans("BankAccountDomiciliation").''; - print '"; } @@ -1183,16 +1182,17 @@ if ($action == 'create') { } } - print ''.$langs->trans("BankAccountOwner").''; - print ''; - print ''; - print ''; + print '
'; print ''; - print ''; + print ''; + print ''; + + print '"; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ff7293f0de4..add7a65b557 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -184,6 +184,7 @@ class Account extends CommonObject public $state_id; public $state_code; public $state; + public $country_id; /** * Variable containing all account types with their respective translated label. @@ -1633,6 +1634,40 @@ class Account extends CommonObject return ''; } + /** + * Return full address for banner + * + * @param string $htmlkey HTML id to make banner content unique + * @param Object $object Object (thirdparty, thirdparty of contact for contact, null for a member) + * @return string Full address string + */ + public function getBannerAddress($htmlkey, $object) + { + global $conf, $langs; + + $out = ''; + + $outdone = 0; + $coords = $this->getFullAddress(1, ', ', getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT')); + if ($coords) { + if (!empty($conf->use_javascript_ajax)) { + // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile + $out .= ''; + $out .= img_picto($langs->trans("Address"), 'map-marker-alt'); + $out .= ' '; + } + $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); + if ($address) { + $out .= $address; + $outdone++; + } + $outdone++; + } + + return $out; + } + + /** * Return if a bank account is defined with detailed information (bank code, desk code, number and key). * More information on codes used by countries on page http://en.wikipedia.org/wiki/Bank_code @@ -2684,7 +2719,6 @@ class AccountLine extends CommonObjectLine return ''; } - /** * Return if a bank line was dispatched into bookkeeping *
'.$langs->trans("BankAccountOwnerAddress").''; + print '
'.$langs->trans("BankAccountOwner").'
'.$langs->trans("BankAccountOwnerAddress").''; print '