1553 |
$filename = sanitize_string($filename); |
$filename = sanitize_string($filename); |
1554 |
$relativepath = "${filename}/${filename}.pdf"; |
$relativepath = "${filename}/${filename}.pdf"; |
1555 |
$fullpathfile = $filedir . "/" . $filename . ".pdf"; |
$fullpathfile = $filedir . "/" . $filename . ".pdf"; |
|
|
|
|
if ($genallowed) |
|
|
{ |
|
|
print '<form action="'.$urlsource.'" method="post">'; |
|
|
print '<input type="hidden" name="action" value="setpdfmodel">'; |
|
|
} |
|
|
print_titre($langs->trans("Documents")); |
|
|
print '<table class="border" width="100%">'; |
|
|
|
|
|
if ($genallowed) |
|
|
{ |
|
|
$liste=array(); |
|
|
if ($modulepart == 'propal') |
|
|
{ |
|
|
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php'); |
|
|
$model=new ModelePDFPropales(); |
|
|
$liste=$model->liste_modeles($this->db); |
|
|
} |
|
|
elseif ($modulepart == 'facture') |
|
|
{ |
|
|
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php'); |
|
|
$model=new ModelePDFFactures(); |
|
|
$liste=$model->liste_modeles($this->db); |
|
|
} |
|
|
else |
|
|
{ |
|
|
dolibarr_print_error($this->db,'Bad value for modulepart'); |
|
|
} |
|
|
print '<tr '.$bc[$var].'><td>'.$langs->trans('Model').'</td><td align="center">'; |
|
|
$this->select_array('modelpdf',$liste,$modelselected); |
|
|
$texte=$langs->trans('Generate'); |
|
|
print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">'; |
|
|
print '</td></tr>'; |
|
|
} |
|
1556 |
|
|
1557 |
$i=0; |
$i=0; |
1558 |
if (is_dir($filedir)) |
if (is_dir($filedir)) |
1563 |
// Si fichier non lisible ou non .pdf, on passe au suivant |
// Si fichier non lisible ou non .pdf, on passe au suivant |
1564 |
if (! is_readable($filedir."/".$file) || ! eregi('\.pdf$',$file)) continue; |
if (! is_readable($filedir."/".$file) || ! eregi('\.pdf$',$file)) continue; |
1565 |
|
|
1566 |
|
|
1567 |
|
if ($i==0) |
1568 |
|
{ |
1569 |
|
// Affiche en-tete tableau |
1570 |
|
if ($genallowed) |
1571 |
|
{ |
1572 |
|
print '<form action="'.$urlsource.'" method="post">'; |
1573 |
|
print '<input type="hidden" name="action" value="setpdfmodel">'; |
1574 |
|
} |
1575 |
|
|
1576 |
|
print_titre($langs->trans("Documents")); |
1577 |
|
print '<table class="border" width="100%">'; |
1578 |
|
|
1579 |
|
if ($genallowed) |
1580 |
|
{ |
1581 |
|
$liste=array(); |
1582 |
|
if ($modulepart == 'propal') |
1583 |
|
{ |
1584 |
|
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/propale/modules_propale.php'); |
1585 |
|
$model=new ModelePDFPropales(); |
1586 |
|
$liste=$model->liste_modeles($this->db); |
1587 |
|
} |
1588 |
|
elseif ($modulepart == 'facture') |
1589 |
|
{ |
1590 |
|
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/facture/modules_facture.php'); |
1591 |
|
$model=new ModelePDFFactures(); |
1592 |
|
$liste=$model->liste_modeles($this->db); |
1593 |
|
} |
1594 |
|
else |
1595 |
|
{ |
1596 |
|
dolibarr_print_error($this->db,'Bad value for modulepart'); |
1597 |
|
} |
1598 |
|
print '<tr '.$bc[$var].'><td>'.$langs->trans('Model').'</td><td align="center">'; |
1599 |
|
$this->select_array('modelpdf',$liste,$modelselected); |
1600 |
|
$texte=$langs->trans('Generate'); |
1601 |
|
print '</td><td align="center" colspan="2"><input class="button" type="submit" value="'.$texte.'">'; |
1602 |
|
print '</td></tr>'; |
1603 |
|
} |
1604 |
|
} |
1605 |
|
|
1606 |
print "<tr $bc[$var]>"; |
print "<tr $bc[$var]>"; |
1607 |
if (eregi('\-detail\.pdf',$file)) print '<td nowrap>PDF Détaillé</td>'; |
if (eregi('\-detail\.pdf',$file)) print '<td nowrap>PDF Détaillé</td>'; |
1608 |
else print '<td nowrap>PDF</td>'; |
else print '<td nowrap>PDF</td>'; |
1618 |
} |
} |
1619 |
} |
} |
1620 |
|
|
1621 |
print "</table>\n"; |
if ($i > 0) |
|
if ($genallowed) |
|
1622 |
{ |
{ |
1623 |
print '</form>'; |
// Affiche pied du tableau |
1624 |
|
print "</table>\n"; |
1625 |
|
if ($genallowed) |
1626 |
|
{ |
1627 |
|
print '</form>'; |
1628 |
|
} |
1629 |
} |
} |
1630 |
|
|
1631 |
} |
} |