Browse Source

Standardize code between customer and supplier invoice list.

Laurent Destailleur 8 years ago
parent
commit
5992175b68
3 changed files with 119 additions and 40 deletions
  1. 25 8
      htdocs/compta/facture/list.php
  2. 1 1
      htdocs/core/lib/functions.lib.php
  3. 93 31
      htdocs/fourn/facture/list.php

+ 25 - 8
htdocs/compta/facture/list.php

@@ -536,7 +536,7 @@ if ($resql)
     $param='&socid='.$socid;
     if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
     if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
-	if ($sall)				 $param.='&sall='.$sall;
+	if ($sall)				 $param.='&sall='.urlencode($sall);
     if ($day)                $param.='&day='.urlencode($day);
     if ($month)              $param.='&month='.urlencode($month);
     if ($year)               $param.='&year=' .urlencode($year);
@@ -760,14 +760,14 @@ if ($resql)
     // Filters lines
     print '<tr class="liste_titre_filter">';
 	// Ref
-	if (! empty($arrayfields['f.facnumber']['checked'])) 
+	if (! empty($arrayfields['f.facnumber']['checked']))
 	{
         print '<td class="liste_titre" align="left">';
         print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
         print '</td>';
 	}
 	// Ref customer
-	if (! empty($arrayfields['f.ref_client']['checked'])) 
+	if (! empty($arrayfields['f.ref_client']['checked']))
 	{
     	print '<td class="liste_titre">';
     	print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.dol_escape_htmltag($search_refcustomer).'">';
@@ -806,6 +806,11 @@ if ($resql)
     	print '<br><input type="checkbox" name="option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
         print '</td>';
 	}
+	// Project
+	if (! empty($arrayfields['p.ref']['checked']))
+	{
+	    print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_project" value="'.$search_project.'"></td>';
+	}
 	// Thirpdarty
 	if (! empty($arrayfields['s.nom']['checked'])) 
 	{
@@ -1016,7 +1021,7 @@ if ($resql)
     
                 print '<td class="nobordernopadding nowrap">';
                 print $facturestatic->getNomUrl(1,'',200,0,'',0,1);
-                print $obj->increment;
+                print empty($obj->increment)?'':' ('.$obj->increment.')';
                 print '</td>';
     
                 print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
@@ -1071,6 +1076,20 @@ if ($resql)
     		    if (! $i) $totalarray['nbfield']++;
     		}
 
+            // Project
+    		if (! empty($arrayfields['p.ref']['checked']))
+    		{
+    		    print '<td class="nowrap">';
+    		    if ($obj->project_id > 0)
+    		    {
+	    		    $projectstatic->id=$obj->project_id;
+    			    $projectstatic->ref=$obj->project_ref;
+    			    print $projectstatic->getNomUrl(1);
+    		    }
+    		    print '</td>';
+    		    if (! $i) $totalarray['nbfield']++;
+    		}
+    		
     		// Third party
     		if (! empty($arrayfields['s.nom']['checked']))
     		{
@@ -1295,15 +1314,13 @@ if ($resql)
 	print $hookmanager->resPrint;
     
 	print "</table>\n";
-    print "</div>";
+    print '</div>';
     
     print "</form>\n";
     
     if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
     {
-        /*
-         * Show list of available documents
-         */
+        // Show list of available documents
         $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
         $urlsource.=str_replace('&amp;','&',$param);
         

+ 1 - 1
htdocs/core/lib/functions.lib.php

@@ -105,7 +105,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
  * 	@param	string	$element	Current element 
  *                              'societe', 'socpeople', 'actioncomm', 'agenda', 'resource', 
  *                              'product', 'productprice', 'stock',
- *                              'propal', 'facture', 'facture_fourn',
+ *                              'propal', 'supplier_proposal', 'facture', 'facture_fourn',
  *                              'categorie', 'bank_account', 'bank_account', 'adherent', 'user',  
  *                              'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey',
  *                              'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project',

+ 93 - 31
htdocs/fourn/facture/list.php

@@ -163,6 +163,8 @@ $arrayfields=array(
     'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj=="1"),
     'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj=="1"),
     'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0),
+    'dynamount_payed'=>array('label'=>$langs->trans("Payed"), 'checked'=>0),
+    'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0),
     'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
     'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
     'f.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
@@ -263,7 +265,9 @@ $sql.= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.
 $sql.= " typent.code as typent_code,";
 $sql.= " state.code_departement as state_code, state.nom as state_name,";
 $sql.= " p.rowid as project_id, p.ref as project_ref";
-if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
+// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
+// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
+if (! $search_all) $sql.= ', SUM(pf.amount) as dynamount_payed';   
 // Add fields from extrafields
 foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
 // Add fields from hooks
@@ -276,6 +280,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typ
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
 $sql.= ', '.MAIN_DB_PREFIX.'facture_fourn as f';
 if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_fourn_extrafields as ef on (f.rowid = ef.fk_object)";
+if (! $search_all) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid';
 if ($search_all || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det as pd ON f.rowid=pd.fk_facture_fourn';
 if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet";
@@ -287,14 +292,10 @@ if ($search_user > 0)
     $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc";
 }
 $sql.= ' WHERE f.fk_soc = s.rowid';
-$sql.= " AND f.entity = ".$conf->entity;
+$sql.= ' AND f.entity IN ('.getEntity('facture_fourn', 1).')';
 if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
 if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
 if ($socid > 0) $sql .= ' AND s.rowid = '.$socid;
-if ($search_all)
-{
-    $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
-}
 if ($search_ref)
 {
 	if (is_numeric($search_ref)) $sql .= natural_search(array('f.ref'), $search_ref);
@@ -337,7 +338,7 @@ if ($month_lim > 0)
 	else if ($year_lim > 0 && ! empty($day_lim))
 		$sql.= " AND f.date_lim_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_lim, $day_lim, $year_lim))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month_lim, $day_lim, $year_lim))."'";
 	else
-		$sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$month_lim."'";
+		$sql.= " AND date_format(f.date_lim_reglement, '%m') = '".$db->escape($month_lim)."'";
 }
 else if ($year_lim > 0)
 {
@@ -382,6 +383,26 @@ $parameters=array();
 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters);    // Note that $action and $object may have been modified by hook
 $sql.=$hookmanager->resPrint;
 
+if (! $search_all)
+{
+    $sql.= " GROUP BY f.rowid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement, f.fk_mode_reglement,";
+    $sql.= " f.total_ht, f.total_ttc, f.total_tva, f.paye, f.fk_statut, f.libelle, f.datec, f.tms,";
+    $sql.= " f.localtax1, f.localtax2,";
+    $sql.= " s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
+    $sql.= " typent.code,";
+    $sql.= " state.code_departement, state.nom,";
+    $sql.= " p.rowid, p.ref";
+
+    foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by
+    {
+        $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key : '');
+    }   
+}
+else
+{
+    $sql.= natural_search(array_keys($fieldstosearchall), $search_all);
+}
+
 $sql.= $db->order($sortfield,$sortorder);
 
 $nbtotalofrecords = '';
@@ -410,7 +431,8 @@ if ($resql)
 	$param='&socid='.$socid;
     if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
     if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
-	if ($day) 					$param.='&day='.urlencode($day);
+	if ($search_all)			$param.='&search_all='.urlencode($search_all);
+    if ($day) 					$param.='&day='.urlencode($day);
 	if ($month) 				$param.='&month='.urlencode($month);
 	if ($year)  				$param.='&year=' .urlencode($year);
 	if ($day_lim) 				$param.='&day_lim='.urlencode($day_lim);
@@ -428,6 +450,8 @@ if ($resql)
 	if ($search_amount_no_tax)	$param.='&search_amount_no_tax='.urlencode($search_amount_no_tax);
 	if ($search_amount_all_tax)	$param.='&search_amount_all_tax='.urlencode($search_amount_all_tax);
 	if ($search_status >= 0)  	$param.="&search_status=".urlencode($search_status);
+    if ($show_files)            $param.='&show_files=' .$show_files;
+	if ($option)                $param.="&option=".$option;
 	if ($optioncss != '')       $param.='&optioncss='.$optioncss;
 	// Add $param from extra fields
 	foreach ($search_array_options as $key => $val)
@@ -453,13 +477,13 @@ if ($resql)
 	print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 	print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 	print '<input type="hidden" name="action" value="list">';
-    print '<input type="hidden" name="page" value="'.$page.'">';
 	print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
 	print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
+    print '<input type="hidden" name="page" value="'.$page.'">';
 	print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
 	print '<input type="hidden" name="socid" value="'.$socid.'">';
 
-	print_barre_liste($langs->trans("BillsSuppliers").($socid?" - $soc->name":""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
+	print_barre_liste($langs->trans("BillsSuppliers").($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit);
 	
 	if ($massaction == 'presend')
 	{
@@ -467,7 +491,7 @@ if ($resql)
 	
 	    if (! GETPOST('cancel'))
 	    {
-	        $objecttmp=new Commande($db);
+	        $objecttmp=new FactureFourn($db);
 	        $listofselectedid=array();
 	        $listofselectedthirdparties=array();
 	        $listofselectedref=array();
@@ -491,8 +515,8 @@ if ($resql)
 	
 	    dol_fiche_head(null, '', '');
 	
-	    $topicmail="SendOrderRef";
-	    $modelmail="order_send";
+	    $topicmail="SendBillRef";
+	    $modelmail="supplier_invoice_send";
 	
 	    // Cree l'objet formulaire mail
 	    include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
@@ -506,12 +530,12 @@ if ($resql)
 	    }
 	    if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1))	// If bit 1 is set
 	    {
-	        $formmail->trackid='ord'.$object->id;
+	        $formmail->trackid='sinv'.$object->id;
 	    }
 	    if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2))	// If bit 2 is set
 	    {
 	        include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-	        $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'ord'.$object->id);
+	        $formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'sinv'.$object->id);
 	    }
 	    $formmail->withfrom=1;
 	    $liste=$langs->trans("AllRecipientSelected");
@@ -678,7 +702,7 @@ if ($resql)
 	if (! empty($arrayfields['f.datef']['checked']))
 	{
 	    print '<td class="liste_titre" align="center">';
-	    if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
+	    if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
 	    print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
 	    $formother->select_year($year?$year:-1,'year',1, 20, 5);
 	    print '</td>';
@@ -687,7 +711,7 @@ if ($resql)
 	if (! empty($arrayfields['f.date_lim_reglement']['checked']))
 	{
 	    print '<td class="liste_titre" align="center">';
-	    if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.$day_lim.'">';
+	    if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day_lim" value="'.dol_escape_htmltag($day_lim).'">';
 	    print '<input class="flat" type="text" size="1" maxlength="2" name="month_lim" value="'.$month_lim.'">';
 	    $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5);
 	    print '<br><input type="checkbox" name="option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
@@ -704,9 +728,9 @@ if ($resql)
 	    print '<td class="liste_titre" align="left"><input class="flat" type="text" size="6" name="search_societe" value="'.$search_societe.'"></td>';
 	}
 	// Town
-	if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
+	if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
 	// Zip
-	if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
+	if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
 	// State
 	if (! empty($arrayfields['state.nom']['checked']))
 	{
@@ -739,14 +763,14 @@ if ($resql)
 	{
 	    // Amount
 	    print '<td class="liste_titre" align="right">';
-	    print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.$search_montant_ht.'">';
+	    print '<input class="flat" type="text" size="5" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).'">';
 	    print '</td>';
 	}
 	if (! empty($arrayfields['f.total_vat']['checked']))
 	{
 	    // Amount
 	    print '<td class="liste_titre" align="right">';
-	    print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.$search_montant_vat.'">';
+	    print '<input class="flat" type="text" size="5" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).'">';
 	    print '</td>';
 	}
 	if (! empty($arrayfields['f.total_localtax1']['checked']))
@@ -767,9 +791,19 @@ if ($resql)
 	{
 	    // Amount
 	    print '<td class="liste_titre" align="right">';
-	    print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.$search_montant_ttc.'">';
+	    print '<input class="flat" type="text" size="5" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
 	    print '</td>';
 	}
+    if (! empty($arrayfields['dynamount_payed']['checked']))
+    {
+        print '<td class="liste_titre" align="right">';
+        print '</td>';
+    }
+    if (! empty($arrayfields['rtp']['checked']))
+    {
+        print '<td class="liste_titre" align="right">';
+        print '</td>';
+    }
 	// Extra fields
 	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
 	{
@@ -819,7 +853,7 @@ if ($resql)
 	}
 	// Action column
 	print '<td class="liste_titre" align="middle">';
-	$searchpicto=$form->showFilterButtons('checkforselect', 0);
+	$searchpicto=$form->showFilterButtons();
 	print $searchpicto;
 	print '</td>';
 
@@ -844,6 +878,8 @@ if ($resql)
 	if (! empty($arrayfields['f.total_localtax1']['checked']))    print_liste_field_titre($arrayfields['f.total_localtax1']['label'],$_SERVER['PHP_SELF'],'f.localtax1','',$param,'align="right"',$sortfield,$sortorder);
 	if (! empty($arrayfields['f.total_localtax2']['checked']))    print_liste_field_titre($arrayfields['f.total_localtax2']['label'],$_SERVER['PHP_SELF'],'f.localtax2','',$param,'align="right"',$sortfield,$sortorder);
 	if (! empty($arrayfields['f.total_ttc']['checked']))          print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
+    if (! empty($arrayfields['dynamount_payed']['checked']))      print_liste_field_titre($arrayfields['dynamount_payed']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
+    if (! empty($arrayfields['rtp']['checked']))                  print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
 	// Extra fields
 	if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
 	{
@@ -880,14 +916,20 @@ if ($resql)
 		{
 			$obj = $db->fetch_object($resql);
 			
-		
 			$datelimit=$db->jdate($obj->datelimite);
 			$facturestatic->id=$obj->facid;
 			$facturestatic->ref=$obj->ref;
+            $facturestatic->type=$obj->type;
 			$facturestatic->ref_supplier=$obj->ref_supplier;
 			$facturestatic->date_echeance = $db->jdate($obj->datelimite);
 			$facturestatic->statut = $obj->fk_statut;
-	
+
+			$paiement = $facturestatic->getSommePaiement();
+			$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
+			$totaldeposits = $facturestatic->getSumDepositsUsed();
+			$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
+			$remaintopay = $obj->total_ttc - $totalpay;
+				
             print '<tr class="oddeven">';
     		if (! empty($arrayfields['f.ref']['checked']))
     		{
@@ -969,7 +1011,7 @@ if ($resql)
     		// Third party
     		if (! empty($arrayfields['s.nom']['checked']))
     		{
-                print '<td>';
+                print '<td class="tdoverflowmax200">';
                 $thirdparty=new Societe($db);
                 $thirdparty->id=$obj->socid;
                 $thirdparty->name=$obj->name;
@@ -1070,22 +1112,23 @@ if ($resql)
     		    $totalarray['totalttc'] += $obj->total_ttc;
             }
 
-            if (! empty($arrayfields['am']['checked']))
+		    if (! empty($arrayfields['dynamount_payed']['checked']))
             {
-                print '<td align="right">'.(! empty($paiement)?price($paiement,0,$langs):'&nbsp;').'</td>';
+                print '<td align="right">'.(! empty($totalpay)?price($totalpay,0,$langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
                 if (! $i) $totalarray['nbfield']++;
     		    if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
-    		    $totalarray['totalam'] += $paiement;
+    		    $totalarray['totalam'] += $totalpay;
             }
 
             if (! empty($arrayfields['rtp']['checked']))
             {
-                print '<td align="right">'.(! empty($remaintopay)?price($remaintopay,0,$langs):'&nbsp;').'</td>';
+                print '<td align="right">'.(! empty($remaintopay)?price($remaintopay,0,$langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
                 if (! $i) $totalarray['nbfield']++;
     		    if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
     		    $totalarray['totalrtp'] += $remaintopay;
             }
             
+            
             // Extra fields
             if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
             {
@@ -1135,7 +1178,6 @@ if ($resql)
             }
             
     		// Action column
-            // Action column
             print '<td class="nowrap" align="center">';
             if ($massactionbutton || $massaction)   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
             {
@@ -1193,7 +1235,27 @@ if ($resql)
 	
 	print "</table>\n";
     print '</div>';
+    
 	print "</form>\n";
+    
+    /*
+    if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
+    {
+        // Show list of available documents
+        $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+        $urlsource.=str_replace('&amp;','&',$param);
+        
+        $filedir=$diroutputmassaction;
+        $genallowed=$user->rights->facture->lire;
+        $delallowed=$user->rights->facture->lire;
+    
+        print $formfile->showdocuments('massfilesarea_invoices','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
+    }
+    else
+    {
+        print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
+    }
+    */
 }
 else
 {