From 3b2453832935e6e579f373934284b87d99c17fd0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 29 Jun 2010 15:10:07 +0000 Subject: [PATCH] Fix: move to external module --- htdocs/multicompany/admin/multicompany.php | 110 --------- .../multicompany/class/multicompany.class.php | 217 ------------------ htdocs/multicompany/index.php | 0 htdocs/multicompany/sql/init_new_entity.sql | 156 ------------- htdocs/multicompany/tpl/add-entity.tpl | 24 -- htdocs/multicompany/tpl/admin-entity.tpl | 82 ------- htdocs/multicompany/tpl/edit-entity.tpl | 24 -- htdocs/multicompany/tpl/index.php | 0 htdocs/multicompany/tpl/view-entity.tpl | 24 -- 9 files changed, 637 deletions(-) delete mode 100644 htdocs/multicompany/admin/multicompany.php delete mode 100644 htdocs/multicompany/class/multicompany.class.php delete mode 100644 htdocs/multicompany/index.php delete mode 100644 htdocs/multicompany/sql/init_new_entity.sql delete mode 100644 htdocs/multicompany/tpl/add-entity.tpl delete mode 100644 htdocs/multicompany/tpl/admin-entity.tpl delete mode 100644 htdocs/multicompany/tpl/edit-entity.tpl delete mode 100644 htdocs/multicompany/tpl/index.php delete mode 100644 htdocs/multicompany/tpl/view-entity.tpl diff --git a/htdocs/multicompany/admin/multicompany.php b/htdocs/multicompany/admin/multicompany.php deleted file mode 100644 index c52f0de2556..00000000000 --- a/htdocs/multicompany/admin/multicompany.php +++ /dev/null @@ -1,110 +0,0 @@ - - * - * 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/multicompany.php - * \ingroup multicompany - * \brief Page d'administration/configuration du module Multi-societe - * \version $Id$ - */ - -require("../../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/multicompany/class/multicompany.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(); - -$mc = new Multicompany($db); - -/* - * Actions - */ - -if ($_GET["action"] == 'setactive') -{ - $mc->setEntity($_GET['id'],'active',$_GET["value"]); - if ($_GET["value"] == 0) $mc->setEntity($_GET['id'],'visible',$_GET["value"]); -} - -if ($_GET["action"] == 'setvisible') -{ - $mc->setEntity($_GET['id'],'visible',$_GET["value"]); -} - - - -/* - * View - */ - -llxHeader('',$langs->trans("MultiCompanySetup")); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("MultiCompanySetup"),$linkback,'setup'); - -print '
'; - -$smarty->template_dir = DOL_DOCUMENT_ROOT.'/multicompany/tpl/'; - -/* - * Create - */ - -if ($_GET["action"] == 'create') -{ - print_titre($langs->trans("AddEntity")); - - $template = 'add-entity.tpl'; -} - -/* - * Edit - */ - -else if ($_GET["action"] == 'modify') -{ - print_titre($langs->trans("EditEntity")); - - $template = 'edit-entity.tpl'; -} - -/* - * View - */ - -else -{ - print_titre($langs->trans("ListOfEntities")); - - $mc->getEntities(1); - //var_dump($mc->entities); - - $template = 'admin-entity.tpl'; - -} - -$mc->assign_smarty_values($smarty,$_GET["action"]); -$smarty->display($template); - - -llxFooter('$Date$ - $Revision$'); -?> \ No newline at end of file diff --git a/htdocs/multicompany/class/multicompany.class.php b/htdocs/multicompany/class/multicompany.class.php deleted file mode 100644 index 82ec1be6789..00000000000 --- a/htdocs/multicompany/class/multicompany.class.php +++ /dev/null @@ -1,217 +0,0 @@ - - * - * 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/multicompany/multicompany.class.php - * \ingroup multicompany - * \brief File Class multicompany - * \version $Id$ - */ - - -/** - * \class Multicompany - * \brief Class of the module multicompany - */ -class Multicompany -{ - var $db; - var $error; - //! Numero de l'erreur - var $errno = 0; - - var $entities = array(); - - /** - * \brief Constructeur de la classe - * \param DB Handler acces base de donnees - * \param id Id produit (0 par defaut) - */ - function Multicompany($DB) - { - $this->db = $DB; - - $this->canvas = "default"; - $this->name = "admin"; - $this->description = ""; - } - - /** - * \brief Creation - */ - function Create($user,$datas) - { - - } - - /** - * \brief Supression - */ - function Delete($id) - { - - } - - /** - * \brief Fetch entity - */ - function fetch($id) - { - global $conf; - - $sql = "SELECT "; - $sql.= $this->db->decrypt('name')." as name"; - $sql.= ", ".$this->db->decrypt('value')." as value"; - $sql.= " FROM ".MAIN_DB_PREFIX."const"; - $sql.= " WHERE ".$this->db->decrypt('name')." LIKE 'MAIN_%'"; - $sql.= " AND entity = ".$id; - - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows($result); - $entityDetails = array(); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($result); - - if (preg_match('/^MAIN_INFO_SOCIETE_PAYS$/i',$obj->name)) - { - $entityDetails[$obj->name] = getCountry($obj->value); - } - else if (preg_match('/^MAIN_MONNAIE$/i',$obj->name)) - { - $entityDetails[$obj->name] = currency_name($obj->value); - } - else - { - $entityDetails[$obj->name] = $obj->value; - } - - $i++; - } - return $entityDetails; - } - - } - - /** - * \brief Enable/disable entity - */ - function setEntity($id, $type='active', $value) - { - global $conf; - - $sql = "UPDATE ".MAIN_DB_PREFIX."entity"; - $sql.= " SET ".$type." = ".$value; - $sql.= " WHERE rowid = ".$id; - - dol_syslog("Multicompany::setEntity sql=".$sql, LOG_DEBUG); - - $result = $this->db->query($sql); - } - - /** - * \brief List of entities - */ - function getEntities($details=0,$visible=0) - { - global $conf; - - $sql = "SELECT rowid, label, description, visible, active"; - $sql.= " FROM ".MAIN_DB_PREFIX."entity"; - if ($visible) $sql.= " WHERE visible = 1"; - - $result = $this->db->query($sql); - if ($result) - { - $num = $this->db->num_rows($result); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($result); - - $this->entities[$i]['id'] = $obj->rowid; - $this->entities[$i]['label'] = $obj->label; - $this->entities[$i]['description'] = $obj->description; - $this->entities[$i]['visible'] = $obj->visible; - $this->entities[$i]['active'] = $obj->active; - if ($details) $this->entities[$i]['details'] = $this->fetch($obj->rowid); - - $i++; - } - } - - } - - /** - * \brief Return combo list of entities. - * \param entities Entities array - * \param selected Preselected entity - */ - function select_entities($entities,$selected='',$option='') - { - $return = '