New: parametre de config des repertoires dans les proprietes de la classe du module

avec un répertoire parent en fonction de l'entité
This commit is contained in:
Regis Houssin 2009-04-29 07:03:55 +00:00
parent 1a60d58047
commit c1b3f88cc3
6 changed files with 68 additions and 63 deletions

View File

@ -71,7 +71,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
/* /*
* Creation repertoire si n'existe pas * Creation repertoire si n'existe pas
*/ */
$upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid); $upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid);
if (! is_dir($upload_dir)) create_exdir($upload_dir); if (! is_dir($upload_dir)) create_exdir($upload_dir);
if (is_dir($upload_dir)) if (is_dir($upload_dir))
@ -95,7 +95,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
*/ */
if ($_GET["action"] == 'delete') if ($_GET["action"] == 'delete')
{ {
$upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid); $upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid);
$file = $upload_dir . '/' . urldecode($_GET['urlfile']); $file = $upload_dir . '/' . urldecode($_GET['urlfile']);
dol_delete_file($file); dol_delete_file($file);
} }
@ -113,7 +113,7 @@ if ($objectid > 0)
$act = new ActionComm($db); $act = new ActionComm($db);
if ($act->fetch($objectid)) if ($act->fetch($objectid))
{ {
$upload_dir = $conf->actions->dir_output.'/'.sanitizeFileName($objectid); $upload_dir = $conf->commercial->dir_actions.'/'.sanitizeFileName($objectid);
$company=new Societe($db); $company=new Societe($db);
$company->fetch($act->societe->id); $company->fetch($act->societe->id);

View File

@ -107,7 +107,7 @@ if ($resql)
$name = "actions-".$obj->month."-".$obj->year.".pdf"; $name = "actions-".$obj->month."-".$obj->year.".pdf";
$relativepath= $name; $relativepath= $name;
$file = $conf->actions->dir_temp."/".$name; $file = $conf->commercial->dir_actions_temp."/".$name;
if (file_exists($file)) if (file_exists($file))
{ {

View File

@ -207,10 +207,7 @@ class Conf
$this->domaine->enabled=0; $this->domaine->enabled=0;
// Module voyage // Module voyage
$this->voyage->enabled=0; $this->voyage->enabled=0;
// Module actions
$this->actions->dir_output=DOL_DATA_ROOT."/action";
$this->actions->dir_temp =DOL_DATA_ROOT."/action/temp";
// Module oscommerce 1 // Module oscommerce 1
$this->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0; $this->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0;
$this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0; $this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0;

View File

@ -276,7 +276,7 @@ if ($modulepart)
//{ //{
$accessallowed=1; $accessallowed=1;
//} //}
$original_file=$conf->actions->dir_output.'/'.$original_file; $original_file=$conf->commercial->dir_actions.'/'.$original_file;
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='$refname'"; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='$refname'";
} }
@ -288,7 +288,7 @@ if ($modulepart)
//{ //{
$accessallowed=1; $accessallowed=1;
//} //}
$original_file = $conf->actions->dir_temp."/".$original_file; $original_file = $conf->commercial->dir_actions_temp."/".$original_file;
//$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='$refname'"; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='$refname'";
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -105,7 +106,7 @@ class CommActionRapport
$pdf=new FPDI_Protection('P','mm',$this->format); $pdf=new FPDI_Protection('P','mm',$this->format);
$pdfrights = array('print'); // Ne permet que l'impression du document $pdfrights = array('print'); // Ne permet que l'impression du document
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final $pdfuserpass = ''; // Mot de passe pour l'utilisateur final
$pdfownerpass = NULL; // Mot de passe du proprietire, cree aleatoirement si pas defini $pdfownerpass = NULL; // Mot de passe du proprietaire, cree aleatoirement si pas defini
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass); $pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
} }
else else

View File

@ -40,63 +40,70 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
class modCommercial extends DolibarrModules class modCommercial extends DolibarrModules
{ {
/**
/** * \brief Constructeur. Definit les noms, constantes et boites
* \brief Constructeur. Definit les noms, constantes et boites * \param DB Database handler
* \param DB Database handler */
*/ function modCommercial($DB)
function modCommercial($DB) {
{ $this->db = $DB ;
$this->db = $DB ; $this->numero = 2 ;
$this->numero = 2 ;
$this->family = "crm"; $this->family = "crm";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = eregi_replace('^mod','',get_class($this)); $this->name = eregi_replace('^mod','',get_class($this));
$this->description = "Gestion commercial"; $this->description = "Gestion commercial";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0; $this->special = 0;
$this->picto='commercial'; $this->picto='commercial';
// Data directories to create when module is enabled // Data directories to create when module is enabled
$this->dirs = array(); $this->dirs = array();
$r=0; $r=0;
$this->dirs[$r][0] = "output"; $this->dirs[$r][0] = "output";
$this->dirs[$r][1] = "/comm"; $this->dirs[$r][1] = "/comm";
$r++; $r++;
$this->dirs[$r][0] = "temp"; $this->dirs[$r][0] = "temp";
$this->dirs[$r][1] = "/comm/temp"; $this->dirs[$r][1] = "/comm/temp";
$r++;
$this->dirs[$r][0] = "actions";
$this->dirs[$r][1] = "/action";
$r++;
$this->dirs[$r][0] = "actions_temp";
$this->dirs[$r][1] = "/action/temp";
// Dependancies // Dependancies
$this->depends = array("modSociete"); $this->depends = array("modSociete");
$this->requiredby = array("modPropale","modContrat","modCommande","modFicheinter"); $this->requiredby = array("modPropale","modContrat","modCommande","modFicheinter");
// Constantes // Constantes
$this->const = array(); $this->const = array();
// Boxes // Boxes
$this->boxes = array(); $this->boxes = array();
// Permissions // Permissions
$this->rights = array(); $this->rights = array();
$this->rights_class = 'commercial'; $this->rights_class = 'commercial';
$r = 1; $r = 1;
// 261 : Permission generale // 261 : Permission generale
$this->rights[$r][0] = 261; $this->rights[$r][0] = 261;
$this->rights[$r][1] = 'Consulter menu commercial'; $this->rights[$r][1] = 'Consulter menu commercial';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 1;
$this->rights[$r][4] = 'main'; $this->rights[$r][4] = 'main';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
$r++; $r++;
} }
/** /**
* \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module.
@ -104,12 +111,12 @@ class modCommercial extends DolibarrModules
*/ */
function init() function init()
{ {
// Permissions // Permissions
$this->remove(); $this->remove();
$sql = array(); $sql = array();
return $this->_init($sql); return $this->_init($sql);
} }
/** /**
@ -118,9 +125,9 @@ class modCommercial extends DolibarrModules
*/ */
function remove() function remove()
{ {
$sql = array(); $sql = array();
return $this->_remove($sql); return $this->_remove($sql);
} }
} }
?> ?>