Fix: Enregistrement en base date < 1940

New: Ajout permission "modifier ses propres infos adhérents"
This commit is contained in:
Laurent Destailleur 2008-01-25 17:40:07 +00:00
parent 6ef1ab52b2
commit dc3128e489
10 changed files with 217 additions and 158 deletions

View File

@ -18,8 +18,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
@ -31,7 +29,7 @@
\author Laurent Destailleur \author Laurent Destailleur
\author Sebastien Di Cintio \author Sebastien Di Cintio
\author Benoit Mortier \author Benoit Mortier
\version $Revision$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");

View File

@ -16,15 +16,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/adherents/fiche.php \file htdocs/adherents/fiche.php
\ingroup adherent \ingroup adherent
\brief Page d'ajout, edition, suppression d'une fiche adherent \brief Page d'ajout, edition, suppression d'une fiche adherent
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -109,7 +107,12 @@ if ($_POST["action"] == 'confirm_sendinfo' && $_POST["confirm"] == 'yes')
} }
} }
if ($user->rights->adherent->creer && $_REQUEST["action"] == 'update' && ! $_POST["cancel"]) if ($_REQUEST["action"] == 'update' && ! $_POST["cancel"])
{
$result=$adh->fetch($_POST["rowid"]);
// If change (allowed on all members) or (allowed on myself and i am edited memeber)
if ($user->rights->adherent->creer || ($user->rights->adherent->self->creer && $adh->user_id == $user->id))
{ {
$datenaiss=''; $datenaiss='';
if (isset($_POST["naissday"]) && $_POST["naissday"] if (isset($_POST["naissday"]) && $_POST["naissday"]
@ -118,9 +121,9 @@ if ($user->rights->adherent->creer && $_REQUEST["action"] == 'update' && ! $_POS
{ {
$datenaiss=dolibarr_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]); $datenaiss=dolibarr_mktime(12, 0, 0, $_POST["naissmonth"], $_POST["naissday"], $_POST["naissyear"]);
} }
//print $_POST["naissmonth"].", ".$_POST["naissday"].", ".$_POST["naissyear"]." ".$datenaiss." ".adodb_strftime('%Y-%m-%d %H:%M:%S',$datenaiss);
// Charge objet actuel // Charge objet actuel
$result=$adh->fetch($_POST["rowid"]);
if ($result > 0) if ($result > 0)
{ {
// Modifie valeures // Modifie valeures
@ -203,6 +206,7 @@ if ($user->rights->adherent->creer && $_REQUEST["action"] == 'update' && ! $_POS
} }
} }
} }
}
if ($user->rights->adherent->creer && $_POST["action"] == 'add') if ($user->rights->adherent->creer && $_POST["action"] == 'add')
{ {
@ -539,6 +543,7 @@ if ($action == 'edit')
$adho->fetch_optionals(); $adho->fetch_optionals();
$adht = new AdherentType($db); $adht = new AdherentType($db);
$adht->fetch($adh->typeid);
/* /*
@ -598,7 +603,15 @@ if ($action == 'edit')
// Type // Type
print '<tr><td>'.$langs->trans("Type").'*</td><td>'; print '<tr><td>'.$langs->trans("Type").'*</td><td>';
if ($user->rights->adherent->creer) // If $user->rights->adherent->self->creer, we do not allow.
{
$htmls->select_array("type", $adht->liste_array(), $adh->typeid); $htmls->select_array("type", $adht->liste_array(), $adh->typeid);
}
else
{
print $adht->getNomUrl(1);
print '<input type="hidden" name="type" value="'.$adh->typeid.'">';
}
print "</td></tr>"; print "</td></tr>";
// Physique-Moral // Physique-Moral
@ -965,56 +978,77 @@ if ($rowid && $action != 'edit')
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer || ($user->rights->adherent->self->creer && $adh->user_id == $user->id))
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Modify")."</a>"; print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=edit\">".$langs->trans("Modify")."</a>";
} }
else
if ($user->rights->adherent->creer)
{ {
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("Modify")."</font>";
}
// Valider // Valider
if ($adh->statut == -1) if ($adh->statut == -1)
{
if ($user->rights->adherent->creer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n"; print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Validate")."</a>\n";
} }
else
{
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("Validate")."</font>";
}
} }
if ($user->rights->adherent->creer)
{
// Reactiver // Reactiver
if ($adh->statut == 0) if ($adh->statut == 0)
{
if ($user->rights->adherent->creer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Reenable")."</a>\n"; print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=valid\">".$langs->trans("Reenable")."</a>\n";
} }
else
{
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("Reenable")."</font>";
}
} }
if ($user->rights->adherent->creer)
{
// Envoi fiche par mail // Envoi fiche par mail
if ($adh->statut >= 1 && $adh->email) if ($adh->statut >= 1 && $adh->email)
{
if ($user->rights->adherent->creer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n"; print "<a class=\"butAction\" href=\"fiche.php?rowid=$adh->id&action=sendinfo\">".$langs->trans("SendCardByMail")."</a>\n";
} }
else
{
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("SendCardByMail")."</font>";
}
} }
if ($user->rights->adherent->supprimer)
{
// Resilier // Resilier
if ($adh->statut >= 1) if ($adh->statut >= 1)
{
if ($user->rights->adherent->supprimer)
{ {
print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n"; print "<a class=\"butAction\" href=\"fiche.php?rowid=$rowid&action=resign\">".$langs->trans("Resiliate")."</a>\n";
} }
else
{
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("Resiliate")."</font>";
}
} }
// Barre d'actions // Barre d'actions
if (! $user->societe_id && ! $adh->user_id)
{
if ($user->rights->user->user->creer) if ($user->rights->user->user->creer)
{
if (! $user->societe_id)
{
if (! $adh->user_id)
{ {
print '<a class="butAction" href="fiche.php?rowid='.$adh->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'; print '<a class="butAction" href="fiche.php?rowid='.$adh->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
else
{
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("CreateDolibarrLogin")."</font>";
} }
} }
@ -1023,6 +1057,10 @@ if ($rowid && $action != 'edit')
{ {
print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n"; print "<a class=\"butActionDelete\" href=\"fiche.php?rowid=$adh->id&action=delete\">".$langs->trans("Delete")."</a>\n";
} }
else
{
print "<font class=\"butActionRefused\" href=\"#\">".$langs->trans("Delete")."</font>";
}
// Action SPIP // Action SPIP
if ($conf->global->ADHERENT_USE_SPIP) if ($conf->global->ADHERENT_USE_SPIP)

View File

@ -18,8 +18,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
@ -31,6 +29,7 @@
\file htdocs/includes/modules/modAdherent.class.php \file htdocs/includes/modules/modAdherent.class.php
\ingroup adherent \ingroup adherent
\brief Fichier de description et activation du module adherents \brief Fichier de description et activation du module adherents
\version $Id$
*/ */
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php"); include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
@ -130,11 +129,19 @@ class modAdherent extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 72; $this->rights[$r][0] = 72;
$this->rights[$r][1] = 'Creer/modifier les adherents'; $this->rights[$r][1] = 'Creer/modifier tous les adherents';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer'; $this->rights[$r][4] = 'creer';
$r++;
$this->rights[$r][0] = 73;
$this->rights[$r][1] = 'Creer/modifier ses propres infos adherents';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self';
$this->rights[$r][5] = 'creer';
$r++; $r++;
$this->rights[$r][0] = 74; $this->rights[$r][0] = 74;
$this->rights[$r][1] = 'Supprimer les adherents'; $this->rights[$r][1] = 'Supprimer les adherents';

View File

@ -94,7 +94,7 @@ class modUser extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 252; $this->rights[$r][0] = 252;
$this->rights[$r][1] = 'Cr<EFBFBD>er/modifier les autres utilisateurs, les groupes et leurs permissions'; $this->rights[$r][1] = 'Creer/modifier les autres utilisateurs, les groupes et leurs permissions';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'user'; $this->rights[$r][4] = 'user';
@ -110,7 +110,7 @@ class modUser extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 254; $this->rights[$r][0] = 254;
$this->rights[$r][1] = 'Supprimer ou d<EFBFBD>sactiver les autres utilisateurs'; $this->rights[$r][1] = 'Supprimer ou desactiver les autres utilisateurs';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'user'; $this->rights[$r][4] = 'user';
@ -118,7 +118,7 @@ class modUser extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 255; $this->rights[$r][0] = 255;
$this->rights[$r][1] = 'Cr<EFBFBD>er/modifier ses propres infos utilisateur'; $this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 1;
$this->rights[$r][4] = 'self'; $this->rights[$r][4] = 'self';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2007 Simon Desee <simon@dedisoft.com> * Copyright (C) 2007 Simon Desee <simon@dedisoft.com>
* *
@ -17,21 +17,24 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/lib/databases/mssql.lib.php \file htdocs/lib/databases/mssql.lib.php
\brief Fichier de la classe permettant de gérer une base mssql \brief Fichier de la classe permettant de gérer une base mssql
\version $Id$
*/ */
// Pour compatibilité lors de l'upgrade
if (! defined('DOL_DOCUMENT_ROOT'))
{
define('DOL_DOCUMENT_ROOT', '../..');
}
/** /**
\class DoliDb \class DoliDb
\brief Classe de gestion de la database de dolibarr \brief Classe de gestion de la database de dolibarr
*/ */
class DoliDb class DoliDb
{ {
//! Handler de base //! Handler de base
@ -514,7 +517,7 @@ class DoliDb
function idate($param) function idate($param)
{ {
//return "dbo.from_unixtime(".$param.")"; //return "dbo.from_unixtime(".$param.")";
return strftime("%d/%m/%Y %H:%M:%S",$param); return adodb_strftime("%d/%m/%Y %H:%M:%S",$param);
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org> /* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
@ -18,21 +18,25 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/lib/databases/mysql.lib.php \file htdocs/lib/databases/mysql.lib.php
\brief Fichier de la classe permettant de gérer une base mysql \brief Fichier de la classe permettant de gérer une base mysql
\version $Id$
*/ */
// Pour compatibilité lors de l'upgrade
if (! defined('DOL_DOCUMENT_ROOT'))
{
define('DOL_DOCUMENT_ROOT', '../..');
}
include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
/** /**
\class DoliDb \class DoliDb
\brief Classe de gestion de la database de dolibarr \brief Classe de gestion de la database de dolibarr
*/ */
class DoliDb class DoliDb
{ {
//! Handler de base //! Handler de base
@ -534,7 +538,7 @@ class DoliDb
*/ */
function idate($param) function idate($param)
{ {
return strftime("%Y%m%d%H%M%S",$param); return adodb_strftime("%Y%m%d%H%M%S",$param);
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org> /* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* *
@ -18,21 +18,25 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/lib/databases/mysqli.lib.php \file htdocs/lib/databases/mysqli.lib.php
\brief Fichier de la classe permettant de gérer une base mysql \brief Fichier de la classe permettant de gérer une base mysql
\version $Id$
*/ */
// Pour compatibilité lors de l'upgrade
if (! defined('DOL_DOCUMENT_ROOT'))
{
define('DOL_DOCUMENT_ROOT', '../..');
}
include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
/** /**
\class DoliDb \class DoliDb
\brief Classe permettant de gérér la database de dolibarr \brief Classe permettant de gérér la database de dolibarr
*/ */
class DoliDb class DoliDb
{ {
//! Handler de base //! Handler de base
@ -549,7 +553,7 @@ class DoliDb
*/ */
function idate($param) function idate($param)
{ {
return strftime("%Y%m%d%H%M%S",$param); return adodb_strftime("%Y%m%d%H%M%S",$param);
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org> /* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* *
@ -18,21 +18,25 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/ */
/** /**
\file htdocs/lib/databases/pgsql.lib.php \file htdocs/lib/databases/pgsql.lib.php
\brief Fichier de la classe permettant de gérér une base pgsql \brief Fichier de la classe permettant de gérér une base pgsql
\version $Id$
*/ */
// Pour compatibilité lors de l'upgrade
if (! defined('DOL_DOCUMENT_ROOT'))
{
define('DOL_DOCUMENT_ROOT', '../..');
}
include_once(DOL_DOCUMENT_ROOT."/includes/adodbtime/adodb-time.inc.php");
/** /**
\class DoliDb \class DoliDb
\brief Classe permettant de gérér la database de dolibarr \brief Classe permettant de gérér la database de dolibarr
*/ */
class DoliDb class DoliDb
{ {
var $db; // Handler de base var $db; // Handler de base
@ -475,7 +479,7 @@ class DoliDb
*/ */
function idate($param) function idate($param)
{ {
return strftime("%Y%m%d%H%M%S",$param); return adodb_strftime("%Y%m%d%H%M%S",$param);
} }

View File

@ -560,12 +560,12 @@ function dolibarr_print_date($time,$format='')
$smin = $reg[5]; $smin = $reg[5];
$ssec = $reg[6]; $ssec = $reg[6];
return strftime($format,dolibarr_mktime($shour,$smin,$ssec,$smonth,$sday,$syear)); return adodb_strftime($format,dolibarr_mktime($shour,$smin,$ssec,$smonth,$sday,$syear));
} }
else else
{ {
// Date est un timestamps // Date est un timestamps
return strftime($format,$time); return adodb_strftime($format,$time);
} }
} }

View File

@ -202,6 +202,7 @@ print '<tr><td width="25%" valign="top">'.$langs->trans("Firstname").'</td>';
print '<td colspan="2">'.$fuser->prenom.'</td>'; print '<td colspan="2">'.$fuser->prenom.'</td>';
print "</tr>\n"; print "</tr>\n";
print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
print '</table><br>'; print '</table><br>';