diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 5ff697054da..1de12f852a6 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -31,15 +31,14 @@ require("./pre.inc.php"); require("./fichinter.class.php"); require_once(DOL_DOCUMENT_ROOT."/project.class.php"); -/* - * Sécurité accés client - */ +// Sécurité accés client if ($user->societe_id > 0) { $action = ''; $socidp = $user->societe_id; } + if ($_GET["socidp"]) { $sql = "SELECT s.nom, s.idp, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s WHERE s.idp = ".$_GET["socidp"]; @@ -289,84 +288,86 @@ if ($_GET["action"] == 'edit') if ($_GET["id"] && $_GET["action"] != 'edit') { - print_fiche_titre($langs->trans("Intervention"),$mesg); - - $fichinter = new Fichinter($db); - if ($fichinter->fetch($_GET["id"])) + print_fiche_titre($langs->trans("Intervention"),$mesg); + + $fichinter = new Fichinter($db); + if ($fichinter->fetch($_GET["id"])) { - $fichinter->fetch_client(); - - print ''; - print ''; - print ''; - print ''; - print ''; - - if ($conf->projet->enabled) - { - $fichinter->fetch_projet(); - print ''; - } - print ''; - print ''; - print ''; - - print ''; - print "
'.$langs->trans("Company").''.$fichinter->client->nom.'
Date'.strftime("%A %d %B %Y",$fichinter->date).'
'.$langs->trans("Ref").''.$fichinter->ref.'
'.$langs->trans("Duration").''.$fichinter->duree.'
'.$langs->trans("Ref").''.$fichinter->projet.'
'.$langs->trans("Status").''.$fichinter->statut.'
'.$langs->trans("Description").''; - print nl2br($fichinter->note); - print '
"; - - - /* - * Barre d'actions - * - */ - print '
'; - print '
'; - - if ($user->societe_id == 0) + $fichinter->fetch_client(); + + print ''; + print ''; + print ''; + print ''; + print ''; + + if ($conf->projet->enabled) { - - if ($fichinter->statut == 0) - { - print ''.$langs->trans("Edit").''; - } - - if ($fichinter->statut == 0) - { - print ''.$langs->trans("Valid").''; - } - - $file = $conf->fichinter->dir_output."/".$fichinter->ref."/".$fichinter->ref.pdf; - if ($fichinter->statut == 0 or !file_exists($file)) - { - $langs->load("bills"); - print ''.$langs->trans("BuildPDF").''; - } - + $fichinter->fetch_projet(); + print ''; } - print ''; - print '
'; - - print '
'.$langs->trans("Company").''.$fichinter->client->nom.'
Date'.strftime("%A %d %B %Y",$fichinter->date).'
'.$langs->trans("Ref").''.$fichinter->ref.'
'.$langs->trans("Duration").''.$fichinter->duree.'
'.$langs->trans("Ref").''.$fichinter->projet.'
"; - print ''; - print ''; - print ''; + + if ($fichinter->statut == 0) + { + print ''.$langs->trans("Edit").''; + } + + if ($fichinter->statut == 0) + { + print ''.$langs->trans("Valid").''; + } + + $file = $conf->fichinter->dir_output."/".$fichinter->ref."/".$fichinter->ref.pdf; + if ($fichinter->statut == 0 or !file_exists($file)) + { + $langs->load("bills"); + print ''.$langs->trans("BuildPDF").''; + } + } + print ''; + print '
'; + + print '
'; - - print_titre($langs->trans("Documents")); - print ''; - - $file = $conf->fichinter->dir_output . "/$fichinter->ref/$fichinter->ref.pdf"; - $relativepath="$fichinter->ref/$fichinter->ref.pdf"; - - $var=true; - - if (file_exists($file)) + print ''; + print ''; + print ''; + + print ''; + print "
'.$langs->trans("Status").''.$fichinter->statut.'
'.$langs->trans("Description").''; + print nl2br($fichinter->note); + print '
"; + + + /* + * Barre d'actions + * + */ + print '
'; + print '
'; + + if ($user->societe_id == 0) { - print "
Ficheinter PDF'.$fichinter->ref.'.pdf'.filesize($file). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'
'; + + + /* + * Documents générés + */ + $filename=sanitize_string($fichinter->ref); + $filedir=$conf->fichinter->dir_output . "/".$fichinter->ref; + $urlsource=$_SERVER["PHP_SELF"]."?id=".$fichinter->id; + //$genallowed=$user->rights->expedition->creer; + //$delallowed=$user->rights->expedition->supprimer; + $genallowed=0; + $delallowed=0; + + $var=true; + + print "
\n"; + $sel->show_documents('ficheinter',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf); + - print "
\n"; + print "\n"; } else