* Copyright (C) 2012-2021 Regis Houssin * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * * 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 . */ /* To call this template, you must define * $textobject * $langs * $extrafield * $elementtype */ /** * @var Conf $conf * @var DoliDB $db * @var ExtraFields $extrafields * @var Form $form * @var Translate $langs * * @var string $action * @var string $elementtype * @var string $textobject */ // Protection to avoid direct call of template if (empty($langs) || !is_object($langs)) { print "Error, template page can't be called as URL"; exit(1); } global $action, $form, $langs; $langs->load("modulebuilder"); if ($action == 'delete') { $attributekey = GETPOST('attrname', 'aZ09'); print $form->formconfirm($_SERVER['PHP_SELF']."?attrname=$attributekey", $langs->trans("DeleteExtrafield"), $langs->trans("ConfirmDeleteExtrafield", $attributekey), "confirm_delete", '', 0, 1); } ?> '.$langs->trans("DefineHereComplementaryAttributes", empty($textobject) ? '' : $textobject).'
'."\n"; //if ($action != 'create' && $action != 'edit') { $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('NewAttribute'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', 1); /*} else { $newcardbutton = ''; }*/ print '
'; print '
'; print '
'.$title.'
'; print '
'.$newcardbutton.'
'; print '
'; print '
'; // Load $extrafields->attributes $extrafields->fetch_name_optionals_label($elementtype); print '
'; print ''; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print ''; print ''; //print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; if (isModEnabled('multicompany')) { print ''; } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } print "\n"; if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type'])) { foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value) { /*if (! (int) dol_eval($extrafields->attributes[$elementtype]['enabled'][$key], 1, 1, '1')) { // TODO Uncomment this to exclude extrafields of modules not enabled. Add a link to "Show extrafields disabled" // continue; }*/ // Load language if required if (!empty($extrafields->attributes[$elementtype]['langfile'][$key])) { $langs->load($extrafields->attributes[$elementtype]['langfile'][$key]); } print ''; // Actions if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''."\n"; } // Position print "\n"; // Label and label translated print '\n"; // We don't translate here, we want admin to know what is the key not translated value // Label translated //print '\n"; // Key print '\n"; // Type $typetoshow = $type2label[$extrafields->attributes[$elementtype]['type'][$key]]; print '\n"; // Size print '\n"; // Computed field print '\n"; // Is unique ? print '\n"; // Is mandatory ? print '\n"; // Can always be editable ? print '\n"; // Visible print '\n"; // Print on PDF print '\n"; // Summable print '\n"; // CSS print '\n"; // CSS view print '\n"; // CSS list print '\n"; // Multicompany if (isModEnabled('multicompany')) { print ''; } // Actions if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''."\n"; } print ""; } } else { $colspan = 17; if (isModEnabled('multicompany')) { $colspan++; } print ''; print ''; print ''; } print "
 '.$langs->trans("Position"); print ''; print img_picto('A-Z', '1downarrow.png'); print ''; print ''.$langs->trans("LabelOrTranslationKey").''.$langs->trans("TranslationString").''.$langs->trans("AttributeCode").''.$langs->trans("Type").''.$langs->trans("Size").''.$langs->trans("ComputedFormula").''.$langs->trans("Unique").''.$langs->trans("Mandatory").''.$form->textwithpicto($langs->trans("AlwaysEditable"), $langs->trans("EditableWhenDraftOnly")).''.$form->textwithpicto($langs->trans("Visibility"), $langs->trans("VisibleDesc").'

'.$langs->trans("ItCanBeAnExpression")).'
'.$form->textwithpicto($langs->trans("DisplayOnPdf"), $langs->trans("DisplayOnPdfDesc")).''.$form->textwithpicto($langs->trans("Totalizable"), $langs->trans("TotalizableDesc")).''.$form->textwithpicto($langs->trans("CssOnEdit"), $langs->trans("HelpCssOnEditDesc")).''.$form->textwithpicto($langs->trans("CssOnView"), $langs->trans("HelpCssOnViewDesc")).''.$form->textwithpicto($langs->trans("CssOnList"), $langs->trans("HelpCssOnListDesc")).''.$langs->trans("Entity").' 
'; print ''.img_edit().''; print '  '.img_delete().''; if ($extrafields->attributes[$elementtype]['type'][$key] == 'password' && !empty($extrafields->attributes[$elementtype]['param'][$key]['options']) && array_key_exists('dolcrypt', $extrafields->attributes[$elementtype]['param'][$key]['options'])) { print '  '.img_picto('', 'refresh').''; } print '".dol_escape_htmltag((string) $extrafields->attributes[$elementtype]['pos'][$key])."'; print dol_escape_htmltag($extrafields->attributes[$elementtype]['label'][$key]); if ($langs->transnoentitiesnoconv($extrafields->attributes[$elementtype]['label'][$key]) != $extrafields->attributes[$elementtype]['label'][$key]) { print '
'; print $langs->transnoentitiesnoconv($extrafields->attributes[$elementtype]['label'][$key]); } print ''; print "
'.dol_escape_htmltag($langs->transnoentitiesnoconv($extrafields->attributes[$elementtype]['label'][$key]))."'.dol_escape_htmltag($key)."'; print getPictoForType($extrafields->attributes[$elementtype]['type'][$key]); print dol_escape_htmltag($typetoshow); print "'.dol_escape_htmltag($extrafields->attributes[$elementtype]['size'][$key])."'.dol_escape_htmltag($extrafields->attributes[$elementtype]['computed'][$key])."'.yn($extrafields->attributes[$elementtype]['unique'][$key])."'.yn($extrafields->attributes[$elementtype]['required'][$key])."'.yn($extrafields->attributes[$elementtype]['alwayseditable'][$key])."'.dol_escape_htmltag($extrafields->attributes[$elementtype]['list'][$key])."'.dol_escape_htmltag((string) $extrafields->attributes[$elementtype]['printable'][$key])."'.yn($extrafields->attributes[$elementtype]['totalizable'][$key])."'.dol_escape_htmltag($extrafields->attributes[$elementtype]['css'][$key])."'.dol_escape_htmltag($extrafields->attributes[$elementtype]['cssview'][$key])."'.dol_escape_htmltag($extrafields->attributes[$elementtype]['csslist'][$key])."'; if (empty($extrafields->attributes[$elementtype]['entityid'][$key])) { print $langs->trans("All"); } else { global $multicompanylabel_cache; if (!is_array($multicompanylabel_cache)) { $multicompanylabel_cache = array(); } if (empty($multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]])) { global $mc; if (is_object($mc) && method_exists($mc, 'getInfo')) { $mc->getInfo($extrafields->attributes[$elementtype]['entityid'][$key]); $multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]] = $mc->label ? $mc->label : $extrafields->attributes[$elementtype]['entityid'][$key]; } } print $multicompanylabel_cache[$extrafields->attributes[$elementtype]['entityid'][$key]]; } print ''; print ''.img_edit().''; print '  '.img_delete().''; if ($extrafields->attributes[$elementtype]['type'][$key] == 'password' && !empty($extrafields->attributes[$elementtype]['param'][$key]['options']) && array_key_exists('dolcrypt', $extrafields->attributes[$elementtype]['param'][$key]['options'])) { print '  '.img_picto('', 'refresh').''; } print '
'; print $langs->trans("None"); print '
"; print '
'; ?>