diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php
index b7f1f0e6db9..f862f7e69e5 100644
--- a/htdocs/admin/bom.php
+++ b/htdocs/admin/bom.php
@@ -44,6 +44,7 @@ $type = 'bom';
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -167,23 +168,7 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK')
}
}
-elseif ($action == 'set_BOM_FREE_TEXT')
-{
- $freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-} elseif ($action=="setshippableiconinlist") {
+elseif ($action=="setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
@@ -490,35 +475,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print "
\n";
print "\n";
- $substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
- $substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
- $htmltext = ''.$langs->trans("AvailableVariables").': ';
- foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
- $htmltext.=' ';
-
- print '';
+ // free text
+ $freetexttitle = $langs->trans("FreeLegalTextOnBOMs");
+ $freetextvar = "BOM_FREE_TEXT";
+ require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
//Use draft Watermark
-
print "";
print ' ';
print " ";
diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php
index e8e035f8b49..05c2d023364 100644
--- a/htdocs/admin/chequereceipts.php
+++ b/htdocs/admin/chequereceipts.php
@@ -44,6 +44,7 @@ $value = GETPOST('value', 'alpha');
if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON = 'mod_chequereceipts_mint.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
/*
* Actions
@@ -72,23 +73,6 @@ if ($action == 'setmod')
dolibarr_set_const($db, "CHEQUERECEIPTS_ADDON", $value, 'chaine', 0, '', $conf->entity);
}
-if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT')
-{
- $freetext = GETPOST('BANK_CHEQUERECEIPT_FREE_TEXT', 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "BANK_CHEQUERECEIPT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
/*
* view
@@ -237,10 +221,6 @@ print ' ';
*/
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
-print ' ';
-print ' ';
-print ' ';
-
print '';
print '';
print ''.$langs->trans("Parameters").' ';
@@ -248,37 +228,15 @@ print ' ';
print ' ';
print " \n";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print '
';
-print " ";
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnChequeReceipts");
+$freetextvar = "BANK_CHEQUERECEIPT_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print ''."\n";
dol_fiche_end();
-print ' ';
-
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index 455175220a8..b7e1e3e0f75 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -47,12 +47,12 @@ $label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'order';
-
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -176,23 +176,8 @@ elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK')
}
}
-elseif ($action == 'set_ORDER_FREE_TEXT')
+elseif ($action=="setshippableiconinlist")
{
- $freetext = GETPOST("ORDER_FREE_TEXT", 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-} elseif ($action=="setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
@@ -532,35 +517,12 @@ print ''.$langs->trans("Value").' ';
print " \n";
print "\n";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print ' ';
-print ' ';
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='ORDER_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print ' ';
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnOrders");
+$freetextvar = "ORDER_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
//Use draft Watermark
-
print "";
print ' ';
print " ";
diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php
index bf02df80b5b..36236fc1b30 100644
--- a/htdocs/admin/contract.php
+++ b/htdocs/admin/contract.php
@@ -50,6 +50,7 @@ if (empty($conf->global->CONTRACT_ADDON))
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -157,13 +158,10 @@ elseif ($action == 'setmod')
elseif ($action == 'set_other')
{
- $freetext= GETPOST('CONTRACT_FREE_TEXT', 'none'); // No alpha here, we want exact string
- $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
$draft= GETPOST('CONTRACT_DRAFT_WATERMARK', 'alpha');
- $res2 = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "CONTRACT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
- if (! $res1 > 0 || ! $res2 > 0) $error++;
+ if (! $res > 0) $error++;
if (! $error)
{
@@ -458,55 +456,36 @@ print " ";
*
*/
-print ' ';
-print ' ';
-print ' ';
-
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '';
print '';
print ''.$langs->trans("Parameter").' ';
print ''.$langs->trans("Value").' ';
+print " \n";
print " \n";
-$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnContracts");
+$freetextvar = "CONTRACT_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
-print ' ';
-$variablename='CONTRACT_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' '."\n";
+print '';
+print ' ';
+print ' ';
//Use draft Watermark
-
print '';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
print ' ';
print ' ';
+print ' ';
+print ' ';
print ' '."\n";
-print '
';
-
-print '';
-print ' ';
-print '
';
-
print ' ';
+print '';
+
dol_fiche_end();
// End of page
diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index 04dcf3ddc36..9ac7b2aa61a 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -57,6 +57,7 @@ if (empty($conf->global->EXPEDITION_ADDON_NUMBER))
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -76,14 +77,6 @@ if ($action == 'updateMask')
elseif ($action == 'set_param')
{
- $freetext=GETPOST('SHIPPING_FREE_TEXT', 'none'); // No alpha here, we want exact string
- $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
- if ($res <= 0)
- {
- $error++;
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-
$draft=GETPOST('SHIPPING_DRAFT_WATERMARK', 'alpha');
$res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if ($res <= 0)
@@ -466,47 +459,35 @@ print ' ';
*/
print load_fiche_titre($langs->trans("OtherOptions"));
+print '';
+print '';
+print ''.$langs->trans("Parameter").' ';
+print ''.$langs->trans("Value").' ';
+print " \n";
+print " \n";
+
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnShippings");
+$freetextvar = "SHIPPING_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
+
+
print '';
print ' ';
print ' ';
-print "";
-print "";
-print "".$langs->trans("Parameter")." \n";
-print " ";
-
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='SHIPPING_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print " \n";
-
print '';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
+print ' ';
print ' ';
+print ' ';
+print ' ';
print " \n";
-print '
';
-
-print '
';
-
print ' ';
+print '
';
+
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php
index cac83ef8d8b..dfe35ee7b56 100644
--- a/htdocs/admin/expensereport.php
+++ b/htdocs/admin/expensereport.php
@@ -51,6 +51,7 @@ $type='expensereport';
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -166,13 +167,10 @@ elseif ($action == 'setoptions')
{
$db->begin();
- $freetext= GETPOST('EXPENSEREPORT_FREE_TEXT', 'none'); // No alpha here, we want exact string
- $res1 = dolibarr_set_const($db, "EXPENSEREPORT_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
$draft= GETPOST('EXPENSEREPORT_DRAFT_WATERMARK', 'alpha');
- $res2 = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "EXPENSEREPORT_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
- if (! $res1 > 0 || ! $res2 > 0) $error++;
+ if (! $res > 0) $error++;
if (! $error)
{
@@ -464,53 +462,37 @@ print ' ';
* Other options
*/
-print '';
-print ' ';
-print ' ';
-
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '';
print '';
-print ''.$langs->trans("Parameter").' ';
+print ''.$langs->trans("Parameter").' ';
print ' ';
+print " \n";
print " \n";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnExpenseReports");
+$freetextvar = "EXPENSEREPORT_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='EXPENSEREPORT_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' '."\n";
+
+print '';
+print ' ';
+print ' ';
//Use draft Watermark
print '';
print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
print ' ';
+print ' ';
+print ' ';
print ' '."\n";
-print '
';
-
-print '';
-print ' ';
-print '
';
-
print ' ';
+print '';
+
dol_fiche_end();
// End of page
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 57a18afcbd3..c25d26f3e0b 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -50,6 +50,7 @@ $type='invoice';
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -195,24 +196,6 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
-
-elseif ($action == 'set_INVOICE_FREE_TEXT')
-{
- $freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
elseif ($action == 'setforcedate')
{
$forcedate = GETPOST('forcedate', 'alpha');
@@ -759,34 +742,12 @@ print ' \n";
print '';
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print ' ';
-print ' ';
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='INVOICE_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print ' ';
-
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnInvoices");
+$freetextvar = "INVOICE_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
+//Use draft Watermark
print '';
print ' ';
print ' ';
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index a407edd3864..8dcfadf9a6c 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -51,6 +51,7 @@ $type='ficheinter';
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -156,23 +157,6 @@ elseif ($action == 'setmod')
dolibarr_set_const($db, "FICHEINTER_ADDON", $value, 'chaine', 0, '', $conf->entity);
}
-elseif ($action == 'set_FICHINTER_FREE_TEXT')
-{
- $freetext= GETPOST('FICHINTER_FREE_TEXT', 'none'); // No alpha here, we want exact string
- $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-
elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK', 'alpha');
@@ -532,32 +516,10 @@ print ''.$langs->trans("Value").' ';
print " \n";
print "\n";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print ' ';
-print ' ';
-print ' ';
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='FICHINTER_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print ' ';
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnInterventions");
+$freetextvar = "FICHINTER_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
//Use draft Watermark
print "";
diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php
index d67451812c6..ce6d390aa69 100644
--- a/htdocs/admin/holiday.php
+++ b/htdocs/admin/holiday.php
@@ -52,6 +52,7 @@ if (empty($conf->global->HOLIDAY_ADDON))
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -159,13 +160,10 @@ elseif ($action == 'setmod')
elseif ($action == 'set_other')
{
- $freetext= GETPOST('HOLIDAY_FREE_TEXT', 'none'); // No alpha here, we want exact string
- $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
$draft= GETPOST('HOLIDAY_DRAFT_WATERMARK', 'alpha');
- $res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
- if (! $res1 > 0 || ! $res2 > 0) $error++;
+ if (! $res > 0) $error++;
if (! $error)
{
@@ -464,54 +462,36 @@ print " ";
* Other options
*/
-print ' ';
-print ' ';
-print ' ';
-
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
+
print '';
print '';
print ''.$langs->trans("Parameter").' ';
print ''.$langs->trans("Value").' ';
+print " \n";
print " \n";
-$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnHolidays");
+$freetextvar = "HOLIDAY_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
-print ' ';
-$variablename='HOLIDAY_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' '."\n";
+print '';
+print ' ';
+print ' ';
//Use draft Watermark
-
print '';
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').' ';
print ' ';
print ' ';
+print ' ';
+print ' ';
print ' '."\n";
-print '
';
-
-print '';
-print ' ';
-print '
';
-
print ' ';
+
+print '';
}
diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php
index d11d07c5f38..dde70bc5314 100644
--- a/htdocs/admin/livraison.php
+++ b/htdocs/admin/livraison.php
@@ -51,6 +51,7 @@ $type='delivery';
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -70,23 +71,6 @@ if ($action == 'updateMask')
}
}
-if ($action == 'set_DELIVERY_FREE_TEXT')
-{
- $free=GETPOST('DELIVERY_FREE_TEXT', 'none'); // No alpha here, we want exact string
- $res=dolibarr_set_const($db, "DELIVERY_FREE_TEXT", $free, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-
if ($action == 'specimen')
{
$modele=GETPOST('module', 'alpha');
@@ -449,32 +433,10 @@ print ''.$langs->trans("Value").' ';
print ' ';
print "\n";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print ' ';
-print ' ';
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='DELIVERY_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print ' ';
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnDeliveryReceipts");
+$freetextvar = "DELIVERY_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '';
diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php
index db41876b02c..50faa61d87a 100644
--- a/htdocs/admin/propal.php
+++ b/htdocs/admin/propal.php
@@ -50,6 +50,7 @@ $type='propal';
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
$error=0;
if ($action == 'updateMask')
@@ -148,23 +149,6 @@ elseif ($action == 'set_PROPALE_DRAFT_WATERMARK')
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
-elseif ($action == 'set_PROPOSAL_FREE_TEXT')
-{
- $freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
elseif ($action == 'setdefaultduration')
{
$res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
@@ -653,34 +637,12 @@ print "\n";
print '';
*/
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print ' ';
-print ' ';
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='PROPOSAL_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print ' ';
-
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnProposal");
+$freetextvar = "PROPOSAL_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
+//Use draft Watermark
print "";
print ' ';
print " ";
diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php
index 6d8936fbe71..fcc3906150f 100644
--- a/htdocs/admin/supplier_invoice.php
+++ b/htdocs/admin/supplier_invoice.php
@@ -55,6 +55,8 @@ $specimenthirdparty->initAsSpecimen();
* Actions
*/
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
+
if ($action == 'updateMask')
{
$maskconstinvoice=GETPOST('maskconstinvoice', 'alpha');
@@ -174,25 +176,6 @@ if ($action == 'addcat')
$fourn->CreateCategory($user, $_POST["cat"]);
}
-if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
-{
- $freetext = GETPOST('SUPPLIER_INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "SUPPLIER_INVOICE_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-
-
/*
* View
*/
@@ -461,11 +444,6 @@ print ' ';
/*
* Other options
*/
-
-print ' ';
-print ' ';
-print ' ';
-
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '';
print '';
@@ -474,33 +452,10 @@ print ''.$langs->trans("Value").' ';
print ' ';
print " \n";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='SUPPLIER_INVOICE_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-
-print '
';
-
-print ' ';
-
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnInvoices");
+$freetextvar = "SUPPLIER_INVOICE_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
/*
* Notifications
diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php
index c414eca8158..95eca54074a 100644
--- a/htdocs/admin/supplier_order.php
+++ b/htdocs/admin/supplier_order.php
@@ -54,6 +54,8 @@ $specimenthirdparty->initAsSpecimen();
* Actions
*/
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
+
if ($action == 'updateMask')
{
$maskconstorder=GETPOST('maskconstorder', 'alpha');
@@ -168,17 +170,15 @@ elseif ($action == 'addcat')
elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
{
- $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT', 'none'); // No alpha here, we want exact string
$doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED', 'alpha');
$doubleapproval = price2num($doubleapproval);
- $res1 = dolibarr_set_const($db, "SUPPLIER_ORDER_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
- $res2 = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity);
+ $res = dolibarr_set_const($db, "SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED", $doubleapproval, 'chaine', 0, '', $conf->entity);
// TODO We add/delete permission here until permission can have a condition on a global var
include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php';
$newmodule=new modFournisseur($db);
-
+
if ($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED)
{
// clear default rights array
@@ -191,7 +191,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
$newmodule->rights[$r][3] = 0;
$newmodule->rights[$r][4] = 'commande';
$newmodule->rights[$r][5] = 'approve2';
-
+
// Insert
$newmodule->insert_permissions(1);
}
@@ -199,7 +199,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER')
{
// Remove all rights with Permission1190
$newmodule->delete_permissions();
-
+
// Add all right without Permission1190
$newmodule->insert_permissions(1);
}
@@ -541,34 +541,12 @@ else
}
*/
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='SUPPLIER_ORDER_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-
-print ' ';
-
print '';
-
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnOrders");
+$freetextvar = "SUPPLIER_ORDER_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
/*
* Notifications
diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php
index b757fb66673..551572891ba 100644
--- a/htdocs/admin/supplier_proposal.php
+++ b/htdocs/admin/supplier_proposal.php
@@ -48,6 +48,7 @@ $error=0;
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+include DOL_DOCUMENT_ROOT.'/core/actions_setfreetext.inc.php';
if ($action == 'updateMask')
{
@@ -129,24 +130,6 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK')
}
}
-if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT')
-{
- $freetext = GETPOST('SUPPLIER_PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
-
- $res = dolibarr_set_const($db, "SUPPLIER_PROPOSAL_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
-
- if (! $res > 0) $error++;
-
- if (! $error)
- {
- setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
- }
- else
- {
- setEventMessages($langs->trans("Error"), null, 'errors');
- }
-}
-
if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL')
{
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
@@ -495,34 +478,12 @@ print ''.$langs->trans("Value")." \n";
print " \n";
print "";
-$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
-$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
-$htmltext = ''.$langs->trans("AvailableVariables").': ';
-foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
-$htmltext.=' ';
-
-print '';
-print ' ';
-print ' ';
-print '';
-print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
-$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
-if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
-{
- print ''.$conf->global->$variablename.' ';
-}
-else
-{
- include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
- print $doleditor->Create();
-}
-print ' ';
-print ' ';
-print " \n";
-print ' ';
-
+// free text
+$freetexttitle = $langs->trans("FreeLegalTextOnSupplierProposal");
+$freetextvar = "SUPPLIER_PROPOSAL_FREE_TEXT";
+require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
+//Use draft Watermark
print "";
print ' ';
print " ";
diff --git a/htdocs/core/actions_setfreetext.inc.php b/htdocs/core/actions_setfreetext.inc.php
new file mode 100644
index 00000000000..7e76a3d5a6d
--- /dev/null
+++ b/htdocs/core/actions_setfreetext.inc.php
@@ -0,0 +1,54 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ * or see http://www.gnu.org/
+ */
+
+/**
+ * \file htdocs/core/actions_setmoduleoptions.inc.php
+ * \brief Code for actions on setting notes of object page
+ */
+
+
+// $action must be defined
+// $arrayofparameters must be set for action 'update'
+// $nomessageinupdate can be set to 1
+// $nomessageinsetmoduleoptions can be set to 1
+if ($action == 'set_freetext')
+{
+ $freetextvar = GETPOST("freetextvar", 'alpha');
+ $freetext = GETPOST("freetext", 'none'); // No alpha here, we want exact string
+ $freetextlang = GETPOST('freetextlang', 'alpha');
+
+ if ( ! empty($conf->global->MAIN_MULTILANGS) && !empty($freetextlang) )
+ {
+ $res = dolibarr_set_const($db, $freetextvar."_".$freetextlang, $freetext, 'chaine', 0, '', $conf->entity);
+ }
+ else
+ {
+ $res = dolibarr_set_const($db, $freetextvar, $freetext, 'chaine', 0, '', $conf->entity);
+ }
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+ }
+ else
+ {
+ setEventMessages($langs->trans("Error"), null, 'errors');
+ }
+}
\ No newline at end of file
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index 2d6e41abe59..2e8d286fc26 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -874,6 +874,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$dims=$pdf->getPageDimensions();
+ if ( ! empty($conf->global->$paramfreetext."_".$outputlangs->defaultlang) )
+ {
+ $paramfreetext .= "_".$outputlangs->defaultlang;
+ }
+
// Line of free text
if (empty($hidefreetext) && ! empty($conf->global->$paramfreetext))
{
diff --git a/htdocs/core/tpl/admin_freetext.tpl.php b/htdocs/core/tpl/admin_freetext.tpl.php
new file mode 100644
index 00000000000..f80ce8b224e
--- /dev/null
+++ b/htdocs/core/tpl/admin_freetext.tpl.php
@@ -0,0 +1,116 @@
+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+/**
+ * The following vars must be defined:
+ * $freetexttitle
+ * $freetextvar
+ * $conf, $langs, $db
+ * The following vars may also be defined:
+ * $freetextlang
+ */
+
+// Protection to avoid direct call of template
+if (empty($conf) || ! is_object($conf))
+{
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
+$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
+$htmltext = ''.$langs->trans("AvailableVariables").': ';
+foreach($substitutionarray as $key => $val) $htmltext.=$key.' ';
+$htmltext.=' ';
+
+print ' ';
+print ' ';
+print ' ';
+print ' ';
+print '';
+
+$form=new Form($db);
+print $form->textwithpicto($freetexttitle, $langs->trans("AddCRIfTooLong").' '.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').' ';
+
+$freetextconfvar = $freetextvar;
+if (! empty($conf->global->MAIN_MULTILANGS) )
+{
+ $freetextlang = GETPOST('freetextlang', 'alpha');
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
+ $formadmin=new FormAdmin($db);
+ print ' '.$langs->trans('Language').' ';
+ print $formadmin->select_language($freetextlang, 'freetextlang', 0, $freetextlang, 1);
+ print '';
+
+ if (! empty($freetextlang))
+ {
+ $freetextconfvar .= '_'.$freetextlang;
+ }
+}
+
+if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
+{
+ print ''.$conf->global->$freetextconfvar.' ';
+}
+else
+{
+ include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
+ $doleditor=new DolEditor("freetext", $conf->global->$freetextconfvar, '', 80, 'dolibarr_notes');
+ print $doleditor->Create();
+}
+print ' ';
+print ' ';
+print " \n";
+print ' ';
+
+if (! empty($conf->global->MAIN_MULTILANGS) )
+{
+?>
+
+