From 6b8a3094f06283b7807da7144b698d8e3dbb9efe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Nov 2018 00:14:23 +0100 Subject: [PATCH] Fix missing some keys in substitution arrays --- htdocs/core/class/html.formmail.class.php | 2 -- htdocs/core/lib/functions.lib.php | 34 ++++++++++++++++++----- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 1406586cea6..79822082797 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1420,8 +1420,6 @@ class FormMail extends Form } } - $tmparray['__(AnyTranslationKey)__']="Translation"; - foreach($tmparray as $key => $val) { if (empty($val)) $tmparray[$key]=$key; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 81ea685f68a..92f2cb62308 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6030,6 +6030,10 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = 'Security key for payment on an invoice'; $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = 'Security key for payment on a a service'; + $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = 'Direct download url of a proposal'; + $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = 'Direct download url of an order'; + $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = 'Direct download url of an invoice'; + if (is_object($object) && $object->element == 'shipping') { $substitutionarray['__SHIPPINGTRACKNUM__']='Shipping tacking number'; @@ -6043,7 +6047,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : '')); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : ''); - // TODO Use this ? + // TODO Remove this $msgishtml = 0; $birthday = dol_print_date($object->birth,'day'); @@ -6154,6 +6158,22 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?str_replace('\n', "\n", $outputlangs->trans("PredefinedMailContentLink", $paymenturl)):''); $substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl; + + if (! empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') + { + $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); + } + else $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = ''; + if (! empty($conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'commande') + { + $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = $object->getLastMainDocLink($object->element); + } + else $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = ''; + if (! empty($conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'facture') + { + $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element); + } + else $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = ''; } } if (empty($exclude) || ! in_array('objectamount', $exclude)) @@ -6214,16 +6234,16 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob )); } - if (empty($exclude) || ! in_array('system', $exclude)) - { - $substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey'); - $substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstant'); - $substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT; - } if (! empty($conf->multicompany->enabled)) { $substitutionarray=array_merge($substitutionarray, array('__ENTITY_ID__' => $conf->entity)); } + if (empty($exclude) || ! in_array('system', $exclude)) + { + $substitutionarray['__DOL_MAIN_URL_ROOT__']=DOL_MAIN_URL_ROOT; + $substitutionarray['__(AnyTranslationKey)__']=$outputlangs->trans('TranslationOfKey'); + $substitutionarray['__[AnyConstantKey]__']=$outputlangs->trans('ValueOfConstantKey'); + } return $substitutionarray; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 563d0852956..5e36da93279 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -967,6 +967,7 @@ CalcLocaltax3Desc=Local Taxes reports are the total of localtaxes sales LabelUsedByDefault=Label used by default if no translation can be found for code LabelOnDocuments=Label on documents LabelOrTranslationKey=Label or translation key +ValueOfConstantKey=Value of constant NbOfDays=No. of days AtEndOfMonth=At end of month CurrentNext=Current/Next