39 print
"Error, template page can't be called as URL";
43if (!is_object($form)) {
44 $form =
new Form($db);
49<!-- BEGIN PHP TEMPLATE extrafields_view.tpl.php -->
51if (!isset($parameters) || !is_array($parameters)) {
52 $parameters = array();
55 $parameters[
'colspan'] =
' colspan="'.$cols.
'"';
58 $parameters[
'cols'] = $cols;
61 $parameters[
'socid'] =
$object->fk_soc;
63$reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
64print $hookmanager->resPrint;
71if (empty($reshook) && !empty(
$object->table_element) && isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label'])) {
72 $lastseparatorkeyfound =
'';
73 $extrafields_collapse_num =
'';
74 $extrafields_collapse_num_old =
'';
78 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $tmpkeyextra => $tmplabelextra) {
84 if ($enabled && isset($extrafields->attributes[
$object->table_element][
'enabled'][$tmpkeyextra])) {
85 $enabled = (int)
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'enabled'][$tmpkeyextra], 1, 1,
'2');
87 if ($enabled && isset($extrafields->attributes[
$object->table_element][
'list'][$tmpkeyextra])) {
88 $enabled = (int)
dol_eval($extrafields->attributes[
$object->table_element][
'list'][$tmpkeyextra], 1, 1,
'2');
92 if ($perms && isset($extrafields->attributes[
$object->table_element][
'perms'][$tmpkeyextra])) {
93 $perms = (int)
dol_eval($extrafields->attributes[
$object->table_element][
'perms'][$tmpkeyextra], 1, 1,
'2');
97 if (empty($enabled)) {
100 if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5 && abs($enabled) != 4) {
108 if (!empty($extrafields->attributes[
$object->table_element][
'langfile'][$tmpkeyextra])) {
109 $langs->load($extrafields->attributes[
$object->table_element][
'langfile'][$tmpkeyextra]);
111 if ($action ==
'edit_extras') {
112 $value = (GETPOSTISSET(
"options_".$tmpkeyextra) ?
GETPOST(
"options_".$tmpkeyextra) : (isset(
$object->array_options[
"options_".$tmpkeyextra]) ?
$object->array_options[
"options_".$tmpkeyextra] :
''));
114 $value = (isset(
$object->array_options[
"options_".$tmpkeyextra]) ?
$object->array_options[
"options_".$tmpkeyextra] :
'');
119 if ($extrafields->attributes[
$object->table_element][
'type'][$tmpkeyextra] ==
'separate') {
120 $extrafields_collapse_num = $tmpkeyextra;
122 print $extrafields->showSeparator($tmpkeyextra,
$object);
124 $lastseparatorkeyfound = $tmpkeyextra;
126 $collapse_group = $extrafields_collapse_num.(!empty(
$object->id) ?
'_'.$object->id :
'');
128 print
'<tr class="trextrafields_collapse'.$collapse_group;
132 if ($extrafields_collapse_num && $i == count($extrafields->attributes[
$object->table_element][
'label'])) {
133 print
' trextrafields_collapse_last';
136 if (isset($extrafields->expand_display) && empty($extrafields->expand_display[$collapse_group])) {
137 print
' style="display: none;"';
140 $extrafields_collapse_num_old = $extrafields_collapse_num;
142 print
'<table class="nobordernopadding centpercent">';
146 if ((!empty($action) && ($action ==
'create' || $action ==
'edit')) && !empty($extrafields->attributes[
$object->table_element][
'required'][$tmpkeyextra])) {
147 print
' fieldrequired';
150 if (!empty($extrafields->attributes[
$object->table_element][
'help'][$tmpkeyextra])) {
152 $tmptooltip = explode(
':', $extrafields->attributes[
$object->table_element][
'help'][$tmpkeyextra]);
153 print $form->textwithpicto($langs->trans($tmplabelextra), $langs->trans($tmptooltip[0]), 1,
'help',
'', 0, 3, (empty($tmptooltip[1]) ?
'' :
'extra_'.$tmpkeyextra.
'_'.$tmptooltip[1]));
155 print $langs->trans($tmplabelextra);
162 $keyforperm =
$object->element;
164 if (
$object->element ==
'fichinter') {
165 $keyforperm =
'ficheinter';
167 if (
$object->element ==
'product') {
168 $keyforperm =
'produit';
170 if (
$object->element ==
'project') {
171 $keyforperm =
'projet';
173 if (isset($user->rights->$keyforperm)) {
174 $permok = $user->hasRight($keyforperm,
'creer') || $user->hasRight($keyforperm,
'create') || $user->hasRight($keyforperm,
'write');
176 if (
$object->element ==
'order_supplier') {
178 $permok = $user->hasRight(
'fournisseur',
'commande',
'creer');
180 $permok = $user->hasRight(
'supplier_order',
'creer');
183 if (
$object->element ==
'invoice_supplier') {
185 $permok = $user->hasRight(
'fournisseur',
'facture',
'creer');
187 $permok = $user->hasRight(
'supplier_invoice',
'creer');
190 if (
$object->element ==
'shipping') {
191 $permok = $user->hasRight(
'expedition',
'creer');
193 if (
$object->element ==
'delivery') {
194 $permok = $user->hasRight(
'expedition',
'delivery',
'creer');
196 if (
$object->element ==
'productlot') {
197 $permok = $user->hasRight(
'stock',
'creer');
199 if (
$object->element ==
'facturerec') {
200 $permok = $user->hasRight(
'facture',
'creer');
202 if (
$object->element ==
'mo') {
203 $permok = $user->hasRight(
'mrp',
'write');
205 if (
$object->element ==
'contact') {
206 $permok = $user->hasRight(
'societe',
'contact',
'creer');
208 if (
$object->element ==
'salary') {
209 $permok = $user->hasRight(
'salaries',
'read');
211 if (
$object->element ==
'member') {
212 $permok = $user->hasRight(
'adherent',
'creer');
216 if (($isdraft || !empty($extrafields->attributes[
$object->table_element][
'alwayseditable'][$tmpkeyextra]))
217 && $permok && $enabled != 5 && ($action !=
'edit_extras' ||
GETPOST(
'attribute') != $tmpkeyextra)
218 && empty($extrafields->attributes[
$object->table_element][
'computed'][$tmpkeyextra])) {
219 $fieldid = empty($forcefieldid) ?
'id' : $forcefieldid;
220 $valueid = empty($forceobjectid) ?
$object->id : $forceobjectid;
221 if (
$object->table_element ==
'societe') {
225 print
'<td class="right"><a class="reposition editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?'.$fieldid.
'='.$valueid.
'&action=edit_extras&token='.
newToken().
'&attribute='.$tmpkeyextra.
'&ignorecollapsesetup=1">'.
img_edit().
'</a></td>';
227 print
'</tr></table>';
230 $cssview = !empty($extrafields->attributes[
$object->table_element][
'cssview'][$tmpkeyextra]) ? ($extrafields->attributes[
$object->table_element][
'cssview'][$tmpkeyextra] .
' ') :
'';
233 print
'<td id="' . $html_id .
'" class="valuefield ' . $cssview .
$object->element .
'_extras_' . $tmpkeyextra .
' wordbreakimp"' . (!empty($cols) ?
' colspan="' . $cols .
'"' :
'') .
'>';
236 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$tmpkeyextra], array(
'date'))) {
237 $datenotinstring = empty(
$object->array_options[
'options_'.$tmpkeyextra]) ?
'' :
$object->array_options[
'options_'.$tmpkeyextra];
239 if (!empty(
$object->array_options[
'options_'.$tmpkeyextra]) && !is_numeric(
$object->array_options[
'options_'.$tmpkeyextra])) {
240 $datenotinstring = $db->jdate($datenotinstring);
243 $value = GETPOSTISSET(
"options_".$tmpkeyextra) ?
dol_mktime(12, 0, 0,
GETPOSTINT(
"options_".$tmpkeyextra.
"month"),
GETPOSTINT(
"options_".$tmpkeyextra.
"day"),
GETPOSTINT(
"options_".$tmpkeyextra.
"year")) : $datenotinstring;
245 if (in_array($extrafields->attributes[
$object->table_element][
'type'][$tmpkeyextra], array(
'datetime'))) {
246 $datenotinstring = empty(
$object->array_options[
'options_'.$tmpkeyextra]) ?
'' :
$object->array_options[
'options_'.$tmpkeyextra];
248 if (!empty(
$object->array_options[
'options_'.$tmpkeyextra]) && !is_numeric(
$object->array_options[
'options_'.$tmpkeyextra])) {
249 $datenotinstring = $db->jdate($datenotinstring);
252 $value = GETPOSTISSET(
"options_".$tmpkeyextra) ?
dol_mktime(
GETPOSTINT(
"options_".$tmpkeyextra.
"hour"),
GETPOSTINT(
"options_".$tmpkeyextra.
"min"),
GETPOSTINT(
"options_".$tmpkeyextra.
"sec"),
GETPOSTINT(
"options_".$tmpkeyextra.
"month"),
GETPOSTINT(
"options_".$tmpkeyextra.
"day"),
GETPOSTINT(
"options_".$tmpkeyextra.
"year"),
'tzuserrel') : $datenotinstring;
256 if ($action ==
'edit_extras' && $permok &&
GETPOST(
'attribute',
'restricthtml') == $tmpkeyextra) {
259 if (
$object->table_element ==
'societe') {
262 print
'<form enctype="multipart/form-data" action="'.$_SERVER[
"PHP_SELF"] .
'?' . $fieldid .
'=' .
$object->id .
'" method="post" name="formextra">';
263 print
'<input type="hidden" name="action" value="update_extras">';
264 print
'<input type="hidden" name="attribute" value="'.$tmpkeyextra.
'">';
265 print
'<input type="hidden" name="token" value="'.newToken().
'">';
266 print
'<input type="hidden" name="'.$fieldid.
'" value="'.
$object->id.
'">';
267 print $extrafields->showInputField($tmpkeyextra, $value,
'',
'',
'', 0,
$object,
$object->table_element);
269 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Modify')).
'">';
276 print $extrafields->showOutputField($tmpkeyextra, $value,
'',
$object->table_element,
null,
$object);
286 if (!empty(
$conf->use_javascript_ajax)) {
290 jQuery(document).ready(function() {
291 function showOptions(child_list, parent_list)
293 var val = $("select[name="+parent_list+"]").val();
294 var parentVal = parent_list + ":" + val;
296 $("select[name=\""+child_list+"\"] option[parent]").hide();
297 $("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show();
299 $("select[name=\""+child_list+"\"] option").show();
302 function setListDependencies() {
303 jQuery("select option[parent]").parent().each(function() {
304 var child_list = $(this).attr("name");
305 var parent = $(this).find("option[parent]:first").attr("parent");
306 var infos = parent.split(":");
307 var parent_list = infos[0];
308 showOptions(child_list, parent_list);
310 /* Activate the handler to call showOptions on each future change */
311 $("select[name=\""+parent_list+"\"]").change(function() {
312 showOptions(child_list, parent_list);
316 setListDependencies();
322<!-- END PHP TEMPLATE extrafields_view.tpl.php -->
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...