From ffa1c8d4515ae84f01d028d86d5bfe258be850f7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 21 Apr 2010 06:22:57 +0000 Subject: [PATCH] Works on workflow --- .../modules/DolibarrModules.class.php | 4 +- htdocs/includes/modules/modWorkflow.class.php | 181 ++++++++++++++++++ htdocs/workflow/admin/workflow.php | 59 ++++++ htdocs/workflow/img/object_workflow.png | Bin 0 -> 655 bytes htdocs/workflow/tpl/add-workflow.tpl.php | 25 +++ htdocs/workflow/tpl/admin-workflow.tpl.php | 25 +++ htdocs/workflow/tpl/edi-workflow.tpl.php | 25 +++ htdocs/workflow/tpl/index.php | 0 htdocs/workflow/tpl/view-workflow.tpl.php | 25 +++ 9 files changed, 342 insertions(+), 2 deletions(-) create mode 100644 htdocs/includes/modules/modWorkflow.class.php create mode 100644 htdocs/workflow/admin/workflow.php create mode 100644 htdocs/workflow/img/object_workflow.png create mode 100644 htdocs/workflow/tpl/add-workflow.tpl.php create mode 100644 htdocs/workflow/tpl/admin-workflow.tpl.php create mode 100644 htdocs/workflow/tpl/edi-workflow.tpl.php create mode 100644 htdocs/workflow/tpl/index.php create mode 100644 htdocs/workflow/tpl/view-workflow.tpl.php diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index 1149c489636..76685a5958a 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -3,8 +3,8 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2009 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin * * 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 diff --git a/htdocs/includes/modules/modWorkflow.class.php b/htdocs/includes/modules/modWorkflow.class.php new file mode 100644 index 00000000000..63ff00edd94 --- /dev/null +++ b/htdocs/includes/modules/modWorkflow.class.php @@ -0,0 +1,181 @@ + + * + * 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 workflow Module workflow + * \brief Workflow management + * \version $Id$ + */ + +/** + * \file htdocs/includes/modules/modWorkflow.class.php + * \ingroup workflow + * \brief Fichier de description et activation du module Workflow + */ + +include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); + + +/** + * \class modWorkflow + * \brief Classe de description et activation du module Workflow + */ +class modWorkflow extends DolibarrModules +{ + + /** + * \brief Constructeur. Definit les noms, constantes et boites + * \param DB handler d'acces base + */ + function modWorkflow($DB) + { + $this->db = $DB ; + + // Id for module (must be unique). + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). + $this->numero = 6000 ; + // Key text used to identify module (for permissions, menus, etc...) + $this->rights_class = 'workflow'; + + $this->family = "base"; + // 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)); + // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) + $this->description = "Workflow management"; + // Can be enabled / disabled only in the main company with superadmin account + $this->core_enabled = 0; + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); + // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) + $this->special = 0; + // Name of png file (without png) used for this module. + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' + $this->picto='workflow@workflow'; + + // Defined if the directory /mymodule/inc/triggers/ contains triggers or not + $this->triggers = 0; + + // Data directories to create when module is enabled + $this->dirs = array("/workflow/temp"); + + // Relative path to module style sheet if exists. Example: '/mymodule/mycss.css'. + //$this->style_sheet = '/workflow/css/workflow.css.php'; + + // Config pages. Put here list of php page names stored in admmin directory used to setup module. + $this->config_page_url = 'workflow.php@workflow'; + + // Dependencies + $this->depends = array(); // List of modules id that must be enabled if this module is enabled + $this->requiredby = array(); // List of modules id to disable if this one is disabled + $this->phpmin = array(5,2); // Minimum version of PHP required by module + $this->need_dolibarr_version = array(2,8); // Minimum version of Dolibarr required by module + $this->langfiles = array("@workflow"); + + // Constants + // List of particular constants to add when module is enabled + //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), + // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); + $this->const=array(); + + // Boxes + $this->boxes = array(); + //$this->boxes[0][1] = "box_workflow@workflow"; + + // Permissions + $this->rights = array(); + $r=0; + + /* + $r++; + $this->rights[$r][0] = 6001; // id de la permission + $this->rights[$r][1] = "Lire les workflow"; // libelle de la permission + $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) + $this->rights[$r][3] = 1; // La permission est-elle une permission par defaut + $this->rights[$r][4] = 'read'; + */ + + // Main menu entries + $this->menus = array(); // List of menus to add + $r=0; + /* + $this->menu[$r]=array('fk_menu'=>0, + 'type'=>'top', + 'titre'=>'Workflow', + 'mainmenu'=>'workflow', + 'leftmenu'=>'1', + 'url'=>'/workflow/index.php', + 'langs'=>'@workflow', + 'position'=>100, + 'perms'=>'$user->rights->workflow->read', + 'enabled'=>'$conf->workflow->enabled', + 'target'=>'', + 'user'=>0); + $r++; + + $this->menu[$r]=array( 'fk_menu'=>'r=0', + 'type'=>'left', + 'titre'=>'Workflow', + 'mainmenu'=>'workflow', + 'url'=>'/workflow/index.php', + 'langs'=>'@workflow', + 'position'=>101, + 'enabled'=>1, + 'perms'=>'$user->rights->workflow->read', + 'target'=>'', + 'user'=>0); + $r++; + */ + } + + + /** + * \brief Fonction appelee lors de l'activation du module. Insere en base les constantes, boites, permissions du module. + * Definit egalement les repertoires de donnees a creer pour ce module. + */ + function init() + { + //$result=$this->load_tables(); + + return $this->_init($sql); + } + + /** + * \brief Fonction appelee lors de la desactivation d'un module. + * Supprime de la base les constantes, boites et permissions du module. + */ + function remove() + { + $sql = array(); + + return $this->_remove($sql); + } + + /** + * \brief Create tables and keys required by module + * This function is called by this->init. + * \return int <=0 if KO, >0 if OK + */ + function load_tables() + { + return $this->_load_tables('/workflow/sql/'); + } +} +?> diff --git a/htdocs/workflow/admin/workflow.php b/htdocs/workflow/admin/workflow.php new file mode 100644 index 00000000000..0ccf0bf6a62 --- /dev/null +++ b/htdocs/workflow/admin/workflow.php @@ -0,0 +1,59 @@ + + * + * 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. + */ + +/** + * \file htdocs/admin/workflow.php + * \ingroup workflow + * \brief Page d'administration/configuration du module Workflow + * \version $Id$ + */ + +require("../../main.inc.php"); +//require_once(DOL_DOCUMENT_ROOT."/workflow/class/workflow.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); + +$langs->load("admin"); + +if (!$user->admin || $user->entity) +accessforbidden(); + +//$wf = new Workflow($db); + +/* + * Actions + */ + + + +/* + * View + */ + +llxHeader('',$langs->trans("WorkflowSetup")); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans("WorkflowSetup"),$linkback,'setup'); + +print '
'; + +$template_dir = DOL_DOCUMENT_ROOT.'/workflow/tpl/'; + + +llxFooter('$Date$ - $Revision$'); +?> \ No newline at end of file diff --git a/htdocs/workflow/img/object_workflow.png b/htdocs/workflow/img/object_workflow.png new file mode 100644 index 0000000000000000000000000000000000000000..b929050598d10d851b4bca1299e8cd75514a41cc GIT binary patch literal 655 zcmV;A0&x9_P)`xW z!{Lw=MWM-LV$|#Pmq`9;;qnNIsj7Mri9{$I4ihKOW;3zbW*^@<9F8Eza*l!?Oi)_` zjT(&xt=DT>E|;PTFRt!#xd^~qk#@V?db{14ayp&9g7a-G7SmR%72N|=4a0Z?``co% z2mx5PSS;l6c&O9qJb}+D=W@Bbd_M0RkHcDqg8Zub>>`;LOYKzD-vUUY4gr?IeRVtMpKtCwByn)dj300vL!`?A$)U2-K|*F_7Q$bupE9awy3RV`Ml z)eWfy4I~KplgXr@*z5JUXL3571d&)(6(f=qa5r)I-S77ePziExqtS?(&8A3XrMWjw z#25@D)wo}&P$-C30>^Wx_6SZ^@na^F336h!TJ3}CYuveT`~!AnW+vV$8+b-P&d&^0 p!Vuy5Ug1vw`g)E#{|NsC7yzo}QT`99$FKkZ002ovPDHLkV1izUCSd>o literal 0 HcmV?d00001 diff --git a/htdocs/workflow/tpl/add-workflow.tpl.php b/htdocs/workflow/tpl/add-workflow.tpl.php new file mode 100644 index 00000000000..4a17dcd09d3 --- /dev/null +++ b/htdocs/workflow/tpl/add-workflow.tpl.php @@ -0,0 +1,25 @@ + + * + * 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$ + */ +?> + + + + + \ No newline at end of file diff --git a/htdocs/workflow/tpl/admin-workflow.tpl.php b/htdocs/workflow/tpl/admin-workflow.tpl.php new file mode 100644 index 00000000000..4a17dcd09d3 --- /dev/null +++ b/htdocs/workflow/tpl/admin-workflow.tpl.php @@ -0,0 +1,25 @@ + + * + * 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$ + */ +?> + + + + + \ No newline at end of file diff --git a/htdocs/workflow/tpl/edi-workflow.tpl.php b/htdocs/workflow/tpl/edi-workflow.tpl.php new file mode 100644 index 00000000000..4a17dcd09d3 --- /dev/null +++ b/htdocs/workflow/tpl/edi-workflow.tpl.php @@ -0,0 +1,25 @@ + + * + * 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$ + */ +?> + + + + + \ No newline at end of file diff --git a/htdocs/workflow/tpl/index.php b/htdocs/workflow/tpl/index.php new file mode 100644 index 00000000000..e69de29bb2d diff --git a/htdocs/workflow/tpl/view-workflow.tpl.php b/htdocs/workflow/tpl/view-workflow.tpl.php new file mode 100644 index 00000000000..4a17dcd09d3 --- /dev/null +++ b/htdocs/workflow/tpl/view-workflow.tpl.php @@ -0,0 +1,25 @@ + + * + * 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$ + */ +?> + + + + + \ No newline at end of file