Works on milestone module
This commit is contained in:
parent
0895f0acba
commit
6bd01ce7d2
133
htdocs/includes/modules/modMilestone.class.php
Normal file
133
htdocs/includes/modules/modMilestone.class.php
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2010 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (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
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \defgroup milestone Milestone module
|
||||||
|
* \brief Module to manage milestones
|
||||||
|
* \version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/includes/modules/modMilestone.class.php
|
||||||
|
* \ingroup milestone
|
||||||
|
* \brief Fichier de description et activation du module Milestone
|
||||||
|
*/
|
||||||
|
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class modMilestone
|
||||||
|
* \brief Classe de description et activation du module Milestone
|
||||||
|
*/
|
||||||
|
class modMilestone extends DolibarrModules
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* \brief Constructeur. definit les noms, constantes et boites
|
||||||
|
* \param DB handler d'acces base
|
||||||
|
*/
|
||||||
|
function modMilestone ($DB)
|
||||||
|
{
|
||||||
|
$this->db = $DB;
|
||||||
|
$this->numero = 1790;
|
||||||
|
|
||||||
|
$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));
|
||||||
|
$this->description = "Gestion des jalons (projets, contrats, propales, ...)";
|
||||||
|
|
||||||
|
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||||
|
$this->version = 'development';
|
||||||
|
|
||||||
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
|
$this->special = 2;
|
||||||
|
$this->picto = 'category';
|
||||||
|
|
||||||
|
// Data directories to create when module is enabled
|
||||||
|
$this->dirs = array();
|
||||||
|
|
||||||
|
// Dependencies
|
||||||
|
$this->depends = array();
|
||||||
|
|
||||||
|
// Config pages
|
||||||
|
$this->config_page_url = array();
|
||||||
|
$this->langfiles = array("milestone");
|
||||||
|
|
||||||
|
// Constantes
|
||||||
|
$this->const = array();
|
||||||
|
|
||||||
|
// Boxes
|
||||||
|
$this->boxes = array();
|
||||||
|
|
||||||
|
// Permissions
|
||||||
|
$this->rights = array();
|
||||||
|
$this->rights_class = 'milestone';
|
||||||
|
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
$this->rights[$r][0] = 1791; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Lire les jalons'; // libelle de la permission
|
||||||
|
$this->rights[$r][2] = 'r'; // type de la permission (deprecated)
|
||||||
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'lire';
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->rights[$r][0] = 1792; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Creer/modifier les jalons'; // libelle de la permission
|
||||||
|
$this->rights[$r][2] = 'w'; // type de la permission (deprecated)
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'creer';
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->rights[$r][0] = 1793; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Supprimer les jalons'; // libelle de la permission
|
||||||
|
$this->rights[$r][2] = 'd'; // type de la permission (deprecated)
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'supprimer';
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief 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.
|
||||||
|
* \return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_init($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Function called when module is disabled.
|
||||||
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||||
|
* Data directories are not deleted.
|
||||||
|
* \return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function remove()
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_remove($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -169,28 +169,6 @@ ALTER TABLE llx_projet ADD COLUMN note_public text AFTER note_private;
|
|||||||
ALTER TABLE llx_projet MODIFY fk_statut smallint DEFAULT 0 NOT NULL;
|
ALTER TABLE llx_projet MODIFY fk_statut smallint DEFAULT 0 NOT NULL;
|
||||||
ALTER TABLE llx_projet MODIFY fk_user_creat integer NOT NULL;
|
ALTER TABLE llx_projet MODIFY fk_user_creat integer NOT NULL;
|
||||||
|
|
||||||
-- Add project milestone
|
|
||||||
create table llx_projet_milestone
|
|
||||||
(
|
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
|
||||||
fk_projet integer NOT NULL,
|
|
||||||
label varchar(255) NOT NULL,
|
|
||||||
description text,
|
|
||||||
datec datetime,
|
|
||||||
tms timestamp,
|
|
||||||
dateo datetime,
|
|
||||||
datee datetime,
|
|
||||||
priority integer DEFAULT 0,
|
|
||||||
fk_user_creat integer,
|
|
||||||
rang integer DEFAULT 0
|
|
||||||
)type=innodb;
|
|
||||||
|
|
||||||
ALTER TABLE llx_projet_milestone ADD INDEX idx_projet_milestone_fk_projet (fk_projet);
|
|
||||||
ALTER TABLE llx_projet_milestone ADD INDEX idx_projet_milestone_fk_user_creat (fk_user_creat);
|
|
||||||
|
|
||||||
ALTER TABLE llx_projet_milestone ADD CONSTRAINT fk_projet_milestone_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
|
|
||||||
ALTER TABLE llx_projet_milestone ADD CONSTRAINT fk_projet_milestone_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
|
|
||||||
|
|
||||||
-- Uniformize code: change tva_taux to tva_tx
|
-- Uniformize code: change tva_taux to tva_tx
|
||||||
ALTER TABLE llx_facturedet CHANGE tva_taux tva_tx real;
|
ALTER TABLE llx_facturedet CHANGE tva_taux tva_tx real;
|
||||||
ALTER TABLE llx_facture_fourn_det CHANGE tva_taux tva_tx double(6,3);
|
ALTER TABLE llx_facture_fourn_det CHANGE tva_taux tva_tx double(6,3);
|
||||||
|
|||||||
@ -163,3 +163,34 @@ INSERT INTO `llx_c_field_list` (`rowid`, `element`, `entity`, `name`, `alias`, `
|
|||||||
|
|
||||||
UPDATE llx_adherent SET pays = null where pays <= 0 and pays != '0';
|
UPDATE llx_adherent SET pays = null where pays <= 0 and pays != '0';
|
||||||
ALTER table llx_adherent MODIFY pays integer;
|
ALTER table llx_adherent MODIFY pays integer;
|
||||||
|
|
||||||
|
-- add milestone module
|
||||||
|
DROP TABLE llx_projet_milestone;
|
||||||
|
create table llx_milestone
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
label varchar(255) NOT NULL,
|
||||||
|
description text,
|
||||||
|
datec datetime,
|
||||||
|
tms timestamp,
|
||||||
|
dateo datetime,
|
||||||
|
datee datetime,
|
||||||
|
priority integer DEFAULT 0,
|
||||||
|
fk_user_creat integer,
|
||||||
|
rang integer DEFAULT 0
|
||||||
|
)type=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_milestone ADD INDEX idx_milestone_fk_user_creat (fk_user_creat);
|
||||||
|
ALTER TABLE llx_milestone ADD CONSTRAINT fk_milestone_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
|
||||||
|
|
||||||
|
create table llx_element_milestone
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_element integer NOT NULL,
|
||||||
|
elementtype varchar(16) NOT NULL,
|
||||||
|
fk_milestone integer NOT NULL
|
||||||
|
) type=innodb;
|
||||||
|
|
||||||
|
ALTER TABLE llx_element_milestone ADD UNIQUE INDEX idx_element_milestone_idx1 (fk_element, elementtype, fk_milestone);
|
||||||
|
ALTER TABLE llx_element_milestone ADD INDEX idx_element_milestone_fk_milestone (fk_milestone);
|
||||||
|
ALTER TABLE llx_element_milestone ADD CONSTRAINT fk_element_milestone_fk_milestone FOREIGN KEY (fk_milestone) REFERENCES llx_milestone(rowid);
|
||||||
29
htdocs/install/mysql/tables/llx_element_milestone.key.sql
Normal file
29
htdocs/install/mysql/tables/llx_element_milestone.key.sql
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2010 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
|
||||||
|
-- the Free Software Foundation; either version 2 of the License, or
|
||||||
|
-- (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
|
||||||
|
-- along with this program; if not, write to the Free Software
|
||||||
|
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE llx_element_milestone ADD UNIQUE INDEX idx_element_milestone_idx1 (fk_element, elementtype, fk_milestone);
|
||||||
|
|
||||||
|
ALTER TABLE llx_element_milestone ADD INDEX idx_element_milestone_fk_milestone (fk_milestone);
|
||||||
|
|
||||||
|
ALTER TABLE llx_element_milestone ADD CONSTRAINT fk_element_milestone_fk_milestone FOREIGN KEY (fk_milestone) REFERENCES llx_milestone(rowid);
|
||||||
|
|
||||||
|
-- Pas de contrainte sur fk_element car pointe sur differentes tables
|
||||||
|
|
||||||
28
htdocs/install/mysql/tables/llx_element_milestone.sql
Normal file
28
htdocs/install/mysql/tables/llx_element_milestone.sql
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-- ============================================================================
|
||||||
|
-- Copyright (C) 2010 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
|
||||||
|
-- the Free Software Foundation; either version 2 of the License, or
|
||||||
|
-- (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
|
||||||
|
-- along with this program; if not, write to the Free Software
|
||||||
|
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
--
|
||||||
|
-- $Id$
|
||||||
|
-- ============================================================================
|
||||||
|
|
||||||
|
create table llx_element_milestone
|
||||||
|
(
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_element integer NOT NULL,
|
||||||
|
elementtype varchar(16) NOT NULL,
|
||||||
|
fk_milestone integer NOT NULL
|
||||||
|
) type=innodb;
|
||||||
|
|
||||||
@ -20,8 +20,6 @@
|
|||||||
-- ============================================================================
|
-- ============================================================================
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_projet_milestone ADD INDEX idx_projet_milestone_fk_projet (fk_projet);
|
ALTER TABLE llx_milestone ADD INDEX idx_milestone_fk_user_creat (fk_user_creat);
|
||||||
ALTER TABLE llx_projet_milestone ADD INDEX idx_projet_milestone_fk_user_creat (fk_user_creat);
|
|
||||||
|
|
||||||
ALTER TABLE llx_projet_milestone ADD CONSTRAINT fk_projet_milestone_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
|
ALTER TABLE llx_milestone ADD CONSTRAINT fk_milestone_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
|
||||||
ALTER TABLE llx_projet_milestone ADD CONSTRAINT fk_projet_milestone_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user (rowid);
|
|
||||||
@ -18,10 +18,9 @@
|
|||||||
-- $Id$
|
-- $Id$
|
||||||
-- ===========================================================================
|
-- ===========================================================================
|
||||||
|
|
||||||
create table llx_projet_milestone
|
create table llx_milestone
|
||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_projet integer NOT NULL,
|
|
||||||
label varchar(255) NOT NULL,
|
label varchar(255) NOT NULL,
|
||||||
description text,
|
description text,
|
||||||
datec datetime, -- date creation
|
datec datetime, -- date creation
|
||||||
@ -29,6 +28,6 @@ create table llx_projet_milestone
|
|||||||
dateo datetime, -- date start milestone
|
dateo datetime, -- date start milestone
|
||||||
datee datetime, -- date end milestone
|
datee datetime, -- date end milestone
|
||||||
priority integer DEFAULT 0, -- priority
|
priority integer DEFAULT 0, -- priority
|
||||||
fk_user_creat integer, -- user who created the task
|
fk_user_creat integer, -- user who created the milestone
|
||||||
rang integer DEFAULT 0
|
rang integer DEFAULT 0
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
Loading…
Reference in New Issue
Block a user