dolibarr/htdocs/core/modules/modImport.class.php

121 lines
3.8 KiB
PHP
Raw Normal View History

2007-10-13 19:54:10 +02:00
<?php
2009-08-24 13:47:43 +02:00
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
2012-12-30 15:13:49 +01:00
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
2007-10-13 19:54:10 +02:00
*
* 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
* the Free Software Foundation; either version 3 of the License, or
2007-10-13 19:54:10 +02:00
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2011-08-01 01:24:38 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2007-10-13 19:54:10 +02:00
*/
/**
2011-08-31 12:27:17 +02:00
* \defgroup import Module import
* \brief Module to make generic import of data into dolibarr database
* \file htdocs/core/modules/modImport.class.php
2009-07-30 01:10:15 +02:00
* \ingroup import
* \brief Fichier de description et activation du module Import
2008-10-01 21:10:17 +02:00
*/
2007-10-13 19:54:10 +02:00
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
2007-10-13 19:54:10 +02:00
2012-10-03 00:30:50 +02:00
/**
* Classe de description et activation du module Import
2008-10-01 21:10:17 +02:00
*/
2007-10-13 19:54:10 +02:00
class modImport extends DolibarrModules
{
2008-10-01 21:10:17 +02:00
/**
2011-09-26 16:22:35 +02:00
* Constructor. Define names, constants, directories, boxes, permissions
*
2012-01-04 21:23:50 +01:00
* @param DoliDB $db Database handler
2008-10-01 21:10:17 +02:00
*/
function __construct($db)
2008-10-01 21:10:17 +02:00
{
2012-01-04 21:23:50 +01:00
$this->db = $db;
2008-10-01 21:10:17 +02:00
$this->numero = 250;
$this->family = "technic";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
2008-10-01 21:10:17 +02:00
$this->description = "Outils d'imports de donnees Dolibarr (via un assistant)";
// Possible values for version are: 'experimental' or 'dolibarr' or version
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
2008-10-01 21:10:17 +02:00
$this->special = 0;
2010-06-02 21:56:14 +02:00
$this->picto = 'technic';
2008-10-01 21:10:17 +02:00
// Data directories to create when module is enabled
$this->dirs = array("/import/temp");
2008-10-01 21:10:17 +02:00
// Config pages
$this->config_page_url = array();
// D<>pendances
$this->depends = array();
$this->requiredby = array();
2009-10-28 17:34:05 +01:00
$this->phpmin = array(4,3,0); // Need auto_detect_line_endings php option to solve MAC pbs.
2008-10-01 21:10:17 +02:00
$this->phpmax = array();
$this->need_dolibarr_version = array(2,7,-1); // Minimum version of Dolibarr required by module
$this->need_javascript_ajax = 1;
2008-10-01 21:10:17 +02:00
// Constantes
$this->const = array();
// Boxes
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'import';
2009-07-29 21:47:15 +02:00
$r=0;
$r++;
$this->rights[$r][0] = 1251;
$this->rights[$r][1] = 'Run mass imports of external data (data load)';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run';
2008-10-01 21:10:17 +02:00
}
/**
2012-01-04 21:23:50 +01:00
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
2008-10-01 21:10:17 +02:00
*/
2012-01-04 21:23:50 +01:00
function init($options='')
2008-10-01 21:10:17 +02:00
{
$sql = array();
2012-01-04 21:23:50 +01:00
return $this->_init($sql,$options);
2008-10-01 21:10:17 +02:00
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
2008-10-01 21:10:17 +02:00
$sql = array();
return $this->_remove($sql,$options);
}
2007-10-13 19:54:10 +02:00
}
?>