diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index b1283c125b6..d88b2113f3b 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Éric Seigne - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,8 +22,7 @@ * */ -/*! - \file htdocs/comm/action/rapport/index.php +/** \file htdocs/comm/action/rapport/index.php \ingroup commercial \brief Page accueil des rapports des actions commerciales \version $Revision$ @@ -154,14 +153,14 @@ if ( $db->query($sql) ) print_barre_liste("Liste des actions commerciales réalisées ou à faire", $page, "index.php",'',$sortfield,$sortorder,'',$num); $i = 0; - print ''; + print '
'; print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; $var=true; while ($i < min($num,$limit)) @@ -177,18 +176,21 @@ if ( $db->query($sql) ) print ''; - $root = DOL_DOCUMENT_ROOT; - $dir = "/document/rapport/comm/actions/"; $name = "rapport-action-".$obj->month."-".$obj->year.".pdf"; - $file = $root . $dir . $name; - $url = $dir . $name; - + $relativepath="comm/actions/" .$name; + $file = $conf->commercial->dir_output . "/comm/actions/" .$name; + if (file_exists($file)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } + else { + print ''; + print ''; + print ''; + } print "\n"; $i++; @@ -198,7 +200,7 @@ if ( $db->query($sql) ) } else { - print $db->error() . ' ' . $sql ; + dolibarr_print_error($db); } diff --git a/htdocs/comm/action/rapport/rapport.pdf.php b/htdocs/comm/action/rapport/rapport.pdf.php index f183d755224..8b37c70b86c 100644 --- a/htdocs/comm/action/rapport/rapport.pdf.php +++ b/htdocs/comm/action/rapport/rapport.pdf.php @@ -20,9 +20,19 @@ * $Source$ * */ + +/** \file htdocs/comm/action/rapport/rapport.pdf.php + \ingroup commercial + \brief Fichier de generation de PDF pour les rapports d'actions + \version $Revision$ +*/ + + require (DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_indexes.php"); require (DOL_DOCUMENT_ROOT ."/includes/fpdf/fpdf_html.php"); + + class CommActionRapport { function CommActionRapport($db=0, $month, $year) @@ -36,9 +46,20 @@ class CommActionRapport { function generate($socid = 0, $catid = 0) { - global $user; + global $user,$conf; - $dir = DOL_DOCUMENT_ROOT . "/document/rapport/"; + $dir = $conf->commercial->dir_output; + + if (! file_exists($dir)) + { + umask(0); + if (! mkdir($dir, 0755)) + { + return "Error"; + } + } + + $dir = $conf->commercial->dir_output . "/comm"; if (! file_exists($dir)) { @@ -49,7 +70,7 @@ class CommActionRapport { } } - $dir = DOL_DOCUMENT_ROOT . "/document/rapport/comm/"; + $dir = $conf->commercial->dir_output . "/comm/actions"; if (! file_exists($dir)) { @@ -60,18 +81,7 @@ class CommActionRapport { } } - $dir = DOL_DOCUMENT_ROOT . "/document/rapport/comm/actions/"; - - if (! file_exists($dir)) - { - umask(0); - if (! mkdir($dir, 0755)) - { - return "Error"; - } - } - - $file = $dir . "rapport-action-".$this->month."-".$this->year.".pdf"; + $file = $dir . "/rapport-action-".$this->month."-".$this->year.".pdf"; if (file_exists($dir)) { @@ -81,7 +91,7 @@ class CommActionRapport { $pdf->SetTitle("Rapport Commercial"); $pdf->SetSubject("Rapport Commercial"); $pdf->SetCreator("Dolibarr ".DOL_VERSION); - $pdf->SetAuthor("Rodolphe Quiedeville"); + $pdf->SetAuthor($user->fullname); $pdf->SetFillColor(220,220,220); @@ -104,6 +114,8 @@ class CommActionRapport { */ function _cover(&$pdf) { + global $user; + $pdf->AddPage(); $pdf->SetAutoPageBreak(false); $pdf->SetFont('Arial','',40); @@ -117,7 +129,7 @@ class CommActionRapport { $pdf->SetXY (10, 170); $pdf->SetFont('Arial','B',18); - $pdf->MultiCell(190, 15, "Rodolphe Quiédeville ", 0, 'C'); + $pdf->MultiCell(190, 15, $user->fullname, 0, 'C'); $pdf->SetFont('Arial','B',16); $pdf->MultiCell(190, 15, "Tél : +33 (0) 6 13 79 63 41", 0, 'C'); diff --git a/htdocs/document.php b/htdocs/document.php index 6f5148f3839..fb5234b0a9f 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -124,6 +124,17 @@ if ($modulepart) } + // Wrapping pour la telephonie + if ($modulepart == 'actionscomm') + { + $user->getrights('commercial'); + //if ($user->rights->commercial->lire) // Ce droit n'existe pas encore + //{ + $accessallowed=1; + //} + $original_file=$conf->commercial->dir_output.'/'.$original_file; + } + } // Limite accès si droits non corrects diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index cd10ca8d0fe..caaf04e9674 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -207,6 +207,7 @@ if (defined("MAIN_MODULE_SOCIETE")) if (defined("MAIN_MODULE_COMMERCIAL")) { $conf->commercial->enabled=MAIN_MODULE_COMMERCIAL; + $conf->commercial->dir_output=DOL_DATA_ROOT."/rapport"; } if (defined("MAIN_MODULE_COMPTABILITE")) {
DateNombreActionPDFDateTaille'.$langs->trans("Nb").''.$langs->trans("Action").''.$langs->trans("PDF").''.$langs->trans("Date").''.$langs->trans("Size").'
'.img_file_new().''.img_pdf().''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).''.filesize($file). ' bytes'.img_pdf().''.strftime("%d %b %Y %H:%M:%S",filemtime($file)).''.filesize($file). ' bytes