Qual: Uniformise code. user class use id in first param of fetch
This commit is contained in:
parent
91b4bcea12
commit
527e2ecb2e
@ -50,7 +50,8 @@ $resql = $db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row($resql);
|
$row = $db->fetch_row($resql);
|
||||||
$user = new User($db, $row[0]);
|
$user = new User($db);
|
||||||
|
$user->fetch($row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$socids = array();
|
$socids = array();
|
||||||
|
|||||||
@ -52,7 +52,8 @@ $resql = $db->query($sql);
|
|||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$row = $db->fetch_row($resql);
|
$row = $db->fetch_row($resql);
|
||||||
$user = new User($db, $row[0]);
|
$user = new User($db);
|
||||||
|
$user->fetch($row[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$socids = array();
|
$socids = array();
|
||||||
|
|||||||
@ -168,16 +168,16 @@ if ($_POST["action"] == 'add_action')
|
|||||||
}
|
}
|
||||||
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
|
$actioncomm->duree=(($_POST["dureehour"] * 60) + $_POST["dureemin"]) * 60;
|
||||||
|
|
||||||
$usertodo=new User($db,$_POST["affectedto"]);
|
$usertodo=new User($db);
|
||||||
if ($_POST["affectedto"] > 0)
|
if ($_POST["affectedto"] > 0)
|
||||||
{
|
{
|
||||||
$usertodo->fetch();
|
$usertodo->fetch($_POST["affectedto"]);
|
||||||
}
|
}
|
||||||
$actioncomm->usertodo = $usertodo;
|
$actioncomm->usertodo = $usertodo;
|
||||||
$userdone=new User($db,$_POST["doneby"]);
|
$userdone=new User($db);
|
||||||
if ($_POST["doneby"] > 0)
|
if ($_POST["doneby"] > 0)
|
||||||
{
|
{
|
||||||
$userdone->fetch();
|
$userdone->fetch($_POST["doneby"]);
|
||||||
}
|
}
|
||||||
$actioncomm->userdone = $userdone;
|
$actioncomm->userdone = $userdone;
|
||||||
|
|
||||||
@ -357,16 +357,16 @@ if ($_POST["action"] == 'update')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Users
|
// Users
|
||||||
$usertodo=new User($db,$_POST["affectedto"]);
|
$usertodo=new User($db);
|
||||||
if ($_POST["affectedto"])
|
if ($_POST["affectedto"])
|
||||||
{
|
{
|
||||||
$usertodo->fetch();
|
$usertodo->fetch($_POST["affectedto"]);
|
||||||
}
|
}
|
||||||
$actioncomm->usertodo = $usertodo;
|
$actioncomm->usertodo = $usertodo;
|
||||||
$userdone=new User($db,$_POST["doneby"]);
|
$userdone=new User($db);
|
||||||
if ($_POST["doneby"])
|
if ($_POST["doneby"])
|
||||||
{
|
{
|
||||||
$userdone->fetch();
|
$userdone->fetch($_POST["doneby"]);
|
||||||
}
|
}
|
||||||
$actioncomm->userdone = $userdone;
|
$actioncomm->userdone = $userdone;
|
||||||
|
|
||||||
|
|||||||
@ -275,7 +275,7 @@ if ($resql)
|
|||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($obj->useridauthor)
|
if ($obj->useridauthor)
|
||||||
{
|
{
|
||||||
$userstatic=new User($db,$obj->useridauthor);
|
$userstatic=new User($db);
|
||||||
$userstatic->id=$obj->useridauthor;
|
$userstatic->id=$obj->useridauthor;
|
||||||
$userstatic->login=$obj->loginauthor;
|
$userstatic->login=$obj->loginauthor;
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
@ -287,7 +287,7 @@ if ($resql)
|
|||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($obj->useridtodo)
|
if ($obj->useridtodo)
|
||||||
{
|
{
|
||||||
$userstatic=new User($db,$obj->useridtodo);
|
$userstatic=new User($db);
|
||||||
$userstatic->id=$obj->useridtodo;
|
$userstatic->id=$obj->useridtodo;
|
||||||
$userstatic->login=$obj->logintodo;
|
$userstatic->login=$obj->logintodo;
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
@ -299,7 +299,7 @@ if ($resql)
|
|||||||
print '<td align="left">';
|
print '<td align="left">';
|
||||||
if ($obj->useriddone)
|
if ($obj->useriddone)
|
||||||
{
|
{
|
||||||
$userstatic=new User($db,$obj->useriddone);
|
$userstatic=new User($db);
|
||||||
$userstatic->id=$obj->useriddone;
|
$userstatic->id=$obj->useriddone;
|
||||||
$userstatic->login=$obj->logindone;
|
$userstatic->login=$obj->logindone;
|
||||||
print $userstatic->getLoginUrl(1);
|
print $userstatic->getLoginUrl(1);
|
||||||
|
|||||||
@ -243,8 +243,8 @@ if ($result)
|
|||||||
print '<tr><td width="20%">'.$langs->trans("Author")."</td>";
|
print '<tr><td width="20%">'.$langs->trans("Author")."</td>";
|
||||||
if ($objp->fk_user_author)
|
if ($objp->fk_user_author)
|
||||||
{
|
{
|
||||||
$author=new User($db,$objp->fk_user_author);
|
$author=new User($db);
|
||||||
$author->fetch();
|
$author->fetch($objp->fk_user_author);
|
||||||
print '<td colspan="4"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$author->id.'">';
|
print '<td colspan="4"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$author->id.'">';
|
||||||
print img_object($langs->trans("ShowUser"),'user').' '.$author->fullname.'</a></td>';
|
print img_object($langs->trans("ShowUser"),'user').' '.$author->fullname.'</a></td>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -333,8 +333,8 @@ else
|
|||||||
|
|
||||||
// Who
|
// Who
|
||||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||||
$userfee=new User($db,$deplacement->fk_user);
|
$userfee=new User($db);
|
||||||
$userfee->fetch();
|
$userfee->fetch($deplacement->fk_user);
|
||||||
print $userfee->getNomUrl(1);
|
print $userfee->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -137,8 +137,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
// Who
|
// Who
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td>'.$langs->trans("Person").'</td><td>';
|
print '<td>'.$langs->trans("Person").'</td><td>';
|
||||||
$userfee=new User($db,$trip->fk_user);
|
$userfee=new User($db);
|
||||||
$userfee->fetch();
|
$userfee->fetch($trip->fk_user);
|
||||||
print $userfee->getNomUrl(1);
|
print $userfee->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
|||||||
@ -140,8 +140,8 @@ if ( $db->query($sql) )
|
|||||||
|
|
||||||
if (!array_key_exists($obj->fk_user_demande,$users))
|
if (!array_key_exists($obj->fk_user_demande,$users))
|
||||||
{
|
{
|
||||||
$users[$obj->fk_user_demande] = new User($db, $obj->fk_user_demande);
|
$users[$obj->fk_user_demande] = new User($db);
|
||||||
$users[$obj->fk_user_demande]->fetch();
|
$users[$obj->fk_user_demande]->fetch($obj->fk_user_demande);
|
||||||
}
|
}
|
||||||
|
|
||||||
// User
|
// User
|
||||||
|
|||||||
@ -164,8 +164,8 @@ if ($_GET["action"] == 'edit')
|
|||||||
else print dol_nl2br($ecmdir->description);
|
else print dol_nl2br($ecmdir->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
||||||
$userecm=new User($db,$ecmdir->fk_user_c);
|
$userecm=new User($db);
|
||||||
$userecm->fetch();
|
$userecm->fetch($ecmdir->fk_user_c);
|
||||||
print $userecm->getNomUrl(1);
|
print $userecm->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
||||||
|
|||||||
@ -277,8 +277,8 @@ if ($_GET["action"] == 'edit')
|
|||||||
else print dol_nl2br($ecmdir->description);
|
else print dol_nl2br($ecmdir->description);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
print '<tr><td>'.$langs->trans("ECMCreationUser").'</td><td>';
|
||||||
$userecm=new User($db,$ecmdir->fk_user_c);
|
$userecm=new User($db);
|
||||||
$userecm->fetch();
|
$userecm->fetch($ecmdir->fk_user_c);
|
||||||
print $userecm->getNomUrl(1);
|
print $userecm->getNomUrl(1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
print '<tr><td>'.$langs->trans("ECMCreationDate").'</td><td>';
|
||||||
|
|||||||
@ -45,7 +45,8 @@ $result = restrictedArea($user, 'user', $_GET["id"], '', $feature2);
|
|||||||
|
|
||||||
if ($_POST["action"] == 'update' && ! $_POST['cancel'])
|
if ($_POST["action"] == 'update' && ! $_POST['cancel'])
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
|
$edituser->fetch($_GET["id"]);
|
||||||
|
|
||||||
$edituser->clicktodial_login = $_POST["login"];
|
$edituser->clicktodial_login = $_POST["login"];
|
||||||
$edituser->clicktodial_password = $_POST["password"];
|
$edituser->clicktodial_password = $_POST["password"];
|
||||||
|
|||||||
@ -202,7 +202,8 @@ if ($_POST["action"] == 'addgroup' && $caneditfield)
|
|||||||
{
|
{
|
||||||
if ($_POST["group"])
|
if ($_POST["group"])
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->SetInGroup($_POST["group"]);
|
$edituser->SetInGroup($_POST["group"]);
|
||||||
|
|
||||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
@ -214,7 +215,8 @@ if ($_GET["action"] == 'removegroup' && $caneditfield)
|
|||||||
{
|
{
|
||||||
if ($_GET["group"])
|
if ($_GET["group"])
|
||||||
{
|
{
|
||||||
$edituser = new User($db, $_GET["id"]);
|
$edituser = new User($db);
|
||||||
|
$edituser->fetch($_GET["id"]);
|
||||||
$edituser->RemoveFromGroup($_GET["group"]);
|
$edituser->RemoveFromGroup($_GET["group"]);
|
||||||
|
|
||||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||||
|
|||||||
@ -115,7 +115,8 @@ if ($_POST["action"] == 'adduser')
|
|||||||
$editgroup->fetch($_GET["id"]);
|
$editgroup->fetch($_GET["id"]);
|
||||||
$editgroup->oldcopy=dol_clone($editgroup);
|
$editgroup->oldcopy=dol_clone($editgroup);
|
||||||
|
|
||||||
$edituser = new User($db, $_POST["user"]);
|
$edituser = new User($db);
|
||||||
|
$edituser->fetch($_POST["user"]);
|
||||||
$result=$edituser->SetInGroup($_GET["id"]);
|
$result=$edituser->SetInGroup($_GET["id"]);
|
||||||
|
|
||||||
// We reload members (list has changed)
|
// We reload members (list has changed)
|
||||||
@ -146,7 +147,8 @@ if ($_GET["action"] == 'removeuser')
|
|||||||
$editgroup->fetch($_GET["id"]);
|
$editgroup->fetch($_GET["id"]);
|
||||||
$editgroup->oldcopy=dol_clone($editgroup);
|
$editgroup->oldcopy=dol_clone($editgroup);
|
||||||
|
|
||||||
$edituser = new User($db, $_GET["user"]);
|
$edituser = new User($db);
|
||||||
|
$edituser->fetch($_GET["user"]);
|
||||||
$edituser->RemoveFromGroup($_GET["id"]);
|
$edituser->RemoveFromGroup($_GET["id"]);
|
||||||
|
|
||||||
// We reload members (list has changed)
|
// We reload members (list has changed)
|
||||||
|
|||||||
@ -50,12 +50,12 @@ $datetimeprev = time();
|
|||||||
$month = strftime("%m", $datetimeprev);
|
$month = strftime("%m", $datetimeprev);
|
||||||
$year = strftime("%Y", $datetimeprev);
|
$year = strftime("%Y", $datetimeprev);
|
||||||
|
|
||||||
$user = new user($db, PRELEVEMENT_USER);
|
$user = new user($db);
|
||||||
|
$user->fetch(PRELEVEMENT_USER);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* View
|
||||||
* Lectures des factures
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$factures = array();
|
$factures = array();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user