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

avec un rpertoire 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
*/
$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))
@ -95,7 +95,7 @@ if ( $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
*/
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']);
dol_delete_file($file);
}
@ -113,7 +113,7 @@ if ($objectid > 0)
$act = new ActionComm($db);
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->fetch($act->societe->id);

View File

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

View File

@ -207,10 +207,7 @@ class Conf
$this->domaine->enabled=0;
// Module voyage
$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
$this->boutique->livre->enabled=defined("BOUTIQUE_LIVRE")?BOUTIQUE_LIVRE:0;
$this->boutique->album->enabled=defined("BOUTIQUE_ALBUM")?BOUTIQUE_ALBUM:0;

View File

@ -276,7 +276,7 @@ if ($modulepart)
//{
$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'";
}
@ -288,7 +288,7 @@ if ($modulepart)
//{
$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'";
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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
* 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);
$pdfrights = array('print'); // Ne permet que l'impression du document
$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);
}
else

View File

@ -40,63 +40,70 @@ include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
class modCommercial extends DolibarrModules
{
/**
* \brief Constructeur. Definit les noms, constantes et boites
* \param DB Database handler
*/
function modCommercial($DB)
{
$this->db = $DB ;
$this->numero = 2 ;
/**
* \brief Constructeur. Definit les noms, constantes et boites
* \param DB Database handler
*/
function modCommercial($DB)
{
$this->db = $DB ;
$this->numero = 2 ;
$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)
$this->name = eregi_replace('^mod','',get_class($this));
$this->description = "Gestion commercial";
$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)
$this->name = eregi_replace('^mod','',get_class($this));
$this->description = "Gestion commercial";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->picto='commercial';
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
$this->special = 0;
$this->picto='commercial';
// Data directories to create when module is enabled
$this->dirs = array();
$r=0;
// Data directories to create when module is enabled
$this->dirs = array();
$r=0;
$this->dirs[$r][0] = "output";
$this->dirs[$r][1] = "/comm";
$this->dirs[$r][0] = "output";
$this->dirs[$r][1] = "/comm";
$r++;
$this->dirs[$r][0] = "temp";
$this->dirs[$r][1] = "/comm/temp";
$r++;
$this->dirs[$r][0] = "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
$this->depends = array("modSociete");
$this->requiredby = array("modPropale","modContrat","modCommande","modFicheinter");
// Dependancies
$this->depends = array("modSociete");
$this->requiredby = array("modPropale","modContrat","modCommande","modFicheinter");
// Constantes
$this->const = array();
// Constantes
$this->const = array();
// Boxes
$this->boxes = array();
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'commercial';
$r = 1;
// Permissions
$this->rights = array();
$this->rights_class = 'commercial';
$r = 1;
// 261 : Permission generale
$this->rights[$r][0] = 261;
$this->rights[$r][1] = 'Consulter menu commercial';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'main';
$this->rights[$r][5] = 'lire';
$r++;
}
// 261 : Permission generale
$this->rights[$r][0] = 261;
$this->rights[$r][1] = 'Consulter menu commercial';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'main';
$this->rights[$r][5] = 'lire';
$r++;
}
/**
* \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()
{
// Permissions
$this->remove();
// Permissions
$this->remove();
$sql = array();
$sql = array();
return $this->_init($sql);
return $this->_init($sql);
}
/**
@ -118,9 +125,9 @@ class modCommercial extends DolibarrModules
*/
function remove()
{
$sql = array();
$sql = array();
return $this->_remove($sql);
return $this->_remove($sql);
}
}
?>