diff --git a/htdocs/telephonie/config/xdsl_wkf.php b/htdocs/telephonie/config/xdsl_wkf.php new file mode 100644 index 00000000000..122e455796d --- /dev/null +++ b/htdocs/telephonie/config/xdsl_wkf.php @@ -0,0 +1,153 @@ + + * + * 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$ + * $Source$ + */ + +/** + \file htdocs/telephonie/config/xdsl.php + \ingroup telephonie + \brief Page configuration telephonie + \version $Revision$ +*/ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT.'/fourn/fournisseur.class.php'); +require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/ligneadsl.class.php'); +require_once(DOL_DOCUMENT_ROOT.'/telephonie/adsl/fournisseurxdsl.class.php'); +require_once(DOL_DOCUMENT_ROOT.'/telephonie/workflowtel.class.php'); + +$langs->load("admin"); +$langs->load("suppliers"); +$langs->load("products"); + +if (!$user->admin) accessforbidden(); + +$ligne = new LigneAdsl($db); + +if ($_GET["action"] == "add") +{ + $wkf = new WorkflowTelephonie($db); + $wkf->create("xdsl",$_POST["wkf_user"],$_POST["wkf_statut"]); + + Header("Location: xdsl_wkf.php"); +} + +if ($_GET["action"] == "delete") +{ + $wkf = new WorkflowTelephonie($db); + $wkf->delete("xdsl",$_GET["wkf_user"],$_GET["wkf_statut"]); + + Header("Location: xdsl_wkf.php"); +} + +/* + * + * + * + */ +llxHeader('','Téléphonie - Configuration - Liens xDSL - Workflow'); + +$h=0; +$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl.php"; +$head[$h][1] = $langs->trans("Suppliers"); +$h++; + +$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_product.php"; +$head[$h][1] = $langs->trans("Products"); +$h++; + +$head[$h][0] = DOL_URL_ROOT."/telephonie/config/xdsl_wkf.php"; +$head[$h][1] = $langs->trans("Workflow"); +$hselected = $h; +$h++; + + +dolibarr_fiche_head($head, $hselected, "Configuration des liens xDSL"); + +print_titre("Workflow"); +print '
'; +print ''; + +$form = new Form($db); +$fourn = new Fournisseur($db,0,$user); +$fourns = $fourn->ListArray(); + +$xfourn = new FournisseurXdsl($db,0,$user); +$xfourns = $xfourn->ListArray(); + +$uss = array(); +$sql = "SELECT u.rowid, u.firstname, u.name"; +$sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."usergroup_user as ug"; +$sql .= " WHERE u.rowid = ug.fk_user"; +$sql .= " AND ug.fk_usergroup = '".TELEPHONIE_GROUPE_COMMERCIAUX_ID."'"; +$sql .= " ORDER BY name "; +if ( $resql = $db->query( $sql) ) +{ + while ($row = $db->fetch_row($resql)) + { + $uss[$row[0]] = $row[1] . " " . $row[2]; + } + $db->free($resql); +} + +/* ***************************************** */ + +print ''; +print ''; + +print ''; +print ''; +print ''; +print "\n"; + +$sql = "SELECT u.rowid, u.firstname, u.name, u.email, w.fk_statut"; +$sql .= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."telephonie_workflow as w"; +$sql .= " WHERE u.rowid = w.fk_user AND w.module = 'xdsl'"; +$sql .= " ORDER BY u.name, u.firstname "; +if ( $resql = $db->query( $sql) ) +{ + while ($row = $db->fetch_row($resql)) + { + $var=!$var; + print ""; + print ''; + print ''; + print ''; + print ''; + } + $db->free($resql); +} + + +print '
Ajouter une alerte pour l\'utilisateur'; + +$form->select_array("wkf_user",$uss); +print ' sur l\'action '; +$form->select_array("wkf_statut",$ligne->statuts); + +print ''; +print '
UtilisateurEmailStatut notifie 
'.$row[1].' '.$row[2].''.$row[3].''.$ligne->statuts[$row[4]].''; + print img_delete(); + print '
'; +print '
'; + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/telephonie/sql/llx_telephonie_workflow.sql b/htdocs/telephonie/sql/llx_telephonie_workflow.sql new file mode 100644 index 00000000000..bbdc7920d7a --- /dev/null +++ b/htdocs/telephonie/sql/llx_telephonie_workflow.sql @@ -0,0 +1,33 @@ +-- ======================================================================== +-- Copyright (C) 2007 Rodolphe Quiedeville +-- +-- 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$ +-- $Source$ +-- +-- ======================================================================== + +create table llx_telephonie_workflow ( + module enum('xdsl','pre'), + fk_user integer, + fk_statut integer + + + +)type=innodb; + +ALTER TABLE llx_telephonie_workflow ADD INDEX idx_telephonie_workflow_module (module); +ALTER TABLE llx_telephonie_workflow ADD UNIQUE INDEX uk_telephonie_workflow_user_statut (fk_user,fk_statut,module); \ No newline at end of file