New: Project creation page has a cancel button

This commit is contained in:
Laurent Destailleur 2011-07-04 08:00:52 +00:00
parent 588547ea6c
commit c341b68eae
4 changed files with 42 additions and 35 deletions

View File

@ -24,7 +24,7 @@
* \file htdocs/contact/fiche.php
* \ingroup societe
* \brief Card of a contact
* \version $Id: fiche.php,v 1.220 2011/07/02 14:53:42 eldy Exp $
* \version $Id: fiche.php,v 1.221 2011/07/04 08:00:52 eldy Exp $
*/
require("../main.inc.php");
@ -123,7 +123,14 @@ if (method_exists($objcanvas->control,'doActions'))
if (empty($reshook))
{
// Creation utilisateur depuis contact
// Cancel
if (GETPOST("cancel") && GETPOST('backtopage'))
{
header("Location: ".GETPOST('backtopage'));
exit;
}
// Creation utilisateur depuis contact
if ($_POST["action"] == 'confirm_create_user' && $_POST["confirm"] == 'yes' && $user->rights->user->user->creer)
{
// Recuperation contact actuel
@ -162,13 +169,6 @@ if (empty($reshook))
}
}
// Cancel
if (GETPOST("cancel") && GETPOST('backtopage'))
{
header("Location: ".GETPOST('backtopage'));
exit;
}
// Add contact
if (GETPOST("action") == 'add' && $user->rights->societe->contact->creer)
{
@ -974,5 +974,5 @@ else
$db->close();
llxFooter('$Date: 2011/07/02 14:53:42 $ - $Revision: 1.220 $');
llxFooter('$Date: 2011/07/04 08:00:52 $ - $Revision: 1.221 $');
?>

View File

@ -24,7 +24,7 @@
* \file htdocs/lib/company.lib.php
* \brief Ensemble de fonctions de base pour le module societe
* \ingroup societe
* \version $Id: company.lib.php,v 1.120 2011/07/03 18:32:08 eldy Exp $
* \version $Id: company.lib.php,v 1.121 2011/07/04 08:00:52 eldy Exp $
*/
/**
@ -331,9 +331,9 @@ function currency_name($code_iso,$withcode=0)
}
/**
* \brief Retourne le nom traduit de la forme juridique
* \param code Code de la forme juridique
* \return string Nom traduit du pays
* Retourne le nom traduit de la forme juridique
* @param code Code de la forme juridique
* @return string Nom traduit du pays
*/
function getFormeJuridiqueLabel($code)
{
@ -387,7 +387,8 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
$buttoncreate='';
if ($conf->projet->enabled && $user->rights->projet->creer)
{
$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").'</a>';
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddProject").' '.img_picto($langs->trans("AddProject"),'filenew').'</a>'."\n";
}
print "\n";
@ -487,7 +488,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$buttoncreate='';
if ($user->rights->societe->contact->creer)
{
$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").'</a>'."\n";
//$buttoncreate='<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").'</a>'."\n";
$buttoncreate='<a class="addnewrecord" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create&amp;backtopage='.urlencode($backtopage).'">'.$langs->trans("AddContact").' '.img_picto($langs->trans("AddContact"),'filenew').'</a>'."\n";
}
print "\n";

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 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
@ -22,7 +22,7 @@
* \file htdocs/projet/fiche.php
* \ingroup projet
* \brief Project card
* \version $Id$
* \version $Id: fiche.php,v 1.126 2011/07/04 08:00:52 eldy Exp $
*/
require("../main.inc.php");
@ -55,6 +55,13 @@ $result = restrictedArea($user, 'projet', $projectid);
* Actions
*/
// Cancel
if (GETPOST("cancel") && GETPOST('backtopage'))
{
header("Location: ".GETPOST('backtopage'));
exit;
}
if ($_POST["action"] == 'add' && $user->rights->projet->creer)
{
$error=0;
@ -270,8 +277,10 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage').'">';
print '<table class="border" width="100%">';
$project = new Project($db);
@ -323,7 +332,14 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
print '</table>';
print '<br><center><input type="submit" class="button" value="'.$langs->trans("Create").'"></center>';
print '<br><center>';
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
if (GETPOST('backtopage'))
{
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</center>';
print '</form>';
}
@ -592,5 +608,5 @@ else
$db->close();
llxFooter('$Date$ - $Revision$');
llxFooter('$Date: 2011/07/04 08:00:52 $ - $Revision: 1.126 $');
?>

View File

@ -26,7 +26,7 @@
* \file htdocs/societe/soc.php
* \ingroup societe
* \brief Third party card page
* \version $Id: soc.php,v 1.120 2011/07/02 14:51:27 eldy Exp $
* \version $Id: soc.php,v 1.121 2011/07/04 08:00:53 eldy Exp $
*/
require("../main.inc.php");
@ -1903,17 +1903,6 @@ else
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
}
/*if ($user->rights->societe->contact->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$object->id.'&amp;action=create">'.$langs->trans("AddContact").'</a>'."\n";
}
*/
/*if ($conf->projet->enabled && $user->rights->projet->creer)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/projet/fiche.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProject").'</a>'."\n";
}*/
if ($user->rights->societe->supprimer)
{
if ($conf->use_javascript_ajax)
@ -1972,5 +1961,5 @@ else
$db->close();
llxFooter('$Date: 2011/07/02 14:51:27 $ - $Revision: 1.120 $');
llxFooter('$Date: 2011/07/04 08:00:53 $ - $Revision: 1.121 $');
?>