Can set language file to use for label key of extra field

This commit is contained in:
Laurent Destailleur 2017-08-27 12:52:26 +02:00
parent 502ac19a0a
commit 76b4a2ce06
4 changed files with 46 additions and 44 deletions

View File

@ -158,12 +158,11 @@ if ($action == 'add')
$params['options'][$key] = $value; $params['options'][$key] = $value;
} }
} }
$result=$extrafields->addExtraField( $result=$extrafields->addExtraField(
GETPOST('attrname', 'alpha'), GETPOST('attrname', 'alpha'),
GETPOST('label', 'alpha'), GETPOST('label', 'alpha'),
$type, $type,
GETPOST('pos', 'alpha'), GETPOST('pos', 'int'),
$extrasize, $extrasize,
$elementtype, $elementtype,
(GETPOST('unique', 'alpha')?1:0), (GETPOST('unique', 'alpha')?1:0),
@ -175,8 +174,8 @@ if ($action == 'add')
(GETPOST('list', 'alpha')?1:0), (GETPOST('list', 'alpha')?1:0),
(GETPOST('ishidden', 'alpha')?1:0), (GETPOST('ishidden', 'alpha')?1:0),
GETPOST('computed_value','alpha'), GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:'') (GETPOST('entitycurrentorall', 'alpha')?0:''),
GETPOST('langfile', 'alpha')
); );
if ($result > 0) if ($result > 0)
{ {
@ -338,7 +337,8 @@ if ($action == 'update')
(GETPOST('ishidden', 'alpha')?1:0), (GETPOST('ishidden', 'alpha')?1:0),
GETPOST('default_value','alpha'), GETPOST('default_value','alpha'),
GETPOST('computed_value','alpha'), GETPOST('computed_value','alpha'),
(GETPOST('entitycurrentorall', 'alpha')?0:'') (GETPOST('entitycurrentorall', 'alpha')?0:''),
GETPOST('langfile')
); );
if ($result > 0) if ($result > 0)
{ {

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2010-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* *
@ -158,7 +158,9 @@
</td> </td>
</tr> </tr>
<!-- Position --> <!-- Position -->
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos'); ?>"></td></tr> <tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo GETPOST('pos','int'); ?>"></td></tr>
<!-- Language file -->
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag(GETPOST('langfile','alpha')); ?>"></td></tr>
<!-- Computed Value --> <!-- Computed Value -->
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('"computed_value"')?GETPOST('"computed_value"'):''); ?>"></td></tr> <tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" type="text" name="computed_value" class="quatrevingtpercent" value="<?php echo (GETPOST('"computed_value"')?GETPOST('"computed_value"'):''); ?>"></td></tr>
<!-- Default Value (at sql setup level) --> <!-- Default Value (at sql setup level) -->

View File

@ -129,23 +129,20 @@
<table summary="listofattributes" class="border centpercent"> <table summary="listofattributes" class="border centpercent">
<?php <?php
$type=$extrafields->attribute_type[$attrname]; $type=$extrafields->attributes[$elementtype]['type'][$attrname];
$size=$extrafields->attribute_size[$attrname]; $size=$extrafields->attributes[$elementtype]['size'][$attrname];
$computed=$extrafields->attribute_computed[$attrname]; $computed=$extrafields->attributes[$elementtype]['computed'][$attrname];
$default=$extrafields->attribute_default[$attrname]; $default=$extrafields->attributes[$elementtype]['default'][$attrname];
$unique=$extrafields->attribute_unique[$attrname]; $unique=$extrafields->attributes[$elementtype]['unique'][$attrname];
$required=$extrafields->attribute_required[$attrname]; $required=$extrafields->attributes[$elementtype]['required'][$attrname];
$pos=$extrafields->attribute_pos[$attrname]; $pos=$extrafields->attributes[$elementtype]['pos'][$attrname];
$alwayseditable=$extrafields->attribute_alwayseditable[$attrname]; $alwayseditable=$extrafields->attributes[$elementtype]['alwayseditable'][$attrname];
$param=$extrafields->attribute_param[$attrname]; $param=$extrafields->attributes[$elementtype]['param'][$attrname];
$perms=$extrafields->attribute_perms[$attrname]; $perms=$extrafields->attributes[$elementtype]['perms'][$attrname];
$list=$extrafields->attribute_list[$attrname]; $langfile=$extrafields->attributes[$elementtype]['langfile'][$attrname];
if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { $list=$extrafields->attributes[$elementtype]['list'][$attrname];
$ishidden=$extrafields->attribute_hidden[$attrname]; $ishidden=$extrafields->attributes[$elementtype]['hidden'][$attrname];
} $entitycurrentorall=$extrafields->attributes[$elementtype]['entityid'][$attrname];
if ($conf->multicompany->enabled) {
$entitycurrentorall=$extrafields->attribute_entityid[$attrname];
}
if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param))
{ {
@ -220,7 +217,9 @@ else
</td> </td>
</tr> </tr>
<!-- Position --> <!-- Position -->
<tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($extrafields->attribute_pos[$attrname]); ?>"></td></tr> <tr><td class="titlefield"><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo dol_escape_htmltag($pos); ?>"></td></tr>
<!-- Language file -->
<tr><td class="titlefield"><?php echo $langs->trans("LanguageFile"); ?></td><td class="valeur"><input type="text" name="langfile" class="minwidth200" value="<?php echo dol_escape_htmltag($langfile); ?>"></td></tr>
<!-- Computed value --> <!-- Computed value -->
<tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr> <tr class="extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans("ComputedFormula"), $langs->trans("ComputedFormulaDesc"), 1, 'help', '', 0, 2, 'tooltipcompute'); ?></td><td class="valeur"><input id="computed_value" class="quatrevingtpercent" type="text" name="computed_value" value="<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
<!-- Default value --> <!-- Default value -->

View File

@ -345,6 +345,7 @@ AddCRIfTooLong=There is no automatic wrapping, so if line is out of page on docu
ConfirmPurge=Are you sure you want to execute this purge?<br>This will delete definitely all your data files with no way to restore them (ECM files, attached files...). ConfirmPurge=Are you sure you want to execute this purge?<br>This will delete definitely all your data files with no way to restore them (ECM files, attached files...).
MinLength=Minimum length MinLength=Minimum length
LanguageFilesCachedIntoShmopSharedMemory=Files .lang loaded in shared memory LanguageFilesCachedIntoShmopSharedMemory=Files .lang loaded in shared memory
LanguageFile=Language file
ExamplesWithCurrentSetup=Examples with current running setup ExamplesWithCurrentSetup=Examples with current running setup
ListOfDirectories=List of OpenDocument templates directories ListOfDirectories=List of OpenDocument templates directories
ListOfDirectoriesForModelGenODT=List of directories containing templates files with OpenDocument format.<br><br>Put here full path of directories.<br>Add a carriage return between eah directory.<br>To add a directory of the GED module, add here <b>DOL_DATA_ROOT/ecm/yourdirectoryname</b>.<br><br>Files in those directories must end with <b>.odt</b> or <b>.ods</b>. ListOfDirectoriesForModelGenODT=List of directories containing templates files with OpenDocument format.<br><br>Put here full path of directories.<br>Add a carriage return between eah directory.<br>To add a directory of the GED module, add here <b>DOL_DATA_ROOT/ecm/yourdirectoryname</b>.<br><br>Files in those directories must end with <b>.odt</b> or <b>.ods</b>.