add lang management to freetext

This commit is contained in:
Christophe Battarel 2019-04-16 16:16:37 +02:00
parent 6d07bcb73e
commit 502b1e4d31
17 changed files with 303 additions and 583 deletions

View File

@ -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 "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// 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 "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_BOM_DRAFT_WATERMARK\">";

View File

@ -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 '<br>';
*/
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BANK_CHEQUERECEIPT_FREE_TEXT">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>';
@ -248,37 +228,15 @@ print '<td class="center" width="60">&nbsp;</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BANK_CHEQUERECEIPT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table>';
print "<br>";
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnChequeReceipts");
$freetextvar = "BANK_CHEQUERECEIPT_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '</table>'."\n";
dol_fiche_end();
print '</form>';
// End of page
llxFooter();
$db->close();

View File

@ -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 '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_ORDER_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// 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 "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";

View File

@ -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 "<br>";
*
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnContracts");
$freetextvar = "CONTRACT_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print '<br>';
$variablename='CONTRACT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td></tr>'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
//Use draft Watermark
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</td></tr>'."\n";
print '</table>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '</table>';
dol_fiche_end();
// End of page

View File

@ -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 '<br>';
*/
print load_fiche_titre($langs->trans("OtherOptions"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnShippings");
$freetextvar = "SHIPPING_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_param">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Parameter")."</td>\n";
print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<tr><td>';
print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='SHIPPING_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 "</td></tr>\n";
print '<tr><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input size="50" class="flat" type="text" name="SHIPPING_DRAFT_WATERMARK" value="'.$conf->global->SHIPPING_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table>';
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></div>';
print '</form>';
print '</table>';
// End of page
llxFooter();
$db->close();

View File

@ -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 '<br>';
* Other options
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setoptions">';
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td colspan="2">'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60"></td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnExpenseReports");
$freetextvar = "EXPENSEREPORT_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='EXPENSEREPORT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td></tr>'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setoptions">';
//Use draft Watermark
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '<input size="50" class="flat" type="text" name="EXPENSEREPORT_DRAFT_WATERMARK" value="'.$conf->global->EXPENSEREPORT_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</td></tr>'."\n";
print '</table>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '</table>';
dol_fiche_end();
// End of page

View File

@ -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 '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
print "</td></tr>\n";
print '</form>';
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_INVOICE_FREE_TEXT" />';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';
// 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 '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';

View File

@ -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 '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_FICHINTER_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='FICHINTER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// 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 "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";

View File

@ -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 "<br>";
* Other options
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnHolidays");
$freetextvar = "HOLIDAY_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
print '<br>';
$variablename='HOLIDAY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td></tr>'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
//Use draft Watermark
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input size="50" class="flat" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</td></tr>'."\n";
print '</table>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>';
print '</form>';
print '</table>';
}

View File

@ -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 '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_DELIVERY_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='DELIVERY_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnDeliveryReceipts");
$freetextvar = "DELIVERY_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
print '</table>';

View File

@ -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 "</td></tr>\n";
print '</form>';
*/
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_PROPOSAL_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// 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 "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";

View File

@ -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 '</table><br>';
/*
* Other options
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -474,33 +452,10 @@ print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='SUPPLIER_INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table><br>';
print '</form>';
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnInvoices");
$freetextvar = "SUPPLIER_INVOICE_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
/*
* Notifications

View File

@ -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 = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='SUPPLIER_ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</table><br>';
print '</form>';
// free text
$freetexttitle = $langs->trans("FreeLegalTextOnOrders");
$freetextvar = "SUPPLIER_ORDER_FREE_TEXT";
require_once(DOL_DOCUMENT_ROOT.'/core/tpl/admin_freetext.tpl.php');
/*
* Notifications

View File

@ -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 '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
print "<td>&nbsp;</td>\n";
print "</tr>";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_PROPOSAL_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// 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 "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";

View File

@ -0,0 +1,54 @@
<?php
/* Copyright (C) 2014-2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 <http://www.gnu.org/licenses/>.
* 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');
}
}

View File

@ -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))
{

View File

@ -0,0 +1,116 @@
<?php
/* Copyright (C) 2019 Christophe Battarel <christophe.battarel@altairis.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*
*/
/**
* 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 = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_freetext">';
print '<input type="hidden" name="freetextvar" value="'.$freetextvar.'">';
print '<tr class="oddeven"><td colspan="2">';
$form=new Form($db);
print $form->textwithpicto($freetexttitle, $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$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 '<br/>'.$langs->trans('Language').'&emsp;';
print $formadmin->select_language($freetextlang, 'freetextlang', 0, $freetextlang, 1);
print '</br>';
if (! empty($freetextlang))
{
$freetextconfvar .= '_'.$freetextlang;
}
}
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="freetext" class="flat" cols="120">'.$conf->global->$freetextconfvar.'</textarea>';
}
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 '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
if (! empty($conf->global->MAIN_MULTILANGS) )
{
?>
<script type="text/javascript">
var freetext = [];
freetext["0"] = "<?php echo $conf->global->$freetextvar;?>";
<?php
$langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
foreach ($langs_available as $key => $value)
{
$freetextlangvar = $freetextvar."_".$key;
print 'freetext["'.$key.'"] = "'.$conf->global->$freetextlangvar.'";';
}
?>
$('#freetextlang').change(function()
{
<?php
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
?>
$('#freetext').html(freetext[$(this).val()]);
<?php
}
else
{
?>
CKEDITOR.instances.freetext.setData(freetext[$(this).val()]);
<?php
}
?>
});
</script>
<?php
}