Fix: add debug mode and change with new module parts management

This commit is contained in:
Regis Houssin 2012-02-23 20:42:25 +01:00
parent ee80305e6c
commit 673fbc457d
2 changed files with 13 additions and 15 deletions

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2012 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
@ -31,6 +31,7 @@ $langs->load("admin");
if (! $user->admin) accessforbidden();
$action = GETPOST('action');
$debug = GETPOST('debug');
$typeconst=array('yesno','texte','chaine');
@ -182,7 +183,7 @@ print '</tr>';
print '</form>';
print "\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<form action="'.$_SERVER["PHP_SELF"].((empty($user->entity) && $debug)?'?debug=1':'').'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// Show constants
@ -195,7 +196,8 @@ $sql.= ", note";
$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
if ($user->entity || empty($conf->multicompany->enabled)) $sql.= " AND visible = 1";
if (empty($user->entity) && $debug) {} // to force for superadmin
elseif ($user->entity || empty($conf->multicompany->enabled)) $sql.= " AND visible = 1";
$sql.= " ORDER BY entity, name ASC";
dol_syslog("Const::listConstant sql=".$sql);
@ -249,7 +251,7 @@ if ($result)
}
else
{
print '<a href="const.php?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete">'.img_delete().'</a>';
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete'.((empty($user->entity) && $debug)?'&debug=1':'').'">'.img_delete().'</a>';
}
print "</td></tr>\n";
@ -275,8 +277,7 @@ if ($conf->use_javascript_ajax)
print "</form>\n";
llxFooter();
$db->close();
llxFooter();
?>

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2010-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
@ -39,7 +39,7 @@ class modWorkflow extends DolibarrModules
*
* @param DoliDB $db Database handler
*/
function modWorkflow($db)
function __construct($db)
{
$this->db = $db;
@ -65,17 +65,14 @@ class modWorkflow extends DolibarrModules
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='technic';
// Defined if the directory /mymodule/core/triggers/ contains triggers or not
$this->triggers = 1;
// 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 = '';
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
$this->config_page_url = 'workflow.php';
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array('triggers' => 1);
// Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled