Skip to content
Snippets Groups Projects
Commit 7e380bb2 authored by Juanjo Menent's avatar Juanjo Menent
Browse files

Uniformize code. visual enhancement

parent dd8f52a7
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
......@@ -22,7 +23,7 @@
* \file htdocs/admin/societe.php
* \ingroup company
* \brief Third party module setup page
* \version $Id: societe.php,v 1.62 2011/08/16 16:49:24 simnandez Exp $
* \version $Id: societe.php,v 1.63 2011/08/17 07:50:29 simnandez Exp $
*/
require("../main.inc.php");
......@@ -34,10 +35,12 @@ $langs->load("admin");
if (!$user->admin)
accessforbidden();
$action=GETPOST("action");
/*
* Actions
*/
if ($_GET["action"] == 'setcodeclient')
if ($action == 'setcodeclient')
{
if (dolibarr_set_const($db, "SOCIETE_CODECLIENT_ADDON",$_GET["value"],'chaine',0,'',$conf->entity) > 0)
{
......@@ -50,7 +53,7 @@ if ($_GET["action"] == 'setcodeclient')
}
}
if ($_GET["action"] == 'setcodecompta')
if ($action == 'setcodecompta')
{
if (dolibarr_set_const($db, "SOCIETE_CODECOMPTA_ADDON",$_GET["value"],'chaine',0,'',$conf->entity) > 0)
{
......@@ -63,7 +66,7 @@ if ($_GET["action"] == 'setcodecompta')
}
}
if ($_POST["action"] == 'COMPANY_USE_SEARCH_TO_SELECT')
if ($action == 'COMPANY_USE_SEARCH_TO_SELECT')
{
if (dolibarr_set_const($db, "COMPANY_USE_SEARCH_TO_SELECT", $_POST["activate_COMPANY_USE_SEARCH_TO_SELECT"],'chaine',0,'',$conf->entity))
{
......@@ -77,7 +80,7 @@ if ($_POST["action"] == 'COMPANY_USE_SEARCH_TO_SELECT')
}
// define constants for models generator that need parameters
if ($_POST["action"] == 'setModuleOptions')
if ($action == 'setModuleOptions')
{
$post_size=count($_POST);
for($i=0;$i < $post_size;$i++)
......@@ -92,7 +95,7 @@ if ($_POST["action"] == 'setModuleOptions')
}
// Activate a document generator module
if ($_GET["action"] == 'set')
if ($action == 'set')
{
$type='company';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
......@@ -108,7 +111,7 @@ if ($_GET["action"] == 'set')
}
// Disable a document generator module
if ($_GET["action"] == 'del')
if ($action== 'del')
{
$type='company';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
......@@ -121,7 +124,7 @@ if ($_GET["action"] == 'del')
}
// Define default generator
if ($_GET["action"] == 'setdoc')
if ($action == 'setdoc')
{
$db->begin();
......@@ -158,7 +161,7 @@ if ($_GET["action"] == 'setdoc')
}
//Activate ProfId
if ($_GET["action"] == 'setprofid')
if ($action == 'setprofid')
{
$idprof="SOCIETE_IDPROF".$_GET["value"]."_UNIQUE";
if (dolibarr_set_const($db, $idprof,$_GET["status"],'chaine',0,'',$conf->entity) > 0)
......@@ -179,7 +182,7 @@ if ($_GET["action"] == 'setprofid')
$form=new Form($db);
$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers';
$help_url='EN:Module Third Parties setup|FR:Paramétrage_du_module_Tiers|ES:Configuración_del_módulo_terceros';
llxHeader('',$langs->trans("CompanySetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
......@@ -236,13 +239,13 @@ if (is_resource($handle))
if ($conf->global->SOCIETE_CODECLIENT_ADDON == "$file")
{
print "<td align=\"center\">\n";
print img_picto($langs->trans("Activated"),'on');
print img_picto($langs->trans("Activated"),'switch_on');
print "</td>\n";
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"),'off');
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
......@@ -302,13 +305,13 @@ if (is_resource($handle))
if ($conf->global->SOCIETE_CODECOMPTA_ADDON == "$file")
{
print '<td align="center">';
print img_picto($langs->trans("Activated"),'on');
print img_picto($langs->trans("Activated"),'switch_on');
print '</td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setcodecompta&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"),'off');
print img_picto($langs->trans("Disabled"),'switch_off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
......@@ -401,7 +404,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
//if ($conf->global->COMPANY_ADDON_PDF != "$name")
//{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Enabled"),'on');
print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>';
//}
//else
......@@ -415,13 +418,13 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (versioncompare($module->phpmin,versionphparray()) > 0)
{
print "<td align=\"center\">\n";
print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'off');
print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off');
print "</td>";
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
}
......@@ -578,5 +581,5 @@ dol_fiche_end();
$db->close();
llxFooter('$Date: 2011/08/16 16:49:24 $ - $Revision: 1.62 $');
llxFooter('$Date: 2011/08/17 07:50:29 $ - $Revision: 1.63 $');
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment