2
0
forked from Wavyzz/dolibarr

Fix: Isolation des rapports d'actions commerciales dans documents.

This commit is contained in:
Laurent Destailleur
2005-01-09 01:46:34 +00:00
parent 2df722b8f6
commit 1706da3d9a
4 changed files with 61 additions and 35 deletions

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 <20>ric Seigne <erics@rycks.com>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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<69>es ou <20> faire", $page, "index.php",'',$sortfield,$sortorder,'',$num);
$i = 0;
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>Date</td>';
print '<td align="center">Nombre</td>';
print '<td>Action</td>';
print '<td align="center">PDF</td>';
print '<td align="center">Date</td>';
print '<td align="center">Taille</td>';
print '<td align="center">'.$langs->trans("Nb").'</td>';
print '<td>'.$langs->trans("Action").'</td>';
print '<td align="center">'.$langs->trans("PDF").'</td>';
print '<td align="center">'.$langs->trans("Date").'</td>';
print '<td align="center">'.$langs->trans("Size").'</td>';
print "</tr>\n";
$var=true;
while ($i < min($num,$limit))
@@ -177,17 +176,20 @@ if ( $db->query($sql) )
print '<td><a href="index.php?action=pdf&amp;month='.$obj->month.'&amp;year='.$obj->year.'">'.img_file_new().'</a></td>';
$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 '<td ><a href="'.DOL_URL_ROOT.$url.'">'.img_pdf().'</a></td>';
print '<td>'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '<td>'.filesize($file). ' bytes</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/document.php?file='.urlencode($relativepath).'&modulepart=actionscomm">'.img_pdf().'</a></td>';
print '<td align="center">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
print '<td align="center">'.filesize($file). ' bytes</td>';
}
else {
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
}
print "</tr>\n";
@@ -198,7 +200,7 @@ if ( $db->query($sql) )
}
else
{
print $db->error() . ' ' . $sql ;
dolibarr_print_error($db);
}

View File

@@ -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,9 @@ 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))
{
@@ -49,7 +59,7 @@ class CommActionRapport {
}
}
$dir = DOL_DOCUMENT_ROOT . "/document/rapport/comm/";
$dir = $conf->commercial->dir_output . "/comm";
if (! file_exists($dir))
{
@@ -60,7 +70,7 @@ class CommActionRapport {
}
}
$dir = DOL_DOCUMENT_ROOT . "/document/rapport/comm/actions/";
$dir = $conf->commercial->dir_output . "/comm/actions";
if (! file_exists($dir))
{
@@ -71,7 +81,7 @@ class CommActionRapport {
}
}
$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<75>deville <rq@lolix.org>", 0, 'C');
$pdf->MultiCell(190, 15, $user->fullname, 0, 'C');
$pdf->SetFont('Arial','B',16);
$pdf->MultiCell(190, 15, "T<EFBFBD>l : +33 (0) 6 13 79 63 41", 0, 'C');

View File

@@ -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<63>s si droits non corrects

View File

@@ -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"))
{