Add: icone pdf dans la liste des factures

This commit is contained in:
Regis Houssin 2007-07-13 15:45:51 +00:00
parent 7cdbc4af0b
commit faaf7ec672
15 changed files with 178 additions and 151 deletions

View File

@ -3116,12 +3116,30 @@ else
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
$facturestatic->id=$objp->facid; $facturestatic->id=$objp->facid;
$facturestatic->ref=$objp->facnumber; $facturestatic->ref=$objp->facnumber;
$facturestatic->type=$objp->type; $facturestatic->type=$objp->type;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td width="90" class="nobordernopadding" nowrap="nowrap">';
print $facturestatic->getNomUrl(1); print $facturestatic->getNomUrl(1);
print $objp->increment; print $objp->increment;
print '</td>';
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans('Late')); if ($objp->datelimite < (time() - $conf->facture->client->warning_delay) && ! $objp->paye && $objp->fk_statut == 1 && ! $objp->am) print img_warning($langs->trans('Late'));
print '</td>';
print '<td width="16" align="right" class="nobordernopadding">';
$filename=sanitize_string($objp->facnumber);
$filedir=$conf->facture->dir_output . '/' . sanitize_string($objp->facnumber);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$objp->facid;
$genallowed=($fac->statut >= 1 && $user->rights->facture->liste);
$html->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,'','','','',1);
print '</td></tr></table>';
print "</td>\n"; print "</td>\n";
if ($objp->df > 0 ) if ($objp->df > 0 )

View File

@ -2894,7 +2894,7 @@ class Form
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
* \return int <0 si ko, nbre de fichiers affichés si ok * \return int <0 si ko, nbre de fichiers affichés si ok
*/ */
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0) function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0)
{ {
// filedir = conf->...dir_ouput."/".get_exdir(id) // filedir = conf->...dir_ouput."/".get_exdir(id)
@ -3046,10 +3046,9 @@ class Form
$file_list=dolibarr_dir_list($filedir,'files',0,'','\.meta$','date',SORT_DESC); $file_list=dolibarr_dir_list($filedir,'files',0,'','\.meta$','date',SORT_DESC);
// Affiche en-tete tableau si non deja affiché // Affiche en-tete tableau si non deja affiché
if (sizeof($file_list) && ! $headershown) if (sizeof($file_list) && ! $headershown && !$iconPDF)
{ {
$headershown=1; $headershown=1;
print_titre($langs->trans("Documents")); print_titre($langs->trans("Documents"));
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
} }
@ -3057,7 +3056,6 @@ class Form
// Boucle sur chaque ligne trouvée // Boucle sur chaque ligne trouvée
foreach($file_list as $i => $file) foreach($file_list as $i => $file)
{ {
// Défini chemin relatif par rapport au module pour lien download // Défini chemin relatif par rapport au module pour lien download
$relativepath=$file["name"]; // Cas general $relativepath=$file["name"]; // Cas general
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas prpal, facture... if ($filename) $relativepath=$filename."/".$file["name"]; // Cas prpal, facture...
@ -3072,24 +3070,34 @@ class Form
if ($extension == 'html') $mimetype='HTML'; if ($extension == 'html') $mimetype='HTML';
if (eregi('\-detail\.pdf',$file["name"])) $mimetype='PDF Détaillé'; if (eregi('\-detail\.pdf',$file["name"])) $mimetype='PDF Détaillé';
print "<tr $bc[$var]>"; if (!$iconPDF) print "<tr $bc[$var]>";
// Affiche colonne type MIME // Affiche colonne type MIME
print '<td nowrap>'.$mimetype.'</td>'; if (!$iconPDF) print '<td nowrap>'.$mimetype.'</td>';
// Affiche nom fichier avec lien download // Affiche nom fichier avec lien download
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">'.$file["name"].'</a>'; if (!$iconPDF) print '<td>';
print '</td>'; print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">';
if (!$iconPDF)
{
$file["name"];
}
else
{
print img_pdf($file["name"],2);
}
print '</a>';
if (!$iconPDF) print '</td>';
// Affiche taille fichier // Affiche taille fichier
print '<td align="right">'.filesize($filedir."/".$file["name"]). ' bytes</td>'; if (!$iconPDF) print '<td align="right">'.filesize($filedir."/".$file["name"]). ' bytes</td>';
// Affiche date fichier // Affiche date fichier
print '<td align="right">'.dolibarr_print_date(filemtime($filedir."/".$file["name"]),'dayhour').'</td>'; if (!$iconPDF) print '<td align="right">'.dolibarr_print_date(filemtime($filedir."/".$file["name"]),'dayhour').'</td>';
if ($delallowed) if ($delallowed)
{ {
print '<td><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'&amp;urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>'; print '<td><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'&amp;urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>';
} }
print '</tr>'; if (!$iconPDF) print '</tr>';
$i++; $i++;
} }

View File

@ -787,13 +787,14 @@ function img_file_new($alt = "default")
/** /**
\brief Affiche logo pdf \brief Affiche logo pdf
\param alt Texte sur le alt de l'image \param alt Texte sur le alt de l'image
\param $size Taille de l'icone : 3 = 16x16px , 2 = 14x14px
\return string Retourne tag img \return string Retourne tag img
*/ */
function img_pdf($alt = "default") function img_pdf($alt = "default",$size=3)
{ {
global $conf,$langs; global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Show"); if ($alt=="default") $alt=$langs->trans("Show");
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/pdf.png" border="0" alt="'.$alt.'" title="'.$alt.'">'; return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/pdf'.$size.'.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
} }
/** /**

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 744 B