Fix: models generator that need parameters

This commit is contained in:
Regis Houssin 2010-04-07 15:05:21 +00:00
parent 06bee0228d
commit 6e3dbf8cac
2 changed files with 14 additions and 9 deletions

View File

@ -34,7 +34,6 @@ $langs->load("admin");
if (!$user->admin)
accessforbidden();
/*
* Actions
*/
@ -80,9 +79,15 @@ if ($_POST["action"] == 'usesearchtoselectcompany')
// define constants for models generator that need parameters
if ($_POST["action"] == 'setModuleOptions')
{
$param=$_POST["param1"];
$value=$_POST["value1"];
if ($param) dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
for($i=0;$i < count($_POST);$i++)
{
if (array_key_exists('param'.$i,$_POST))
{
$param=$_POST["param".$i];
$value=$_POST["value".$i];
if ($param) dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
}
}
}
// Activate a document generator module

View File

@ -77,9 +77,9 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$texte.= '<input type="hidden" name="action" value="updateMask">';
$texte.= '<input type="hidden" name="maskcustomer" value="COMPANY_ELEPHANT_MASK_CUSTOMER">';
$texte.= '<input type="hidden" name="masksupplier" value="COMPANY_ELEPHANT_MASK_SUPPLIER">';
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
$texte.= '<input type="hidden" name="param1" value="COMPANY_ELEPHANT_MASK_CUSTOMER">';
$texte.= '<input type="hidden" name="param2" value="COMPANY_ELEPHANT_MASK_SUPPLIER">';
$texte.= '<table class="nobordernopadding" width="100%">';
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("ThirdParty"));
@ -90,7 +90,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Parametrage du prefix customers
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskcustomer" value="'.$conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER.'">',$tooltip,1,1).'</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="value1" value="'.$conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER.'">',$tooltip,1,1).'</td>';
$texte.= '<td align="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
@ -98,7 +98,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Parametrage du prefix suppliers
$texte.= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="masksupplier" value="'.$conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER.'">',$tooltip,1,1).'</td>';
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="value2" value="'.$conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER.'">',$tooltip,1,1).'</td>';
$texte.= '</tr>';
$texte.= '</table>';