diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index a5ccb33f084..040ae1ba96e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -314,7 +314,7 @@ class FormFile if (preg_match('/massfilesarea_/', $modulepart)) { - $out.='
| '; -//if (! empty($arrayfields['t.field2']['checked'])) print ' | '; +foreach($object->fields as $key => $val) +{ + if (in_array($key, array('datec','tms','status'))) continue; + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; + if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; + if (! empty($arrayfields['t.'.$key]['checked'])) print ' | '; +} // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -376,25 +389,15 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $parameters=array('arrayfields'=>$arrayfields); $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -if (! empty($arrayfields['t.datec']['checked'])) +// Rest of fields search +foreach($object->fields as $key => $val) { - // Date creation - print ' | '; - print ' | '; + if (! in_array($key, array('datec','tms','status'))) continue; + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; + if (in_array($val['type'], array('timestamp'))) $align.=' nowrap'; + if (! empty($arrayfields['t.'.$key]['checked'])) print ''; } -if (! empty($arrayfields['t.tms']['checked'])) -{ - // Date modification - print ' | '; - print ' | '; -} -/*if (! empty($arrayfields['t.statut']['checked'])) - { - // Status - print ''; - print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); - print ' | '; - }*/ // Action column print ''; $searchpicto=$form->showFilterButtons(); @@ -402,11 +405,18 @@ print $searchpicto; print ' | '; print ''."\n"; -// Fields title + +// Fields title label +// -------------------------------------------------------------------- print '|||||||||
| '.$obj->field1.' | '; - if (! $i) $totalarray['nbfield']++; + if (in_array($key, array('datec','tms','status'))) continue; + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; + if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour'); + elseif ($key == 'status') print ' | '.$object->getLibStatut(3).' | '; + else print $obj->$key; + print ''; + if (! $i) $totalarray['nbfield']++; + } } - if (! empty($arrayfields['t.field2']['checked'])) - { - print ''.$obj->field2.' | '; - if (! $i) $totalarray['nbfield']++; - }*/ // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -483,30 +505,23 @@ while ($i < min($num, $limit)) $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - // Date creation - if (! empty($arrayfields['t.datec']['checked'])) + // Rest of fields + foreach($object->fields as $key => $val) { - print ''; - print dol_print_date($db->jdate($obj->date_creation), 'dayhour'); - print ' | '; - if (! $i) $totalarray['nbfield']++; + if (! in_array($key, array('datec','tms','status'))) continue; + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align='center'; + if (in_array($val['type'], array('timestamp'))) $align.='nowrap'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + if (in_array($val['type'], array('date','datetime','timestamp'))) print dol_print_date($db->jdate($obj->$key), 'dayhour'); + elseif ($key == 'status') print ' | '.$object->getLibStatut(3).' | '; + else print $obj->$key; + print ''; + if (! $i) $totalarray['nbfield']++; + } } - // Date modification - if (! empty($arrayfields['t.tms']['checked'])) - { - print ''; - print dol_print_date($db->jdate($obj->date_update), 'dayhour'); - print ' | '; - if (! $i) $totalarray['nbfield']++; - } - // Status - /* - if (! empty($arrayfields['t.statut']['checked'])) - { - $userstatic->statut=$obj->statut; - print ''.$userstatic->getLibStatut(3).' | '; - }*/ - // Action column print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined @@ -536,7 +551,7 @@ if (isset($totalarray['totalhtfield'])) if ($num < $limit) print ' | '.$langs->trans("Total").' | '; else print ''.$langs->trans("Totalforthispage").' | '; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).' | '; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).' | '; elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).' | '; elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).' | '; else print ''; @@ -567,13 +582,16 @@ print ''."\n"; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'); + $formfile = new FormFile($db); + // Show list of available documents $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; $urlsource.=str_replace('&','&',$param); $filedir=$diroutputmassaction; - $genallowed=$user->rights->facture->lire; - $delallowed=$user->rights->facture->lire; + $genallowed=$user->rights->mymodule->read; + $delallowed=$user->rights->mymodule->read; print $formfile->showdocuments('massfilesarea_mymodule','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); } |