Esempio n. 1
0
print '</div></div></div>';
print '<div class="fichecenter"><br>';
// Charge tableau des categories
$cate_arbo = $categstatic->get_full_arbo($type);
// Define fulltree array
$fulltree = $cate_arbo;
// Define data (format for treeview)
$data = array();
$data[] = array('rowid' => 0, 'fk_menu' => -1, 'title' => "racine", 'mainmenu' => '', 'leftmenu' => '', 'fk_mainmenu' => '', 'fk_leftmenu' => '');
foreach ($fulltree as $key => $val) {
    $categstatic->id = $val['id'];
    $categstatic->ref = $val['label'];
    $categstatic->type = $type;
    $li = $categstatic->getNomUrl(1, '', 60);
    $desc = dol_htmlcleanlastbr($val['description']);
    $data[] = array('rowid' => $val['rowid'], 'fk_menu' => $val['fk_parent'], 'entry' => '<table class="nobordernopadding centpercent"><tr><td>' . $li . '</td><td width="50%">' . dolGetFirstLineOfText($desc) . '</td>' . '<td align="right" width="20px;"><a href="' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $val['id'] . '&type=' . $type . '">' . img_view() . '</a></td>' . '</tr></table>');
}
print '<table class="liste nohover" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Categories") . '</td><td></td><td align="right">';
if (!empty($conf->use_javascript_ajax)) {
    print '<div id="iddivjstreecontrol"><a href="#">' . img_picto('', 'object_category') . ' ' . $langs->trans("UndoExpandAll") . '</a> | <a href="#">' . img_picto('', 'object_category-expanded') . ' ' . $langs->trans("ExpandAll") . '</a></div>';
}
print '</td></tr>';
$nbofentries = count($data) - 1;
if ($nbofentries > 0) {
    print '<tr ' . $bc[0] . '><td colspan="3">';
    tree_recur($data, $data[0], 0);
    print '</td></tr>';
} else {
    print '<tr ' . $bc[0] . '>';
    print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>' . img_picto_common('', 'treemenu/branchbottom.gif') . '</td>';
Esempio n. 2
0
 /**
  *	Show list of documents in a directory
  *
  *  @param	string	$upload_dir         Directory that was scanned
  *  @param  array	$filearray          Array of files loaded by dol_dir_list function before calling this function
  *  @param  string	$modulepart         Value for modulepart used by download wrapper
  *  @param  string	$param              Parameters on sort links
  *  @param  int		$forcedownload      Force to open dialog box "Save As" when clicking on file
  *  @param  string	$relativepath       Relative path of docs (autodefined if not provided)
  *  @param  int		$permtodelete       Permission to delete
  *  @param  int		$useinecm           Change output for use in ecm module
  *  @param  int		$textifempty        Text to show if filearray is empty
  *  @param  int		$maxlength          Maximum length of file name shown
  *  @param	string $url				Full url to use for click links ('' = autodetect)
  *  @return int                 		<0 if KO, nb of files shown if OK
  */
 function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '')
 {
     global $user, $conf, $langs;
     global $bc;
     global $sortfield, $sortorder;
     dol_syslog(get_class($this) . '::list_of_autoecmfiles upload_dir=' . $upload_dir . ' modulepart=' . $modulepart);
     // Show list of documents
     if (empty($useinecm)) {
         print load_fiche_titre($langs->trans("AttachedFiles"));
     }
     if (empty($url)) {
         $url = $_SERVER["PHP_SELF"];
     }
     print '<table width="100%" class="nobordernopadding">';
     print '<tr class="liste_titre">';
     $sortref = "fullname";
     if ($modulepart == 'invoice_supplier') {
         $sortref = 'level1name';
     }
     print_liste_field_titre($langs->trans("Ref"), $url, $sortref, "", $param, 'align="left"', $sortfield, $sortorder);
     print_liste_field_titre($langs->trans("Documents2"), $url, "name", "", $param, 'align="left"', $sortfield, $sortorder);
     print_liste_field_titre($langs->trans("Size"), $url, "size", "", $param, 'align="right"', $sortfield, $sortorder);
     print_liste_field_titre($langs->trans("Date"), $url, "date", "", $param, 'align="center"', $sortfield, $sortorder);
     print_liste_field_titre('', '', '');
     print '</tr>';
     // To show ref or specific information according to view to show (defined by $module)
     if ($modulepart == 'company') {
         include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
         $object_instance = new Societe($this->db);
     } else {
         if ($modulepart == 'invoice') {
             include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
             $object_instance = new Facture($this->db);
         } else {
             if ($modulepart == 'invoice_supplier') {
                 include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
                 $object_instance = new FactureFournisseur($this->db);
             } else {
                 if ($modulepart == 'propal') {
                     include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
                     $object_instance = new Propal($this->db);
                 } else {
                     if ($modulepart == 'supplier_proposal') {
                         include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
                         $object_instance = new SupplierProposal($this->db);
                     } else {
                         if ($modulepart == 'order') {
                             include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
                             $object_instance = new Commande($this->db);
                         } else {
                             if ($modulepart == 'order_supplier') {
                                 include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
                                 $object_instance = new CommandeFournisseur($this->db);
                             } else {
                                 if ($modulepart == 'contract') {
                                     include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
                                     $object_instance = new Contrat($this->db);
                                 } else {
                                     if ($modulepart == 'product') {
                                         include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
                                         $object_instance = new Product($this->db);
                                     } else {
                                         if ($modulepart == 'tax') {
                                             include_once DOL_DOCUMENT_ROOT . '/compta/sociales/class/chargesociales.class.php';
                                             $object_instance = new ChargeSociales($this->db);
                                         } else {
                                             if ($modulepart == 'project') {
                                                 include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
                                                 $object_instance = new Project($this->db);
                                             } else {
                                                 if ($modulepart == 'fichinter') {
                                                     include_once DOL_DOCUMENT_ROOT . '/fichinter/class/fichinter.class.php';
                                                     $object_instance = new Fichinter($this->db);
                                                 } else {
                                                     if ($modulepart == 'user') {
                                                         include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
                                                         $object_instance = new User($this->db);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $var = true;
     foreach ($filearray as $key => $file) {
         if (!is_dir($file['name']) && $file['name'] != '.' && $file['name'] != '..' && $file['name'] != 'CVS' && !preg_match('/\\.meta$/i', $file['name'])) {
             // Define relative path used to store the file
             $relativefile = preg_replace('/' . preg_quote($upload_dir . '/', '/') . '/', '', $file['fullname']);
             //var_dump($file);
             $id = 0;
             $ref = '';
             $label = '';
             // To show ref or specific information according to view to show (defined by $module)
             if ($modulepart == 'company') {
                 preg_match('/(\\d+)\\/[^\\/]+$/', $relativefile, $reg);
                 $id = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'invoice') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'invoice_supplier') {
                 preg_match('/([^\\/]+)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
                 if (is_numeric($ref)) {
                     $id = $ref;
                     $ref = '';
                 }
             }
             // $ref may be also id with old supplier invoices
             if ($modulepart == 'propal') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'supplier_proposal') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'order') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'order_supplier') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'contract') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'product') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'tax') {
                 preg_match('/(\\d+)\\/[^\\/]+$/', $relativefile, $reg);
                 $id = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'project') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'fichinter') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $ref = isset($reg[1]) ? $reg[1] : '';
             }
             if ($modulepart == 'user') {
                 preg_match('/(.*)\\/[^\\/]+$/', $relativefile, $reg);
                 $id = isset($reg[1]) ? $reg[1] : '';
             }
             if (!$id && !$ref) {
                 continue;
             }
             $found = 0;
             if (!empty($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
                 $found = 1;
             } else {
                 //print 'Fetch '.$id." - ".$ref.'<br>';
                 if ($id) {
                     $result = $object_instance->fetch($id);
                 } else {
                     //fetchOneLike looks for objects with wildcards in its reference.
                     //It is useful for those masks who get underscores instead of their actual symbols
                     //fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
                     //that's why we look only look fetchOneLike when fetch returns 0
                     if (!($result = $object_instance->fetch('', $ref))) {
                         $result = $object_instance->fetchOneLike($ref);
                     }
                 }
                 if ($result > 0) {
                     // Save object into a cache
                     $found = 1;
                     $this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = clone $object_instance;
                 }
                 if ($result == 0) {
                     $found = 1;
                     $this->cache_objects[$modulepart . '_' . $id . '_' . $ref] = 'notfound';
                     unset($filearray[$key]);
                 }
             }
             if (!$found > 0 || !is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
                 continue;
             }
             // We do not show orphelins files
             $var = !$var;
             print '<tr ' . $bc[$var] . '>';
             print '<td>';
             if ($found > 0 && is_object($this->cache_objects[$modulepart . '_' . $id . '_' . $ref])) {
                 print $this->cache_objects[$modulepart . '_' . $id . '_' . $ref]->getNomUrl(1, 'document');
             } else {
                 print $langs->trans("ObjectDeleted", $id ? $id : $ref);
             }
             print '</td>';
             print '<td>';
             //print "XX".$file['name']; //$file['name'] must be utf8
             print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
             if ($forcedownload) {
                 print '&attachment=1';
             }
             print '&file=' . urlencode($relativefile) . '">';
             print img_mime($file['name'], $file['name'] . ' (' . dol_print_size($file['size'], 0, 0) . ')') . ' ';
             print dol_trunc($file['name'], $maxlength, 'middle');
             print '</a>';
             print "</td>\n";
             print '<td align="right">' . dol_print_size($file['size'], 1, 1) . '</td>';
             print '<td align="center">' . dol_print_date($file['date'], "dayhour") . '</td>';
             print '<td align="right">';
             if (!empty($useinecm)) {
                 print '<a data-ajax="false" href="' . DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart;
             }
             if ($forcedownload) {
                 print '&attachment=1';
             }
             print '&file=' . urlencode($relativefile) . '">';
             print img_view() . '</a> &nbsp; ';
             //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'&section='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
             //else print '&nbsp;';
             print "</td></tr>\n";
         }
     }
     if (count($filearray) == 0) {
         print '<tr ' . $bc[false] . '><td colspan="4">';
         if (empty($textifempty)) {
             print $langs->trans("NoFileFound");
         } else {
             print $textifempty;
         }
         print '</td></tr>';
     }
     print "</table>";
     // Fin de zone
 }
Esempio n. 3
0
     print '<td align="center" class="nowrap">';
     print '<a href="' . DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=' . $objp->rowid . '&amp;account=' . $object->id . '&amp;page=' . $page . '">';
     print img_edit();
     print '</a>';
     print "&nbsp; ";
     print '<a href="releve.php?num=' . $objp->num_releve . '&amp;account=' . $object->id . '">' . $objp->num_releve . '</a>';
     print "</td>";
 } else {
     print '<td align="center">';
     if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
         print '<a href="' . DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=' . $objp->rowid . '&amp;account=' . $object->id . '&amp;page=' . $page . '">';
         print img_edit();
         print '</a>';
     } else {
         print '<a href="' . DOL_URL_ROOT . '/compta/bank/ligne.php?rowid=' . $objp->rowid . '&amp;account=' . $object->id . '&amp;page=' . $page . '">';
         print img_view();
         print '</a>';
     }
     if ($object->canBeConciliated() > 0 && empty($objp->rappro)) {
         if ($db->jdate($objp->dv) < $now - $conf->bank->rappro->warning_delay) {
             print ' ' . img_warning($langs->trans("Late"));
         }
     }
     print '&nbsp;';
     if ($user->rights->banque->modifier) {
         print '<a href="' . $_SERVER["PHP_SELF"] . '?action=delete&amp;rowid=' . $objp->rowid . '&amp;id=' . $object->id . '&amp;page=' . $page . '">';
         print img_delete();
         print '</a>';
     }
     print '</td>';
 }
 print '<div class="ecmjqft">';
 print '<table class="nobordernopadding"><tr>';
 /*print '<td align="left">';
 		print dol_escape_htmltag($file);
 		print '</td>';*/
 // Nb of docs
 print '<td align="right">';
 print isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0 ? $val['cachenbofdoc'] : '&nbsp;';
 print '</td>';
 print '<td align="left">';
 if ($nbofsubdir > 0 && $nboffilesinsubdir > 0) {
     print '<font color="#AAAAAA">+' . $nboffilesinsubdir . '</font> ';
 }
 print '</td>';
 // Edit link
 print '<td align="right" width="18"><a href="' . DOL_URL_ROOT . '/ecm/docmine.php?section=' . $val['id'] . '&relativedir=' . urlencode($val['fullrelativename']) . '">' . img_view($langs->trans("Edit") . ' - ' . $langs->trans("View")) . '</a></td>';
 // Add link
 //print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
 //print '<td align="right" width="14">&nbsp;</td>';
 // Info
 print '<td align="right" width="18">';
 $userstatic->id = isset($val['fk_user_c']) ? $val['fk_user_c'] : 0;
 $userstatic->lastname = isset($val['login_c']) ? $val['login_c'] : 0;
 $htmltooltip = '<b>' . $langs->trans("ECMSection") . '</b>: ' . $val['label'] . '<br>';
 $htmltooltip = '<b>' . $langs->trans("Type") . '</b>: ' . $langs->trans("ECMSectionManual") . '<br>';
 $htmltooltip .= '<b>' . $langs->trans("ECMCreationUser") . '</b>: ' . $userstatic->getNomUrl(1) . '<br>';
 $htmltooltip .= '<b>' . $langs->trans("ECMCreationDate") . '</b>: ' . (isset($val['date_c']) ? dol_print_date($val['date_c'], "dayhour") : $langs->trans("NeedRefresh")) . '<br>';
 $htmltooltip .= '<b>' . $langs->trans("Description") . '</b>: ' . $val['description'] . '<br>';
 $htmltooltip .= '<b>' . $langs->trans("ECMNbOfFilesInDir") . '</b>: ' . (isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0 ? $val['cachenbofdoc'] : $langs->trans("NeedRefresh")) . '<br>';
 if ($nboffilesinsubdir > 0) {
     $htmltooltip .= '<b>' . $langs->trans("ECMNbOfFilesInSubDir") . '</b>: ' . $nboffilesinsubdir;
Esempio n. 5
0
print '<div class="fichecenter"><br>';
// Charge tableau des categories
$cate_arbo = $categstatic->get_full_arbo($type);
// Define fulltree array
$fulltree = $cate_arbo;
// Define data (format for treeview)
$data = array();
$data[] = array('rowid' => 0, 'fk_menu' => -1, 'title' => "racine", 'mainmenu' => '', 'leftmenu' => '', 'fk_mainmenu' => '', 'fk_leftmenu' => '');
foreach ($fulltree as $key => $val) {
    $categstatic->id = $val['id'];
    $categstatic->ref = $val['label'];
    $categstatic->color = $val['color'];
    $categstatic->type = $type;
    $li = $categstatic->getNomUrl(1, '', 60);
    $desc = dol_htmlcleanlastbr($val['description']);
    $data[] = array('rowid' => $val['rowid'], 'fk_menu' => $val['fk_parent'], 'entry' => '<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" ' . ($categstatic->color ? ' style="background: #' . $categstatic->color . ';"' : ' style="background: #aaa"') . '>' . $li . '</span></td>' . '<td width="50%">' . dolGetFirstLineOfText($desc) . '</td>' . '<td align="right" width="20px;"><a href="' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $val['id'] . '&type=' . $type . '">' . img_view() . '</a></td>' . '</tr></table>');
}
print '<table class="liste nohover" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Categories") . '</td><td></td><td align="right">';
if (!empty($conf->use_javascript_ajax)) {
    print '<div id="iddivjstreecontrol"><a href="#">' . img_picto('', 'object_category') . ' ' . $langs->trans("UndoExpandAll") . '</a> | <a href="#">' . img_picto('', 'object_category-expanded') . ' ' . $langs->trans("ExpandAll") . '</a></div>';
}
print '</td></tr>';
$nbofentries = count($data) - 1;
if ($nbofentries > 0) {
    print '<tr ' . $bc[0] . '><td colspan="3">';
    tree_recur($data, $data[0], 0);
    print '</td></tr>';
} else {
    print '<tr ' . $bc[0] . '>';
    print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>' . img_picto_common('', 'treemenu/branchbottom.gif') . '</td>';
Esempio n. 6
0
			if ($section == $val['id']) print '</u>';
			print '</td>';
			print '<td>&nbsp;</td>';
			print '</tr></table>';
			print "</td>\n";

			// Nb of docs
			print '<td align="right">';
			print $val['cachenbofdoc'];
			print '</td>';
			print '<td align="left">';
			if ($nbofsubdir && $nboffilesinsubdir) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
			print '</td>';

			// Edit link
			print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$val['id'].'">'.img_view().'</a></td>';

			// Add link
			//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
			print '<td align="right">&nbsp;</td>';

			// Info
			print '<td align="center">';
			$userstatic->id=$val['fk_user_c'];
			$userstatic->nom=$val['login_c'];
			$htmltooltip='<b>'.$langs->trans("ECMSection").'</b>: '.$val['label'].'<br>';
			$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionManual").'<br>';
			$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$userstatic->getNomUrl(1).'<br>';
			$htmltooltip.='<b>'.$langs->trans("ECMCreationDate").'</b>: '.dol_print_date($val['date_c'],"dayhour").'<br>';
			$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['description'].'<br>';
			$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>';
Esempio n. 7
0
		$categstatic->type=$type;
		print ' &nbsp;'.$categstatic->getNomUrl(0,'',28);

		//print ' &nbsp;'.dol_trunc($val['label'],28);
		//if ($section == $val['id']) print '</u>';
		print '</td>';
		print '</tr></table>';
		print "</td>\n";

		// Description
		print '<td>';
		print dol_trunc($categstatic->get_desc($val['id']),48);
		print '</td>';

		// Link to category card
		print '<td align="right"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>';

		// Add link
		//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
		//print '<td align="right">&nbsp;</td>';

		print "</tr>\n";
	}

	$oldvallevel=$val['level'];
	$nbofentries++;
}


// If nothing to show
if ($nbofentries == 0)
    /**
     *      Show list of documents in a directory
     *      @param      upload_dir          Directory that was scanned
     *      @param      filearray           Array of files loaded by dol_dir_list function before calling this function
     *      @param      modulepart          Value for modulepart used by download wrapper
     *      @param      param               Parameters on sort links
     *      @param      forcedownload       Force to open dialog box "Save As" when clicking on file
     *      @param      relativepath        Relative path of docs (autodefined if not provided)
     *      @param      permtodelete        Permission to delete
     *      @param      useinecm            Change output for use in ecm module
     *      @param      textifempty         Text to show if filearray is empty
     *      @param      maxlength           Maximum length of file name shown
     *      @return     int                 <0 if KO, nb of files shown if OK
     */
    function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0)
    {
        global $user, $conf, $langs;
        global $bc;
        global $sortfield, $sortorder;

        // Affiche liste des documents existant
        if (empty($useinecm)) print_titre($langs->trans("AttachedFiles"));
        //else { $bc[true]=''; $bc[false]=''; };
        $url=$_SERVER["PHP_SELF"];
        print '<table width="100%" class="nobordernopadding">';
        print '<tr class="liste_titre">';
        print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"","",$param,'align="left"',$sortfield,$sortorder);
        print_liste_field_titre($langs->trans("Documents2"),$_SERVER["PHP_SELF"],"name","",$param,'align="left"',$sortfield,$sortorder);
        print_liste_field_titre($langs->trans("Size"),$_SERVER["PHP_SELF"],"size","",$param,'align="right"',$sortfield,$sortorder);
        print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"date","",$param,'align="center"',$sortfield,$sortorder);
        print_liste_field_titre('','','');
        print '</tr>';

        if ($modulepart == 'invoice')
        {
            include_once(DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php');
            $object_static=new Facture($this->db);
        }
        if ($modulepart == 'invoice_supplier')
        {
            include_once(DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php');
            $object_static=new FactureFournisseur($this->db);
        }

        $var=true;
        foreach($filearray as $key => $file)
        {
            if (!is_dir($file['name'])
            && $file['name'] != '.'
            && $file['name'] != '..'
            && $file['name'] != 'CVS'
            && ! preg_match('/\.meta$/i',$file['name']))
            {
                // Define relative path used to store the file
                $relativefile=preg_replace('/'.preg_quote($upload_dir.'/','/').'/','',$file['fullname']);
                //print 'eeee'.$relativefile;
                //var_dump($file);
                $var=!$var;
                print '<tr '.$bc[$var].'>';
                print '<td>';
                $id='';$ref='';
                if ($modulepart == 'invoice')
                {
                    preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg);
                    $ref=$reg[1];
                    $object_static->fetch('',$ref);
                    //print $relativefile.'rr'.$id;
                    print $object_static->getNomUrl(1,'document');
                }
                if ($modulepart == 'invoice_supplier')
                {
                    preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg);
                    $id=$reg[1];
                    $object_static->fetch($id);
                    //print $relativefile.'rr'.$id;
                    print $object_static->getNomUrl(1,'document');
                }
                print '</td>';
                print '<td>';
                //print "XX".$file['name']; //$file['name'] must be utf8
                print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
                if ($forcedownload) print '&attachment=1';
                print '&file='.urlencode($relativefile).'">';
                print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
                print dol_trunc($file['name'],$maxlength,'middle');
                print '</a>';
                print "</td>\n";
                print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
                print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>';
                print '<td align="right">';
                if (! empty($useinecm))  print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
                if ($forcedownload) print '&attachment=1';
                print '&file='.urlencode($relativefile).'">';
                print img_view().'</a> &nbsp; ';
                //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'&section='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>';
                //else print '&nbsp;';
                print "</td></tr>\n";
            }
        }
        if (sizeof($filearray) == 0)
        {
            print '<tr '.$bc[$var].'><td colspan="4">';
            if (empty($textifempty)) print $langs->trans("NoFileFound");
            else print $textifempty;
            print '</td></tr>';
        }
        print "</table>";
        // Fin de zone
    }