Qual: Uniformize code

This commit is contained in:
Laurent Destailleur 2011-09-14 12:47:51 +00:00
parent 0426a4c441
commit 3e394189e7
2 changed files with 30 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -39,14 +39,14 @@ if ($user->societe_id > 0) $socid = $user->societe_id;
//$result = restrictedArea($user, 'projet', $projectid); //$result = restrictedArea($user, 'projet', $projectid);
if (!$user->rights->projet->lire) accessforbidden(); if (!$user->rights->projet->lire) accessforbidden();
$userAccess=0;
$langs->load("users"); $langs->load("users");
$langs->load("projects"); $langs->load("projects");
$progress=GETPOST('progress'); $progress=GETPOST('progress');
$description=GETPOST('description'); $description=GETPOST('description');
$userAccess=0;
/* /*
* Actions * Actions
@ -154,7 +154,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer && (empty($proje
{ {
print_fiche_titre($langs->trans("NewTask")); print_fiche_titre($langs->trans("NewTask"));
if ($mesg) print '<div class="error">'.$mesg.'</div>'; dol_htmloutput_errors($mesg);
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -198,16 +198,14 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer && (empty($proje
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$description.'</textarea>'; print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$description.'</textarea>';
print '</td></tr>'; print '</td></tr>';
print '<tr><td colspan="2" align="center">'; print '</table>';
//if (sizeof($tasksarray))
//{ print '<center><br>';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
print ' &nbsp; &nbsp; '; print ' &nbsp; &nbsp; ';
//}
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>'; print '</center>';
print '</table>';
print '</form>'; print '</form>';
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -20,7 +20,7 @@
/** /**
* \file htdocs/projet/tasks/task.php * \file htdocs/projet/tasks/task.php
* \ingroup projet * \ingroup projet
* \brief Fiche taches d'un projet * \brief Page of a project task
*/ */
require ("../../main.inc.php"); require ("../../main.inc.php");
@ -29,8 +29,8 @@ require_once(DOL_DOCUMENT_ROOT."/projet/class/task.class.php");
require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php");
require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/html.formother.class.php");
$taskid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'')); $taskid = GETPOST("id");
$taskref = (isset($_GET["ref"])?$_GET["ref"]:''); $taskref = GETPOST("ref");
// Security check // Security check
$socid=0; $socid=0;
@ -129,7 +129,7 @@ if ($taskid)
//$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project
//$arrayofuseridoftask=$task->getListContactId('internal'); //$arrayofuseridoftask=$task->getListContactId('internal');
if ($mesg) print $mesg; dol_htmloutput_mesg($mesg);
$head=task_prepare_head($task); $head=task_prepare_head($task);
@ -144,8 +144,6 @@ if ($taskid)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
if ($mesg) print $mesg.'<br>';
// Ref // Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="30%">'.$langs->trans("Ref").'</td>';
print '<td>'.$task->ref.'</td></tr>'; print '<td>'.$task->ref.'</td></tr>';
@ -191,10 +189,13 @@ if ($taskid)
print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$task->description.'</textarea>'; print '<textarea name="description" wrap="soft" cols="80" rows="'.ROWS_3.'">'.$task->description.'</textarea>';
print '</td></tr>'; print '</td></tr>';
print '<tr><td align="center" colspan="2">';
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Modify").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';
print '<center><br>';
print '<input type="submit" class="button" name="update" value="'.$langs->trans("Modify").'"> &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<center>';
print '</form>'; print '</form>';
} }
else else
@ -255,9 +256,15 @@ if ($taskid)
print nl2br($task->description); print nl2br($task->description);
print '</td></tr>'; print '</td></tr>';
print '</table></form>'; print '</table>';
print '</div>';
}
dol_fiche_end();
if ($_GET["action"] != 'edit')
{
/* /*
* Actions * Actions
*/ */