Line 1:
Line 1:
+
<!-- BEGIN origin interlang links -->
+
<!-- You can edit this section but do NOT remove these comments
+
Links below will be automatically replicated on translated pages by PolyglotBot -->
+
[[fr:Système_de_substitution_de_variables]]
+
[[zh:变量替换系统]]
+
<!-- END interlang links -->
+
{{TemplateDocUser}}
{{TemplateDocUser}}
{{TemplateDocDevEn}}
{{TemplateDocDevEn}}
Line 11:
Line 18:
==Dolibarr User==
==Dolibarr User==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 63:
Line 72:
|User remote IP
|User remote IP
|}
|}
+
*
*
==My Company==
==My Company==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 82:
Line 94:
|contact@mycompany.com
|contact@mycompany.com
|My company contact email
|My company contact email
+
|
+
|-
+
|__MYCOMPANY_PHONE__
+
|0123456789
+
|My company phone number
+
|
+
|-
+
|__MYCOMPANY_FAX__
+
|0123456789
+
|My company fax number
|
|
|-
|-
Line 159:
Line 181:
|
|
|}
|}
+
*
*
==Object==
==Object==
===Generic===
===Generic===
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 206:
Line 231:
|V 13
|V 13
|}
|}
+
*
*
===Objects with amounts===
===Objects with amounts===
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 219:
Line 247:
|__DATE_YMD__
|__DATE_YMD__
|1/1/2020
|1/1/2020
−
|Actual date
+
|Object date
|
|
|-
|-
Line 233:
Line 261:
|-
|-
|__AMOUNT_TEXT__
|__AMOUNT_TEXT__
−
|One thousan five hundred ...
+
|One thousand five hundred ...
|Amount in words
|Amount in words
|V13
|V13
|-
|-
|__AMOUNT_TEXTCURRENCY__
|__AMOUNT_TEXTCURRENCY__
−
|One thousan five hundred ...
+
|One thousand five hundred ...
|Amount in words with currency
|Amount in words with currency
|V13
|V13
Line 253:
Line 281:
|-
|-
|__AMOUNT_VAT_TEXT__
|__AMOUNT_VAT_TEXT__
−
|One thousan five hundred ...
+
|One thousand five hundred ...
|VAT Amount in words
|VAT Amount in words
|V13
|V13
|-
|-
|__AMOUNT_VAT_TEXTCURRENCY__
|__AMOUNT_VAT_TEXTCURRENCY__
−
|One thousan five hundred ...
+
|One thousand five hundred ...
|VAT Amount in words with currency
|VAT Amount in words with currency
|V13
|V13
Line 312:
Line 340:
|V13
|V13
|}
|}
+
*
*
==Member==
==Member==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 448:
Line 479:
|V 13
|V 13
|}
|}
+
*
*
==Thirdparty==
==Thirdparty==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 569:
Line 603:
|V13
|V13
|}
|}
+
*
*
==Candidate==
==Candidate==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 595:
Line 632:
|V13
|V13
|}
|}
+
*
*
==Project==
==Project==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 621:
Line 661:
|
|
|}
|}
+
*
*
==Shipment==
==Shipment==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 642:
Line 685:
|
|
|}
|}
+
*
*
==Reception==
==Reception==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 663:
Line 709:
|V13
|V13
|}
|}
+
*
*
==Contract==
==Contract==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 694:
Line 743:
|
|
|}
|}
+
*
*
==Extrafield==
==Extrafield==
===Generic Rule===
===Generic Rule===
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 711:
Line 763:
|
|
|}
|}
+
*
*
===Date Extrafield===
===Date Extrafield===
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 737:
Line 792:
|
|
|}
|}
+
*
*
===Datetime Extrafield===
===Datetime Extrafield===
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 768:
Line 826:
|
|
|}
|}
+
*
*
==Online Payment==
==Online Payment==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 790:
Line 851:
|-
|-
|}
|}
+
+
*
+
+
==Online Proposal Signature==
+
+
*
+
+
{| class="wikitable sortable" style="width: 85%;"
+
|+
+
!Variable
+
!Displayed Value
+
!Note
+
!Dolibarr Mini
+
|-
+
|__ONLINE_SIGN_URL__
+
|[https://mydoli.com/public/onlinesign http://mydoli.com/public/onlinesign]
+
|Address of the Online Signature for proposal
+
|15
+
|-
+
|}
+
+
*
+
+
==Online Intervention Signature==
+
+
*
+
+
{| class="wikitable sortable" style="width: 85%;"
+
|+
+
!Variable
+
!Displayed Value
+
!Note
+
!Dolibarr Mini
+
|-
+
|__ONLINE_SIGN_FICHINTER_URL__
+
|[https://mydoli.com/public/onlinesign http://mydoli.com/public/onlinesign]
+
|Address of the Online Signature for intervention
+
|
+
|-
+
|}
+
*
*
==Document download==
==Document download==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 814:
Line 918:
|http://mydoli.com/invoice.pdf
|http://mydoli.com/invoice.pdf
|Direct download url of an invoice. This needs that the setup INVOICE_ALLOW_EXTERNAL_DOWNLOAD is set to allow to generate the link.
|Direct download url of an invoice. This needs that the setup INVOICE_ALLOW_EXTERNAL_DOWNLOAD is set to allow to generate the link.
+
|
+
|-
+
|__DIRECTDOWNLOAD_URL_FICHINTER__
+
|http://mydoli.com/fichinter.pdf
+
|Direct download url of an intervention. This needs that the setup FICHINTER_ALLOW_EXTERNAL_DOWNLOAD is set to allow to generate the link.
|
|
|-
|-
Line 828:
Line 937:
|__URL_INVOICE__
|__URL_INVOICE__
|http://mydoli.com/compta/facture/card.php?id=xxx
|http://mydoli.com/compta/facture/card.php?id=xxx
−
|Direct download url of an invoice. This needs that the setup INVOICE_ALLOW_EXTERNAL_DOWNLOAD is set to allow to generate the link.
+
|
+
|
+
|-
+
|__URL_FICHINTER__
+
|
+
|
|
|
|}
|}
+
*
*
==Event==
==Event==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 857:
Line 974:
|V13
|V13
|}
|}
+
*
*
==Dates==
==Dates==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 943:
Line 1,063:
|
|
|}
|}
+
*
*
==Multicompany==
==Multicompany==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 959:
Line 1,082:
|V13
|V13
|}
|}
+
*
*
==System==
==System==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 990:
Line 1,116:
|
|
|}
|}
+
*
*
==For Emails==
==For Emails==
+
*
*
+
{| class="wikitable sortable" style="width: 85%;"
{| class="wikitable sortable" style="width: 85%;"
|+
|+
Line 1,002:
Line 1,131:
|-
|-
|__CONTACT_NAME_XXX__
|__CONTACT_NAME_XXX__
−
|Mr T
+
|Mister T
−
|XXX is the contact type defined on Setup->Dictionaries->Contact/Address types (exemple : __CONTACT_NAME_BILLING__ for the billing contact). The output will be Title + LastName + First Name
+
|XXX is the contact type defined on Setup->Dictionaries->Contact/Address types (exemple : __CONTACT_NAME_BILLING__ for the billing contact). The output will be LastName + First Name
+
|V14
+
|-
+
|__CONTACT_LASTNAME_XXX__
+
|T
+
|XXX is the contact type defined on Setup->Dictionaries->Contact/Address types (exemple : __CONTACT_NAME_BILLING__ for the billing contact).
+
|V14
+
|-
+
|__CONTACT_FIRSTNAME_XXX__
+
|Mister
+
|XXX is the contact type defined on Setup->Dictionaries->Contact/Address types (exemple : __CONTACT_NAME_BILLING__ for the billing contact).
+
|V14
+
|-
+
|__CONTACT_TITLE_XXX__
+
|Mr
+
|XXX is the contact type defined on Setup->Dictionaries->Contact/Address types (exemple : __CONTACT_NAME_BILLING__ for the billing contact).
+
|V14
+
|-
+
|__CHECK_READ__
+
|
+
|In emailings, insert a blank image with a callback URL to Dolibarr (/public/emailing/mailing-read.php?tag=)
|
|
|-
|-
−
|__CHECK_READ__
+
|__UNSUBSCRIBE__
|
|
−
|Insert a blank image with a callback URL to Dolibarr (/public/emailing/mailing-read.php?tag=)
+
|In emailings, insert a link to allow a recipient to unsubscribe from emailings. If the recipient (third party or contact) unsubscribes, his status will change to "Refuse bulk emailings"
+
To setup the wording of:
+
+
- the mention in your email for unsubscribing: Translation (key : MailUnsubcribe)
+
+
- the landing page after unsubscribing: Translation (key: YourMailUnsubcribeOK)
|
|
|}
|}
+
*
*
−
=Custom substitution variables=
+
=Substitution variables provide by external module=
−
Custom substituion variables can be added by external modules
+
Custom substitution variables can be added by external modules.
+
For this, the external module must embed a file called '''mymodule/core/substitutions/functions_mymodules.lib.php''' and set the
+
+
<code>$this->module_parts['substitutions'] = 1 </code>
+
+
into the module descriptor.
+
+
=How it work=
+
The array to define all substitution variables is defined in code by calling the method
+
<code>$substitutionarray = getCommonSubstitutionArray().</code>
+
This method receive the $object in parameter, so it can define the content of the substitution array using properties of this object. No database access and no IO are allowed to set the substitution array.
+
+
Then the array will be used by calling the make_substitutions() this way:
+
<code>$textcompleted = make_substitutions($textwithsubtitutionkeys, $substitutionarray)</code>
+
+
+
However, sometimes to value to use is not available into the $object, neither into the environment, and it needs a database access to get the value.
+
In such a case, the substitution is not done by the getCommonSubstitutionArray(). The getCommonSubstitutionArray() will just add an entry into the array of substitution with the information to explain how to get the value like for this entry:
+
<code>$substitutionarray['__PROJECT_NAME__@lazyload'] = '/projet/class/project.class.php:Project:fetchAndSetSubstitution:'.$object->id</code>
+
The substitution will be done by the make_substitutions() and only it is required by calling the method defined (here fetchAndSetSubstitution with the param $object->id of the object Project defined into file /projet/class/project.class.php).
+
Thus, the heavy database access is done only if required.