31 if (empty($conf) || !is_object($conf))
33 print "Error, template page can't be called as URL";
38 $langs->load(
"modulebuilder");
40 $listofexamplesforlink =
'Societe:societe/class/societe.class.php<br>Contact:contact/class/contact.class.php<br>Product:product/class/product.class.php<br>Project:projet/class/project.class.php';
44 <!-- BEGIN PHP TEMPLATE admin_extrafields_add.tpl.php -->
46 jQuery(document).ready(
function() {
47 function init_typeoffields(
type)
49 console.log(
"select a new type (add) = "+
type);
50 var size = jQuery(
"#size");
51 var computed_value = jQuery(
"#computed_value");
52 var langfile = jQuery(
"#langfile");
53 var default_value = jQuery(
"#default_value");
54 var unique = jQuery(
"#unique");
55 var required = jQuery(
"#required");
56 var alwayseditable = jQuery(
"#alwayseditable");
57 var list = jQuery(
"#list");
58 var totalizable = jQuery(
"#totalizable");
60 if ((
GETPOST(
'type',
'alpha') !=
"select") && (
GETPOST(
'type',
'alpha') !=
"sellist"))
62 print 'jQuery("#value_choice").hide();';
65 if (
GETPOST(
'type',
'alpha') ==
"separate")
67 print "jQuery('#size, #default_value, #langfile').val('').prop('disabled', true);";
68 print 'jQuery("#value_choice").hide();';
74 jQuery(
"tr.extra_computed_value").show();
76 computed_value.val(
''); jQuery(
"tr.extra_computed_value").hide();
78 if (computed_value.val())
80 console.log(
"We enter a computed formula");
81 jQuery(
"#default_value").val(
'');
83 jQuery(
"#default_value, #unique, #required, #alwayseditable, #list").attr(
'disabled',
true);
84 jQuery(
"tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_list").hide();
88 console.log(
"No computed formula");
89 jQuery(
"#default_value, #unique, #required, #alwayseditable, #list").attr(
'disabled',
false);
90 jQuery(
"tr.extra_default_value, tr.extra_unique, tr.extra_required, tr.extra_alwayseditable, tr.extra_list").show();
93 if (
type ==
'date') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'disabled'); jQuery(
"#value_choice").hide();jQuery(
"#helpchkbxlst").hide(); }
94 else if (
type ==
'datetime') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'disabled'); jQuery(
"#value_choice").hide(); jQuery(
"#helpchkbxlst").hide();}
95 else if (
type ==
'double') { size.val(
'24,8').removeAttr(
'disabled'); unique.removeAttr(
'disabled'); jQuery(
"#value_choice").hide(); jQuery(
"#helpchkbxlst").hide();}
96 else if (
type ==
'int') { size.val(
'10').removeAttr(
'disabled'); unique.removeAttr(
'disabled'); jQuery(
"#value_choice").hide(); jQuery(
"#helpchkbxlst").hide();}
97 else if (
type ==
'text') { size.val(
'2000').removeAttr(
'disabled'); unique.prop(
'disabled',
true).removeAttr(
'checked'); jQuery(
"#value_choice").hide();jQuery(
"#helpchkbxlst").hide(); }
98 else if (
type ==
'html') { size.val(
'2000').removeAttr(
'disabled'); unique.prop(
'disabled',
true).removeAttr(
'checked'); jQuery(
"#value_choice").hide();jQuery(
"#helpchkbxlst").hide(); }
99 else if (
type ==
'varchar') { size.val(
'255').removeAttr(
'disabled'); unique.removeAttr(
'disabled'); jQuery(
"#value_choice").hide();jQuery(
"#helpchkbxlst").hide(); }
100 else if (
type ==
'password') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); required.val(
'').prop(
'disabled',
true); default_value.val(
'').prop(
'disabled',
true); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helppassword").show();}
101 else if (
type ==
'boolean') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").hide();jQuery(
"#helpchkbxlst").hide();}
102 else if (
type ==
'price') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").hide();jQuery(
"#helpchkbxlst").hide();}
103 else if (
type ==
'select') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helpselect").show();}
104 else if (
type ==
'sellist') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helpsellist").show();}
105 else if (
type ==
'radio') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helpselect").show();}
106 else if (
type ==
'checkbox') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helpselect").show();}
107 else if (
type ==
'chkbxlst') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helpchkbxlst").show();}
108 else if (
type ==
'link') { size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'disabled'); jQuery(
"#value_choice").show(); jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helplink").show();}
109 else if (
type ==
'separate') {
110 langfile.val(
'').prop(
'disabled',
true);size.val(
'').prop(
'disabled',
true); unique.removeAttr(
'checked').prop(
'disabled',
true); required.val(
'').prop(
'disabled',
true);
111 jQuery(
"#value_choice").show();
112 jQuery(
".spanforparamtooltip").hide(); jQuery(
"#helpseparate").show();
115 size.val(
'').prop(
'disabled',
true);
116 unique.removeAttr(
'disabled');
119 if (
type ==
'separate')
121 required.removeAttr(
'checked').prop(
'disabled',
true); alwayseditable.removeAttr(
'checked').prop(
'disabled',
true); list.removeAttr(
'checked').prop(
'disabled',
true);
122 jQuery(
'#size, #default_value, #langfile').val(
'').prop(
'disabled',
true);
123 jQuery(
'#list').val(3);
127 default_value.removeAttr(
'disabled');
128 langfile.removeAttr(
'disabled');required.removeAttr(
'disabled'); alwayseditable.removeAttr(
'disabled'); list.removeAttr(
'disabled');
131 init_typeoffields(
'<?php echo GETPOST('type', 'alpha
'); ?>');
132 jQuery(
"#type").change(
function() {
133 init_typeoffields($(
this).val());
137 jQuery(
"#computed_value").keyup(
function() {
138 init_typeoffields(jQuery(
'#type').val());
143 <form action=
"<?php echo $_SERVER["PHP_SELF
"]; ?>" method=
"post">
144 <input
type=
"hidden" name=
"token" value=
"<?php echo $_SESSION['newtoken']; ?>">
145 <input type=
"hidden" name=
"action" value=
"add">
149 <table summary=
"listofattributes" class=
"border centpercent">
151 <tr><td
class=
"titlefield fieldrequired"><?php echo $langs->trans(
"LabelOrTranslationKey"); ?></td><td
class=
"valeur"><input type=
"text" name=
"label" size=
"40" value=
"<?php echo GETPOST('label', 'alpha'); ?>"></td></tr>
153 <tr><td
class=
"fieldrequired"><?php echo $langs->trans(
"AttributeCode"); ?></td><td
class=
"valeur"><input type=
"text" name=
"attrname" id=
"attrname" size=
"10" value=
"<?php echo GETPOST('attrname', 'alpha'); ?>"> <span
class=
"opacitymedium">(<?php echo $langs->trans(
"AlphaNumOnlyLowerCharsAndNoSpace"); ?>)</span></td></tr>
155 <tr><td
class=
"fieldrequired"><?php echo $langs->trans(
"Type"); ?></td><td
class=
"valeur">
156 <?php
print $form->selectarray(
'type', $type2label,
GETPOST(
'type',
'alpha'), 0, 0, 0,
'', 0, 0, 0,
'',
'', 1); ?>
159 <tr
class=
"extra_size"><td
class=
"fieldrequired"><?php echo $langs->trans(
"Size"); ?></td><td
class=
"valeur"><input
id=
"size" type=
"text" name=
"size" size=
"5" value=
"<?php echo (GETPOST('size', 'alpha') ?GETPOST('size', 'alpha') : ''); ?>"></td></tr>
160 <!-- Default Value (
for select list / radio/ checkbox) -->
161 <tr
id=
"value_choice">
163 <?php echo $langs->trans(
"Value"); ?>
166 <table
class=
"nobordernopadding">
168 <textarea
name=
"param" id=
"param" cols=
"80" rows=
"<?php echo ROWS_4 ?>"><?php echo
GETPOST(
'param',
'alpha'); ?></textarea>
170 <span
id=
"helpselect" class=
"spanforparamtooltip"><?php
print $form->textwithpicto(
'', $langs->trans(
"ExtrafieldParamHelpselect"), 1, 0,
'', 0, 2,
'helpvalue1')?></span>
171 <span
id=
"helpsellist" class=
"spanforparamtooltip"><?php
print $form->textwithpicto(
'', $langs->trans(
"ExtrafieldParamHelpsellist"), 1, 0,
'', 0, 2,
'helpvalue2')?></span>
172 <span
id=
"helpchkbxlst" class=
"spanforparamtooltip"><?php
print $form->textwithpicto(
'', $langs->trans(
"ExtrafieldParamHelpchkbxlst"), 1, 0,
'', 0, 2,
'helpvalue3')?></span>
173 <span
id=
"helplink" class=
"spanforparamtooltip"><?php
print $form->textwithpicto(
'', $langs->trans(
"ExtrafieldParamHelplink").
'<br><br>'.$langs->trans(
"Examples").
':<br>'.$listofexamplesforlink, 1, 0,
'', 0, 2,
'helpvalue4')?></span>
174 <span
id=
"helppassword" class=
"spanforparamtooltip"><?php
print $form->textwithpicto(
'', $langs->trans(
"ExtrafieldParamHelpPassword"), 1, 0,
'', 0, 2,
'helpvalue5')?></span>
175 <span
id=
"helpseparate" class=
"spanforparamtooltip"><?php
print $form->textwithpicto(
'', $langs->trans(
"ExtrafieldParamHelpSeparator"), 1, 0,
'', 0, 2,
'helpvalue6')?></span>
181 <tr><td
class=
"titlefield"><?php echo $langs->trans(
"Position"); ?></td><td
class=
"valeur"><input type=
"text" name=
"pos" size=
"5" value=
"<?php echo GETPOSTISSET('pos') ? GETPOST('pos', 'int') : 100; ?>"></td></tr>
182 <!-- Language file -->
183 <tr><td
class=
"titlefield"><?php echo $langs->trans(
"LanguageFile"); ?></td><td
class=
"valeur"><input type=
"text" id=
"langfile" name=
"langfile" class=
"minwidth200" value=
"<?php echo dol_escape_htmltag(GETPOST('langfile', 'alpha')); ?>"></td></tr>
184 <!-- Computed Value -->
185 <?php
if (empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) { ?>
186 <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 (GETPOSTISSET('computed_value') ? GETPOST('computed_value', 'none') : ''); ?>"></td></tr>
188 <tr
class=
"extra_computed_value"><td><?php echo $form->textwithpicto($langs->trans(
"ComputedFormula"), $langs->trans(
"ComputedFormulaDesc")).$form->textwithpicto($langs->trans(
"Computedpersistent"), $langs->trans(
"ComputedpersistentDesc"), 1,
'warning'); ?></td><td
class=
"valeur"><input
id=
"computed_value" class=
"quatrevingtpercent" type=
"text" name=
"computed_value" value=
"<?php echo dol_escape_htmltag($computed); ?>"></td></tr>
190 <!-- Default Value (at sql setup level) -->
191 <tr
class=
"extra_default_value"><td><?php echo $langs->trans(
"DefaultValue").
' ('.$langs->trans(
"Database").
')'; ?></td><td
class=
"valeur"><input
id=
"default_value" type=
"text" name=
"default_value" size=
"5" value=
"<?php echo (GETPOST('default_value', 'alpha') ?GETPOST('default_value', 'alpha') : ''); ?>"></td></tr>
193 <tr
class=
"extra_unique"><td><?php echo $langs->trans(
"Unique"); ?></td><td
class=
"valeur"><input
id=
"unique" type=
"checkbox" name=
"unique"<?php echo (
GETPOST(
'unique',
'alpha') ?
' checked' :
''); ?>></td></tr>
195 <tr
class=
"extra_required"><td><?php echo $langs->trans(
"Required"); ?></td><td
class=
"valeur"><input
id=
"required" type=
"checkbox" name=
"required"<?php echo (
GETPOST(
'required',
'alpha') ?
' checked' :
''); ?>></td></tr>
196 <!-- Always editable -->
197 <tr
class=
"extra_alwayseditable"><td><?php echo $langs->trans(
"AlwaysEditable"); ?></td><td
class=
"valeur"><input
id=
"alwayseditable" type=
"checkbox" name=
"alwayseditable"<?php echo ((
GETPOST(
'alwayseditable',
'alpha') || !
GETPOST(
'button',
'alpha')) ?
' checked' :
''); ?>></td></tr>
199 <tr><td
class=
"extra_list"><?php echo $form->textwithpicto($langs->trans(
"Visibility"), $langs->trans(
"VisibleDesc")); ?>
200 </td><td
class=
"valeur"><input
id=
"list" class=
"minwidth100" type=
"text" name=
"list" value=
"<?php echo GETPOST('list', 'int') != '' ? GETPOST('list', 'int') : '1'; ?>"></td></tr>
201 <!-- Visibility
for PDF-->
202 <tr><td
class=
"extra_pdf"><?php echo $form->textwithpicto($langs->trans(
"DisplayOnPdf"), $langs->trans(
"DisplayOnPdfDesc")); ?>
203 </td><td
class=
"valeur"><input
id=
"printable" class=
"minwidth100" type=
"text" name=
"printable" value=
"<?php echo dol_escape_htmltag(GETPOST('printable', 'int')); ?>"></td></tr>
205 <tr
class=
"extra_totalizable"><td><?php echo $langs->trans(
"Totalizable"); ?></td><td
class=
"valeur"><input
id=
"totalizable" type=
"checkbox" name=
"totalizable"<?php echo ((
GETPOST(
'totalizable',
'alpha') ||
GETPOST(
'button',
'alpha')) ?
' checked' :
''); ?>></td></tr>
206 <!-- Help tooltip -->
207 <tr
class=
"help"><td><?php echo $form->textwithpicto($langs->trans(
"HelpOnTooltip"), $langs->trans(
"HelpOnTooltipDesc")); ?></td><td
class=
"valeur"><input
id=
"help" class=
"quatrevingtpercent" type=
"text" name=
"help" value=
"<?php echo dol_escape_htmltag($help); ?>"></td></tr>
208 <?php
if ($conf->multicompany->enabled) { ?>
209 <!-- Multicompany entity -->
210 <tr><td><?php echo $langs->trans(
"AllEntities"); ?></td><td
class=
"valeur"><input
id=
"entitycurrentorall" type=
"checkbox" name=
"entitycurrentorall"<?php echo (
GETPOST(
'entitycurrentorall',
'alpha') ?
'' :
' checked'); ?>></td></tr>
216 <div
class=
"center"><input type=
"submit" name=
"button" class=
"button button-save" value=
"<?php echo $langs->trans("Save
"); ?>">
217 <input type=
"submit" name=
"button" class=
"button button-cancel" value=
"<?php echo $langs->trans("Cancel
"); ?>"></div>
221 <!-- END PHP TEMPLATE admin_extrafields_add.tpl.php -->
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
$conf db name
Only used if Module[ID]Name translation string is not found.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type